Skip to content

pppd: EAP-TLS session leak, PEAP fatal() exits, pppoe debug-dump over-read (#663) - #664

Open
jhanglim wants to merge 3 commits into
ppp-project:masterfrom
jhanglim:aivuln-fixes
Open

jhanglim wants to merge 3 commits into
ppp-project:masterfrom
jhanglim:aivuln-fixes

Conversation

@jhanglim

@jhanglim jhanglim commented Nov 9, 2026

Copy link
Copy Markdown

Fixes for the items in #663, found while reviewing pppd 2.5.5 (master 4dc474c) with an AI-assisted binary analysis tool and confirmed against the source; details, line numbers and conditions are in the issue.

  • pppd/EAP-TLS: free the session on init failure and zero it on creation — the session leaked on every EAP-TLS Start whose init failed (no EAP-TLS secret configured) or that followed an earlier Start; rtx_len/frag/offset/tlslen were uninitialised and the retransmit path could run on a fresh session.
  • pppd/PEAP: fail the authentication instead of dying, free the buffers — the two fatal() calls reachable from the peer (response larger than the peer's MRU, compound-MAC mismatch) now fail the authentication; peap_finish() frees in_buf/out_buf.
  • plugins/pppoe: bound the debug dump by the payload size, check recv — pppoe_printpkt() no longer reads past the 1508-byte payload when the length field is larger; waitForPADO()/waitForPADS() skip a failed recv(); the AC-Name copy no longer runs strlen() on a tag that is not NUL-terminated.
  • pppd: reject a CHAP Authentication-Protocol option shorter than 5 bytes
  • pppd: fix the length pr_log copies into its line buffer

Compile-tested only: armhf, the Debian configure options (--enable-cbcp --enable-multilink), -Wall; no new warnings in the changed files. Not run. Happy to split this into separate pull requests if you prefer.

🤖 Generated with Claude Code

@paulusmack

Copy link
Copy Markdown
Collaborator

Each commit requires a sign-off, as described in Submitting-patches.md. The sign-off needs to be from a human who takes responsibility for the content and can assert the right to submit the patches.

@Neustradamus

Copy link
Copy Markdown
Member

@jhanglim: Have you seen the @paulusmack comment?

Seokwoo Jang added 3 commits November 22, 2026 09:17
pppoe_printpkt() walked the tags and (with pppoe-verbose 2) hex-dumped
the payload up to the 16-bit length field of the received packet, while
the packet structure holds 1508 payload bytes.  receivePacket() dumps
every packet before the callers compare the length field with the
received byte count, so with "debug" a discovery frame whose length
field is larger than the packet makes the dump read up to 64 KB past the
stack buffer.  Clamp the length to the payload size.

waitForPADO() and waitForPADS() ignored the return value of
receivePacket(); on a recv() error len was -1, which the unsigned
comparison with HDR_SIZE accepted, and the stale buffer was parsed.
Skip the iteration instead.

The AC-Name tag is not NUL-terminated, so copying it with strlcpy()
made strlen() read past the tag; copy len bytes and terminate.

Signed-off-by: Seokwoo Jang <[email protected]>
lcp_reqci() only required an Authentication-Protocol option to be at
least 4 bytes long and then read the CHAP algorithm byte, so a 4-byte
CHAP option read one byte past the option (past inpacket_buf when the
option ends a maximum-size packet).  Reject an option without the
algorithm byte, as CILEN_CHAP already says it must have one.

Signed-off-by: Seokwoo Jang <[email protected]>
pr_log() computed the number of bytes left after the last newline, l,
but copied n bytes, reading past the formatted text.  The extra bytes
were never printed because linep was set from l; copy l bytes.

Signed-off-by: Seokwoo Jang <[email protected]>
@jhanglim

Copy link
Copy Markdown
Author

Hi Paul, sorry for the late reply — yes, I have seen it. I have added my Signed-off-by to each commit. Since the EAP-TLS and PEAP code is being reworked on the dev branch, I dropped those two commits from this PR. The remaining three (pppoe debug dump, LCP CHAP option length, pr_log) also apply cleanly to dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants