hey i found this
http://www.exploit-db.com/exploits/18564/

# Exploit Title : Drupal CMS 7.12 (latest stable release) Multiple Vulnerabilities
# Date : 02-03-2012
# Author : Ivano Binetti (http://ivanobinetti.com)
# Software link : http://ftp.drupal.org/files/projects/drupal-7.12.zip
# Vendor site : http://drupal.org
# Version : 7.12 (and lower)
# Tested on : Debian Squeeze (6.0)
# Original Advisory: http://ivanobinetti.blogspot.com/2012/03/drupal-cms-712-latest-stable-re...
# Other Advisory : http://packetstormsecurity.org/files/110404/Drupal-CMS-7.12-Cross-Site-R...
# Other Advisory : http://www.1337day.com/exploits/17611

any patch or something ?
all my sites at risk right now
:(

Comments

Heine’s picture

It's bogus except for point 2.2. The form_token is bound to a particular session. As long as the token remains a secret, there's no exploit possible. The token can only be obtained if there's another vulnerability (XSS), which is why we have lots of code in Drupal to prevent XSS.
In case of MiTM I recommend that the attacker extracts the admin pwd or session id and does modifications himself instead of the round-about CSRF.

Point 2.2 deals with the logout CSRF which is a widely known and minor (though annoying) issue. See #144538: User logout is vulnerable to CSRF for a discussion. POST vs GET doesn't' really matter here, as an iframe post to the logout URL would have the same effect as a GET request from an image embedded in the 'attack' page.

The HTTP_REFERER check recommendation is ridiculous.

wooody’s picture

I don't think it's right exploit, coz it's deny any access to this page:
drupal/admin/people/create?render=overlay&render=overlay

erickc’s picture

I have read this exploit and in my opinion it is right.

Http_Referer checking is a primary element to prevent CSRF exploit. I would recommend to Heine to read OWASP doscumentation about it https://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29_Pr...

Point 2.2 If you check Http_referer you could not use form_token ad solve your CSRF "minor" (I think Hine did not perform really an Man in the middle attack) vulnerability.

Point 2.1 I verified that Drupal has problems described in above advisory because did not correctly chech "form_buid_id" parameter. Question for Heine: why you introduced this parameter if you don't use it?
"form_token" parameter: also this parameter has problems because it should be unique for any operation, instead is the same for similar operations in the same session.

Can an attacker use this exploit to gain access to the system? As descibed in the advisory these vulnerabilities can exploited by an internal attacker (did you think that internal attackers are not a problem? ok then your Drupal cms is not vulnerable) which is able to sniff form_token parameter and so create a new Drupal administrator account.
Any external attacker that controls an internal client become an internal attacker.

When you perform an Man in the Middle attack you can simply redirect all the traffic to an attacker machine and from the attacker machine redirect the traffic to oroginal destination without the networks know about it. This is passive method and it is very SILENT and, most of all, is very simple to perform.
Drupal should not allow this.

Heine’s picture

We use the token check as laid out on the OWASP page and did not include the Referrer check because (as also laid out on the OWASP page you link to) :

1) it is not always included in the request
2) XSS can also bypass this check
3) A MITM attacker could easily alter the referrer.

If a MITM is a concern, use HTTPS.

The form_build_id is used, but not as an anti-CSRF measure. Mainly state storage.

erickc’s picture

Dear Heine,
You should use both token check and http_referer check. Sure, if could use only token check but you need to secure it and improve form_token generation in order to make it unique for any operations.
You say that http referer check can be bypassed by XSS. Sure but I don't think that latest Drupal release (7.12) is vulnerable to XSS. So http_referer check is good solution to avoid CSRF vulnerability. Most of all because in the page you link "dumm" says that "We can't add a token....."

You say that http_referer is not always included in the request: sure because there are simply hacks to not send http referer in http request (for example using ) but when you perform http refere check,when you don't receive http_referer you should discard that request because it means that someone is trying to spoof http_referer. Simple, not?

Sure you can improve security with https (note that Drupal defualt installation uses only http) but if you correct form_token logic generation and introduce http_referer checking you will make (almost) impossible to exploit Drupal.

Heine’s picture

It's not that hard to fake the HTTP_REFERRER with XSS. It wouldn't add to security in that case and also be painful for many admins whose browsers do not send referrers. Just look at the complaints about being unable to admin ModX after enabling the referrer check.

greggles’s picture

An official response to this issue is now posted at http://drupal.org/node/1475530

Some more specific analysis and details are here: http://groups.drupal.org/node/216314

erickc’s picture

Security Drupal's analysis (http://groups.drupal.org/node/216314) is wrong for the following motivations:
1) why do you inserted "Suggested mitigation steps" if you think isn't a real vulnerability?
2) do you know what a POC means? It is ridiculous that the exploit doesn't work because "new_admin.com" is not a valid hostname. IT IS only A POC for demonstration purpose and, normally, to avoid lamer damage in the POC voluntarily the exploit has some mistake.
3)A site cannot be vulnerable to MITM. Is the network that is vulnerable if isn't implemented "Port Security" on network switch or if there aren't IDS/IPS devices to detect and prevent man in the middle.
4) You have some anomalies in "form_token" and "form_build_id" even if you don't want to admit it.
5) A CSRF attack is more silent if you allow to send POST request instead of GET request. I think that this is the meaning.
6) Simple Http_Referrer check would allow to avoid "force logout" CSRF which could aid an hacker to sniff user and password during a MITM

Also Heine's consideration about XSS are wrong. Is ridiculous that Drupal doesn't perform http_referrer check as XSS could allow to bypass it. This argument is like saying "I don't put the doors at home as could be some thieves able to open them"

Heine’s picture

It might be better to continue the discussion at the groups post. I moved my reply to the group.

ivanobinetti’s picture

MITRE CVE Numbering Authority assigned CVE-2007-6752 for "force user/logout" (sections 2.2, 3.2 of my Drupal 7.12 CSRF Advisory).

Furthermore MITRE CVE Numbering Authority, considers that:

. Sections 2.1 and 3.1 – Poor Session Checking (CSRF to change any Drupal settings) – would be a Drupal’s “Security Improvement”.
. Section 2.3 – Poor Session Checking (POST and GET method) – and section 2.4 - Poor Session Checking (Http Referer) - would be Drupal’s “Potential Security Improvements”.