Fetch-url-file-3a-2f-2f-2froot-2f.aws-2fconfig Jun 2026
from urllib.parse import unquote, urlparse
Modern browsers restrict fetch() on file:// URIs due to cross-origin security policies. However, in server-side JavaScript (Node.js with node-fetch or axios ), there is no such restriction. An attacker who can control a server-side fetch call (e.g., through a parameter passed to an API endpoint) can read arbitrary files.
[profile dev] aws_access_key_id = YOUR_DEV_ACCESS_KEY aws_secret_access_key = YOUR_DEV_SECRET_KEY region = us-east-1
What (e.g., Node.js, Python/Django, PHP) does your application use? fetch-url-file-3A-2F-2F-2Froot-2F.aws-2Fconfig
I can provide tailored code snippets and configuration rules to lock down your specific environment. Share public link
: Contains configuration parameters such as the default AWS region and output formats. It often lists assumed IAM roles.
In php.ini :
[Attacker] ---> Sends Payload (file:///root/.aws/config) ---> [Vulnerable Web App] | [Attacker] <--- Returns AWS Config File Contents <------------------ (Reads Local File System)
Most developers associate SSRF strictly with network protocols like http:// or https:// targeting internal assets like the AWS Instance Metadata Service (IMDS). However, if the underlying request engine (such as cURL , Python's requests , or Node's fetch ) permits the , the request turns inward. Instead of querying an external webpage, the server treats the payload as a local file request, pulling plaintext system files directly from the server's disk. Why Attackers Target root/.aws/config
?page=file:///root/.aws/config
To prevent these types of exploits, developers and security teams should implement the following strategies:
In LFI attacks, a script includes files based on user input (e.g., ?page=about ). If the script directly concatenates the input to a filesystem path without sanitization, an attacker can use path traversal ( ../../ ) to read arbitrary files. The file:// wrapper in PHP (allow_url_include) or similar functionalities can also be abused. The encoded string would appear in the page parameter:
While best practices dictate using temporary credentials through AWS IAM roles instead of storing static access keys, misconfigured environments sometimes store highly sensitive AWS Access Keys and Secret Access Keys in accompanying files like /root/.aws/credentials . Exposing the .aws directory allows unauthorized access to an entire AWS cloud infrastructure. How Attackers Exploit Local File Access from urllib