Fix AclSize computation#4832
Conversation
|
Hi & thanks a lot for the PR. Could you add a test? scapy/test/scapy/layers/smb2.uts Line 552 in d73bbc1 Also the PEP8 test is failing. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4832 +/- ##
=======================================
Coverage 80.88% 80.88%
=======================================
Files 368 368
Lines 90231 90231
=======================================
+ Hits 72979 72980 +1
+ Misses 17252 17251 -1
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the computation of AclSize in the WINNT_ACL class to match Windows-generated security descriptors. The issue was that Scapy was incorrectly calculating the ACL size by adding 14 bytes instead of 8 bytes to the length of the ACEs, causing a mismatch with legitimate Windows packets.
- Fixed the
AclSizecomputation inWINNT_ACLto properly calculate the total size by adding 8 bytes (header size) instead of 14 bytes - Added clarifying comments explaining the header structure and size calculation
- Added a test to verify that the computed
AclSizematches the actual length of the ACL
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scapy/layers/smb2.py | Fixed AclSize calculation and added explanatory comments for the header structure |
| test/scapy/layers/smb2.uts | Added test assertion to verify AclSize computation matches actual ACL length |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This comes from a legitimate packet crafted by Windows via a call to
RegSaveKeyThe security descriptor was created using the following C code :
We can find exactly what we requested. The security descriptor match our expectation and AclSize == 32 (0x20)
This is what we get when performing the same operation with Scapy
The security descriptor was created with the following code :
We can see that the AclSize here is not 32 but 38 (0x26). Our request ends-up on an invalid argument error.
fixes #4831