2\ METHOD 1: Look for the OAuth redirect consent link in browser history and/or proxy logs.
Take note of the following fields:
- client_id (malicious app id)
- redirect_uri (malicious domain)
- scope (API permissions requested)
3\ Review permissions requested in the scope field (I'll show you where else to find these permissions in the logs).
Take note of these:
- User.Read
- User.ReadWrite
- User.ReadWrite.All
- Mail.ReadWrite
- Calendars.ReadWrite
- Files.ReadWrite
- User.Export.All
4\ METHOD 2: Review Azure Audit Logs
Look for 3 log entries that will be created when a user authorises a malicious app. These are covered in the blog (too long to write into a tweet).
These logs will reveal:
> Malicious Object ID (important later)
> App name
> Permissions
5\ METHOD 3: Review Azure Sign-in Logs or UAL
These will show logons into a user account originating from the malicious application.
It's important you do Method 2 before Method 3 so you can get the application object ID and application name to make this high-fidelity ;)
happy hunting also i think i use way too many purple things.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
This leaves OBVIOUS AF traces. Look for entries with zeros, and datetime defaulting to 1970. You can also review timestamps (covered in thread 4).
I highlighted in purple where you zero out the data in hex.
3\ Method 2: Overwriting the file
Overwrite the entire entry with a "cleaned" version. In this example I removed all lines pertaining to "sansforensics" logging in. Timestamp detection is the best method to discover this technique.
Look for processes in /proc/<PID>/exe where the path shows "(deleted)"
Here are two examples👇 1. BPFDoor deleted binary 2. An attacker abusing memfd_create() to exec their malware in RAM w/o dropping files to disk.
2\ To recover/extract these binaries running in memory - you can copying them out from this location:
/proc/<PID>/exe
Also as an FYI for memfd_create() abuse detection you can hunt for the "memfd: (deleted)" string directly.
3\ You can also review what command line spawned the pid by reviewing:
/proc/<PID>/cmdline
This screenshot shows the cmdline used for the memdf_create() reverse shell. There are a lot of other interesting things you can also review in /proc/PID
2\ Most IR analysts are taught to detect timestomping using two methods:
> Compare $FI vs $SI times in the MFT
> Look for 0s in timestamp nanoseconds
These two detections are NOT foolproof - they will catch simple cases. Attackers can set nanoseconds and modify $FN time!
3\ Why should you care?
Most forensic courses teach these 2 detections without introducing more variables. A lot of analysts treat what they are taught as the "bible" without questioning it and when it comes to detecting these anomalies... critical evidence may be missed.