expose icon indicating copy to clipboard operation
expose copied to clipboard

SQL Injection

Open WindowsNT opened this issue 8 years ago • 8 comments

Are the filters configured to detect a SQL injection attempt?

I passed

anything' OR '1'='1

to one form and it didn't detect it.

WindowsNT avatar Apr 28 '18 15:04 WindowsNT

Yes, it should detect SQLi as per filter_rules.json#L517-L529. If not, then the filter may have gotten broken. I had opened https://github.com/enygma/expose/issues/58 in hopes of having better quality checks on new/old/modified rules.

quantumpacket avatar Apr 28 '18 18:04 quantumpacket

Because this rule does not include ' char?

tranba avatar May 21 '18 10:05 tranba

@tranba quotes are normalized here src/Expose/Converter/ConvertMisc.php#L80-L94 if that is not done then the patterns would be overly complex with having to match each and every variation of quote use.

quantumpacket avatar May 21 '18 17:05 quantumpacket

@quantumpacket I've found a problem in the run function: https://github.com/enygma/expose/blob/07ee1ebe5af6a23029d4d30147463141df724fc5/src/Expose/Manager.php#L125-L129

Convert only apply to the first level of data array, then for example $data = array( 'POST' = array('dirty' => " a ' or 1 = 1") ) will bypass

tranba avatar May 23 '18 05:05 tranba

@enygma Have not tested the below, but would using array_walk_recursive() suffice for the above? We may want to also check that recursion is being done in other areas as well. [ DEMO ]

src/Expose/Manager.php

        // try to clean up standard filter bypass methods
        array_walk_recursive($data, [new \Expose\Converter\Converter, 'runAllConversions']);

        $path = array();
        // ...

src/Expose/Converter/Converter.php

    public function runAllConversions(&$value)
    {
        // ...
        // return $value;

Might I suggest running the rules against https://github.com/minimaxir/big-list-of-naughty-strings as part of the unit tests?

Also on a side-note, would you be interested in a Python3 port of Expose?

quantumpacket avatar May 24 '18 16:05 quantumpacket

Seems anything' OR '1'='1 doesn't match with rules

Below are matched:

a' or 1=1;# a' or 1=1;--

yehgdotnet avatar Jul 14 '19 16:07 yehgdotnet

@yehgdotnet what was the downvote for? Did the code not work or is the rule itself broken?

quantumpacket avatar Jul 14 '19 19:07 quantumpacket

@yehgdotnet what was the downvote for? Did the code not work or is the rule itself broken?

wrong click, was too sleepy, cheers

yehgdotnet avatar Jul 14 '19 23:07 yehgdotnet