6.0.0-beta1
7/8/25

[#5892] Linked attachment feature vulnerability
Summary Linked attachment feature vulnerability
Queue IMP
Queue Version HEAD
Type Bug
State Resolved
Priority 2. Medium
Owners
Requester joao_mauricio (at) clix (dot) pt
Created 11/15/2007 (6445 days ago)
Due
Updated 06/22/2010 (5495 days ago)
Assigned 11/16/2007 (6444 days ago)
Resolved 12/04/2007 (6426 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
06/22/2010 11:00:04 AM info (at) iwmi (dot) com Comment #25 Reply to this comment
Wow, just found out about this exploit. Limited employees at our 
company have mail, however, they can store files in their accounts and 
give out URL's to all employees allowing access to pictures, documents 
and other.  All of this sharing was going on "under the radar"  - have 
not tried yet to see if this is where they are storing MP3's -  So 
much for being able to control access !
12/04/2007 08:23:10 AM Michael Slusarz Comment #24
State ⇒ Resolved
Reply to this comment
11/27/2007 10:20:04 PM Chuck Hagenbuch Comment #23 Reply to this comment
Seems to me like we should make sure not to send those particular mime 
types, and otherwise this should be okay now.
11/27/2007 07:44:57 PM Michael Slusarz Comment #22 Reply to this comment
We should wait for their final measures to deal with that problem and
then reconsider if we still need to add some additional protection.
Fixed in FF 2.0.0.10:

http://www.mozilla.org/security/announce/2007/mfsa2007-37.html
11/21/2007 12:23:33 PM Jan Schneider Comment #21 Reply to this comment
It looks like the Mozilla folks at least accepted that this is their own bug:

http://blog.mozilla.com/security/2007/11/16/jar-protocol-xss-security-issues/



We should wait for their final measures to deal with that problem and 
then reconsider if we still need to add some additional protection.
11/20/2007 11:17:44 PM joao_mauricio (at) clix (dot) pt Comment #20 Reply to this comment
Think about the ids for a minute. Say someone has an email address on
server2 that forwards back to server1. When the attacker sends the
message to the server2 address, it'll have to generate a guest id.
Then the victim will read it when logged in to server1, and all we
can do, maybe, is to say that you can't see this attachment, because
we have no record of the email having been sent to the victim at
their server1 account. The whole thing seems fragile to me.
attachment received from the attacker's email with unique_id = 10 
received (not even the attacker knows that id, just the rcpt):



if the rcpt is authenticated on the server's imp system:

         if the unique_id corresponds to the logged user: success!

         else: fail!

else: success! (cause then, it wont happen any XSS attack)



Maybe that's too complicated, cause maybe i'm not think well about all 
the problems that it raises, so, let's get back to the other solution 
mentioned...
... which is solved by an intermediate page, if not a redirect (I
didn't see an answer to that question), right?
Well, i have to say that when you adopted my "redirect" suggestion, i 
didn't thought that it was a bit modified, cause, my google's previous 
example (when i explained my redirection idea) won't work on this 
situation, but i think that a solution with an intermediate page, as 
you said, it's ok.


11/20/2007 10:52:17 PM Chuck Hagenbuch Comment #19 Reply to this comment

[Show Quoted Text - 10 lines]
... which is solved by an intermediate page, if not a redirect (I 
didn't see an answer to that question), right?



Think about the ids for a minute. Say someone has an email address on 
server2 that forwards back to server1. When the attacker sends the 
message to the server2 address, it'll have to generate a guest id. 
Then the victim will read it when logged in to server1, and all we can 
do, maybe, is to say that you can't see this attachment, because we 
have no record of the email having been sent to the victim at their 
server1 account. The whole thing seems fragile to me.
11/20/2007 10:24:52 PM joao_mauricio (at) clix (dot) pt Comment #18 Reply to this comment
As I said earlier, people can already disable this with a 
configuration option.
I guess that doesn't count as an argument, cause if you are suggesting 
that as a good option, then, for the system's security, it shouldn't 
be implemented in the first place.

[Show Quoted Text - 10 lines]
I don't know if that "secret id craziness" is that crazy, cause it's 
how google does it; but maybe i've expressed my self wrong. If you 
think that's the right solution, ok, but remember that the "jar:" will 
operate after the url is resolved, and the file retrieved.
11/20/2007 09:43:22 PM Michael Slusarz Comment #17 Reply to this comment
Sounds good.
Agreed.
11/20/2007 09:18:53 PM Jan Schneider Comment #16 Reply to this comment
Isn't the simplest answer here to just add an intermediate page? Make
it impossible to download a linked attachment directly - you have to
go to the page first, get a token that's valid for a few minutes,
make a POST request, etc., then you get the file. That way no jar:
link could link directly to a file.
Sounds good.
11/20/2007 09:10:15 PM Chuck Hagenbuch Comment #15 Reply to this comment
I have an alternate thought here than the secret id craziness, and 
having to determine users by id and email address, which seems really 
unworkable if you think about forwarding, aliases, and a bunch of 
other stuff. My head spins.



Isn't the simplest answer here to just add an intermediate page? Make 
it impossible to download a linked attachment directly - you have to 
go to the page first, get a token that's valid for a few minutes, make 
a POST request, etc., then you get the file. That way no jar: link 
could link directly to a file.
11/20/2007 09:06:13 PM Chuck Hagenbuch Comment #14 Reply to this comment
Well... now i've realized that the solution i mentioned earlier isn't
possible too, cause: first the script retrives the file and next the
jar: protocol acts.
Even with a redirect to a different protocol in between?
11/20/2007 09:05:28 PM Chuck Hagenbuch Comment #13 Reply to this comment
I guess the easier but uncool solution is to remove the "Link
Attachments" feature ;) but i guess you don't want that...
As I said earlier, people can already disable this with a 
configuration option.
11/17/2007 08:00:34 PM joao_mauricio (at) clix (dot) pt Comment #12 Reply to this comment
I guess the easier but uncool solution is to remove the "Link 
Attachments" feature ;) but i guess you don't want that...
11/17/2007 07:05:49 PM joao_mauricio (at) clix (dot) pt Comment #11 Reply to this comment
The idea is that the server generate one unique id for each of the 
email recipients, in such a way that the recipient could only open his 
own attachment. Even if the attacker knows a valid id for his evil 
file, that id should only work with his own horde account. For the 
rest of the email recipients (who don't have accounts), there's no 
problem, cause the main problem here is that the file is located and 
run in the same domain of the recipient webmail account, that makes 
possible the attack to happen. If you have the evil script running on 
webmail.server1 and the victim has it's account on webmail.server2, 
the script won't have the right permissions to XSS the victim.

For the "webmail.server1 attacker, webmail.server1 victim" problem, I 
think that it's possible to check which attachment is "visible" to 
which account.
But the attachments are sent to email _recipients_, who don't have
accounts. So how do you propose to enforce the uniqueness? The
attacker could send them any valid id. Secret doesn't matter.
11/17/2007 06:46:26 PM Chuck Hagenbuch Comment #10 Reply to this comment
What is needed is not an unique id, it's a secret and unique id.. on
gmail, for example, each rcpt receives an unique and secret id in his
url, including the sender. A timestamp concatenated with a
pseudo-random id, or something like that may be a solution.
But the attachments are sent to email _recipients_, who don't have 
accounts. So how do you propose to enforce the uniqueness? The 
attacker could send them any valid id. Secret doesn't matter.
11/17/2007 06:43:28 PM joao_mauricio (at) clix (dot) pt Comment #9 Reply to this comment
What is needed is not an unique id, it's a secret and unique id.. on 
gmail, for example, each rcpt receives an unique and secret id in his 
url, including the sender. A timestamp concatenated with a 
pseudo-random id, or something like that may be a solution.
Besides that we already have such an (pseudo) unique id, the
timestamp, how would that help? The attacker, which would be the
sender, would send the message to himself anyway.
11/17/2007 06:22:14 PM Jan Schneider Comment #8 Reply to this comment
Besides that we already have such an (pseudo) unique id, the 
timestamp, how would that help? The attacker, which would be the 
sender, would send the message to himself anyway.
11/17/2007 05:54:00 PM joao_mauricio (at) clix (dot) pt Comment #7 Reply to this comment
Well... now i've realized that the solution i mentioned earlier isn't 
possible too, cause: first the script retrives the file and next the 
jar: protocol acts. So.. I think that a good solution is to put a 
secure id in the attachment's URL, for each rcpt of the attachment. 
That way, no one (except the rcpt) would know the path to the file and 
the XSS attack won't be possible.
11/17/2007 06:06:32 AM Chuck Hagenbuch Comment #6
Version ⇒ HEAD
Reply to this comment
Moving to HEAD; will have to be addressed there first no matter how 
far back any changes are backported.
11/17/2007 06:05:46 AM Chuck Hagenbuch Comment #5 Reply to this comment

[Show Quoted Text - 10 lines]
How does that help? By preventing the jar: prefix being on the URL, 
because you've done a redirect? I guess that might make sense, and if 
that's it that's a relatively simple change...


11/16/2007 04:43:59 AM joao_mauricio (at) clix (dot) pt Comment #4 Reply to this comment
I guess that won't do the job either... cause it doesn't matter the 
extension you use, the jar: protocol will interpret it as if it was a 
jar file... i think that the solution begins with "hiding" the 
original attachment. Another google example (this time a good one :P):



http://mail.google.com/mail/?attid=0.1&disp=attd&view=att&th=1166689ac6fe384d



I'm not sure, but i think that what happens in this situation, is that 
an internal script is run and then you have access to the desired 
attachment. But not directly.
Poster wrote back clarifying that this is an XSS issue
(http://blog.beford.org/?p=8). I'm still not sure that this is a
vulnerability that we can solve in IMP.

To the poster: what is your suggested solution here? Any particular
site can turn off linked attachments. But any application that hosts
files is "vulnerable" to this. So what can an app do, aside from
disallowing jar files?
11/16/2007 04:13:15 AM Chuck Hagenbuch Comment #3 Reply to this comment
Poster wrote back clarifying that this is an XSS issue 
(http://blog.beford.org/?p=8). I'm still not sure that this is a 
vulnerability that we can solve in IMP.



To the poster: what is your suggested solution here? Any particular 
site can turn off linked attachments. But any application that hosts 
files is "vulnerable" to this. So what can an app do, aside from 
disallowing jar files?
11/16/2007 01:10:22 AM Chuck Hagenbuch Comment #2
State ⇒ Feedback
Priority ⇒ 2. Medium
Reply to this comment
By exploiting the jar: protocol feature of Mozilla Firefox and the
fact that the Imp Web Client allows things like
"https://mail.server/horde/imp/attachment.php?u=user&t=4827164921&f=example.jpg", it's possible to execute various XSS attacks. For 
example:
"jar:https://mail.server/horde/imp/attachment.php?u=user&t=4827164921&f=example.jar!/evil.htm".
I'm certainly sensitive to security concerns, but there are several 
reasons I don't think this is a vulnerability in IMP itself, though 
IMP might be "involved" in exploiting it:



- When downloading linked attachments, we send a content-disposition 
of attachment. If the browser displays files directly anyway... 
there's only so much we can do about that.



- If I'm reading correctly, you have to prepend jar: to the URL for 
this to happen. IMP will never do that, so someone would have to send 
a hand-crafted email containing the malicious URL.



- If the attacker is crafting their own URL anyway, isn't it a lot 
simpler to put their malicious file somewhere else, and to make it 
look more enticing then an email attachment? Admittedly this is a 
dodge, but I think the other reasons are more valid.



- A user could upload other kinds of "bad" content to an attachment 
and send them out. That makes this a file delivery mechanism - we 
should probably have a hook for scanning and accepting/rejecting 
linked attachments - but that's no more a vulnerability than an FTP 
site is.



If you don't disagree, I'll turn this into an enhancement ticket to 
add a hook for scanning linked attachments (probably easier to have it 
handle all attachments and accept/reject on initial upload, actually). 
If you do disagree, please explain, and we'll see where we are.



Thanks,

Chuck
11/15/2007 08:55:45 PM joao_mauricio (at) clix (dot) pt Comment #1
State ⇒ Unconfirmed
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Linked attachment feature vulnerability
Queue ⇒ IMP
Reply to this comment
By exploiting the jar: protocol feature of Mozilla Firefox and the 
fact that the Imp Web Client allows things like 
"https://mail.server/horde/imp/attachment.php?u=user&t=4827164921&f=example.jpg", it's possible to execute various XSS attacks. For example: 
"jar:https://mail.server/horde/imp/attachment.php?u=user&t=4827164921&f=example.jar!/evil.htm".

Saved Queries