Methods and apparatus for detecting cross-site request forgery (csrf) attacks include a csrf detector that analyzes http communications for information indicative of a csrf attack. The csrf detector may analyze http responses from a website for csrf code that automatically performs unauthorized access of an online account of a user of a user computer upon receipt and execution of the csrf code in the user computer. The csrf detector may also analyze http requests from a web browser for information indicative of a csrf attack.

Patent
   8893270
Priority
Jan 29 2008
Filed
Jan 29 2008
Issued
Nov 18 2014
Expiry
Jul 07 2033
Extension
1986 days
Assg.orig
Entity
Large
6
1
currently ok
9. A computer having memory and a processor for executing computer-readable program code in the memory, the memory comprising:
a cross-site request forgery (csrf) detector comprising computer-readable program code, wherein the csrf detector detects a csrf attack that automatically performs an unauthorized access of an online account of a user of a user computer when csrf code is received and loaded in the user computer, the csrf detector being configured to:
detect presence of the csrf code in an http (Hypertext Transfer Protocol) response sent by a website to the user computer by determining whether a type of content expected to be received by a web browser running in the user computer is consistent with content that will be provided to the web browser,
receive an http request from the web browser,
analyze the http request for information indicative of the csrf attack, and
perform a security action when the csrf code is found in the http response,
and perform the security action when the http request includes information indicative of the csrf attack.
1. A computer-implemented method of detecting a cross-site request forgery (csrf) attack, the method comprising:
receiving an http (Hypertext Transfer Protocol) response from a website, the http response being responsive to a request for a web page previously submitted from a user computer to the website;
analyzing the http response for presence of csrf code by determining whether a type of content expected to be received by a web browser running in the user computer is consistent with content that will be provided to the web browser, the csrf code comprising computer-readable program code which automatically accesses an online account of a user of the user computer upon receipt and execution of the csrf code in the user computer without authorization from the user;
performing a security action when the csrf code is found in the http response;
receiving an http request from the web browser;
analyzing the http request for information indicative of a csrf attack; and
performing the security action when the http request includes information indicative of the csrf attack.
2. The method of claim 1 further comprising:
forwarding the http response to the web browser running in the user computer when the csrf code is not found in the http response.
3. The method of claim 1 further comprising:
forwarding the http request to a destination computer when the http request does not include information indicative of the csrf attack.
4. The method of claim 1 wherein the security action comprises blocking communication to and from the website.
5. The method of claim 1 wherein the csrf code comprises an HTML image tag that retrieves content that is not an image file.
6. The method of claim 1 wherein the csrf code comprises a script.
7. The method of claim 1 wherein analysis of the http response for presence of the csrf code is performed in the user computer.
8. The method of claim 1 wherein analysis of the http response for presence of the csrf code is performed in another computer separate from the user computer.
10. The computer of claim 9 wherein the computer comprises a gateway computer.
11. The computer of claim 9 wherein the csrf detector is configured to forward the http response to the web browser running in the user computer when the csrf code is not found in the http response.
12. The computer of claim 9 wherein the csrf detector is configured to forward the http request to a destination computer when the http request does not include information indicative of the csrf attack.
13. The computer of claim 9 wherein the security action comprises blocking communication to and from the website.
14. The computer of claim 9 wherein the csrf code comprises an HTML image tag that retrieves content that is not an image file.
15. The computer of claim 9 wherein the computer is a user computer.

1. Field of the Invention

The present invention relates generally to computer security, and more particularly but not exclusively to methods and apparatus for detecting computer attacks.

2. Description of the Background Art

Cross-site request forgery (“CSRF”) is a type of computer attack where unauthorized transmissions are sent from a user computer to access websites that trust the user. The transmissions resulting from a CSRF attack are “unauthorized” in that the user has not authorized or initiated the transmissions and is not even aware that the transmissions were sent out from his computer. The unauthorized transmissions may involve unauthorized access of a user's online account. FIG. 1 shows a flow diagram schematically illustrating an example CSRF attack.

A CSRF attack may begin with a hacker or other malicious individual introducing CSRF code in a legitimate website 170 that the user visits (arrow 161). The CSRF code may comprise computer-readable program code that automatically performs unauthorized access of an online account upon receipt and execution in the victim user computer. A user employing a web browser 173 may request a web page from the website 170 (arrow 162). In response, the website provides the web page (arrow 163), which may include the CSRF code. When the CSRF code is received and executed in the user's computer, the CSRF code sends unauthorized transmissions to access the user's online account in the website 171 (arrow 164). For example, the CSRF code may comprise the following script:

<Img src=http://somebank.com/transferfunds.asp?amnt=10000&acc=someone>

where “somebank.com” is the domain of the website 171. If the user keeps authentication information for the website 171 in a cookie, and if the cookie has not expired, the script will transfer funds out of the user's account without the user's approval when the script is executed in the user's computer.

A popular technique of guarding user computers from websites that contain malicious codes is to consult a web reputation service. The web reputation service maintains a database of malicious websites. The use of a web reputation service, however, is ineffective against CSRF attacks because the website serving the CSRF code is typically a legitimate website. Also, a typical web reputation service cannot provide real-time protection from CSRF attacks because it is difficult to update a reputation database fast enough to include newly compromised websites.

In one embodiment, methods and apparatus for detecting cross-site request forgery (CSRF) attacks include a CSRF detector that analyzes HTTP communications for information indicative of a CSRF attack. The CSRF detector may analyze HTTP responses from a website for CSRF code that automatically performs unauthorized access of an online account of a user of a user computer upon receipt and execution of the CSRF code in the user computer. The CSRF detector may also analyze HTTP requests from a web browser for information indicative of a CSRF attack.

These and other features of the present invention will be readily apparent to persons of ordinary skill in the art upon reading the entirety of this disclosure, which includes the accompanying drawings and claims.

FIG. 1 shows a flow diagram schematically illustrating a CSRF attack.

FIG. 2 shows a schematic diagram of a computer in accordance with an embodiment of the present invention.

FIG. 3 shows a flow diagram schematically illustrating detection of a CSRF attack in accordance with an embodiment of the present invention.

FIG. 4 shows how the components of FIG. 3 may be implemented in separate computers in accordance with an embodiment of the present invention.

FIG. 5 shows a flow diagram of a method of detecting a CSRF attack in accordance with an embodiment of the present invention.

The use of the same reference label in different drawings indicates the same or like components.

In the present disclosure, numerous specific details are provided, such as examples of apparatus, components, and methods, to provide a thorough understanding of embodiments of the invention. Persons of ordinary skill in the art will recognize, however, that the invention can be practiced without one or more of the specific details. In other instances, well-known details are not shown or described to avoid obscuring aspects of the invention.

Being computer-related, it can be appreciated that some components disclosed herein may be implemented in hardware, software, or a combination of hardware and software (e.g., firmware). Software components may be in the form of computer-readable program code stored in a computer-readable storage medium, such as memory, mass storage device, or removable storage device. For example, a computer-readable storage medium may comprise computer-readable program code for performing the function of a particular component. Likewise, computer memory may be configured to include one or more components, which may be executed by a processor. Software components may be implemented in logic circuits, for example. Components may be implemented separately in multiple modules or together in a single module.

Referring now to FIG. 2, there is shown a schematic diagram of a computer 100 in accordance with an embodiment of the present invention. The computer 100 may be employed as a user computer or a gateway computer, for example. The computer 100 may have less or more components to meet the needs of a particular application. The computer 100 may include a processor 101, such as those from the Intel Corporation or Advanced Micro Devices, for example. The computer 100 may have one or more buses 103 coupling its various components. The computer 100 may include one or more user input devices 102 (e.g., keyboard, mouse), one or more data storage devices 106 (e.g., hard drive, optical disk, USB memory), a display monitor 104 (e.g., LCD, flat panel monitor, CRT), a computer network interface 105 (e.g., network adapter, modem), and a main memory 108 (e.g., RAM). The computer network interface 105 may be coupled to a computer network 109, which in this example includes the Internet.

In the example of FIG. 1, the main memory 108 includes a web browser 210 and a cross-site request forgery (CSRF) detector 212. The web browser 210 and the detector 212 may be loaded from the data storage device 106 to the main memory 108 for execution by the processor 101.

The web browser 210 may comprise a commercially available web browser, such as the Microsoft Internet Explorer™ web browser.

The CSRF detector 212 may comprise computer-readable program code for detecting a CSRF attack. In one embodiment, the detector 212 is configured to intercept HTTP communications to and from the web browser 210. For example, the CSRF detector 212 may be configured as a local proxy for the web browser 210.

The detector 212 may be configured to receive and analyze HTTP (hypertext transfer protocol) communications, such as HTTP requests and responses, to and from the web browser 212 for information indicative of a CSRF attack. In one embodiment, the detector 212 detects a CSRF attack by looking for CSRF code in an HTTP response from a website. CSRF code comprises computer-readable program code, such as an HTML tag or script, that automatically performs unauthorized access of an online account on a website or server computer upon execution in the victim user computer. For example, the detector 212 may check the HTTP response for inconsistency, such as program code that supposedly gets an image from a website but actually does not. The detector 212 may detect a CSRF attack by looking for CSRF code in an HTTP request from a user computer. For example, the detector 212 may check the HTTP request for inconsistency, such as whether the type of content expected to be received by the web browser as indicated in the request matches the content that will be provided to the web browser.

FIG. 3 shows a flow diagram schematically illustrating detection of a CSRF attack in accordance with an embodiment of the present invention. In the example of FIG. 3, a user of the computer 100 employs the web browser 210 to request a web page from a website 310 in accordance with HTTP. The website 310, which runs on a web server computer, sends a corresponding HTTP response (arrow 301), which in this example includes a web page. The CSRF detector 212 receives the HTTP response and analyzes the HTTP response for information indicative of a CSRF attack, such as presence of CSRF code. In this example, the detector 212 checks the HTTP response for malicious HTML tags. A malicious HTML tag purports to get or be a particular type of content but actually gets or is something else. An example malicious HTML tag is an HTML image tag,

<Img src=URL>

where the URL (uniform resource locator) should be for an image file, such as a .jpg or .gif file, as indicated by the tag “Img src.” For example, the URL

http://tw.i4.yimg.com/i/tw/hp/spirit/yahoo_logo.gif

is for an image file as indicated by the .gif extension of “yahoo_logo.gif.”

If the URL is for a content other than an image (e.g., a script), the detector 212 may deem the HTML image tag to be CSRF code and terminate the connection with the website 310. For example, the detector 212 may block communications to and from the website 310 and inform the user by providing a warning web page to the web browser 210.

If the HTTP response from the website 310 does not have any information indicative of a CSRF attack, the detector 212 may forward the HTTP response to the web browser 210 (arrow 302).

The web browser 210 may send an HTTP request to a website on the Internet (arrow 303). The HTTP request may be initiated by program code from the web page received from the website 310 or due to the user's navigation to another website. The detector 212 receives the HTTP request from the web browser 210 and analyzes the HTTP request for information indicative of a CSRF attack. In this example, the detector 212 examines the accept header field of the HTTP request to look for any inconsistency. The accept header field of an HTTP request indicates the type of content acceptable as a response to the HTTP request. If the web browser 210 is rendering an image tag as indicated by the corresponding HTTP response previously received by the web browser 210, the detector 212 may expect the accept header of the HTTP request to indicate an image.

As a particular example, the detector 212 operating as a local proxy for the web browser 210 may detect an HTTP request that the web browser 210 just sent. The HTTP request header includes an accept header field, which indicates the type of content the web browser 210 wants to retrieve by the HTTP Request. The following HTML request shows an example where the web browser 210 wants to retrieve a .gif image file:

http://tw.i4.yimg.com/i/tw/hp/spirit/yahoo_logo.gif

the browser will sent the following HTTP Request,

GET /i/tw/hp/spirit/yahoo_logo.gif HTTP/1.1

Host: tw.i4.yimg.com

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7

Accept: image/gif

Accept-Language: zh-tw,en-us;q=0.7,en;q=0.3

Accept-Encoding: gzip,deflate

Accept-Charset: Big5,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

In the above example, the accept header field indicates an image/gif type content, which is an image. If the web browser 210 is rendering an HTML image tag and requesting content other than an image file type, the detector 212 may deem the HTTP request to be part of a CSRF attack. In that case, the detector 212 may block the HTTP request and so inform the user by providing a notification web page to the web browser 210.

If the HTTP request does not include information indicative of a CSRF attack, the detector 212 may forward the HTTP request to its destination on the Internet (arrow 304).

In the example of FIG. 3, the web browser 210 and the CSRF detector 212 both run on the computer 100 in a private computer network. As can be appreciated, the detector 212 may also be run in a computer separate from the web browser 210. For example, as shown in FIG. 4, the detector 212 may be running in a computer 400 serving as an Internet gateway for the private computer network. Accordingly, HTTP communications between the Internet and the private computer network go through the computer 400, where the detector 212 runs to check HTTP responses and requests for CSRF attack. In the example of FIG. 4, the computer 100 serves as a user computer running the web browser 210. HTTP communications between the web browser 210 and a website on the Internet are intercepted by the detector 212 in the computer 400. The operation of the detector 212 is otherwise the same as explained with reference to FIG. 3.

FIG. 5 shows a flow diagram of a method 500 of detecting a CSRF attack in accordance with an embodiment of the present invention. The method 500 is explained using the components shown in FIGS. 2-4 for illustration purposes only. Other components may also be used without detracting from the merits of the present invention.

In the example of FIG. 5, the CSRF detector 212 receives an HTTP response from a website (step 501). The HTTP response may be responsive to a request for a web page previously sent to the website by the web browser 210. The detector 212 analyzes the HTTP response to detect a CSRF attack (step 502). For example, the detector 212 may be configured to detect a CSRF attack by looking for CSRF code in the HTTP response. The detector 212 performs a security action if the detector 212 detects a CSRF attack based on its analysis of the HTTP response (step 502 to step 503). The security action may involve blocking communications with the website and/or informing the user by way of a notification web page, for example. Otherwise, if the detector 212 does not detect a CSRF attack from the HTTP response, the detector 212 forwards the HTTP response to the web browser 210 (step 502 to step 504).

At a later time, the detector 212 receives an HTTP request from the web browser 210 (step 505). The HTTP request may be for the same website from which the HTTP response was received (see step 501) or for another website. The detector 212 analyzes the HTTP request to detect a CSRF attack (step 506). The detector 212 performs a security action if the detector 212 detects a CSRF attack based on its analysis of the HTTP request (step 506 to step 503). Otherwise, if the detector 212 does not detect a CSRF attack from the HTTP request, the detector 212 forwards the HTTP request to its destination computer on the Internet (step 506 to step 507).

An effective method and apparatus for detecting CSRF attacks have been disclosed. While specific embodiments of the present invention have been provided, it is to be understood that these embodiments are for illustration purposes and not limiting. Many additional embodiments will be apparent to persons of ordinary skill in the art reading this disclosure.

Yang, Shun-Fa, Kuo, Hsin-hsin, Liang, Wen-Tien

Patent Priority Assignee Title
10165004, Mar 18 2015 CEQUENCE SECURITY, INC Passive detection of forged web browsers
10419431, Sep 23 2015 ADVANCED NEW TECHNOLOGIES CO , LTD Preventing cross-site request forgery using environment fingerprints of a client device
10931686, Feb 01 2017 CEQUENCE SECURITY, INC Detection of automated requests using session identifiers
10931713, Feb 17 2016 CEQUENCE SECURITY, INC Passive detection of genuine web browsers based on security parameters
11381629, Mar 18 2015 Cequence Security, Inc. Passive detection of forged web browsers
11418520, Jun 15 2015 CEQUENCE SECURITY, INC Passive security analysis with inline active security device
Patent Priority Assignee Title
20090119769,
////
Executed onAssignorAssigneeConveyanceFrameReelDoc
Jan 29 2008TREND MICRO INCORPORATED(assignment on the face of the patent)
Jan 29 2008YANG, SHUN-FATREND MICRO INCORPORATEDASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0205060157 pdf
Jan 29 2008LIANG, WEN-TIENTREND MICRO INCORPORATEDASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0205060157 pdf
Jan 29 2008KUO, HSIN-HSINTREND MICRO INCORPORATEDASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0205060157 pdf
Date Maintenance Fee Events
Apr 16 2018M1551: Payment of Maintenance Fee, 4th Year, Large Entity.
May 18 2022M1552: Payment of Maintenance Fee, 8th Year, Large Entity.


Date Maintenance Schedule
Nov 18 20174 years fee payment window open
May 18 20186 months grace period start (w surcharge)
Nov 18 2018patent expiry (for year 4)
Nov 18 20202 years to revive unintentionally abandoned end. (for year 4)
Nov 18 20218 years fee payment window open
May 18 20226 months grace period start (w surcharge)
Nov 18 2022patent expiry (for year 8)
Nov 18 20242 years to revive unintentionally abandoned end. (for year 8)
Nov 18 202512 years fee payment window open
May 18 20266 months grace period start (w surcharge)
Nov 18 2026patent expiry (for year 12)
Nov 18 20282 years to revive unintentionally abandoned end. (for year 12)