Skip to content
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

Strip comments from SAML Response XML during scan #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hodak
Copy link

@hodak hodak commented Aug 28, 2024

Let's say you get this kind of email claim in SAML Response

<saml:Attribute
  Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
  <saml:AttributeValue xsi:type="xs:string">
    [email protected]@evil.com
  </saml:AttributeValue>
</saml:Attribute>

using Samly you will get this assertion:

%Samly.Assertion{
  attributes: %{
    "email" => "[email protected]@evil.com",
    ...
  },
  ...
}

but with modifying the response and adding an empty comment

<saml:Attribute
  Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
  <saml:AttributeValue xsi:type="xs:string">
    [email protected]<!---->@evil.com
  </saml:AttributeValue>
</saml:Attribute>

the envelope signature verification will pass, and you will get

%Samly.Assertion{
  attributes: %{
    "email" => ["[email protected]", "@evil.com"],
    ...
  },
  ...
}

If your app expects multiple emails and takes the first one, it might assume the identity of a different user within the same organization.

We've been running this kind of fix ourselves for a while now Recruitee/samly@056298d but now thought it might be better to update it in the core if you agree.

@CLAassistant
Copy link

CLAassistant commented Aug 28, 2024

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants