Commit Graph

2405 Commits

Author SHA1 Message Date
h00die d5ba1afbec fix URLs not resolving
fix URLs not resolving

add csv export to references

fix URLs not resolving

pdf not pd

missed a url change

remove extra recirectedfrom fields

remove extra file

fix ovftool url accidental replacement
2022-02-16 17:22:40 -06:00
bwatters 0239ef1cc6 Land #16117, Updates for Log4Shell 2022-02-15 16:39:00 -06:00
Spencer McIntyre e2c91ebf30 Land #16010, zabbix_script_exec improvements
This updates the zabbix_script_exec module to work with versions 5.0 and
newer as well as adds a new item-based execution technique.
2022-02-04 15:13:13 -05:00
Spencer McIntyre ae278d0568 Cleanup some minor typos 2022-02-04 15:12:57 -05:00
lap1nou 8838d9cb66 Added timeout system, fixed a bug with TLS_PSK, linted 2022-02-04 04:01:23 -08:00
Spencer McIntyre 965493191f Add and use a Log4Shell mixin 2022-02-03 16:09:49 -05:00
lap1nou 645ef5e71f Fixed few bugs 2022-02-02 14:30:02 -08:00
lap1nou 7bf08a28ea Modified default stager 2022-02-02 12:34:07 -08:00
lap1nou de32cc0e97 Linted with Rubocop, factorized API call, fixed some grammmar 2022-02-01 13:29:30 -08:00
Spencer McIntyre d46822184f Updates for Log4Shell 2022-01-28 14:56:44 -05:00
Spencer McIntyre 458d584f83 Add details to check codes and PR feedback 2022-01-21 09:40:23 -05:00
Spencer McIntyre 579627f5c7 Update docs, note OS X support 2022-01-20 10:47:11 -05:00
Spencer McIntyre ba469a4b2c Add version detection to the Unifi exploit 2022-01-20 09:26:48 -05:00
Spencer McIntyre 3d80a46e67 Check the HTTP response from the trigger 2022-01-19 17:51:31 -05:00
Spencer McIntyre ef344d9d12 Add the Unifi Log4Shell RCE exploit 2022-01-19 17:51:31 -05:00
bwatters 4cf3ae352c Land #16050, Log4Shell: vCenter RCE
Merge branch 'land-16050' into upstream-master
2022-01-19 16:30:33 -06:00
Spencer McIntyre 96a5d656bd Final cleanups and reference updates 2022-01-14 08:41:37 -05:00
Spencer McIntyre 3f04b80d8b Add vCenter Log4Shell docs 2022-01-13 14:50:28 -05:00
Pedro Ribeiro 053fbe2a28 fix cisco advisory links 2022-01-13 18:55:39 +00:00
Spencer McIntyre d5c83b41f9 Cleanup the vCenter Log4Shell exploit 2022-01-13 11:57:00 -05:00
Spencer McIntyre 7b1398f0ae Allow overriding check module datastore options 2022-01-13 11:51:39 -05:00
Spencer McIntyre 62a814fa59 Refactor Log4shell exploit code into reusable bits 2022-01-13 09:45:02 -05:00
Spencer McIntyre e093154865 Refactor the BeanFactory gadget code 2022-01-12 16:58:31 -05:00
Spencer McIntyre e873907d13 Initial vCenter exploit via Log4Shell 2022-01-12 15:34:45 -05:00
Spencer McIntyre 877bab6f2a Land #15969, Log4j2 HTTP Header Injection Exploit 2022-01-11 16:52:08 -05:00
Spencer McIntyre 7b64383040 Preemptively tweak references to ysoserial 2022-01-11 16:25:21 -05:00
lap1nou cb616b94c7 Removed some useless parameter + fixed a few bugs 2022-01-09 13:08:25 -08:00
RageLtMan 6a7c81e1ba Update authors 2022-01-08 21:56:15 -05:00
lap1nou 53c2400be9 Added cleaning procedure + fixed few mistakes/error mesage, removed unused docs 2022-01-08 10:56:31 -08:00
lap1nou ccc90b0330 Linted doc+module, added support for 6.x version, aded support for TLS and item RCE, improved payload management 2022-01-07 17:40:15 -08:00
Spencer McIntyre 3f15c9ecc1 Writeup the module docs 2022-01-07 17:30:39 -05:00
Spencer McIntyre 9b03d0272a Add check and auto-HTTP_HEADER capabilities 2022-01-07 17:30:39 -05:00
Spencer McIntyre 6198d9653d Remove the REMOTE_LOAD datastore option
The necessary value can be inferred by the target and it's payload
compatibility so just set it intelligently.
2022-01-07 17:30:39 -05:00
Spencer McIntyre f56f328c8d Use an enum for the YSoSerial payload option 2022-01-07 17:30:39 -05:00
Spencer McIntyre 3cb70c01bf Cleanup typos, make module aggressive 2022-01-07 17:30:39 -05:00
lap1nou c9cc6d85ac Refactored code by using Zabbix HTTP API, should work with 2.x, 3.x, 4.x, 5.x 2022-01-05 13:35:40 -08:00
space-r7 e26eb2b193 display full path in print_status() 2022-01-04 14:43:04 -06:00
h00die c6372ecdf1 more wp catch themes doc and error handling 2022-01-04 04:34:42 -05:00
lap1nou 6aa289f3dc Merged both module, stil WIP 2022-01-03 16:20:16 -08:00
lapinou 18834f673c Add files via upload 2022-01-02 00:29:36 +01:00
RageLtMan 5eb2c3233d Authors cleanup 2021-12-29 10:56:44 -05:00
RageLtMan 4f8448c3ba Implement infrastructure for ysoserial payload
Pull in the ysoserial mixin and create target configurations to
permit ysoserial payload generation. Setup datastore options and
execution flow to manage the remote code loading workflow vs the
deserialization approach.

The buffer produced by ysoserial still needs to be marshalled into
a valid Java String or Stream of some sort, and verified functional
against the PoC target container using public ysoserial libraries.
2021-12-29 09:10:07 -05:00
RageLtMan ec03b57f6f Rubocop: dont suppress exception 2021-12-29 09:10:07 -05:00
RageLtMan bcdaf53fa1 Rubocop pass on exploit module 2021-12-29 09:10:07 -05:00
RageLtMan 4f07a2fbea First "working" 2021-44228 exploit module state
Clean up the Java code for PayloadFactory - the `main()` function
is actually not required, the error seen on initial attempts to
compile was some sort of PEBKAC or weird things in classpaths.

Update the module to start the HTTP server before issuing the HTTP
request starting the call chain which eventually executes the Java
PayloadFactory - that chain is quick and races with the service's
startup time to get the JAR containing the Payload and its factory.

Minor misc cleanup.
Give credit where due: we stand on the shoulders of giants.

Testing:
  LDAP request is serviced with response containing our JAR URL and
trigger parameters for the factory to instantiate Payload.class and
call its `main()` function.
  HTTP request is serviced to deliver the JAR.
  Payload handler on MSF-side is tripped with incoming connection.
2021-12-29 09:10:07 -05:00
RageLtMan 4874943e7f Implement infrastructure for payload delivery
Per the discussion with @schierlm on GitHub (mihi), the most direct
way to deliver and instantiate our Java payload in the target is
via remote code loading of the JAR using HTTP. This requires a
bootstrap class, a Factory, which instantiates our Payload.class
by calling its main() function on-load from the HTTP endpoint
serving the remote-code-loaded JAR.

Implement a basic PayloadFactory class and include and its sources
in the Metasploit tree.

Using @schierlm's own code from ~10y ago, implement injection of
the PayloadFactory class into our JAR-encoded payloads. Then,
using more of his code from the same module (2011-3544), implement
a secondary service within the exploit module (Rex::ServiceManager
services don't stack well in Msf namespace as they all get assigned
to self.service - faux pas on our end) to serve HTTP requests with
the injected JAR. Finally, generate an appropriate URL target for
the remote code loaded JAR for injection into the LDAP response and
leveraging a final piece of @schierlm's hackery, generate a valid
URI path (updating the datastore is ill advised @ runtime, but its
needed here for the correct service cleanup routines to fire).

Note: during development, i figured out a way to use Rjb for native
Java object serialization to buffers which we can use in Ruby, so i
stashed that away in the Exploit::Java mixin for posterity and left
a reference to it in the module for future endeavors.

Testing:
  Verified that the generated jar is served at the generated URL
  Verified that the generated JAR can be executed at the CLI for
both metasploit.Payload and metasploit.PayloadFactory
  Currently not triggering the remote code load (per wireshark and
our own HTTP service) when delivering the LDAP response, so tuning
that is the next leg of this effort.
2021-12-29 09:10:07 -05:00
RageLtMan feed54b3ae Cleanup 2021-12-29 09:10:07 -05:00
RageLtMan aa6c977423 Leverage Rjb to serialize payload "natively"
After evaluating a Rex::Java::Serialization::Model::Stream.decode
of a StringIO containing a natively-produced byteArray serialized
Java class, it looks to be quite time consuming to produce a native
construct from the JARs we currently generate - this requires some
lower-level intervention in the payload generation process and a
considerable amount of data & reference organization.

Since time is limited, and such a construct is devilishly difficult
to proof when bulding out-of-band (in a different language), this
commit takes a different direction: attempting to leverage the Ruby
Java Bridge gem to implore Java itself to construct the serialized
data structure and marshal it back into Ruby for our disposition.

Split the :serialized_payload method to build the actual byteArray
payload in :byte_array_payload which encapsulates the Rjb interface
and produces a valid output to the LDAP packet crafting routine in
:serialized_payload (as read on the wire and by the JVM on the
target container).

Unfortunately, another problem exists here - the metasploit.Payload
class raises: #<NotSerializableException: metasploit.Payload>.
This will likely need to be addressed in the payloads repository.
Once the metasploit.Payload can be successfully serialized by Rjb,
the wire format should accept it verbatim for delivery on-target.
2021-12-29 09:10:07 -05:00
RageLtMan 642c79f633 Shim test hardness with pre-serialized b64 payload
Using Java:
1. Build a test class which prints to the console on init
and ctor
2. Build a serializer for the test class which writes the byteArray
representation of the serialized class to a file
3. Build, run, produce the serialized output and b64 encode it
4. Embed the serialized data into our exploit during development to
avoid construction problems for the Rex encoder of those structures
and my lack of experience using them.
5. TODO: use the embedded Java-produced serialized data to tweak
native structure composition from the raw Java class output.

This is still not working, as just natively writing out the Java
byte array produces an ASN.1 decoding error on the exploitation
target whereas the curent implementation producing EOF errors from
the target system. Wireshark is complaining, so its likely to be
an LDAP structuring issue: the protocol should be using tag 4 which
represents an octet string but the wire data has tag 2 since i was
encoding each byte to BER. Adding octal encoding to the byte array
and encoding each char of that to BER makes the LDAP packet legal
but still results in a `javax.naming.NamingException [Root
exception is java.io.EOFException]`

Leaving this here for folks to hack on while i execute work tasks.
2021-12-29 09:10:07 -05:00
RageLtMan 30d564f8cb Attempt to serialize the Java payload class
Delivery of the raw payload class bytes and ber-encoded payload do
not produce actionable results. Java-based PoCs appear to pass a
byteArray to their LDAP crafting scheme, although the subsequent
BER encoding appears to be opaque or not exist.

Rex::Java::Serialization appears to provide a mechanism by which to
build a Java byteArray in native Rex.
Implement naive NewArray construction, and encode the bytes of that
array per LDAP protocol specification as otherwise the server will
throw an ASN.1 decoding error.

This is still not producing a session, but may be closer to the
solution. So far not even the simple class built as suggested by
@schierlm is executing correctly in the target Docker container,
meaning that the decoded LDAP response packet is not being loaded
or not referencing something correctly.
2021-12-29 09:10:07 -05:00