Skip to content

[KC] KernelCache view fails to find strings in loaded images due to segments having incorrect flags #7354

@bdash

Description

@bdash

Version and Platform (required):

  • Binary Ninja Version: 5.2.8223-dev Ultimate, 3afa844d
  • OS: macos
  • OS Version: 26.0
  • CPU Architecture: arm64

Bug Description:
After loading an image from a kernel cache, it should be possible to see its strings in the Strings pane.

Steps To Reproduce:

  1. Load a kernel cache. I used 22G5064d__iPhone15,2/kernelcache.release.iPhone15,2
  2. Load an image via the triage view. I picked com.apple.security.sandbox.
  3. Edit -> Go To Address… and enter com.apple.security.sandbox::__TEXT.__cstring
  4. Search for one of the strings you see in the Strings pane.

Expected Behavior:
Strings!

Actual Behavior:
No strings :-(

This is a consequence of zero being passed as the flag argument to AddAutoSegment. That marks the segment as not readable, which causes the string analysis to skip its contents.

Image

KernelCacheController::ApplyImage should be using SegmentFlagsFromMachOProtections(segment.initprot, segment.maxprot) instead of segment.flags when adding the segment.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions