SAML Injection: XML Signature Wrapping Attacks

OAuth and SSOExploitation

From PayloadsAllTheThings by Swissky and contributors, under the MIT licence. Shown as written; the title and classification are ours. Licences. Its authors can have this tip removed by writing to abuse@bugbountytips.org.

XML Signature Wrapping (XSW) attack, some implementations check for a valid signature and match it to a valid assertion, but do not check for multiple assertions, multiple signatures, or behave differently depending on the order of assertions.

  • XSW1: Applies to SAML Response messages. Add a cloned unsigned copy of the Response after the existing signature.

  • XSW2: Applies to SAML Response messages. Add a cloned unsigned copy of the Response before the existing signature.

  • XSW3: Applies to SAML Assertion messages. Add a cloned unsigned copy of the Assertion before the existing Assertion.

  • XSW4: Applies to SAML Assertion messages. Add a cloned unsigned copy of the Assertion within the existing Assertion.

  • XSW5: Applies to SAML Assertion messages. Change a value in the signed copy of the Assertion and adds a copy of the original Assertion with the signature removed at the end of the SAML message.

  • XSW6: Applies to SAML Assertion messages. Change a value in the signed copy of the Assertion and adds a copy of the original Assertion with the signature removed after the original signature.

  • XSW7: Applies to SAML Assertion messages. Add an “Extensions” block with a cloned unsigned assertion.

  • XSW8: Applies to SAML Assertion messages. Add an “Object” block containing a copy of the original assertion with the signature removed.

In the following example, these terms are used.

  • FA: Forged Assertion

  • LA: Legitimate Assertion

  • LAS: Signature of the Legitimate Assertion

xml
<SAMLResponse>
  <FA ID="evil">
      <Subject>Attacker</Subject>
  </FA>
  <LA ID="legitimate">
      <Subject>Legitimate User</Subject>
      <LAS>
         <Reference Reference URI="legitimate">
         </Reference>
      </LAS>
  </LA>
</SAMLResponse>

In the Github Enterprise vulnerability, this request would verify and create a sessions for Attacker instead of Legitimate User, even if FA is not signed.

Comments

No comments yet.