Git Product home page Git Product logo

beast-exploit's Introduction

#BEAST attack

A sample application of the BEAST attack with a MiTM to demonstrate the vunlerability of the protocol SSLv3, TLSv1

How this exploit work ?

  • Server : It's a perfect secure server ready to make handshake with a client using the protocol SSLv3 and receive encrypted requests from the client through is handler.
    Class: Server() - Important functions : connection(), SecureTCPHandler.handle(), disconnect()

  • Client : A sample client, can be related to a web browser. The client makes requests to a server with a cookie inside.
    Class: Client(AESCipher) - Important functions : connection(), request(...), disconnect()
    Example request :

GET / HTTP/1.1\r\nCookie: UpVP0rDn5SoHoiX9\r\n\r\n
  • Proxy : The proxy is our man in the middle, he is completely passive. He intercepts encrypted requests from the client to the server and lets the attacker alter them. He also intercepts the data from the server to the client and gets the header response status.
    Class: Proxy() - Important functions : ProxyTCPHandler.handle()

  • Attacker : He can ask to the client generate a request to a secure server with a cookie inside. In real case, it can be done by injecting some javascript into the a web page visited by the client. He also alters client's requests regarding the proxy interception. Finally he can decipher one byte of the client's request.
    Class: Beast(Client) - Important functions : run(), alter(...)

Note I don't find a way to use ssl context from Python. I use a() traditionnal encryption)[http://stackoverflow.com/a/12525165/2274530] in AES (utils/AESCipher) wit no mac and padding. Follow this issues

###Exploit

The attack starts with the function exploit.run(). By hypothesis the requests are encrypted with CBC. We know that the length of the bloc are 16 bytes because it's AES.

The attacker know the construction of the packet except the secret text.

For example : |the secret is TH|IS_IS_SECRET...|

The attacker know the length of the secret is is 14 bytes. He adds a byte to make the request 15 bytes length. (This is padding in the code). After that he will have something like that:

athe secret is T|HIS_IS_SECRET...|

Now, he doesn't know only one char : T. (he will try the 256 possibilities to find the result.)

After that, a request from the client is send to a server, the proxy intercept this request and the attacker reads and remembers. He takes the last cipher block of the request and the Ci-1 cipher block he want to decrypt. He makes a xor operation of (athe secret is T) XOR iv XOR ci-1 and send this to the serveur. When he will intercept the request, he checks if the cipher are the same in the first request and in the second request. If no, he will retry with an another char. Otherwise we will change the plaintext guess :

the secret is GH|IS_IS_SECRET...|

And he repeats the previous operation until he decrypts all bytes of the secret text.

##Run it !

Require python version 2.7.* to launch this exploit. Then just run:

python BEAST.py localhost 1111

The Poodle attack cannot be run on an updated Debian machines.

##Ressources

beast-exploit's People

Contributors

mpgn avatar

Stargazers

 avatar Give Me A Name avatar akeepmr avatar OlderMutt avatar Siger Yang avatar

Watchers

Alex Yao 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.