TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A picture got my PostgreSQL database to start mining Monero

459 pointsby WhiteSource1about 7 years ago

20 comments

craigkerstiensabout 7 years ago
The short story of this is:<p>- Gain access to the database itself<p>- And the Postgres database should be vulnerable to various remote code execution<p>- Once they&#x27;re able to execute code remotely, they then download an image which has binary data tacked onto it<p>- They then parse out the executable part of the image using dd<p>- Then they&#x27;re able to execute and mine away<p>While an interesting read the shortest takeaway is:<p>1. Don&#x27;t leave your Postgres open to the public internet and<p>2. Ensure to upgrade when security releases come out.<p>If you&#x27;re unsure if the version your on has security patches available or other reasons to upgrade consider checking out <a href="https:&#x2F;&#x2F;why-upgrade.depesz.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;why-upgrade.depesz.com&#x2F;</a><p>Edit: Looks like the user that gained access had ability to execute pl&#x2F;c. Which has to run as superuser. You won&#x27;t find things like pl&#x2F;c, pl&#x2F;python generally supported on most Postgres services like Heroku, RDS, Citus because of just this reason. So in this case database access with pl&#x2F;c was enabled, suspect could have been done equally via other vectors (once database access was achieved).
评论 #16620633 未加载
评论 #16622659 未加载
评论 #16618714 未加载
评论 #16618476 未加载
评论 #16619070 未加载
评论 #16624634 未加载
评论 #16619011 未加载
hans_castorpabout 7 years ago
Creating a C language function is not allowed to regular users by default because &quot;language C&quot; is an untrusted language only superusers can create functions using that. Additionally, regular users don&#x27;t have the privileges to insert into pg_proc. So unless the attacked application uses a superuser for database access (which is a big security hole to begin with) or uses a superuser account with a weak password and allow superuser access from the outside, I don&#x27;t see how this could be exploited.
评论 #16618454 未加载
评论 #16621691 未加载
评论 #16618755 未加载
tristanhoabout 7 years ago
&gt; This attack’s Monero address has done more than 312.5 XMR so far, valued with more than $90,000 to date.<p>Wow. IMO buried lede. That is... very impressive.
kyle-rbabout 7 years ago
I&#x27;m going to train a model to detect pictures of Scarlett Johansson to prevent this type of attack in the future.
评论 #16619440 未加载
jacob019about 7 years ago
It&#x27;s amazing that in 2018 people leave databases publicly exposed.
评论 #16617937 未加载
评论 #16618076 未加载
评论 #16618194 未加载
评论 #16619447 未加载
评论 #16617987 未加载
yreadabout 7 years ago
I thought this was one of those files that are an image and an executable AT THE SAME TIME. Slightly disappointed that it&#x27;s just catted together
评论 #16618227 未加载
评论 #16618115 未加载
评论 #16618207 未加载
phyzomeabout 7 years ago
Clickbait headline. Was expecting a weird Postgres buffer overflow or something, instead it&#x27;s a honeypot and the picture is almost completely irrelevant (just a matter of where the attacker hosted their binary).
tehwebguyabout 7 years ago
So how can one protect against an image with a payload?<p>Would the payload still be there if the image was rebuilt with Imagemagick?
评论 #16618360 未加载
评论 #16620003 未加载
评论 #16618468 未加载
评论 #16618400 未加载
redspectreabout 7 years ago
These attacks are not interesting. They require superuser functionality. Can&#x27;t believe this wasn&#x27;t mentioned. If someone has superuser access on your database, it&#x27;s game over.<p>The real solution is not to go around making DBAs&#x27; lives harder by disabling all this stuff. The real solution is to not give attackers on the internet superuser access on your database!!! Why is the database exposed to the public internet to begin with?
jjoeabout 7 years ago
<i>Do you see the binary code? It’s right below her left elbow!</i><p>It takes someone with astute observation skills to see this.
评论 #16619568 未加载
Analemma_about 7 years ago
This reminds me of SQL Slammer. Remember that? After that mess, there were Slashdot threads just like we have HN threads right now, and the overwhelming consensus among the sysadmins there was, &quot;Database servers should <i>never</i> be visible to the public Internet. They should always be behind a VPN or application server&quot;. And then, as is usual for nerd fora, someone would try to come up with a counterexample, &quot;But what if...&quot;, and the sysadmins would just cut them off with, &quot;No. Never ever.&quot;<p>That hasn&#x27;t changed, folks. If someone on the Internet can talk to your Postgres database, you are Doing It Wrong.
EGregabout 7 years ago
How exactly can this be exploited?<p>Who has to run the Postgres database?<p>In what kind of way does it has to be accessed to get this happening?<p>Are we talking about web apps that use Postgres on the back end and run arbitrary queries?<p>Are we talking about people who somehow extract the Postgres database username and password and it has admin permissions?<p>I wasn&#x27;t sure what&#x27;s happening.
评论 #16618175 未加载
prependabout 7 years ago
How does the image get executed? I went through the article and in the example the author extracts the executable manually using dd.<p>But how would an unsuspecting user run the executable? Perhaps I missed this, but is there some image viewer or browser that runs the trailing bytes of images?
评论 #16618050 未加载
评论 #16618040 未加载
znpyabout 7 years ago
I am studying towards the RHCSA (Red Hat Certified System Administrator) and right now I am learning about SELinux.<p>I am fairly sure that this could have been prevented by SELinux.
samstaveabout 7 years ago
Why would you have your (ANY) db directly publicly accessible?
评论 #16622144 未加载
jyriandabout 7 years ago
This title makes zero sense.
blattimwindabout 7 years ago
Ironically unavailable due to an &quot;error establishing a database connection&quot;.
评论 #16618030 未加载
评论 #16618578 未加载
snitch182about 7 years ago
Kind of funny, but klicking the link says the database is down.<p>&quot;Error establishing a database connection&quot;
评论 #16618216 未加载
andrewshaduraabout 7 years ago
Postgres, not Postgre.
评论 #16617897 未加载
knorkerabout 7 years ago
The short story of this is:<p>Cryptocurrencies are run on, by, and for crime. It&#x27;s immoral to participate in cryptocurrencies. You wouldn&#x27;t be a member of a club that had people like this owning the club house and everyone on the board, but due to pure greed and wilful ignorance people keep &quot;investing&quot; in this organized crime.<p>Shame on you all.
评论 #16625532 未加载