GithubHelp home page GithubHelp logo

kamaal44 / accidentalflask Goto Github PK

View Code? Open in Web Editor NEW

This project forked from z3mil/accidentalflask

0.0 1.0 0.0 365 KB

A simple vulnerable token machine written in python.

License: MIT License

Python 100.00%

accidentalflask's Introduction

MIT License


Logo

accidentalFlask

A simple vulnerable token machine

LOL, What is this?

A simple vulnerable Python API for educational purposes, specifically built for token entropy / bad session management abuse. The app is built in Python 3 with Flask and exposes 2 APIs at /token and /whomai. The web app runs locally and does not incorporate any backend storage.

Clone and install dependencies

git clone https://github.com/threatact0r/accidentalFlask.git 
cd accidentalFlask
python3 -m pip install -r requirement.txt

Run

python3 app.py &

running the app

Exploit Manually

On every run, the admin token is generated and echoed to terminal. The token endpoint will create a weak RC4 encrypted blob based on the provided username and a substring of current epoch time, students can use tools like attack proxies (e.g. Burp sequencer) to enumrate the entropy of the token, and attempt to generate a valid admin token. An admin token can be verified by hitting the whoami endpoint which will respond with You are logged in as admin if the token matches. RC4 is a stream cipher that is known to be vulnerable to bit-flipping.

  1. token endpoint
curl --location --request POST 'http://127.0.0.1:5000/token' \
--header 'Content-Type: application/json' \
--data-raw '{
    "Username": "bdmin",
    "Password": "password"
}'
  1. whoami endpoint
curl --location --request POST 'http://127.0.0.1:5000/whoami' \
--header 'Content-Type: application/json' \
--data-raw '{
    "Token": "<insert_token_here>"
}'

Automate

The attack set out to achieve a valid admin token can be done with Burp intruder or any other automation tool. A generated token for a similar user (e.g. 'bdmin') will generate a close enough cipher text to be bit-flipped. the whoami endpoint will return a different response if an admin token is presented.

Burp Intruder

accidentalflask's People

Contributors

threatact0r 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.