Opened 2 years ago

Closed 18 months ago

Last modified 18 months ago

#1487895 closed Bugs (fixed)

Content checks for inline attachments

Reported by: thomasb Owned by:
Priority: 3 Milestone: 0.7-stable
Component: Security Version: git-master
Severity: major Keywords:
Cc:

Description

Contents of attachments (such as pictures) which are embedded in HTML (multipart/related) messages should be checked before sending them to the client.

Internet Explorer executes javascript code within images (!) if <script>... exists in content. It entirely ignores mimetype headers but does content sniffing.

This is a XSS vulnerability which exists when using Internet Explorer and is an attack that takes advantage of a bug which exists in the web browser.

Reproduction Procedure:

Disguise HTML which contains a SCRIPT tag as a picture file (.jpg, .gif, etc.) or create a picture file that contains a SCRIPT tag and attach it. Send this email and when this attachment is opened/viewed, the javascript is executed.

Attachments (1)

strip_html_for_ie_2011-11-03.diff (1.1 KB) - added by Enrico204 19 months ago.
Possibile workaround for IE text/plain bug

Download all attachments as: .zip

Change History (7)

comment:1 Changed 22 months ago by alec

  • Component changed from Core functionality to Security issue
  • Priority changed from 5 to 3
  • Version changed from 0.2.2 to svn-trunk

See duplicate #1488020 for examples.

Changed 19 months ago by Enrico204

Possibile workaround for IE text/plain bug

comment:2 Changed 19 months ago by Enrico204

I've attached a possibile workaround to clean attachment.

This bug is IE-related (<= 8), and it's fixed in IE9 only: Internet Explorer reads the file content ignoring the content-type served.

comment:3 Changed 18 months ago by thomasb

@Enrico204: I'm sorry but your patch isn't a proper solution for this. While it may solve the issue of this ticket it will break some other use cases where people want to download (unmodified) attachments. Also it requires to load all attachment contents into PHP memory which may exhaust some resources and lead to errors. We had good reasons to circumvent output buffering and to pass attachments directly to the client line by line. All this has to be tanken into account when trying to solve this issue.

comment:4 Changed 18 months ago by alec

A solution for memory issue would be stream wrapper (see stream_wrapper_register() function).

comment:5 Changed 18 months ago by thomasb

  • Resolution set to fixed
  • Status changed from new to closed

Implemented in [57486f6e]

comment:6 Changed 18 months ago by alec

Please read #1488020. This can be used for any attachments not only embed. An attacker can provide a link to attachment (or any message part) without _embed parameter.

Note: See TracTickets for help on using tickets.