lH/W2tOpCKVuOAQAPYQ7CrdinOSpv5lTiAJ3 /yb9NTSgBpqn3kMBwWwm+vaxUF77r1yJ1Qx8363atem4A1/cwIvSH4ahN+Ro4iApyMMA/z +FcY4ANeIb1hmtYaYTaP/QBwh7xn8CaFHrWHVT658y3CvLB81As578NNeulxbpOb307UbC oheTEj6WqjODTvKPVw1s3z4IZrUBrXaGUepC2WXK7bE8Yskw/9U2UsNMZV9v8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778578430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8IKDZ2BlqwnMPF6S/7ZcVKxktvIOgwYBppa11kK1PNU=; b=dpGQ/ZySf6wu5/XNVCKNXUzmnqAC62zqyA+/qPsH5zszAeAFeSSZ43a5t/MzjE2nGlRHuF oSYrCm7INB4n6ZnXyG4md7BJp9TA8aF5L3jvRZWCRAK5wa4b2VzIH+6GCuWeRRGdsE8mb2 N0770b8emDeGApIjCKV5Em3uH1JSZ/NNzJ6t7FKjnuin6WYctQp7GvqpsApGmF+s+E73kt GITvLtKrcLj5ICPzpv+8sMqgilWMN/+AQdx+ERnLKLNv8k6jB5NB3CGaiQju6lQJ6sy7jY 7tdKGvpe0TKdmvf8AvVgF4inWyPZJilBsK4+dzoEdZR6mVx6Uuj5OGz45ZrpKw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4gFBHL2GsSzxwy for ; Tue, 12 May 2026 09:33:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 64C9Xo4N041015 for ; Tue, 12 May 2026 09:33:50 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 64C9XomV041014 for bugs@FreeBSD.org; Tue, 12 May 2026 09:33:50 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 295218] problem with pf_nl.c's nested_table_parser Date: Tue, 12 May 2026 09:33:50 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D295218 Bug ID: 295218 Summary: problem with pf_nl.c's nested_table_parser Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu User code can cause the kernel pf netlink code to write beyond the bounds of stack-allocated objects due to the way that pf_nl.c's nested_table_parser is used. nested_table_parser is willing to let user-supplied netlink commands cause writes to pfioc_table.pfrio_flags: #define _OUT(_field) offsetof(struct pfioc_table, _field) static const struct nlattr_parser nla_p_table[] =3D { ..., { .type =3D PF_T_FLAGS, .off =3D _OUT(pfrio_flags), .cb =3D nlattr_get_ui= nt32 }, }; ... NL_DECLARE_ATTR_PARSER(nested_table_parser, nla_p_table); But then nested_table_parser is used in contexts where the target is not a pfioc_table, for example in table_astats_parser: #define _OUT(_field) offsetof(struct nl_parsed_table_astats, _field) static const struct nlattr_parser nla_p_table_astats[] =3D { { .type =3D PF_TAS_TABLE, .off =3D _OUT(table), .arg =3D &nested_table_pa= rser, .cb =3D nlattr_get_nested }, }; NL_DECLARE_PARSER(table_astats_parser, struct genlmsghdr, nlf_p_empty, nla_p_table_astats); In this example, pf_handle_table_get_astats() parses into a struct nl_parsed_table_astats. This struct has size 1068, but the nested_table_parser is willing to write "pfrio_flags" at offset 1096. This writes somewhere bad on the stack. One possible fix is that nla_p_table should be used only in table_parser, and not also in nested_table_parser; instead, a separate nlattr_parser should be declared for nested_table_parser, omitting the PF_T_FLAGS. --=20 You are receiving this mail because: You are the assignee for the bug.=