/prodsec-skills:xml-serialization-securityfrom prodsec-skills
Hardens XML parsing and deserialization against XXE, entity expansion, SSRF, and unsafe deserialization. Provides per-language secure configuration for Java, .NET, Python, PHP, and more.
Ships in prodsec-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Secure parsing and processing of XML and serialized data. Prevent XXE, entity expansion, SSRF, DoS, and unsafe deserialization across platforms.
Java parsers have XXE enabled by default. Primary defense -- disallow DTDs completely:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setXIncludeAware(false);
If DTDs cannot be completely disabled, disable external entities individually:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
String[] featuresToDisable = {
"http://xml.org/sax/features/external-general-entities",
"http://xml.org/sax/features/external-parameter-entities",
"http://apache.org/xml/features/nonvalidating/load-external-dtd"
};
for (String feature : featuresToDisable) {
dbf.setFeature(feature, false);
}
dbf.setXIncludeAware(false);
dbf.setExpandEntityReferences(false);
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
var settings = new XmlReaderSettings {
DtdProcessing = DtdProcessing.Prohibit,
XmlResolver = null
};
var reader = XmlReader.Create(stream, settings);
# Option 1: defusedxml (preferred)
from defusedxml import ElementTree as ET
ET.parse('file.xml')
# Option 2: lxml with safe settings
from lxml import etree
parser = etree.XMLParser(resolve_entities=False, no_network=True)
tree = etree.parse('filename.xml', parser)
ACCESS_EXTERNAL_DTD and ACCESS_EXTERNAL_STYLESHEET to empty strings.General rule: never deserialize untrusted native objects. Prefer JSON with schema validation. Enforce size/structure limits before parsing. Reject polymorphic types unless strictly allow-listed.
| Language | Dangerous | Safe Alternative |
|---|---|---|
| PHP | unserialize() | json_decode() |
| Python | pickle, yaml.load() | json.loads(), yaml.safe_load() |
| Java | Default ObjectInputStream, Jackson default typing, XStream without allow-lists | Override resolveClass with allow-list; disable default typing; use XStream allow-lists |
| .NET | BinaryFormatter | DataContractSerializer, System.Text.Json with TypeNameHandling=None |
| Ruby | Marshal.load from untrusted input | JSON.parse() |
pickle, unserialize, BinaryFormatter, Marshal.load)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub redhatproductsecurity/prodsec-skills --plugin prodsec-skills130 skills in this plugin
/address-sanitizerAddressSanitizer detects memory errors during fuzzing. Use when fuzzing C/C++ code to find buffer overflows and use-after-free bugs.
/admin-interface-securitySecure the administrative interface of model registries. Use when building, deploying, or reviewing model registry access controls and admin interfaces./aflppAFL++ is a fork of AFL with better fuzzing performance and advanced features. Use for multi-core fuzzing of C/C++ projects.
Other plugins' skills for the same job