in

ASP.NET Weblogs

This Blog

Syndication

Jason Salas' WebLog

On-air and online: making people laugh, making people think, pissing people off

Antacid, anyone? The possibility of Ajax scripting attacks

Despite my profession, I've never attested to know much about computers, a fact I'll now undoubtedly prove.  I'm wondering if because of the apparently inherent nature of Ajax programming to be a performance concern in executing remote server-side scripts on an per-client-side event basis, potentially firing in rapid succession (which in cases of data access wired up to keypress events can reasonably be a fairly large concern), does this open a dangerous window in the case of form-based data input to injection attacks?

If people can immediately see or easily extract your client-side code (either through embedded code or through <script> tags), they figure out what remote script you're calling through XMLHTTP, and write a malicious program to repeatedly fill out this form with harmful data, right?  Or just hammer the server until it's overloaded with request traffic, to the point when its shuts down, unable to take the weight?  Could this be a potentially catastrophic danger to web apps, a hybrid of a SQL injection attack, malicious cross-site scripting and blog spamming

After discussing the above argument offline with some friends pretty into Ajax at the moment - Wally, Michael, Craig and Glav - the general consensus appeared to be that the de facto Ajax programming model is naturally flawed at the current time, and that HTTP can still be threatened by way of a denial of service attack at any time, Ajax or not.  The solution would be proper implementation of best practices development, considering service-oriented architecture to ensure optimal security and proper performance.

Wally says - "It is highly likely that if you go back to the server too much, even a relatively small application will overload its server.  IIS and ASP.NET keeps a threadpool of 25 threads per cpu available on the server to process.  This value is modifiable.  I've run with a threadpool of 50 and 75 threads per cpu and it greatly improved the performance of a server farm running a single application where the application made a number of small/highly optimized operations."

Michael says - 'Malicious/selfish users might tweak the client-side a bit to gain an advantage. For example, you could easily drop the period between refreshes. I wrote about this risk at http://ajaxpatterns.org/Submission_Throttling under 'How to protect against "impatient" clients?'"

Craig says - "All the old rules of best practices and good application architecture will apply to AJAX. Validate your input and put safeguards on your services. AJAX is still a HTTP request so you have context information at your disposal. You could look at IP addresses and other such information to safeguard against denial of service attacks, you could create a unique session ID or ticket that would only come from a trusted source and evaluate this value BEFORE any processing."

Glav says - "I think more abuse will come from overuse or bad practices when using Ajax.  Because of the 'invisible' nature of the postback, the effects of excessive and/or long running postbacks are less evident.  I think it can be open to malicious attack too, but only in the same way that standard web apps are today. If its critical stuff, the standard defensive measures should apply, much like you would design into your services in an SOA application."

I guess the larger concern would be that for the moment, developers code Ajax-based applications *very* defensively.  I'm finding that the more I learn about Ajax in its current state, the more I worry.

Published Aug 20 2005, 08:37 AM by guam-aspdev
Filed under: , ,

Comments

 

mike said:

Perhaps I'm not seeing it, but I still don't quite see based on what you've got here where AJAX opens extra vulnerability. As Craig says, it's still HTTP, and whether information hits the server from a user clicking a Submit button or an AJAX asynch request, the server has to be coded equally defensively, no?

The vulnerability issue I recently heard about that seems like a concern is the use of immediate-postback scenarios and the potential there for security breaches. Example: on an order form, you enter your name, then address, then city, etc. An AJAX-ish app could be sending back each datum as you finish it, withOUT waiting for you to submit. You might still cancel ("hey, this web site look suspicious!"), but too late. Some developers might do this with credit-card numbers for "insta-validation," which might seem like a feature to users (less waiting), but opens the door to bad practices and accustoming users to this scenario.
August 21, 2005 5:20 PM
 

Jason Salas said:

Hey Mike,

Yeah, I guess you're right...any script theoretically would be susceptible to attack. It seems like the safeguards against bad practice development and poor performance dangers are still a concern.
August 21, 2005 7:25 PM

Leave a Comment

(required)  
(optional)
(required)  
Add