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

Hashes over 65535 in length triggers database error #841

Closed
rixvet opened this issue Dec 16, 2022 · 1 comment · Fixed by #867
Closed

Hashes over 65535 in length triggers database error #841

rixvet opened this issue Dec 16, 2022 · 1 comment · Fixed by #867
Labels
enhancement Enhancement of existing features / Small addition

Comments

@rixvet
Copy link
Collaborator

rixvet commented Dec 16, 2022

The ./hashcat/tools/luks2hashcat.py tooling (can) produce hashes which are over 65535 in length. Which are to be used together with LUKS hash algoritm 29521 (new in hashcat 6.2.6). When trying to insert into this into hashtopolis it triggers an database error:

PHP Fatal error:  Uncaught PDOException: 
SQLSTATE[42000]: Syntax error or access violation: 1074 Column length too big for column 'hash' (max = 65535); use BLOB or TEXT instead in /var/www/hashtopolis/inc/Util.class.php:1301\nStack trace:\n#0
/var/www/hashtopolis/inc/Util.class.php(1301): PDO->query('ALTER TABLE
Has...')\n#1 /var/www/hashtopolis/inc/utils/ConfigUtils.class.php(88): 
Util::setMaxHashLength(264000)\n#2
/var/www/hashtopolis/inc/handlers/ConfigHandler.class.php(13): 
ConfigUtils::updateConfig(Array)\n#3
/var/www/hashtopolis/config.php(22): 
ConfigHandler->handle('updateConfig')\n#4 {main}\n  thrown in
/var/www/hashtopolis/inc/Util.class.php on line 1301

Unable to insert long hashes has been reported a while ago in #184 and #324 how-ever both tickets are closed, allowing me to make a fresh one, since IMHO the issue still persist.

One suggestion would be to use a different way of storing large hashes in the database e.g.:

diff --git a/src/install/hashtopolis.sql b/src/install/hashtopolis.sql
index 1b357b35..c3faff58 100644
--- a/src/install/hashtopolis.sql
+++ b/src/install/hashtopolis.sql
@@ -237,7 +237,7 @@ CREATE TABLE `FileDelete` (
 CREATE TABLE `Hash` (
   `hashId`      INT(11)      NOT NULL,
   `hashlistId`  INT(11)      NOT NULL,
-  `hash`        TEXT         NOT NULL,
+  `hash`        MEDIUMTEXT   NOT NULL,
   `salt`        VARCHAR(256) DEFAULT NULL,
   `plaintext`   VARCHAR(256) DEFAULT NULL,
   `timeCracked` BIGINT       DEFAULT NULL,

How-ever I am not sure whether this has unwanted side-effects.

@zyronix
Copy link
Member

zyronix commented Jan 17, 2023

Note for self: Double check how indexing of mysql is dealing with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing features / Small addition
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants