Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upImport and generate dynamic `ysoserial` Java serialization objects #11125
Conversation
asoto-r7
added
library
needs-docs
delayed
labels
Dec 14, 2018
wvu-r7
reviewed
Dec 14, 2018
lib/msf/util/java_deserialization.rb Outdated
asoto-r7
added some commits
Dec 14, 2018
bcoles
reviewed
Dec 16, 2018
bcoles
referenced this pull request
Dec 16, 2018
Open
Add Weblogic_serialize_rawobject CVE-2015-4852 #11131
asoto-r7
force-pushed the
asoto-r7:ysoserial-payloads
branch
from
e04c25e
to
349a366
Dec 17, 2018
bcoles
reviewed
Dec 18, 2018
lib/msf/util/java_deserialization.rb Outdated
This comment has been minimized.
This comment has been minimized.
You might wanna rename your file |
asoto-r7
added some commits
Dec 18, 2018
asoto-r7
added
docs
and removed
needs-docs
labels
Dec 19, 2018
This comment has been minimized.
This comment has been minimized.
@wchen: Thanks! I've renamed the helper script and added Wiki documentation. This PR is now ready for final review and potential landing. |
asoto-r7
removed
the
delayed
label
Dec 19, 2018
wchen-r7
self-assigned this
Dec 20, 2018
This comment has been minimized.
This comment has been minimized.
I'll give this a try. Thank you! |
This comment has been minimized.
This comment has been minimized.
Hi @asoto-r7, I have submitted a pull request to you for the rspec. You can find it here: Please let me know when you have resolved the issue with hp_imc_java_deserialize.rb not getting a session, and then I'll take a look at the PR again. Thank you! |
asoto-r7
added some commits
Jan 2, 2019
asoto-r7
force-pushed the
asoto-r7:ysoserial-payloads
branch
from
e126f3c
to
ddebc29
Jan 4, 2019
This comment has been minimized.
This comment has been minimized.
@wchen-r7: It's ready to go! I've also updated the testing steps above to provide a more thorough walkthrough. The most significant bug was that when I randomized ysoserial fingerprintable strings, I was off-by-one in my character count. (TANGENT: However, along the way, I had to troubleshoot offsets and values of both To support future debugging, I've added a
|
This comment has been minimized.
This comment has been minimized.
Cool thanks! I think when you were updating your code, rspec went out of date again: https://travis-ci.org/rapid7/metasploit-framework/jobs/475527324#L2480 Could you please take a look at that? Something related to this:
|
This comment has been minimized.
This comment has been minimized.
@wchen-r7: I've spent the day arguing with
... should reference this in the
So, testing that manually: msf5> pry
pry> p = Msf::Util::JavaDeserialization::ysoserial_payload("BeanShell1","id")
pry> p.include?("java.awt.event")
=> true Looks fine to me! What am I missing? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@wchen: Thanks for the rspec, especially since it caught that I had locally updated the JSON file, but committed a version that didn't contain all the payloads. The tests are passing now and it's ready for testing. I apologize for the delay. |
This comment has been minimized.
This comment has been minimized.
I will try again. Thanks! |
asoto-r7
added some commits
Jan 14, 2019
This comment has been minimized.
This comment has been minimized.
Exploit is working for me with this patch. Let me look around a bit more and then I'll try to land it. Pretty busy today w/ meetings but I think I should be able to do this today. |
wchen-r7
merged commit 72d3f65
into
rapid7:master
Jan 15, 2019
added a commit
that referenced
this pull request
Jan 15, 2019
This comment has been minimized.
This comment has been minimized.
Release NotesThis adds support for importing and generating dynamic objects from |
asoto-r7 commentedDec 14, 2018
•
edited
Overview
Problem: Some exploit modules targeting Java deserialization vulnerabilities use "blobs" like Base64 strings, which make the code difficult to read, change, and verify. Personally, I spent a full day reverse engineering a recent Java serialized object, understanding
ysoserial
, and recreating a verified "blob" to land PR #10947. And yet, despite my comments and notes, it will be difficult for the next person to understand or modify. And so...Proposed solution: To make Java serialized objects more easily readable and adaptable, this PR adds support for importing and generating dynamic objects from
ysoserial
and hopefully fixes #10057). Rather than invokingysoserial
directly (and all the Java overhead that would entail), this PR uses a once-run Docker container. The docker container will output a JSON file (data/ysoserial_payloads.json
) containing the relevant binary and offsets so that a Metasploit library can quickly generate a dynamic Java serialized object.Current Status
Ready for landing. Pending @wchen-r7's review.
Considerations for future work:
ysoserial-modified.jar
with it'sbash
,cmd
, andpowershell
variations.Myfaces2
which requires a<base_url>:<classname>
formatted string orURLDNS
which requires a URL).Feedback welcome! Thanks!😃
Verification
Please review
lib/msf/util/java_deserialization.rb
to identify code that significantly contradicts our current or best practices.Change directory to the
tools/payloads/ysoserial
.CommonsBeanutils1
that invokesls
:hp_imc_java_deserialize
module works with the new updates: