Thank you for visiting OWASP.org. We have migrated our community to a new web platform and regretably the content for this page needed to be programmatically ported from its previous wiki page. There’s still some work to be done.
This is an example of a Project or Chapter Page.
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.
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.
String rPort = request.getParameter("remotePort");
ServerSocket srvr = new ServerSocket(rPort);
Socket skt = srvr.accept();
int rPort = Int32.Parse(Request.get_Item("remotePort "));
IPEndPoint endpoint = new IPEndPoint(address,rPort);
socket = new Socket(endpoint.AddressFamily,
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)
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);
This example shows a resource injection attack focused on obtaining Microsoft Windows SMB hashes from a remote server:
Related Threat Agents
- G. Hoglund and G. McGraw. Exploiting Software. Addison-Wesley, 2004.