← SAML lesson
IdentitySAMLAdvanced45 min+100 XP

Delete the Signature

The Northwind SAML Portal accepts a base64 SAMLResponse and grants the administrator console when the role attribute is admin. Exploit the stripped flaw in assertion validation.

“The identity provider signed an analyst assertion, but the service provider read the role from an unsigned copy and granted administrator.”

OASIS SAML 2.0 CoreOASIS SAML 2.0 ProfilesW3C XML Signature Syntax and ProcessingNIST SP 800-63B: Digital Identity GuidelinesOWASP SAML Security Cheat Sheet
The story
SAML is XML with a signature, and XML has many equivalent representations. Security depends on verifying the signature over the exact element that is later used for authorization, then enforcing audience, recipient, time and replay rules.

Service providers often parse XML into a document, verify one assertion, then read identity or attributes from another node, another namespace or an unsigned extension. Signature wrapping, comment truncation, stripped signatures and missing audience or recipient checks let an attacker reuse a valid signature while changing what the application trusts. A response can also be replayed to a different SP or ACS when those constraints are not enforced.

Your objective
  • Decode the signed sample
  • Identify which parts of the response are trusted
  • Forge or replay an administrator assertion
  • Capture the flag
Boundary under test

Browser to service provider ACS

Field guide · request anatomy

Where to look before you type a payload

01Receive

The browser posts a base64 SAMLResponse to the service provider's assertion consumer service.

02Parse

The XML parser builds a document tree with assertions, signatures, namespaces and attributes.

03Verify

The SP checks the signature over a specific element and resolves the reference and canonicalization.

04Select

The application chooses the assertion, NameID and attributes that will define the session.

Progressive hints

Open one hint at a time. The first two build the model; the last two point at the boundary.

Hint 1

Open the sample, decode the base64 and identify the Assertion, the Signature and the role attribute.

Hint 2

Ask which exact bytes the signature covers; the lab mode tells you where the trust boundary is broken.

Hint 3

Decode the sample, delete the <Signature> element, change the role to admin, and submit. The SP fails open when the signature is missing.

Hint 4 · near the answer

Submit the base64 SAMLResponse to /saml/acs; the flag appears when the SP grants administrator.

Guided workbench

Observe → Hypothesize → Test → Prove → Explain

This is the same loop a reviewer expects in a report. Your draft stays in this browser; nothing is submitted until you choose to export it.

0/15steps complete
Observe0/3
Hypothesize0/3
Test0/3
Prove0/3
Explain0/3

Evidence log

Write for a reviewer who was not in the room. Every claim needs a request, response or state change behind it.

Preview the evidence report
# Lab evidence report — Delete the Signature

- Family: SAML
- Lab ID: web-saml-stripped-signature
- Date: 2026-12-05

## Workflow

### Observe

- [ ] Open "Delete the Signature" and record the entry point, the HTTP method and the role you are given.
- [ ] List every parameter, header, cookie and object identifier the normal flow exposes.
- [ ] Save a baseline response: status, body shape, timing and the fields that change by user.

### Hypothesize

- [ ] Name the server decision that protects the entry point, and the evidence it should use.
- [ ] Use the clue as a constraint, not an answer: Decode the sample, delete the <Signature> element, change the role to admin, and submit. The SP fails open when the signature is missing.
- [ ] Predict the exact status, body or state change that would prove the decision is missing.

### Test

- [ ] Start from the baseline and change one value: the SAMLResponse assertion and signature.
- [ ] Keep the request replayable; vary encoding, method or identifier location only after the first result.
- [ ] Capture the full request and response for the winning attempt, including the flag.

### Prove

- [ ] Capture the flag and name the exact foreign object, role or state change it proves.
- [ ] Repeat from a clean session and confirm the result is not cached or stale.
- [ ] State impact precisely: what data or action did you actually obtain?

### Explain

- [ ] State the root cause without naming the payload: which decision failed?
- [ ] Name the control that prevents recurrence and the layer where it belongs.
- [ ] Write one regression test that fails before the fix and passes after it.

## Evidence

### Target and baseline

_Not recorded._

### Hypothesis

_Not recorded._

### Winning request

_Not recorded._

### Proof

_Not recorded._

### Root cause

_Not recorded._

### Control and regression test

_Not recorded._

## Analyst conclusion

The proof demonstrates the missing control above. The regression test should fail against the vulnerable behavior and pass after remediation.
Solution and debrief
Locked until you capture the flag.

The full request, the reasoning and the debrief unlock after a successful capture. That is deliberate: struggle first, then consolidate.

What a reviewer will ask

False positives to rule out

  • The SP rejects the response before reading any attribute; a signature error is not a bypass.
  • The changed attribute is inside the signed assertion and the signature check fails.
  • The response is accepted only for the same audience and recipient and the attacker gains no new privilege.

Regression tests to name

  • Unsigned response is rejected: Authentication fails with an explicit signature error
  • Signature wrapping is rejected: The request is rejected or only the verified assertion is used
  • Audience and recipient enforced: The service provider rejects it for audience or recipient mismatch
The defender's move
  • Use a maintained SAML library and verify the signature over the exact assertion that supplies identity and attributes.
  • Reject unsigned assertions, enforce audience, recipient, issuer, NotBefore and NotOnOrAfter, and bind responses to the request ID.
  • Reject duplicate IDs, unexpected namespace declarations and multiple assertions unless the profile explicitly allows them.
  • Use short assertion lifetimes, one-time replay caches, signed request/response exchange and strict XML parsing.
See the secure-code pattern and all 4 regression tests →
الخلاصة

SAML تعتمد على XML وتوقيعه، وXML له تمثيلات متكافئة كثيرة. الخطر عندما يتحقق الخادم من توقيع Assertion ثم يقرأ الدور أو الهوية من عقدة أخرى غير موقعة. الحل: استخدم مكتبة SAML مُصانة، وتحقق من التوقيع على نفس العقدة التي تُستخدم للتفويض، وارفض الاستجابات غير الموقعة، واشترط audience وrecipient والوقت وعدم التكرار، وارفض المعرفات المكررة والمساحات الاسمية غير المتوقعة.