Join us at IRC!
Your life is ending one minute at a time. If you were to die tomorrow, what would you do today?
Thursday, May 17, 2012
Navigation
Members Online
Total Online: 32
Web Spiders: 16
Guests Online: 27
Members Online: 5

Registered Members: 70039
Newest Member: p0isoN
Latest Articles

Hacking Javascripts



FLV Blaster - Download Music and Videos Faster

website security An all-round way on how to hack javascripts.



Allright, for all you peeps out there who are having trouble hacking your way through a simple javascblockedript, I wrote this simple but effective article.


Let's start with the following question: What happens when we enter our password into a javascblockedript? OR What actions performs the scblockedript to verify us?

The answer is simple: The scblockedript compares our input with a given value or variable.


Let us look a 3 different examples:

1) Comparing with a given value

function checkpass {
if (enteredpassword=="dapass") {
alert("You got it!")
}
else {
alert("Invalid UserID")
}
}

I suppose nobody has problems with this. The password you need to enter is dapass.


2) Comparing with a variable

function checkpass {
var pass = "dapass"

if (enteredpassword==pass) {
alert("You got it!")
}
else {
alert("Invalid UserID")
}
}

I think this is also a very simple scblockedript. You clearly see what value/variable the scblockedript is comparing your input to and what its value is.


3) Comparing with a variable but...

function checkpass {
var pass = "da"
var pass2 = "pass"
var pass3 = pass + pass2 //this line combines "da" and "pass" into "dapass"

if (enteredpassword==pass3) {
alert("You got it!")
}
else {
alert("Invalid UserID")
}
}

John Doe might think: "w00t this is too easy!" and yes this is an easy scblockedript but it's the concept that counts. What if you all sorts of calculations and functions that are editing the final variable. You could reconstruct everything but that will take a while, no? John Doe will possibly think: "I will just enter javascblockedript:alert(pass3) in my browser to pop up a window with the pass. OK... huh? Why is the box empty?"

A big hint to everyone: always try the scblockedript with some bibberish else some variables/actions won't yet be initialized/used. So no wonder JD gets an empty alertbox: the operation pass + pass2 in the pass3 variable was never excuted thus it doesn't contain any value!

After excuting the scblockedript with random values JD finds the pass with javascblockedript:alert(pass3) and he lives happely ever after...


NOTE 1: scblockedripts could not be in the page itself but in an external file. You can use the JSView extension for Firefox to easily find external javascblockedripts/css-files.

NOTE 2: the method described in 3 requires some logical thinking (*) and you will need to view the scblockedript itself to get the variable (duh!). (*) e.g. if the scblockedript says if (enteredpassword==pass) {...} don't start looking in the variable pass3 or anything ;)


Voila, I hope this article helped you and contained just what you were expecting. If you want to know or you're thinking: "Why isn't this or that discussed here?" Just leave a comment and I'll add it or simply write a v2 of my article ;)

The_Cell

Comments

god on April 16 2006 - 20:55:51
haha great :p u can solve almost all the stegs on this site.. **and he lives happely ever after...** made me laugh :p i was hoping maybe someone could make a new genre of javascblockedript challenges? ones that need another .. concept....
The_Cell on April 16 2006 - 21:06:28
I think you mean javascblockedript instead of stegs :p Thanx fopr comment, I get the hint...I'll do my best ;)
god on April 16 2006 - 21:18:10
yep lol javascblockedripts** :p well i wasnt implying you, just talking in general :)
aFk on September 10 2006 - 03:11:36
what if we get this type of pass check. /// if(encrypt==checkpass&&tell==0){alert('Access Granted') please pm me. more of code is alcode=deconstruct var encrypt=new Array() for(count=2;count<finalcode.length+2;count+=2){ eval("encrypt["+((count/2)-1)+"]='"+((finalcode.charAt(count-2)!='0')?finalcode.charAt(count-2):'')+""+finalcode.charAt(count-1)+"'";) encrypt[((count/2)-1)]=acharset.charAt(Math.round((acharset.length*encrypt[((count/2)-1)])/100)) } encrypt=encrypt.join('') if(counttimes<times){mkasci(encrypt)} else { counttimes=0 if(encrypt==checkpass&&tell==0){alert('Access Granted');location.replace(storeup+encrypt.substring(0,5)+".html";);} else { if(tell==1){document.write("<B>"+storeup+"</B> is encrypted as <B>"+encrypt+"</B>";);} else { if(history.length>0){ alert("Access Denied";); history.go(-1); } else {location.replace("http://polymathic.tripod.com/hs/reject.html";)}
aFk on September 10 2006 - 03:25:42
sorry that looked sloppy. just visit here and view the source, Thanks great article by the way.. Please Pm me regarding this here's source link http://www.bailacademy.org/restrictedarea.html
The_Cell on October 04 2006 - 20:42:01
I suggest echoing all the variables and then try to roughly recontruct how the scrip edits all of its strings.
sleazoid on February 18 2007 - 07:34:01
nice articleB)
Post Comment

Sorry.

You must have completed the challenge Basic 1 and have 100 points or more, to be able to post.
Ratings
Rating is available to members only.

Please login or register to vote.

Awesome! 25% [3 Votes]
Very Good 58% [7 Votes]
Good 17% [2 Votes]
Average 0% [No Votes]
Poor 0% [No Votes]
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.