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

Raidsonic NAS IB-4220 / 5220 exec #2188

Merged
merged 1 commit into from Sep 23, 2013

Conversation

m-1-k-3
Copy link
Contributor

@m-1-k-3 m-1-k-3 commented Aug 3, 2013

This is one more module for a webapp vuln in a quite old NAS from raidsonic.

The advisory is here: http://www.s3cur1ty.de/m1adv2013-010

Release Date: 12.02.2013
BID: 57958
Exploit DB ID: 24499
OSVDB: 90221, 90220, 90219

Best,
Mike

if not (datastore['CMD'])
fail_with(Exploit::Failure::BadConfig, "#{rhost}:#{rport} - Only the cmd/generic payload is compatible")
end
response_pattern = "\<FORM\ NAME\=\"form\"\ METHOD\=\"POST\"\ ACTION\=\"\/cgi\/time\/time.cgi\"\ ENCTYPE\=\"multipart\/form-data"
Copy link
Contributor

Choose a reason for hiding this comment

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

Since response_pattern is being used in more than one place looks like should be defined as a CONSTANT for the module.

@jvazquez-r7
Copy link
Contributor

Thanks @m-1-k-3,

Did some small comments. On the other hand, people will be more active next week after Vegas events, so maybe there is some more feedback entering the next week!

Finally, we'll need pcap for verification purposes as usual.

Thanks!

@jvazquez-r7
Copy link
Contributor

After giving a look, maybe FileDropper is failing because the "rm -f" command isn't available on BusyBox :? Just guessing, discussion on course with @m-1-k-3


include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::CommandShell
include Msf::Exploit::FileDropper
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it isn't used anymore and can be deleted.

Copy link
Contributor

Choose a reason for hiding this comment

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

The comment above isn't true anymore, because the module is using FileDropper again!

@jvazquez-r7
Copy link
Contributor

Little msftidy complain:

$ tools/msftidy.rb modules/exploits/linux/http/raidsonic_nas_ib5220_exec_noauth.rb 
raidsonic_nas_ib5220_exec_noauth.rb:209 - [WARNING] Spaces at EOL

}
sock.put(user)
sock.put("\r\n")
sock.put("rm /tmp/#{inetd_cfg}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're deleting while exploitation, would be nice to add a "on_new_session" handler, and check which the file indeed doesn't exist. If the file still exists on on_new_session a message should be printed to the user.

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as we've discussed via email, you're doing this deletion here, and not on_new_session, because for any reason we don't spot atm, the FileDropper mixin is failing to delete it. Would add a code comment explaining it, so others don't go shocked when look at this code.

@jvazquez-r7
Copy link
Contributor

Hi @m-1-k-3,

Did m-1-k-3#9 in order to:

  • Beautify code / styling like asked while code review
  • Fix the way to establish a session over a telnet connection as we've discussed recently.

Hopefully changes are not breaking nothing, cannot test it! Let me know if it works for you, feel free to land once ready, so we can continue with review of this pull request. Once the current changes are landed, I would like to discuss with you if init the telnetd daemon through inetd is really necessary, or it can be started standalone.

@m-1-k-3
Copy link
Contributor Author

m-1-k-3 commented Aug 18, 2013

thx @jvazquez-r7 - the module is working quite good now.

The telnetd is compiled in inetd mode

BusyBox v1.00-rc3 (2008.02.14-01:00+0000) multi-call binary
Usage: telnetd (inetd mode) [OPTION]
Telnetd uses incoming TELNET connections via inetd.
Options:
-l LOGIN exec LOGIN on connect (default /bin/sh)

@jvazquez-r7
Copy link
Contributor

Awesome, thanks for testing @m-1-k-3, do you mind to share pcap of module working after apply these last changes? Thanks in advance!

@jvazquez-r7
Copy link
Contributor

If #2389 is landed, the same fix should be applied here

@jvazquez-r7
Copy link
Contributor

Processing!

@jvazquez-r7
Copy link
Contributor

Looks okey, and last changes are "compatible" with pcap's already sent by @m-1-k-3, thanks @m-1-k-3!

jvazquez-r7 pushed a commit that referenced this pull request Sep 23, 2013
@jvazquez-r7 jvazquez-r7 merged commit ad8a04c into rapid7:master Sep 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants