Formshield Captcha - Older Version vulnerable to replay attacks
- To: bugtraq@xxxxxxxxxxxxxxxxx
- Subject: Formshield Captcha - Older Version vulnerable to replay attacks
- From: arvind doraiswamy <arvind.doraiswamy@xxxxxxxxx>
- Date: Fri, 24 Apr 2009 15:56:33 +0530
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=rATDjUadq1TZ422mNL+n9zRWcCERVk/tOPRpU1IAKLs=; b=AZoVArdaH/W4HuXNXniufT9jOGqk21aeLW8+KGzrcL085P5tKnbaRRUvWF+cE75Tef nOWCQpoAOVEHleQ3vfjpZ8EuP9NvzW7GB1+bcpW2dAeegjg96tMDWsxspmtKUuZBM3ff ueZ88cp9TgEqk26biT6YcT+PJH+rCGofOlBfw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=odf55wu+a19N98QXhgekML5J6Q/VyMevmbLtwk92ICnsErS710H4JWs4UATo4Noc8B oZYZlyrrIuFDCqnSzYK2KguaLiI6LE5/Hk/nS0ThChJ/oKorNF5Y6hXdFvswjhTAAxzG r6EmO7IAFRNtQuK0zcUE7R6Nbow8htIQ7M1mQ=
- List-help: <mailto:bugtraq-help@securityfocus.com>
- List-id: <bugtraq.list-id.securityfocus.com>
- List-post: <mailto:bugtraq@securityfocus.com>
- List-subscribe: <mailto:bugtraq-subscribe@securityfocus.com>
- List-unsubscribe: <mailto:bugtraq-unsubscribe@securityfocus.com>
- Mailing-list: contact bugtraq-help@xxxxxxxxxxxxxxxxx; run by ezmlm
Replay attack on CAPTCHA Libraries
Summary
A CAPTCHA implementation that we tested were found to be vulnerable to
replay attacks. The attack is explained in detail for Formshield – A
popular DOT NET CAPTCHA implementation.
NOTE: We discovered this during a Black Box engagement with one of our
clients. The version which is vulnerable is an older version of
Formshield ; the exact version is not clear. The developer claims that
the problem has been fixed in the newest version of Formshield. Here
is the explanation of the Formshield attack in detail:
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
The Formshield CAPTCHA library that is used to prevent automated bots
from functioning is vulnerable to a replay attack. It is possible to
fix the CAPTCHA value to a specific value and send that value to the
server as part of every request and gain access to protected
resources.
The Formshield CAPTCHA uses a dynamic key stored in the __VIEWSTATE of
the request and sends encrypted text to the server for obtaining and
displaying new image text in the CAPTCHA on the page every time. There
are 2 problems with this approach:
The encrypted text for a specific image always remains the same
The key used to encrypt the request sent to the server does not expire
Objective of the Attacks
We intend to demonstrate that it is possible to preset the image text
in a displayed CAPTCHA for every request thereafter. This image text
can thereafter be used in every subsequent valid request to the
application.
Access to resources protected by the CAPTCHA can be obtained in the
process. An adversary could create a program which will automate
numerous form submissions and replay numerous requests all with the
known preset CAPTCHA thus defeating the basic purpose of the CAPTCHA
itself.
Background
A request for the initial page on which the Formshield Captcha is
embedded is made. After all the other form fields on the page are
rendered a separate request is made to the server to obtain the text
for the Captcha image. This request contains 2 parameters:
__formshield and properties.
The value of the __formshield parameter was always found to be
Formshield1. The value of the properties parameter changed each time
new text was populated in the CAPTCHA image. Changing content of this
parameter results in no new text being generated at all. The encrypted
properties value though is obtained by a dynamic key in the
__VIEWSTATE variable. If the contents of the __VIEWSTATE variable can
be obtained then we have a plaintext cipher text match which can be
replayed every time for every new request.
Details of the Attack
To carry out this attack we need to intercept and modify HTTP(S)
traffic going to the web server.
When the request for the CAPTCHA text is made the encrypted properties
value is replaced with the known Ciphertext value instead. This
results in the known plain text Captcha being set on the screen. The
form is filled up and submitted along with the known plaintext
CAPTCHA. Here is an example of the encrypted properties value that is
sent and the image text that is displayed on screen.
ENCRYPTED PROPERTIES VALUE:
vQzTYzbknujZ52Q9KC6bf8k0DKljxksYExQwIiMYjF2rRfexAtdXbfDJp2ftmWE%2fNSqypLhRbhwRTcKowQ592KNf%2f4vXj%2fWJ4iW2vR%2fkd3FYwGZR4uwRW
PAogFTvHZP8JoHX83PKoGnUv3pBoW23Tl2%2b9VeK63FeYtSaUbh7Ezebstd6VVmwEcEi%2bz8Gax5KVsTulQdVwVjXNtqEG9HbAQfAZUETWrzb%2fqc60O8r3j3M2BnRh%2fRJrgFAydv7GWp1vYpLAeUcrc%2f3FeuybntAalXPgxijb%2fMhNtA1TLOsheM8oZwpDq6fdA%3d%3d
CORRESPONDING IMAGE TEXT:
91KG1a
This request is once again intercepted and the __VIEWSTATE variable is
replaced with the corresponding known __VIEWSTATE which contained the
dynamic key.
This modified request is then sent to the server which validates the
CAPTCHA and offers access to protected resources. Since the
imagetext-cipher text-__VIEWSTATE never expires we can submit the same
request even after many days with the same values and it still
succeeds.
Solution:
The problem can be mitigated by
Managing the CAPTCHA value at the application server instead of the
client side __VIEWSTATE variable by tying it to the Session ID.
A 10 or 15 minute timeout if implemented improves the security as well.
The image cache on the server side must also be expired as soon as it
is rendered to the browser.
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
While the advisory mentioned here targets only a specific CAPTCHA this
could well be a problem with any CAPTCHA implementation which does not
verify the CAPTCHA code at the server side. All CAPTCHA developers can
read this advisory and check their implementations to see whether this
applies to them.
Here are the URL’s for Formshield:
Formshield – http://dotnetfreak.co.uk
http://www.codeproject.com/KB/custom-controls/CaptchaControl.aspx
Arvind Doraiswamy
Paladion Networks - http://www.paladion.net