Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

PHP function name bypasses #1274

Closed
lifeforms opened this issue Dec 30, 2018 · 5 comments
Closed

PHP function name bypasses #1274

lifeforms opened this issue Dec 30, 2018 · 5 comments

Comments

@lifeforms
Copy link
Contributor

lifeforms commented Dec 30, 2018

In PHP code, functions are called like system('uname') which triggers our PHP function names blacklist. However, PHP functions can also be called as follows:

# as made famous by https://www.secjuice.com/php-rce-bypass-filters-sanitization-waf/
(system)('uname')         # triggers 942370 by accident
(sy.(st).em)('uname')
(string)"system"('uname')

# some others
define('x', 'sys' . 'tem');
(x)/* comment */('uname');

$y = 'sys'.'tem';
($y)('uname')

define('z', [['sys' .'tem']]);
(z)[0][0]('uname');

Can we block these patterns, for instance with a regular expression?
Probably would be in a higher paranoia level.

@lifeforms lifeforms changed the title PHP function name bypass PHP function name bypasses Dec 30, 2018
@theMiddleBlue
Copy link
Contributor

I think that the idea on rule 942430 about matching anomaly number of special chars is a good way to block this kind of patterns. Probably just for []()"'. could be enough.

define('z', [['sys' .'tem']]);
(z)[0][0]('uname');

I didn't think about this, cool!

@spartantri
Copy link
Contributor

We will catch it as excessive non word chars and things like that not properly classify it as php injection bypass attempt, do somebody knows how to write transforms? it would be really nice to have the php equivalent t:phpdecode functionality to that of t:cmdline for bash as there will be a lot of possible combinations of this.

@theMiddleBlue
Copy link
Contributor

it would be really nice to have the php equivalent t:phpdecode functionality to that of t:cmdline for bash

yeah! it would be nice to have something that executes string concatenation syntaxes like: (sy.(st).e."\x6d") in system

@fgsch
Copy link
Contributor

fgsch commented Mar 8, 2019

Is this resolved by #1294? Can we close it?

@dune73
Copy link
Contributor

dune73 commented Mar 8, 2019

Yes, @theMiddleBlue covered this in #1294. So this is done. Closing now. Please reopen if I'm wrong.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants