Network Time Protocol Private Mode 'reslist' NULL Pointer Dereference Vulnerability
The ntpdc reslist command in ntpd does not check the return value of more_pkt(), which can return NULL when the response sequence number reaches MAXSEQ, leading to a NULL pointer dereference and crash. An attacker who can increase the restrict list size on a server with mode 7 enabled can cause a segmentation fault, resulting in denial of service.
Originally disclosed on Cisco Talos
An unauthenticated ntpdc reslist command can cause a segmentation fault in ntpd by causing a NULL pointer dereference.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The functions list_restrict4() and list_restrict6() do not check whether more_pkt() returns NULL when the sequence number reaches MAXSEQ, and then dereference the NULL pointer.
Impact
An attacker who can increase the size of the restrict list on a server with mode 7 enabled can crash ntpd, causing a denial of service.
What the attacker needed
Mode 7 enabled on the server; Restrict list large enough to reach MAXSEQ; Ability to send ntpdc reslist command
The fix
The return value of more_pkt() should be checked at each invocation, and if it is NULL, ntpd should fail gracefully.
How it was found
- Enable mode 7 on the ntpd server (disabled by default).
- Ensure the restrict list contains enough entries so that seqno can equal MAXSEQ.
- Send an unauthenticated ntpdc reslist command to the server.
- The server attempts to send multiple response packets, more_pkt() returns NULL when seqno equals MAXSEQ, and the NULL pointer is dereferenced, causing a crash.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a bug in the Network Time Protocol daemon (ntpd), which keeps computers' clocks in sync. A command called reslist asks the server to list its access restrictions; if there are too many restrictions to fit in one reply, the server sends several replies. The code that builds these replies fails to check for an error when the reply number gets too high, so it tries to use an empty pointer and crashes the server.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.