Skip to content

Commit 88e66e3

Browse files
committed
Added second flavor of the tool
1 parent 0207b9e commit 88e66e3

File tree

3 files changed

+326
-18
lines changed

3 files changed

+326
-18
lines changed

encryptFile.html

Lines changed: 252 additions & 0 deletions
Large diffs are not rendered by default.

readme.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,52 @@ Embed and hide any file in HTML
33

44
Author: Arno0x0x - [@Arno0x0x](http://twitter.com/Arno0x0x)
55

6-
What this tool does is taking a file, encrypt it with a simple RC4 encryption stub, and embed it into an HTML file as ressource, along with an automatic download routine simulating a user clicking on the embeded ressource.
6+
What this tool does is taking a file (*any type of file*), encrypt it, and embed it into an HTML file as ressource, along with an automatic download routine simulating a user clicking on the embedded ressource.
77

8-
When the user browses to the HTML file, the embeded file is decrypted on the fly, saved in a temporary folder, and the file is then presented to the user as if it was being downloaded from the remote site. Depending on the user's browser and the file type presented, the file can be automatically opened by the browser.
8+
Then, when the user browses the HTML file, the embedded file is decrypted on the fly, saved in a temporary folder, and the file is then presented to the user as if it was being downloaded from the remote site. Depending on the user's browser and the file type presented, the file can be automatically opened by the browser.
9+
10+
This tool comes in two flavors, providing the same overall functionnality but with some slight changes in the way of using it:
11+
12+
1. An **python script** which generates the output HTML file based on a template, using **RC4 encryption** routines, and embedding the decryption key within the output file. The resulting HTML can either be browsed by the targeted user or sent as an attachement.
13+
14+
2. An **HTML/Javascript** that you can drag the file into be encrypted to, which generates the output HTML file, using the **WebCrypto API**, but NOT embedding the decryption material (*key and counter*). Instead, the decryption material is displayed as a set of URL parameters to be added into a URL pointing to the HTML resulting file: `http(s)://hosting.server.com/result.html#hexencodedkey!hexencodedcounter`. So the resulting HTML file cannot be sent as an attachment.
15+
The main advantage of this technique is that the decryption material is not embedded into the file itself, hence preventing analysis and even retrieval of the payload by any system which doesn't have the full URL (eg: intercepting proxy)
916

1017
Side notes:
1118
- This tool was inspired and derived from the great 'demiguise' tool : [https://github.com/nccgroup/demiguise](https://github.com/nccgroup/demiguise)
1219

1320
- The b64AndRC4 function used on the binary input (from the XLL file) is a mix of:
1421
[https://gist.github.com/borismus/1032746](https://gist.github.com/borismus/1032746) and [https://gist.github.com/farhadi/2185197](https://gist.github.com/farhadi/2185197)
1522

16-
- Check [https://gist.github.com/Arno0x/f71a9db515ddea686ccdd77666bebbaa](https://gist.github.com/Arno0x/f71a9db515ddea686ccdd77666bebbaa) for an easy malicious XLL creation
23+
- Check [https://gist.github.com/Arno0x/f71a9db515ddea686ccdd77666bebbaa](https://gist.github.com/Arno0x/f71a9db515ddea686ccdd77666bebbaa) for an easy malicious XLL creation which is a perfect example of a malicious document one could try to deliver with this method.
1724

1825
- In the HTML template (*html.tpl file*) it is advised to insert your own key environmental derivation function below in place
1926
of the 'keyFunction'. You should derive your key from the environment so that it only works on your intended target (*and not in a sandbox*).
2027

2128
Usage
2229
----------------------
2330

24-
Few examples files are provided in the `payloads_examples` directory. For instancethe `calc.xll` is an Excel add-in (XLL) file that contains a metasploit shellcode for x86 processes to launch the `calc.exe` process.
31+
Few payload examples files are provided in the `payloads_examples` directory. For instance the `calc.xll` is an Excel add-in (XLL) file that contains a metasploit shellcode for x86 processes to launch the `calc.exe` process.
32+
33+
**Using the python script**
2534

2635
1/ Generate the malicious html file from the XLL file, along with a secret key:
2736
`python embedInHTML.py -k mysecretkey -f example_calc.xll -o index.html`
2837

2938
2/ Expose the html file on a web server (*one can be optionnaly started for you with the `-w` flag*)
3039

31-
3/ Point your browser to the html file and let the magic happen:
40+
**Using the HTML/Javascript**
41+
42+
1/ Open the encryptFile.html file with a browser
43+
44+
2/ Simply drag the payload file into the page (*you can optionnaly change the output file name*)
45+
46+
3/ Save the resulting file and take note of the decryption material as URL parameters to be added to the file name
47+
48+
49+
**Eventually...**
50+
51+
Point the target's browser to the html file and let the magic happen:
3252

3353
<img src="https://dl.dropboxusercontent.com/s/d53j2yev8itwu4e/deliverXLLviaHTML.jpg?dl=0" width="600">
3454

0 commit comments

Comments
 (0)