[Java] CWE-078: Add JSch lib OS Command Injection sink - #5710
Conversation
de99cb7 to
746f43b
Compare
owen-mc
left a comment
There was a problem hiding this comment.
You can simplify by making setCommand the sink. I can't think of any good reason why code would call setCommand apart from that they intend to call connect soon afterwards.
This shouldn't be a stand-alone query. It should be adding some sinks to ExecTainted, the existing command injection query. That query isn't very easy to extend at the moment, so I have made a PR to fix that.
746f43b to
6627773
Compare
6627773 to
797e00f
Compare
owen-mc
left a comment
There was a problem hiding this comment.
That looks great. I've checked and the new version gets the same hits on LGTM as the old one. The other, more minor, comments from my previous review still stand.
|
@p0wn4j Do you intend to make a bug bountry submission for this contribution? |
|
Yes I want to make a bug bounty submission. |
9a16be5 to
3d891f0
Compare
|
@p0wn4j Great, that addresses all of the review comments. When you make a bug bountry submission this will be ready to pass to the next stage. |
|
OK, thanks for the review :) |
I have copied ExecTainted.ql, ExecCommon.qll from java/ql/src/Security/CWE/CWE-078/ path. |
JSch is a pure Java implementation of SSH2. JSch allows you to connect to a sshd server and use port forwarding, X11 forwarding, file transfer, command execution, etc.
If an attacker can control the command that is going to be executed on a sshd server, it can lead an attacker to Remote Code Execution on that server.
Code example:
Found hits on these repos:
https://github.com/KingLai23/Puzzle
https://github.com/manuelacalvo/DATATourisme
https://github.com/jack775544/jTransfer