(opening a ticket per saxofan's direction)

i have captcha (both the default math and reCaptcha) failing every time, but only on a form built with a custom module.
drupal v6.20
captcha 6.x-2.3

this just started happening since the upgrade to 6.20
did something change with 6.20's forms API?

CommentFileSizeAuthor
#6 captcha_webform.png72.67 KBbès
#6 captcha_userlogin.png44.73 KBbès

Comments

soxofaan’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

Please provide more info.
Something special about the custom form/module? What do you mean with "failing": error messages, always blocking CAPTCHA, nothing happens, ...?

chadd’s picture

by failing i mean that captcha always fails validation. no other error messages display.
"The answer you entered for the CAPTCHA was not correct."
this occurs with both the default math captcha and with the recaptcha enabled.

there is no ajax or anything on these custom forms, just a simple form that sends an email.

chadd’s picture

Status: Postponed (maintainer needs more info) » Active
chadd’s picture

and from the log:

_contact post blocked by CAPTCHA module: challenge "Math" (by module "captcha"), user answered "", but the solution was "undefined".

soxofaan’s picture

Status: Active » Postponed (maintainer needs more info)

If you're sure there is no AJAX involved (the symptoms reported in #4 typically indicate AJAX issues),
there is probably something wrong in the form handling of your custom module. Can you post this custom module here?

bès’s picture

StatusFileSize
new44.73 KB
new72.67 KB

Same problem here, one of my client try placing a captcha on the webform "edit component" form.

And i see that in this particular case the $form_submit is not as usual.

Here is a screenshot of the $form_submit in the webform case :
http://drupal.org/files/captcha_webform.png

And one in a standard form (user_login)
http://drupal.org/files/captcha_userlogin.png

You can see that in the webform case the "captcha_response" is nested in multiple array since the captcha.module wait it in :
// Get CAPTCHA response.
$captcha_response = $form_state['values']['captcha_response'];

I'll continue my research to find why this nest stuff happen.

AlexisWilke’s picture

I got a user who ran in a similar problem with my Hidden CAPTCHA here:

#1260552: Doesn't seem to work for me

Thank you.
Alexis Wilke

ChristianP’s picture

Any success with this yet? My problem is in #7's response. I get this error "CAPTCHA session reuse attack detected.
The answer you entered for the CAPTCHA was not correct."

I have made a custom form using Rules to send it.

Edit: Okay, seems like I fixed it using this patch: http://drupal.org/files/issues/captchaSessionReuseFix2.patch

AlexisWilke’s picture

Christian P.,

Note that the patch completely remove the update:

-        // Invalidate CAPTCHA token to avoid reuse.
-        db_query("UPDATE {captcha_sessions} SET token=NULL WHERE csid=%d", $posted_captcha_sid);
+        // Invalidate CAPTCHA token to avoid reuse. Don't do this when form is not submitted.
+        if ($form_state['submitted']) {
+          // Folowing line is commented out to ensure the persistence functionality test is passed,
+          //db_query("UPDATE {captcha_sessions} SET token=NULL WHERE csid=%d", $posted_captcha_sid);
+        }

The last db_query() is commented out... it probably shouldn't be.

Thank you.
Alexis

ChristianP’s picture

What happens if that one is commented out? (Not really good with programming). Does it mean that the captcha will never be different from each other and/or is it easier to hack? I use the module Hidden Captcha btw so any Image with a code in it is not really a concern for me. :)

AlexisWilke’s picture

Well! The Hidden CAPTCHA is the best... 8-)

Assuming that a spammer finds out, he has to crack one CAPTCHA and he can reuse the same answer over and over again. Although it is not likely that a spammer would bother, if many people start using code like that it could end up being a great thing for them.

Thank you.
Alexis Wilke

elachlan’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (outdated)