Wednesday, May 31, 2023

Testing SAML Endpoints For XML Signature Wrapping Vulnerabilities

A lot can go wrong when validating SAML messages. When auditing SAML endpoints, it's important to look out for vulnerabilities in the signature validation logic. XML Signature Wrapping (XSW) against SAML is an attack where manipulated SAML message is submitted in an attempt to make the endpoint validate the signed parts of the message -- which were correctly validated -- while processing a different attacker-generated part of the message as a way to extract the authentication statements. Because the attacker can arbitrarily forge SAML assertions which are accepted as valid by the vulnerable endpoint, the impact can be severe. [1,2,3]

Testing for XSW vulnerabilities in SAML endpoints can be a tedious process, as the auditor needs to not only know the details of the various XSW techniques, but also must handle a multitude of repetitive copy-and-paste tasks and apply the appropriate encoding onto each message. The latest revision of the XSW-Attacker module in our BurpSuite extension EsPReSSo helps to make this testing process easier, and even comes with a semi-automated mode. Read on to learn more about the new release! 

 SAML XSW-Attacker

After a signed SAML message has been intercepted using the Burp Proxy and shown in EsPReSSO, you can open the XSW-Attacker by navigating to the SAML tab and then the Attacker tab.  Select Signature Wrapping from the drop down menu, as shown in the screenshot below:



To simplify its use, the XSW-Attacker performs the attack in a two step process of initialization and execution, as reflected by its two tabs Init Attack and Execute Attack. The interface of the XSW-Attacker is depicted below.
XSW-Attacker overview

The Init Attack tab displays the current SAML message. To execute a signature wrapping attack, a payload needs to be configured in a way that values of the originally signed message are replaced with values of the attacker's choice. To do this, enter the value of a text-node you wish to replace in the Current value text-field. Insert the replacement value in the text-field labeled New value and click the Add button. Multiple values can be provided; however, all of which must be child nodes of the signed element. Valid substitution pairs and the corresponding XPath selectors are displayed in the Modifications Table. To delete an entry from the table, select the entry and press `Del`, or use the right-click menu.

Next, click the Generate vectors button - this will prepare the payloads accordingly and brings the Execute Attack tab to the front of the screen.

At the top of the Execute Attack tab, select one of the pre-generated payloads. The structure of the selected vector is explained in a shorthand syntax in the text area below the selector.
The text-area labeled Attack vector is editable and can be used to manually fine-tune the chosen payload if necessary. The button Pretty print opens up a syntax-highlighted overview of the current vector.
To submit the manipulated SAML response, use Burp's Forward button (or Go, while in the Repeater).

Automating XSW-Attacker with Burp Intruder

Burp's Intruder tool allows the sending of automated requests with varying payloads to a test target and analyzes the responses. EsPReSSO now includes a Payload Generator called XSW Payloads to facilitate when testing the XML processing endpoints for XSW vulnerabilities. The following paragraphs explain how to use the automated XSW attacker with a SAML response.

First, open an intercepted request in Burp's Intruder (e.g., by pressing `Ctrl+i`). For the attack type, select Sniper. Open the Intruder's Positions tab, clear all payload positions but the value of the XML message (the `SAMLResponse` parameter, in our example). Note: the XSW-Attacker can only handle XML messages that contain exactly one XML Signature.
Next, switch to the Payloads tab and for the Payload Type, select Extension-generated. From the newly added Select generator drop-down menu, choose XSW Payloads, as depicted in the screenshot below.



While still in the Payloads tab, disable the URL-encoding checkbox in the Payload Encoding section, since Burp Intruder deals with the encoding automatically and should suffice for most cases.
Click the Start Attack button and a new window will pop up. This window is shown below and is similar to the XSW Attacker's Init Attack tab.


Configure the payload as explained in the section above. In addition, a schema analyzer can be selected and checkboxes at the bottom of the window allow the tester to choose a specific encoding. However, for most cases the detected presets should be correct.

Click the Start Attack button and the Intruder will start sending each of the pre-generated vectors to the configured endpoint. Note that this may result in a huge number of outgoing requests. To make it easier to recognize the successful Signature Wrapping attacks, it is recommended to use the Intruder's Grep-Match functionality. As an example, consider adding the replacement values from the Modifications Table as a Grep-Match rule in the Intruder's Options tab. By doing so, a successful attack vector will be marked with a checkmark in the results table, if the response includes any of the configure grep rules.

Credits

EsPReSSO's XSW Attacker is based on the WS-Attacker [4] library by Christian Mainka and the original adoption for EsPReSSO has been implemented by Tim Günther.
Our students Nurullah Erinola, Nils Engelberts and David Herring did a great job improving the execution of XSW and implementing a much better UI.

---

[1] On Breaking SAML - Be Whoever You Want to Be
[2] Your Software at My Service
[3] Se­cu­ri­ty Ana­ly­sis of XAdES Va­li­da­ti­on in the CEF Di­gi­tal Si­gna­tu­re Ser­vices (DSS)
[4] WS-Attacker

Related articles


  1. Physical Pentest Tools
  2. Hack Tool Apk No Root
  3. Tools Used For Hacking
  4. Hacker Tools 2020
  5. Pentest Tools Open Source
  6. Blackhat Hacker Tools
  7. Hack Tools
  8. Bluetooth Hacking Tools Kali
  9. Nsa Hack Tools
  10. New Hacker Tools
  11. Android Hack Tools Github
  12. Pentest Tools Linux
  13. Pentest Tools Subdomain
  14. Hackers Toolbox
  15. Pentest Box Tools Download
  16. Hack Tools Mac
  17. Hack Tools For Pc
  18. Best Hacking Tools 2019
  19. Pentest Tools Website
  20. Hacking Tools And Software
  21. Pentest Tools Open Source
  22. Github Hacking Tools
  23. Hacker Search Tools
  24. Hack Rom Tools
  25. Pentest Tools Subdomain
  26. Hack Apps
  27. Hacker
  28. Hacking Tools Mac
  29. Hacker Tools For Ios
  30. Top Pentest Tools
  31. Tools Used For Hacking
  32. Hacking Tools Download
  33. Hacker Tools 2020
  34. Black Hat Hacker Tools
  35. Pentest Tools List
  36. Blackhat Hacker Tools
  37. Hacking Tools Kit
  38. Hacking Tools Online
  39. Best Pentesting Tools 2018
  40. Hack Tools Online
  41. Hacking App
  42. Hacking Tools For Windows 7
  43. Tools 4 Hack
  44. Pentest Tools Android
  45. Hacker Tools Online
  46. What Is Hacking Tools
  47. Ethical Hacker Tools
  48. Hacking Tools Free Download
  49. Pentest Tools Free
  50. Pentest Tools For Android
  51. Hack Tool Apk
  52. Beginner Hacker Tools
  53. Hacking Tools
  54. How To Hack
  55. Hack Apps
  56. Hack Tools Online
  57. Hack Tools
  58. Pentest Tools Website Vulnerability
  59. Hacking Tools For Windows
  60. Tools For Hacker
  61. Github Hacking Tools
  62. Hacker Tools For Pc
  63. How To Hack
  64. Bluetooth Hacking Tools Kali
  65. World No 1 Hacker Software
  66. Hacker Tools Software
  67. Tools For Hacker
  68. Best Hacking Tools 2020
  69. Growth Hacker Tools
  70. Hacking Tools And Software
  71. Computer Hacker
  72. Black Hat Hacker Tools
  73. Hack Tools
  74. Hack Tools Download
  75. Pentest Tools
  76. Hack Tool Apk
  77. Nsa Hacker Tools
  78. Pentest Tools Website
  79. Hacking Tools Pc
  80. Best Hacking Tools 2020
  81. Black Hat Hacker Tools
  82. New Hacker Tools
  83. Hacking Tools Usb
  84. Hacks And Tools
  85. Pentest Automation Tools
  86. Hacking Tools Download
  87. Hack Tools Mac
  88. What Is Hacking Tools
  89. Hackrf Tools
  90. Hacks And Tools
  91. Hack Tool Apk No Root
  92. Hacker Tools Windows
  93. Pentest Tools Subdomain
  94. Hack Tools For Ubuntu
  95. Pentest Reporting Tools
  96. Hack Tools Pc
  97. Hacking Tools Pc
  98. Hacker Tools For Windows
  99. Hack Tool Apk No Root
  100. Hacking Tools Name
  101. Pentest Tools Alternative
  102. Hack And Tools
  103. Github Hacking Tools
  104. Hacker Techniques Tools And Incident Handling
  105. Black Hat Hacker Tools
  106. Ethical Hacker Tools
  107. Hacker
  108. Pentest Tools Github
  109. Pentest Tools Url Fuzzer
  110. New Hacker Tools
  111. Pentest Automation Tools
  112. Hack And Tools
  113. Hacker Tools Linux
  114. Nsa Hack Tools
  115. Pentest Tools Linux
  116. Game Hacking
  117. Pentest Reporting Tools
  118. Tools 4 Hack
  119. Hack Rom Tools
  120. How To Hack
  121. Best Pentesting Tools 2018
  122. Hack Tools Github
  123. Hacks And Tools
  124. Hacking Tools Github

No comments:

Post a Comment