Nmap Anonymization With Proxychains
Nmap Anonymization With Proxychains
If you work in the infosec industry and never asked yourself this question, please take
your time to think. Our objective here is to accomplish a full scan without revealing our
real IP to the target.
Another idea is just to use proxies or even TOR. Although nmap offers a --proxy
option, it should be noted that:
Well, it does not give us much of an option instead of not trusting this feature, does it?
Then we present you another solution: proxychains.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
What does proxychains do (and
does not)?
According to the package description
Proxy chains force any tcp connection made by any given tcp clien
t to follow through proxy (or proxy chain). It is a kind of proxi
fier. It acts like sockscap / premeo / eborder driver ( intercept
s TCP calls )
This version supports SOCKS4, SOCKS5 and HTTP CONNECT proxy serve
BUGTREE rs. Different proxy types can be mixed in the same chain.
[Proxychains] Allows TCP and DNS tunneling through proxies.
These are the two protocols we are going to “secure” while using proxychains. Keep in
mind that all other protocols might pose a hazard to your anonimity.
ProxyChains README
current version: 3.1
======================
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Now, according to proxychain’s man page in Debian 9 (and Kali therefore):
This version (2.0) supports SOCKS4, SOCKS5 and HTTP CONNECT proxy
servers. Auth-types: socks - "user/pass" , http - "basic".
WTF Debian?! To be sure this is just an outdated manpage I checked the package
informations:
So yeah, it seems ok. The main difference between versions 2 and 3 is the support for
DNS requests (which is something really important). Anyway, you should check your
I am assuming here you are familiarized with it. If not, refer to this page. All an all, the
phases are:
1. Script pre-scanning
2. Target enumeration
3. Host discovery (ping scanning)
4. Reverse-DNS resolution
5. Port scanning
6. Version detection
7. OS detection
8. Traceroute
9. Script scanning
10. Output
11. Script post-scanning
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
What is a ping to nmap?
First point to make clear is the concept of ping in nmap’s terminology:
Ping scan therefore uses multiple protocols besides ICMP. Keep that in mind. Now we
know the difference between these two guys, we may move on.
BUGTREE
Born to kill bugs. Live by them.
Proxychains
Our proxychains config is set to use SOCKS5 protocol in order to tunnel our requests
through the TOR network. Our TOR client is listening in port 9050 for that matter. This
is the default configuration for proxychains, so lets keep it this way.
So if we want to skip any UDP or ICMP packets in host discovery and stick only to
TCP probes, it should be enough to add the -PS option. This should orverrule all the
other ping types.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
#proxychains nmap -n -PS -sT 216.58.222.14 -p80 --packet-trace -v
v
ProxyChains-3.1 (http://proxychains.sf.net)
But no luck this time! In fact, we can check whether our host is probing the target
directly:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
fahrzeug.48630 > gru06s25-in-f14.1e100.net.http: Flags [S], c
ksum 0x7634 (correct), seq 630702871, win 1024, options [mss 146
0], length 0
20:12:48.039067 IP (tos 0x0, ttl 46, id 10400, offset 0, flags [n
one], proto TCP (6), length 44)
gru06s25-in-f14.1e100.net.http > fahrzeug.48630: Flags [S.],
cksum 0x9fb6 (correct), seq 1872872446, ack 630702872, win 4278
0, options [mss 1380], length 0
20:12:48.039121 IP (tos 0x0, ttl 64, id 61273, offset 0, flags [D
F], proto TCP (6), length 40)
fahrzeug.48630 > gru06s25-in-f14.1e100.net.http: Flags [R], c
ksum 0x91ed (correct), seq 630702872, win 0, length 0
3 packets captured
3 packets received by filter
0 packets dropped by kernel
BUGTREE
Born to kill bugs. Live by them. Two SYN pings from our host to the target, no proxy. Bad bad OPSEC, folks.
Since proxychains is not tunneling our ping scan, even when we use SYN scan only,
how can we avoid leaking our IP during the host discovery phase? Simple: skip it!
Make sure the target host is up using some other method and then go for the
scanning phase.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Scanned at 2017-10-17 20:13:45 -02 for 1s
PORT STATE SERVICE REASON
80/tcp open http syn-ack
0 packets captured
0 packets received by filter
BUGTREE 0 packets dropped by kernel
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 1.18 seconds
The DNS request was correctly made through proxychains, which is using TOR.
Strangely, nmap interprets 216.58.214.228/0 as an IPv6 address and then breaks. It
seems nmap does not get along with our SOCKS5 DNS resolution.
Let’s see what happens when we scan the IP address directly, instead of the name:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
NSOCK INFO [0.0310s] nsock_trace_handler_callback(): Callback: CO
NNECT SUCCESS for EID 40 [172.16.100.1:53]
NSOCK INFO [0.2920s] nsock_trace_handler_callback(): Callback: RE
AD SUCCESS for EID 18 [8.8.8.8:53] (125 bytes)
NSOCK INFO [0.2920s] nsock_read(): Read request from IOD #1 [8.8.
8.8:53] (timeout: -1ms) EID 66
NSOCK INFO [0.2920s] nsock_iod_delete(): nsock_iod_delete (IOD #
1)
NSOCK INFO [0.2920s] nevent_delete(): nevent_delete on event #66
(type READ)
NSOCK INFO [0.2920s] nsock_iod_delete(): nsock_iod_delete (IOD #
2)
NSOCK INFO [0.2920s] nevent_delete(): nevent_delete on event #34
(type READ)
NSOCK INFO [0.2920s] nsock_iod_delete(): nsock_iod_delete (IOD #
3)
BUGTREE NSOCK INFO [0.2920s] nevent_delete(): nevent_delete on event #50
Born to kill bugs. Live by them. (type READ)
Completed Parallel DNS resolution of 1 host. at 12:52, 0.26s elap
sed
Initiating Connect Scan at 12:52
Scanning gru06s25-in-f14.1e100.net (216.58.222.14) [1 port]
|S-chain|-<>-127.0.0.1:9050-<><>-216.58.222.14:80-<><>-OK
CONN (0.9788s) TCP localhost > 216.58.222.14:80 => Connected
Discovered open port 80/tcp on 216.58.222.14
Completed Connect Scan at 12:52, 0.69s elapsed (1 total ports)
Nmap scan report for gru06s25-in-f14.1e100.net (216.58.222.14)
Host is up, received user-set (0.69s latency).
Scanned at 2017-10-17 12:52:19 -02 for 1s
PORT STATE SERVICE REASON
80/tcp open http syn-ack
As you can see, a reverse DNS resolution to Google’s DNS server (8.8.8.8) is done
without a tunnel. Although we are not leaking our IP directly to the target, it still is
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
being leaked. Confirming with tcpdump:
Due to this situation, it seems wise to use the -n option (skip name resolution) when
scanning through a proxy.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Initiating SYN Stealth Scan at 12:59
Scanning 216.58.222.14 [1 port]
SENT (0.0730s) TCP 172.16.100.250:43067 > 216.58.222.14:80 S ttl=
59 id=23061 iplen=44 seq=774587308 win=1024 <mss 1460>
RCVD (0.1134s) TCP 216.58.222.14:80 > 172.16.100.250:43067 SA ttl
=55 id=63050 iplen=44 seq=2278336372 win=42780 <mss 1380>
Discovered open port 80/tcp on 216.58.222.14
Completed SYN Stealth Scan at 12:59, 0.22s elapsed (1 total port
s)
Nmap scan report for 216.58.222.14
Host is up, received user-set (0.040s latency).
Scanned at 2017-10-17 12:59:19 -02 for 0s
PORT STATE SERVICE REASON
80/tcp open http syn-ack ttl 55
And in tcpdump:
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
ksum 0xce28 (correct), seq 774587309, win 0, length 0
3 packets captured
3 packets received by filter
0 packets dropped by kernel
BUGTREE
Born to kill bugs. Live by them.
From what we conclude the safest option from what we have tested so far is:
That is all for now, folks! Please note this is a first draft and most certainly might
contain multiple some mistakes. Please feel free to share your corrections,
suggestions and observations.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
pentest (2)
← Previous Next →
BUGTREE
Born to kill bugs. Live by them.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
0 Comments Bugtree
1 Login
LOG IN WITH
OR SIGN UP WITH DISQUS ?
Name
BUGTREE
Be the first to comment.
Born to kill bugs. Live by them.
✉ Subscribe d Add Disqus to your site 🔒 Disqus' Privacy Policy
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD