Skip to content

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.

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