Skip to content

Fix the security holes in the 2.10.0 abilities - #2384

Merged
subodhr258 merged 15 commits into
mainfrom
fix/abilities-security-2.10.0
Nov 17, 2026
Merged

subodhr258 merged 15 commits into
mainfrom
fix/abilities-security-2.10.0

Conversation

@subodhr258

@subodhr258 subodhr258 commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

A security check of the 2.10.0 abilities for AI agents found two holes that an Author (any user with upload_files) can reach through /wp-json/godam/mcp or /wp-json/wp-abilities/v1/:

  • Private image URL leak. godam/update-video-settings (thumbnail_image_id) and godam/add-layer (cta.image_id) only checked that the ID was an image. On godam-multisite.local an Author passed an administrator's private image ID: the ability returned that file's URL and made it the public poster of the Author's video. This is the same kind of hole as godam/get-media in Check read access before an AI agent ability returns an attachment #2380. Both image IDs now go through get_attachment(), so an image the user cannot read is "not found".

  • SSRF in godam/import-media-from-url. WordPress core blocks the cloud metadata range (169.254.0.0/16) and CGNAT (100.64.0.0/10) only from 6.9.6 and 7.0.3. On 6.9.0 to 6.9.5 and 7.0.0 to 7.0.2, an Author could import http://169.254.169.254/.... The ability names the file from the response's text/plain type, so the response would be saved as a .txt in public uploads and its URL returned (cloud credentials on an AWS host with IMDSv1). The import now resolves the host and refuses any non-public address (only global IPv6, 2000::/3, is accepted), allows only the uploads folder on the site's own host (another page there may be one only the server can open, such as a status page), checks every redirect the same way, pins the download to the addresses it checked, and no longer returns the first KB of a failed response's body.

  • Switches only hid abilities. The MCP switch and "Let AI agents make changes" set listing flags only. An MCP server that names GoDAM tools itself, or wp_get_ability()->execute(), could still run a write the administrator turned off. The permission check of every GoDAM and add-on ability now refuses while MCP is off, and a write refuses while changes are off. (Also folded in from Retranscode only media items, with an hourly limit below Editor #2385.)

  • Retranscode route (folded in from Retranscode only media items, with an hourly limit below Editor #2385): a Contributor could send their own draft post (not media) to POST /godam/v1/transcoding/retranscode; it now requires an attachment.

  • Transcript fetch: anyone who can edit a video can store any .vtt/.srt URL as its transcript, and godam/get-transcript fetched any such path on the site's own host from the server. Same-site transcripts are now fetched only from the uploads folder, through the same rule the import uses (is_uploads_url()); the path is URL-decoded first, so %2e%2e or an encoded backslash cannot climb out.

Release ticket: https://github.com/rtCamp/godam-plugin-wp/issues/106. All of these should ship in 2.10.0.

Where to look

The parts a human reviewer should spend their time on. Everything else is mechanical: the tests, two small test stubs (remove_action, wp_attachment_is_image), and the regenerated POT (line shifts plus one merged message).

  1. Address check before the download (inc/classes/abilities/class-library-abilities.php:651-782, public_addresses(), resolve_host(), is_public_ip(); embedded_ipv4() at 1179-1196)
    Every address the host resolves to (A and AAAA) must be public. The site's own host is allowed only for a URL in its uploads folder (host, port and path; nothing when uploads sit at the host root), and a host is also allowed when the site owner allowed it with the http_request_host_is_external filter. A host whose IPv6 addresses cannot be read is refused, because the download may connect over IPv6.

    $records = function_exists( 'dns_get_record' ) ? dns_get_record( $host, DNS_AAAA ) : false;
    if ( ! is_array( $records ) ) {
        return array(); // no addresses: the host is refused
    }
    ...
    // Checked on the address's bytes, so every spelling gets the same answer.
    $ip = filter_var( $ip, FILTER_VALIDATE_IP ) ? (string) inet_ntop( self::embedded_ipv4( inet_pton( $ip ) ) ) : '';
    if ( ! filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ) {
        return false;
    }
    // 100.64.0.0/10 (CGNAT) and 192.0.0.0/24 ...

    Check: an IPv4 address carried inside IPv6 is refused however it is written (::ffff:169.254.169.254, ::ffff:a9fe:a9fe, NAT64 64:ff9b::/96, 6to4 2002::/16). PHP before 8.2 compares IPv6 addresses as text, so the tests run on 7.4, 8.1 and 8.5. Two trade-offs: a server with dns_get_record() disabled refuses every import from a host name, and a site that returns true for every host on core's filter gets no protection here, the same as for core's own requests.

  2. Redirect check and address pin during the download (inc/classes/abilities/class-library-abilities.php:510-543)
    Each redirect is checked the same way, and each checked host is pinned to the addresses that passed, so a second DNS answer (DNS rebinding) cannot swap in an internal address.

    $pins = array( self::pin_entry( $url, $addresses ) ); // "host:port:ip,ip"
    
    $check_redirect = function ( $location ) use ( &$pins ) {
        $addresses = $this->public_addresses( (string) $location );
        if ( null === $addresses ) {
            throw new \WpOrg\Requests\Exception( 'A valid URL was not provided.', 'wp_http.redirect_failed' );
        }
        $pins[] = self::pin_entry( (string) $location, $addresses );
    };
    
    $pin_addresses = function ( $handle ) use ( &$pins ) {
        ...
        curl_setopt( $handle, CURLOPT_RESOLVE, $entries );
    };
    add_action( 'requests-requests.before_redirect', $check_redirect );
    add_action( 'http_api_curl', $pin_addresses );

    Check: the redirect hook and exception are the ones core's own WP_Http::validate_redirects() uses, so a refused redirect ends as a normal WP_Error from download_url(). Core fires http_api_curl for every request, redirects included. The pin only applies when WordPress uses cURL; on its fallback transport the download is checked but not pinned. Checked against real cURL on PHP 7.4 and 8.5: a host name that is not in DNS was served from the pinned address.

  3. Image read check (inc/classes/abilities/class-ability-group.php:583-622, used at class-video-settings-abilities.php:267 and in class-layer-abilities.php build_cta())

    $post = $this->get_attachment( $image_id ); // not found unless the user may read it
    ...
    if ( ! wp_attachment_is_image( $post->ID ) ) { ... 'rtgodam_not_an_image' ... }

    Check: an Author can still use any inherit library image (same as the Media Library), and an administrator can still use their own private image (checked live).

  4. Switches enforced when an ability runs (inc/classes/abilities/class-ability-group.php:225-300, within_switches())

    if ( ! Abilities::mcp_enabled() ) { return new \WP_Error( 'rtgodam_mcp_off', ... ); }
    if ( $writes_off ) { return new \WP_Error( 'rtgodam_writes_off', ... ); }
    return call_user_func( $callback, $input );

    Check: $writes_off is $writes && ! $public, so the rtgodam_ability_is_public filter still decides. The MCP switch is read at call time. Nothing in GoDAM or GoDAM for Woo runs abilities itself, so this cannot block internal code.

  5. Retranscode permission (inc/classes/rest-api/class-transcoding.php:790-806)

    $can = 'attachment' === get_post_type( $attachment_id ) && current_user_can( 'edit_post', $attachment_id );
  6. Uploads-folder rule (inc/classes/abilities/class-ability-group.php:598-611, is_uploads_url()), used by the import's own-host case and the transcript fetch (class-media-abilities.php:758-781): uploads host and port, a path under the uploads path, no .. or backslash after URL-decoding, and nothing at all when uploads sit at the host root.

UI evidence

No UI change: all fixes are in abilities and routes called by AI agents over MCP or the Abilities REST API. Live check on godam-multisite.local (GoDAM develop, then this branch, MCP Adapter 0.7.1, as an Author through /wp-json/godam/mcp):

Call develop (e93dfeb) this branch
update-video-settings with the admin's private image ID succeeded, returned the private file URL "No media item with ID 88 exists"
add-layer card CTA with that image ID layer saved with the private image "No media item with ID 88 exists"
import-media-from-url http://100.64.0.1/x.mp4, http://[::ffff:169.254.169.254]/x refused only by core 6.9.6+ / 7.0.3+ "Give a public http or https URL."
import-media-from-url a public MP4 imported imported
Contributor POST .../transcoding/retranscode with own draft post passed the permission check 403
Switches off, write called through the adapter's default server or REST refused (not found) refused, now also in the permission check itself

How to test

  1. On a site with the MCP Adapter, create an Author with an Application Password, and a private image owned by an administrator.
  2. As the Author, call godam-update-video-settings on one of the Author's own videos with thumbnail_image_id = that private image: expect "No media item with ID ... exists". As the administrator the same call works.
  3. As the Author, call godam-add-layer with type: cta, cta: {style: card, heading: x, image_id: <private image>}: same error.
  4. As the Author, call godam-import-media-from-url with http://169.254.169.254/latest/meta-data/ and http://100.64.0.1/a.mp4: "Give a public http or https URL.". A public MP4 URL still imports.
  5. As a Contributor, POST /wp-json/godam/v1/transcoding/retranscode with {"id": <own draft post>}: 403.
  6. Untick Settings > Writing > GoDAM and AI agents; in WP-CLI run wp eval 'var_dump( wp_get_ability( "godam/create-folder" )->execute( array( "name" => "x" ) ) );' --user=<admin>: rtgodam_writes_off error.
  7. vendor/bin/phpunit --filter 'AbilityImageReadAccessTest|ImportMedia|AbilityRulesTest|RetranscodePermissionTest|TranscriptFetchHostTest'.

Risk

risk: medium because it changes what several abilities and the retranscode route accept on release day; a site that imports from a LAN host other than its own name (rare) is now refused unless it allows that host with core's http_request_host_is_external filter.

godam/update-video-settings (thumbnail_image_id) and godam/add-layer
(cta.image_id) only checked that the ID was an image. An Author could pass
an administrator's private image: update-video-settings returned its file
URL and made it the public poster of the Author's video, and add-layer put
it on the player. Both now load the image through get_attachment(), so an
image the user cannot read is "not found", like a missing ID.
Core's wp_http_validate_url() let link-local (169.254.0.0/16, the cloud
metadata service) and CGNAT (100.64.0.0/10) addresses through before
WordPress 6.9.6 and 7.0.3. On those versions an Author could import
http://169.254.169.254/... and the response was saved as a .txt in the
public uploads folder, with its URL returned.

The import now resolves the host and refuses it unless every address is
public (the site's own host stays allowed, as in core), checks every
redirect the same way, and no longer hands back the first KB of a failed
response's body.
@subodhr258 subodhr258 added the risk: medium Agent QA plus a human spot check label Nov 17, 2026
@subodhr258
subodhr258 changed the base branch from develop to main November 17, 2026 09:51
rtBot
rtBot previously requested changes Nov 17, 2026

@rtBot rtBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code analysis identified issues

action-phpcs-code-review has identified potential problems in this pull request during automated scanning. We recommend reviewing the issues noted and that they are resolved.

phpcs scanning turned up:

🚫 1 error


Powered by rtCamp's GitHub Actions Library

@github-actions

Copy link
Copy Markdown

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
13 0 13

⚠️ Warnings (13)

📁 readme.txt (1 warning)
📍 Line 🔖 Check 💬 Message
0 mismatched_plugin_name Plugin name "GoDAM - Video Hosting for LMS & Online Courses" is different from the name declared in plugin header "GoDAM".
📁 assets/build/pages/video-editor.min.js (1 warning)
📍 Line 🔖 Check 💬 Message
2 react_removed_api This file calls "ReactDOM.findDOMNode", which was removed in React 19 and stops working once WordPress upgrades React. Use a ref on the element instead.
📁 assets/build/css/main.css (1 warning)
📍 Line 🔖 Check 💬 Message
0 EnqueuedStylesScope This style is being loaded in all contexts.
📁 assets/src/libs/analytics.min.js (5 warnings)
📍 Line 🔖 Check 💬 Message
0 EnqueuedScriptsScope This script is being loaded in all frontend contexts.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/2026/11/17/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
📁 assets/build/js/main.min.js (5 warnings)
📍 Line 🔖 Check 💬 Message
0 EnqueuedScriptsScope This script is being loaded in all frontend contexts.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/2026/11/17/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

is_public_ip() only unwrapped an IPv4-mapped address written with dots.
PHP before 8.2 compares IPv6 addresses as text, so the hex spelling a DNS
lookup returns (::ffff:a9fe:a9fe for 169.254.169.254) counted as public on
PHP 7.4 to 8.1. The address is now converted with inet_pton() and the IPv4
address inside an IPv4-mapped, IPv4-compatible, NAT64 or 6to4 address gets
the IPv4 rules.
Three gaps left in the address check of godam/import-media-from-url:

- DNS rebinding: the download looked the host up again. Each checked host,
  redirects included, is now pinned to the addresses that passed, through
  CURLOPT_RESOLVE on core's http_api_curl action.
- A failed or unavailable IPv6 lookup left the host checked on IPv4 only,
  while the download could still connect over IPv6. Such a host is refused.
- A host the site owner allowed with core's http_request_host_is_external
  filter was refused. It is allowed, as in core.

POT: line references only.
The retranscode route let anyone who can edit an ID retranscode it, so a
Contributor could send their own draft post, which is not media. It now
also requires an attachment. Users below Editor can start 10 retranscodes
an hour (filter rtgodam_retranscode_hourly_limit), so an Author looping
over their uploads cannot burn the site's GoDAM plan. Editors and above,
who use the bulk Retranscoding page, are not limited.
The MCP switch and the "Let AI agents make changes" switch only hid
abilities from listings (meta.public, show_in_rest, mcp.public). An MCP
server that names GoDAM tools itself, or code calling
wp_get_ability()->execute(), could still run a write an administrator had
turned off. Every GoDAM and add-on ability's permission check now refuses
while MCP is off, and a write refuses while changes are off.
Anyone who can edit a video can store any .vtt or .srt URL as its
transcript, and godam/get-transcript fetches it from the server without
the user's login. On the site's own host it now fetches only a caption
file under the uploads folder, so no other path on the site is reachable.
@subodhr258 subodhr258 changed the title Fix two security holes in the 2.10.0 abilities: private image URLs and SSRF in URL import Fix the security holes in the 2.10.0 abilities Nov 17, 2026

@KMchaudhary KMchaudhary left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed for correctness. The core of the fix is sound — I traced the redirect path (requests-requests.before_redirect → WP_Http_Requests_Hooks::dispatch), the http_api_curl/curl.before_send bridge for CURLOPT_RESOLVE pinning, and WP_Ability::execute() → check_permissions(), and all three hooks fire as the PR assumes. The IP-parsing (embedded IPv4 extraction, CGNAT/link-local/reserved coverage) holds up under the spellings called out in the description. A few smaller things worth a look:

  1. Switch-off messages are swallowed by WP_Ability::execute() (within_switches, class-ability-group.php). execute() treats any non-true permission result as a failure: it calls _doing_it_wrong() with the message and returns the generic "Ability … does not have necessary permission." So any caller going through execute() never sees the helpful rtgodam_mcp_off / rtgodam_writes_off text, and each blocked write while a switch is off emits a _doing_it_wrong notice (log noise under WP_DEBUG). Security still holds; only the messaging/noise is affected. Worth confirming the MCP adapter path surfaces the custom message (it may not go through execute()).

  2. resolve_host() false-negatives on AAAA trouble. It returns array() (→ refuse) whenever dns_get_record($host, DNS_AAAA) isn't an array — not only when dns_get_record is disabled (documented), but also on a transient AAAA failure/timeout — discarding valid gethostbynamel() IPv4 results. A legit public, IPv4-only/AAAA-flaky host becomes intermittently un-importable.

  3. IPv6 multicast ff00::/8 passes is_public_ip(). The regex blocks fe[89ab] and f[cd] only; neither it nor the FILTER flags exclude ff… (e.g. ff02::1). Lower SSRF value than link-local, but it's a non-public range slipping through — consider adding ff to the reject prefix.

  4. Switch enforcement gated on isset($args['permission_callback']). All abilities set one today, so this is latent, but a future ability (or add-on reusing add()) that omits permission_callback would register with no switch gate at all — re-opening exactly this hole. Enforcing the switches unconditionally would be more robust than relying on every future add() call passing a callback.

  5. Transcript $base_path collapses to / when the uploads baseurl has no path (is_transcript_url_allowed). If the uploads URL is at the domain root (custom UPLOADS / rewrite), PHP_URL_PATH is null → $base_path = '/' → strpos($path, '/') === 0 matches every absolute path, so any same-host .vtt/.srt passes, not just the uploads folder.

None of these block the security goal; 1–3 are the most worth addressing before release.

ff00::/8 passed is_public_ip(): neither PHP's range flags nor the link-local and unique-local prefixes cover it.
@subodhr258

Copy link
Copy Markdown
Collaborator Author

Thanks for the trace. Point by point:

  1. IPv6 multicast: fixed in 155c5dd. is_public_ip() now also refuses ff00::/8; ff02::1 and FF05::2 added to the tests.

  2. Switch messages swallowed by execute(): no change. The abilities REST run route and the MCP adapter call check_permissions() and return our WP_Error, so its text reaches them. And with a switch off the ability is not listed on either, so a client gets "not found" before it gets here. Only custom PHP calling execute() hits the generic message plus the notice, which is the case this check is for.

  3. AAAA failure refuses the host: kept on purpose. If the IPv6 lookup fails we cannot tell whether the host also has an internal IPv6 address, so the import refuses instead of guessing. A flaky AAAA lookup makes an import fail; the user can retry. Easing this is a 2.10.1 item if it shows up in practice.

  4. Gate only when permission_callback is set: no change. Core's wp_register_ability() refuses to register an ability without a permission_callback, so no ability can register without the gate.

  5. Uploads at the domain root: no change. Then every path on that host is under the uploads URL, and the rule still allows only .vtt / .srt files on the site's own host with no ... That is the same set of files the site already serves to visitors.

@rudrakshi-gupta

Copy link
Copy Markdown
Member

Reviewed dee2b9a. Kuldip's trace of the redirect hook, the cURL pin and execute() matches what I found, and I agree with his points 1–3 and 5. Below is only what's new.

What I ran

  • PR branch: the targeted tests pass (62), the full PHPUnit suite passes (1590), and PHPCS is clean on inc/classes/abilities/ and class-transcoding.php.
  • Trial merge into current main (the branch is 1 behind): it merges cleanly and the suite passes (1590).
  • I ran Library_Abilities::is_public_ip() directly over a set of addresses (results in 2).

Should fix before release

  1. The site's own host skips the address check, and the import still saves any allowed type publicly. That reopens the "saved as .txt and URL returned" path for server-only pages. public_addresses() returns array() (allowed, not pinned) for home_url()'s host, and redirects get the same treatment. Core's wp_http_validate_url() also allows the site's own host, but core never hands the body back to an Author. Here the response is saved in uploads and its URL is returned.
    Steps: an Author calls godam/import-media-from-url with https://<site host>/server-status?auto, or with a public URL that redirects there. The request comes from the server itself. If the site's host resolves locally (a /etc/hosts entry or a Docker/local setup) or the server is behind its own proxy, Apache's Require local lets it through. The response is text/plain, the import names it server-status.txt from the Content-Type, and the Author gets a public URL to it. The same goes for any page restricted by IP to the server (status/health endpoints, IP-locked admin tools on port 80/443/8080, which core's port check allows).
    This depends on the environment, but it is the same impact the description names for the metadata endpoint. Two possible fixes, in order of preference:
    • On the site's own host, accept only a path under the uploads base URL. This is the same rule this PR adds for transcripts, so there could be one shared helper, which would also pick up Kuldip's point 5.
    • Or adopt and accept only media types (image/video/audio, plus document types if needed) for imports, by passing mimes in media_handle_sideload()'s $overrides, so a text/plain body is never stored.

Worth tightening (low severity)

  1. is_public_ip() lets a few more non-public ranges through than ff00::/8 (Kuldip's point 3). Output from running it:
Address Result Range
224.0.0.1, 239.255.255.250 PUBLIC IPv4 multicast 224.0.0.0/4
198.18.0.1 PUBLIC benchmarking 198.18.0.0/15, used as internal space on some networks
64:ff9b:1::a9fe:a9fe PUBLIC local-use NAT64 64:ff9b:1::/48 (RFC 8215), carries 169.254.169.254
fec0::1 PUBLIC deprecated site-local fec0::/10, still routed internally in places
ff02::1, ff05::1:3 PUBLIC IPv6 multicast ff00::/8
100::1 PUBLIC discard-only 100::/64
2001:0:4136:… PUBLIC Teredo carries an obfuscated IPv4; fine to leave

Everything the description lists is refused correctly: ::ffff: in both spellings, NAT64 64:ff9b::/96, 6to4, ::, ::1, 0.0.0.0, CGNAT, 192.0.0.0/24 and link-local. Adding 224.0.0.0/4 and 198.18.0.0/15 to the IPv4 check, 64:ff9b:1::/48 to embedded_ipv4()'s NAT64 carriers (or refusing it outright), and ^(fe[89a-f]|f[cd]|ff) plus ^100:: to the IPv6 regex would close all of these.

Checked, OK

  • get_image() goes through get_attachment() before wp_attachment_is_image(), for both thumbnail_image_id and cta.image_id. build_cta() is shared by add and update, so both paths are covered.
  • Retranscode: 'attachment' === get_post_type() is checked before edit_post, and a missing ID gives false and so 403.
  • Transcript rule: the path is decoded once before the ../\ check. $base_path comes from the lowercased $baseurl, so the strtolower( $path ) comparison is consistent. A double-encoded %252e%252e is safe, because the web server decodes it only once, into a literal %2e%2e folder name.
  • The failed-download error now keeps only code and message, so no body bytes come back.

Not ready to approve yet. 1 is the one I'd fix before the release; 2 and Kuldip's points can go in the same push.

The server fetches the URL, so a page on the site's host that only the server may open (a status page, an IP-locked tool) could be saved publicly as text. The import and the transcript fetch now share one uploads-folder rule, which also checks the port and refuses everything when uploads sit at the host root. The public-IP check now accepts only global IPv6 (2000::/3) and refuses 198.18.0.0/15 and 224.0.0.0/4.
@subodhr258

Copy link
Copy Markdown
Collaborator Author

Thanks, both fixed in d2cd77f.

  1. Own host: took your first option. On the site's own host the import now accepts only a URL in the uploads folder (same host and port, a path under the uploads path, no .. or backslash after decoding), and redirects go through the same check, so https://<site>/server-status?auto and a public URL redirecting there are both refused. The rule is one helper, is_uploads_url() in Ability_Group, now shared with the transcript fetch. It also refuses everything when uploads sit at the host root, which covers Kuldip's point 5.
  2. Ranges: IPv6 now has to be global unicast (2000::/3). That refuses ff00::/8, fec0::/10, 100::/64, 64:ff9b:1::/48 and anything else outside it, without listing each range. IPv4 adds 198.18.0.0/15 and 224.0.0.0/4. Your table's addresses are in the tests. Teredo stays allowed, as you suggested.

No new strings, so the POT is unchanged.

@subodhr258
subodhr258 merged commit e96f235 into main Nov 17, 2026
10 checks passed
@subodhr258
subodhr258 deleted the fix/abilities-security-2.10.0 branch November 17, 2026 12:14
@rudrakshi-gupta

Copy link
Copy Markdown
Member

Re-reviewed d2cd77f, 155c5dd and c763309. I saw this is already merged (e96f235, same tree as c763309), so this is a confirmation plus one follow-up for 2.10.1.

What I ran on c763309

  • Full PHPUnit passes (1593), both on the branch and merged with current main. PHPCS is clean on inc/classes/abilities/.
  • I re-ran my is_public_ip() address matrix. Every address from my earlier table is now refused: 224/4, 198.18/15, 64:ff9b:1::, fec0::, ff02::, ff05:: and 100::. Public ones still pass (8.8.8.8, 2606:4700::1111). Allowing only 2000::/3 for IPv6 is a cleaner rule than a deny list.
  • is_uploads_url() also fixes Kuldip's point 5: an uploads folder at the root of its host (/) is refused, and the port is compared. Transcripts use the same helper.

Follow-up: the site's own server under another name still skips the uploads-only rule

The new rule only kicks in when the URL's host string equals home_url()'s host. The same server reached by a different name or by its IP takes the normal path. Its address is public, so it passes. I confirmed it with the PR's own test harness (ImportMediaPublicUrlTest::ability(), site.test and an attacker-controlled name both resolving to 93.184.216.34):

URL public_addresses()
https://site.test/server-status?auto refused ✅
https://site.test/wp-content/uploads/x.mp4 allowed ✅
http://93.184.216.34/server-status?auto (the server's own public IP) allowed
http://alias.attacker.example/server-status?auto (an A record pointing at the server) allowed

The case I raised, Apache's Require local, still matches here. mod_authz_host's local also allows a connection when the client address equals the server address, which is exactly what a request from the box to its own public IP is. The default vhost typically answers an unknown Host name, and server-status is usually global. So on a single-server host, an Author can still import /server-status?auto as a public .txt. It just needs the IP or any domain pointed at it.

Suggested fix: after resolve_host(), treat the host as the site itself when any of its addresses matches one of the site's own addresses. Then apply is_uploads_url() (or refuse). The site's own addresses are resolve_host( home_url host ) plus $_SERVER['SERVER_ADDR'] when it's set. Behind a CDN or load balancer the first set is the CDN's and SERVER_ADDR is usually private (already refused), so this mainly matters for single-server sites, which is the vulnerable setup. A test can reuse the harness rows above.

The default ports (80/443/8080) are the only ones reachable, and the impact depends on how the site is hosted, so this doesn't need to hold 2.10.0. It's worth a quick follow-up so the own-host rule can't be sidestepped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium Agent QA plus a human spot check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants