• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • About Darknet
  • Hacking Tools
  • Popular Posts
  • Darknet Archives
  • Contact Darknet
    • Advertise
    • Submit a Tool
darknet.org.uk logo

Darknet - Hacking Tools, Hacker News & Cyber Security

Darknet.org.uk is a cybersecurity site online since 2000. It covers security tools, technical research and hacking news, alongside an archive of earlier posts.

You are here: Home / Countermeasures / AJAX: Is your application secure enough?

AJAX: Is your application secure enough?

Published April 5, 2006 | Updated September 9, 2015 |

Views: 123,533

Introduction

We see it all around us, recently. Web applications get niftier by the day by utilising the various new techniques recently introduced in a few web-browsers, like I.E. and Firefox. One of those new techniques involves using Javascript. More specifically, the XmlHttpRequest-class, or object.

Advertisement

Webmail applications use it to quickly update the list of messages in your Inbox, while other applications use the technology to suggest various search-queries in real-time. All this without reloading the main, sometimes image- and banner- ridden, page. (That said, it will most probably be used by some of those ads as well.)

Before we go into possible weaknesses and things to keep in mind when implementing an AJAX enabled application, first a brief description of how this technology works.

The Basics

Asynchronous Javascript and XML, dubbed AJAX is basically doing this. Let me illustrate with an example, an email application. You are looking at your Inbox and want to delete a message. Normally, in plain HTML applications, the POST or GET request would perform the action, and re-locate to the Inbox, effectively reloading it.

With the XmlHttpRequest-object, however, this request can be done while the main page is still being shown.

In the background a call is made which performs the actual action on the server, and optionally responds with new data. (Note that this request can only be made to the web-site that the script is hosted on: it would leave massive DoS possibilities if I can create an HTML page that, using Javascript, can request thousands of concurrent web-pages from a web-site. You can guess what happens if a lot of people would visit that page.)

Advertisement

The Question

Some web-enabled applications, such as for email, do have pretty destructive functionality that could possibly be abused. The question is — will the average AJAX-enabled web-application be able to tell the difference between a real and a faked XmlHttpRequest?

Do you know if your recently developed AJAX-enabled or enhanced application is able to do this? And if so — does it do this adequately?

Do you even check referrers or some trivial token such as the user-agent? Chances are you do not even know. Chances are that other people, by now, do.

To be sure that the system you have implemented — or one you are interested in using — is properly secured, thus trustworthy, one has to ‘sniff around’.

Incidentally, the first time I discovered such a thing was in a lame preview function for a lame ringtone-site. Basically, the XmlHttpRequest URI’s ‘len’ parameter specified the length of the preview to generate and it seemed like it was loading the original file. Entering this URI in a browser (well, actually, ‘curl‘), specifying a very large value, one could easily grab all the files.

This is a fatal mistake: implement an AJAX interface accepting GET requests. GET requests are the easiest to fake. More on this later.

The question is — can we perform an action while somebody is logged in somewhere else. It is basically XSS/CSS (Cross Site Scripting) but then again, it isn’t.

My Prediction

Some popular applications I checked are hardened in such a way that they use some form of random sequence numbering: the server tells it, encoded, what the application should use as a sequence number when sending the next command. This is mostly obscured by Javascript and a pain in the ass to dissect — but not impossible.

And as you may have already noted: if there is improper authentication on the location called by the XmlHttpRequest-object, this would leave a possibility for malicious purpose. This is exactly where we can expect weaknesses and holes to arise.There should be proper authentication in place. At all times.

As all these systems are built by men, chances are this isn’t done properly.

HTTP traffic analysis
Analysing HTTP traffic analysis with tools like ethereal (yeh I like GUIs so sue me) surely comes in handy to figure out whether applications you use are actually safe from exploitation. This application allows one to easily filter and follow TCP streams so one can properly analyse what is happening there.

If you want to investigate your own application, the use of a sniffer isn’t even necessary but I would suggest you let a colleague that hasn’t implemented it, play around with your app and a sniffer in an attempt to ‘break’ through it.

Cookies
Cookies are our friend when it comes to exploiting, I mean researching any vulnerabilities in AJAX implementations.

If the XmlHttp-interface is merely protected by cookies, exploiting this is all the easier: the moment you get the browser to make a request to that website, your browser is happily sending any cookies along with it.

Back to my earlier remark about a GET-requests being a pretty lame implementation: from a developers point of view, I can imagine one temporary accepts GET requests to be able to easily debug stuff without having to constantly enter irritating HTTP data using telnet. But when you are done with it you really should disable it immediately!

I could shove a GET request hidden in an image link. Sure the browser doesn’t understand the returned data which might not even be an image. But my browser does happily send any authenticating cookies, and the web-application on the other end will have performed some operation.

Using GET is a major mistake-a-to-make. POST is a lot better, as it harder to fake. The XmlHttpRequest can easily do a POST. But I cannot get a script, for instance I could have embedded one in this article, to do a POST request to another website because of the earlier noted restriction: you can only request to the same web-site the web-application is on.

One can modify its own browser, to make request to other websites, but it would be hard to get the browser on somebody elses machine to do this.

Or would it?

If proper authentication, or rather credential verification, still sucks, I can still set up a web-site that does the exact POST method that the AJAX interface expects. That will be accepted and the operation will be performed. Incidentally I have found a popular site that, so far, does not seem to have proper checks in place. More on that one in another article.

Merely using cookies is again a bad idea.

One should also check the User-Agent and possibly a Referrer (the XmlHttpRequest nicely allows one to send any additional headers so you could just put some other token in the Referrer-field). Sure these can still be faked — but it may fend off some investigating skiddiots.

Sequence Numbering, kinda…

A possible way of securing one’s application is using some form of ‘sequence-numbering’-like scheme.

Roughly, this boils down to this.

One should let the page, or some include javascript, generated on the server side, include some token that the performs some operation on which gives a result which is used in any consecutive request to the webserver. The webserver should not allow any request with another ‘sequence number’, so to speak.

The servers’ ‘challenge-string‘ should be as random as possible in order to make it non-predictable: if one could guess what the next sequence number will be, it is again wide open for abuse.

There are properly other ways of hardening interfaces like this, but they all basically come down to getting some fixed information from the webserver as far away from the end-users reach as possible.

You can implement this as complex as you want but can be implemented very basic as well.

For instance when I, as a logged-in user of a web-enabled email-application get assigned a Session-ID and stuff, the page that my browser receives includes a variable iSeq which contains an non-predictable number. When I click “Delete This Message”, this number is transmitted with the rest of the parameters. The server can then respond with new data and, hidden in the cookies or other HTTP Requests field, pass the next sequence number that the web-server will accept as a valid request, only.

As far as I know, these seems the only way of securing it. This can still be abused if spyware sniffs HTTP communications — which they recently started doing.

Javascript Insertion

On a side note I wanted to throw in a remark on Javascript Insertion. This is an old security violation and not really restricted to AJAX, and not an attack on AJAX. Rather, it is an attack utilising the XmlHttpRequest object for malice.

If I would be able to insert Javascript in the web-application I am currently looking at in my other browser window, I would be able to easily delete any post the site allows me to delete. Now that doesn’t seem all that destructive as it only affects that user? Wrong, any user visiting will have its own posts deleted. Ouch.

Javascript insertion has been a nasty one for years and it still is when people throw their home-brew stuff into production.

On a weak implemented forum or web-journal, one could even post new messages — including the Javascript so that any visitor — with the proper permission — would re-post the message keeping the flood of spam coming.

As these technologies keep developing — and lazy website developers do not update their websites to keep up with these changes.

The recent ‘AJAX enhancements’ that some sites got recently might have been improperly implemented. This year might be a good time to check all those old web-applications for any possible Javascript insertion tricks.

If you didn’t mind the cookies getting caught — the sudden deletion of random items and/or public embarrassment might be something to entice you to verify your the code.

Digg This Article

Advertisement

Related Posts:

  • Dark Web vs Deep Web - What They Are and How to…
  • Dark Web Search Engines for Security Research:…
  • Maigret - OSINT Username Search Tool
  • Privacy Implications of Web 3.0 and Darknets
  • Vulhub - Build Vulnerable Docker Labs for Security Research
  • Apktool - Decompile, Edit and Rebuild Android APKs
Share
Tweet
Share
Buffer
WhatsApp
Email

Primary Sidebar

Search Darknet

Advertisement
  • Email
  • Facebook
  • LinkedIn
  • RSS
  • Twitter

Advertise on Darknet

Latest Posts

jadx: Decompile Android APKs to readable Java, beside a glass lens turning scattered grey code fragments into ordered orange lines.

jadx – Decompile Android APKs to Readable Java

Views: 87

jadx turns an Android app's compiled code back into Java you can read. Point it at an APK and you … ...Read More about jadx – Decompile Android APKs to Readable Java

SIM Swapping: How a bribe bypassed AT&T's security, beside tweezers lifting a SIM card out of a phone's tray.

SIM Swapping – How a Bribe Bypassed AT&T’s Security

Views: 235

SIM swapping is a fraud in which criminals take over someone's phone number by moving it to a SIM … ...Read More about SIM Swapping – How a Bribe Bypassed AT&T’s Security

Silk Road: Ross Ulbricht put his real Gmail in a job ad, beside an open laptop glowing orange on a library table next to an empty chair.

Silk Road – Ross Ulbricht Put His Real Gmail in a Job Ad

Views: 258

Silk Road was a hidden marketplace on the dark web, reachable only through Tor and paid for in … ...Read More about Silk Road – Ross Ulbricht Put His Real Gmail in a Job Ad

Apktool: Decompile, edit and rebuild Android APKs, beside a curved graphite shell opened to reveal stacked layers and orange resin.

Apktool – Decompile, Edit and Rebuild Android APKs

Views: 357

Apktool turns an Android app back into something you can read and change: the manifest as plain XML, … ...Read More about Apktool – Decompile, Edit and Rebuild Android APKs

Maigret: OSINT username search tool. Graphite chain links joined by one orange link; darknet.org.uk watermark.

Maigret – OSINT Username Search Tool

Views: 914

Give Maigret a username and it finds the sites with an account by that name, reads the profiles it … ...Read More about Maigret – OSINT Username Search Tool

subfinder: Passive subdomain enumeration. An orange cord loops through a dark bead among frayed charcoal ends.

subfinder – Passive Subdomain Enumeration Tool

Views: 863

Point subfinder at a domain and it asks dozens of online sources which hostnames they have seen … ...Read More about subfinder – Passive Subdomain Enumeration Tool

Topics

  • Advertorial (28)
  • Apple (46)
  • Cloud Security (8)
  • Countermeasures (232)
  • Cryptography (86)
  • Dark Web (8)
  • Database Hacking (90)
  • Events/Cons (7)
  • Exploits/Vulnerabilities (433)
  • Forensics (64)
  • GenAI (14)
  • Hacker Culture (10)
  • Hacking News (238)
  • Hacking Tools (719)
  • Hardware Hacking (82)
  • Legal Issues (179)
  • Linux Hacking (74)
  • Malware (241)
  • Networking Hacking Tools (352)
  • Password Cracking Tools (106)
  • Phishing (41)
  • Privacy (218)
  • Secure Coding (119)
  • Security Software (235)
  • Site News (51)
    • Authors (6)
  • Social Engineering (37)
  • Spammers & Scammers (76)
  • Stupid E-mails (6)
  • Telecomms Hacking (7)
  • UNIX Hacking (6)
  • Virology (6)
  • Web Hacking (385)
  • Windows Hacking (171)
  • Wireless Hacking (45)

Security Blogs

  • Dancho Danchev
  • F-Secure Weblog
  • Google Online Security
  • Graham Cluley
  • Internet Storm Center
  • Krebs on Security
  • Schneier on Security
  • TaoSecurity
  • Troy Hunt

Security Links

  • Exploits Database
  • Linux Security
  • Register – Security
  • SANS
  • Sec Lists
  • US CERT
Advertisement

Footer

Most Viewed Posts

  • Brutus Password Cracker Hacker – Download brutus-aet2.zip AET2 (2,496,979)
  • Darknet – Hacking Tools, Hacker News & Cyber Security (2,175,433)
  • Top 15 Security Utilities & Download Hacking Tools (2,099,490)
  • 10 Best Security Live CD Distros (Pen-Test, Forensics & Recovery) (1,201,954)
  • Password List Download Best Word List – Most Common Passwords (936,312)
  • wwwhack 1.9 – wwwhack19.zip Web Hacking Software Free Download (779,028)
  • Hack Tools/Exploits (675,510)
  • Wep0ff – WEP Evil Twin Attack Tool (533,130)

Search

Recent Posts

  • jadx – Decompile Android APKs to Readable Java November 9, 2026
  • SIM Swapping – How a Bribe Bypassed AT&T’s Security November 8, 2026
  • Silk Road – Ross Ulbricht Put His Real Gmail in a Job Ad November 5, 2026
  • Apktool – Decompile, Edit and Rebuild Android APKs November 2, 2026
  • Maigret – OSINT Username Search Tool October 26, 2026
  • subfinder – Passive Subdomain Enumeration Tool October 20, 2026

Tags

apple botnets computer-security darknet Database Hacking ddos dos exploits fuzzing google hacking-networks hacking-websites hacking-windows hacking tool Information-Security information gathering Legal Issues malware microsoft network-security Network Hacking Password Cracking pen-testing penetration-testing Phishing Privacy Python scammers Security Security Software spam spammers sql-injection trojan trojans virus viruses vulnerabilities web-application-security web-security windows windows-security Windows Hacking worms XSS

Copyright © 1999–2026 Darknet All Rights Reserved · Privacy Policy