Welcome, Guest. Please Login or Register.
May 04, 2025, 09:50:54 AM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Problem Checking Password w/database « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Problem Checking Password w/database  (Read 434 times)
nsanden
Jr. Member
**
Posts: 58


I'm a llama!

Problem Checking Password w/database
« on: June 08, 2002, 09:28:33 PM »
Reply with quote

I'm writing a little script that needs to be able to check the cookied password vs the password thats in the db. The problem is I have no experience with crypt, and I noticed the passwords are obviously encyrpted before they go into the database, so how do i decrypt them before checking them vs the cookied password?

I tried $passwrd = crypt($cookiedpassword,substr($cookiedpassword,0,2)); but that doesn't match the password in my database...

Any help would be appreciated!

Thanks,
Nate
Logged
Jedi~
Eric
Beta Tester
YaBB God
*****
Posts: 1284


WWW
Re:Problem Checking Password w/database
« Reply #1 on: June 08, 2002, 10:22:03 PM »
Reply with quote

You can't decrypt passwords if encrypted using crypt(), it's a one way encryption.
Logged
nsanden
Jr. Member
**
Posts: 58


I'm a llama!

Re:Problem Checking Password w/database
« Reply #2 on: June 08, 2002, 10:27:57 PM »
Reply with quote

Well after a further look, I logged into the forums... So it set my cookied username and password.

Then a made a page and echoed the cookied password..

it looked to be encyrpted somehow, but it wasn't the same as the encyrpted password in the database...

So how do i check the cookied password with the password in the database?????
Logged
nsanden
Jr. Member
**
Posts: 58


I'm a llama!

Re:Problem Checking Password w/database
« Reply #3 on: June 08, 2002, 11:48:05 PM »
Reply with quote

Okay I know I can't be the only one that ran into this problem, but I did manage to figure it out, so I want to share for those that care....

(Mod/Admin feel free to delete if you think this may jeaprodize yabb security)

First of all when you login to your forums, yabb encrypts whatever you enter in the password field and gives it a seed of the first 2 letters of your password... So say "passwd" is the name of password text field in the login form.

loginout.php then does $passwd=crypt($passwd,substr($passwd,2,0));

this takes and encrypts your entered password and uses the first 2 characters as the seed.

so now your password is encypted and compared to the database password.

Then for your cookie, yabb encrypts it again! This time using $password=crypt($passwd,$pwseed) where $pwseed is "ys". This is declared in subs.php

Since you can't decrypt a password, you have to use your head (as I didn't at first) and do some backwards checking...

Try doing a query of your database to find the password for a certain user, crypt it once with the "ys" seed, and that will equal your cookied password. If they don't equal, then your user isn't logged in, or he doesn't exist. If they do equal then he's verified!
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Problem Checking Password w/database « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.027 seconds with 17 queries.