Image
 
linkedin_logo.png rss_logo.jpg
twitter_logo.png youtube_logo.jpg
Latest Additions
 
EH-Net Login
Welcome Guest.






Lost Password?
No account yet? Register
Who's Online
We have 35 guests and 1 member online
 
Advertisement

You are here: Home arrow Ethical Hacking Discussions and Related Certificationsarrow Web Applicationsarrow Password Encoding in Database
EH-Net
May 25, 2013, 12:46:12 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Go back to The Ethical Hacker Network Online Magazine Home Page
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Password Encoding in Database  (Read 4863 times)
0 Members and 1 Guest are viewing this topic.
SynJunkie
Jr. Member
**
Offline Offline

Posts: 71


View Profile WWW
« on: June 10, 2009, 04:02:02 AM »

Hi

I’m currently learning abut SQL Injection and as luck happens I was asked to have a poke around at an internal web application that we have to see if it has any problems.  I’m by no means a pen tester just someone who likes to poke around at stuff.

I was quickly able to find a way to return logon names and passwords from the SQL database using SQL injection but password seem to be encoded/encrypted.

Is there a way to tell what encoding/encryption is used?

What I could see was that many accounts have the same stored password (12 characters and always starting with a = symbol) which I guessed correctly is “password”. However, my stored password (which isn’t “password”) is 16 characters and also starting with a = symbol. Other accounts that I now are not “password” are also 16 characters.

I have verified my findings with the backend database but I would like to demonstrate that although I can retrieve information on all the accounts I can then use the credentials to log in.

I have run the stored passwords through encoders on clez.net but it doesn’t decode my password to what I know it should be.

Thanks in advance for any help.

Regards

Syn

PS. I have permission to do this testing.
Logged

----------------------------------
http://synjunkie.blogspot.com
SynJunkie
Jr. Member
**
Offline Offline

Posts: 71


View Profile WWW
« Reply #1 on: June 10, 2009, 04:36:23 AM »

Just a followup on this. 

I tried encoding my known password (using the encoding page on clez.net) and after comparing it to the stored password and found it to be base64 but reversed.  So i tested this on a password which I didn't know and bingo!

Maybe this might help someone else out there.

One other question to anyone who may be experienced in this, is this a common method of storing passwords? Are there any other common ways of storing passwords?

Cheers

Syn
Logged

----------------------------------
http://synjunkie.blogspot.com
ethicalhack3r
Full Member
***
Offline Offline

Posts: 139


View Profile WWW
« Reply #2 on: June 10, 2009, 06:51:53 AM »

Here is a list of MySQL's encryption and compression functions:
http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html

Id say most of them in the link are pretty common.

Heres a good tut on PHP encryption and salts:
http://www.onlamp.com/pub/a/php/2001/07/26/encrypt.html
« Last Edit: June 10, 2009, 06:54:00 AM by ethicalhack3r » Logged
SynJunkie
Jr. Member
**
Offline Offline

Posts: 71


View Profile WWW
« Reply #3 on: June 10, 2009, 10:49:38 AM »

Thanks for the links.  They look pretty interesting although a bit over my head at the moment.  Maybe it will all make sense one day :-)

Cheers

Syn
Logged

----------------------------------
http://synjunkie.blogspot.com
mambru
Jr. Member
**
Offline Offline

Posts: 98


View Profile
« Reply #4 on: June 10, 2009, 11:00:04 AM »


One other question to anyone who may be experienced in this, is this a common method of storing passwords? Are there any other common ways of storing passwords?


I'd say that the fact of storing passwords is a bad practice, what you'd like to store are hashes of them
Logged
SynJunkie
Jr. Member
**
Offline Offline

Posts: 71


View Profile WWW
« Reply #5 on: June 10, 2009, 11:14:56 AM »

Agreed.

The question was really not "what should we do" but more "what are people doing in webapps". This is the first live web app I have looked at and I was curious if this was type of encoding was common.
Logged

----------------------------------
http://synjunkie.blogspot.com
former33t
Full Member
***
Offline Offline

Posts: 226


View Profile
« Reply #6 on: June 10, 2009, 12:02:40 PM »

I'll caveat this by saying that the only web applications I've done any pentesting on were government and on "secure" networks.

I see one of three things done with web application authentication.  The first is PKI, which is becoming more and more common.  The second is storing the password hashes (I most often see SHA1 being used when used with MySQL).  Storing the hashes helps some, but they can be cracked offline with a dictionary attack if you can get them dumped via SQL injection.  These two are the methods I see when a "professional" has developed the web application.

When someone has read the PHP/mysql programming for dummies book and sets out to leave their mark on the organization, I see LOTS of SQL injection errors and plain text passwords stored in the database (or worse in a text file in the application directory).  One of the first things I do with these web applications is to try to get a directory listing of the location of the web app.  The second thing is that if they are using poorly designed classes that don't have an extension the server recognizes, I try to download those directly.  They often contain the database passwords (which often makes user passwords unnecessary).  The final thing I do before even trying SQL injection is to try to induce an error in the application with URL hacking to get it do display some of the logic (if error reporting isn't turned off).

At any rate, passwords in the clear and SQL injection are way to common.  They are becoming even more common (in my experience) with the multitudes of inexperienced web "programmers" out there.  My only consolation is that these systems don't touch the Internet so they are only vulnerable to insider attacks.
Logged

Certifications: CREA, MCSE: Security, CCNA, Security+, other junk
SynJunkie
Jr. Member
**
Offline Offline

Posts: 71


View Profile WWW
« Reply #7 on: June 10, 2009, 03:04:37 PM »

Useful to know.  Thanks. lovin this SQL Injection stuff though.  As soon as I figured out how to read the errors and tune my injection against the right columns to get the usernames and passwords out I was totally diggin it.

Cheers

Syn

Logged

----------------------------------
http://synjunkie.blogspot.com
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.061 seconds with 22 queries.
 
Exclusive Deal

sansfire13_245x90_cw90.jpg
SANSFIRE 2013
June 15 - 22

5% Off w/ Code: EHN_5

SANS Deals 4 EH-Netters
5% OFF Any SANS Course in Any Format!
Coupon Code: EHN_5 Including SANS Rocky Mountain 2013 & SANS Boston 2013
Polls
Compared to this year, 2013 will be:
 
Recent Forum Topics
EH-Net News Feeds
Latest Additions
 
         
Advertisement

© 2013 The Ethical Hacker Network
Joomla! is Free Software released under the GNU/GPL License.