PoPToP — 1 vulnerability check
noctis ships 1 vulnerability check for PoPToP, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
PoPToP PPTP server control packet negative length buffer overflow
| CVE | CVE-2003-0213 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | pptp |
| Ports | 1723 |
| Detection | script, tcp_open, tcp_send, sleep, tcp_close, match · highest QoD 75 |
| Feed | tests/vulnerabilities/poptop/CVE-2003-0213.yaml |
Opens a PPTP control connection (TCP 1723), sends a Start-Control-Connection-Request and requires a reply from PoPToP (vendor field "linux"), then checks that the connection answers an Echo-Request carrying a random identifier. It then sends a control packet header whose length field is 0, without any overflow data, followed by two single bytes a few seconds apart. A fixed PoPToP rejects lengths below 11 and closes the control connection at once, so a later write fails. A vulnerable PoPToP turns the 0 length into a negative read size, which lets an attacker overflow the 220-byte packet buffer: the server stays blocked in that read, keeps the connection open and accepts the bytes without answering, which confirms the finding.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Opens a persistent TCP/TLS socket
- Sends a binary frame on the open socket
- Parses / computes the next value with a Rhai script
- Sends a binary frame on the open socket
- Parses / computes the next value with a Rhai script
- Sends a binary frame on the open socket
- Sends a binary frame on the open socket
- Sends a binary frame on the open socket
- Checks
s.echofor^true$→ finding QoD 75: PoPToP PPTP server accepts a control packet length of 0 (negative read buffer overflow)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2003-0213
- https://sourceforge.net/projects/poptop/files/pptpd/
- https://datatracker.ietf.org/doc/html/rfc2637
Feed source — tests/vulnerabilities/poptop/CVE-2003-0213.yaml
# PoPToP pptpd (Linux PPTP server, TCP 1723) — control packet length 0/1
# negative read size → stack buffer overflow in pptpctrl (CVE-2003-0213).
#
# Ported from OpenVAS/Greenbone NVT pre2008/poptop_negative_read.nasl
# (OID 1.3.6.1.4.1.25623.1.0.11540, GPL-2.0-only). Code path read in the
# pptpd sources (ctrlpacket.c read_pptp_header(), 1.1.4-b4 and 1.5.0).
#
# Bug. read_pptp_header() reads the u16be packet length, then
# read(fd, packet + 2, length - 2)
# into a 220-byte stack buffer. Before 1.1.3-20030409 / 1.1.4-b3 only the upper
# bound was checked, so a length of 0 or 1 turns the size negative (huge as
# size_t). The fix rejects `length <= 10 || length > 220` and closes the control
# connection at once ("we loose sync ... must close connection").
#
# NOT A CRASH PROBE. The NVT sends a 0 length followed by 1500 'A' bytes, which
# smashes the stack of a vulnerable pptpctrl, and needs packet capture to tell
# the FIN of the dead process from the RST of a fixed one. This feed sends the
# 0 length with NO overflow data: a vulnerable pptpctrl is left blocked in that
# negative-size read — the connection stays open and keeps accepting bytes
# (2 more, far below the 220-byte buffer) without ever answering — while a fixed
# release closes the control connection right away, so a write a few seconds
# later fails with a broken pipe.
#
# Steps (one connection):
# 1. Start-Control-Connection-Request (the NVT's frame) → the reply must be a
# Start-Control-Connection-Reply whose vendor field is "linux" (hard-coded
# by pptpd, as the NVT requires);
# 2. Echo-Request with a random identifier → Echo-Reply carrying it (the
# connection is live and answers well-formed packets just before);
# 3. the 2-byte length 0 header, a 2 s pause, 1 byte, a 1 s pause, 1 byte:
# vulnerable when every write succeeds and nothing is ever answered.
# A fixed server closed after the header: one of the two writes fails.
# The two byte reads must also last their whole 1 s timeout: after a close
# they end at once on EOF, so a fixed server is not reported even when a
# middlebox drops the RST that makes the later write fail.
#
# Better than the OpenVAS NVT: no stack-smashing payload, no raw packet capture,
# and a live Echo-Request control on the same connection right before the probe.
# Limits: the stuck read only happens where the negative size is accepted by
# read() — 32-bit pptpd builds (the 2003-era deployments). A 64-bit build gets
# EFAULT, closes like a fixed release and is reported clean (and cannot be
# overflowed that way either). An inline device that silently black-holes the
# connection after the
# malformed header would look the same as a vulnerable server.
uid: 9102b9f8-ecee-484e-a757-f117dc0edab6
name: "PoPToP PPTP server control packet negative length buffer overflow"
description: |
Opens a PPTP control connection (TCP 1723), sends a
Start-Control-Connection-Request and requires a reply from PoPToP (vendor
field "linux"), then checks that the connection answers an Echo-Request
carrying a random identifier. It then sends a control packet header whose
length field is 0, without any overflow data, followed by two single bytes a
few seconds apart. A fixed PoPToP rejects lengths below 11 and closes the
control connection at once, so a later write fails. A vulnerable PoPToP
turns the 0 length into a negative read size, which lets an attacker
overflow the 220-byte packet buffer: the server stays blocked in that read,
keeps the connection open and accepts the bytes without answering, which
confirms the finding.
cves: [CVE-2003-0213]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [poptop, pptpd, pptp, vpn, buffer-overflow, memory-corruption, intrusive, tcp-1723]
services: [pptp]
ports: [1723]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2003-0213"
- "https://sourceforge.net/projects/poptop/files/pptpd/"
- "https://datatracker.ietf.org/doc/html/rfc2637"
steps:
# Start-Control-Connection-Request exactly as the NVT builds it (156 bytes,
# firmware 2320, empty hostname/vendor) and an Echo-Request (16 bytes).
- id: build
action: script
store_as: x
code: |
let id = rand_hex(4);
let sccrq = "009c" + "0001" + "1a2b3c4d" + "0001" + "0000" + "0100" + "0000"
+ "00000001" + "00000001" + "0000" + "0910" + crap(256, "0");
#{ id: id, sccrq: sccrq, echo: "0010" + "0001" + "1a2b3c4d" + "0005" + "0000" + id }
- id: init-state
action: script
store_as: s
code: |
#{ poptop: false, echo: false }
- id: open
action: tcp_open
handle: pptp
port: "{{port}}"
timeout_secs: 5
store_as: c
- id: send-sccrq
action: tcp_send
handle: pptp
condition: "c.connected == true"
send_hex: "{{x.sccrq}}"
timeout_secs: 5
store_as: r1
# Start-Control-Connection-Reply: length 156, message type 1, magic cookie,
# control type 2; vendor field (bytes 92..155) "linux" + NUL.
- id: check-sccrp
action: script
condition: "c.connected == true"
store_as: s
code: |
let h = if type_of(r1.response_hex) == "string" { r1.response_hex } else { "" };
s.poptop = strlen(h) >= 312
&& substr(h, 0, 19) == "009c00011a2b3c4d0002"
&& substr(h, 184, 195) == "6c696e757800";
s
- id: send-echo
action: tcp_send
handle: pptp
condition: "s.poptop == true"
send_hex: "{{x.echo}}"
timeout_secs: 5
store_as: r2
# Echo-Reply: length 20, control type 6, our identifier, result 1.
- id: check-echo
action: script
condition: "s.poptop == true"
store_as: s
code: |
let h = if type_of(r2.response_hex) == "string" { r2.response_hex } else { "" };
s.echo = strlen(h) >= 40
&& substr(h, 0, 19) == "001400011a2b3c4d0006"
&& substr(h, 24, 31) == x.id;
s
# Length 0 header, no payload: the fixed server closes here (EOF read).
- id: send-zero-length
action: tcp_send
handle: pptp
condition: "s.echo == true"
send_hex: "0000"
timeout_secs: 3
store_as: z0
- id: wait-1
action: sleep
condition: "s.echo == true"
duration_ms: 2000
# First write after a close still succeeds (it draws the RST); the second
# one then fails with a broken pipe.
- id: send-byte-1
action: tcp_send
handle: pptp
condition: "s.echo == true"
send_hex: "00"
timeout_secs: 1
store_as: z1
- id: wait-2
action: sleep
condition: "s.echo == true"
duration_ms: 1000
- id: send-byte-2
action: tcp_send
handle: pptp
condition: "s.echo == true"
send_hex: "00"
timeout_secs: 1
store_as: z2
- id: close
action: tcp_close
handle: pptp
- id: check-negative-read
action: match
source: s.echo
pattern: "^true$"
condition: "s.echo == true && z0.sent == true && z1.sent == true && z2.sent == true && z0.responded == false && z1.responded == false && z2.responded == false && z1.duration_ms >= 900 && z2.duration_ms >= 900"
on_match:
finding:
title: "PoPToP PPTP server accepts a control packet length of 0 (negative read buffer overflow)"
description: "The PoPToP PPTP server (vendor \"linux\") answered a Start-Control-Connection-Request and an Echo-Request, then accepted a control packet header with a length field of 0: instead of closing the control connection as fixed releases do, it stayed blocked in a read whose size the 0 length made negative and kept accepting bytes without answering. An attacker who sends more than the 220-byte packet buffer through this read overflows the stack of the control process (CVE-2003-0213)."
remediation: "Upgrade PoPToP pptpd to 1.1.4-b3, 1.1.3-20030409 or later (current releases reject control packet lengths below 11), or block TCP 1723 from untrusted networks."
confidence_delta: 0.55
qod: 75
evidence: "TCP {{port}}: Start-Control-Connection-Reply vendor \"linux\"; Echo-Reply returned identifier {{x.id}}; after a length 0 header the connection stayed open: 3 writes over 3 s accepted, no reply and no close"