Home > Ask the Security Experts > Application Security Questions & Answers > Preventing cross-site request forgery attacks
Ask The Security Expert: Questions & Answers
EMAIL THIS

Preventing cross-site request forgery attacks

Michael Cobb, featured expert EXPERT RESPONSE FROM: Michael Cobb, featured expert

Pose a Question
Other Security Categories
Meet all Security Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 28 March 2009
How can website owners be preventing cross-site request forgery attacks, and do you think these defenses should be taken on by browser vendors?

>
Cross-site request forgery (CSRF) is interesting in that it exploits the way a website executes requests from a user. It assumes or "trusts" that the action is what the user wants to do. Cross-site request forgery attacks are the opposite of a cross-site scripting attack, which exploits how users trust the content being displayed by a website. There are some well-documented examples of how powerful a CSRF attack can be. About 18 million eBay users in Korea, for example, lost personal information in 2008 to a CSRF attack, and customers of a bank in Mexico were rerouted to a different website, thanks to a malicious email's image tag.

More specifically, the goal of a CSRF attack is to send unauthorized commands from a user to a website. For example, commands are often linked to a specific URL: http://www.bonds?buy=1000&bond=ABC.

If the attacker can force the browser to send this request while the user is logged into his or her account, the website will carry out the request. Typically an attacker will embed JavaScript code directly into an email or webpage, utilizing a cross-site scripting flaw in order to request a specific "task url," which will then execute without the user's knowledge. The attack is invisible to its victims so an attacker can experiment almost indefinitely to try to craft a successful attack.

Certainly any site that performs actions based on input from authenticated or trusted users is at risk. Because a website can't tell whether a user intended to send a request, these attacks are difficult to defend against unless the site requires every user to authorize every action.

To make CSRF attacks harder to execute, your site should check the Referer header in each request, which reveals the address of the webpage. More importantly, critical requests, such as account login or purchase instructions, must include user-specific secret authentication values like characters from a password that the attacker can't guess. If the attacker can't determine the right values for all of a form's inputs, the attack will fail. Sites should also limit the lifetime of authentication cookies and not solely rely on them when processing form submissions or requests. To prevent forged login requests, sites should use these countermeasures even before the user is logged in. Sites should also be tested for cross-site scripting vulnerabilities as these are often used to inject a CSRF attack into a webpage.

Although browsers are the most common means to execute these attacks, the CSRF vulnerability is not solely limited to them. An attacker can just as easily embed attacks into any document that allows scripting, such as a Word document or Flash file. Given that individuals can do relatively little to protect themselves against these attacks, does the responsibility fall to vendors to fix this problem? There is always a case for browser and application vendors making their products more secure, but security must be balanced against usability. Would you really want to be forced to click "OK" every time you clicked on a link or "Submit" button? I think in this instance, website developers must assess the type of requests their applications are likely to process and implement authentication methods appropriate to the data or instructions in each of them.


BROWSE BY TAG
Application Security,   Application and Platform Security,   Web Security Tools and Best Practices,   Web Browser Security,   Web Application and Web 2.0 Threats,   VIEW ALL TAGS

Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Application Security
Do Facebook URL security concerns justify blocking social networks?
Is there a way to block iPhone widgets that bypass Web filters?
Should enterprises be concerned with Twitter in the workplace?
Are there still Google Desktop security problems?
Can an IP spoofing tool be used to spam SPF servers?
Will an application usage policy best control network bandwidth?
How can URL-shortening services be manipulated?
Is my security program ready for Web application firewall deployment?
How to ensure the security of a shopping cart application
When to use the service features of the Metasploit hacking tool

Web Browser Security
Exploit code targets Internet Explorer zero-day display flaw
InZero Systems launches hardware-based security gateway
Web security firm ranks Firefox, Safari browsers as flaw prone
Microsoft fixes security update that breaks Internet Explorer
Mozilla update repairs Firefox buffer overflow vulnerabilities
Kaspersky system analyzes malicious URLs on Twitter for malware
Silon malware intercepts Internet Explorer sessions, steals credentials
Do Facebook URL security concerns justify blocking social networks?
Phishing attacks to remain a major problem, say security experts
Adrian Perrig: Improve SSL/TLS Security Through Education and Technology
Web Browser Security Research

Web Application and Web 2.0 Threats
New Facebook worm propagates using sexy model
Web security firm ranks Firefox, Safari browsers as flaw prone
Web application vulnerability assessment shows patching progress
Layoffs prompt insider threat fears, cybersecurity survey finds
Botnet masters turn to Google, social networks to avoid detection
Computer worm infections up, scareware antivirus down, Microsoft says
Web-based attacks skyrocket, pirating sites surge, security firms say
Kaspersky system analyzes malicious URLs on Twitter for malware
Pushdo botnet uses Facebook to spread malicious email attachment
Do Facebook URL security concerns justify blocking social networks?

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
browser hijacker  (SearchSecurity.com)
cache cramming  (SearchSecurity.com)
cache poisoning  (SearchSecurity.com)
honey monkey  (SearchSecurity.com)
JavaScript hijacking  (SearchSecurity.com)
NCSA  (SearchSecurity.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Find Security Solutions for Your Business
TechTarget Security Media
Information Security View this month\\'s issue and subscribe today.
Information Security Decisions Apply online for free conference admission.
SearchSecurity.com
HomeNewsMagazineMultimediaWhite PapersLearningAdviceTopicsEventsAbout Us

About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts