Skip to content

Commit ea17757

Browse files
authored
Merge pull request #99 from wh1t3p1g/v2
release V2
2 parents 0099d9b + c6afa31 commit ea17757

File tree

94 files changed

+14888
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+14888
-7
lines changed

.gitignore

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
HELP.md
22
.gradle
33
build/
4-
!gradle/wrapper/gradle-wrapper.jar
4+
55
!**/src/main/**/build/
66
!**/src/test/**/build/
77

@@ -52,9 +52,13 @@ runtime.json
5252
*.db
5353
ignores.json
5454
cql.txt
55-
env/data
56-
env/import
57-
.DS_Store
58-
jre_libs
5955
*.jar
60-
db.properties
56+
57+
.DS_Store
58+
*.tar.gz
59+
config/db.properties
60+
rules/cyphers.yml
61+
target/
62+
release
63+
**/src/test/**
64+
output

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 wh1t3P1g
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
![img.png](logo.png)
2+
#
3+
![Java version](https://img.shields.io/badge/Java-17-blue.svg)
4+
![License](https://img.shields.io/badge/License-MIT-green.svg)
5+
![Blackhat](https://img.shields.io/badge/Blackhat-Arsenal%202024-red.svg)
6+
7+
TABBY 是一款针对 Java 语言的静态代码分析工具,可用于快速发现多种类型的 Java 语言相关的漏洞。
8+
9+
TABBY 使用静态分析框架 [Soot](https://github.com/soot-oss/soot) 作为语义提取工具,将JAR/WAR/CLASS文件转化为代码属性图,
10+
并使用 [Neo4j](https://neo4j.com/) 图数据库来存储生成的代码属性图CPG。
11+
12+
此外,通过扩展 Neo4j 的[路径遍历逻辑](https://github.com/wh1t3p1g/tabby-path-finder),TABBY 可以使用简单的 cypher 语句即可完成复杂污点分析输出潜在的漏洞调用链路。
13+
14+
## #1 使用方法
15+
16+
使用 Tabby 需要有以下环境:
17+
- JAVA 环境
18+
- 可用的 Neo4j 图数据库
19+
- Neo4j Browser 或者其他 Neo4j 可视化的工具或者 Tabby 的 IDEA [插件](https://github.com/wh1t3p1g/tabby-intellij-plugin)
20+
21+
具体的使用方法参见: [Tabby Quick Start](https://www.yuque.com/wh1t3p1g/tp0c1t/lf12lg69ngh47akx)
22+
23+
## #2 Tabby的适用人群
24+
25+
开发 Tabby 的初衷是想要提高代码审计的效率,尽可能的减少人工检索的工作量
26+
27+
使用 tabby 生成的代码属性图可以完成以下的工作场景:
28+
29+
- 挖掘目标项目中的反序列化利用链,支持大多数序列化机制,包括 Java 原生序列化机制、Hessian、XStream 等
30+
- 挖掘目标项目中的常见 Web 漏洞,支持分析 WAR/JAR/FATJAR/JSP/CLASS 文件
31+
- 搜索符合特定条件的函数、类,譬如检索调用了危险函数的静态函数
32+
33+
利用 tabby 生成后的代码属性图,在 Neo4j 图数据库中进行动态自定义漏洞挖掘/利用链挖掘。
34+
35+
## #3 成果
36+
37+
- [现有利用链覆盖](https://github.com/wh1t3p1g/tabby/wiki/%E7%8E%B0%E6%9C%89%E5%88%A9%E7%94%A8%E9%93%BE%E8%A6%86%E7%9B%96)
38+
- papers && slides
39+
- KCon 2022 [Tabby: Java Code Review Like A Pro](https://github.com/wh1t3p1g/tabby/blob/v2/papers/tabby%20java%20code%20review%20like%20a%20pro.pdf)
40+
- KCon 议题补充 [基于代码属性图的自动化漏洞挖掘实践](https://blog.0kami.cn/blog/2023/%E5%9F%BA%E4%BA%8E%E4%BB%A3%E7%A0%81%E5%B1%9E%E6%80%A7%E5%9B%BE%E7%9A%84%E8%87%AA%E5%8A%A8%E5%8C%96%E6%BC%8F%E6%B4%9E%E6%8C%96%E6%8E%98%E5%AE%9E%E8%B7%B5/)
41+
- DSN 2023 [Tabby: Automated Gadget Chain Detection for Java Deserialization Vulnerabilities](https://ieeexplore.ieee.org/document/10202660)
42+
- BlackHat EU 2024 [Tabby: Simplifying the Art of Java Vulnerability Hunting](https://github.com/wh1t3p1g/tabby/blob/v2/papers/Tabby%20Simplifying%20the%20Art%20of%20Java%20Vulnerability%20Hunting.pdf)
43+
- ICASSP 2025 [VulKiller: Java Web Vulnerability Detection with Code Property Graph and Large Language Models]()
44+
- CVEs
45+
- CVE-2021-21346 [如何高效的挖掘 Java 反序列化利用链?](https://blog.0kami.cn/2021/03/14/java-how-to-find-gadget-chains/)
46+
- CVE-2021-21351
47+
- CVE-2021-39147 [如何高效地捡漏反序列化利用链?](https://www.anquanke.com/post/id/251814)
48+
- CVE-2021-39148
49+
- CVE-2021-39152 [m0d9](http://m0d9.me/2021/08/29/XStream%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96%EF%BC%88%E4%B8%89%EF%BC%89%E2%80%94%E2%80%94Tabby%20CVE%E4%B9%8B%E6%97%85/)
50+
- CVE-2021-43297
51+
- CVE-2022-39198 [yemoli](https://yml-sec.top/2022/12/30/%E4%BB%8Ecve-2022-39198%E5%88%B0%E6%98%A5%E7%A7%8B%E6%9D%AFdubboapp/#CVE-2022-39198%E6%8C%96%E6%8E%98)
52+
- CVE-2023-23638
53+
54+
## #4 常见问题
55+
56+
- [常见问题](https://www.yuque.com/wh1t3p1g/tp0c1t/ueduxuz6fmxhpoyb)
57+
58+
如果使用中存在其他问题,欢迎在 [discussions](https://github.com/wh1t3p1g/tabby/discussions) 提问!
59+
60+
如果使用中发现了 Tabby 实现上的 bug,欢迎在 [issues](https://github.com/wh1t3p1g/tabby-path-finder/issues) 提交相关错误详情!
61+
62+
## #5 初衷&致谢
63+
64+
当初,在进行利用链分析的过程中,深刻认识到这一过程是能被自动化所代替的(不管是 Java 还是 PHP)。但是,国内很少有这方面工具的开源。GI 工具实际的检测效果其实并不好,为此,依据我对程序分析的理解,开发了 tabby 工具。我对 tabby 工具期望不单单只是在利用链挖掘的应用,也希望后续能从漏洞分析的角度利用 tabby 的代码属性图进行分析。我希望 tabby 能给国内的 Java 安全研究人员带来新的工作模式。
65+
66+
当然,当前版本的 tabby 仍然存在很多问题可以优化,希望有程序分析经验的师傅能一起加入 tabby 的建设当中,有啥问题可以直接联系我哦!
67+
68+
如果 tabby 给你的工作带来了便利,请不要吝啬你的🌟哦!
69+
70+
如果你使用 tabby 并挖到了漏洞,非常欢迎提供相关的成功案例 XD
71+
72+
如果你有能力一起建设,也可以一起交流,或直接 PR,或直接 issue
73+
74+
- 优秀的静态分析框架 [soot](https://github.com/soot-oss/soot)
75+
- [gadgetinspector](https://github.com/JackOfMostTrades/gadgetinspector)
76+
- [ysoserial](https://github.com/frohoff/ysoserial)[marshalsec](https://github.com/mbechler/marshalsec)

README_EN.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
![img.png](logo.png)
2+
#
3+
![Java version](https://img.shields.io/badge/Java-17-blue.svg)
4+
![License](https://img.shields.io/badge/License-MIT-green.svg)
5+
![Blackhat](https://img.shields.io/badge/Blackhat-Arsenal%202024-red.svg)
6+
7+
TABBY is a static code analysis tool tailored for the Java language, designed to swiftly uncover a multitude of vulnerabilities specific to Java.
8+
9+
TABBY leverages the [Soot](https://github.com/soot-oss/soot) static analysis framework as its semantic extraction engine to convert JAR/WAR/CLASS files into Code Property Graphs (CPGs). It then employs the [Neo4j](https://neo4j.com/) graph database to store these generated CPGs.
10+
11+
Furthermore, by extending Neo4j's [path traversal logic](https://github.com/wh1t3p1g/tabby-path-finder), TABBY can perform complex taint analysis and output potential vulnerability call chains with straightforward Cypher queries.
12+
13+
## #1 Usage
14+
15+
To use Tabby, the following environment requirements must be met:
16+
17+
- JAVA Environment
18+
- An available Neo4j graph database
19+
- Neo4j Browser or another visualization tool for Neo4j, or the [Tabby IDEA Plugin](https://github.com/wh1t3p1g/tabby-intellij-plugin)
20+
21+
For detailed instructions on how to use Tabby, please refer to the [Tabby Quick Start Guide](https://www.yuque.com/wh1t3p1g/tp0c1t/lf12lg69ngh47akx).
22+
23+
## #2 Target Audience for Tabby
24+
25+
The development of Tabby was initiated with the aim of enhancing the efficiency of code audits and minimizing the workload associated with manual searches.
26+
27+
With the Code Property Graphs generated by Tabby , the following scenarios can be addressed:
28+
29+
- Identifying deserialization exploitation chains within target projects, supporting a wide range of serialization mechanisms, including Java's native serialization, Hessian, XStream, and others.
30+
- Uncovering common web vulnerabilities within target projects, capable of analyzing WAR/JAR/FATJAR/JSP/CLASS files.
31+
- Searching for functions or classes that meet specific criteria, such as static methods that invoke dangerous functions.
32+
33+
By leveraging the Code Property Graphs generated by Tabby, users can conduct dynamic, custom vulnerability mining and exploitation chain analysis within the Neo4j graph database.
34+
35+
## #3 Achievements
36+
37+
- [Existing Exploit Chain Coverage](https://github.com/wh1t3p1g/tabby/wiki/%E7%8E%B0%E6%9C%89%E5%88%A9%E7%94%A8%E9%93%BE%E8%A6%86%E7%9B%96)
38+
- Papers && Slides
39+
- KCon 2022 [Tabby: Java Code Review Like A Pro](https://github.com/knownsec/KCon/blob/master/2022/tabby%20java%20code%20review%20like%20a%20pro%E3%80%90KCon2022%E3%80%91.pdf)
40+
- KCon Topic Supplement [Automated Vulnerability Mining Practice Based on Code Property Graphs](https://blog.0kami.cn/blog/2023/%E5%9F%BA%E4%BA%8E%E4%BB%A3%E7%A0%81%E5%B1%9E%E6%80%A7%E5%9B%BE%E7%9A%84%E8%87%AA%E5%8A%A8%E5%8C%96%E6%BC%8F%E6%B4%9E%E6%8C%96%E6%8E%98%E5%AE%9E%E8%B7%B5/)
41+
- DSN 2023 [Tabby: Automated Gadget Chain Detection for Java Deserialization Vulnerabilities](https://ieeexplore.ieee.org/document/10202660)
42+
- BlackHat EU 2024 [Tabby: Simplifying the Art of Java Vulnerability Hunting](https://github.com/wh1t3p1g/tabby/blob/v2/papers/Tabby%20Simplifying%20the%20Art%20of%20Java%20Vulnerability%20Hunting.pdf)
43+
- ICASSP 2025 [VulKiller: Java Web Vulnerability Detection with Code Property Graph and Large Language Models]()
44+
- CVEs
45+
- CVE-2021-21346
46+
- CVE-2021-21351
47+
- CVE-2021-39147
48+
- CVE-2021-39148
49+
- CVE-2021-39152 m0d9
50+
- CVE-2021-43297
51+
- CVE-2022-39198 yemoli
52+
- CVE-2023-23638
53+
54+
## #4 Frequently Asked Questions
55+
56+
- [FAQ](https://www.yuque.com/wh1t3p1g/tp0c1t/ueduxuz6fmxhpoyb)
57+
58+
If you encounter any other issues while using Tabby, feel free to ask in the [discussions](https://github.com/wh1t3p1g/tabby/discussions)!
59+
60+
If you discover any bugs in the implementation of Tabby, please submit the relevant error details in the [issues](https://github.com/wh1t3p1g/tabby-path-finder/issues) section.
61+
62+
## #5 Motivation & Acknowledgments
63+
64+
Initially, during the process of exploit chain analysis, it became clear that this process could be automated (whether for Java or PHP). However, there was a noticeable lack of open-source tools in this area within China. Existing GI tools did not perform well in practical detection scenarios. Based on my understanding of program analysis, I developed the Tabby tool. My vision for Tabby extends beyond just exploit chain mining; I also hope that it can be utilized from a vulnerability analysis perspective, leveraging its Code Property Graphs for deeper insights. It is my wish that Tabby introduces a new working model for Java security researchers.
65+
66+
Of course, the current version of Tabby still has many areas for improvement, and I welcome developers with experience in program analysis to join in the development of Tabby. If you have any questions, feel free to contact me directly!
67+
68+
If Tabby has facilitated your work, please do not hesitate to give it a star ⭐!
69+
70+
If you discover vulnerabilities using Tabby, we warmly welcome you to share related success stories.
71+
72+
If you are able to contribute to its development, let's engage in discussions, or submit Pull Requests or Issues directly.
73+
74+
- [soot](https://github.com/soot-oss/soot)
75+
- [gadgetinspector](https://github.com/JackOfMostTrades/gadgetinspector)
76+
- [ysoserial](https://github.com/frohoff/ysoserial) && [marshalsec](https://github.com/mbechler/marshalsec)

config/settings.properties

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# targets to analyse
2+
tabby.build.target = cases/java-sec-code-1.0.0.jar
3+
tabby.build.libraries = libs
4+
tabby.build.mode = web
5+
#tabby.build.mode = gadget
6+
tabby.output.directory = ./output/dev
7+
tabby.build.rules.directory = ./rules
8+
tabby.build.thread.size = max
9+
10+
# settings for jre environments
11+
tabby.build.useSettingJRE = false
12+
tabby.build.isJRE9Module = false
13+
#tabby.build.javaHome = /Library/Java/JavaVirtualMachines/graalvm-jdk-17.0.9+11.1/Contents/Home
14+
#tabby.build.javaHome = /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
15+
#tabby.build.javaHome = /Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home
16+
tabby.build.javaHome = /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
17+
18+
# debug
19+
tabby.debug.details = false
20+
tabby.debug.print.current.methods = true
21+
22+
# jdk settings
23+
tabby.build.isJDKProcess = false
24+
tabby.build.withAllJDK = false
25+
tabby.build.isJDKOnly = false
26+
27+
# dealing fatjar
28+
tabby.build.checkFatJar = true
29+
30+
# set false for debug
31+
tabby.build.removeNotPollutedCallSite = true
32+
33+
# pointed-to analysis types
34+
tabby.build.interProcedural = true
35+
tabby.build.onDemandDrive = false
36+
37+
# pointed-to analysis settings
38+
tabby.build.analysis.everything = true
39+
tabby.build.isPrimTypeNeedToCreate = false
40+
tabby.build.thread.timeout = 2
41+
tabby.build.method.timeout = 5
42+
tabby.build.alias.maxCount = 5
43+
tabby.build.array.maxLength = 25
44+
tabby.build.method.maxDepth = 500
45+
tabby.build.method.maxBodyCount = 8000
46+
tabby.build.object.maxTriggerTimes = 300
47+
tabby.build.object.field.k.limit = 10
48+
tabby.build.with.cache.enable = false
49+
tabby.build.isNeedToCreateIgnoreList = false
50+
tabby.build.isNeedToDealNewAddedMethod = true
51+
tabby.build.timeout.forceStop = true
52+
53+
# plugin settings
54+
tabby.build.isNeedToProcessXml = true

logo.png

149 KB
Loading
Binary file not shown.
44 MB
Binary file not shown.

pom.xml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>3.3.0</version>
9+
<relativePath/> <!-- lookup parent from repository -->
10+
</parent>
11+
<groupId>org.tabby</groupId>
12+
<artifactId>tabby</artifactId>
13+
<version>0.0.1-SNAPSHOT</version>
14+
<name>tabby</name>
15+
<description>A CAT called Tabby</description>
16+
17+
<properties>
18+
<java.version>17</java.version>
19+
</properties>
20+
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-data-jpa</artifactId>
25+
</dependency>
26+
27+
<dependency>
28+
<groupId>org.soot-oss</groupId>
29+
<artifactId>soot</artifactId>
30+
<version>4.5.0</version>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>org.apache.tomcat</groupId>
35+
<artifactId>tomcat-jasper</artifactId>
36+
<version>10.1.18</version>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>org.apache.ant</groupId>
41+
<artifactId>ant</artifactId>
42+
<version>1.10.12</version>
43+
</dependency>
44+
45+
<dependency>
46+
<groupId>org.apache.commons</groupId>
47+
<artifactId>commons-lang3</artifactId>
48+
<version>3.12.0</version>
49+
</dependency>
50+
<dependency>
51+
<groupId>com.google.guava</groupId>
52+
<artifactId>guava</artifactId>
53+
<version>33.2.1-jre</version>
54+
</dependency>
55+
<dependency>
56+
<groupId>com.google.code.gson</groupId>
57+
<artifactId>gson</artifactId>
58+
<version>2.11.0</version>
59+
</dependency>
60+
61+
<dependency>
62+
<groupId>com.h2database</groupId>
63+
<artifactId>h2</artifactId>
64+
<scope>runtime</scope>
65+
</dependency>
66+
<dependency>
67+
<groupId>org.projectlombok</groupId>
68+
<artifactId>lombok</artifactId>
69+
<optional>true</optional>
70+
</dependency>
71+
<dependency>
72+
<groupId>org.springframework.boot</groupId>
73+
<artifactId>spring-boot-starter-test</artifactId>
74+
<scope>test</scope>
75+
</dependency>
76+
</dependencies>
77+
78+
<build>
79+
<finalName>tabby</finalName>
80+
<plugins>
81+
<plugin>
82+
<groupId>org.springframework.boot</groupId>
83+
<artifactId>spring-boot-maven-plugin</artifactId>
84+
<configuration>
85+
<excludes>
86+
<exclude>
87+
<groupId>org.projectlombok</groupId>
88+
<artifactId>lombok</artifactId>
89+
</exclude>
90+
</excludes>
91+
</configuration>
92+
</plugin>
93+
</plugins>
94+
</build>
95+
96+
<repositories>
97+
<repository>
98+
<id>jitpack.io</id>
99+
<url>https://jitpack.io</url>
100+
</repository>
101+
</repositories>
102+
103+
</project>

rules/basicClasses.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[
2+
"io.netty.channel.ChannelFutureListener",
3+
"scala.runtime.java8.JFunction2$mcIII$sp",
4+
"scala.runtime.java8.JFunction1$mcII$sp",
5+
"scala.runtime.java8.JFunction0$mcV$sp",
6+
"scala.runtime.java8.JFunction0$mcZ$sp",
7+
"scala.runtime.java8.JFunction0$mcJ$sp",
8+
"scala.runtime.java8.JFunction0$mcI$sp",
9+
"scala.runtime.java8.JFunction1$mcZJ$sp",
10+
"scala.runtime.java8.JFunction1$mcZI$sp",
11+
"scala.runtime.java8.JFunction1$mcVI$sp",
12+
"scala.runtime.java8.JFunction0$mcD$sp",
13+
"scala.runtime.java8.JFunction0$mcF$sp",
14+
"scala.runtime.java8.JFunction0$mcS$sp",
15+
"scala.runtime.java8.JFunction0$mcB$sp",
16+
"com.codahale.metrics.Gauge",
17+
"java.net.URI",
18+
"sun.reflect.generics.repository.ClassRepository",
19+
"java.security.PermissionCollection",
20+
"sun.reflect.generics.tree.ClassTypeSignature",
21+
"java.net.URI$Parser",
22+
"sun.reflect.generics.visitor.TypeTreeVisitor"
23+
]

0 commit comments

Comments
 (0)