Skip to content

Strip comments from SAML Response XML during scan#9

Open
hodak wants to merge 1 commit intodropbox:mainfrom
hodak:strip-comments-from-response-xml
Open

Strip comments from SAML Response XML during scan#9
hodak wants to merge 1 commit intodropbox:mainfrom
hodak:strip-comments-from-response-xml

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">
    jon@snow.com@evil.com
  </saml:AttributeValue>
</saml:Attribute>

using Samly you will get this assertion:

%Samly.Assertion{
  attributes: %{
    "email" => "jon@snow.com@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">
    jon@snow.com<!---->@evil.com
  </saml:AttributeValue>
</saml:Attribute>

the envelope signature verification will pass, and you will get

%Samly.Assertion{
  attributes: %{
    "email" => ["jon@snow.com", "@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.

@k-cross
Copy link

k-cross commented Jan 22, 2026

As of this writing, this is the top most PR.

I have not been at dropbox for a while and I was the only one actively maintaining both the samly and esaml projects. I have no controls to make any changes to these repositories anymore and so they should almost certainly be moved to the control of an independent organization.

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.

3 participants