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

Add keywords for error reporting injection and case injection #154

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Liang2580
Copy link

chinese: 增加对报错注入的优化和对case的优化
English: Add keywords for error reporting injection and case injection

增加对 - 结尾的优化
Increase the optimization of - ending

As follows:
`static size_t parse_dash(struct libinjection_sqli_state * sf)
{
const char *cs = sf->s;
const size_t slen = sf->slen;
size_t pos = sf->pos;

/*

  • five cases
    1. --[white] this is always a SQL comment
    1. --[EOF] this is a comment
    1. --[notwhite] in MySQL this is NOT a comment but two unary operators
    1. --[notwhite] everyone else thinks this is a comment
    1. -[not dash] '-' is a unary operator
      */

if (pos + 2 == slen && cs[pos + 1] == '-' && char_is_white(cs[pos+2]) ) {
return parse_eol_comment(sf);
} else if (pos +2 == slen && cs[pos + 1] == '-') {
return parse_eol_comment(sf);
} else if (pos + 1 == slen && cs[pos + 1] == '-' && (sf->flags & FLAG_SQL_ANSI)) {
/* --[not-white] not-white case:
*
*/
sf->stats_comment_ddx += 1;
return parse_eol_comment(sf);
} else {
st_assign_char(sf->current, TYPE_OPERATOR, pos, 1, '-');
return pos + 1;
}
}`

Optimize the treatment of -
Add keywords for error reporting injection and case injection
@Liang2580
Copy link
Author

Error injection test case:

and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a); and (extractvalue(1,concat(0x7e,(select user()),0x7e))); and (updatexml(1,concat(0x7e,(select user()),0x7e),1)); and geometrycollection((select * from(select * from(select user())a)b)); and multipoint((select * from(select * from(select user())a)b)); and polygon((select * from(select * from(select user())a)b)); and multipolygon((select * from(select * from(select user())a)b)); and linestring((select * from(select * from(select user())a)b)); and multilinestring((select * from(select * from(select user())a)b)); and exp(~(select * from(select user())a));

case else test case
' or 1=case when current_user like 'dvwa%' then 1 else 3*1e08 end or 1=x'
'-1=x'

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

Successfully merging this pull request may close these issues.

1 participant