Java Serialization Audit logo

Java Serialization Audit

OrganizationPopular
wgpsec
java-serialization-audit

Java 源码序列化类漏洞审计。当在 Java 白盒审计中需要检测序列化/反序列化相关漏洞时触发。 覆盖 3 类风险: Java 原生反序列化(ObjectInputStream/Gadget Chain/ysoserial)、 XXE(DocumentBuilderFactory/SAXParser/XMLInputFactory/TransformerFactory/SchemaFactory 五种解析器)、 模板注入 SSTI(Velocity/FreeMarker/Thymeleaf 模板引擎代码执行)。 Java 反序列化是 Java 生态最具特色的高危漏洞类型,Gadget Chain 分析是核心难点。

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill namejava-serialization-audit
Stars
1.7K
Forks
242
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by wgpsec on GitHub. Read the source before you install it.

Installation

Install the Java Serialization Audit AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wgpsec/AboutSecurity.git /tmp/AboutSecurity
mkdir -p .claude/skills
cp -r /tmp/AboutSecurity/skills/code-audit/java/java-serialization-audit .claude/skills/java-serialization-audit
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Java Serialization Audit in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Java Serialization Audit on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Java Serialization Audit is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Java 序列化类漏洞源码审计

本 skill 聚焦源码层面判断"反序列化/XXE/SSTI 是否成立",核心工作是:白盒确认反序列化入口点、追踪数据来源、评估 classpath 中可用 Gadget 链、验证 XML 解析器安全配置、检查模板引擎渲染上下文。构造 exploit payload、远程利用链发送等运行时黑盒技术属于对应 exploit skill 范畴。

深入参考


3 类漏洞速查表

类型典型 Sink利用条件严重度
Java 反序列化ObjectInputStream.readObject(), XMLDecoder.readObject()用户可控序列化流 + classpath 存在可用 Gadget ChainCritical
XXEDocumentBuilderFactory, SAXParser, XMLInputFactory, TransformerFactory, SchemaFactory外部实体/DTD 未禁用 + 用户可控 XML 输入High-Critical
SSTIVelocity.evaluate, FreeMarker Template, Thymeleaf 预处理表达式用户输入直接进入模板编译/渲染上下文Critical

Java 反序列化审计要点

  • 入口点识别: ObjectInputStream.readObject()ObjectInputStream.readUnshared()XMLDecoder.readObject()、自定义 readObject/readResolve/readExternal 实现中的额外攻击面
  • 数据来源追踪: HTTP 请求 body(魔术字节 AC ED 00 05 或 Base64 编码 rO0AB)、RMI/JMX 远程调用、JMS 消息队列、Redis/Memcached 缓存反序列化、文件读取、ViewState、Cookie/Session 序列化存储
  • Gadget 可用性评估: 检查 pom.xml/build.gradle 及 classpath 中是否存在已知 Gadget 链的依赖库(commons-collections 3.x/4.x、commons-beanutils、spring-core、Groovy、hibernate-core 等),版本是否在受影响范围内
  • 防御机制验证: JEP 290 ObjectInputFilter 是否配置、白名单 vs 黑名单策略、SerialKiller/NotSoSerial 等第三方防护库是否启用、resolveClass 是否被重写为白名单校验
  • readResolve/readObject 自定义逻辑: 即使不存在通用 Gadget,自定义反序列化方法中的文件操作、网络请求、动态类加载等行为也构成攻击面

XXE 审计要点

  • 5 种 XML 解析器安全配置:
    • DocumentBuilderFactory: setFeature("http://apache.org/xml/features/disallow-doctype-decl", true)
    • SAXParserFactory: 同上 + setFeature("http://xml.org/sax/features/external-general-entities", false) + setFeature("http://xml.org/sax/features/external-parameter-entities", false)
    • XMLInputFactory (StAX): setProperty(XMLInputFactory.SUPPORT_DTD, false) + setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false)
    • TransformerFactory: setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "") + setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "")
    • SchemaFactory: setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "") + setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "")
  • 数据流分析: XML 输入来源(HTTP 请求体、文件上传、SOAP 消息、SVG/Office 文件) → 进入解析器 → 解析结果回显(直接 XXE)或无回显(盲注/带外 OOB)
  • Java 特有协议: jar: 协议可触发远程文件下载与解压、netdoc: 协议(旧版 JDK)等价于 file://

模板注入 SSTI 审计要点

  • Velocity: Velocity.evaluate(context, writer, tag, userTemplate) — 若 userTemplate 参数用户可控则直接 RCE
  • FreeMarker: new Template("t", new StringReader(userInput), cfg).process(dataModel, writer) — 用户输入作为模板源编译即危险
  • Thymeleaf: 控制器返回值拼接导致 SSTI,return "user/" + input 时 input 可注入 __${expr}__ 预处理表达式触发 SpEL → RCE
  • 安全模式: 模板名/路径白名单、FreeMarker 设置 TemplateClassResolver.ALLOWS_NOTHING_RESOLVER 禁用 ?new() 内建函数、Velocity 使用 SecureUberspector、Thymeleaf 限制视图名不可拼接用户输入

检测清单

  • 所有 ObjectInputStream.readObject()/XMLDecoder.readObject() 调用点已逐一审查
  • 反序列化入口的数据来源(HTTP/RMI/JMS/缓存/文件)已追踪确认
  • classpath 依赖已检查是否包含已知 Gadget Chain 库及其受影响版本
  • JEP 290 ObjectInputFilter / SerialKiller / 白名单 resolveClass 等防御机制已验证
  • 自定义 readObject/readResolve 方法中的额外攻击面已排查
  • 5 种 XML 解析器的安全 Feature 配置已逐一确认
  • XML 输入来源(请求体/上传/SOAP/SVG)及回显方式已分析
  • Velocity/FreeMarker/Thymeleaf 模板渲染入口的用户输入可控性已检查
  • 模板引擎安全模式(沙箱/白名单/禁用危险函数)已验证
  • 严重度评分使用了统一公式,与 pipeline 一致

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Java Serialization Audit AI skill do?

Java 源码序列化类漏洞审计。当在 Java 白盒审计中需要检测序列化/反序列化相关漏洞时触发。 覆盖 3 类风险: Java 原生反序列化(ObjectInputStream/Gadget Chain/ysoserial)、 XXE(DocumentBuilderFactory/SAXParser/XMLInputFactory/TransformerFactory/SchemaFactory 五种解析器)、 模板注入 SSTI(Velocity/FreeMarker/Thymeleaf 模板引擎代码执行)。 Java 反序列化是 Java 生态最具特色的高危漏洞类型,Gadget Chain 分析是核心难点。

Why use Java Serialization Audit on TypingMind?

Because you install it once and use it with any model. Java Serialization Audit is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Java Serialization Audit in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wgpsec/AboutSecurity/tree/master/skills/code-audit/java/java-serialization-audit. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Java Serialization Audit?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Java Serialization Audit?

As many as you like. As long as a model supports skills, you can use Java Serialization Audit with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Java Serialization Audit AI skill free?

It is published on GitHub by wgpsec. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇