Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MacOS] DYLIB Injection through "DYLD_INSERT_LIBRARIES" env variable #2017

Open
Zeyad-Azima opened this issue Aug 3, 2023 · 2 comments
Open

Comments

@Zeyad-Azima
Copy link

Zeyad-Azima commented Aug 3, 2023

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

Copy link

github-actions bot commented Dec 2, 2023

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 github-actions bot added the stale label Dec 2, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2023
@therealbobo therealbobo reopened this Dec 10, 2023
@github-actions github-actions bot removed the stale label Dec 11, 2023
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants