$ strings moose_mips.elf
[...]
cat /proc/cpuinfo
GET /xx/rnde.php?p=%d&f=%d&m=%d HTTP/1.1
Host: www.getcool.com
Connection: Keep-Alive
127.0.0.1
[...]
A Story of an Embedded Linux Botnet
Embedded Linux Malware
Moose DNA (description)
Moose Herding (the Operation)
What’s New?
Take Aways
Malware Researcher at ESET
Infosec lecturer at ETS University in Montreal
Previously
infosec developer, network admin, linux system admin
Co-founder Montrehack (hands-on security workshops)
Founder NorthSec Hacker Jeopardy
What marketing likes to call "Internet of Things Malware"
consumer routers
DVR
Smart TVs
IP Camera monitoring systems
…
Small amount of memory
Small amount of flash
Non x86 architectures: ARM, MIPS
Wide-variety of libc implementations / versions
Same ABI-compatible Linux kernel (2.4 < x < 4.3)
Support ELF binaries
Rarely an integrated UI
Networked
Hard to detect
Hard to remediate
Hard to fix
Low hanging fruit for bad guys
Several cases disclosed in the last two years
A lot of same-old background noise (DDoSer)
Things are only getting worse
Linux/Aidra
Linux/Bassobo
ChinaZ family (XOR.DDoS, …)
Linux/Dofloo
Linux/DNSAmp (Mr Black, BillGates)
Linux/Gafgyt (LizardStresser)
Linux/Hydra
Linux/Tsunami
…
Statically-linked stripped binaries
No imports (library calls) present
All the code bundled together down to kernel syscall
Disassembler (if available for arch) doesn’t help much
GCC and GNU libc are always changing so compiled binaries always change
Little IDA FLIRT signatures available (if any)
Various C libraries: µClibc, eglibc, glibc, musl, …
Map syscalls with IDA script
But libc is too big
Still too much code to RE
Provided tool: https://github.com/eset/malware-research/blob/master/moose/ida/mips_identify_syscalls.py
Reproduce environment (arch, libc/compiler versions)
Build libraries w/ symbols under same conditions
Use bindiff to map library functions
Focus on malware code
Going down to syscalls is too long in large binaries
Find a close match of C library
Build with symbols
Bindiff it (or maybe FLIRT it)
Be careful of strings and AV variant names
$ strings moose_mips.elf
[...]
cat /proc/cpuinfo
GET /xx/rnde.php?p=%d&f=%d&m=%d HTTP/1.1
Host: www.getcool.com
Connection: Keep-Alive
127.0.0.1
[...]
Be careful with detection names
Don’t request domain take down based on output of strings
and don’t do so for other people’s research!
aka Malware description
Discovered in November 2014
Thoroughly analyzed in early 2015
Published a report in late May 2015
Named after the string "elan" present in the malware executable
The Slovak rock band (from 1969 and still active)
Statically linked stripped ELF binary
ARM (GNU EABI and EABI 5)
MIPS (little and big endian)
No x86 sample found
C&C IP in integer form buried in all this code
Pivot through firewalls
Home-made NAT traversal
Custom-made Proxy service
only available to a set of authorized IP addresses
Remotely configured generic network sniffer
DNS Hijacking
Don’t assume it’s custom when it can be a standard protocol
No fallback domains or DGA
Telnet credentials bruteforce
Wordlist of 304 user/pass entries sent by server
Less RE, more honeypot!
Launch the binary in a debian MIPS qemu image
Reachable from the Internet
Watch it behave
Firewall it
Aurel images: https://people.debian.org/~aurel32/qemu/mips/
Qemu command:
qemu-system-mips -M malta \
-no-reboot -nographic \
-kernel vmlinux-3.2.0-4-4kc-malta \
-hda debian_wheezy_mips_standard.qcow2 \
-append "root=/dev/sda1 console=ttyS0" \
-redir tcp:10073::10073 -redir tcp:22::22 -redir tcp:23::23
We were too careful
Everything we learned operationally was because of infected host
The Malware Operation
Network sniffer was used to steal HTTP Cookies
Twitter: twll
, twid
Facebook: c_user
Instagram: ds_user_id
Google: SAPISID
, APISID
Google Play / Android: LAY_ACTIVE_ACCOUNT
Youtube: LOGIN_INFO
Nature of traffic
Protocol
Targeted social networks
Few weeks after the publication the C&C servers went dark
After a reboot, all affected devices should be cleaned
But victims compromised via weak credentials, so they can always reinfect
On the lookout for Moose v2
Looked at over 150 new samples targeting embedded Linux platforms
New proxy service port (20012)
C&C selection on CLI
C&C server returns 404 on unknown bots
Still under analysis
Still trying to get infected
Python and Shell Scripts
Protocol dissectors, fake servers, tshark wrappers
Yara rules
Not yet complex
Tools and processes need to catch up
a low hanging fruit
Prevention simple
Thank you!
and special thanks to Thomas Dupuy (@nyx__o)