OSX/Crisis
Associated threat actors
1 distinct threat actor Mallory has associated with this family across public reporting. Open in Mallory to see the full evidence chain and overlapping campaigns.
Techniques & procedures
16 distinct techniques documented for this family, organized by ATT&CK tactic.
Execution
3 techniques
Execution
Next task is to install the Input Manager (method _dropOsaxBundle , address 0xd871 ). It will be located at /Users/USERNAME/Library/ScriptingAdditions/appleHID ... I’m pretty sure it’s the spying component being injected into applications.
The last interesting bit is the method name called _communicateWithAgents . It’s big and still not reversed but it seems to involve shared memory... agents are the infected applications with the spying module, which dump information to the main backdoor module.
Execution will continue with a method called _resizeSharedMemoryWindow . Here some kernel shared memory settings will be changed. They are kern.sysv.shmmax , kern.sysv.shmall . Since this requires root privileges, it will only work if the backdoor module was installed as root.
Persistence
4 techniques
Persistence
If mdworker.flg is found then the method _createInternalFilesAndFolders will be called... It will create the rootkit bundle... WeP1xpBU.wA-.kext , fix the permissions to root:wheel... If the backdoor is running as root, it will try to connect to the rootkit or load it if connection failed.
Before, the kernel extension rootkit could be easily hidden from kextstat by manipulating this list. Now we must patch an I/O Kit OSArray class called sLoadedKexts
Call method makeBackdoorResident , which will create the Launch Agent com.apple.mdworker.plist at ~/Library/LaunchAgents . This will be responsible for starting the backdoor module.
If mode is Ah57K and target is Lion, the /etc/authorization file will be modified by the method enableSetugidAuth . It modifies the privilege system.privilege.setugid_appkit , which will allow AppKit apps to run setuid/setgid.
Privilege Escalation
5 techniques
Privilege Escalation
If mdworker.flg is found then the method _createInternalFilesAndFolders will be called... It will create the rootkit bundle... WeP1xpBU.wA-.kext , fix the permissions to root:wheel... If the backdoor is running as root, it will try to connect to the rootkit or load it if connection failed.
Before, the kernel extension rootkit could be easily hidden from kextstat by manipulating this list. Now we must patch an I/O Kit OSArray class called sLoadedKexts
Call method makeBackdoorResident , which will create the Launch Agent com.apple.mdworker.plist at ~/Library/LaunchAgents . This will be responsible for starting the backdoor module.
The difference between the two modes is that the Ah56K mode does not try to escalate privileges, while the other one tries it using a spoofed authentication dialog with System Preferences icon... the backdoor executable creates a copy of itself named System Preferences and launches it.
Here the System Preferences backdoor copy will be made and launched, the mdworker.flg will be set, and also make the backdoor module SUID root... the backdoor module will be set SUID root if higher privileges are obtained.
Stealth
6 techniques
Stealth
Classic kernel rootkits aka kernel extensions. Two simple ideas that can make them a lot more powerful and universal.
The trick here is that the backdoor executable creates a copy of itself named System Preferences and launches it.
The next step is to verify is a file called off.flg exists at the backdoor executable location... If it does exist, then the following will happen: Remove off.flg file.
The first important operation that is executed is to verify if the current OS is supported, using getSystemVersionMajor:minor:bugFix: method. Lion and Snow Leopard are valid targets, but also Leopard.
Execution will continue with a method called _resizeSharedMemoryWindow . Here some kernel shared memory settings will be changed. They are kern.sysv.shmmax , kern.sysv.shmall . Since this requires root privileges, it will only work if the backdoor module was installed as root.
Before this happens there is a classic anti-debugging trick – our “old” friend AmIBeingDebugged sysctl. The method detachNewThreadSelector:toTarget:withObject: is called... using the sysctl trick to detect the debugger and sleeping for 50 seconds until next check.
Defense Impairment
2 techniques
Defense Impairment
If mode is Ah57K and target is Lion, the /etc/authorization file will be modified by the method enableSetugidAuth . It modifies the privilege system.privilege.setugid_appkit , which will allow AppKit apps to run setuid/setgid.
The main() starts at 0x3B5C and the start of hostilities is with overriding asl_send()... The objective is to avoid error & warning messages to be written to the log files.
Credential Access
1 technique
Credential Access
If mode is Ah57K and target is Lion, the /etc/authorization file will be modified by the method enableSetugidAuth . It modifies the privilege system.privilege.setugid_appkit , which will allow AppKit apps to run setuid/setgid.
Discovery
3 techniques
Discovery
One easy solution is to read the kernel image from disk and process its symbols... Virtual File System – VFS. Read mach_kernel using VFS functions.
The first important operation that is executed is to verify if the current OS is supported, using getSystemVersionMajor:minor:bugFix: method. Lion and Snow Leopard are valid targets, but also Leopard.
Before this happens there is a classic anti-debugging trick – our “old” friend AmIBeingDebugged sysctl. The method detachNewThreadSelector:toTarget:withObject: is called... using the sysctl trick to detect the debugger and sleeping for 50 seconds until next check.
Observables
1 indicator attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
Recent activity
2 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.