SAML Response Decoder
Operator: Abdulla Al Fahad. How tools are built and checked
The SAMLResponse in a browser trace is a long base64 string, and the error your service provider shows for it, signature invalid or audience mismatch, rarely says which part failed. Decoding is the easy half. The harder half is knowing whether the person who sent the message could have changed what you are reading.
This page decodes SAMLResponse and AuthnRequest messages from base64, from a redirect URL or from plain XML, shows the fields people check when single sign-on breaks, and verifies the XML signature against a certificate you paste. It says verified only when every step passed, and it ties the signature to the assertion on screen.
It does not fetch metadata, call your identity provider or send the message anywhere.
Key features
- Accepts a bare base64 value, a percent-encoded one, a redirect URL with SAMLRequest or SAMLResponse (raw-deflated), an HTML form field, or the XML itself
- Message fields: issuer, ID, IssueInstant, Destination, InResponseTo, status and message, NameIDPolicy and RequestedAuthnContext for requests, RelayState
- Per assertion: subject NameID and format, subject confirmation with Recipient and expiry, Conditions window, audiences, authentication instant, session index and end, context class, and every attribute with all its values
- Time checks with an adjustable clock allowance and a time-to-check override, plus optional expected audience, ACS URL and issuer comparisons
- XML signature verification with exclusive or inclusive canonicalization, SHA-1 to SHA-512 digests and RSA or ECDSA signatures, shown step by step
- Redirect-binding signature check over the raw query string with the SigAlg and Signature parameters
- Warnings for several assertions, assertions outside the expected position, an assertion hidden inside a ds:Signature, duplicate IDs, encrypted assertions and SHA-1
How SAML messages are encoded and how the signature is checked
In the HTTP-POST binding the XML is base64 in a form field. In the HTTP-Redirect binding the XML is first deflated (raw DEFLATE, no zlib header), then base64 encoded, then URL encoded, so a pasted URL is decoded in that order and the inflated size is capped at 5 MB. A redirect message is signed outside the XML: the signature covers the query string up to SigAlg, written in the order message, RelayState, SigAlg, with each value in its URL-encoded form.
An XML signature holds a SignedInfo with a canonicalization method, a signature method and one Reference. The Reference names the signed element by an ID in its URI, lists transforms (an enveloped-signature transform and a canonicalization), and carries a digest of the result. SignatureValue signs the canonical SignedInfo. A verifier must recompute the digest, then verify the signature over SignedInfo with a key it trusts.
Exclusive canonicalization writes only the namespace declarations an element actually uses, sorts attributes by namespace URI and local name, and escapes text and attribute values in a fixed way, which is why a re-serialised document can still match its digest. This page's canonicalizer was compared byte for byte with the output of xmllint --c14n and xmllint --exc-c14n on 22 test documents covering namespace redeclarations, resets of the default namespace, attribute order, escaped characters, CRLF line ends, character references, CDATA and comments, and it honours an InclusiveNamespaces PrefixList.
How it works
The XML is read by a namespace-aware reader that refuses any DOCTYPE or entity declaration, resolves only the five predefined entities and numeric references, and caps depth, element count and attribute count.
The key comes from the certificate you paste, never from KeyInfo in the message. If you leave the box empty and choose the embedded option, a passing check is labelled consistent with its own certificate only, because anyone can embed a certificate of their own.
Defences against signature wrapping run before the digest: every ID must belong to exactly one element, the Reference must resolve to exactly one element, that element must be the Signature's own parent, only enveloped-signature and canonicalization transforms are allowed, and a signature with more than one Reference fails.
After verification, each assertion is tested for sitting inside an element whose signature verified. Those that do not are labelled not verified and counted against the verdict, whatever else passed. A signature's own subtree (ds:Object, ds:KeyInfo, SignatureValue) never counts as covered, because the enveloped-signature transform removes the whole ds:Signature before the digest is taken; an assertion found there is reported as an error. In a request or logout message that has no assertion in it, the signature has to be on the message element itself, not on a signed element nested somewhere inside an unsigned one.
The verdict is Verified only if every signature passed every step, every assertion and encrypted assertion shown is covered, and a message without assertions is itself the signed element. Anything less is shown as failed, not verified, partly verified or consistent with its own certificate only. A message with more than 20 signatures is reported as not checked, because none of them is examined.
When this helps
- An integrator sees users rejected with audience mismatch, pastes the response, and the Checks list shows the Audience is the old entity ID https://app.example.test/saml/metadata while the new service provider expects another.
- An administrator whose logins started failing at 09:00 sets the time to check to 08:59 and sees the assertion's NotOnOrAfter is before the service provider's clock, which points to clock drift.
- A security reviewer tests an application by pasting a captured response, then looks at the assertion panel to see that the unsigned assertion is the one the application displays. The same check applies to a captured AuthnRequest: when its Destination or AssertionConsumerServiceURL sits outside the signed element, the page reports Partly verified instead of Verified.
Opening a file
- Paste the SAMLResponse value, the redirect URL or the XML. Dropping a saved file also works.
- Paste your identity provider's signing certificate (PEM) from its metadata. Optionally fill the expected audience, ACS URL and issuer, and set the clock allowance.
- Choose Decode and check. Read the verdict banner, then the Checks list.
- Open Signature steps to see which step failed, and the assertion panels for the attribute values.
Example
Signed example, tampered example and wrapping example (certificates are throwaway)
Signed: assertion _a8f31c0d52 for alice@example.com, signed with ECDSA P-256 and SHA-256, valid from 61 s ago to 5 min ahead, audience https://app.example.test/saml/metadata, attributes email, displayName and groups (engineering, oncall)
Tampered: the NameID and email changed to admin@example.com after signing
Wrapping: an unsigned assertion _evil0001 for admin@example.com first, the signed original inside samlp:ExtensionsVerdicts
Signed: Verified; 12 signature steps pass; the audience and time-window checks report ok and none fails; note that only the assertion is signed, not the Response wrapper
Tampered: Signature check failed at step Digest of the signed element (the SHA-256 of the canonical assertion does not equal DigestValue)
Wrapping: Partly verified; the signature is good but _evil0001 is not inside the signed element and is marked not verified; warnings for two assertions and for an assertion under ExtensionsTips for best results
- Take the certificate from the IdP's metadata or admin console, not from the message. The page will also show the embedded certificate's fingerprint so the two can be compared.
- A clock allowance of 60 to 120 seconds is a common tolerance. Set it to 0 to see the exact margin.
- When the Response itself is unsigned but the assertion is signed, the page notes that Status and Destination are not covered by the signature; some service providers require the Response to be signed as well.
- An empty AttributeValue and an AttributeValue marked nil are listed differently, since some applications treat them differently.
Limits
A signature that verifies proves the signed bytes came from the holder of the key. It does not prove the login is acceptable: audience, recipient, time window, replay and InResponseTo still need checking by the service provider.
Only RSA PKCS#1 v1.5 and ECDSA signature methods are supported, and only the two XML canonicalization 1.0 families (inclusive and exclusive, with or without comments). RSA-PSS and DSA signatures, and canonicalization 1.1, are reported as unsupported and are never reported as verified.
Encrypted assertions are not decrypted, since that needs the service provider's private key, which this page never asks for. Their presence is reported.
Decoded assertions can contain names, e-mail addresses and group memberships. Treat a captured response as personal data.
Common errors and how to fix them
- The input is neither XML nor valid base64.
- Paste the value of the SAMLResponse or SAMLRequest field, the whole redirect URL, or the XML. Remove any surrounding quotes or the field name if you copied from a header.
- The document declares a DOCTYPE or an entity. It was refused.
- SAML messages never need either, and entity declarations are how XML bombs and file-reading attacks are built. Do not process such a message in your own software either.
- N elements share the ID. A verifier that picks a different one than the application reads is the signature-wrapping attack.
- The message contains two elements with the same ID value. Treat it as hostile; a genuine IdP never produces it.
- The signature sits in one element but signs another.
- The Reference points at an element that is not the Signature's parent. SAML requires an enveloped signature on its own parent, so a detached or foreign reference is rejected.
Best practices
- Have your service provider reject any message that carries more than one assertion, or an assertion outside the Response's direct children, rather than picking one.
- Require the signature to cover the assertion, and read attributes only from the element the signature verified.
What the wrapping example shows
A signature wrapping attack keeps a validly signed element and moves it out of the way, then inserts an unsigned element where the application looks. The signature check then passes on the original element while the application reads the attacker's. In the wrapping example the signed assertion sits under samlp:Extensions and a new assertion for admin@example.com stands in the usual place. The signature step list is all green, which is the dangerous part, and the page still returns Partly verified because the assertion that would be read is not inside the signed element.
Two quieter shapes get the same verdict. In the first, the unsigned assertion is tucked inside the signature itself, under ds:Object or ds:KeyInfo: the digest skips the entire ds:Signature, so the text there is not signed, yet it is a descendant of the signed Response or assertion and a naive coverage test would count it. In the second, a genuinely signed AuthnRequest or LogoutRequest is placed inside the Extensions of an unsigned message that carries the attacker's own destination; the signature verifies, but it signs the inner element, so the outer fields are marked unsigned.
Which certificate to paste
Use the signing certificate your identity provider publishes in its metadata or admin console, and compare its SHA-256 fingerprint with the one the page prints for the certificate embedded in the message. If an IdP rotates its key it publishes both for a period, so paste both certificates in the box and the check passes when either one verifies. If the embedded certificate is not among the ones you pasted, that is worth asking the IdP about before trusting any of its messages.
Frequently asked questions
Why does the verdict not say valid when the signature passes?
A passing signature only covers the element it references. The verdict also needs every assertion on screen to be inside that element, and the key to come from your pasted certificate. Without those, the honest label is partly verified or consistent with its own certificate only.
Does it check that the same assertion was not used before?
No. Replay detection needs a store of assertion IDs kept by the service provider. The page shows the ID, the one-time-use flag and the window, so you can see what such a check would use.
Can it decode a Microsoft Entra ID or Okta response?
Yes, any standard SAML 2.0 message. Microsoft Entra ID (formerly Azure AD) and Okta sign the assertion, the response or both; the page handles each, and the notes under the verdict say which of the two was covered.