SlideShare a Scribd company logo
.lusoftware verification & validation
VVS
Automated and Effective Testing of Web
Services for XML Injection Attacks 
Sadeeq Jan, Cu D. Nguyen, Lionel Briand
Interdisciplinary Centre for Security, Reliability and Trust (SnT) 
University of Luxembourg
ISSTA’16
The International Symposium on Software Testing and Analysis 
Saarland University, Saarbrücken, Germany. July 18-20, 2016
XML Injection
2
•  Bypassing authentication
•  Privilege escalation
•  Information disclosure
•  Generating errors/system crash
Impact
Definition
Injecting malicious content into XML files/messages to
manipulate/compromise the logic of an application/
service
3
XML Injection Example
Create new account
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<role>user</role>
<mail>a@b.com</mail>
</user>
<user>
<username>admin</username> 
<password>s4n3p81</password>
<role>Administrator</role>
<mail>sv-admin@gmail.com</mail>
</user>
…..
......
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<role>user</role>
<mail>a@b.com</mail>
</user>

XML
Database
XML Injection Example "
(Privilege Escalation)
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<role>user</role>
<mail>abc</mail>
<role>Administrator</role>
<mail>a@b.com</mail>
</user>
Web Form
Generated XML Message
abc</mail><role>Administrator<role>
<mail>a@b.com
4
.........
.........
<complexType name="UserType">
<all>
<element name="username" type="tns:StringUserType"
maxOccurs="1" minOccurs="1" />
<element name="password" type="tns:StringPassType"
maxOccurs="1" minOccurs="1"/>
<element name="role" type="tns:Int1000Type" 
maxOccurs="1" minOccurs="1"/> 
 

<element name="mail" type="tns:EmailType" 
maxOccurs="1" minOccurs="1" />
</all>
</complexType>
.........
.........
5
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<role>user</role>
<mail>abc</mail>
<role>Administrator</role>
<mail>a@b.com</mail>
</user>
Well-formed but not valid 
XML Schema
violates cardinality =1 constraint of
‘role’ element in XML Schema
<element name="role" type="tns:Int1000Type" 
maxOccurs="1" minOccurs="1"/>

XML Injection in presence of constraints
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<!--

</password>

<role>user</role>

<mail>
-->
<role>Administrator</role>
<mail>a@b.com</mail>
</user>
Web Form
Generated XML Message
Well-formed and valid
--><role>Administrator<role><mail>a@b.com
m1U9q10</password><!--
6
XML Injection in presence of constraints
•  Generate invalid XML files/messages
•  Result in large number of false positives
•  No dedicated testing tool for XML Injection attacks
Limitations of State-Of-The-Art Tools
7
•  A novel automated testing approach and tool
(SOLMI)
•  Generates valid but malicious XML files/messages
•  Covers wide range of XML Injection attacks
•  Evaluation of the approach on an industrial financial
system
Contributions of This Work
8
9
•  Type 1: Deforming
•  Type 2: Random closing tags
•  Type 3: Replicating
•  Type 4: Replacing
Taxonomy of XML Injection Attacks
<user>
<username>Tom</username> 
<password>m1U<9q10</password>
<role>user</role>
<mail>a@b.com</mail>
</user>
Mutated XML
10
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<role>user</role>
<mail>a@b.com</mail>
</user>
Original XML
Type 1: Deforming
Using XML special characters (e.g., <, &, ‘) to crash the service
Example:
<user>
<username>Tom</username> 
<password></test></password>
<role>user</role>
<mail>a@b.com</mail>
</user>
Mutated XML
11
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<role>user</role>
<mail>a@b.com</mail>
</user>
Original XML
Example: 
Type 2: Random Closing Tags
Using XML closing tags to reveal the hidden XML structure (e.g. </test>)
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<role>user</role>
<mail>abc</mail>
<role>Administrator</role>
<mail>a@b.com</mail>
</user>
Mutated XML
12
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<role>user</role>
<mail>a@b.com</mail>
</user>
Original XML
Example: 
Type 3: Replicating
Replicating existing XML elements with malicious content
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<!--

</password>

<role>user</role>

<mail>
-->
<role>Administrator</role>
<mail>a@b.com</mail>
</user>
Mutated XML
(XML is well-formed, valid, yet
malicious)
13
<user>
<username>Tom</username> 
<password>m1U9q10</password>
<role>user</role>
<mail>a@b.com</mail>
</user>
Original XML
Example: 
Type 4: Replacing 
Replicating + ensuring that the resulting XML is well formed and valid
Proposed Approach
14
SOLMI Approach
15
Generalizable approach: Injection Grammar can be replaced for testing other types of vulnerabilities
SUT
XML
Validator
(e.g.
Gateway/
Firewall)
Schema
Constraints
Security
Policies
XML
T1
T2
Tn
Mutation
XML Messages
(Tests)
Type 1 - 2
Web
Services
XML
XML
XML
Constraint
Solving
Injection
Grammar
Type 3 - 4
Mutation Operators
Attack
 Mut. Operator
 Description
Type 1
Deforming
MO_der_meta
Inserts an XML meta-character into the selected
element of the input XML message 
MO_der_att
Removes a quote from the value of a selected
attribute of an element
Type 2
Random
closing tags
MO_clo
Adds </test> into the content of a selected XML
element of the message 
Type 3
Replicating
MO_replica
Replicates an XML element, injects it with a new
content and place it at the location right after the
selected element
Type 4
Replacing
MO_replace
Replicates an XML element, obtains a new content,
comments out the selected element, and injects the
new one at its location
16
Injection Grammar
17
Generate attack strings for elements in XML (e.g. SQL Injection attack strings
based on the grammar)
SQL Injection Grammar *
* D. Appelt, C. Nguyen, and L. Briand. Behind an application firewall, are we safe from sql injection attacks? In Software Testing, Verification and Validation (ICST),
2015 IEEE 8th International Conference on, pages 1–10, April 2015.
18
Test Generation Process
(for Type 3-4)
Select Element
Tests Gen.
Completed?
End
No
Yes
Extract constraints from the
XML Schema
Solve Constraints, generate
attack string using Constraint Solver
Mutate Element with the attack
string
XML Element
Schema Constraints
 Attack String
Ti
Transform constraints to the
Solver’s input language
Injection
Grammar
Start
XML
Schema
19
Test Generation Process
(for Type 3-4)
Select Element
Tests Gen.
Completed?
End
No
Yes
Extract constraints from the
XML Schema
Solve Constraints, generate
attack string using Constraint Solver
Mutate Element with the attack
string
XML Element
Schema Constraints
 Attack String
Ti
Transform constraints to the
Solver’s input language
Injection
Grammar
Start
XML
Schema
20
Test Generation Process
(for Type 3-4)
Select Element
Tests Gen.
Completed?
End
No
Yes
Extract constraints from the
XML Schema
Solve Constraints, generate
attack string using Constraint Solver
Mutate Element with the attack
string
XML Element
Schema Constraints
 Attack String
Ti
Transform constraints to the
Solver’s input language
Injection
Grammar
Start
XML
Schema
21
Test Generation Process
(for Type 3-4)
Select Element
Tests Gen.
Completed?
End
No
Yes
Extract constraints from the
XML Schema
Solve Constraints, generate
attack string using Constraint Solver
Mutate Element with the attack
string
XML Element
Schema Constraints
 Attack String
Ti
Transform constraints to the
Solver’s input language
Injection
Grammar
Start
XML
Schema
22
Test Generation Process
(for Type 3-4)
Select Element
Tests Gen.
Completed?
End
No
Yes
Extract constraints from the
XML Schema
Solve Constraints, generate
attack string using Constraint Solver
Mutate Element with the attack
string
XML Element
Schema Constraints
 Attack String
Ti
Transform constraints to the
Solver’s input language
Injection
Grammar
Start
XML
Schema
23
Test Generation Process
(for Type 3-4)
Select Element
Tests Gen.
Completed?
End
No
Yes
Extract constraints from the
XML Schema
Solve Constraints, generate
attack string using Constraint Solver
Mutate Element with the attack
string
XML Element
Schema Constraints
 Attack String
Ti
Transform constraints to the
Solver’s input language
Injection
Grammar
Start
XML
Schema
24
Test Generation Process
(for Type 3-4)
Select Element
Tests Gen.
Completed?
End
No
Yes
Extract constraints from the
XML Schema
Solve Constraints, generate
attack string using Constraint Solver
Mutate Element with the attack
string
XML Element
Schema Constraints
 Attack String
Ti
Transform constraints to the
Solver’s input language
Injection
Grammar
Start
XML
Schema
<transaction> 

<UserName>Mike123</UserName> 


<BankCode>0111</BankCode> 

<RequestId>R19228381</RequestId> 

<CardNumber>1234567891234<CardNumber> 
</transaction> 
….....
<xs:element name=“RequestId”
type="cw:stringLen1_11"/>
</xs:simpleType>
<xs:simpleType name="stringLen1_11">
<xs:minLength value=”4"/>
<xs:maxLength value=”11"/>
<pattern value="[a-zA-Z0-9s]*"/>
</xs:restriction>
</xs:simpleType>
….....
XML File
 Transform Constraint to
Solver’s input language
Schema Constraint for element ‘RequestId’
Generated Content for
the XML element
(Attack Payload)
OR True
Examples of malicious content rejected by the solver:
-  OR 1=1 
 
à 
violates the regular expression
-  Drop table RequestIDs 
à 
violates maximum
length constraints
Injection
Grammar
Mutation 
(type 4)
<transaction> 

<UserName>Mika123</UserName> 


<BankCode>0111</BankCode>

<!– 

 
</BankCode>

 
<RequestId>R19228381</RequestId>

 
<CardNumber>

-->

<RequestId>OR True</RequestId>

<CardNumber>1234567891234<CardNumber> 
</transaction> 
Resulting XML Message (Test of Type 4)
Concrete Example of Test Generation "
(for Type 4)
Extract associated constraints for
selected element
25
String Constraint
Solver
Evaluation & Results
26
Objectives & Tools for evaluation
Objectives
•  To evaluate the effectiveness and cost (time) of our
proposed approach
•  To compare our proposed approach with the state-
of-the-art tools
Tools
•  ReadyAPI
•  SOLMI
27
Subject Application
28
XML Gateway (Axway XML Gateway) that protects 44 Web Services
of a credit card processing company 
Web Service 1
Web Service 2
Web Service N
XML
Schemas
XML Threat
Policy
Backend
Service
Interface 1
Service
Interface
Service
Interface N
XML GatewayInternet
Service
Interface 1
Service
Interface
Service
Interface N
XML Gateway
29
Architecture of SOLMI
Constraint Solver
Hampi
XML
Processor
Schema
Processor
Injection Grammar (SQL)
Test Generator
Mutation
Strategies
Test Cases
SUT
Test
Executor
Monitor/
Oracle
Transformer
Results
30
MO Operator
 # Tests (T)
 % Bypassing Tests (Tp)
 Test Generation Time (s)
ReadyAPI
Malformed
XML
4430
 2.37
 < 1 min
SOLMI
MO-meta
 1772
 0
 0.64
MO-close
 443
 0
 0.35
MO_der_att
 NA
 NA
 NA
MO-replica
 3236
 0
2929.99
(49 mins)
MO-replace
 3236
 78.86
2998.97
(50 mins)
Results
31
MO Operator
 # Tests (T)
 % Bypassing Tests (Tp)
 Test Generation Time (s)
ReadyAPI
Malformed
XML
4430
 2.37
 < 1 min
SOLMI
MO-meta
 1772
 0
 0.64
MO-close
 443
 0
 0.35
MO_der_att
 NA
 NA
 NA
MO-replica
 3236
 0
2929.99
(49 mins)
MO-replace
 3236
 78.86
2998.97
(50 mins)
Results
32
MO Operator
 # Tests (T)
 % Bypassing Tests (Tp)
 Test Generation Time (s)
ReadyAPI
Malformed
XML
4430
 2.37
 < 1 min
SOLMI
MO-meta
 1772
 0
 0.64
MO-close
 443
 0
 0.35
MO_der_att
 NA
 NA
 NA
MO-replica
 3236
 0
2929.99
(49 mins)
MO-replace
 3236
 78.86
2998.97
(50 mins)
Results
33
MO Operator
 # Tests (T)
 % Bypassing Tests (Tp)
 Test Generation Time (s)
ReadyAPI
Malformed
XML
4430
 2.37
 < 1 min
SOLMI
MO-meta
 1772
 0
 0.64
MO-close
 443
 0
 0.35
MO_der_att
 NA
 NA
 NA
MO-replica
 3236
 0
2929.99
(49 mins)
MO-replace
 3236
 78.86
2998.97
(50 mins)
Results
34
MO Operator
 # Tests (T)
 % Bypassing Tests (Tp)
 Test Generation Time (s)
ReadyAPI
Malformed
XML
4430
 2.37
 < 1 min
SOLMI
MO-meta
 1772
 0
 0.64
MO-close
 443
 0
 0.35
MO_der_att
 NA
 NA
 NA
MO-replica
 3236
 0
2929.99
(49 mins)
MO-replace
 3236
 78.86
2998.97
(50 mins)
Results
35
MO Operator
 # Tests (T)
 % Bypassing Tests (Tp)
 Test Generation Time (s)
ReadyAPI
Malformed
XML
4430
 2.37
 < 1 min
SOLMI
MO-meta
 1772
 0
 0.64
MO-close
 443
 0
 0.35
MO_der_att
 NA
 NA
 NA
MO-replica
 3236
 0
2929.99
(49 mins)
MO-replace
 3236
 78.86
2998.97
(50 mins)
36
•  Test strategy that randomly injects XML meta-
characters or closing tags (state-of-the-art tools)
are unlikely to be effective 
•  SOLMI approach is highly effective and the test
generation time is practically reasonable
•  SOLMI is generalizable to other types of attacks
Conclusion
Summary
37

More Related Content

PPT
XPath Injection
PDF
Hacking XPATH 2.0
PDF
[3.3] Detection & exploitation of Xpath/Xquery Injections - Boris Savkov
PPTX
XML & XPath Injections
PPTX
Natural Language Query to SQL conversion using Machine Learning Approach
PPTX
Java interface
PDF
Methods in Java
PDF
22 multi threading iv
XPath Injection
Hacking XPATH 2.0
[3.3] Detection & exploitation of Xpath/Xquery Injections - Boris Savkov
XML & XPath Injections
Natural Language Query to SQL conversion using Machine Learning Approach
Java interface
Methods in Java
22 multi threading iv

What's hot (20)

PPTX
Unit 4 exceptions and threads
PDF
Java Generics - by Example
PPT
Introduction to Java Programming Part 2
PPTX
Java interface
PPT
Chapter 4 - Defining Your Own Classes - Part I
PPTX
PPTX
Xml session
PDF
On Parameterised Types and Java Generics
PDF
Introduction [1] - Software Testing Techniques (CIS640)
PPT
Chapter 2 - Getting Started with Java
PDF
CS5393-Korat_Mittal_Akshay_ProjReport
PDF
Beyond PITS, Functional Principles for Software Architecture
PPTX
Java Generics
PDF
Validation and Inference of Schema-Level Workflow Data-Dependency Annotations
PDF
Java Generics Introduction - Syntax Advantages and Pitfalls
PDF
The Ring programming language version 1.2 book - Part 53 of 84
PPTX
Method overloading and constructor overloading in java
PPT
Generics in java
PPTX
Lecture - 5 Control Statement
PPT
Java interfaces
Unit 4 exceptions and threads
Java Generics - by Example
Introduction to Java Programming Part 2
Java interface
Chapter 4 - Defining Your Own Classes - Part I
Xml session
On Parameterised Types and Java Generics
Introduction [1] - Software Testing Techniques (CIS640)
Chapter 2 - Getting Started with Java
CS5393-Korat_Mittal_Akshay_ProjReport
Beyond PITS, Functional Principles for Software Architecture
Java Generics
Validation and Inference of Schema-Level Workflow Data-Dependency Annotations
Java Generics Introduction - Syntax Advantages and Pitfalls
The Ring programming language version 1.2 book - Part 53 of 84
Method overloading and constructor overloading in java
Generics in java
Lecture - 5 Control Statement
Java interfaces
Ad

Viewers also liked (20)

PDF
Blending Automated and Manual Testing
PPT
Fuzzing 101 Webinar on Zero Day Management
PPTX
Automated Attack Surface Approximation [FSE - SRC 2015]
PPTX
Software Security Education at Scale
PDF
Unmasking Anonymous: An Eyewitness Account of a Hacktivist Attack
PPTX
Sania: Syntactic and Semantic Analysis for Automated Testing against SQL Inje...
PDF
Autonomous Hacking: The New Frontiers of Attack and Defense
PPTX
A DevOps Guide to Web Application Security
PPT
Attacks Against Captcha Systems - DefCamp 2012
PPTX
Jon Gorenflo - Burp Collaborator
PPTX
DefCamp 2013 - In vehicle CAN network security
PPTX
Web-App Remote Code Execution Via Scripting Engines
PPTX
Apache Multiview Vulnerability
PPTX
PPTX
File upload vulnerabilities & mitigation
PDF
Sql injection bypassing hand book blackrose
PPTX
Cross Domain Hijacking - File Upload Vulnerability
PPTX
Waf bypassing Techniques
PDF
XML Attack Surface - Pierre Ernst (OWASP Ottawa)
PDF
SSRF workshop
Blending Automated and Manual Testing
Fuzzing 101 Webinar on Zero Day Management
Automated Attack Surface Approximation [FSE - SRC 2015]
Software Security Education at Scale
Unmasking Anonymous: An Eyewitness Account of a Hacktivist Attack
Sania: Syntactic and Semantic Analysis for Automated Testing against SQL Inje...
Autonomous Hacking: The New Frontiers of Attack and Defense
A DevOps Guide to Web Application Security
Attacks Against Captcha Systems - DefCamp 2012
Jon Gorenflo - Burp Collaborator
DefCamp 2013 - In vehicle CAN network security
Web-App Remote Code Execution Via Scripting Engines
Apache Multiview Vulnerability
File upload vulnerabilities & mitigation
Sql injection bypassing hand book blackrose
Cross Domain Hijacking - File Upload Vulnerability
Waf bypassing Techniques
XML Attack Surface - Pierre Ernst (OWASP Ottawa)
SSRF workshop
Ad

Similar to Automated and Effective Testing of Web Services for XML Injection Attacks (20)

PDF
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
PDF
xml rpc
PPTX
XML Schemas
PPTX
Simple xml in .net
PPT
XMLLec1.pptsfsfsafasfasdfasfdsadfdsfdf dfdsfds
PPT
XMLLec1 (1xML lecturefsfsdfsdfdsfdsfsdfsdfdsf
PPT
XML stands for EXtensible Markup Language
PPT
Mazda Use of Third Generation Xml Tools
PPTX
Schematron
PPTX
eXtensible Markup Language (XML)
PDF
Java 17
PDF
PostgreSQL and XML
PDF
tutorial21
PDF
tutorial21
PPTX
Secure Dot Net Programming
PPT
Implementing the Genetic Algorithm in XSLT: PoC
DOCX
ORACLE SOA SUIT BASIC XML FORMATS
DOCX
Soa suite doc
PPTX
Generating characterization tests for legacy code
PPT
XML - EXtensible Markup Language
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
xml rpc
XML Schemas
Simple xml in .net
XMLLec1.pptsfsfsafasfasdfasfdsadfdsfdf dfdsfds
XMLLec1 (1xML lecturefsfsdfsdfdsfdsfsdfsdfdsf
XML stands for EXtensible Markup Language
Mazda Use of Third Generation Xml Tools
Schematron
eXtensible Markup Language (XML)
Java 17
PostgreSQL and XML
tutorial21
tutorial21
Secure Dot Net Programming
Implementing the Genetic Algorithm in XSLT: PoC
ORACLE SOA SUIT BASIC XML FORMATS
Soa suite doc
Generating characterization tests for legacy code
XML - EXtensible Markup Language

More from Lionel Briand (20)

PDF
LTM: Scalable and Black-box Similarity-based Test Suite Minimization based on...
PDF
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
PDF
Automated Test Case Repair Using Language Models
PDF
Automated Testing and Safety Analysis of Deep Neural Networks
PDF
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
PDF
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
PDF
Precise and Complete Requirements? An Elusive Goal
PDF
Large Language Models for Test Case Evolution and Repair
PDF
Metamorphic Testing for Web System Security
PDF
Simulator-based Explanation and Debugging of Hazard-triggering Events in DNN-...
PDF
Fuzzing for CPS Mutation Testing
PDF
Data-driven Mutation Analysis for Cyber-Physical Systems
PDF
Many-Objective Reinforcement Learning for Online Testing of DNN-Enabled Systems
PDF
ATM: Black-box Test Case Minimization based on Test Code Similarity and Evolu...
PDF
Black-box Safety Analysis and Retraining of DNNs based on Feature Extraction ...
PDF
PRINS: Scalable Model Inference for Component-based System Logs
PDF
Revisiting the Notion of Diversity in Software Testing
PDF
Applications of Search-based Software Testing to Trustworthy Artificial Intel...
PDF
Autonomous Systems: How to Address the Dilemma between Autonomy and Safety
PDF
Mathematicians, Social Scientists, or Engineers? The Split Minds of Software ...
LTM: Scalable and Black-box Similarity-based Test Suite Minimization based on...
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
Automated Test Case Repair Using Language Models
Automated Testing and Safety Analysis of Deep Neural Networks
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Precise and Complete Requirements? An Elusive Goal
Large Language Models for Test Case Evolution and Repair
Metamorphic Testing for Web System Security
Simulator-based Explanation and Debugging of Hazard-triggering Events in DNN-...
Fuzzing for CPS Mutation Testing
Data-driven Mutation Analysis for Cyber-Physical Systems
Many-Objective Reinforcement Learning for Online Testing of DNN-Enabled Systems
ATM: Black-box Test Case Minimization based on Test Code Similarity and Evolu...
Black-box Safety Analysis and Retraining of DNNs based on Feature Extraction ...
PRINS: Scalable Model Inference for Component-based System Logs
Revisiting the Notion of Diversity in Software Testing
Applications of Search-based Software Testing to Trustworthy Artificial Intel...
Autonomous Systems: How to Address the Dilemma between Autonomy and Safety
Mathematicians, Social Scientists, or Engineers? The Split Minds of Software ...

Recently uploaded (20)

PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
medical staffing services at VALiNTRY
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
top salesforce developer skills in 2025.pdf
PPTX
ai tools demonstartion for schools and inter college
PDF
Nekopoi APK 2025 free lastest update
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
assetexplorer- product-overview - presentation
PPTX
history of c programming in notes for students .pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Designing Intelligence for the Shop Floor.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Softaken Excel to vCard Converter Software.pdf
medical staffing services at VALiNTRY
Internet Downloader Manager (IDM) Crack 6.42 Build 41
2025 Textile ERP Trends: SAP, Odoo & Oracle
CHAPTER 2 - PM Management and IT Context
top salesforce developer skills in 2025.pdf
ai tools demonstartion for schools and inter college
Nekopoi APK 2025 free lastest update
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Transform Your Business with a Software ERP System
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
assetexplorer- product-overview - presentation
history of c programming in notes for students .pptx
Reimagine Home Health with the Power of Agentic AI​
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)

Automated and Effective Testing of Web Services for XML Injection Attacks

  • 1. .lusoftware verification & validation VVS Automated and Effective Testing of Web Services for XML Injection Attacks Sadeeq Jan, Cu D. Nguyen, Lionel Briand Interdisciplinary Centre for Security, Reliability and Trust (SnT) University of Luxembourg ISSTA’16 The International Symposium on Software Testing and Analysis Saarland University, Saarbrücken, Germany. July 18-20, 2016
  • 2. XML Injection 2 •  Bypassing authentication •  Privilege escalation •  Information disclosure •  Generating errors/system crash Impact Definition Injecting malicious content into XML files/messages to manipulate/compromise the logic of an application/ service
  • 3. 3 XML Injection Example Create new account <user> <username>Tom</username> <password>m1U9q10</password> <role>user</role> <mail>[email protected]</mail> </user> <user> <username>admin</username> <password>s4n3p81</password> <role>Administrator</role> <mail>[email protected]</mail> </user> ….. ...... <user> <username>Tom</username> <password>m1U9q10</password> <role>user</role> <mail>[email protected]</mail> </user> XML Database
  • 4. XML Injection Example " (Privilege Escalation) <user> <username>Tom</username> <password>m1U9q10</password> <role>user</role> <mail>abc</mail> <role>Administrator</role> <mail>[email protected]</mail> </user> Web Form Generated XML Message abc</mail><role>Administrator<role> <mail>[email protected] 4
  • 5. ......... ......... <complexType name="UserType"> <all> <element name="username" type="tns:StringUserType" maxOccurs="1" minOccurs="1" /> <element name="password" type="tns:StringPassType" maxOccurs="1" minOccurs="1"/> <element name="role" type="tns:Int1000Type" maxOccurs="1" minOccurs="1"/> <element name="mail" type="tns:EmailType" maxOccurs="1" minOccurs="1" /> </all> </complexType> ......... ......... 5 <user> <username>Tom</username> <password>m1U9q10</password> <role>user</role> <mail>abc</mail> <role>Administrator</role> <mail>[email protected]</mail> </user> Well-formed but not valid XML Schema violates cardinality =1 constraint of ‘role’ element in XML Schema <element name="role" type="tns:Int1000Type" maxOccurs="1" minOccurs="1"/> XML Injection in presence of constraints
  • 7. •  Generate invalid XML files/messages •  Result in large number of false positives •  No dedicated testing tool for XML Injection attacks Limitations of State-Of-The-Art Tools 7
  • 8. •  A novel automated testing approach and tool (SOLMI) •  Generates valid but malicious XML files/messages •  Covers wide range of XML Injection attacks •  Evaluation of the approach on an industrial financial system Contributions of This Work 8
  • 9. 9 •  Type 1: Deforming •  Type 2: Random closing tags •  Type 3: Replicating •  Type 4: Replacing Taxonomy of XML Injection Attacks
  • 10. <user> <username>Tom</username> <password>m1U<9q10</password> <role>user</role> <mail>[email protected]</mail> </user> Mutated XML 10 <user> <username>Tom</username> <password>m1U9q10</password> <role>user</role> <mail>[email protected]</mail> </user> Original XML Type 1: Deforming Using XML special characters (e.g., <, &, ‘) to crash the service Example:
  • 11. <user> <username>Tom</username> <password></test></password> <role>user</role> <mail>[email protected]</mail> </user> Mutated XML 11 <user> <username>Tom</username> <password>m1U9q10</password> <role>user</role> <mail>[email protected]</mail> </user> Original XML Example: Type 2: Random Closing Tags Using XML closing tags to reveal the hidden XML structure (e.g. </test>)
  • 12. <user> <username>Tom</username> <password>m1U9q10</password> <role>user</role> <mail>abc</mail> <role>Administrator</role> <mail>[email protected]</mail> </user> Mutated XML 12 <user> <username>Tom</username> <password>m1U9q10</password> <role>user</role> <mail>[email protected]</mail> </user> Original XML Example: Type 3: Replicating Replicating existing XML elements with malicious content
  • 13. <user> <username>Tom</username> <password>m1U9q10</password> <!-- </password> <role>user</role> <mail> --> <role>Administrator</role> <mail>[email protected]</mail> </user> Mutated XML (XML is well-formed, valid, yet malicious) 13 <user> <username>Tom</username> <password>m1U9q10</password> <role>user</role> <mail>[email protected]</mail> </user> Original XML Example: Type 4: Replacing Replicating + ensuring that the resulting XML is well formed and valid
  • 15. SOLMI Approach 15 Generalizable approach: Injection Grammar can be replaced for testing other types of vulnerabilities SUT XML Validator (e.g. Gateway/ Firewall) Schema Constraints Security Policies XML T1 T2 Tn Mutation XML Messages (Tests) Type 1 - 2 Web Services XML XML XML Constraint Solving Injection Grammar Type 3 - 4
  • 16. Mutation Operators Attack Mut. Operator Description Type 1 Deforming MO_der_meta Inserts an XML meta-character into the selected element of the input XML message MO_der_att Removes a quote from the value of a selected attribute of an element Type 2 Random closing tags MO_clo Adds </test> into the content of a selected XML element of the message Type 3 Replicating MO_replica Replicates an XML element, injects it with a new content and place it at the location right after the selected element Type 4 Replacing MO_replace Replicates an XML element, obtains a new content, comments out the selected element, and injects the new one at its location 16
  • 17. Injection Grammar 17 Generate attack strings for elements in XML (e.g. SQL Injection attack strings based on the grammar) SQL Injection Grammar * * D. Appelt, C. Nguyen, and L. Briand. Behind an application firewall, are we safe from sql injection attacks? In Software Testing, Verification and Validation (ICST), 2015 IEEE 8th International Conference on, pages 1–10, April 2015.
  • 18. 18 Test Generation Process (for Type 3-4) Select Element Tests Gen. Completed? End No Yes Extract constraints from the XML Schema Solve Constraints, generate attack string using Constraint Solver Mutate Element with the attack string XML Element Schema Constraints Attack String Ti Transform constraints to the Solver’s input language Injection Grammar Start XML Schema
  • 19. 19 Test Generation Process (for Type 3-4) Select Element Tests Gen. Completed? End No Yes Extract constraints from the XML Schema Solve Constraints, generate attack string using Constraint Solver Mutate Element with the attack string XML Element Schema Constraints Attack String Ti Transform constraints to the Solver’s input language Injection Grammar Start XML Schema
  • 20. 20 Test Generation Process (for Type 3-4) Select Element Tests Gen. Completed? End No Yes Extract constraints from the XML Schema Solve Constraints, generate attack string using Constraint Solver Mutate Element with the attack string XML Element Schema Constraints Attack String Ti Transform constraints to the Solver’s input language Injection Grammar Start XML Schema
  • 21. 21 Test Generation Process (for Type 3-4) Select Element Tests Gen. Completed? End No Yes Extract constraints from the XML Schema Solve Constraints, generate attack string using Constraint Solver Mutate Element with the attack string XML Element Schema Constraints Attack String Ti Transform constraints to the Solver’s input language Injection Grammar Start XML Schema
  • 22. 22 Test Generation Process (for Type 3-4) Select Element Tests Gen. Completed? End No Yes Extract constraints from the XML Schema Solve Constraints, generate attack string using Constraint Solver Mutate Element with the attack string XML Element Schema Constraints Attack String Ti Transform constraints to the Solver’s input language Injection Grammar Start XML Schema
  • 23. 23 Test Generation Process (for Type 3-4) Select Element Tests Gen. Completed? End No Yes Extract constraints from the XML Schema Solve Constraints, generate attack string using Constraint Solver Mutate Element with the attack string XML Element Schema Constraints Attack String Ti Transform constraints to the Solver’s input language Injection Grammar Start XML Schema
  • 24. 24 Test Generation Process (for Type 3-4) Select Element Tests Gen. Completed? End No Yes Extract constraints from the XML Schema Solve Constraints, generate attack string using Constraint Solver Mutate Element with the attack string XML Element Schema Constraints Attack String Ti Transform constraints to the Solver’s input language Injection Grammar Start XML Schema
  • 25. <transaction> <UserName>Mike123</UserName> <BankCode>0111</BankCode> <RequestId>R19228381</RequestId> <CardNumber>1234567891234<CardNumber> </transaction> …..... <xs:element name=“RequestId” type="cw:stringLen1_11"/> </xs:simpleType> <xs:simpleType name="stringLen1_11"> <xs:minLength value=”4"/> <xs:maxLength value=”11"/> <pattern value="[a-zA-Z0-9s]*"/> </xs:restriction> </xs:simpleType> …..... XML File Transform Constraint to Solver’s input language Schema Constraint for element ‘RequestId’ Generated Content for the XML element (Attack Payload) OR True Examples of malicious content rejected by the solver: -  OR 1=1 à violates the regular expression -  Drop table RequestIDs à violates maximum length constraints Injection Grammar Mutation (type 4) <transaction> <UserName>Mika123</UserName> <BankCode>0111</BankCode> <!– </BankCode> <RequestId>R19228381</RequestId> <CardNumber> --> <RequestId>OR True</RequestId> <CardNumber>1234567891234<CardNumber> </transaction> Resulting XML Message (Test of Type 4) Concrete Example of Test Generation " (for Type 4) Extract associated constraints for selected element 25 String Constraint Solver
  • 27. Objectives & Tools for evaluation Objectives •  To evaluate the effectiveness and cost (time) of our proposed approach •  To compare our proposed approach with the state- of-the-art tools Tools •  ReadyAPI •  SOLMI 27
  • 28. Subject Application 28 XML Gateway (Axway XML Gateway) that protects 44 Web Services of a credit card processing company Web Service 1 Web Service 2 Web Service N XML Schemas XML Threat Policy Backend Service Interface 1 Service Interface Service Interface N XML GatewayInternet Service Interface 1 Service Interface Service Interface N XML Gateway
  • 29. 29 Architecture of SOLMI Constraint Solver Hampi XML Processor Schema Processor Injection Grammar (SQL) Test Generator Mutation Strategies Test Cases SUT Test Executor Monitor/ Oracle Transformer
  • 30. Results 30 MO Operator # Tests (T) % Bypassing Tests (Tp) Test Generation Time (s) ReadyAPI Malformed XML 4430 2.37 < 1 min SOLMI MO-meta 1772 0 0.64 MO-close 443 0 0.35 MO_der_att NA NA NA MO-replica 3236 0 2929.99 (49 mins) MO-replace 3236 78.86 2998.97 (50 mins)
  • 31. Results 31 MO Operator # Tests (T) % Bypassing Tests (Tp) Test Generation Time (s) ReadyAPI Malformed XML 4430 2.37 < 1 min SOLMI MO-meta 1772 0 0.64 MO-close 443 0 0.35 MO_der_att NA NA NA MO-replica 3236 0 2929.99 (49 mins) MO-replace 3236 78.86 2998.97 (50 mins)
  • 32. Results 32 MO Operator # Tests (T) % Bypassing Tests (Tp) Test Generation Time (s) ReadyAPI Malformed XML 4430 2.37 < 1 min SOLMI MO-meta 1772 0 0.64 MO-close 443 0 0.35 MO_der_att NA NA NA MO-replica 3236 0 2929.99 (49 mins) MO-replace 3236 78.86 2998.97 (50 mins)
  • 33. Results 33 MO Operator # Tests (T) % Bypassing Tests (Tp) Test Generation Time (s) ReadyAPI Malformed XML 4430 2.37 < 1 min SOLMI MO-meta 1772 0 0.64 MO-close 443 0 0.35 MO_der_att NA NA NA MO-replica 3236 0 2929.99 (49 mins) MO-replace 3236 78.86 2998.97 (50 mins)
  • 34. Results 34 MO Operator # Tests (T) % Bypassing Tests (Tp) Test Generation Time (s) ReadyAPI Malformed XML 4430 2.37 < 1 min SOLMI MO-meta 1772 0 0.64 MO-close 443 0 0.35 MO_der_att NA NA NA MO-replica 3236 0 2929.99 (49 mins) MO-replace 3236 78.86 2998.97 (50 mins)
  • 35. Results 35 MO Operator # Tests (T) % Bypassing Tests (Tp) Test Generation Time (s) ReadyAPI Malformed XML 4430 2.37 < 1 min SOLMI MO-meta 1772 0 0.64 MO-close 443 0 0.35 MO_der_att NA NA NA MO-replica 3236 0 2929.99 (49 mins) MO-replace 3236 78.86 2998.97 (50 mins)
  • 36. 36 •  Test strategy that randomly injects XML meta- characters or closing tags (state-of-the-art tools) are unlikely to be effective •  SOLMI approach is highly effective and the test generation time is practically reasonable •  SOLMI is generalizable to other types of attacks Conclusion