Penetration Testing mailing list archives
Re: Determining the encryption used
From: Peter Kosinar <goober () ksp sk>
Date: Fri, 12 May 2006 02:04:30 +0200 (CEST)
Hello,
While doing a pen-test I came across a database with encrypted fields and I was curious to try and see what I would do with it.
Could you provide an example of such an (possibly) encrypted field?
Is it possible to determine the encryption used by "looking" at the encrypted results or lenght ?
Sometimes. Very much depends on the structure of the data -- for example, if all the "encrypted" values (in one column of the database) have the same length, it might be some kind of hash, used for authentication purposes. Some applications store their passwords hashed either using crypt() or some variation of MD5; structure of the latter is quite easy-to-recognize. It's also often quite helpful to find out what application creates / uses those encrypted fields, it might provide some clues as of what kind of encryption/hashing is used.
If nothing obvious appears at the first and second glance, it might be useful to look if the values seem to have some additional structure -- for example, are there some repeating patterns at the beginning/end? If so, the values might represent some textual data, these are quite often reduntant and repeating.
I know that with Base64 it's pretty easy because of the "==" at the end.
This is not completely true, "=" characters are used as padding in Base64 encoding. If the length of the original text is a multiple of 3, there won't be any ='s at the end, otherwise you should find one or two of them.
In general, if the field looks too much letter/number-ish, it's most likely some kind of ASCII-armor used to store binary data while avoiding problems with different encodings/codepages or such. I've also seen MD5 sums stored in a database in textual form (in general, fields consisting purely of [0-9A-F] are usually just hexadecimal descriptions of some other data).
Also if there are any tools besides openssl that you found usefull to try all the cipher, consecutively with a passphrase/keyword against a file/string
Depending on the kind of cipher (if it is some kind of password-hash), you might find tools like John the Ripper much faster for dictionary-style attacks.
Peter -- [Name] Peter Kosinar [Quote] 2B | ~2B = exp(i*PI) [ICQ] 134813278 ------------------------------------------------------------------------------ This List Sponsored by: CenzicConcerned about Web Application Security? Why not go with the #1 solution - Cenzic, the only one to win the Analyst's Choice Award from eWeek. As attacks through web applications continue to rise, you need to proactively protect your applications from hackers. Cenzic has the most comprehensive solutions to meet your application security penetration testing and vulnerability management needs. You have an option to go with a managed service (Cenzic ClickToSecure) or an enterprise software (Cenzic Hailstorm). Download FREE whitepaper on how a managed service can help you: http://www.cenzic.com/news_events/wpappsec.php And, now for a limited time we can do a FREE audit for you to confirm your results from other product. Contact us at request () cenzic com for details.
------------------------------------------------------------------------------
Current thread:
- Determining the encryption used John Madden (May 11)
- Re: Determining the encryption used Art Cooper (May 12)
- Re: Determining the encryption used Tim (May 12)
- Re: Determining the encryption used Rodrigo Ramos (May 12)
- Re: Determining the encryption used Tim (May 12)
- Re: Determining the encryption used Byron Sonne (May 12)
- Re: Determining the encryption used Peter Kosinar (May 12)
- Re: Determining the encryption used Tonnerre Lombard (May 12)
- Re: Determining the encryption used Tim (May 12)
- Re: Determining the encryption used Phoebe Tunstall (May 12)
- Re: Determining the encryption used Peter Kosinar (May 13)
- Re: Determining the encryption used Tim (May 13)
- Re: Determining the encryption used Tim (May 12)
- RE: Determining the encryption used Sahir Hidayatullah (May 12)
- Re: Determining the encryption used thomas springer (May 12)
- Re: Determining the encryption used Dotzero (May 12)
- <Possible follow-ups>
- Re: Determining the encryption used iccs-abr (May 12)
- RE: Determining the encryption used Bob Bell (rtbell) (May 12)