I use 4.6.10 on php5, MySQL 4.0.24

I recently installed bad behavior 1.2.4. and this caught my attention:

Request type POST
Host www.denmarkonline.dk
URI /comment/reply/112/70/comment/reply/112
Protocol HTTP/1.0
Henvisning http://www.denmarkonline.dk/comment/reply/112/70
User Agent Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1a) Gecko/20020611
Headers POST /comment/reply/112/70/comment/reply/112 HTTP/1.0 Accept: */* Connection: keep-alive Cookie: PHPSESSID=2c8c90d929a81689a8802f19a41ccf70 Expect: 100-continue Host: www.denmarkonline.dk Pragma: no-cache Referer: http://www.denmarkonline.dk/comment/reply/112/70 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1a) Gecko/20020611
Request Entity edit: Array op: Gennemse kommentar
Denied Reason Header 'Expect' prohibited in HTTP/1.0 requests
Response 403

Look at the phpsessid. It looks like somebody found a way to hack the drupal core system to post spam comments. Is my assumption correct ?

Comments

yelvington’s picture

Botnet attacks are becoming a serious problem. I've experienced several attacks in which literally thousands of simultaneous requests resulted in the "too many connections" error, rendering the site useless.

The problem you cited looks like a Drupal-specific attempt to post blog spam by a poorly written bot that is faking its identity as a Mozilla-based browser. As I understand it the 4.7.4/4.6.10 changes in form handling are intended to stop some of that from making it into the database but you still incur the expense of the hits.

If you root around in your logs you may find simultaneous assaults from multiple addresses at the same time. That's a pretty clear botnet signature. They come in several flavors -- attempts to post blog spam, attempts to push fake HTTP referers into logfiles and trackbacks, Microsoft-specific virus infection attempts, and plain old denial-of-service attacks.

There are some improvements in the .htaccess file of recent Drupal releases that can help with some types of attacks (not the one you cited), and you can add a few lines of your own to drop connections for specific types of probes. You should be sure Drupal isn't trying to serve 404s for any image directories, etc., or any of the common Microsoft attacks. If you want you can just have Apache redirect them to the source of the problem:

RedirectMatch /_vti_bin/ http://www.microsoft.com
RedirectMatch /scripts/ http://www.microsoft.com
RedirectMatch /MSADC/ http://www.microsoft.com
RedirectMatch /c/ http://www.microsoft.com
RedirectMatch /d/ http://www.microsoft.com
RedirectMatch /_mem_bin/ http://www.microsoft.com
RedirectMatch /msadc/ http://www.microsoft.com
RedirectMatch /MSOffice/ http://www.microsoft.com

... and/or just drop the connection ...

RewriteCond %{HTTP_REFERER} (casino) [NC,OR]
RewriteCond %{HTTP_REFERER} (cialis) [NC,OR]
RewriteCond %{HTTP_REFERER} (viagra) [NC,OR]
RewriteCond %{HTTP_REFERER} (cheating-?wives) [NC,OR]
RewriteCond %{HTTP_REFERER} (housewives) [NC]
RewriteCond %{HTTP_REFERER} (insurance) [NC]
RewriteRule \.*$ - [F,L]

et cetera.

drubeedoo’s picture

Thanks for the detailed and humorous reply. I never would have thought of sending the MS weakness-probing bots back to their sandbox. You made my day... ;-)

kbahey’s picture

If you see the result, it is a 403, which means access denied.

So, the bot attempt to post spam at your site was unsuccessful, either because the bot used invalid code (specifying HTTP/1.0 and using Expect at the same time) or because the session ID is not for a logged in user as well. That ID can just be what got sent to the bot in earlier requests.

I agree with yelvington that bots are a serious problem, and if they do no real damage, they do suck system resources. There is no fool proof generic solution yet.
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

FlemmingLeer’s picture

I think the 403 is a result of the Bad behavior module which blocked the attempt. I don´t know if it would have been blocked without the module.

My site seems to recover a bit after I installed the bad behavior and right now it has logged over 8000 attempts to post spam comments since november 1st ! And my site is only a small niche site. :/