`
leonzhx
  • 浏览: 766758 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Zz Cross-Site Request Forgery Guide: Learn All About CSRF Attacks and CSRF Prote

阅读更多

Cross-Site Request Forgery Guide: Learn All About CSRF Attacks and CSRF Protection

Cross-Site Request Forgery Attacks

Cross-Site Request Forgery (CSRF) is an attack outlined in the OWASP Top 10 whereby a malicious website will send a request to a web application that a user is already authenticated against from a different website. This way an attacker can access functionality in a target web application via the victim's already authenticated browser. Targets include web applications like social media, in browser email clients, online banking, and web interfaces for network devices.

Key Concepts of Cross-Site Request Forgery

  • Malicious requests are sent from a site that a user visits to another site that the attacker believes the victim is validated against.
  • The malicious requests are routed to the target site via the victim’s browser, which is authenticated against the target site.
  • The vulnerability lies in the affected web application, not the victim’s browser or the site hosting the CSRF.

 

Executing a CSRF Attack

In a Cross Site Request Forgery attack, the attacker is exploiting how the target web application manages authentication. For CSRF to be exploited the victim must be authenticated against (logged in) to the target site. For instance let’s say examplebank.com has online banking that is vulnerable to CSRF. If I visit a page containing a CSRF attack on examplebank.com but am not currently logged in, nothing happens. If I am logged in however, the requests in the attack will be executed as if they were actions that I had intended to do.

Let’s look at how the attack described above would work in a bit more detail. First let’s assume that I’m logged in to my account on examplebank.com which allows for standard online banking features, including transferring funds to another account.

Now let’s say I happen to visit somemalicioussite.com. It just so happens that this site is trying to attack people who bank with examplebank.com and have setup a CSRF attack on their site. The attack will transfer $1500.00 to their account, which is account number 123456789. Somewhere on somemalicioussite.com attackers have added this line of code:

<iframe src="http://examplebank.com/app/transferFunds?amount=1500&destinationAccount=123456789" >

Upon loading that iframe, my browser will send that request to examplebank.com which my browser has already logged in as me. The request will be processed and send $1500.00 to account 123456789.

 

Another Example of Cross-Site Request Forgery

I just bought a new home wireless router. Like most wifi routers it’s configured through a web interface. The router was shipped to me with an internal IP address of 192.168.1.1. I’m having trouble configuring the router though, and fortunately the folks over at somemalicioussite.com have published a guide that shows me exactly what buttons to click in the router interface to get everything set up securely. The attackers have also set up a proxy server at 123.45.67.89 that will log all traffic that goes through it and look for things like passwords and session tokens.

As I clicked through the configuration guide I missed the 1x1 pixel image that failed to load:

<img src=”http://192.168.1.1/admin/config/outsideInterface?nexthop=123.45.67.89” alt=”pwned” height=”1” width=”1”/>

The attackers knew that when I was reading their tutorial I would be logged in to the router interface. So they had the CSRF attack setup in the tutorial. With that request my router would be reconfigured so that my traffic will be routed to their proxy server where they can do all manner of bad things with it.

Preventing Cross-Site Request Forgery (CSRF) Vulnerabilities

The most common method to prevent Cross-Site Request Forgery (CSRF) attacks is to append unpredictable challenge tokens to each request and associate them with the user’s session. Such tokens should at a minimum be unique per user session, but can also be unique per request. By including a challenge token with each request, the developer can ensure that the request is valid and not coming from another source other than the user.

Finding and Remediating Cross-Site Request Forgery (CSRF) Vulnerabilities

 

The easiest way to check whether an application is vulnerable is to see if each link and form contains an unpredictable token for each user. Without such an unpredictable token, attackers can forge malicious requests. Focus on the links and forms that invoke state-changing functions, since those are the most important CSRF targets.   

分享到:
评论

相关推荐

    CSRF(英语:Cross-site request forgery)浅析.md

    CSRF(英语:Cross-site request forgery)浅析.md

    Robust Defenses for Cross-Site Request Forgery

    Cross-Site Request Forgery (CSRF) is a widely exploited web site vulnerability. In this paper, we present a new vari- ation on CSRF attacks, login CSRF, in which the attacker forges a cross-site ...

    Exploit-DMA-Radius-Manager-4.4.0---Cross-Site-Request-Forgery-CSRF-:DMA Radius Manager 4.4.0-跨站请求伪造(CSRF)

    利用DMA半径管理器-4.4.0 ---跨站点请求伪造CSRF- DMA Radius Manager 4.4.0-跨站请求伪造(CSRF)

    ring-anti-forgery:环中间件以防止CSRF攻击

    Ring-Anti-forgery已移至: : Ring-Anti-Forgery已移至Ring GitHub组织。 该存储库将不再更新,因此请更新您的书签和GitHub监视。

    CSRF防御.docx

    CSRF(Cross-site request forgery),中文名称:跨站请求伪造,也被称为:one click attacksession riding,缩写为:CSRFXSRF。 二.CSRF可以做什么? 你这可以这么理解CSRF攻击:攻击者盗用了你的身份,以你的...

    开源项目-gorilla-csrf.zip

    开源项目-gorilla-csrf.zip,gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services

    iron-clad.java.building.secure.web.applications

    Defend against cross-site scripting, cross-site request forgery, and clickjacking Protect sensitive data while it is stored or in transit Prevent SQL injection and other injection attacks Ensure safe ...

    Web应用安全:CSRF简介.pptx

    CSRF,全称Cross-site request forgery,中文名为:跨站请求伪造,也被称为 one-click attack 或者 session riding,通常缩写为 CSRF 或者 XSRF CSRF简介 2、攻击原理 CSRF攻击利用网站对于用户网页浏览器的信任,...

    在django中使用post方法时,需要增加csrftoken的例子

    从百度查到在django中,使用post方法时,需要先生成随机码,以防止CSRF(Cross-site request forgery)跨站请求伪造,并稍加修改: 注:这是一个js文件,需要引入到html模板中:[removed][removed] 这样做比使用{% ...

    Mastering.Modern.Web.Penetration.Testing

    Chapter 4: Cross-Site Request Forgery Chapter 5: Exploiting SQL Injection Chapter 6: File Upload Vulnerabilities Chapter 7: Metasploit and Web Chapter 8: XML Attacks Chapter 9: Emerging Attack Vectors...

    跨站攻击(XSS+CSRF).docx

    跨站请求伪造(英语:Cross-site request forgery),也被称为 one-click attack 或者 session riding,通常缩写为 CSRF 或者 XSRF, 是一种挟制用户在当前已登录的Web应用程序上执行非本意的操作的攻击方法。...

    SSRF(Server Side Request Forgery,SSRF)漏洞.pdf

    讲述服务端请求伪造(Server Side Request Forgery,SSRF)攻防

    qingmvc#qingmvc#CSRF-跨站请求伪造1

    Cross-site request forgery 跨站请求伪造常见的跨站请求伪造:微博关注操作:get,访问一条链接就关注成功 【除非是某种不受限的api】

    web防火墙WAF功能测试方案

    国内外的信息安全厂商当前能防范的针对Web服务器的攻击类型主要有SQL注入攻击、XSS攻击、HTTP Flood攻击、爬虫、CGI扫描、漏洞扫描、盗链防护、CSRF(Cross-Site Request Forgery)攻击防护等。但事实上,能防范和能...

    保护ASP.NET应用免受CSRF攻击

     CSRF(Cross-site request forgery),中文名称:跨站请求伪造,也被称为:one click attack/session riding,缩写为:CSRF/XSRF。CSRF(Cross Site Request Forgery, 跨站域请求伪造)是一种网络的攻击方式,它...

    mp4 creator- win32

    About this release: MP4Creator is the command line mp4 multiplexer tool from the mpeg4ip project. Since the mpeg4ip projects has stopped in Sep-2007, several community patches have been created for ...

    008-Web安全基础4 - 请求伪造漏洞.pptx

    CSRF 的全称是Cross-site request forgery,即跨站请求伪造,我们可以简单的理解这种漏洞为,攻击者利用被攻击者的身份发起了某些被攻击者原本不知情的网络请求。包括以被攻击者的身 份发布一条微博,以被攻击者的...

    Web应用安全:CSRF防范对策.pptx

    我们再来重温下CSRF的定义:CSRF英文全称是:Cross Site Request Forgery,中文是:跨站点请求伪造。CSRF攻击者在用户已经登录目标网站之后,诱使用户访问一个攻击页面,利用目标网站对用户的信任,以用户身份在攻击...

    algo-copy-move-image-forgery.rar_copy move matlab_copy_move_forg

    DWT-PCA (EVD) Based Copy-move Image Forgery Detection

    JavaScript Security(PACKT,2014)

    You will then focus on one of the most common JavaScript security attacks, cross-site scripting, and how to prevent cross-site scripting and cross-site forgery. Last but not least, the book covers ...

Global site tag (gtag.js) - Google Analytics