Pages

Sunday, August 14, 2011

WebGoat - Insecure Client Storage

Stage one:

Check source code first, you will find that:


Using firebug to find the JS file "clientSideValidation.js" including function "
isValidCoupon()" and the coupon information:

var coupons = ["nvojubmq",
As we can see, there is decryption function called "decrypt()", the code of decrypt function.

function decrypt(code){

This is old Caesar Cipher, we can easily find the decryption tool or write one by ourselves. But here, we use this decrypt function.

The working process:
1, client input coupon code
2, client side validation script will check this coupon code immediately (decrypt the stored coupon code and compare with client input)
3, If the the code is matched then client input will be accepted

Attacking process:
Because the coupon code has been stored in client side (in the JS file) and the decrypt process run in client side, we just need to find out the coupon code and decrypt it.

type the following code in Firefox's URL Bar or use firebug console:
alert(decrypt("nvojubmq"));        //for example, we use the first coupon code

Then we got the plain-text of coupon code:
PLATINUM


Stage two:
solution one:
use firebug to check the source code,
you will find that the final price box has the property "readonly=""", just delete this property, we will find that the final price can be changed~

solution two:
using WebSacrab or Burp Proxy to intercept and tamper the request you will find the final price change it to "0.00".

No comments:

Post a Comment