Skip to content

MS-PAC: enforce buffer alignment and PAC structure validation - #2352

Open
adilalperenciftci wants to merge 1 commit into
fortra:masterfrom
adilalperenciftci:fix/ms-pac-structure-validation
Open

adilalperenciftci wants to merge 1 commit into
fortra:masterfrom
adilalperenciftci:fix/ms-pac-structure-validation

Conversation

@adilalperenciftci

Copy link
Copy Markdown
Contributor

Summary

I traced malformed PAC input handling to unchecked descriptor metadata and fixed-format buffer fields in PACTYPE.

  • Reject truncated descriptor tables, unsupported PAC versions, unaligned offsets, ranges inside the descriptor table, out-of-range buffers, and overlapping buffers before slicing.
  • Validate PAC_ATTRIBUTES_INFO size, FlagsLength, and reserved flag bits.
  • Validate the revision and exact wire length of the SID in PAC_REQUESTOR.
  • Validate PAC signature checksum types and their profile-specific MAC lengths while permitting the optional two-byte RODC identifier.
  • Preserve PAC construction and signing behavior.

Tests

  • python -m pytest tests/misc/test_pac_helpers.py -q - 21 passed, 5 subtests passed.
  • python -m pytest -m "not remote" -q - 847 passed, 9 skipped, 1544 deselected, 55 subtests passed.
  • flake8 impacket/krb5/pac.py tests/misc/test_pac_helpers.py --count --select=E9,F63,F7,F82 --show-source --statistics - 0 findings.

Signed-off-by: Adil Alperen Ciftci adilalperenciftci@users.noreply.github.com

I traced malformed PAC inputs to unchecked descriptor and fixed-buffer metadata. I now reject invalid table layout, overlapping ranges, inconsistent PAC_ATTRIBUTES_INFO and PAC_REQUESTOR data, and checksum lengths that do not match the selected profile.

I covered the accepted and rejected wire layouts with focused regression tests.

Signed-off-by: Adil Alperen Ciftci <adilalperenciftci@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@anadrianmanrique anadrianmanrique self-assigned this Nov 4, 2026
@anadrianmanrique anadrianmanrique added the in review This issue or pull request is being analyzed label Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in review This issue or pull request is being analyzed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants