|
| 1 | +REPORT = {} |
| 2 | +VALID = false |
| 3 | + |
| 4 | +SQLI_ERRORS = { |
| 5 | + "SQL syntax.*?MySQL", |
| 6 | + "Warning.*?\\Wmysqli?_", |
| 7 | + "MySQLSyntaxErrorException", |
| 8 | + "valid MySQL result", |
| 9 | + "check the manual that (corresponds to|fits) your MySQL server version", |
| 10 | + "Unknown column '[^ ]+' in 'field list'", |
| 11 | + "MySqlClient\\.", |
| 12 | + "com\\.mysql\\.jdbc", |
| 13 | + "Zend_Db_(Adapter|Statement)_Mysqli_Exception", |
| 14 | + "Pdo[./_\\]Mysql", |
| 15 | + "MySqlException", |
| 16 | + "SQLSTATE\\[\\d+\\]: Syntax error or access violation", |
| 17 | + "check the manual that (corresponds to|fits) your MariaDB server version", |
| 18 | + "check the manual that (corresponds to|fits) your Drizzle server version", |
| 19 | + "MemSQL does not support this type of query", |
| 20 | + "is not supported by MemSQL", |
| 21 | + "unsupported nested scalar subselect", |
| 22 | + "PostgreSQL.*?ERROR", |
| 23 | + "Warning.*?\\Wpg_", |
| 24 | + "valid PostgreSQL result", |
| 25 | + "Npgsql\\.", |
| 26 | + "PG::SyntaxError:", |
| 27 | + "org\\.postgresql\\.util\\.PSQLException", |
| 28 | + "ERROR:\\s\\ssyntax error at or near", |
| 29 | + "ERROR: parser: parse error at or near", |
| 30 | + "PostgreSQL query failed", |
| 31 | + "org\\.postgresql\\.jdbc", |
| 32 | + "Pdo[./_\\]Pgsql", |
| 33 | + "PSQLException", |
| 34 | + "Driver.*? SQL[\\-\\_\\ ]*Server", |
| 35 | + "OLE DB.*? SQL Server", |
| 36 | + "\bSQL Server[^<"]+Driver", |
| 37 | + "Warning.*?\\W(mssql|sqlsrv)_", |
| 38 | + "\bSQL Server[^<"]+[0-9a-fA-F]{8}", |
| 39 | + "DB-Error.*", |
| 40 | + "System\\.Data\\.SqlClient\\.SqlException\\.(SqlException|SqlConnection\\.OnError)", |
| 41 | + "(?s)Exception.*?\bRoadhouse\\.Cms\\.", |
| 42 | + "Microsoft SQL Native Client error '[0-9a-fA-F]{8}", |
| 43 | + "\\[SQL Server\\]", |
| 44 | + "ODBC SQL Server Driver", |
| 45 | + "ODBC Driver \\d+ for SQL Server", |
| 46 | + "SQLServer JDBC Driver", |
| 47 | + "com\\.jnetdirect\\.jsql", |
| 48 | + "macromedia\\.jdbc\\.sqlserver", |
| 49 | + "Zend_Db_(Adapter|Statement)_Sqlsrv_Exception", |
| 50 | + "com\\.microsoft\\.sqlserver\\.jdbc", |
| 51 | + "Pdo[./_\\](Mssql|SqlSrv)", |
| 52 | + "SQL(Srv|Server)Exception", |
| 53 | + "Unclosed quotation mark after the character string", |
| 54 | + "Microsoft Access (\\d+ )?Driver", |
| 55 | + "JET Database Engine", |
| 56 | + "Access Database Engine", |
| 57 | + "ODBC Microsoft Access", |
| 58 | + "Syntax error \\(missing operator\\) in query expression", |
| 59 | + "\bORA-\\d{5}", |
| 60 | + "Oracle error", |
| 61 | + "Oracle.*?Driver", |
| 62 | + "Warning.*?\\W(oci|ora)_", |
| 63 | + "quoted string not properly terminated", |
| 64 | + "SQL command not properly ended", |
| 65 | + "macromedia\\.jdbc\\.oracle", |
| 66 | + "oracle\\.jdbc", |
| 67 | + "Zend_Db_(Adapter|Statement)_Oracle_Exception", |
| 68 | + "Pdo[./_\\](Oracle|OCI)", |
| 69 | + "OracleException", |
| 70 | + "CLI Driver.*?DB2", |
| 71 | + "DB2 SQL error", |
| 72 | + "\bdb2_\\w+\\(", |
| 73 | + "SQLCODE[=:\\d, -]+SQLSTATE", |
| 74 | + "com\\.ibm\\.db2\\.jcc", |
| 75 | + "Zend_Db_(Adapter|Statement)_Db2_Exception", |
| 76 | + "Pdo[./_\\]Ibm", |
| 77 | + "DB2Exception", |
| 78 | + "ibm_db_dbi\\.ProgrammingError", |
| 79 | + "Warning.*?\\Wifx_", |
| 80 | + "Exception.*?Informix", |
| 81 | + "Informix ODBC Driver", |
| 82 | + "ODBC Informix driver", |
| 83 | + "com\\.informix\\.jdbc", |
| 84 | + "weblogic\\.jdbc\\.informix", |
| 85 | + "Pdo[./_\\]Informix", |
| 86 | + "IfxException", |
| 87 | + "Dynamic SQL Error", |
| 88 | + "Warning.*?\\Wibase_", |
| 89 | + "org\\.firebirdsql\\.jdbc", |
| 90 | + "Pdo[./_\\]Firebird", |
| 91 | + "SQLite/JDBCDriver", |
| 92 | + "SQLite\\.Exception", |
| 93 | + "(Microsoft|System)\\.Data\\.SQLite\\.SQLiteException", |
| 94 | + "Warning.*?\\W(sqlite_|SQLite3::)", |
| 95 | + "\\[SQLITE_ERROR\\]", |
| 96 | + "SQLite error \\d+:", |
| 97 | + "sqlite3.OperationalError:", |
| 98 | + "SQLite3::SQLException", |
| 99 | + "org\\.sqlite\\.JDBC", |
| 100 | + "Pdo[./_\\]Sqlite", |
| 101 | + "SQLiteException", |
| 102 | + "SQL error.*?POS([0-9]+)", |
| 103 | + "Warning.*?\\Wmaxdb_", |
| 104 | + "DriverSapDB", |
| 105 | + "-3014.*?Invalid end of SQL statement", |
| 106 | + "com\\.sap\\.dbtech\\.jdbc", |
| 107 | + "\\[-3008\\].*?: Invalid keyword or missing delimiter", |
| 108 | + "Warning.*?\\Wsybase_", |
| 109 | + "Sybase message", |
| 110 | + "Sybase.*?Server message", |
| 111 | + "SybSQLException", |
| 112 | + "Sybase\\.Data\\.AseClient", |
| 113 | + "com\\.sybase\\.jdbc", |
| 114 | + "Warning.*?\\Wingres_", |
| 115 | + "Ingres SQLSTATE", |
| 116 | + "Ingres\\W.*?Driver", |
| 117 | + "com\\.ingres\\.gcf\\.jdbc", |
| 118 | + "Exception (condition )?\\d+\\. Transaction rollback", |
| 119 | + "com\\.frontbase\\.jdbc", |
| 120 | + "Syntax error 1. Missing", |
| 121 | + "(Semantic|Syntax) error [1-4]\\d{2}\\.", |
| 122 | + "Unexpected end of command in statement \\[", |
| 123 | + "Unexpected token.*?in statement \\[", |
| 124 | + "org\\.hsqldb\\.jdbc", |
| 125 | + "org\\.h2\\.jdbc", |
| 126 | + "\\[42000-192\\]", |
| 127 | + "![0-9]{5}![^]", |
| 128 | + "]+(failed|unexpected|error|syntax|expected|violation|exception)", |
| 129 | + "\\[MonetDB\\]\\[ODBC Driver", |
| 130 | + "nl\\.cwi\\.monetdb\\.jdbc", |
| 131 | + "Syntax error: Encountered", |
| 132 | + "org\\.apache\\.derby", |
| 133 | + "ERROR 42X01", |
| 134 | + ", Sqlstate: (3F|42).{3}, (Routine|Hint|Position):", |
| 135 | + "/vertica/Parser/scan", |
| 136 | + "com\\.vertica\\.jdbc", |
| 137 | + "org\\.jkiss\\.dbeaver\\.ext\\.vertica", |
| 138 | + "com\\.vertica\\.dsi\\.dataengine", |
| 139 | + "com\\.mckoi\\.JDBCDriver", |
| 140 | + "com\\.mckoi\\.database\\.jdbc", |
| 141 | + "<REGEX_LITERAL>", |
| 142 | + "com\\.facebook\\.presto\\.jdbc", |
| 143 | + "io\\.prestosql\\.jdbc", |
| 144 | + "com\\.simba\\.presto\\.jdbc", |
| 145 | + "UNION query has different number of fields: \\d+, \\d+", |
| 146 | + "Altibase\\.jdbc\\.driver", |
| 147 | + "com\\.mimer\\.jdbc", |
| 148 | + "Syntax error,[^", |
| 149 | + "]+assumed to mean", |
| 150 | + "io\\.crate\\.client\\.jdbc", |
| 151 | + "encountered after end of query", |
| 152 | + "A comparison operator is required here", |
| 153 | + "-10048: Syntax error", |
| 154 | + "rdmStmtPrepare\\(.+?\\) returned", |
| 155 | + "SQ074: Line \\d+:", |
| 156 | + "SR185: Undefined procedure", |
| 157 | + "SQ200: No table", |
| 158 | + "Virtuoso S0002 Error", |
| 159 | + "\\[(Virtuoso Driver|Virtuoso iODBC Driver)\\]\\[Virtuoso Server\\]" |
| 160 | +} |
| 161 | + |
| 162 | + |
| 163 | +PAYLOADS = { |
| 164 | + "'123", |
| 165 | + "''123", |
| 166 | + "`123", |
| 167 | + "\")123", |
| 168 | + "\"))123", |
| 169 | + "`)123", |
| 170 | + "`))123", |
| 171 | + "'))123", |
| 172 | + "')123\"123", |
| 173 | + "[]123", |
| 174 | + "\"\"123", |
| 175 | + "'\"123", |
| 176 | + "\"'123", |
| 177 | + "\123", |
| 178 | +} |
| 179 | + |
| 180 | +function main(param,url) |
| 181 | + local resp = send_req(url) |
| 182 | + if resp.body:GetStrOrNil() == "" then |
| 183 | + return REPORT |
| 184 | + end |
| 185 | + |
| 186 | + for index_key,index_value in ipairs(SQLI_ERRORS) do |
| 187 | + local match = is_match(index_value,resp.body:GetStrOrNil()) |
| 188 | + if ( match == false or match == nil) then |
| 189 | + -- NOTHING |
| 190 | + else |
| 191 | + REPORT["url"] = url |
| 192 | + REPORT["match"] = index_value |
| 193 | + REPORT["payload"] = current_payload |
| 194 | + VALID = true |
| 195 | + println(string.format("SQLI ERROR: %s",url)) |
| 196 | + return 1 |
| 197 | + end |
| 198 | + end |
| 199 | + return REPORT |
| 200 | +end |
| 201 | + |
| 202 | +function payloads_gen(url) |
| 203 | + all_payloads = {} |
| 204 | + if string.find(url,"?") then |
| 205 | + for index_key, payload_value in ipairs(PAYLOADS) do |
| 206 | + new_querys = change_urlquery(url,payload_value) |
| 207 | + for pay_index, pay_value in pairs(new_querys) do |
| 208 | + table.insert(all_payloads,pay_value) |
| 209 | + end |
| 210 | + end |
| 211 | + end |
| 212 | + return REPORT |
| 213 | +end |
| 214 | + |
0 commit comments