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

CLI improvements #23

Open
frohoff opened this issue Mar 8, 2016 · 3 comments
Open

CLI improvements #23

frohoff opened this issue Mar 8, 2016 · 3 comments

Comments

@frohoff
Copy link
Owner

frohoff commented Mar 8, 2016

CLI arg/param parsing should support the following:

  • reusing payload param definition/processing from within exploits
  • relatively easy addition of gadgets/payloads/exploits and interoperability with existing (compatible) gadgets/payloads/exploits
  • have a reasonable chance of supporting unforeseen exploits/chains/bypasses/etc with minimal changes
  • wider variety of gadgets (non-RCE types)
  • arbitrary parameters for exploits/gadgets (exploit target host/port/path, remote load gadgets, file paths/contents, etc)
  • nesting of payload objects (for wrapping with bypasses, etc) and binding into nested structures
  • annotating payload objects with serialization format and peer/child payload object compatibility
  • automatically generate help text that shows allowable values for fixed-option parameters
@frohoff
Copy link
Owner Author

frohoff commented Mar 8, 2016

Some ideas:

  • Annotate "bindable" classes and fields/properties
  • Bind command line parameters into object structure using dotted property notation (a la web frameworks)
  • Use annotation parameter to limit choices if necessary (limit to specific payload classes, serialization formats, etc)
  • Bound implementation choices instantiate specified class and inject sub-parameters as appropriate

Example:

@Bind public class SomeExploit {
    @Bind private Payload payload;
    @Bind private URL url;
...
}

@Bind class SomeExecPayload {
    @Bind private String cmd;

...
}

@Bind class SomeFileWritePayload {
    @Bind private String path;
    @Bind private String contents;

...
}

@Bind class SomeBypass {
    @Bind private Payload inner;
...
}
$ java ... SomeExploit 
    Usage:
       -payload [CHOICE]
          * SomeExecPayload
          * SomeFileWritePayload
          * SomeBypass
       -url [URL]

$ java ... SomeExploit -payload SomeExecPayload 
       -url [URL]
       -payload.cmd [String]

$ java ... SomeExploit -url http://someurl -payload SomeExecPayload -payload.cmd "somecommand"
[Successfully executed]

$ java ... SomeExploit -url http://someurl -payload SomeBypass
    Usage:
       -payload.inner [CHOICE]
          * SomeExecPayload
          * SomeFileWritePayload
          * SomeBypass
$ java ... SomeExploit  -url http://someurl  -payload SomeBypass -payload.inner SomeFileWritePayload
    Usage:
       -payload.inner.path [String]
       -payload.inner.contents [String]

$ java ... SomeExploit  -url http://someurl  -payload SomeBypass -payload.inner SomeFileWritePayload -payload.inner.path "app/webshell.jsp" -payload.inner.contents "<html>webshell-here</html>"
[Successfully executed]

Might be able to abbreviate option names where it wouldn't introduce ambiguity as well. For example, -payload.inner could be specified as -p.i, -inner, or just `-i'. Similar unambiguous abbreviation might be able to be performed with fixed-choice values.

$ java ... SomeExploit  -u http://someurl  -p SomeBypass -i SomeFileWritePayload -path "app/webshell.jsp" -contents "<html>webshell-here</html>"
[Successfully executed]

Something like this seems like it would accommodate pretty much anything in the future, but I'm concerned that it may be to complex or confusing.

@federicodotta
Copy link

Another useful CLI parameter could be the encoding of the serialized exploit.

Based on the real word scenario I saw, useful encoding could be:

  • Raw
  • Base64
  • ASCII HEX

Thank you for your great job!

@pwntester
Copy link
Contributor

I think the approach is very flexible and should allow future gadgets with special needs.

The only thing I would add is that gadgets should also define what output formats they support so they can be generated in different formats as JavaSer (default and mandatory), XStream, Kryo, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants