Your browser’s address bar (URL bar) can be used to inject JavaScript code directly into the webpage you are visiting without reloading the page. The following codes are useful to do cookie editing but remember, this demonstration is for education purpose, you should not attempt to perform such test on data you do not personally own and control:

First, visit the targeted webpage and inject the following code to view realted cookie’s fields and the values assigned to them.

javascript:alert(document.cookie);

Second, to edit a certain value use:

javascript:void(document.cookie="Field=myValue");

For example, if the following field exist:

active=no

The value can be changed to yes with the following code:

javascript:void(document.cookie="active=yes");

If the field’s name does not exist, it will be created.
To have more control over cookies, refer to a proper tutorial and inject the codes in a similar way.

In addition, there are cookies editors available online such as the following PlugIn for Mozilla FireFox:

Add N Edit Cookies
Homepage: http://addneditcookies.mozdev.org.
Download latest release from: https://addons.mozilla.org/en-US/firefox/addon/573.

5 Responses to “Javascript Injection (Cookie Editing)”

Leave a Reply

*

Haider’s WebSpace
Welcome to my technical blog. This is where I write, archive and share computer related articles. Subjects vary from posting technical solutions to researching particular topics. Feel free to comment and talk IT!
Sponsored Links
My Tweets