Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove vLAN tags for DHCP discover script #2819

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kbucheli
Copy link

The broadcast-dhcp-discover script fails to report/dissect DHCP offers if the packet has a vLAN tag:

[root@lx-test-01 ~]# nmap --script /usr/share/nmap/scripts/broadcast-dhcp-discover.nse 
Starting Nmap 7.92 ( https://nmap.org ) at 2024-04-18 13:09 CEST
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 10.20 seconds
[root@lx-test-01 ~]#

dhcp_offer_with_vlan_tag

Whereas with this fix the packet is properly dissected by removing the tag if one is found:

[root@lx-test-01 ~]# nmap --script /root/nmap/scripts/broadcast-dhcp-discover.nse
Starting Nmap 7.92 ( https://nmap.org ) at 2024-04-18 13:10 CEST
Pre-scan script results:
| broadcast-dhcp-discover: 
|   Response 1 of 1: 
|     Interface: enp98s0
|     IP Offered: 129.129.240.213
|     DHCP Message Type: DHCPOFFER
|     Server Identifier: 129.129.190.11
|     Subnet Mask: 255.255.255.0
|     Router: 129.129.240.1
|     Domain Name Server: 129.129.190.11, 129.129.230.11
|     Domain Name: psi.ch
|_    IP Address Lease Time: 1h00m00s
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 10.20 seconds
[root@lx-test-01 ~]# 

And it still works fine on networks where there is no vLAN tag:

[root@lx-test-02 ~]# nmap --script /root/nmap/scripts/broadcast-dhcp-discover.nse 
Starting Nmap 7.92 ( https://nmap.org ) at 2024-04-18 13:15 CEST
Pre-scan script results:
| broadcast-dhcp-discover: 
|   Response 1 of 2: 
|     Interface: ens192
|     IP Offered: 10.129.160.247
|     DHCP Message Type: DHCPOFFER
|     Server Identifier: 129.129.190.11
|     Subnet Mask: 255.255.255.0
|     Router: 10.129.160.1
|     Domain Name Server: 129.129.190.11, 129.129.230.11
|     Domain Name: psi.ch
|     IP Address Lease Time: 1h00m00s
|   Response 2 of 2: 
|     Interface: ens192
|     IP Offered: 10.129.160.247
|     DHCP Message Type: DHCPOFFER
|     Server Identifier: 129.129.190.11
|     Subnet Mask: 255.255.255.0
|     Router: 10.129.160.1
|     Domain Name Server: 129.129.190.11, 129.129.230.11
|     Domain Name: psi.ch
|_    IP Address Lease Time: 1h00m00s
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 10.14 seconds
[root@lx-test-02 ~]# 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant