[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


Janitor acceptance emails will be sent out over the coming weeks. Make sure to check your spam folder!


[Advertise on 4chan]


File: pepefrogg.png (295 KB, 840x720)
295 KB PNG
My website got hacked. The hacker got to the .php files on my server and they included my mysql password in plaintext, like this:

>mysql_connect("localhost", "me", "mypass");

What's the proper way to do it, anons? Where do I store the password and how do I get this php script to read it then?
I never thought someone could access the files directly so it didn't see this as a problem.
From what I gathered, he used a vulnerability in the vsFTPd version I use.
>>
>>109403363
It depends on how you deploy, but generally your code reads the value from environment variables, which get injected into your server at runtime.
>>
>>109403363
Store credentials outside your source/web root with restrictive permissions, preferably manage them with a proper secrets system, use a least-privileged database user, and rotate them. But once somebody owns the machine that legitimately needs the password, there is no clever PHP hiding place that makes the password inaccessible to that attacker. Fix the server compromise first.
>>
>>109403363
Put your log in and passes on a thumb drive. Then you shove the thumb drive up your ass. Make sure your shove in deep so your dildo won't damage it when you're ramming it in an out. When you need access just shove your little peepee into a free USB portband BOOM there ya go!!!
>>
>>109403454
I do this!
>>
>>109403363
>php
>ORACLE """mysql"""
>What's the proper way to do it
for starters, look for an overview of technological advancements in the 21st century bruv
>>
Well firstly, your FTP server was running as its own user, right? Why was that user allowed to read these files? Or run anything else?
>>
>>109403363
environment variables

export $MYSQL_PASSWORD='test';

Then in your php

mysql_connect("localhost", "me", getenv('MYSQL_PASSWORD'));
>>
>>109403625
Said he on 4chan, a site he loves because it's old
>>
>>109403822
which also go hacked recently, kek.
it's true, though. he doesn't have to change his tech stack, just keep it up-to-date and know wtf he's doing.
>>
>>109403851
People always say 4chan is kino and based because it's stuck in 2008
But honestly 4chan is the worst coded site I've ever seen
It's just a single imgboard.php file that's 10k lines long
I bet nobody in the world knows how it works.
>>
File: Vishnu.gif (1.58 MB, 490x570)
1.58 MB GIF
>>109403363
If someone has access to your server then it’s too late and hiding the sql credentials won’t save you from being jam’d.
>>
>>109403363
make it so mysql binds to localhost only and restrict access to the local port using selinux or use uds. don't know if mysql supports uds listener though. most shitware doesn't.
>>
>>109403972
does ORACLE(TM) mysql not support unix sockets like postgres, so you don't even have tcp exposure to begin with?
also, localhost=127.0.0.1 is not good security theater. using another 127.0.0.0/24 address (with a random high port too of course) is better.
>>
>>109403363
what is in the database, anon?
>>
>>109404022
The Epstein Client List.
>>
>>109404022
A collection of all the dildos I’ve purchased over the years, including their size and shape and place of sale. When the hacker found it he made me pay a lot of money to him to stay quiet about it. I’m literally shaking.
>>
>>109404228
>I’m literally shaking.
Yeah but that's from the vibrating 1.5m long horse dildo anon.
>>
>>109403822
>4jeet
>a site he loves
who told you that? lol
>>
File: apusil.png (246 KB, 680x510)
246 KB PNG
>>109403363
Feels bad man
Reading the values from environment variables is the simplest. It's not a magic bullet, but it would actually protect you if they could only access the php scripts in the document root and they don't have a shell or remote code execution.
I would also containerize everything and give them the least privilege they need.
>>
I hate AI for so many reasons.

One reason is that Claude makes hacking so much easier.
Claude will analyze all the code on the server and tell you how to exploit it
>>
>>109403851
What is there to hack on 4chan? Oh no the bad people now have my IP address and may or may not know I like to browse /e/.
>>109403874
What's the issue? It just works.
>>
>>109405409
>What is there to hack on 4chan?
The hacker did it for the lulz. The only thing that really came out of it from what I remember is the source code and janny emails.
>>
>>109403363
>The hacker got to the .php files
how?
>>
>>109405449
and fingerprinting

He should have dumped the db, but nooo
>>
>>109408202
Did you even read the post
>>
>php
what fucking year is it?
>>
>>109409562
>umm, it's current year sweaty
>>
>>109403363
Host a static site instead.
>>
>>109403664
if you do this you have to make sure you properly clear the value after use too otherwise it just stays in memory for anything else to read.
>>
>>109403874
>But honestly 4chan is the worst coded site I've ever seen
>It's just a single imgboard.php file that's 10k lines long
There are way worse.
I have seen 10k lines of jquery codes in a laravel blade file, and there are hundred of those laravel blade files.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.