Tharindu Edirisinghe
https://www.meetup.com/Melbourne-Identity-and-Security-Meetup/events/269830019/
Securing
SAML SSO
from XSW
Attacks
Security Internal.com
Tharindu Edirisinghe
Graduate Researcher/ PhD Student
Open Source Contributor
RaiderJava Encoder
@thariyarox
What is Single Sign On
(SSO) ?
Identity Provider
(Office 365)
Zoom
Example for SSO
Email
Moodle (LMS)
Timetable
Service Providers
(Replying Party Applications)
Authentication Request
Authentication Response
Use Account
Identity Provider
Zoom
SAML in SSO
Email
Moodle (LMS)
Timetable
Service Providers
(Replying Party Applications)
SAML Authentication Request
SAML Authentication Response
Use Account
DEMO
SAML
Authentication
Request and Response
Identity Provider
SAML Authentication Attack
Client
Service Provider
(Replying Party Application)
SAML Authentication Request
SAML Authentication Response
Use Account
JoanneResponse
Assertion
JoanneAdmin
DEMO
SAML
Authentication
Attack
Digital Signatures
Digital Signatures and Signature Verification
Source: https://en.wikipedia.org/wiki/Electronic_signature#/media/File:Digital_Signature_diagram.svg
Identity
Provider
needs
to sign the
responses
Relying Party
needs to verify
the signature
Identity Provider
Digitally Signed SAML Responses/Assertions
Client
Service Provider
(Replying Party Application)
SAML Authentication Request
SAML Authentication Response
Use Account
JoanneResponse
Assertion
Sign the
Response/Assertion
Verify the signature of
Response/Assertion
Assertion
Signature
Response
Signature
DEMO
SAML Authentication
Attack Prevention with
Digital Signatures
Structure of XML Signature
Source: https://www.usenix.org/system/files/conference/usenixsecurity12/sec12-final91.pdf
XML Signature Wrapping
(XSW)
Attacks on SAML
Securing SAML SSO from XSW attacks
Securing SAML SSO from XSW attacks
Securing SAML SSO from XSW attacks
Securing SAML SSO from XSW attacks
Securing SAML SSO from XSW attacks
Securing SAML SSO from XSW attacks
Securing SAML SSO from XSW attacks
Securing SAML SSO from XSW attacks
Apache Tomcat Server
(Port 8080)
WSO2 Identity Server
(Port 9443)
Web Browser
(Uses Proxy Port 9090)
BurpSuite
(Port 9090)
Travelocity.com
Sample SAML Client
Application
SAML
Identity Provider
SAML Raider
XSW DEMO Setup
Modified SAML Raider : https://github.com/thariyarox/SAMLRaider/blob/NewAttacks/target/saml-raider-1.2.0-SNAPSHOT-jar-with-dependencies.jar
XSW DEMO
Source: https://www.usenix.org/system/files/conference/usenixsecurity12/sec12-final91.pdf
WSO2 Security Advisory: https://docs.wso2.com/display/Security/Security+Advisory+WSO2-2016-0104
Office 365
SAML Client App Salesforce
Where it’s fixed?
SAML Request
SAML Response
SAML Request
SAML Response
Fix for SAML Signature Validation
Fix ???
XSW Prevention ?
● If the SAML client is implemented using a 3rd party library, check if it supports XSW
prevention. (Eg: OpenSAML client library)
● If SAML assertion/response parsing is done with your implementation, add extra
validations. (Eg: prevent multiple responses/assertions in the XML message)
● Conduct penetration testing for SAML authentication flows. Use standard tools or
make your own one ! (https://github.com/thariyarox/SAMLRaider/tree/NewAttacks/target)
XML Comments
in
SAML Signatures
XML Comments
Source: https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations
<A X="1" Y="2">some text<!-- and a comment --></A>
< A Y="2" X="1" >some text</ A >
Both are logically equal
XML Comments in Signature?
Source: https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations
<A X="1" Y="2">some text<!-- and a comment --></A>
< A Y="2" X="1" >some text</ A > XML Transformation
(Canonicalization)
Transformed XML
Generate XML Signature
exc-c14n#WithComments canonicalization
Source: https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations
<A X="1" Y="2">some text<!-- and a comment --></A>
< A Y="2" X="1" >some text</ A >
XML Transformation
(Canonicalization)
Transformed XML
Generate XML Signature
<A X="1" Y="2">some text<!-- and a comment --></A>
Two inputs will end up with different
signatures
XML Transformation
(Canonicalization)
Transformed XML
<A X="1" Y="2">some text</A>
Generate XML Signature
exc-c14n canonicalization
Source: https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations
<A X="1" Y="2">some text<!-- and a comment --></A>
< A Y="2" X="1" >some text</ A > XML Transformation
(Canonicalization)
Transformed XML
Generate XML Signature
< A Y="2" X="1" >some text</ A >
Both inputs will end up with the
same signature
XML Parser issues with processing
comments (exc-c14n)
Source: https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations
<A>first text<!-- comment -->second text</A>
first text
<!-- comment -->
second text
node_A.getText()
What gets returned??
XML Parser issues with processing
comments (exc-c14n)
Source: https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations
<Username> phil <!-- comment --> lip </Username>
phil
<!-- comment -->
lip
node_A.getText()
Returns first part of the text
Victim
Attacker’s username is phillip
XML Parser issues with processing
comments (exc-c14n)
Source: https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations
<Username> jo <!-- comment --> anne </Username>
jo
<!-- comment -->
anne
node_A.getText()
Returns last part of the text
Victim
Attacker’s username is joanne
DEMO
SAML Attack
with
XML Comments
XML Comments Attack Prevention
● Use exc-c14n#WithComments canonicalization algorithm.
● If exc-c14n is used, process the text of the XML node separately and remove the
comment before extracting the node value.
● Use an XML processing library which is not vulnerable to the string tokenization issue
when comments are present. (Eg: DOM parser, SAX parser)
Summary
● Single Sign On (SSO)
● SAML for SSO
● Digital Signatures
● XSW attacks on SAML
● Penetration testing SAML flows
● XML comments in signatures
● SAML attack prevention
Thank You !
@thariyarox
https://au.linkedin.com/in/ediri

More Related Content

PPTX
Vulnerabilities in modern web applications
PPTX
Spring Boot
PPTX
Dangling DNS records takeover at scale
PPTX
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
PPTX
Django Girls Tutorial
PDF
Concurrency in Golang
PPTX
Basic Concept of Node.js & NPM
PDF
Introduction to MongoDB
Vulnerabilities in modern web applications
Spring Boot
Dangling DNS records takeover at scale
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Django Girls Tutorial
Concurrency in Golang
Basic Concept of Node.js & NPM
Introduction to MongoDB

What's hot (20)

PDF
Linux basic commands with examples
PDF
Shell scripting
PDF
Support programmation orientée objet c# .net version f8
PDF
#살아있다 #자프링외길12년차 #코프링2개월생존기
PDF
Nodejs presentation
PPTX
Presentation1.pptx
PPTX
Quic을 이용한 네트워크 성능 개선
PPTX
Bash shell scripting
PDF
Atomicity In Redis: Thomas Hunter
PDF
Web Application Penetration Testing
PPT
Linux command ppt
PDF
Linux systems - Linux Commands and Shell Scripting
PDF
Cours JavaScript
PPTX
Mongo DB Presentation
PDF
A la découverte de vue.js
PDF
Concurrency With Go
PDF
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
PDF
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
PDF
쿠키런 1년, 서버개발 분투기
KEY
Protocol Buffers and Hadoop at Twitter
Linux basic commands with examples
Shell scripting
Support programmation orientée objet c# .net version f8
#살아있다 #자프링외길12년차 #코프링2개월생존기
Nodejs presentation
Presentation1.pptx
Quic을 이용한 네트워크 성능 개선
Bash shell scripting
Atomicity In Redis: Thomas Hunter
Web Application Penetration Testing
Linux command ppt
Linux systems - Linux Commands and Shell Scripting
Cours JavaScript
Mongo DB Presentation
A la découverte de vue.js
Concurrency With Go
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
쿠키런 1년, 서버개발 분투기
Protocol Buffers and Hadoop at Twitter
Ad

More from Tharindu Edirisinghe (6)

PPTX
Enterprise Cloud Security Posture Management_Kodez.pptx
PDF
ISD_LMS_Lecture4_OOAnalysis____DA-20.pdf
PDF
Owasp API Security top 10 - The need of enterprise solutions for managing API...
PPTX
Security Considerations on Linux Package Management
PPTX
The Rise of Ransomware
PPTX
Managing Security in External Software Dependencies
Enterprise Cloud Security Posture Management_Kodez.pptx
ISD_LMS_Lecture4_OOAnalysis____DA-20.pdf
Owasp API Security top 10 - The need of enterprise solutions for managing API...
Security Considerations on Linux Package Management
The Rise of Ransomware
Managing Security in External Software Dependencies
Ad

Recently uploaded (20)

PPTX
Tech Workshop Escape Room Tech Workshop
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PPTX
Computer Software - Technology and Livelihood Education
PDF
E-Commerce Website Development Companyin india
PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PPTX
GSA Content Generator Crack (2025 Latest)
PDF
AI Guide for Business Growth - Arna Softech
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PPTX
Introduction to Windows Operating System
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
Visual explanation of Dijkstra's Algorithm using Python
DOC
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
Autodesk AutoCAD Crack Free Download 2025
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
Microsoft Office 365 Crack Download Free
PPTX
Airline CRS | Airline CRS Systems | CRS System
Tech Workshop Escape Room Tech Workshop
Matchmaking for JVMs: How to Pick the Perfect GC Partner
Computer Software - Technology and Livelihood Education
E-Commerce Website Development Companyin india
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
GSA Content Generator Crack (2025 Latest)
AI Guide for Business Growth - Arna Softech
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
DNT Brochure 2025 – ISV Solutions @ D365
Introduction to Windows Operating System
Weekly report ppt - harsh dattuprasad patel.pptx
How to Use SharePoint as an ISO-Compliant Document Management System
Visual explanation of Dijkstra's Algorithm using Python
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
Autodesk AutoCAD Crack Free Download 2025
CNN LeNet5 Architecture: Neural Networks
Microsoft Office 365 Crack Download Free
Airline CRS | Airline CRS Systems | CRS System

Securing SAML SSO from XSW attacks