Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1szMlu-005gVz-E8 for pgsql-admin@arkaria.postgresql.org; Fri, 11 Oct 2024 21:02:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1szMls-00BZPW-93 for pgsql-admin@arkaria.postgresql.org; Fri, 11 Oct 2024 21:02:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1szMlr-00BZPO-Px for pgsql-admin@lists.postgresql.org; Fri, 11 Oct 2024 21:02:00 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1szMlp-000Q6R-JZ for pgsql-admin@postgresql.org; Fri, 11 Oct 2024 21:01:58 +0000 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2e30fb8cb07so372720a91.3 for ; Fri, 11 Oct 2024 14:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728680517; x=1729285317; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Lmdk0O5/WYtTXwbejVaRrUQkLNr9TTgL1Jy/i5IFGjo=; b=XZSiPqLe6b8ZquZEfx6b9YgJbWwAFGAd5PR9ZqaAnywjKTsst1jIqnQ7hDG+FnQEY4 RhurEaT8T/gL/ew/5UOUTH+Xdy6TKZXXWpYj88zyy1Uc618PGmFGxPYWgXNjDOEVrvrL eNjWT4bQ90jlmsIqdk6PmQpzDB5I+jbwBuzsCalLMzH8JmisXu/6uWc8y3JzXwrm7JlS yiWBeTw9XBNLDpleDMOa8fOSl66bN3fVCS5yp+/o7MROcAttv1LKeYcJae4zk3q1W1+z 7MntuzXWjEsmTcJhRo5vfjstj795L85ENnRigo2Iqm9K6xwYQDz5MvEGacSzpaFOqi0C /zvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728680517; x=1729285317; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Lmdk0O5/WYtTXwbejVaRrUQkLNr9TTgL1Jy/i5IFGjo=; b=uTRkJaTy2gTezza+OCfmCZh/U2ZM/E4ki0o1zG9UPeMPMduy+zR/DA6QcNCRoUuoY4 1ygYu0/pF1Jf4KJDMjyyMagXrn6zICLFz/9RcOHz32WkpfrTv7pVpSacOlXbYwetwF0d CB1mUnYKyp7G/UwjahNRuTRDOYnauFftzlnRo+e0q25MR/8djRGBqcNbuHLWxEeBn0gu pbC/TZATqhOY4kXscM/hEB8A0w4yoJM84YSiIZ+M1rttYKdYhpOsItCX8s6G00Ou0dlz lanwgQ6GfPkTUL4ldvGP9juo++uuwhXOrmTCTHOrRER5z8j+8aV36kC1TqJ271bbmhXR mq+Q== X-Forwarded-Encrypted: i=1; AJvYcCUQn9TLJgV0xXEgThnlGSsKZyl4tJdcprof2VHjf89CIoBf5ZLvYJ2vn3EIXIqbrGz75lM3YXKBtm13MQ==@postgresql.org X-Gm-Message-State: AOJu0Yz146duDNyOiCLmHwXmASkT4jcPt/3uC3DOExUrpz/8S87t5UIA 0WlN19541ybiSb9V3hecPHLSwzpe5GXMc1NusQws6DM7P8cLMQwX0fcuOmK0FRFbU95mLgvHBpT 3QbMC6PKkTJJtGwuvDzYRm1RCZCA= X-Google-Smtp-Source: AGHT+IHOZzN7rslLS7Itqk5Fi3eyAgy8VU5V3k2L3v8mLCEcPEqSzR2KPoLEP4VZ9/sgQC4irUAwfknLwiHGEOBBaTY= X-Received: by 2002:a17:90b:46c2:b0:2e0:f81c:731f with SMTP id 98e67ed59e1d1-2e2f0af2ed8mr4767311a91.24.1728680516653; Fri, 11 Oct 2024 14:01:56 -0700 (PDT) MIME-Version: 1.0 References: <6b344a9d0ae654ca0bda0381a2f7f96df76ae3b2.camel@cybertec.at> <1eb200f88003972f2723967ddc95b70b3e61f5de.camel@cybertec.at> In-Reply-To: From: Imran Khan Date: Sat, 12 Oct 2024 00:01:43 +0300 Message-ID: Subject: Re: Unknown temp directories and library files To: Jeff Janes Cc: Laurenz Albe , Priancka Chatz , pgsql-admin Content-Type: multipart/alternative; boundary="000000000000201db9062439cc0b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000201db9062439cc0b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable In that case involving OS admin make sense. On Fri, Oct 11, 2024, 11:51=E2=80=AFPM Jeff Janes wr= ote: > > > On Fri, Oct 11, 2024 at 4:16=E2=80=AFPM Laurenz Albe > wrote: > >> On Fri, 2024-10-11 at 15:47 +0200, Priancka Chatz wrote: >> > On Fri, Oct 11, 2024 at 3:09=E2=80=AFPM Laurenz Albe >> wrote: >> > > On Thu, 2024-10-10 at 12:22 +0200, Priancka Chatz wrote: >> > > > I am observing a new/unknown behavior on some of my instances. My >> postgres Data >> > > > directory path is /home/postgres/pgdata/pgroot/data. And I see a >> temp directory >> > > > present inside /home/postgres/pgdata which has 100s of directory >> underneath it >> > > > and inside each directory some library files related to Psycopg2. >> Not sure what >> > > > these files are and why it is getting created. I am attaching >> screenshots for reference. >> > > > Can anyone shed some light or direct me to any links to >> troubleshoot this? >> > > >> > > I'd say somebody broke into your database and is abusing it for his >> purposes. >> > > >> > > If that proves true, rescue what you can of the data and start with = a >> new >> > > installation, preferably with better security. >> >> I have no conclusive proof for abuse, but a library has no business in >> "pgsql_tmp". >> That looks very much like somebody guessed your superuser password and i= s >> hijacking >> the operating system account. >> > > But he didn't say they were in pgsql_tmp, just that they were in some tem= p > directory apparently 3 or 4 levels higher in the directory tree than wher= e > I would expect pgsql_tmp to be. To me this looks like some cruft left ove= r > from some sysadmin running the python package manager, perhaps while logg= ed > in as the wrong user. (Although I suppose that running a package manager = as > the wrong user is also something a hacker might try to do...) > > Cheers, > > Jeff > --000000000000201db9062439cc0b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
In that=C2=A0case involving OS admin make sense.
On Fri, O= ct 11, 2024, 11:51=E2=80=AFPM Jeff Janes <jeff.janes@gmail.com> wrote:


On Fri, Oct 11, 2024 at 4:= 16=E2=80=AFPM Laurenz Albe <laurenz.albe@cybertec.at> wrote= :
On Fri, 2024-1= 0-11 at 15:47 +0200, Priancka Chatz wrote:
> On Fri, Oct 11, 2024 at 3:09=E2=80=AFPM Laurenz Albe <laurenz= .albe@cybertec.at> wrote:
> > On Thu, 2024-10-10 at 12:22 +0200, Priancka Chatz wrote:
> > > I am observing a new/unknown behavior on some of my instance= s. My postgres Data
> > > directory path is /home/postgres/pgdata/pgroot/data. And I s= ee a temp directory
> > > present inside /home/postgres/pgdata which has 100s of direc= tory underneath it
> > > and inside each directory some library files related to Psyc= opg2. Not sure what
> > > these files are and why it is getting created. I am attachin= g screenshots for reference.
> > > Can anyone shed some light or direct me to any links to trou= bleshoot this?
> >
> > I'd say somebody broke into your database and is abusing it f= or his purposes.
> >
> > If that proves true, rescue what you can of the data and start wi= th a new
> > installation, preferably with better security.

I have no conclusive proof for abuse, but a library has no business in &quo= t;pgsql_tmp".
That looks very much like somebody guessed your superuser password and is h= ijacking
the operating system account.

But he di= dn't say they were in pgsql_tmp, just that they were in some temp direc= tory apparently 3 or 4 levels higher in the directory tree than where I wou= ld expect pgsql_tmp to be. To me this looks like some cruft left over from = some sysadmin running the python package manager, perhaps while logged in a= s the wrong user. (Although I suppose that running a package manager as the= wrong user is also something a hacker might try to do...)

Cheers,

Jeff
--000000000000201db9062439cc0b--