CVE-2022-3708 (published 2022-10-28T19:15Z)

The Web Stories plugin for WordPress is vulnerable to Server-Side Request Forgery in versions up to, and including 1.24.0 due to insufficient validation of URLs supplied via the 'url' parameter found via the /v1/hotlink/proxy REST API Endpoint. This makes it possible for authenticated users to make web requests to arbitrary locations originating from the web application and can be used to query and modify information from internal services.

CVSS v3 base score: 8.1, HIGH (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N)

Weakness information:
cwe_id: CWE-918
cwe_name: Server-Side Request Forgery (SSRF)
description: The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
extended_description: By providing URLs to unexpected hosts or ports, attackers can make it appear that the server is sending the request, possibly bypassing access controls such as firewalls that prevent the attackers from accessing the URLs directly. The server can be used as a proxy to conduct port scanning of hosts in internal networks, use other URLs such as that can access documents on the system (using file://), or use other protocols such as gopher:// or tftp://, which may provide greater control over the contents of requests.
         

Fix information:
repo_url: https://github.com/GoogleForCreators/web-stories-wp
commit_details: repo_url: https://github.com/GoogleForCreators/web-stories-wp
author: Pascal Birchler
author_date: 2022-09-02 17:09:39+02:00
msg: Improve URL checks in hotlinking controller
repository: repo_url: https://github.com/GoogleForCreators/web-stories-wp
repo_name: GoogleForCreators/web-stories-wp
description: Web Stories for WordPress
repo_language: JavaScript
owner: GoogleForCreators
file_changes: filename: Hotlinking_Controller.php
change_type: ModificationType.MODIFY
diff: @@ -672,9 +672,21 @@ class Hotlinking_Controller extends REST_Controller implements HasRequirements {
 			}
 
 			$parts = array_map( 'intval', explode( '.', $ip ) );
-			if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0]
-				|| ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] )
-				|| ( 192 === $parts[0] && 168 === $parts[1] )
+			if (
+				0 === $parts[0] // 0.0.0.0/8.
+				||
+				127 === $parts[0] // 127.0.0.0/8.
+				||
+				10 === $parts[0] // 10.0.0.0/8.
+				||
+				( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] ) // 172.16.0.0/12.
+				||
+				( 192 === $parts[0] && 168 === $parts[1] ) // 192.168.0.0/16.
+				||
+				( 169 === $parts[0] && 254 === $parts[1] ) // 169.254.0.0/16.
+				||
+				// phpcs:ignore Squiz.PHP.CommentedOutCode.Found
+				( 100 === $parts[0] && 64 <= $parts[1] && 127 >= $parts[1] ) // Private: 100.64.0.0/10.
 			) {
 				// If host appears local, reject.
 				return false;

programming_language: PHP
filename: Hotlinking_Controller.php
change_type: ModificationType.MODIFY
diff: @@ -573,6 +573,9 @@ class Hotlinking_Controller extends DependencyInjectedRestTestCase {
 			'an external request when not allowed'         => [
 				'url' => 'http://192.168.0.1/caniload.php',
 			],
+			'a request with disallowed link-local ip'      => [
+				'url' => 'http://169.254.0.0/caniload.php',
+			],
 			'a port not considered safe by default'        => [
 				'url' => 'https://example.com:81/caniload.php',
 			],

programming_language: PHP