mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2026-04-26 10:55:56 +03:00
[GH-ISSUE #71] Why are we storing the password in plain text AND encrypting it? #54
Labels
No labels
Feature
Feature
Is It Really an Issue?
Need More Info
Request
Security
bug
duplicate
enhancement
enhancement
help wanted
invalid
pull-request
question
suggestion
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tinyfilemanager#54
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ghost on GitHub (Oct 17, 2018).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/71
This adds no additional security at all, we need a setup where the user passes the information through a post request, THEN it gets encrypted... of course, looking at this snippet, later we use password_verify, this does nothing to help us
@alecos71 commented on GitHub (Oct 17, 2018):
The password is encrypted, please read the manual... http://php.net/manual/en/function.password-hash.php
no longer exists... now only passwords are encrypted... the user don't need to be encrypted... a security hole has been fixed...
Download the filemanger and read the source!
@ghost commented on GitHub (Oct 17, 2018):
yes but we are encrypting the password in the same file, we encrypt things so people cannot view the password, but the password is still in plain text, even though it gets encrypted on the same file, this adds no extra security at all, say the server was to get hacked, we would see the users password, passing it through encryption and using password verify does nothing though, we could do the same thing with the plain text password and it would be the same
@hpolonkoev commented on GitHub (Oct 17, 2018):
@saderror256
The purpose of the library to be a single file without any database independences (or files with stored data). Therefore the password are stored directly in the file. If you don't want to have your passwords in a plain text, you can hash them beforehand (separatly somewhere else using the
password_hash()) and just add a hash to the array.@alecos71 commented on GitHub (Oct 17, 2018):
There is no way to have encrypted the password in plain text, password_hash and password_verify are used to prevent that the password is sent in clear, when encrypted, the password cannot be hacked in the form login... read the manual before writing: http://php.net/manual/en/function.password-hash.php and http://php.net/manual/en/function.password-verify.php. If the password will be served encrypted in plain text php file would be impossible to change the password because people don't have the chance to modify the password... why do not you read the php manual before writing?
@alecos71 commented on GitHub (Oct 17, 2018):
having a separate php file to generate a password hash would involve two things:
and I cannot figure the security hole if someone has access to gen_password.php for example...
@hpolonkoev commented on GitHub (Oct 17, 2018):
@alecos71
I think you misunderstood the point of @saderror256. He don't "like" the fact that we can see the passwords plain text in php file. That all.
What I tried to suggest is to hash the password somewhere else, copy the hash and replace it in the auth_users array.
I didn't asked to update library (git repository). Just a solution for @saderror256 case. Maybe not the best one.
@alecos71 commented on GitHub (Oct 17, 2018):
Sorry, for a mistake I got the your quoted reply of @saderror256, so the suggestion to have a separate file to storing the password hash is yours...
for making your propose will be necessary provide a separate php file to store the password, I think that is not the better way since would be dangerous in my humble opinion. At the moment, if the server would be down no file would be readable so the risk to read the source php file is very low, should crash the php engine for reading the php file source...
@alecos71 commented on GitHub (Oct 17, 2018):
@saderror256 sorry for the mistake...
@hpolonkoev commented on GitHub (Oct 17, 2018):
@alecos71
No worries. I think we are all here trying to find some kind of solutions and make the library better.
I totally agree with you. The purpose of manager to be a single file. The solution I suggested was just for @saderror256, not really for the library it self.
@alecos71 commented on GitHub (Oct 17, 2018):
@saderror256 something like this?
gen_password.php
test.php
Not tested write on fly... as you can see for password_verify is necessary to pass the password in clear... this is the limit...
@hpolonkoev thanks!
@hpolonkoev commented on GitHub (Oct 17, 2018):
If the user can't generate the hash himself, there are plenty of online hash generators that can be used.
The inconvenience : the user has to remember the passwords, otherwise he has to reset them.
@alecos71 commented on GitHub (Oct 17, 2018):
Nice solution, but online there are only MD5, Crypt, the only website that supports password_hash (for using with password_verify) is http://www.passwordtool.hu/php5-password-hash-generator
Thanks.
@alecos71 commented on GitHub (Oct 18, 2018):
just to do something I released this little script of mine:
https://github.com/alecos71/password-hash-generator
@alecos71 commented on GitHub (Oct 18, 2018):
https://github.com/prasathmani/tinyfilemanager/pull/73
Added my password generator...
@ghost commented on GitHub (Oct 20, 2018):
This looks exactly what would be good, an idea since you want to keep everything in one file is to use comments with random strings (no reason, just spam on the keyboard) and then later, we can have a script at the start which reads the actual program for the first random string (this string is used to tell the program that the password and user has not been setup), then we show the setup, once the user picks a password and stuff, encrypt it and replace the comment with something like this
This way, it still stays in one file 👍
@alecos71 commented on GitHub (Oct 20, 2018):
What about my implementation? It does exactly what request, read and test in localhost my changes...
https://github.com/prasathmani/tinyfilemanager/pull/73/files#diff-f382ee4072618879bd7063ce8e903db7
It works so that:
if a password is empty, fm will show the password generator, then copy and past into array:
save filemanager php file and reload the page, since now the passwords are not empty fm will show the login, it works even if
$use_auth = false;The password generator is inside the one php filemanager so there is no necessity to have another file...
@alecos71 commented on GitHub (Oct 20, 2018):
This is very dangerous since filemanager should not able to write into its file because if hacker can access to fm and generate its passwords will be the end of game... instead should work as my propose...