|
| 1 | +# WSO 2.5 webshell download via apikey.php |
| 2 | + |
| 3 | +An instance of Web Shell by oRb version 2.5, |
| 4 | +uniquely-obfuscated, |
| 5 | +and downloaded via [apikey.php](/apikey.php). |
| 6 | + |
| 7 | +## Origin |
| 8 | + |
| 9 | +### IP Address 185.39.199.9 |
| 10 | + |
| 11 | +185.39.199.9 → Kolomiec-gw.solomenskaya3-sw.kv.wnet.ua |
| 12 | + |
| 13 | +185.39.199.9 belongs to: |
| 14 | + |
| 15 | + inetnum: 185.39.199.0 - 185.39.199.255 |
| 16 | + netname: WNET-KYIV |
| 17 | + address: Wnet LLC |
| 18 | + address: Bohdana Khmelnitskoho 48A |
| 19 | + address: Kyiv, 01030 |
| 20 | + address: Ukraine |
| 21 | + |
| 22 | +Looks like wnet.ua is a high end ISP that can provide network consulting |
| 23 | +and services, and maybe even write a little software. |
| 24 | + |
| 25 | +`p0f3` is [convinced](p0f.dat) that "Windows 7 or 8" drives this IP address. |
| 26 | + |
| 27 | +### Download |
| 28 | + |
| 29 | +Looks like the attacker(s) thought that someone had installed |
| 30 | +a working [apikey.php](/apikey.php) file downloader. |
| 31 | +I added `apikey.php` emulation to my honey pot |
| 32 | +on 2019-04-05, added emulation of `apikey.php` access test, |
| 33 | +and 2019-05-27, added file download capability. |
| 34 | + |
| 35 | +The file downloaded would have ended up named `settings.php` |
| 36 | + |
| 37 | +The download user agent says: |
| 38 | + |
| 39 | + Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3198.0 Safari/537.36 OPR/49.0.2711.0 |
| 40 | + |
| 41 | +The "Accept" and "Accept-Encoding" are "*/*" and "identity" respectively. |
| 42 | +This seems to be something that Chrome browsers send, |
| 43 | +which lines up with the user agent string. |
| 44 | + |
| 45 | +## Deobfuscation |
| 46 | + |
| 47 | +The [downloaded code](dc1.php) can be made into a decoder by changing "eval" to "print", |
| 48 | +and cleaning up some of the "<?" PHP short tags. |
| 49 | +Since a lot of PHP installations no longer allow short tags, their use seems self-limiting. |
| 50 | + |
| 51 | +The [next stage](dc2.php) is a visual dog's breakfast. |
| 52 | +PHP comments interspersed through PHP code obscured by calls to `function eltelt()`, |
| 53 | +with a number as the argument. |
| 54 | +The `eltelt()` base64-decodes a string from an array based on the numerical argument. |
| 55 | + |
| 56 | +The obfuscation is simpler than it immediately appears. |
| 57 | +All string literals in the original code got replaced by calls to `function eltelt()`. |
| 58 | +The numeric argument to `eltelt()` constitutes a count: |
| 59 | +the first string literal gets replaced by `eltelt(1)`, the second by `eltelt(2)`, |
| 60 | +the hundreth by `eltelt(100)` and so forth. |
| 61 | +Each string literal got base64-encoded, and the resulting string becomes an array element |
| 62 | +in `eltelt()`. |
| 63 | +The obfuscators made no attempt to re-use strings already in the `eltelt()` internal array. |
| 64 | + |
| 65 | +## Analysis |
| 66 | + |
| 67 | +The obfuscation seems odd. |
| 68 | +It does encode strings like "FilesMAn" and "WSO_VERSION" |
| 69 | +which are probably widely used in malware signatures. |
| 70 | +The obfuscation doesn't keep a human from looking at the code |
| 71 | +for a few seconds and recognizing that the obfuscated code |
| 72 | +is probably a version of WSO. |
| 73 | +Typical WSO function names ("WSOsetcookie", "wsoEx", "actionPhp") are still present, |
| 74 | +as they aren't string literals. |
| 75 | +Signatures of function names will not get fooled by this obfuscation. |
| 76 | +If you've gone to the work of extracting all string literals |
| 77 | +and replacing them with a function call, |
| 78 | +why not "compact" the string literal data by keeping track of strings? |
| 79 | +This would minimize the data needed by the string-literal-recovery |
| 80 | +function, and possibly make the code even less visually appealing. |
| 81 | + |
| 82 | +It's just another WSO web shell. |
| 83 | +I've already [seen it used]() to download [extendable back door]() malware. |
| 84 | +The unique aspects are: |
| 85 | + |
| 86 | +* Download via `apikey.php` |
| 87 | +* Encoding of string literals |
0 commit comments