Bug 294886 - dhclient: Failed to obtain lease after FreeBSD-SA-26:15.dhclient
Summary: dhclient: Failed to obtain lease after FreeBSD-SA-26:15.dhclient
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 15.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2026-04-30 03:22 UTC by Kevin Zheng
Modified: 2026-05-01 19:54 UTC (History)
5 users (show)

See Also:
des: mfc-stable15+
des: mfc-stable14+
des: mfc-stable13+
markj: needs_errata+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Zheng 2026-04-30 03:22:06 UTC
After updating to address FreeBSD-SA-26:15.dhclient, my dhclient fails to obtain a lease:

Starting dhclient.
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from x.x.x.x
dhcpoffer: filename contains invalid characters.
packet_to_lease failed.

This is because I am operating in a corporate environment where the bootp filename argument is:

\boot\x86\wdsnbp.com

However, the fix in e7b4fb41 that addresses FreeBSD-SA-26:15.dhclient/CVE-2026-42511 looks for forward slash ('\') and bails out if it sees it.

I tried to work around this by adding to /etc/dhclient.conf:

ignore bootfile-name;

However this processing seems to happen before this can even take place.
Comment 1 Kevin Zheng 2026-04-30 03:25:34 UTC
I think that dhclient should at least clear the "illegal" filename and continue to try to use the lease without bailing out.
Comment 2 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-04-30 08:25:29 UTC
https://reviews.freebsd.org/D56740
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-04-30 16:46:30 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=873a195ba63575e46686cfd6ea9670a0ca340fa0

commit 873a195ba63575e46686cfd6ea9670a0ca340fa0
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-30 16:45:35 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-04-30 16:45:35 +0000

    dhclient: Improve server and filename validation

    * Don't iterate over each string three times; once is enough.

    * Reject control characters (anything below space) in addition to the
      double quote and backslash.

    * If an unsafe character is encountered, discard the string instead of
      rejecting the entire lease.

    * If backslashes are encountered in the file name option, convert them
      to forward slashes instead of rejecting the option.

    * Tweak the warning messages a bit.  Looking through the rest of the
      code, it seems to me that notes generally end with a period while
      warnings generally don't.

    Fixes:          8008e4b88daf ("dhclient: Check for unexpected characters in some DHCP server options")
    PR:             294886
    MFC after:      1 week
    Reviewed by:    brooks, markj
    Differential Revision:  https://reviews.freebsd.org/D56740

 sbin/dhclient/dhclient.c | 75 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 54 insertions(+), 21 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2026-04-30 21:07:21 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=252f603d1704044defb7695e707bc87c7f75483a

commit 252f603d1704044defb7695e707bc87c7f75483a
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-30 16:45:35 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-04-30 21:06:54 +0000

    dhclient: Improve server and filename validation

    * Don't iterate over each string three times; once is enough.

    * Reject control characters (anything below space) in addition to the
      double quote and backslash.

    * If an unsafe character is encountered, discard the string instead of
      rejecting the entire lease.

    * If backslashes are encountered in the file name option, convert them
      to forward slashes instead of rejecting the option.

    * Tweak the warning messages a bit.  Looking through the rest of the
      code, it seems to me that notes generally end with a period while
      warnings generally don't.

    Fixes:          8008e4b88daf ("dhclient: Check for unexpected characters in some DHCP server options")
    PR:             294886
    MFC after:      1 week
    Reviewed by:    brooks, markj
    Differential Revision:  https://reviews.freebsd.org/D56740

    (cherry picked from commit 873a195ba63575e46686cfd6ea9670a0ca340fa0)

 sbin/dhclient/dhclient.c | 75 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 54 insertions(+), 21 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-04-30 21:07:22 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f9478ad42c442c49a7eff60227148bf2b90b48c

commit 2f9478ad42c442c49a7eff60227148bf2b90b48c
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-30 16:45:35 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-04-30 21:07:05 +0000

    dhclient: Improve server and filename validation

    * Don't iterate over each string three times; once is enough.

    * Reject control characters (anything below space) in addition to the
      double quote and backslash.

    * If an unsafe character is encountered, discard the string instead of
      rejecting the entire lease.

    * If backslashes are encountered in the file name option, convert them
      to forward slashes instead of rejecting the option.

    * Tweak the warning messages a bit.  Looking through the rest of the
      code, it seems to me that notes generally end with a period while
      warnings generally don't.

    Fixes:          8008e4b88daf ("dhclient: Check for unexpected characters in some DHCP server options")
    PR:             294886
    MFC after:      1 week
    Reviewed by:    brooks, markj
    Differential Revision:  https://reviews.freebsd.org/D56740

    (cherry picked from commit 873a195ba63575e46686cfd6ea9670a0ca340fa0)

 sbin/dhclient/dhclient.c | 75 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 54 insertions(+), 21 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-04-30 21:08:24 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b1ece85741db0db60ce68daca564f03dc711fe30

commit b1ece85741db0db60ce68daca564f03dc711fe30
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-30 16:45:35 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-04-30 21:07:18 +0000

    dhclient: Improve server and filename validation

    * Don't iterate over each string three times; once is enough.

    * Reject control characters (anything below space) in addition to the
      double quote and backslash.

    * If an unsafe character is encountered, discard the string instead of
      rejecting the entire lease.

    * If backslashes are encountered in the file name option, convert them
      to forward slashes instead of rejecting the option.

    * Tweak the warning messages a bit.  Looking through the rest of the
      code, it seems to me that notes generally end with a period while
      warnings generally don't.

    Fixes:          8008e4b88daf ("dhclient: Check for unexpected characters in some DHCP server options")
    PR:             294886
    MFC after:      1 week
    Reviewed by:    brooks, markj
    Differential Revision:  https://reviews.freebsd.org/D56740

    (cherry picked from commit 873a195ba63575e46686cfd6ea9670a0ca340fa0)

 sbin/dhclient/dhclient.c | 75 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 54 insertions(+), 21 deletions(-)
Comment 7 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-04-30 21:15:57 UTC
Over to Mark who is handling the EN.
Comment 8 commit-hook freebsd_committer freebsd_triage 2026-05-01 15:08:26 UTC
A commit in branch releng/13.5 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b362b6b6c8f28c1ff545bf7c6cdd09388879d1d8

commit b362b6b6c8f28c1ff545bf7c6cdd09388879d1d8
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-30 16:45:35 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-04-30 21:20:57 +0000

    dhclient: Improve server and filename validation

    * Don't iterate over each string three times; once is enough.

    * Reject control characters (anything below space) in addition to the
      double quote and backslash.

    * If an unsafe character is encountered, discard the string instead of
      rejecting the entire lease.

    * If backslashes are encountered in the file name option, convert them
      to forward slashes instead of rejecting the option.

    * Tweak the warning messages a bit.  Looking through the rest of the
      code, it seems to me that notes generally end with a period while
      warnings generally don't.

    Approved by:    so
    Security:       FreeBSD-EN-26:11.dhclient
    Fixes:          8008e4b88daf ("dhclient: Check for unexpected characters in some DHCP server options")
    PR:             294886
    MFC after:      1 week
    Reviewed by:    brooks, markj
    Differential Revision:  https://reviews.freebsd.org/D56740

    (cherry picked from commit 873a195ba63575e46686cfd6ea9670a0ca340fa0)
    (cherry picked from commit b1ece85741db0db60ce68daca564f03dc711fe30)

 sbin/dhclient/dhclient.c | 75 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 54 insertions(+), 21 deletions(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2026-05-01 15:09:28 UTC
A commit in branch releng/14.3 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5bad905eb37f69a8ac90f5e10c07527aded70b5b

commit 5bad905eb37f69a8ac90f5e10c07527aded70b5b
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-30 16:45:35 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-04-30 21:21:27 +0000

    dhclient: Improve server and filename validation

    * Don't iterate over each string three times; once is enough.

    * Reject control characters (anything below space) in addition to the
      double quote and backslash.

    * If an unsafe character is encountered, discard the string instead of
      rejecting the entire lease.

    * If backslashes are encountered in the file name option, convert them
      to forward slashes instead of rejecting the option.

    * Tweak the warning messages a bit.  Looking through the rest of the
      code, it seems to me that notes generally end with a period while
      warnings generally don't.

    Approved by:    so
    Security:       FreeBSD-EN-26:11.dhclient
    Fixes:          8008e4b88daf ("dhclient: Check for unexpected characters in some DHCP server options")
    PR:             294886
    MFC after:      1 week
    Reviewed by:    brooks, markj
    Differential Revision:  https://reviews.freebsd.org/D56740

    (cherry picked from commit 873a195ba63575e46686cfd6ea9670a0ca340fa0)
    (cherry picked from commit 2f9478ad42c442c49a7eff60227148bf2b90b48c)

 sbin/dhclient/dhclient.c | 75 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 54 insertions(+), 21 deletions(-)
Comment 10 commit-hook freebsd_committer freebsd_triage 2026-05-01 15:09:30 UTC
A commit in branch releng/14.4 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=dfcb69cdb07edcee90af4ce4fa11207655c5424e

commit dfcb69cdb07edcee90af4ce4fa11207655c5424e
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-30 16:45:35 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-04-30 21:21:45 +0000

    dhclient: Improve server and filename validation

    * Don't iterate over each string three times; once is enough.

    * Reject control characters (anything below space) in addition to the
      double quote and backslash.

    * If an unsafe character is encountered, discard the string instead of
      rejecting the entire lease.

    * If backslashes are encountered in the file name option, convert them
      to forward slashes instead of rejecting the option.

    * Tweak the warning messages a bit.  Looking through the rest of the
      code, it seems to me that notes generally end with a period while
      warnings generally don't.

    Approved by:    so
    Security:       FreeBSD-EN-26:11.dhclient
    Fixes:          8008e4b88daf ("dhclient: Check for unexpected characters in some DHCP server options")
    PR:             294886
    MFC after:      1 week
    Reviewed by:    brooks, markj
    Differential Revision:  https://reviews.freebsd.org/D56740

    (cherry picked from commit 873a195ba63575e46686cfd6ea9670a0ca340fa0)
    (cherry picked from commit 2f9478ad42c442c49a7eff60227148bf2b90b48c)

 sbin/dhclient/dhclient.c | 75 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 54 insertions(+), 21 deletions(-)
Comment 11 commit-hook freebsd_committer freebsd_triage 2026-05-01 15:09:31 UTC
A commit in branch releng/15.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=dc8762cfb6e2794ec10873263fa606ff969b1905

commit dc8762cfb6e2794ec10873263fa606ff969b1905
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-30 16:45:35 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-04-30 21:09:38 +0000

    dhclient: Improve server and filename validation

    * Don't iterate over each string three times; once is enough.

    * Reject control characters (anything below space) in addition to the
      double quote and backslash.

    * If an unsafe character is encountered, discard the string instead of
      rejecting the entire lease.

    * If backslashes are encountered in the file name option, convert them
      to forward slashes instead of rejecting the option.

    * Tweak the warning messages a bit.  Looking through the rest of the
      code, it seems to me that notes generally end with a period while
      warnings generally don't.

    Approved by:    so
    Security:       FreeBSD-EN-26:11.dhclient
    Fixes:          8008e4b88daf ("dhclient: Check for unexpected characters in some DHCP server options")
    PR:             294886
    MFC after:      1 week
    Reviewed by:    brooks, markj
    Differential Revision:  https://reviews.freebsd.org/D56740

    (cherry picked from commit 873a195ba63575e46686cfd6ea9670a0ca340fa0)
    (cherry picked from commit 252f603d1704044defb7695e707bc87c7f75483a)

 sbin/dhclient/dhclient.c | 75 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 54 insertions(+), 21 deletions(-)
Comment 12 Mark Johnston freebsd_committer freebsd_triage 2026-05-01 16:20:24 UTC
This should be fixed by FreeBSD-EN-26:11.dhclient.
Comment 13 Kevin Zheng 2026-05-01 18:50:53 UTC
I updated and confirmed that the fix works for me. Thanks all for working on this. Now I can fill out "caused an errata notice" on my FreeBSD bingo card :)
Comment 14 Mark Johnston freebsd_committer freebsd_triage 2026-05-01 19:54:20 UTC
(In reply to Kevin Zheng from comment #13)
Technically, secteam caused the EN. :(

Thank you for the report.