sysdig icon indicating copy to clipboard operation
sysdig copied to clipboard

[MacOS] DYLIB Injection through "DYLD_INSERT_LIBRARIES" env variable

Open Zeyad-Azima opened this issue 2 years ago • 2 comments

Intrroduction

Sysdig is vulnerable to DYLIB Injection through the DYLD_INSERT_LIBRARIES environment variable. When running the sysdig tool it loads the libraries in the DYLD_INSERT_LIBRARIES environment variable automatically and without verifying the signature if it's the same as the tool or no. Which lead to Inject a malicious DYLIB by the tool and act on the behave of it.

Steps to Reproduce

  • When running sysdig normally it will run as should, But if we created a DYLIB and indicat to it using the DYLD_INSERT_LIBRARIES environment variable it will load it without any verifying automatically.

Screenshot 2023-08-04 at 3 29 16 AM

Test DYLIB Code

#import <Foundation/Foundation.h>
__attribute__((constructor))
static void testing(int argc, const char **argv) {
NSLog(@"[+] Dynamic library loaded into %s", argv[0]);
}

Compile the code using gcc normally:

gcc -framework Foundation -dynamiclib code.m -o test.dylib

Cc: @mhzcyber

Zeyad-Azima avatar Aug 03 '23 19:08 Zeyad-Azima

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 02 '23 01:12 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 10 '24 01:04 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 09 '24 01:08 github-actions[bot]