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

keychain.js | SEGFAULT when --include-acls is combined with other args, #6

Open
darmado opened this issue Oct 24, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@darmado
Copy link
Owner

darmado commented Oct 24, 2024

Description
SEGFAULT when --include-acls is combined with other args,

script name: keychain.js

Steps To Reproduce
Steps to reproduce the unexpected behavior:

  1. sh osascript -l JavaScript keychain.js --list-all-generic --debug
  • list_all_key_of_type function executes and returns all 123 generic keys
  1. sh osascript -l JavaScript keychain.js --list-all-generic --include-acls --debug

Expected behavior
When the user passes the --include-acls ar as input. the query_acls function should execute, and return the ACL output. (not a TCC permission issue )
ACLs are returned and printed by the list_all_key_of_type function
image

FUNCTION: CODE:
image

Screenshots
image

@darmado darmado added the bug Something isn't working label Oct 24, 2024
@darmado darmado self-assigned this Oct 24, 2024
@darmado
Copy link
Owner Author

darmado commented Oct 24, 2024

RCA

  • I spent 5 hours on this bad boy. :)
  • The bug was very subtle. I didn't realize we cannot get Obj-C objects from JS arrays with JS methods.
  • hence the default error during the first query wherein the quer function attempted to access the obj-c objects from the JS array.

Buggy code block

let item_o_c = $.CFMakeCollectable(items[0]).js;
console.log("[+] Successfully searched, found " + item_o_c.length + " items")
for(let i = 0; i < item_o_c.length; i++){
    let item = item_o_c[i];
    // ... processing ...
}
let item_o_c = $.CFMakeCollectable(items[0]);
console.log("[+] Successfully searched, found " + item_o_c.count() + " items")
for(let i = 0; i < item_o_c.count(); i++){
    let item = item_o_c.objectAtIndex(i);
    // ... processing ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant