Giter Club home page Giter Club logo

Comments (12)

ssl avatar ssl commented on June 9, 2024 1

That query appears to work. Before I updated the settings to version 4.2, I ran that query:

mysql> ALTER TABLE `reports` CHANGE `payload` `payload` VARCHAR(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL;
Query OK, 119 rows affected (0.09 sec)
Records: 119  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE reports ADD INDEX(payload);
Query OK, 0 rows affected (0.06 sec)
Records: 0  Duplicates: 0  Warnings: 0

Okay thanks! That confirms my suspicion. Seems like a small bug which happens in certain installs but I will implement some fixes to make sure it doesn't happen again.

Thanks again and have a great night.

from ezxss.

ssl avatar ssl commented on June 9, 2024

Can you check your database and compare it with the sql queries https://github.com/ssl/ezXSS/blob/master/app/sql/4.1-4.2.sql

Im not sure why you got this error, might be from Move data from reportstoreports_data``

Also what is your mysql version?

from ezxss.

geeknik avatar geeknik commented on June 9, 2024

8.0.36-0ubuntu0.23.10.1

My DB structure using query="SELECT table_name AS 'Table', round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB' FROM information_schema.TABLES WHERE table_schema = '$db' ORDER BY (data_length + index_length) DESC;"

reports_data	86.52
reports	83.26
alerts	0.02
console	0.02
logs	0.02
payloads	0.02
sessions	0.02
sessions_data	0.02
users	0.02
settings	0.00

If I need to start over, it's okay, there's nothing in the DB I really need to save.

from ezxss.

ssl avatar ssl commented on June 9, 2024

Does reports_data and sessions_data contain all the data from the reports?

And does the reports/sessions tables still contain these columns or not?

  • dom, screenshot, localstorage, sessionstorage;
  • dom, localstorage, sessionstorage, console;

from ezxss.

ssl avatar ssl commented on June 9, 2024

Going back to the page and trying again gives me this error: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'reports_data' already exists

Also, does this mean the database is still on version 4.1?

from ezxss.

ssl avatar ssl commented on June 9, 2024

Looks like this issue is only on MySQL and not on MariaDB.

It might have todo with the indexes. If all data is correct in reports/sessions_data, and the correct columns got deleted, please check if the indexes got added to the columns. If not, try running it manual and let me know what it says


ALTER TABLE reports ADD INDEX(archive);
ALTER TABLE reports ADD INDEX(payload);
ALTER TABLE reports ADD INDEX(id);
ALTER TABLE reports ADD INDEX(shareid);
ALTER TABLE reports_data ADD INDEX(reportid);

ALTER TABLE sessions ADD INDEX(id);
ALTER TABLE sessions ADD INDEX(payload);
ALTER TABLE sessions ADD INDEX(clientid);
ALTER TABLE sessions ADD INDEX(origin);
ALTER TABLE sessions_data ADD INDEX(sessionid);

ALTER TABLE reports ENGINE INNODB;
ALTER TABLE settings ENGINE INNODB;

from ezxss.

geeknik avatar geeknik commented on June 9, 2024
mysql> ALTER TABLE reports ADD INDEX(archive);
Query OK, 119 rows affected, 1 warning (0.02 sec)
Records: 119  Duplicates: 0  Warnings: 1

mysql> ALTER TABLE reports ADD INDEX(payload);
ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes
mysql> ALTER TABLE reports ADD INDEX(id);
Query OK, 119 rows affected (0.01 sec)
Records: 119  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE reports ADD INDEX(shareid);
Query OK, 119 rows affected (0.04 sec)
Records: 119  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE reports_data ADD INDEX(reportid);
Query OK, 0 rows affected (0.06 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE sessions ADD INDEX(id);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE sessions ADD INDEX(payload);
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE sessions ADD INDEX(clientid);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE sessions ADD INDEX(origin);
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE sessions_data ADD INDEX(sessionid);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE reports ENGINE INNODB;
Query OK, 119 rows affected (0.08 sec)
Records: 119  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE settings ENGINE INNODB;
Query OK, 33 rows affected (0.04 sec)
Records: 33  Duplicates: 0  Warnings: 0

from ezxss.

ssl avatar ssl commented on June 9, 2024

So looks like ALTER TABLE reports ADD INDEX(payload); is the problem. I'm not 100% sure why, but for now, it seems like all other queries got run without an issue and you can just manually change your version to 4.2 in the settings table and everything should work fine.

I will look into the issue but it might be fixable with your server/mysql settings. I will also add a try catch around this code to make sure it doesn't just fail.

from ezxss.

ssl avatar ssl commented on June 9, 2024

Could you check if this query works and fixes it?

ALTER TABLE `reports` CHANGE `payload` `payload` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL;

ALTER TABLE reports ADD INDEX(payload);

from ezxss.

geeknik avatar geeknik commented on June 9, 2024

After I updated the settings to version 4.2, I can login, and everything appears to be working as expected. Thanks!

from ezxss.

ssl avatar ssl commented on June 9, 2024

After I updated the settings to version 4.2, I can login, and everything appears to be working as expected. Thanks!

Amazing!

Could you confirm or deny if the query below gives any errors or fixes the index? Or if not, changing the varchar number to a lower number? I believe it has something todo with MySQL and index sizes. When confirming this I can add a fix to ezXSS to not fail.

Could you check if this query works and fixes it?

ALTER TABLE `reports` CHANGE `payload` `payload` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL;

ALTER TABLE reports ADD INDEX(payload);

from ezxss.

geeknik avatar geeknik commented on June 9, 2024

That query appears to work. Before I updated the settings to version 4.2, I ran that query:

mysql> ALTER TABLE `reports` CHANGE `payload` `payload` VARCHAR(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL;
Query OK, 119 rows affected (0.09 sec)
Records: 119  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE reports ADD INDEX(payload);
Query OK, 0 rows affected (0.06 sec)
Records: 0  Duplicates: 0  Warnings: 0

from ezxss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.