-
Notifications
You must be signed in to change notification settings - Fork 14.7k
ensured: MsTdsLogin7 UTF-18 fields use RubySMB String16 #20896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensured: MsTdsLogin7 UTF-18 fields use RubySMB String16 #20896
Conversation
|
Thank you @rudraditya21 for fixing this. I looked into this and found out the issue is much deeper. Your fix is good, but it only fixes the BinData uses some kind of DSL that maps field types as an under_scored name to a registered class. In this case, metasploit-framework/lib/msf/core/post/windows/file_system.rb Lines 31 to 39 in 591b3ea
This is the root cause of all these issues. Once a module that includes this mixin is loaded, the class overwrites the original Since the implementation of Unfortunately, there is no specs written for this mixin and the only way to test if these modifications won't break anything else is to actually to test a module that uses the mixin. I successfully tested the CVE-2022-21999 SpoolFool Privesc, which uses the the BinData structures implemented in the I would prefer having this fix in place, since it would solve the issue for any BinData structures that uses |
|
If the mixin’s String16 registration is overriding RubySMB’s and causing the broader issue, removing the duplicate class seems like the right fix. I’m good proceeding with that change. I can update the PR to remove the mixin’s String16 and keep the MsTdsLogin7 fix minimal or revert it if it’s no longer needed. Let me know your preference on the PR structure. |
|
Sounds good to me! Please, go ahead and remove the |
…ns and reverted: MsTdsLogin7 to its original :string16
|
Thanks for updating this @rudraditya21 ! Everything looks good to me now. I retested the specs and it's all good. I'll go ahead and land it. |
Fixes: #20874
This change ensures MsTdsLogin7 UTF‑16 buffer fields are represented as RubySMB::Field::String16 objects rather than raw strings. It updates buffer field handling to use the RubySMB String16 class for UTF‑16 fields and makes the buffer parsing logic work with both registered symbols and class types.
All Tests Pass
bundle exec rspec --seed 10152 spec/lib/rex/proto/ms_tds/ms_tds_login7_spec.rb spec/api/json_rpc_spec.rbOutput