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

[pypi] setup.py install based cmdclass not executed #369

Open
calebbrown opened this issue Sep 21, 2022 · 1 comment
Open

[pypi] setup.py install based cmdclass not executed #369

calebbrown opened this issue Sep 21, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@calebbrown
Copy link
Contributor

calebbrown commented Sep 21, 2022

exotel v0.1.6 downloads a malicious windows binary when setup.py is called with "install".

Unfortunately we didn't execute the malicious payload which would have called out to the domain "linkedopports[.]com" because it called the "bdist" step to create a wheel, and then installed the wheel:

Install succeeded:
Collecting exotel==0.1.6
  Downloading exotel-0.1.6.tar.gz (2.2 kB)
Building wheels for collected packages: exotel
  Building wheel for exotel (setup.py): started
  Building wheel for exotel (setup.py): finished with status 'done'
  Created wheel for exotel: filename=exotel-0.1.6-py3-none-any.whl size=1790 sha256=de7e1ccfae5d769d08346ca1091f41ff3cc753063a58240008ef9d94c0527c43
  Stored in directory: /root/.cache/pip/wheels/c6/1e/3e/71d3147d5a3a8d82f51ee372046a92751b1dfa20432f29c144
Successfully built exotel
Installing collected packages: exotel
Successfully installed exotel-0.1.6

The setup.py contained the following:

def send():
    # ... truncated ...
 
class PostInstallCommand(install):
    def run(self):
        install.run(self)
        send()

setup(
  name='exotel',
  version='0.1.6',
  description='exotel',
  python_requires=">=3.6",
  install_requires=[''],
  tests_require=[],
  cmdclass={'install': PostInstallCommand},
)

Refs: https://storage.googleapis.com/ossf-malware-analysis-results/pypi/exotel/0.1.6.json, https://osv.dev/vulnerability/GHSA-cv6j-9835-p7fh

@calebbrown calebbrown added the bug Something isn't working label Sep 21, 2022
@dukecat0
Copy link
Contributor

I just had some tests, and setup.py install was run actually. Probably it's because the environment variable COMPUTERNAME doesn't exist, so the malicious payload is not executed. https://inspector.pypi.io/project/exotel/0.1.6/packages/8b/ed/9ebeb34d4adb9b01151d73ccfde9c1cb2d629c3b146953c8727559a65446/exotel-0.1.6.tar.gz/exotel-0.1.6/setup.py#line.9

Maybe related to #586.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants