XSL
application/xml
Magic Bytes
Offset: 0
3C 3F 78 6D 6C
The Extensible Stylesheet Language (XSL) is a family of recommendations developed by the World Wide Web Consortium for defining the styling and transformation of XML documents. It is primarily utilized to convert XML data into different output formats, such as HTML for web browsers or the legacy XSL-FO standard for generating paginated materials. Although the format consists of structured text, processing XSL templates can be vulnerable to XML External Entity attacks if the underlying parsers are not configured securely.
Validation Code
How to validate .xsl files in Python
Python
def is_xsl(file_path: str) -> bool:
"""Check if file is a valid XSL by magic bytes."""
signature = bytes([0x3C, 0x3F, 0x78, 0x6D, 0x6C])
with open(file_path, "rb") as f:
return f.read(5) == signature
How to validate .xsl files in Node.js
Node.js
function isXSL(buffer: Buffer): boolean {
const signature = Buffer.from([0x3C, 0x3F, 0x78, 0x6D, 0x6C]);
return buffer.subarray(0, 5).equals(signature);
}
Go
func IsXSL(data []byte) bool {
signature := []byte{0x3C, 0x3F, 0x78, 0x6D, 0x6C}
if len(data) < 5 {
return false
}
return bytes.Equal(data[:5], signature)
}
API Endpoint
GET
/api/v1/xsl
curl https://filesignature.org/api/v1/xsl