diff --git a/lib/core/agent.py b/lib/core/agent.py
index f44c369cb..c6827461d 100644
--- a/lib/core/agent.py
+++ b/lib/core/agent.py
@@ -480,7 +480,7 @@ class Agent(object):
@rtype: C{str}
"""
- prefixRegex = r"(?:\s+(?:FIRST|SKIP)\s+\d+)*"
+ prefixRegex = r"(?:\s+(?:FIRST|SKIP|LIMIT \d+)\s+\d+)*"
fieldsSelectTop = re.search(r"\ASELECT\s+TOP\s+[\d]+\s+(.+?)\s+FROM", query, re.I)
fieldsSelectRownum = re.search(r"\ASELECT\s+([^()]+?),\s*ROWNUM AS LIMIT FROM", query, re.I)
fieldsSelectDistinct = re.search(r"\ASELECT%s\s+DISTINCT\((.+?)\)\s+FROM" % prefixRegex, query, re.I)
@@ -508,7 +508,10 @@ class Agent(object):
elif fieldsSelectRownum:
fieldsToCastStr = fieldsSelectRownum.groups()[0]
elif fieldsSelectDistinct:
- fieldsToCastStr = fieldsSelectDistinct.groups()[0]
+ if Backend.getDbms() in (DBMS.HSQLDB,):
+ fieldsToCastStr = fieldsNoSelect
+ else:
+ fieldsToCastStr = fieldsSelectDistinct.groups()[0]
elif fieldsSelectCase:
fieldsToCastStr = fieldsSelectCase.groups()[0]
elif fieldsSelectFrom:
@@ -888,6 +891,10 @@ class Agent(object):
limitStr = queries[Backend.getIdentifiedDbms()].limit.query % (num, 1)
limitedQuery += " %s" % limitStr
+ elif Backend.isDbms(DBMS.HSQLDB):
+ limitStr = queries[Backend.getIdentifiedDbms()].limit.query % (1, num)
+ limitedQuery += " %s" % limitStr
+
elif Backend.isDbms(DBMS.FIREBIRD):
limitStr = queries[Backend.getIdentifiedDbms()].limit.query % (num + 1, num + 1)
limitedQuery += " %s" % limitStr
diff --git a/lib/core/dump.py b/lib/core/dump.py
index 03caf233b..058f5d9e9 100644
--- a/lib/core/dump.py
+++ b/lib/core/dump.py
@@ -160,7 +160,7 @@ class Dump(object):
def currentDb(self, data):
if Backend.isDbms(DBMS.MAXDB):
self.string("current database (no practical usage on %s)" % Backend.getIdentifiedDbms(), data, content_type=CONTENT_TYPE.CURRENT_DB)
- elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.PGSQL):
+ elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.PGSQL, DBMS.HSQLDB):
self.string("current schema (equivalent to database on %s)" % Backend.getIdentifiedDbms(), data, content_type=CONTENT_TYPE.CURRENT_DB)
else:
self.string("current database", data, content_type=CONTENT_TYPE.CURRENT_DB)
diff --git a/lib/core/settings.py b/lib/core/settings.py
index 3256c0fa1..3b53705ba 100644
--- a/lib/core/settings.py
+++ b/lib/core/settings.py
@@ -222,6 +222,8 @@ USER_AGENT_ALIASES = ("ua", "useragent", "user-agent")
REFERER_ALIASES = ("ref", "referer", "referrer")
HOST_ALIASES = ("host",)
+HSQLDB_DEFAULT_SCHEMA = "PUBLIC"
+
# Names that can't be used to name files on Windows OS
WINDOWS_RESERVED_NAMES = ("CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9")
diff --git a/plugins/dbms/hsqldb/enumeration.py b/plugins/dbms/hsqldb/enumeration.py
index 9bf2b9b23..67744d4b5 100644
--- a/plugins/dbms/hsqldb/enumeration.py
+++ b/plugins/dbms/hsqldb/enumeration.py
@@ -12,6 +12,7 @@ from lib.core.data import logger
from lib.core.data import queries
from lib.core.common import Backend
from lib.core.common import unArrayizeValue
+from lib.core.settings import HSQLDB_DEFAULT_SCHEMA
from lib.request import inject
class Enumeration(GenericEnumeration):
@@ -40,3 +41,6 @@ class Enumeration(GenericEnumeration):
def getHostname(self):
warnMsg = "on HSQLDB it is not possible to enumerate the hostname"
logger.warn(warnMsg)
+
+ def getCurrentDb(self):
+ return HSQLDB_DEFAULT_SCHEMA
diff --git a/plugins/generic/databases.py b/plugins/generic/databases.py
index b9eed29b9..ed3ac32eb 100644
--- a/plugins/generic/databases.py
+++ b/plugins/generic/databases.py
@@ -674,7 +674,7 @@ class Databases:
continue
for index in getLimitRange(count):
- if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL):
+ if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.HSQLDB):
query = rootQuery.blind.query % (unsafeSQLIdentificatorNaming(tbl), unsafeSQLIdentificatorNaming(conf.db))
query += condQuery
field = None
diff --git a/plugins/generic/entries.py b/plugins/generic/entries.py
index 6dc5fe8c4..ec1dc8640 100644
--- a/plugins/generic/entries.py
+++ b/plugins/generic/entries.py
@@ -296,7 +296,7 @@ class Entries:
if column not in entries:
entries[column] = BigArray()
- if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL):
+ if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.HSQLDB):
query = rootQuery.blind.query % (agent.preprocessField(tbl, column), conf.db, conf.tbl, sorted(colList, key=len)[0], index)
elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):
query = rootQuery.blind.query % (agent.preprocessField(tbl, column),
diff --git a/txt/common-columns.txt b/txt/common-columns.txt
index 3464db5fc..6eab10cab 100644
--- a/txt/common-columns.txt
+++ b/txt/common-columns.txt
@@ -2596,3 +2596,7 @@ tmp_lahir
universitas
urut
waktu
+
+# WebGoat
+cookie
+login_count
diff --git a/txt/common-tables.txt b/txt/common-tables.txt
index 9468c9382..e9a488a2d 100644
--- a/txt/common-tables.txt
+++ b/txt/common-tables.txt
@@ -3366,3 +3366,6 @@ tuser
tusers
userstbl
usertbl
+
+# WebGoat
+user_data
diff --git a/xml/queries.xml b/xml/queries.xml
index 75185bca0..c57a5b49f 100644
--- a/xml/queries.xml
+++ b/xml/queries.xml
@@ -652,7 +652,7 @@
-
+
@@ -675,30 +675,30 @@
-
+
-
+
-
+
-
+
-
+
-
+