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

Python: New code/command execution sinks #818

Closed
1 of 2 tasks
am0o0 opened this issue Feb 25, 2024 · 12 comments
Closed
1 of 2 tasks

Python: New code/command execution sinks #818

am0o0 opened this issue Feb 25, 2024 · 12 comments
Assignees
Labels
All For One Submissions to the All for One, One for All bounty

Comments

@am0o0
Copy link

am0o0 commented Feb 25, 2024

Query PR

github/codeql#15715

Language

Python

CVE(s) ID list

  • CVE-2023-46134 related to pandas query function on DataFrame objects

CWE

CWE-074

Report

What is new?
JsonPickle library Code execution sinks
Pytorch library Code execution sinks
Pexpect library Command Execution and Secondary server cmd injection
AsyncSsh library Secondary server cmd injection
Netmiko library Secondary server cmd injection
Scrapli library Secondary server cmd injection
Twisted library Secondary server cmd injection
Ssh2-python library Secondary server cmd injection
pandas library DataFrame Code execution sinks

What has changed?
Upgrade paramiko query to Secondary server command execution query which attackers can execute commands on other than the primary server. it is in the experimental directory.
for the paramiko query, it has added proxyCommand as a SystemCommandExecution because it executes commands on the primary server.
Upgraded Fabric framework and added proxy_command as a SystemCommandExecution, I didn't change the sinks of this framework to Secondary server command execution because it is not in an experimental library, otherwise the run and sudo functions are SecondaryCommandInjection and local function is SystemCommandExecution. I only simplified the framework structure with new higher-level APIs and added SystemCommandExecution new sinks.

Also, I tried my best to use inline tests everywhere so you can review this PR more easily. :)

Are you planning to discuss this vulnerability submission publicly? (Blog Post, social networks, etc).

  • Yes
  • No

Blog post link

TBD

@am0o0 am0o0 added the All For One Submissions to the All for One, One for All bounty label Feb 25, 2024
@sylwia-budzynska sylwia-budzynska self-assigned this Feb 27, 2024
@ghsecuritylab
Copy link
Collaborator

Your submission is now in status Query review.

For information, the evaluation workflow is the following:
Initial triage > Test run > Results analysis > Query review > Final decision > Pay > Closed

@sylwia-budzynska
Copy link

Hi @am0o0

I just ran your new query and a query with a taint tracking config from remote flow sources to the new sinks on top 1000 most popular python repos, but no results were found. I also ran a sink-only query to see if the sinks are being used (without checking if user input flows into them, so these results are not vulnerabilities) and there were over 3300 results, which means those sinks do get used in these top 1000 apps.

This makes me think there could be two reasons why we are not getting results:

  • we need a taint step to help reach the sinks
  • the python repos that were scanned use these sinks in a secure way.

Could you have a look if there might be missing a taint step somewhere? If more TPs can't be found, the scope score for this submission will be low unfortunately

@am0o0
Copy link
Author

am0o0 commented Mar 6, 2024

Hi @sylwia-budzynska

Thank you a lot for helping and informing me to improve the query :) I'll work on improving this submission to find some results.

@am0o0
Copy link
Author

am0o0 commented Mar 9, 2024

Hi @sylwia-budzynska, for now, I found one result, But I don't know yet whether I should search only in the top 1000 repositories or not.
https://github.com/guydavis/machinaris/
I'm working on adding additional steps if I find anything related too.

@am0o0
Copy link
Author

am0o0 commented Mar 9, 2024

There is a CVE related to the pexpect sink( in the Ajenti/Ajenti repo), if I support this CVE in this submission, then does this addition help to increase the scope score?

@sylwia-budzynska
Copy link

sylwia-budzynska commented Mar 11, 2024

for now, I found one result, But I don't know yet whether I should search only in the top 1000 repositories or not.
https://github.com/guydavis/machinaris/

Good catch, that improves the score 👍

There is a CVE related to the pexpect sink( in the Ajenti/Ajenti repo), if I support this CVE in this submission, then does this addition help to increase the scope score?

It won't increase the scope score significantly, but it's always good to have more sinks, so I encourage you to add it.

If you find any more repos with results, please share the databases of these repos and the query used, that speeds up a lot the work for us. Thanks!

@angelg84
Copy link

angelg84 commented Mar 11, 2024 via email

@ghsecuritylab
Copy link
Collaborator

Your submission is now in status Final decision.

For information, the evaluation workflow is the following:
Initial triage > Test run > Results analysis > Query review > Final decision > Pay > Closed

@xcorail
Copy link
Contributor

xcorail commented Jun 24, 2024

Hello @am0o0
can you please provide me with your HackerOne email, or any other email, for bounty payment?
You can email me privately
Best regards

@ghsecuritylab
Copy link
Collaborator

Your submission is now in status Pay.

For information, the evaluation workflow is the following:
Initial triage > Test run > Results analysis > Query review > Final decision > Pay > Closed

@xcorail
Copy link
Contributor

xcorail commented Jun 24, 2024

Created Hackerone report 2573454 for bounty 591010 : [818] Python: New code/command execution sinks

@xcorail xcorail closed this as completed Jun 24, 2024
@ghsecuritylab
Copy link
Collaborator

Your submission is now in status Closed.

For information, the evaluation workflow is the following:
Initial triage > Test run > Results analysis > Query review > Final decision > Pay > Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
All For One Submissions to the All for One, One for All bounty
Projects
None yet
Development

No branches or pull requests

5 participants