pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedPGSQL 10, many Random named DB
11+ messages / 9 participants
[nested] [flat]
* PGSQL 10, many Random named DB
@ 2018-01-24 10:52 Durumdara <durumdara@gmail.com>
2018-01-24 11:06 ` Re: PGSQL 10, many Random named DB Adam Tauno Williams <awilliam@whitemice.org>
2018-01-24 11:18 ` Re: PGSQL 10, many Random named DB Condor <condor@stz-bg.com>
2018-01-24 13:42 ` Re: PGSQL 10, many Random named DB Adrian Klaver <adrian.klaver@aklaver.com>
2018-01-24 17:22 ` Re: PGSQL 10, many Random named DB Merlin Moncure <mmoncure@gmail.com>
2018-01-25 16:51 ` Re: PGSQL 10, many Random named DB Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 5 replies; 11+ messages in thread
From: Durumdara @ 2018-01-24 10:52 UTC (permalink / raw)
To: pgsql-general
Hello!
Somewhere the system administrator (who don't know the PG really) installed
a PGSQL server (10.x) with a database.
He couldn't manage the server well.
Yesterday my colleague saw 21 databases in this server with random names.
He checked it with built in PGAdmin IV.
Today we checked it again, and we saw 33 databases.
The first name is "ahucli" for example - like an aztec king... :-).
The server OS is Windows, the PGSQL is 10.x.
What can cause this strange thing?
1.) PGAdmin IV bug?
2.) Their server is hacked/cracked from outside?
3.) A wrong configured tool, or an automation?
4.) "Alien invasion", etc.
Did you see same thing anywhere?
Thank you for any advice in this theme!
Best regards
dd
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
@ 2018-01-24 11:06 ` Adam Tauno Williams <awilliam@whitemice.org>
4 siblings, 0 replies; 11+ messages in thread
From: Adam Tauno Williams @ 2018-01-24 11:06 UTC (permalink / raw)
To: pgsql-general
> 1.) PGAdmin IV bug?
> 2.) Their server is hacked/cracked from outside?
> 3.) A wrong configured tool, or an automation?
> 4.) "Alien invasion", etc.
> Did you see same thing anywhere?
Are their connections to the server? What does "netstat" tell you?
--
Meetings Coordinator, Michigan Association of Railroad Passengers
537 Shirley St NE Grand Rapids, MI 49503-1754 Phone: 616.581.8010
E-mail: awilliam@whitemice.org GPG#D95ED383 Web: http://www.marp.org
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
@ 2018-01-24 11:18 ` Condor <condor@stz-bg.com>
2018-01-24 11:27 ` Re: PGSQL 10, many Random named DB Vincenzo Romano <vincenzo.romano@notorand.it>
4 siblings, 1 reply; 11+ messages in thread
From: Condor @ 2018-01-24 11:18 UTC (permalink / raw)
To: Durumdara <durumdara@gmail.com>; +Cc: pgsql-general
On 24-01-2018 12:52, Durumdara wrote:
> Hello!
>
> Somewhere the system administrator (who don't know the PG really)
> installed a PGSQL server (10.x) with a database.
> He couldn't manage the server well.
>
> Yesterday my colleague saw 21 databases in this server with random
> names.
>
> He checked it with built in PGAdmin IV.
> Today we checked it again, and we saw 33 databases.
>
> The first name is "ahucli" for example - like an aztec king... :-).
>
> The server OS is Windows, the PGSQL is 10.x.
>
> What can cause this strange thing?
>
> 1.) PGAdmin IV bug?
> 2.) Their server is hacked/cracked from outside?
> 3.) A wrong configured tool, or an automation?
> 4.) "Alien invasion", etc.
>
> Did you see same thing anywhere?
>
> Thank you for any advice in this theme!
>
> Best regards
> dd
I bet on 2.
probably did not setup pg_hba.conf file.
Regards,
HC
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
2018-01-24 11:18 ` Re: PGSQL 10, many Random named DB Condor <condor@stz-bg.com>
@ 2018-01-24 11:27 ` Vincenzo Romano <vincenzo.romano@notorand.it>
0 siblings, 0 replies; 11+ messages in thread
From: Vincenzo Romano @ 2018-01-24 11:27 UTC (permalink / raw)
To: Condor <condor@stz-bg.com>; +Cc: Durumdara <durumdara@gmail.com>; pgsql-general
2018-01-24 12:18 GMT+01:00 Condor <condor@stz-bg.com>:
> On 24-01-2018 12:52, Durumdara wrote:
>>
>> Hello!
>>
>> Somewhere the system administrator (who don't know the PG really)
>> installed a PGSQL server (10.x) with a database.
>> He couldn't manage the server well.
>>
>> Yesterday my colleague saw 21 databases in this server with random
>> names.
>>
>> He checked it with built in PGAdmin IV.
>> Today we checked it again, and we saw 33 databases.
>>
>> The first name is "ahucli" for example - like an aztec king... :-).
>>
>> The server OS is Windows, the PGSQL is 10.x.
>>
>> What can cause this strange thing?
>>
>> 1.) PGAdmin IV bug?
>> 2.) Their server is hacked/cracked from outside?
>> 3.) A wrong configured tool, or an automation?
>> 4.) "Alien invasion", etc.
>>
>> Did you see same thing anywhere?
>>
>> Thank you for any advice in this theme!
>>
>> Best regards
>> dd
>
>
>
>
> I bet on 2.
> probably did not setup pg_hba.conf file.
>
> Regards,
> HC
>
The logs are your friends.
Maybe you can track down those "CREATE DATABASE" commands with
timestamps and IP addresses.
There could be a (local rogue) piece of software that does this trick.
Again, check with logs.
--
Vincenzo Romano - NotOrAnd.IT
Information Technologies
--
NON QVIETIS MARIBVS NAVTA PERITVS
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
@ 2018-01-24 13:42 ` Adrian Klaver <adrian.klaver@aklaver.com>
4 siblings, 0 replies; 11+ messages in thread
From: Adrian Klaver @ 2018-01-24 13:42 UTC (permalink / raw)
To: Durumdara <durumdara@gmail.com>; pgsql-general
On 01/24/2018 02:52 AM, Durumdara wrote:
> Hello!
>
> Somewhere the system administrator (who don't know the PG really)
> installed a PGSQL server (10.x) with a database.
> He couldn't manage the server well.
>
> Yesterday my colleague saw 21 databases in this server with random names.
> He checked it with built in PGAdmin IV.
> Today we checked it again, and we saw 33 databases.
>
> The first name is "ahucli" for example - like an aztec king... :-).
>
> The server OS is Windows, the PGSQL is 10.x.
>
> What can cause this strange thing?
>
> 1.) PGAdmin IV bug?
I doubt it but easy enough to double check. Use the psql command line
tool and do \l. Or find the $PGDATA
directory(https://www.postgresql.org/docs/10/static/storage-file-layout.html)
and see how many sub-directories there are base/ where each
sub-directory is a database.
> 2.) Their server is hacked/cracked from outside?
Is this server accessible from the outside?
> 3.) A wrong configured tool, or an automation?
My bet. Per Vincenzo's post check the logs.
> 4.) "Alien invasion", etc.
>
> Did you see same thing anywhere?
>
> Thank you for any advice in this theme!
>
> Best regards
> dd
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
@ 2018-01-24 17:22 ` Merlin Moncure <mmoncure@gmail.com>
2018-01-24 17:40 ` Re: PGSQL 10, many Random named DB Rob Sargent <robjsargent@gmail.com>
4 siblings, 1 reply; 11+ messages in thread
From: Merlin Moncure @ 2018-01-24 17:22 UTC (permalink / raw)
To: Durumdara <durumdara@gmail.com>; +Cc: pgsql-general
On Wed, Jan 24, 2018 at 4:52 AM, Durumdara <durumdara@gmail.com> wrote:
> Hello!
>
> Somewhere the system administrator (who don't know the PG really) installed
> a PGSQL server (10.x) with a database.
> He couldn't manage the server well.
>
> Yesterday my colleague saw 21 databases in this server with random names.
> He checked it with built in PGAdmin IV.
> Today we checked it again, and we saw 33 databases.
>
> The first name is "ahucli" for example - like an aztec king... :-).
>
> The server OS is Windows, the PGSQL is 10.x.
>
> What can cause this strange thing?
>
> 1.) PGAdmin IV bug?
> 2.) Their server is hacked/cracked from outside?
> 3.) A wrong configured tool, or an automation?
> 4.) "Alien invasion", etc.
>
> Did you see same thing anywhere?
>
> Thank you for any advice in this theme!
You could be looking at a very serious situation. Random data stored
without your knowledge can be symptom of a hack or simple bug.
Figuring out which is which is a very urgent consideration. You may
want to consider:
*) poke around created database and try to determine if the created
databases point to something you created or more suspicious things.
this is URGENT
*) review firewall and network configuration
*) review pg_hba.conf
*) generally check logs everywhere, be advised hackers are often smart
and covert tracks
*) log all connections. adjust logging to also capture client ip and
pid if not already
*) log all queries (also with ajustments above). this is expensive,
so be prepared to turn off when problem is found
merlin
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
2018-01-24 17:22 ` Re: PGSQL 10, many Random named DB Merlin Moncure <mmoncure@gmail.com>
@ 2018-01-24 17:40 ` Rob Sargent <robjsargent@gmail.com>
2018-01-24 18:12 ` Re: PGSQL 10, many Random named DB Melvin Davidson <melvin6925@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Rob Sargent @ 2018-01-24 17:40 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 01/24/2018 10:22 AM, Merlin Moncure wrote:
> On Wed, Jan 24, 2018 at 4:52 AM, Durumdara <durumdara@gmail.com> wrote:
>> Hello!
>>
>> Somewhere the system administrator (who don't know the PG really) installed
>> a PGSQL server (10.x) with a database.
>> He couldn't manage the server well.
>>
>> Yesterday my colleague saw 21 databases in this server with random names.
>> He checked it with built in PGAdmin IV.
>> Today we checked it again, and we saw 33 databases.
>>
>> The first name is "ahucli" for example - like an aztec king... :-).
>>
>> The server OS is Windows, the PGSQL is 10.x.
>>
>> What can cause this strange thing?
>>
>> 1.) PGAdmin IV bug?
>> 2.) Their server is hacked/cracked from outside?
>> 3.) A wrong configured tool, or an automation?
>> 4.) "Alien invasion", etc.
>>
>> Did you see same thing anywhere?
>>
>> Thank you for any advice in this theme!
> You could be looking at a very serious situation. Random data stored
> without your knowledge can be symptom of a hack or simple bug.
> Figuring out which is which is a very urgent consideration. You may
> want to consider:
>
> *) poke around created database and try to determine if the created
> databases point to something you created or more suspicious things.
> this is URGENT
> *) review firewall and network configuration
> *) review pg_hba.conf
> *) generally check logs everywhere, be advised hackers are often smart
> and covert tracks
> *) log all connections. adjust logging to also capture client ip and
> pid if not already
> *) log all queries (also with ajustments above). this is expensive,
> so be prepared to turn off when problem is found
>
> merlin
>
Step one for me would be to unplug the ethernet cable. If it in some
unaccessible place shut it down, make it accessible, then go with
Merlins list.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
2018-01-24 17:22 ` Re: PGSQL 10, many Random named DB Merlin Moncure <mmoncure@gmail.com>
2018-01-24 17:40 ` Re: PGSQL 10, many Random named DB Rob Sargent <robjsargent@gmail.com>
@ 2018-01-24 18:12 ` Melvin Davidson <melvin6925@gmail.com>
2018-01-25 09:38 ` Re: PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Melvin Davidson @ 2018-01-24 18:12 UTC (permalink / raw)
To: Rob Sargent <robjsargent@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
On Wed, Jan 24, 2018 at 12:40 PM, Rob Sargent <robjsargent@gmail.com> wrote:
>
>
> On 01/24/2018 10:22 AM, Merlin Moncure wrote:
>
>> On Wed, Jan 24, 2018 at 4:52 AM, Durumdara <durumdara@gmail.com> wrote:
>>
>>> Hello!
>>>
>>> Somewhere the system administrator (who don't know the PG really)
>>> installed
>>> a PGSQL server (10.x) with a database.
>>> He couldn't manage the server well.
>>>
>>> Yesterday my colleague saw 21 databases in this server with random names.
>>> He checked it with built in PGAdmin IV.
>>> Today we checked it again, and we saw 33 databases.
>>>
>>> The first name is "ahucli" for example - like an aztec king... :-).
>>>
>>> The server OS is Windows, the PGSQL is 10.x.
>>>
>>> What can cause this strange thing?
>>>
>>> 1.) PGAdmin IV bug?
>>> 2.) Their server is hacked/cracked from outside?
>>> 3.) A wrong configured tool, or an automation?
>>> 4.) "Alien invasion", etc.
>>>
>>> Did you see same thing anywhere?
>>>
>>> Thank you for any advice in this theme!
>>>
>> You could be looking at a very serious situation. Random data stored
>> without your knowledge can be symptom of a hack or simple bug.
>> Figuring out which is which is a very urgent consideration. You may
>> want to consider:
>>
>> *) poke around created database and try to determine if the created
>> databases point to something you created or more suspicious things.
>> this is URGENT
>> *) review firewall and network configuration
>> *) review pg_hba.conf
>> *) generally check logs everywhere, be advised hackers are often smart
>> and covert tracks
>> *) log all connections. adjust logging to also capture client ip and
>> pid if not already
>> *) log all queries (also with ajustments above). this is expensive,
>> so be prepared to turn off when problem is found
>>
>> merlin
>>
>> Step one for me would be to unplug the ethernet cable. If it in some
> unaccessible place shut it down, make it accessible, then go with Merlins
> list.
>
>
>
In addition to all previous suggestions, you might also want to consider
the following.
1. Look at the schemas of the existings and new databases. Are they
similar? If so,
this is possibly a condition of poor application design, where each
new client/customer gets their own database.
2. Are the existing / new databases growing in size, or they becoming
stable?
Use the following queries to check their sizes daily (or hourly).
SELECT oid,
datname,
pg_size_pretty(pg_database_size(datname))as
size_pretty,
pg_database_size(datname) as size,
(SELECT pg_size_pretty (SUM(
pg_database_size(datname))::bigint)
FROM pg_database) AS total,
((pg_database_size(datname) / (SELECT SUM(
pg_database_size(datname))
FROM pg_database) ) * 100)::numeric(6,3) AS pct
FROM pg_database
ORDER BY datname;
SELECT n.nspname as schema,
c.relname as table,
a.rolname as owner,
c.relfilenode as filename,
c.reltuples::bigint,
pg_size_pretty(pg_relation_size(n.nspname|| '.' ||
c.relname)) as size,
pg_size_pretty(pg_total_relation_size(n.nspname||
'.' || c.relname)) as total_size,
pg_relation_size(n.nspname|| '.' || c.relname) as
size_bytes,
pg_total_relation_size(n.nspname|| '.' || c.relname)
as total_size_bytes,
CASE WHEN c.reltablespace = 0
THEN 'pg_default'
ELSE (SELECT t.spcname
FROM pg_tablespace t
WHERE (t.oid =
c.reltablespace) )
END as tablespace
FROM pg_class c
JOIN pg_namespace n ON (n.oid = c.relnamespace)
JOIN pg_authid a ON ( a.oid = c.relowner )
WHERE n.nspname NOT LIKE 'pg_%'
AND relname NOT LIKE 'pg_%'
AND relname NOT LIKE 'information%'
AND relname NOT LIKE 'sql_%'
AND relkind IN ('r')
ORDER BY total_size_bytes DESC, 1, 2;
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
2018-01-24 17:22 ` Re: PGSQL 10, many Random named DB Merlin Moncure <mmoncure@gmail.com>
2018-01-24 17:40 ` Re: PGSQL 10, many Random named DB Rob Sargent <robjsargent@gmail.com>
2018-01-24 18:12 ` Re: PGSQL 10, many Random named DB Melvin Davidson <melvin6925@gmail.com>
@ 2018-01-25 09:38 ` Durumdara <durumdara@gmail.com>
2018-01-25 21:54 ` Re: PGSQL 10, many Random named DB Merlin Moncure <mmoncure@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Durumdara @ 2018-01-25 09:38 UTC (permalink / raw)
To: ; +Cc: pgsql-general@lists.postgresql.org
Dear Members!
Thank you for the suggestions.
Yes, the sysadmin allowed incoming connections from net.
We will check your list when we are there.
Thank you again!
Best wishes
dd
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
2018-01-24 17:22 ` Re: PGSQL 10, many Random named DB Merlin Moncure <mmoncure@gmail.com>
2018-01-24 17:40 ` Re: PGSQL 10, many Random named DB Rob Sargent <robjsargent@gmail.com>
2018-01-24 18:12 ` Re: PGSQL 10, many Random named DB Melvin Davidson <melvin6925@gmail.com>
2018-01-25 09:38 ` Re: PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
@ 2018-01-25 21:54 ` Merlin Moncure <mmoncure@gmail.com>
0 siblings, 0 replies; 11+ messages in thread
From: Merlin Moncure @ 2018-01-25 21:54 UTC (permalink / raw)
To: Durumdara <durumdara@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
On Thu, Jan 25, 2018 at 3:38 AM, Durumdara <durumdara@gmail.com> wrote:
> Dear Members!
>
> Thank you for the suggestions.
> Yes, the sysadmin allowed incoming connections from net.
> We will check your list when we are there.
Don't bother. We have a confirmed attack, time to take immediate remediation.
1. Disconnect machine from network _immediately_ and move to DMZ
2. Create new server and dump/restore data to the new machine
3. Determine if hacker was able to compromise to the rest of your
network. Warning signs:
*) installed extensions you didn't install dblink, plsh, plperl, etc
*) strange errors in database log
*) starnge errors syslog (is this linux/unix?)
4. Poor network security (hands free ps access to other boxes, etc)
Put short, you have to assume your network is compromised and only
change that assumption when disproven. These days, if hacker has
shell access you pretty much have reinstall the box from the ground
up. Root escalation is a thing (there are probably meltdown related
escalations out there) and once the hacker has root it's game over.
In fact, in some cases you have to throw out the hardware too.
merlin
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: PGSQL 10, many Random named DB
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
@ 2018-01-25 16:51 ` Laurenz Albe <laurenz.albe@cybertec.at>
4 siblings, 0 replies; 11+ messages in thread
From: Laurenz Albe @ 2018-01-25 16:51 UTC (permalink / raw)
To: Durumdara <durumdara@gmail.com>; pgsql-general
Durumdara wrote:
> Somewhere the system administrator (who don't know the PG really) installed a PGSQL server (10.x) with a database.
> He couldn't manage the server well.
>
> Yesterday my colleague saw 21 databases in this server with random names.
> He checked it with built in PGAdmin IV.
> Today we checked it again, and we saw 33 databases.
>
> The first name is "ahucli" for example - like an aztec king... :-).
>
> The server OS is Windows, the PGSQL is 10.x.
>
> What can cause this strange thing?
>
> 1.) PGAdmin IV bug?
> 2.) Their server is hacked/cracked from outside?
> 3.) A wrong configured tool, or an automation?
> 4.) "Alien invasion", etc.
Must be aliens.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2018-01-25 21:54 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24 10:52 PGSQL 10, many Random named DB Durumdara <durumdara@gmail.com>
2018-01-24 11:06 ` Adam Tauno Williams <awilliam@whitemice.org>
2018-01-24 11:18 ` Condor <condor@stz-bg.com>
2018-01-24 11:27 ` Vincenzo Romano <vincenzo.romano@notorand.it>
2018-01-24 13:42 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-01-24 17:22 ` Merlin Moncure <mmoncure@gmail.com>
2018-01-24 17:40 ` Rob Sargent <robjsargent@gmail.com>
2018-01-24 18:12 ` Melvin Davidson <melvin6925@gmail.com>
2018-01-25 09:38 ` Durumdara <durumdara@gmail.com>
2018-01-25 21:54 ` Merlin Moncure <mmoncure@gmail.com>
2018-01-25 16:51 ` Laurenz Albe <laurenz.albe@cybertec.at>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox