humanprotocol / human-protocol

Human Protocol python/js/ts Monorepo with example
https://dashboard.humanprotocol.org
MIT License
23 stars 33 forks source link

Comprehensive CORS Misconfiguration on stg-fortune-recording-oracle-server.humanprotocol.org #2310

Closed basit511 closed 2 months ago

basit511 commented 3 months ago

Comprehensive CORS Misconfiguration on stg-fortune-recording-oracle-server.humanprotocol.org Summary:

This report details a critical Cross-Origin Resource Sharing (CORS) misconfiguration on the Human Protocol staging server, https://stg-fortune-recording-oracle-server.humanprotocol.org/swagger. This misconfiguration exposes the server to potential theft of sensitive data and unauthorized actions due to unrestricted access from any domain.

Technical Details:

CORS (Cross-Origin Resource Sharing): A web security mechanism that restricts web browsers from making requests to a different domain than the one that served the webpage. It protects from unauthorized access by implementing a policy that defines which origins (domains, ports, protocols) can access the server's resources. Misconfiguration: The server responds to requests with the Access-Control-Allow-Origin header set to *. This indicates that requests from any origin are permitted, bypassing the intended security measure. Impact:

A malicious actor could exploit this misconfiguration in several ways:

Cross-Site Scripting (XSS): An attacker could inject malicious scripts from a different domain onto a trusted website. When a user visits the compromised website, the script could steal sensitive data (e.g., access tokens, user information) transmitted during communication with the Human Protocol server. Data Exfiltration: An attacker could leverage specially crafted requests from another domain to extract sensitive data directly from the Human Protocol server. This includes information like user records, financial transactions, or internal server data. Unauthorized Actions: Malicious scripts or requests could be used to perform unauthorized actions on the server. This could involve modifying data, triggering specific functionalities, or disrupting critical operations. Severity:

This CORS misconfiguration is considered a high-severity vulnerability due to the potential for significant impact. Sensitive data exposure and unauthorized actions on the server can lead to financial losses, reputational damage, and disruption of Human Protocol services.

Steps to Reproduce:

Access the Target URL: Open https://stg-fortune-recording-oracle-server.humanprotocol.org/swagger in a web browser. Inspect Network Requests: Use browser developer tools (e.g., Firefox DevTools, Chrome DevTools) to examine network requests made during page load. Analyze Response Headers: Look for the Access-Control-Allow-Origin header in the response headers for the target URL. Verify Misconfiguration: If the header value is set to * or a domain other than the one that served the webpage, the CORS misconfiguration is confirmed. Recommendation:

Implement Restrictive CORS Policy: The Human Protocol team should enforce a strict CORS policy that only allows requests from authorized origins. This can be achieved by setting the Access-Control-Allow-Origin header to specific allowed domains, such as the Human Protocol production and staging domains. Review Additional CORS Headers: Consider implementing additional CORS headers like Access-Control-Allow-Methods to restrict the allowed HTTP methods (e.g., GET, POST) and Access-Control-Allow-Headers to specify permitted request headers. POC LINK - https://drive.google.com/file/d/1zxHlQRwxFsDJkd-g7tVR96HF4-Get6j0/view?usp=drive_link

basit511 commented 3 months ago

@ivhus Any update on this?

ivhus commented 2 months ago

This is insignificant because staging environment doesn't have sensitive data But anyway discussing with the devs Access-Control-Allow-Methods restrictions @basit511

basit511 commented 2 months ago

@ivhus So can we close it?

ansaqib commented 2 months ago

@ivhus - What's the update on this?

ivhus commented 2 months ago

@ansaqib wrote yesterday to @Dzeranov and @portuu3, depends on the guys

basit511 commented 2 months ago

@ansaqib We should wait for the final update and forward the necessary to the contributor

ivhus commented 2 months ago

yes closing as not dangerous for staging