Giter Club home page Giter Club logo

pystegosploit's Introduction

PyStegosploit - Exploit Delivery via Steganography and Polyglots

[video1] | [video2] | [page]

by Charmve - yidazhang1 [at] gmail[dot]com, @Charmve @therealsaumil @amichael

May 2021

stego_imajs.png

Stegosploit creates a new way to encode "drive-by" browser exploits and deliver them through image files. These payloads are undetectable using current means. This paper discusses two broad underlying techniques used for image based exploit delivery - Steganography and Polyglots. Drive-by browser exploits are steganographically encoded into JPG and PNG images. The resultant image file is fused with HTML and Javascript decoder code, turning it into an HTML+Image polyglot. The polyglot looks and feels like an image, but is decoded and triggered in a victim's browser when loaded.

A Tour of the Stegosploit Toolkit [1]

Stegosploit comprises of tools that let a user analyse images, steganographically encode exploit data onto JPG and PNG files, and turn the encoded images into polyglot files that can be rendered as HTML or executed as Javascript.

The current version of Stegosploit is 0.2 and can be found in Issue 0x08 of the International Journal of Proof-of-Concept or Get The Fuck Out (Poc||GTFO). Note that you will have to read through the end of the article in PoC||GTFO to find the hint on how to extract the toolkit.

๐Ÿ” Browse Folders

  • ๐Ÿ“„ README.md
  • ๐Ÿ“„ copying.txt - WTFPL
  • ๐Ÿ“ stego/
    • ๐Ÿ“„ image_layer_analysis.html - Analyse an image's bit layers
    • ๐Ÿ“„ iterative_encoding.html - Encode an exploit onto a JPG or PNG image
    • ๐Ÿ“„ imagedecoder.html - Decode a steganographically encoded image
    • ๐Ÿ“„ imagedecode.js
    • ๐Ÿ“„ histogram.js
    • ๐Ÿ“„ md5.js
    • ๐Ÿ“„ base64.js
  • ๐Ÿ“ exploits/
    • ๐Ÿ“„ exploits.js - Canned exploit code
    • ๐Ÿ“„ decoder_cve_2014_0282.html - Decoder code + CVE-2014-0282 HTML elements
  • ๐Ÿ“ imajs/
    • ๐Ÿ“„ html_in_jpg_ie.pl - Generate JPG+HTML polyglot for IE
    • ๐Ÿ“„ html_in_jpg_ff.pl - Generate JPG+HTML polyglot for Firefox
    • ๐Ÿ“„ html_in_png.pl - Generate a PNG+HTML polyglot (for any browser)
    • ๐Ÿ“„ pngenum.pl - Enumerate a PNG file's FourCC chunks
    • ๐Ÿ“„ jpegdump.c - Enumerate a JPG file's segments
    • ๐Ÿ“„ CRC32.pm
    • ๐Ÿ“„ PNGDATA.pm
  • โ˜… ๐Ÿ“ project-stegosploit/ - Core Part video show 1 | text show 1
    • ๐Ÿ“ encoding/ - core
      • ๐Ÿ“„ iterative_encoding.html - Steganographically Encoding the Exploit Code
      • ๐Ÿ“„ image_layer_analysis.html
      • ๐Ÿ“„ imagedevoder.html
      • ๐Ÿ“„ decode_and_run_cinput_withjs.html
    • ๐Ÿ“ exploits/ - decoder.html
    • ๐Ÿ“ images/ - encoded and original images
    • ๐Ÿ“ polyglots/ - lena_poly_demo.html
    • ๐Ÿ“ scripts/ - Creates an HTML+PNG polyglot polyglot_with_jpg.py
    • ๐Ÿ“ tmp/ run --/tools/msf4$ ./msfconsole -r ./tmp/load_meterpreter.rc video show 2
    • ๐Ÿ“„ README.md - Show how to use this project-stegosploit

jpegdump.c is written by Ralph Giles and can be downloaded from https://svn.xiph.org/experimental/giles/jpegdump.c

In this repo, importantly, project-stegosploit is key part, which show how to hidden Exploit Code into image, to encode/decode, and to execute the meterpreter framework.

๐Ÿ”ง How Stegosploit Works

The exploit code is inserted within the pixels of the image so that the image contains the exploit code. IMAJS then creates a polyglot image that will be read as an image and contains a decoder that will extract and run the javascript exploit.

The exploit that we will use is an Internet Explorer Use-after-free exploit (CVE-2014-0282).

๐Ÿ”จ Requirements

  • Ubuntu 18.04 / Kali / Debian 9
  • web service - python -m http.server 8000
  • Metasploit Framework - How to Install

msfconsole.png

๐Ÿ“† What we have done so far

Highlights:

  • The server can serve images to the VM over 10.0.2.2:5000
  • The jpg.py program can build a polyglot file (valid .html and .jpg)

๐Ÿ“ Checklist

  • Refactor CRC32.pm

  • Refactor PNGDATA.pm

  • Refactor html_in_jpg_ie.pl

  • Refactor pngenum.pl

  • Demo Server

    • Move all static exploit files in demo pages to /static
    • Make sure all static files are passed parsed using template_render
    • Add an image picker for the image_layer_analysis.html (Optional)

โœจ Related Works Stegosploit

My repo

โ• Disclaimer

  • This repo follows the GPL open source agreement, please be sure to understand.

  • We strictly prohibit all acts that violate any national laws through this program, please use this program within the legal scope.

  • By default, using this item will be deemed as your agreement to our rules. Please be sure to abide by the moral and legal standards.

  • If you do not comply, you will be responsible for the consequences, and the author will not bear any responsibility!

๐Ÿ“Ž References

[1] https://stegosploit.info/

[2] https://conference.hitb.org/hitbsecconf2015ams/sessions/stegosploit-hacking-with-pictures/

[3] https://www.vulnerability-db.com/?q=articles/2015/06/17/exploit-delivery-steganography-using-stegosploit-tool-v02

[4] https://www.blackhat.com/docs/eu-15/materials/eu-15-Shah-Stegosploit-Exploit-Delivery-With-Steganography-And-Polyglots.pdf

[5] https://stackoverflow.com/questions/4110964/how-does-heap-spray-attack-work

[6] https://www.youtube.com/watch?time_continue=1&v=6lYUtIZHlJA

[7] https://www.owasp.org/images/0/01/OWASL_IL_2010_Jan_-_Moshe_Ben_Abu_-_Advanced_Heapspray.pdf

[8] https://en.wikipedia.org/wiki/Heap_spraying

[9] https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

๐ŸŽง Related job

video

โœ‰๏ธ Contact

yidazhang1[#]gmail[dot]com


pystegosploit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pystegosploit's Issues

lack of instructions

Unfortunately, almost nobody will be able to figure out how to use this without instructions, making further POC projects near impossible for learning ethical hackers.

the exploit CVE-2014-0282 not run

Hello, How are you?
I am trying to execute the attack on my VM using the image in order to Dynamic analysis for the malware, I have done all the code except the (load_meterpreter.rc) code, which I did not understand.
When I tried to open the image on the virtual environment that contains IE9 on windows 7 ultimate SP1, nothing happened.
Can you help me I don't know what's wrong and I've been trying for a month.
I really need your advice and thanks.
RESULT

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.