Repository navigation
Fix the security holes in the 2.10.0 abilities - #2384
Conversation
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.
rtBot
left a comment
There was a problem hiding this comment.
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
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 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.
KMchaudhary
left a comment
There was a problem hiding this comment.
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:
-
Switch-off messages are swallowed by
WP_Ability::execute()(within_switches,class-ability-group.php).execute()treats any non-truepermission 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 throughexecute()never sees the helpfulrtgodam_mcp_off/rtgodam_writes_offtext, and each blocked write while a switch is off emits a_doing_it_wrongnotice (log noise underWP_DEBUG). Security still holds; only the messaging/noise is affected. Worth confirming the MCP adapter path surfaces the custom message (it may not go throughexecute()). -
resolve_host()false-negatives on AAAA trouble. It returnsarray()(→ refuse) wheneverdns_get_record($host, DNS_AAAA)isn't an array — not only whendns_get_recordis disabled (documented), but also on a transient AAAA failure/timeout — discarding validgethostbynamel()IPv4 results. A legit public, IPv4-only/AAAA-flaky host becomes intermittently un-importable. -
IPv6 multicast
ff00::/8passesis_public_ip(). The regex blocksfe[89ab]andf[cd]only; neither it nor the FILTER flags excludeff…(e.g.ff02::1). Lower SSRF value than link-local, but it's a non-public range slipping through — consider addingffto the reject prefix. -
Switch enforcement gated on
isset($args['permission_callback']). All abilities set one today, so this is latent, but a future ability (or add-on reusingadd()) that omitspermission_callbackwould register with no switch gate at all — re-opening exactly this hole. Enforcing the switches unconditionally would be more robust than relying on every futureadd()call passing a callback. -
Transcript
$base_pathcollapses to/when the uploads baseurl has no path (is_transcript_url_allowed). If the uploads URL is at the domain root (customUPLOADS/ rewrite),PHP_URL_PATHis null →$base_path = '/'→strpos($path, '/') === 0matches every absolute path, so any same-host.vtt/.srtpasses, 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.
|
Thanks for the trace. Point by point:
|
|
Reviewed dee2b9a. Kuldip's trace of the redirect hook, the cURL pin and What I ran
Should fix before release
Worth tightening (low severity)
Everything the description lists is refused correctly: Checked, OK
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.
|
Thanks, both fixed in d2cd77f.
No new strings, so the POT is unchanged. |
|
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
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
The case I raised, Apache's Suggested fix: after 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. |
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/mcpor/wp-json/wp-abilities/v1/:Private image URL leak.
godam/update-video-settings(thumbnail_image_id) andgodam/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 asgodam/get-mediain Check read access before an AI agent ability returns an attachment #2380. Both image IDs now go throughget_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 importhttp://169.254.169.254/.... The ability names the file from the response'stext/plaintype, so the response would be saved as a.txtin 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/.srtURL as its transcript, andgodam/get-transcriptfetched 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%2eor 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).Address check before the download (
inc/classes/abilities/class-library-abilities.php:651-782,public_addresses(),resolve_host(),is_public_ip();embedded_ipv4()at1179-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_externalfilter. A host whose IPv6 addresses cannot be read is refused, because the download may connect over IPv6.Check: an IPv4 address carried inside IPv6 is refused however it is written (
::ffff:169.254.169.254,::ffff:a9fe:a9fe, NAT6464:ff9b::/96, 6to42002::/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 withdns_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.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.
Check: the redirect hook and exception are the ones core's own
WP_Http::validate_redirects()uses, so a refused redirect ends as a normalWP_Errorfromdownload_url(). Core fireshttp_api_curlfor 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.Image read check (
inc/classes/abilities/class-ability-group.php:583-622, used atclass-video-settings-abilities.php:267and inclass-layer-abilities.phpbuild_cta())Check: an Author can still use any
inheritlibrary image (same as the Media Library), and an administrator can still use their own private image (checked live).Switches enforced when an ability runs (
inc/classes/abilities/class-ability-group.php:225-300,within_switches())Check:
$writes_offis$writes && ! $public, so thertgodam_ability_is_publicfilter 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.Retranscode permission (
inc/classes/rest-api/class-transcoding.php:790-806)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):update-video-settingswith the admin's private image IDadd-layercard CTA with that image IDimport-media-from-urlhttp://100.64.0.1/x.mp4,http://[::ffff:169.254.169.254]/ximport-media-from-urla public MP4POST .../transcoding/retranscodewith own draft postHow to test
godam-update-video-settingson one of the Author's own videos withthumbnail_image_id= that private image: expect "No media item with ID ... exists". As the administrator the same call works.godam-add-layerwithtype: cta,cta: {style: card, heading: x, image_id: <private image>}: same error.godam-import-media-from-urlwithhttp://169.254.169.254/latest/meta-data/andhttp://100.64.0.1/a.mp4: "Give a public http or https URL.". A public MP4 URL still imports.POST /wp-json/godam/v1/transcoding/retranscodewith{"id": <own draft post>}: 403.wp eval 'var_dump( wp_get_ability( "godam/create-folder" )->execute( array( "name" => "x" ) ) );' --user=<admin>:rtgodam_writes_offerror.vendor/bin/phpunit --filter 'AbilityImageReadAccessTest|ImportMedia|AbilityRulesTest|RetranscodePermissionTest|TranscriptFetchHostTest'.Risk
risk: mediumbecause 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'shttp_request_host_is_externalfilter.