I don't do Windows but here are some (initial) details about why...

@patrickwardle
Patrick Wardle@patrickwardle
9 views Jul 20, 2024 ~4 min read
Advertisement
1
I don't do Windows but here are some (initial) details about why the CrowdStrike's CSAgent.sys crashed

Faulting inst: mov r9d, [r8]
R8: unmapped address

...taken from an array of pointers (held in RAX), index RDX (0x14 * 0x8) holds the invalid memory address

@_JohnHammond
Media image
Media image
2
The other "drivers" (e.g. 'C-00000291-...32.sys') appear to be obfuscated data ...and are x-ref'd (perhaps ingested?) by CSAgent.sys

...so maybe invalid (config/signature) data triggered the fault in CSAgent.sys

This would be easier to tell/confirm via debugging 😅
Media image
3
This is all surmised static analysis ...reversing CSAgent.sys (now on VT: virustotal.com/gui/file/fc17c…)
and data from a single crash dump ...so take with a pinch of 🧂🫣

...and big mahalo to Tom! 🧠🙏🏽
4
Sharing a .zip with:
▫️A few versions of CSAgent.sys (+idb)
▫️Various C-....sys files (including the latest that I believe contains the "fix"?)

I don't have any Windows systems/VMs, so hopefully ya'll can keep digging 🥰

drive.google.com/file/d/1OVIWLD…
#SharingIsCaring
5
A big outstanding questions to me is; what are the 'C-00000291-...xxx.sys' files?

As deleting them fixes the crash, this seems imply their contents matter (as its CSAgent.sys that has references to them, that is crashing).

But as their contents change between systems... 🤔
6
"The .sys files causing the issue are channel update files, they cause the top level CS driver to crash as they're invalidly formatted." -Kevin Beaumont

cyberplace.social/@GossiTheDog/1…
7
Note "channel updates ...bypassed client's staging controls and was rolled out to everyone regardless" resetera.com/threads/window…

A few IT folks who had set the CS policy to ignore latest version confirmed this was, ya, bypassed, as this was "content" update (vs. a version update)
8
An update from @CrowdStrike confirms our analysis: crowdstrike.com/blog/technical…

Namely:
▫️ The C-...sys files aren't kernel drivers, but rather are "configuration files" dubbed "Channel Files"

▫️ C-00000291- "triggered a logic error that resulted in an OS crash" (via CSAgent.sys)
9
@CrowdStrike
Media image
Media image
Media image
10
Some surmised a blank (0x0, ...) Channel File was to blame.

@CrowdStrike debunked that stating the issue was "not related to null bytes contained in ...any... Channel File"

Also @MalwareUtkonos notes a check that shows files must start w/ "0xaaaaaaaa":

@MalwareUtkonos
Malware Utkonos@MalwareUtkonos
@patrickwardle @CrowdStrike There is what appears to be a file magic check for 0xAAAAAAAA at this address in:
37c78ba2eac468941a80f4e12aa390a00cb22337fbf87a94c59cee05473d1c66
This byte pattern is also the first four bytes of the "Channel Files". A file with all NULLs may fail this cmp.
Media image
11
(Others may have mentioned this?) but we find many references "channel files" in @CrowdStrike's patents that provide more insight into their purpose, format, etc.

Search:
"channel file" assignee:(Crowdstrike, Inc.)

For example in US11822515B2 & US11645397B2:
Media image
Media image
12
(attempting) to explain this all to the general America public on @ABC's "Good Morning America" @GMA #TalkingNerdy 📺🇺🇸🍿🤓
Media image
Media image
13
Yes, @Apple should be lauded for deprecating 3rd-party kexts & supporting the move to user-mode System Extensions.

However this has been fraught w/ kernel panics (ha!), privilege escalations ...& worse unprivileged code/malware can still trivially unload macOS security tools! 🫣
14
@Apple macOS kernel code that facilities user-mode System Extensions was (is?) notorious buggy.

Ironically this resulted in security tools that had been migrated to user-mode, now inadvertently triggering wide-spread kernel panics (in core Apple kexts) 🤦🏻‍♂️ #YouHadOneJob
Media image
15
@Apple Other issues included new privilege escalations in core macOS System Extension framework(s) such as CVE-2019-8805

See "Endpoint Security and Insecurity" by @sdotknight (presented at #OBTS 🥰): objectivebythesea.org/v3/talks/OBTS_…
Media image
16
Finally due to flaw in🍎's handling of System Extensions unpriv'd code/malware may trigger their unloading 😱

It's trivial to exploit this 0day, e.g. to nuke LuLu (a firewall that runs as a trusted System Extension) even on the latest version of macOS!

ℹ️ bug not LuLu-specific!
0:18
17
I'm stoked to talking more about crash reports (which provided both the means to gain insight into @CrowdStrike's crash as well as revealed this and other macOS 0days) at @BlackHatEvents! 🖤🥰

Talk: "The Hidden Treasure of Crash Reports?" blackhat.com/us-24/briefing…
18
Update from @CrowdStrike provides details on content of the problematic Channel Files pointing to a problematic "IPC Template Instance"

Also confirms our analysis that crash was due to OOB memory read of invalid memory (not a NULL pointer deref. as some erroneously claimed) 👀
Media image
19
Read more here: crowdstrike.com/falcon-content…

...also mentions another bug in the validation of the Channel Files (performed during testing): "Due to a bug in the Content Validator, one of the two Template Instances passed validation despite containing problematic content data."
20
Still, doesn't explain why the erroneously validated Channel File wasn't tested (tested enough?) *with* the driver.

Though as others have noted, sometimes with an OOB memory read you get "lucky" inadvertently getting a pointer that isn't invalid (and thus, no crash) 🤔
21
@Microsoft has posted their own technical analysis of the @CrowdStrike crash, also confirming:

"that this was a read-out-of-bounds memory safety error in the CrowdStrike developed CSagent.sys driver"

Have a read:
microsoft.com/en-us/security… (by the talented @dwizzzleMSFT)
22
@CrowdStrike explains why channel files could be filled with 0x0s: crowdstrike.com/blog/tech-anal…

tl;dr: Windows (for security reasons) first 0x0s out files and if a crash then occurs the (real) data is never written.

Note: CS driver has basic checks so no crash from these 0x0 files!
23
Finally, we have the full technical analysis from @CrowdStrike!

"[this] instructed the Content Interpreter to read the 21st entries of the input pointer array. However, the IPC Template Type only generates 20 inputs ...[leading to] an out-of-bounds read"

crowdstrike.com/wp-content/upl…
Media image
24
@CrowdStrike This 100% matches our/@taviso's conclusions derived from analyzing the crash report/disasm 🧠

RAX: input pointer array
R11: index (0x14/20d)

Accessing Array[20] retrieved the 21st item (as arrays are 0-based). This returned an invalid memory address that 💥'd when deref'd!
Media image
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • Screenshot Tweet
Create Free Account

Includes 7-day Premium trial

Advertisement