You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2005/08/26 12:57:10 UTC

[Bug 4558] New: oscommerce ships with an open redirector

http://bugzilla.spamassassin.org/show_bug.cgi?id=4558

           Summary: oscommerce ships with an open redirector
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Platform: All
               URL: http://demo.oscommerce.com/redirect.php?action=url&goto=
                    www.example.com/?random
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Rules
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: bugzilla.spamassassin.org@iloaf.com


Spammers are abusing an open redirector in the popular open source shopping cart 
program "OSCommerce."  

Redirector pattern to decode it so the URI rules can do the biz.
20_uri_tests.cf: 
redirector_pattern /redirect\.php.*goto=(.*?)(?:$|&)/

Credits to Alex Broens who bugged us over IM when we should have been taking Tea.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
Attachment #3106 is|0                           |1
           obsolete|                            |




------- Additional Comments From spamassassin@dostech.ca  2005-08-29 16:26 -------
Created an attachment (id=3108)
 --> (http://bugzilla.spamassassin.org/attachment.cgi?id=3108&action=view)
patch

You can only look for both delimiters (& ;) if the particular redirect script
supports both.	Otherwise it is trivial to have SA detect one domain while the
script really redirects to another.  In this case the script only supports the
& delimiter (which is the old preferred delimiter, the ; is the new preferred
delimiter for CGI query strings).  This is why the existing redirector patterns
each look for a different mix of delimiters.

Again, almost all redirector patterns should be case-insensitive.

Redirector patterns should go directly into 20_uri_tests.cf.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From bugzilla.spamassassin.org@iloaf.com  2005-08-27 03:20 -------
Nice one! Along the same lines that fails on this uri ;)
http://demo.oscommerce.com/redirect.php?action=url&blahgoto=www.ppppppppp.com&goto=www.ooooooooo.com&goto=www.wwwwwwwww.com#&blah2goto=www.zzzzzzzzz.com

(It should find the wwwwwwwww.com)
How about 
redirector_pattern /^http.*redirect\.php.*?.*(?:\?|&|\#)goto=(.*?)(?:$|&|\?|\#)/i

?



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] [review] add redirector pattern for oscommerce software open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From felicity@apache.org  2005-08-29 19:38 -------
+1



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From bugzilla.spamassassin.org@iloaf.com  2005-08-26 11:54 -------
Created an attachment (id=3104)
 --> (http://bugzilla.spamassassin.org/attachment.cgi?id=3104&action=view)
Sample email (munged to protect trap)

Sorry for the delay - here is a sample of the mail with the redirector abuse in
it.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] [review] add redirector pattern for oscommerce software open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558


sidney@sidney.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs two votes             |Ready to be applied




------- Additional Comments From sidney@sidney.com  2005-08-29 20:06 -------
+1

Could someone add test cases for this to t/uri.t?



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From lwilton@earthlink.net  2005-08-27 16:13 -------
Subject: Re:  oscommerce ships with an open redirector

> In response to Comment #6:
> {5,60}
> This fails in a valid (though rare) case like "x.us".  quinlan in IRC
suggested
> that {4,255} would be correct.

Considered at the time I wrote it, but I considered it unlikely enough to
not be a concern.  Note I did start the other pattern at 4.  {4,255} would
be correct, but I get a little nervous with matches that long.

> Wouldn't this fail in the case of something like
> http://255longdomainname/somedir/redirect.php ?

Yep.  I was basing the assumption on the idea that these were perverted
"real" redirectors, and that real redirectors would perhaps usually have
rational top-level name lengths.

> Shouldn't this match https too?
> /^https?/

Haven't a clue.  The two examples didn't use https so I didn't include it.
Can't see a reason not to put it in though.

> Why "60"?  Is that an arbitrary number or was it chosen for some reason?

Arbitrary, based on typical length of real domain names, and the usual
concerns on long pattern matches that can potentially backtrack.





------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From wtogami@redhat.com  2005-08-27 14:52 -------
In response to Comment #6:
{5,60}
This fails in a valid (though rare) case like "x.us".  quinlan in IRC suggested
that {4,255} would be correct.

Wouldn't this fail in the case of something like
http://255longdomainname/somedir/redirect.php ?

Shouldn't this match https too?
/^https?/

Why "60"?  Is that an arbitrary number or was it chosen for some reason?



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From sidney@sidney.com  2005-08-28 00:36 -------
> Cookie: cookie_test=please_accept_for_session;

There's the cookie. If your browser is configured not to accept cookies then you
would get the page saying that you need to have cookies enabled, but your
browser was set to accept the cookie.




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] [review] add redirector pattern for oscommerce software open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From spamassassin@dostech.ca  2005-08-30 21:07 -------
I think something needs to be done about uri.t needing the redirector patterns
added to uri.t (it doesn't load them from 20_uri_tests.cf) before we worry about
adding tests for each redirector pattern.  I do agree that it needs to be done
though since it's really easy to get a redirector pattern incorrect, and
somebody might break one trying to optimize it down the road.

[dos@silver 3.1]$ svn commit -m "bug 4558: ..."
Sending        rules/20_uri_tests.cf
Transmitting file data .
Committed revision 264934.

[dos@silver trunk]$ svn commit -m "bug 4558: ..."
Sending        rules/20_uri_tests.cf
Transmitting file data .
Committed revision 264935.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4558] [review] add redirector pattern for oscommerce software open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558


wtogami@redhat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|3.0.5                       |3.1.0
            Version|3.0.4                       |SVN Trunk (Latest Devel
                   |                            |Version)




------- Additional Comments From wtogami@redhat.com  2005-08-31 17:43 -------
Ooops... sorry.




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4558] [review] add redirector pattern for oscommerce software open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From felicity@apache.org  2005-08-31 16:40 -------
Subject: Re:  [review] add redirector pattern  for oscommerce software open redirector

On Wed, Aug 31, 2005 at 03:23:27AM -0700, bugzilla-daemon@bugzilla.spamassassin.org wrote:
>              Status|RESOLVED                    |REOPENED
>          Resolution|FIXED                       |
>   Status Whiteboard|Ready to be applied         |
>    Target Milestone|3.1.0                       |3.0.5
>             Version|SVN Trunk (Latest Devel     |3.0.4
>                    |Version)                    |
> 
> Retargeting for 3.0.5.  I personally will subject these 3.0.5 candidate patches
> to our own test users to ensure a regression free 3.0.5 with minimal detriment
> to the developer resources of 3.1.0.

Um.  This ticket can't be retargeted to 3.0.x.  The redirector_pattern
functionality is a 3.1 feature and doesn't exist in 3.0...





------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From wtogami@redhat.com  2005-08-27 16:31 -------
>> Why "60"?  Is that an arbitrary number or was it chosen for some reason?
> Arbitrary, based on typical length of real domain names, and the usual
> concerns on long pattern matches that can potentially backtrack.

They need not buy long domain names.  They could instead make a subdomain to
circumvent an arbitrarily short domain name.  OTOH we don't have a long domain
name rule elsewhere?



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From spamassassin@dostech.ca  2005-08-27 02:31 -------
Of course that last one was missing the trailing slash and shouldn't be case
sensitive, so:

redirector_pattern /redirect\.php.*?(?:\?|&)goto=(.*?)(?:$|&)/i



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From bugzilla.spamassassin.org@iloaf.com  2005-08-28 01:16 -------
Created an attachment (id=3106)
 --> (http://bugzilla.spamassassin.org/attachment.cgi?id=3106&action=view)
osCommerce redirector patch for 70_testing 

see above



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From duncf@debian.org  2005-08-27 16:18 -------
I believe that ; behaves the same way as & in a CGI parameter string in some
cases (though I don't know about PHP). Perhaps this would be better?

redirector_pattern m'/redirect\.php\?.*(?<=[?&;])goto=(.*?)(?:$|[&;])'

is the .* a problem in a redirector pattern? (It shouldn't be, unless people
start giving us super long URLs to try to exploit that, so maybe .{0,300} would
be better (or some other number))



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] [review] add redirector pattern for oscommerce software open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558


wtogami@redhat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |
  Status Whiteboard|Ready to be applied         |
   Target Milestone|3.1.0                       |3.0.5
            Version|SVN Trunk (Latest Devel     |3.0.4
                   |Version)                    |




------- Additional Comments From wtogami@redhat.com  2005-08-31 03:23 -------
Retargeting for 3.0.5.  I personally will subject these 3.0.5 candidate patches
to our own test users to ensure a regression free 3.0.5 with minimal detriment
to the developer resources of 3.1.0.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From henry@stern.ca  2005-08-27 15:03 -------
A simpler, easier-to-read regex would be

redirector_pattern m'/redirect\.php\?.*(?<=[\?&])goto=(.*?)(?:$|&)'



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From lwilton@earthlink.net  2005-08-27 13:49 -------
Subject: Re:  oscommerce ships with an open redirector

redirector_pattern
m'^http://[^/]{5,60}/redirect\.php\?[\w\-\.\&\=]{0,100}?\&goto=([\w\-\.]{4,6
0})'i

would be closer to how I would probably code it (untested).

        Loren





------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From bugzilla.spamassassin.org@iloaf.com  2005-08-27 22:51 -------
(In reply to comment #12)
> FWIW, when I click on the links here, I don't get redirected, I get told that I
> need a cookie first.


That's odd, This one works for me on firefox on windows.
Here is the trace:

GET
/redirect.php?action=url&blahgoto=www.ppppppppp.com&goto=www.ooooooooo.com&goto=www.wwwwwwwww.com
HTTP/1.1
Host: demo.oscommerce.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10)
Gecko/20050716 Firefox/1.0.6
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: cookie_test=please_accept_for_session;
osCsid=08f79611101357d5d4e3fa30bba53bf0

HTTP/1.x 302 Found
Date: Sun, 28 Aug 2005 04:42:05 GMT
Server: Apache/2.0.46 (Red Hat)
Accept-Ranges: bytes
X-Powered-By: PHP/4.3.2
Set-Cookie: cookie_test=please_accept_for_session; expires=Tue, 27-Sep-2005
04:42:05 GMT; path=/; domain=demo.oscommerce.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://www.wwwwwwwww.com
Content-Encoding: gzip
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
----------------------------------------------------------
http://www.wwwwwwwww.com/#&blah2goto=www.zzzzzzzzz.com

GET / HTTP/1.1
Host: www.wwwwwwwww.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10)
Gecko/20050716 Firefox/1.0.6
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 200 OK
Date: Sun, 28 Aug 2005 05:46:09 GMT
Server: Apache/2.0.46 (Red Hat)
Accept-Ranges: bytes
X-Powered-By: PHP/4.3.2
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8





------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |3.1.0






------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From duncf@debian.org  2005-08-27 17:56 -------
FWIW, when I click on the links here, I don't get redirected, I get told that I
need a cookie first.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] [review] add redirector pattern for oscommerce software open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558


sidney@sidney.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rosenbaumlm@ornl.gov




------- Additional Comments From sidney@sidney.com  2005-09-05 06:25 -------
*** Bug 4566 has been marked as a duplicate of this bug. ***



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558





------- Additional Comments From spamassassin@dostech.ca  2005-08-27 02:25 -------
You actually need to check to make sure it's really 'goto' and not 'blahgoto'. 
Otherwise it'll match the first 'blahgoto' and miss any 'goto' that follows it.
 Example:

http://demo.oscommerce.com/redirect.php?action=url&blahgoto=www.nowhere.com&goto=www.gohere.com

I think (no sleep in quite some time) this should do it:

redirector_pattern /redirect\.php.*?(?:\?|&)goto=(.*?)(?:$|&)


Anyway, if somebody can make a patch, somebodys can vote on it and somebody can
apply it.  (A couple more weeks and I should have some spare time to
eat/sleep/write code myself.)



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] oscommerce ships with an open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558


felicity@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lwilton@earthlink.net




------- Additional Comments From felicity@apache.org  2005-08-27 13:43 -------
*** Bug 4561 has been marked as a duplicate of this bug. ***



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4558] [review] add redirector pattern for oscommerce software open redirector

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4558


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dev@spamassassin.apache.org
         AssignedTo|dev@spamassassin.apache.org |spamassassin@dostech.ca
            Summary|oscommerce ships with an    |[review] add redirector
                   |open redirector             |pattern  for oscommerce
                   |                            |software open redirector
  Status Whiteboard|                            |needs two votes




------- Additional Comments From spamassassin@dostech.ca  2005-08-29 16:29 -------
Please vote for 3.1 inclusion.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are on the CC list for the bug, or are watching someone who is.