Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


javascript injection basics

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
skymaster
Cheater
Reputation: 0

Joined: 20 Aug 2007
Posts: 44
Location: ur mom's bed

PostPosted: Sat Aug 25, 2007 10:27 am    Post subject: javascript injection basics Reply with quote

Javascript Injection


Summary: Javascript injection is a nifty little technique that allows you to alter a sites contents without actually leaving the site. This can be very usefull when say, you need to spoof the server by editing some form options. Examples will be explained throughout.

Contents:
I. Injection Basics
II. Cookie Editing
III. Form Editing


I. Injection Basics

Javascript injections are run from the URL bar of the page you are visiting. To use them, you must first completly empty the URL from the URL bar. That means no http:// or whatever.

Javascript is run from the URL bar by using the javascript: protocol. In this tutorial I will only teach you the bare bones of using this, but if you are a Javascript guru, you can expand on this using plain old javascript.

The two commands covered in this tutorial are the alert(); and void(); commands. These are pretty much all you will need in most situations. For your first javascript, you will make a simple window appear, first go to any website and then type the following into your URL bar:
Code:
javascript:alert('Hello, World');

You should get a little dialog box that says "Hello, World". This will be altered later to have more practical uses.

You can also have more than one command run at the same time:
Code:
javascript:alert('Hello'); alert('World');

This would pop up a box that said 'Hello' and than another that says 'World'.

II. Cookie Editing

First off, check to see if the site you are visiting has set any cookies by using this script:
Code:
javascript:alert(document.cookie);

This will pop up any information stored in the sites cookies. To edit any information, we make use of the void(); command.
Code:
javascript:void(document.cookie="Field = myValue");

This command can either alter existing information or create entirely new values. Replace "Field" with either an existing field found using the alert(document.cookie); command, or insert your very own value. Then replace "myValue" with whatever you want the field to be. For example:
Code:
javascript:void(document.cookie="Authorized=yes");

Would either make the field "authorized" or edit it to say "yes"... now wheter or not this does anything of value depends on the site you are injecting it on.

It is also usefull to tack an alert(document.cookie); at the end of the same line to see what effect your altering had.

III. Form Editing

Sometimes, to edit values sent to a given website through a form, you can simply download that html and edit it slightly to allow you to submit what you want. However, sometimes the website checks to see if you actually submitted it from the website you were supposed to. To get around this, we can just edit the form straight from javascript. Note: The changes are only temporary, so it's no tuse trying to deface a site through javascript injection like this.

Every form on a given webpage (unless named otherwise) is stored in the forms[x] array... where "x" is the number, in order from top to bottom, of all the forms in a page. Note that the forms start at 0, so the first form on the page would actually be 0, and the second would be 1 and so on. Lets take this example:
Code:
<form action="http://www.website.com/submit.php" method="post">
<input type="hidden" name="to" value="[email protected]">

Note:Since this is the first form on the page, it is forms[0]

Say this form was used to email, say vital server information to the admin of the website. You can't just download the script and edit it because the submit.php page looks for a referer. You can check to see what value a certain form element has by using this script:
Code:
javascript:alert(document.forms[0].to.value)

This is similar to the alert(document.cookie); discussed previously. In this case, It would pop up an alert that says "[email protected]"

So here's how to Inject your email into it. You can use pretty much the same technique as the cookies editing shown earlier:
Code:
javascript:void(document.forms[0].to.value="[email protected]")

This would change the email of the form to be "[email protected]". Then you could use the alert(); script shown above to check your work. Or you can couple both of these commands on one line.

That's pretty much all there is to it. PM me, or post any quesitons or comments regarding this tutorial. As always, rep is always appreciated.




edit crud my cpu messed me up srry im too lazy 2 edit and i forgot 2 XD
Back to top
View user's profile Send private message
LolSalad
Grandmaster Cheater
Reputation: 1

Joined: 26 Aug 2007
Posts: 988
Location: Australia

PostPosted: Fri Aug 31, 2007 2:00 am    Post subject: Reply with quote

Nexodyne Forums - Javascript Injection

Make your own... Copying and pasting = PHAILURE. Evil or Very Mad Evil or Very Mad Evil or Very Mad
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites