{"exploit":{"id":"EDB-38137","name":"Apple Mac OSX Install.Framework - Arbitrary mkdir / unlink and chown to Admin Group","description":"Apple Mac OSX Install.Framework - Arbitrary mkdir / unlink and chown to Admin Group","cves":["CVE-2015-5784"],"author":"Google Security Research","published":"2015-09-10","platform":"osx","type":"local","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/38137","path":"exploits/osx/local/38137.txt","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-38137.txt","vulnerabilities":[{"id":"CVE-2015-5784","state":"PUBLISHED","title":null,"titleSource":null,"description":"runner in Install.framework in the Install Framework Legacy component in Apple OS X before 10.10.5 does not properly drop privileges, which allows attackers to execute arbitrary code in a privileged context via a crafted app.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2015-5784","cvss":{"version":"2.0","baseScore":9.3,"severity":"high","vectorString":"AV:N/AC:M/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2015-5784"},"updatedAt":"2024-08-06T06:59:04.386Z","retrievedAt":"2026-11-27T09:08:37.052Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-38137.png?v=2","url":"https://exploitbin.com/exploits/EDB-38137","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-38137/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-38137/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"Source: https://web.archive.org/web/2015/https://code.google.com/p/google-security-research/issues/detail?id=477\n\nInstall.framework has a suid root binary here: /System/Library/PrivateFrameworks/Install.framework/Resources/runner\n  This binary vends the IFInstallRunner Distributed Object, which has the following method:\n\n  [IFInstallRunner makeReceiptDirAt:asRoot:]\n\n  If you pass 1 for asRoot, then this code will treat the makeReceiptDirAt string as a path and make two directories\n  (Library/Receipts) below it. At first glance this code looks immediately racy and no doubt we could play some\n  symlink tricks to get arbitrary directories created, but, on second glance, we can do a lot more!\n\n  This code is using distributed objects which is a \"transparent\" IPC mechanism: what this means in practise is that\n  not only can I call methods on the IFInstallRunner object running in the suid root process, but I can also pass it objects\n  from my process; when the suid root process then tries to call methods on those object this will actually result in callbacks\n  into my process :)\n\n  In this case rather than just passing an NSString as the makeReceiptDirAt parameter I create and pass an instance of my own class\n  \"InitialPathObject\" which behaves a bit like a string but gives me complete control over its behaviour from my process.\n\n  By creating a couple of this custom classes and implementing various methods we can reach calls to mkdir, chown and unlink with euid == 0.\n  We can completely control the string passed to mkdir and unlink.\n  In the chown case the code will chown our controlled path to root:admin; regular os x users are members of the admin group which means that this\n  will give the user access to files which previously belonged to a different group.\n\n  To hit the three actions (mkdir, chown and unlink) with controlled arguments we need to override various\n  combinations of selectors and fail at the right points:\n\n  InitialPathObject = the object we pass to the makeReceiptDirAt selector\n    overrides: - stringByAppendingPathComponent\n                 * will be called twice:\n                    * first time:  return an NSString* pointing to a non-existant file\n                    * second time: return SecondFakeStringObject\n\n  SecondFakeStringObject = returned by the second call to stringByAppendingPathComponent\n    overrides: - length\n                 * will be called by the NSFileManager?\n                 * return length of path to non-existant file\n               - getCharacters:\n                 * will be called by the NSFileManager?\n                 * return character of the non-existant file path\n               - fileSystemRepresentation\n                 * for MKDIR:\n                   * first time: return char* of the target path\n                   * second time: return char* to non-existant file\n                   * third time: return char* to non-existant file\n                 * for CHOWN:\n                   * first time: return char* of temporary directory to create and ignore\n                   * second time: return char* of target path\n                 * for UNLINK:\n                   * first time: return char* of temporary directory to create and ignore\n                   * second time: return char* to non-existant file\n                   * third time: return char* to path to unlink\n               - stringByAppendingPathComponent:\n                 * for MKDIR:\n                   * not called\n                 * for CHOWN:\n                   * return NSString* pointing to file which does exist // to bail out before creating /Receipts\n                 * for UNLINK\n                   * not called\n\n  build: clang -o as_root_okay_then_poc as_root_okay_then_poc.m -framework Foundation\n  run: ./as_root_okay_then_poc MKDIR|CHOWN|UNLINK <target>\n\n  note that this will create some root-owned temporary directories in /tmp which will need to be manually cleaned up\n\nProof of Concept:\nhttps://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/38137.zip","sha256":"edea009be4aec47e89fd4862e37d65fc62b9aa88ed6fd5371fae2c09ba7e3321","bytes":4050,"fetchedAt":"2026-11-27T09:08:31.798Z","encoding":"utf-8 (display only; download retains original bytes)"}