Java Framework Audit logo

Java Framework Audit

OrganizationPopular
wgpsec
java-framework-audit

Java 框架特定漏洞源码审计。当在 Java 白盒审计中需要检测框架层面的已知漏洞模式时触发。 覆盖 5 大框架/组件: Spring 全家桶(SpEL/Actuator/参数绑定/Spring Cloud Gateway)、 Struts2(OGNL/ActionMapping/Content-Type 解析)、Shiro(RememberMe 反序列化/URI 绕过)、 FastJSON/Jackson/Gson(反序列化 autotype/polymorphic)、MyBatis(${} 注入/动态 SQL)。 这些是 Java 生态中出现频率最高、影响面最广的框架级漏洞。

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill namejava-framework-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 Framework 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-framework-audit .claude/skills/java-framework-audit
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Java Framework 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 Framework 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 Framework 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 框架特定漏洞源码审计

框架漏洞的本质分两类: 框架自身缺陷(已知 CVE,升级即修)和框架误用(开发者对框架安全机制理解不足导致的配置/编码缺陷)。本 skill 关注的核心问题是: 被审计项目的代码如何触发这些已知的框架缺陷模式。

深入参考


5 大框架/组件速查表

框架/组件核心风险首要搜索关键字典型严重度
Spring 全家桶SpEL 注入 / Actuator 暴露 / Mass Assignment@Value SpelExpression Actuator management.endpoints高-严重
Struts2OGNL 注入 / Content-Type 解析struts.xml ActionSupport ValueStack ognl严重
ShiroRememberMe 反序列化 / URI 绕过setCipherKey rememberMe ShiroFilterChain严重
FastJSON/Jackson/Gson反序列化 autotype / polymorphicJSON.parseObject JSON.parse enableDefaultTyping @JsonTypeInfo严重
MyBatis${} SQL 拼接注入${ 在 Mapper XML / @Select @Update 注解

Spring 全家桶审计要点

  • Spring MVC 参数绑定(Mass Assignment): @ModelAttribute 会自动将请求参数绑定到对象字段。若实体类含 role/isAdmin/price 等敏感字段且未使用 @InitBinder + WebDataBinder.setAllowedFields() 做白名单,攻击者可通过添加额外参数覆写敏感属性
  • Spring Boot Actuator: 检查 management.endpoints.web.exposure.include 配置。高危端点: /actuator/env(泄露配置 + restart RCE)、/actuator/jolokia(JNDI 注入)、/actuator/heapdump(堆转储提取密钥/密码)、/actuator/gateway/routes(Gateway 路由注入)
  • SpEL 注入: 5 种常见注入点 — @Value("#{externInput}")@Cacheable(key="#root.args[0]") 拼接用户输入、@PreAuthorize / @PostAuthorize 表达式拼接、ExpressionParser.parseExpression() 直接解析外部输入、Spring Data @Query 中的 SpEL ?#{...}
  • Spring Cloud Gateway: CVE-2022-22947 类型漏洞,路由 Predicate/Filter 配置中嵌入 SpEL 表达式,通过 Actuator /gateway/routes 动态注册恶意路由
  • Spring Security 配置陷阱: antMatchers 顺序错误(宽松规则在前覆盖严格规则)、.permitAll() 范围过大、路径匹配与 Servlet 路径不一致(如尾部斜杠 /admin vs /admin/

Struts2 审计要点

  • OGNL 注入: 用户可控数据进入 OGNL 表达式求值。参数名/值通过 ParametersInterceptor 进入 ValueStack,若 SecurityMemberAccess 限制不严,可执行任意代码
  • Content-Type 解析: Jakarta Multipart 解析器对异常 Content-Type 的错误处理导致 OGNL 执行(S2-045),Content-Disposition 的 filename 字段同理(S2-046)
  • ActionMapping 参数前缀: method:(调用任意 Action 方法)、redirect:/redirectAction:(OGNL 注入)。检查 struts.enable.DynamicMethodInvocationstruts.mapper.alwaysSelectFullNamespace
  • 版本 CVE 映射: Struts 2.0.x~2.3.x 是高危区间,S2-001/005/009/012/013/015/016/019/032/033/037/045/046/048/052/053/057/059/061/062 均为远程代码执行级别

Shiro 审计要点

  • RememberMe 反序列化: Shiro 1.2.4 及之前版本使用硬编码 AES 密钥 kPH+bIxk5D2deZiIxcaaaA== 加密 RememberMe Cookie。即使升级后,若开发者使用自定义但可预测/泄露的密钥,风险依旧存在
  • URI 绕过: 分号截断 /admin/;.js 绕 Shiro 但被 Spring 正常路由、/..;/admin 路径穿越、双重 URL 编码、大小写混合绕 Filter。核心原因是 Shiro 的 URL 匹配与后端框架(Spring/Servlet)的解析规则不一致
  • 版本 CVE: CVE-2016-4437(硬编码密钥)、CVE-2020-1957(/toLogin;/../admin 绕过)、CVE-2020-11989(双重编码)、CVE-2021-41303(路径标准化绕过)

FastJSON/Jackson/Gson 审计要点

  • FastJSON: JSON.parseObject(input)JSON.parse(input) 默认支持 @type 字段指定反序列化类。autotype 黑名单随版本升级不断被绕过(1.2.24→1.2.47→1.2.68→1.2.80)。Feature.SupportNonPublicField 开启时可设置私有字段。1.2.83+ 引入 safeMode 彻底关闭 autotype
  • Jackson: ObjectMapper.enableDefaultTyping()ObjectMapper.activateDefaultTyping() 开启全局多态反序列化,等同于全局 RCE 入口。字段级 @JsonTypeInfo(use=Id.CLASS)@JsonTypeInfo(use=Id.MINIMAL_CLASS) 同样危险
  • Gson: 本身不支持多态反序列化,相对安全。但自定义 TypeAdapter / JsonDeserializer 中若使用 Class.forName 加载用户指定类名则引入风险
  • 检测方法: 搜索 JSON.parseObject / JSON.parse(FastJSON)、enableDefaultTyping / activateDefaultTyping / @JsonTypeInfo(Jackson)、自定义 TypeAdapter(Gson)

MyBatis 审计要点

  • ${} vs #{}: ${} 是字符串直接拼接(等同于 String.format),#{} 是预编译参数绑定。Mapper XML 和 @Select/@Update/@Delete/@Insert 注解中的 ${} 均为 SQL 注入入口
  • 动态 SQL 中的 ${}: <if test="sort != null">ORDER BY ${sort}</if><where><foreach> 标签内的 ${} 使用同样危险
  • ORDER BY / LIKE / IN 安全写法: ORDER BY 无法使用 #{} 预编译,应对列名做白名单校验; LIKE 应改写为 LIKE CONCAT('%', #{keyword}, '%'); IN 应使用 <foreach collection="ids" item="id">#{id}</foreach>
  • 两种入口: Mapper XML 文件(*Mapper.xml)和注解模式(@Select("SELECT * FROM ${table}")),两者都需要审计

检测清单

  • 已确认项目使用的框架及精确版本号,已比对已知 CVE
  • Spring Actuator 端点暴露范围已检查,敏感端点已确认是否需要认证
  • SpEL 注入的 5 种场景已逐一搜索排查
  • Spring MVC @ModelAttribute 绑定的实体是否有敏感字段未做白名单
  • Struts2 项目已确认 OGNL 安全配置和 SecurityMemberAccess 设置
  • Shiro setCipherKey 是否使用默认或弱密钥,Filter Chain 的 URI 匹配与实际路由是否一致
  • FastJSON 版本及 autotype 配置已确认,Jackson 是否开启 enableDefaultTyping
  • 所有 Mapper XML 和 @Select 注解中的 ${} 使用已标记,不可避免的场景已确认有白名单防护
  • 动态 SQL 标签(<if> / <where> / <foreach>)中的 ${} 已检查
  • 所有发现的框架漏洞均有 EVID_* 证据链(Source→Sink 路径 + 版本/配置证据)

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 Framework Audit AI skill do?

Java 框架特定漏洞源码审计。当在 Java 白盒审计中需要检测框架层面的已知漏洞模式时触发。 覆盖 5 大框架/组件: Spring 全家桶(SpEL/Actuator/参数绑定/Spring Cloud Gateway)、 Struts2(OGNL/ActionMapping/Content-Type 解析)、Shiro(RememberMe 反序列化/URI 绕过)、 FastJSON/Jackson/Gson(反序列化 autotype/polymorphic)、MyBatis(${} 注入/动态 SQL)。 这些是 Java 生态中出现频率最高、影响面最广的框架级漏洞。

Why use Java Framework Audit on TypingMind?

Because you install it once and use it with any model. Java Framework 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 Framework 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-framework-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 Framework 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 Framework Audit?

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

Is the Java Framework 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 👇