Add module for Eclipse Equinoxe OSGi console RCE.#9554
Add module for Eclipse Equinoxe OSGi console RCE.#9554jrobles-r7 merged 7 commits intorapid7:masterfrom
Conversation
|
please add documentation, see https://github.com/rapid7/metasploit-framework/blob/master/documentation/modules/module_doc_template.md |
|
Edited documentation by following the template. Let me know if something is missing or unclear. |
sempervictus
left a comment
There was a problem hiding this comment.
Thank you foe the pr. Any chance the hex strings could be expanded or commented up a bit? Its rather opaque ATM.
|
Did you forget to add the docs to this PR? I still only see one file. |
|
Fixed missing documentation file. |
| Follow these steps to run the vulnerable application on a Linux host: | ||
|
|
||
| 1. Create a test environment directory | ||
| ``mkdir testenv && cd testenv`` |
| 1. Create a test environment directory | ||
| ``mkdir testenv && cd testenv`` | ||
| 2. Download the setup script | ||
| ``wget https://gist.githubusercontent.com/QKaiser/66c8a618eef2a7801c0bbb1aa43d724a/raw/e098f6ea31717311bd6ce5b3be94744dddfc2388/setup.sh`` |
| 3. Set appropriate permission | ||
| `chmod +x setup.sh` | ||
| 4. Execute setup script | ||
| ``./setup.sh`` |
| 4. Execute setup script | ||
| ``./setup.sh`` | ||
| 5. Launch the vulnerable application with this command so it listens on port TCP/5555 | ||
| ``java -jar org.eclipse.osgi.jar -console 5555`` |
| 5. Launch the vulnerable application with this command so it listens on port TCP/5555 | ||
| ``java -jar org.eclipse.osgi.jar -console 5555`` | ||
| 6. Verify that the server is running, you should be prompted with `osgi> ` | ||
| ``telnet localhost 5555`` |
There was a problem hiding this comment.
single or triple ticks here
|
|
||
| Exploit running against a Ubuntu Linux target: | ||
|
|
||
| `` |
| BuildTuple : i486-linux-musl | ||
| Meterpreter : x86/linux | ||
|
|
||
| `` |
|
|
||
| Exploit running against a Windows 7 target: | ||
|
|
||
| `` |
| Domain : WORKGROUP | ||
| Logged On Users : 2 | ||
| Meterpreter : x86/windows | ||
| `` |
| `` | ||
|
|
||
|
|
||
| ## References |
There was a problem hiding this comment.
I would actually remove this section and move it up to the description area.
|
docs look really good overall, a bunch of nit picks. well done! |
|
@sempervictus regarding protocol library, What I could do though is use IAC constants from |
|
@sempervictus I took a shot at using |
OSGI Console on Debian 9.3 x64OSGI Console on Windows 7 SP1 x64 |
Release NotesThe exploit/multi/misc/osgi_console_exec module has been added to framework. It uses the fork command of exposed OSGi consoles to execute code on vulnerable servers. |
|
I used this module today. :) |
Vulnerable Application
Description
This module takes advantage of OSGi consoles exposed by some Java-based middleware servers.
The OSGi console is a telnet-based server that can be used for remote debugging and dynamic loading/removal of Java bundles running on an OSGi based server.
References
Test setup
Linux environment
Follow these steps to run the vulnerable application on a Linux host:
mkdir testenv && cd testenvwget https://gist.githubusercontent.com/QKaiser/66c8a618eef2a7801c0bbb1aa43d724a/raw/e098f6ea31717311bd6ce5b3be94744dddfc2388/setup.shchmod +x setup.sh./setup.shjava -jar org.eclipse.osgi.jar -console 5555osgi>telnet localhost 5555telnetd --ip=127.0.0.1 startWindows environment
Follow these steps to run the vulnerable application on a Windows host:
osgi_testfor clarity.configurationinosgi_testconfig.iniin yourconfigurationdirectory. The file should contain the following lines only:pluginsdirectory inosgi_testdirectoryplugins/org.apache.felix.gogo.command_(version).jarfrom the SDK asorg.apache.felix.gogo.command.jarinosgi_testdirectory.plugins/org.apache.felix.gogo.runtime_(version).jarfrom the SDK asorg.apache.felix.gogo.runtime.jarinosgi_testdirectory.plugins/org.apache.felix.gogo.shell_(version).jarfrom the SDK asorg.apache.felix.gogo.shell.jarinosgi_testdirectory.plugins/org.eclipse.equinox.console_(version).jarfrom the SDK asorg.eclipse.equinox.console.jarinosgi_testdirectory.plugins/org.eclipse.osgi_(version).jarfrom the SDK asorg.eclipse.osgi.jarinosgi_testdirectory.osgi_testdirectory should contain the following items:java -jar org.eclipse.osgi.jar -console 5555osgi>telnet localhost 5555telnetd --ip=127.0.0.1 startIf you don't want to go through all those steps manually I recommend you to run the setup script on a Linux host, mount the directory on a Windows VM and start from step 11.
Verification Steps
You can verify the module against the vulnerable application with those steps:
use exploit/multi/misc/osgi_console_execset RHOST 127.0.0.1set RPORT 5555orset RPORT 2019check. The target should appear vulnerable.set payloadwith the payload of your choosing.runOptions
TIME_WAIT - Time to wait for payload to be executed. The default value is set to 20 seconds.
Scenarios
Reverse shell on Linux host
Exploit running against a Ubuntu Linux target:
Reverse shell on Windows host
Exploit running against a Windows 7 target:
If you happen to know a good bypass to feed command stager to
getRuntime().exec()without relying on the presence of bash let me know :)