1
1
/**
2
- * Copyright 2012,2013 Nick Galbreath
2
+ * Copyright 2012,2016 Nick Galbreath
3
3
4
4
* BSD License -- see COPYING.txt for details
5
5
*
@@ -187,11 +187,11 @@ static int char_is_white(char ch) {
187
187
/* ' ' space is 0x32
188
188
'\t 0x09 \011 horizontal tab
189
189
'\n' 0x0a \012 new line
190
- '\v' 0x0b \013 verical tab
190
+ '\v' 0x0b \013 vertical tab
191
191
'\f' 0x0c \014 new page
192
192
'\r' 0x0d \015 carriage return
193
193
0x00 \000 null (oracle)
194
- 0xa0 \240 is latin1
194
+ 0xa0 \240 is Latin-1
195
195
*/
196
196
return strchr (" \t\n\v\f\r\240\000" , ch ) != NULL ;
197
197
}
@@ -290,7 +290,7 @@ static void st_clear(stoken_t * st)
290
290
static void st_assign_char (stoken_t * st , const char stype , size_t pos , size_t len ,
291
291
const char value )
292
292
{
293
- /* done to elimiate unused warning */
293
+ /* done to eliminate unused warning */
294
294
(void )len ;
295
295
st -> type = (char ) stype ;
296
296
st -> pos = pos ;
@@ -398,7 +398,7 @@ static size_t parse_eol_comment(struct libinjection_sqli_state * sf)
398
398
}
399
399
}
400
400
401
- /** In Ansi mode, hash is an operator
401
+ /** In ANSI mode, hash is an operator
402
402
* In MYSQL mode, it's a EOL comment like '--'
403
403
*/
404
404
static size_t parse_hash (struct libinjection_sqli_state * sf )
@@ -1526,7 +1526,7 @@ int libinjection_sqli_fold(struct libinjection_sqli_state * sf)
1526
1526
continue ;
1527
1527
} else if ((sf -> tokenvec [left ].type == TYPE_BAREWORD || sf -> tokenvec [left ].type == TYPE_VARIABLE ) &&
1528
1528
sf -> tokenvec [left + 1 ].type == TYPE_LEFTPARENS && (
1529
- /* TSQL functions but common enough to be collumn names */
1529
+ /* TSQL functions but common enough to be column names */
1530
1530
cstrcasecmp ("USER_ID" , sf -> tokenvec [left ].val , sf -> tokenvec [left ].len ) == 0 ||
1531
1531
cstrcasecmp ("USER_NAME" , sf -> tokenvec [left ].val , sf -> tokenvec [left ].len ) == 0 ||
1532
1532
@@ -1549,7 +1549,7 @@ int libinjection_sqli_fold(struct libinjection_sqli_state * sf)
1549
1549
1550
1550
/* pos is the same
1551
1551
* other conversions need to go here... for instance
1552
- * password CAN be a function, coalese CAN be a function
1552
+ * password CAN be a function, coalesce CAN be a function
1553
1553
*/
1554
1554
sf -> tokenvec [left ].type = TYPE_FUNCTION ;
1555
1555
continue ;
@@ -1813,7 +1813,7 @@ int libinjection_sqli_fold(struct libinjection_sqli_state * sf)
1813
1813
* 1,-sin(1) --> 1 (1)
1814
1814
* Here, just do
1815
1815
* 1,-sin(1) --> 1,sin(1)
1816
- * just remove unary opartor
1816
+ * just remove unary operator
1817
1817
*/
1818
1818
st_copy (& sf -> tokenvec [left + 1 ], & sf -> tokenvec [left + 2 ]);
1819
1819
pos -= 1 ;
@@ -2016,7 +2016,7 @@ int libinjection_sqli_blacklist(struct libinjection_sqli_state* sql_state)
2016
2016
}
2017
2017
2018
2018
/*
2019
- * return TRUE if sqli , false is benign
2019
+ * return TRUE if SQLi , false is benign
2020
2020
*/
2021
2021
int libinjection_sqli_not_whitelist (struct libinjection_sqli_state * sql_state )
2022
2022
{
@@ -2030,10 +2030,10 @@ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state* sql_state)
2030
2030
2031
2031
if (tlen > 1 && sql_state -> fingerprint [tlen - 1 ] == TYPE_COMMENT ) {
2032
2032
/*
2033
- * if ending comment is contains 'sp_password' then it's sqli !
2033
+ * if ending comment is contains 'sp_password' then it's SQLi !
2034
2034
* MS Audit log apparently ignores anything with
2035
- * 'sp_password' in it. Unable to find primary refernece to
2036
- * this "feature" of SQL Server but seems to be known sqli
2035
+ * 'sp_password' in it. Unable to find primary reference to
2036
+ * this "feature" of SQL Server but seems to be known SQLi
2037
2037
* technique
2038
2038
*/
2039
2039
if (my_memmem (sql_state -> s , sql_state -> slen ,
@@ -2052,7 +2052,7 @@ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state* sql_state)
2052
2052
2053
2053
if (sql_state -> fingerprint [1 ] == TYPE_UNION ) {
2054
2054
if (sql_state -> stats_tokens == 2 ) {
2055
- /* not sure why but 1U comes up in Sqli attack
2055
+ /* not sure why but 1U comes up in SQLi attack
2056
2056
* likely part of parameter splitting/etc.
2057
2057
* lots of reasons why "1 union" might be normal
2058
2058
* input, so beep only if other SQLi things are present
@@ -2077,7 +2077,7 @@ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state* sql_state)
2077
2077
2078
2078
/*
2079
2079
* for fingerprint like 'nc', only comments of /x are treated
2080
- * as SQL... ending comments of "--" and "#" are not sqli
2080
+ * as SQL... ending comments of "--" and "#" are not SQLi
2081
2081
*/
2082
2082
if (sql_state -> tokenvec [0 ].type == TYPE_BAREWORD &&
2083
2083
sql_state -> tokenvec [1 ].type == TYPE_COMMENT &&
@@ -2087,7 +2087,7 @@ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state* sql_state)
2087
2087
}
2088
2088
2089
2089
/*
2090
- * if '1c' ends with '/x' then it's sqli
2090
+ * if '1c' ends with '/x' then it's SQLi
2091
2091
*/
2092
2092
if (sql_state -> tokenvec [0 ].type == TYPE_NUMBER &&
2093
2093
sql_state -> tokenvec [1 ].type == TYPE_COMMENT &&
@@ -2110,13 +2110,13 @@ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state* sql_state)
2110
2110
if (sql_state -> tokenvec [0 ].type == TYPE_NUMBER &&
2111
2111
sql_state -> tokenvec [1 ].type == TYPE_COMMENT ) {
2112
2112
if (sql_state -> stats_tokens > 2 ) {
2113
- /* we have some folding going on, highly likely sqli */
2113
+ /* we have some folding going on, highly likely SQLi */
2114
2114
sql_state -> reason = __LINE__ ;
2115
2115
return TRUE;
2116
2116
}
2117
2117
/*
2118
2118
* we check that next character after the number is either whitespace,
2119
- * or '/' or a '-' ==> sqli .
2119
+ * or '/' or a '-' ==> SQLi .
2120
2120
*/
2121
2121
ch = sql_state -> s [sql_state -> tokenvec [0 ].len ];
2122
2122
if ( ch <= 32 ) {
@@ -2138,7 +2138,7 @@ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state* sql_state)
2138
2138
}
2139
2139
2140
2140
/*
2141
- * detect obvious sqli scans.. many people put '--' in plain text
2141
+ * detect obvious SQLi scans.. many people put '--' in plain text
2142
2142
* so only detect if input ends with '--', e.g. 1-- but not 1-- foo
2143
2143
*/
2144
2144
if ((sql_state -> tokenvec [1 ].len > 2 )
@@ -2174,7 +2174,7 @@ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state* sql_state)
2174
2174
}
2175
2175
2176
2176
/*
2177
- * not sqli
2177
+ * not SQLi
2178
2178
*/
2179
2179
sql_state -> reason = __LINE__ ;
2180
2180
return FALSE;
@@ -2183,8 +2183,8 @@ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state* sql_state)
2183
2183
streq (sql_state -> fingerprint , "1&1" ) ||
2184
2184
streq (sql_state -> fingerprint , "1&v" ) ||
2185
2185
streq (sql_state -> fingerprint , "1&s" )) {
2186
- /* 'sexy and 17' not sqli
2187
- * 'sexy and 17<18' sqli
2186
+ /* 'sexy and 17' not SQLi
2187
+ * 'sexy and 17<18' SQLi
2188
2188
*/
2189
2189
if (sql_state -> stats_tokens == 3 ) {
2190
2190
sql_state -> reason = __LINE__ ;
@@ -2240,7 +2240,7 @@ int libinjection_is_sqli(struct libinjection_sqli_state * sql_state)
2240
2240
size_t slen = sql_state -> slen ;
2241
2241
2242
2242
/*
2243
- * no input? not sqli
2243
+ * no input? not SQLi
2244
2244
*/
2245
2245
if (slen == 0 ) {
2246
2246
return FALSE;
0 commit comments