Skip to content

Commit

Permalink
feat: add new encoded functions on list
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocesarato committed Jan 9, 2021
1 parent aa8f98b commit 459d75d
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 41 deletions.
135 changes: 96 additions & 39 deletions src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,23 @@ class Functions
'syslog',
'passthru',
'define_syslog_variables',
/*
"dl",
"debugger_off",
"debugger_on",
"parse_ini_file",
"show_source",
"symlink",
"popen",
*/
'posix_kill',
/*
"posix_getpwuid",
"posix_mkfifo",
"posix_setpgid",
"posix_setsid",
"posix_setuid",
*/
'posix_getpwuid',
'posix_mkfifo',
'posix_setpgid',
'posix_setsid',
'posix_setuid',
'posix_uname',
'proc_close',
'proc_get_status',
'proc_nice',
'proc_open',
'proc_terminate',
/*
"ini_alter",
"ini_get_all",
"ini_restore",
"parse_ini_file",
*/
'pcntl_exec',
'inject_code',
'apache_child_terminate',
'apache_note',
'define_syslog_variables',
/*
"apache_setenv",
"escapeshellarg",
"escapeshellcmd",
*/
];

/**
Expand All @@ -75,51 +54,129 @@ class Functions
* @var array
*/
public static $dangerous = [
// PHP Code Execution
'il_exec',
'shell_exec',
'eval',
'system',
'create_function',
'exec',
'pcntl_exec',
'assert',
'syslog',
'passthru',
'create_function',
'include',
'include_once',
'require',
'require_once',
'preg_replace',
// Files and configurations
'syslog',
'define_syslog_variables',
'debugger_off',
'get_meta_tags',
'highlight_file',
'debugger_on',
'parse_ini_file',
'php_strip_whitespace',
'show_source',
'symlink',
'popen',
'fopen',
'file_get_contents',
'file_put_contents',
'chmod',
'chown',
'copy',
'move',
'is_file',
'is_dir',
'ini_alter',
'ini_get_all',
'ini_restore',
'parse_ini_file',
'inject_code',
'apache_child_terminate',
'apache_setenv',
'apache_note',
'define_syslog_variables',
// Curl
'curl_init',
'curl_setopt',
'curl_exec',
// Posix
'posix_kill',
'posix_getpwuid',
'posix_mkfifo',
'posix_setpgid',
'posix_setsid',
'posix_setuid',
'posix_uname',
// Processes
'popen',
'proc_close',
'proc_get_status',
'proc_nice',
'proc_open',
'proc_terminate',
'ini_alter',
'ini_get_all',
'ini_restore',
'parse_ini_file',
'inject_code',
'apache_child_terminate',
'apache_setenv',
'apache_note',
'define_syslog_variables',
// Encoding
'escapeshellarg',
'escapeshellcmd',
'base64_decode',
'urldecode',
'rawurldecode',
'str_rot13',
'preg_replace',
'create_function',
// Information Disclosure
'phpinfo',
'posix_mkfifo',
'posix_getlogin',
'posix_ttyname',
'getenv',
'get_current_user',
'proc_get_status',
'get_cfg_var',
'disk_free_space',
'disk_total_space',
'diskfreespace',
'getcwd',
'getlastmo',
'getmygid',
'getmyinode',
'getmypid',
'getmyuid',
// Callback functions
'ob_start',
'array_diff_uassoc',
'array_diff_ukey',
'array_filter',
'array_intersect_uassoc',
'array_intersect_ukey',
'array_map',
'array_reduce',
'array_udiff_assoc',
'array_udiff_uassoc',
'array_udiff',
'array_uintersect_assoc',
'array_uintersect_uassoc',
'array_uintersect',
'array_walk_recursive',
'array_walk',
'assert_options',
'uasort',
'uksort',
'usort',
'preg_replace_callback',
'spl_autoload_register',
'iterator_apply',
'call_user_func',
'call_user_func_array',
'register_shutdown_function',
'register_tick_function',
'set_error_handler',
'set_exception_handler',
'session_set_save_handler',
'sqlite_create_aggregate',
'sqlite_create_function',
];

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ class Scanner
*/
public static $functionsEncoded = [];


/**
* Functions encoded values.
*
Expand Down Expand Up @@ -1003,7 +1002,7 @@ public function scanFile($info)
*/
foreach ($encoders as $encoder) {
$key = $funcRaw . $encoder;
if(isset(self::$functionsEncodedValues[$key])) {
if (isset(self::$functionsEncodedValues[$key])) {
$value = self::$functionsEncodedValues[$key];
} else {
$value = @$encoder($funcRaw);
Expand Down

0 comments on commit 459d75d

Please sign in to comment.