https://github.com/uk0/cve-2022-42889-intercept
通过 jvm 启动参数 以及 jps pid进行拦截非法参数
https://github.com/uk0/cve-2022-42889-intercept
cve-2022-42889
Last synced: 4 months ago
JSON representation
通过 jvm 启动参数 以及 jps pid进行拦截非法参数
- Host: GitHub
- URL: https://github.com/uk0/cve-2022-42889-intercept
- Owner: uk0
- Created: 2022-10-20T13:05:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-21T03:46:50.000Z (over 2 years ago)
- Last Synced: 2025-01-20T23:55:48.956Z (4 months ago)
- Topics: cve-2022-42889
- Language: Java
- Homepage:
- Size: 4.5 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### cve-2022-42889-intercept
* 低于 Java11版本的需要注意,更高的版本已经取消了`Javascript`解释器
* 本次方案针对 Java8通过 jvm 启动参数 以及 jps pid进行拦截非法参数

#### quick start
```bash
-----------------------load......
cve-2022-42889 check start
cve-2022-42889 is_deep_match org.apache.commons.text.StringSubstitutor
md.getReturnType().getActualName() java.lang.String
[cve-2022-42899] class found!: class org.apache.commons.text.StringSubstitutor
(StringSubstitutor replace disabled)
[CVE 2022-42889] StringSubstitutorclass org.apache.commons.text.StringSubstitutor: (sanitized) PoC Output: %_script:javascript:195 + 324_
by arksec.cn
```### 打开方式
>使用 Attach API 远程加载的 Java agent 不会再先于main方法执行,这取决于另一虚拟机调用 Attach API 的时机。并且,它运行的也不再是premain方法,而是名为agentmain的方法。
Java 虚拟机并不限制 Java agent 的数量。你可以在 java 命令后附上多个-javaagent参数,或者远程 attach 多个 Java agent,Java 虚拟机会按照定义顺序,或者 attach 的顺序逐个执行这些 Java agent。* premain
* java 启动参数```bash
-javaagent:/path/to/dir/CVE-2022-42889-Agent-1.0-SNAPSHOT-jar-with-dependencies.jar
```
* agentmain
* jps (pid注入)
* 执行 `Attach` 的main方法 (先引入 `tools.jar`)