xml_saml_security

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleID    = "xml-saml-security"
	ModuleName  = "XML SAML Security"
	ModuleShort = "SAML XML security checks (XXE + signature verification)"
)

Variables

View Source
var (
	ModuleDesc = `` /* 673-byte string literal not displayed */

	ModuleConfirmation = "" /* 223-byte string literal not displayed */
	ModuleSeverity     = severity.High
	ModuleConfidence   = severity.Firm
	ModuleTags         = []string{"injection", "xxe", "authentication", "auth-bypass", "moderate"}
)

Functions

func DeflateCompress

func DeflateCompress(data []byte) ([]byte, error)

DeflateCompress compresses data using DEFLATE (raw, no header).

func DeflateDecompress

func DeflateDecompress(data []byte) ([]byte, error)

DeflateDecompress decompresses DEFLATE data (raw, no header).

func EncodeSAML

func EncodeSAML(xmlContent string, original *DecodedSAML) string

EncodeSAML encodes XML back to SAML format using original encoding.

func InjectDOCTYPE

func InjectDOCTYPE(doc *XMLDocument, decoded *DecodedSAML, systemURL string) (string, error)

InjectDOCTYPE creates a payload with an external-DTD DOCTYPE pointing at the supplied out-of-band (OAST) callback URL. If the target's XML parser loads the external DTD subset, it fetches systemURL and the OAST server records an interaction — the only signal that confirms the parser processes external DTDs.

func InjectENTITY

func InjectENTITY(doc *XMLDocument, decoded *DecodedSAML, systemURL string) (string, error)

InjectENTITY creates a payload that declares an external general entity pointing at the supplied OAST callback URL and references it in the document body (in place of the original ID value). If the parser resolves and expands the entity, it fetches systemURL and the OAST server records an interaction — out-of-band proof of XXE, replacing the previous response-shape heuristic.

Types

type DecodedSAML

type DecodedSAML struct {
	XMLContent   string
	IsCompressed bool
	IsBase64     bool
}

DecodedSAML holds the decoded SAML data and encoding flags.

func DecodeSAML

func DecodeSAML(input string) (*DecodedSAML, error)

DecodeSAML decodes a SAML parameter value. Flow: URL decode -> Base64 decode -> DEFLATE decompress -> XML

type Module

type Module struct {
	modkit.BaseActiveModule
	// contains filtered or unexported fields
}

Module implements XML SAML security scanning.

func New

func New() *Module

New creates a new XML SAML Security scanner module.

func (*Module) ScanPerInsertionPoint

func (m *Module) ScanPerInsertionPoint(
	ctx *httpmsg.HttpRequestResponse,
	ip httpmsg.InsertionPoint,
	httpClient *http.Requester,
	scanCtx *modkit.ScanContext,
) ([]*output.ResultEvent, error)

ScanPerInsertionPoint plants out-of-band (OAST) XXE probes into SAML XML.

Confirmation is purely out-of-band: each probe declares an external DTD / external entity pointing at a unique OAST callback URL, and a finding is emitted ASYNCHRONOUSLY by the OAST poller only if the target's XML parser actually resolves it and calls back. There is no synchronous, response-shape based verdict — that heuristic produced false positives (it could not tell a parsed DTD from a silently stripped one), so the module no-ops without OAST.

type XMLDocument

type XMLDocument struct {
	Content    string
	HasDoctype bool
	IDAttrVal  string // Value of ID attribute if found
}

XMLDocument represents a parsed XML document.

func ParseXML

func ParseXML(content string) (*XMLDocument, error)

ParseXML parses XML content and extracts metadata.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL