PiggyArchive / PiggyAuth

Safe & feature-rich auth plugin. Project has been discontinued
Apache License 2.0
33 stars 8 forks source link

Horrible chat lag when checking if chat messages are passwords #56

Closed DaPigGuy closed 7 years ago

DaPigGuy commented 7 years ago

DO NOT REMOVE THIS

Please make sure your issue complies with these guidelines:

General

When players chat, there is horrible lag when checking if messages are the password. (Currently removed from PiggyAuth) #### **Server Software:** PMMP #### **Version of PiggyAuth:** 3.0.0.10 #### **Data Provider:**

Steps to Reproduce the Issue

  1. Chat a lot

Extra Information

AnUnknownPerson commented 7 years ago

Were in the code is it set to check for passwords?

DaPigGuy commented 7 years ago

EventListener

AnUnknownPerson commented 7 years ago

Show me the code were it checks please.

DaPigGuy commented 7 years ago

EventListener Line 194

AnUnknownPerson commented 7 years ago

OK let me see

AnUnknownPerson commented 7 years ago

What test server are you using? 1 how are you hosting? 2 how Much ram do you have 3 how Much ram have you used? 4 what plugins are installed?

Thunder33345 commented 7 years ago

it probably the same regardless of details like ram etc, since you are querying not via async

Aericio commented 7 years ago

That shouldn't matter, you can have a server with one player and you can notice it.

AnUnknownPerson commented 7 years ago

@MCPEPIG @Aericio @Thunder33345 hmm can I see a video or a clip of it!?

AnUnknownPerson commented 7 years ago

@MCPEPIG @Thunder33345 @Aericio us there any error or spam in the console?

Aericio commented 7 years ago

Me and @MCPEPIG already tested & confirmed this bug... there are no errors.

DaPigGuy commented 7 years ago

Confirmed by 3 people on 3 different servers using PiggyAuth.

AnUnknownPerson commented 7 years ago

Hmm ok

SleepSpace9 commented 7 years ago

I agree to @Thunder33345 that is has to be done via async. To compare chat message and password it has to be generated a hash, which is almost done extra slow for security reasons. (https://github.com/MCPEPIG/PiggyAuth/blob/master/src/PiggyAuth/Main.php#L240) But also via async there would probably be a noticeable delay before it sends the message. I'm really unsure if there is a secure solution for this issue.

Thunder33345 commented 7 years ago

just include an option to not check it for now some owners dont really think this is a necessary feature at the price of speed, also how hereauth did it?

and other plugins who does anti share pwd things??

SleepSpace9 commented 7 years ago

I think other plugins are using weaker hash algorithms so they are more easy to brute-force. HereAuth and SimpleAuth are using a combination of salted SHA-512 and Whirlpool hash. PiggyAuth is using BCrypt which is designed to make it hard to brute-force. You could try reducing the cost value in config.yml which should also reduce the amount of time to compute: https://github.com/MCPEPIG/PiggyAuth/blob/master/resources/config.yml#L166

SalmonDE commented 7 years ago

Is this really only related to chat messages? I'm experiencing a lag spike here when a player uses /login.

SalmonDE commented 7 years ago

I believe this is fixed in #76