Showing posts with label Cryptography. Show all posts
Showing posts with label Cryptography. Show all posts

Friday, January 4, 2013

Rehashing Pass the Hash

The first question one might ask is, “Really…  Why are you writing about this old news now?”  The answer is simple; even with the release of Window 8 and Server 2012, Pass the Hash (PTH) attacks are still incredibly simple and effective.  While from an academic standpoint passing the hash is simple to understand, it is a bit more complex from an attacker or defender’s stand point.  The reason for this post is that having read a huge number of papers and post on pass the hash, none of them gave me a clear picture.   

The reason pass the hash is so powerful is due to NTLM’s initial design flaw.  NTLM was essentially broken from the day it was released.  While UNIX started saving salted hashes in the 1970s, the designers of NTLM chose to use an unsalted hash.  Salting a hash is probably the most important design criterion when designing an authentication system.

A hash is a one way transformation of a variable input to a fixed length output.  A hash function must be deterministic, meaning that the same input will always generate the same output, no matter what platform it might be run on. Another key property of a good hash function is that even a small change in the input creates a significant change in the output.  The final vital property of a hash function is that it must be truly one way.  There must be no method allowing the input to be derived using only the output.

With these properties, and the benefit of hindsight, a hash is the perfect way to for one party to prove they know a password without the other party actually knowing it.   Storing reversible or god forbid plaintext passwords introduces a significant number or risks.  Only the ignorant do this.

If the hash can’t be reversed, then you might think there are no more risks and you can just hash those passwords and be on your merry way.  If we didn’t have a security model to think about, this might make sense.   The reason we bother to hash the passwords and not store them as plaintext on our authentication servers is that, on the off chance that the auth server is compromised, we want to minimize the value of the stolen identities.  Assuming you kick out the attacker and restore from backup, it would be nice to not have to force all of your users to change their passwords.  It would be nice to be sure that the breach wasn’t just a foothold to a larger attack. Additionally, as users tend to reuse passwords, we don’t want to put the users’ accounts at risk on other systems or sites.  This brings us to the risk created by just storing the password hash with no salt.  If one has access to the hash and wants to derive the input (password), all that needs to be done is test passwords until the outputs (hashes) match.  This Brute force method is always a theoretical option when trying to defeat a cryptographic function.  Trying all possible passwords is time consuming, which works against the attacker.  Unfortunately, with super fast processors and huge amounts of cheap storage, it is now possible to pre-compute and store huge numbers of hashes and the corresponding passwords.  In the space of less than 1 TB, you can store tables that cover 96% of 1 to 9 character passwords containing upper case, lower case, and numbers.  By storing just the password hash we make it completely worth an attacker’s time to create and save the pre-computes values.  Even better, you can just pay when you need to use someone else’s’ tables.

Simply salting the hash wastes all that work the attacker did to pre-compute the hashes.  Salting a hash is simply adding random or pseudo-random data to the input before computing the hash.  The salt is saved and later used when verifying the password.  When verifying the password, the salt is looked up, re-applied to the password that is being tested, and the data hashed.  If the result on file and the real-time computed result match, the password was correct. By applying the random data, we have completely wasted the attackers’ pre-computation effort.  Ideally, every account uses a different salt, so that even if your user database is taken, every password must be brute forced separately. 

Salted Hash Example

Password    Salt  SHA-1 Hash

V3ryStrong  1     88 93 EB 7A 28 DA A4 95 89 B1 B5 A1 E0 C6 A0 83 9D 38 A3 39

V3ryStrong  2     59 86 41 B2 62 B7 C3 C7 54 27 78 94 FB D6 59 24 5F 77 74 40

 

The example is purposely weak to make for easy understanding.  Usually the salt would be 8 – 16 bytes. It shows the amplification provided by SHA-1.  With a single bit change the data is completely different and we see that there is no way to pre-compute all passwords, unless we pre-compute all passwords with all possible salt values, which in not feasible.   

While this is fun background data, it really has little to do with passing the hash, as PTH lets an attacker who has the hash assume the user’s identity without ever knowing the password.  This is because windows stores the user’s NT hash in Active Directory DIT or the SAM.  The first step of NTLM and NTLMv2 handshakes is that the system converts the user’s password to the NT hash, and the handshake does some fun handshake math that proves the user knew the hash, without the hash ever crossing the network. 

This system makes the hash “password equivalent”.  If an attacker has the user’s hash, they just skip the “convert password to NT hash” and go straight to using it in the handshake.   There are many tools for doing this, depending on where NTLM is being used. NTLM authentication occurs in-band with the protocol that is being used to access data or access a system.  NTLM auth occurs inside remote file access via CIFS/SMB, TDS for accessing SQL server, RPC for all sorts or remote administration and access, HTTP for web auth, and I’m sure a few more things. 

In order for an attacker to pass the hash, they need four things:

1.       The valid NT hash (and username)

2.       A channel to pass the hash through

3.       A server hosting a service that utilizes/allows NTLM auth

4.       A client (or tool) that allows the attacker to input the hash rather than the password

In a world where all four elements are available to an attacker, there is no stopping PTH.  Keeping in mind the four requirements, defenders can limit, and more importantly, and understand their level of exposure. 

Securing the Hash

The most important thing a defender can do is keep the hash from falling into the wrong hands.  The hash resides on a computer in two main areas; the SAM (Security Account Manager) db and in RAM, for users that are logged in.  There is a common misconception that the NT hash is also stored in the registry for cached logon of domain user accounts on domain joined computers.  This is just that, a misconception. Depending on system settings, data is stored that allows a domain user to logon to a machine when no domain controller is available; however this data is an MD4 of the NT hash + username.  It might be worth an attackers’ time to pre-compute the hashes for common user names, such as ‘Administrator’. 

Looking at the threat model, one can conclude that the horse is out of the barn if the hash is stolen.  In order to steal the hash, the attacker had to gain full control of the system.  The attacker must either execute hash stealing code as a member of local administrators, or gain physical access to the poorly protected computer.  While the horse is indeed out of the barn on that host, the attacker should be able to go no further.  At least that is the defenders hope. This is, of course, not the case.  If the user has the other three required elements, she can act as the user at will. 

Stealing the Hash from RAM

In order for an attacker to steal a user’s NT hash from RAM, the attacker must run code with administrator rights.  As with all the advice that will be offered, all the controls are fairly standard and map to basic security concepts.

·         Reduce surface area

o   Don’t leave sessions logged in unnecessarily, as another administrator’s failure can compromise your account.

o   Avoid logging in with administrator rights.  If you screw up and run attackers code, they can’t steal the hash if you aren’t an admin.

·         Use up to date AV software

Stealing the Hash via Physical Access

We all know that if an attacker has physical access to a host then they own the host.  The last thing we want to do is allow the attacker to use that host as a foothold to even more systems and data.  In the case of PTH attacks, we probably have good news here.  The NT hashes are stored in the local SAM. If the computers are not domain joined, the username and password usually don’t cross hosts, unless you took the time to sync up your usernames and passwords across them all.  As I mentioned earlier, the cached domain credentials DO NOT contain the NT hash. This means the SAM from one computer is of no value on anther.  

The one place where there IS a great deal of risk is in an enterprise, where standardization probably means that the local admin password is the same across every domain member.   This means that the compromise of any one server is equivalent to the compromise of every server.  This means that that dev server that you left up running PHP 1.2 can be a great foothold to the rest of your servers and data.

To reduce this risk:

·         Use full disk encryption that requires a token or Password Based Key Derivation Function

·         Enable syskey protection > 1.

o   This requires a password or floppy to boot and decrypt the goodies in the SAM.

o   This scales poorly for an enterprise.

·         Make sure all local admin passwords are different.

Stealing the Hash from the Network

The NTLM and NTLMv2 handshakes assure that the NT hash itself can be verified, without it ever appearing on the network.  There is nothing to see here.

If an attacker were to figure out a way to get the hash from the network, it would be an impressive feat.

Securing the Channels

If the attacker steals the hash, but has no path to pass it over, then the hash is of little value.  One nice thing about NTLM auth is that it occurs in band with the protocol utilizing it, so as a defender, you can better understand and limit your exposure.  If you block ports 80, 138,139, and 445, but open 1433, you know that the stolen hash can only be used to access SQL data but not remote file access or websites.

Controls to consider:

·         Reduce Surface Area. Only open the ports you need.  Duh…

·         Authenticate end points with VPN or IPSec.

Stop using NTLM

This one is not so simple.  One can “kerberize” all sorts of servers.  That is, allow them to utilize Kerberos authentication rather than NTLM.  Microsoft has done a pretty good job kerberizing applications, but in almost all cases, if Kerberos fails, the app will allow fallback to NTLM.

I know of no options for a defender here.  This section is really a call to MS, and others, to allow for more granular options related to NTLM auth, Kerberos, and fallback options.

I suppose this is an opportunity for firewall vendors as well.  It would be fairly easy to block NTLM auth and allow Kerberos on a per protocol basis.  I suspect an F5 ninja could write a crazy iRule to do it too.

Stop Clients from Allowing the use of the NT Hash

Assuming you have dealt with the firewall rules, most attackers will have no channel to pass hashes over.  The last option would be to pass from hosts inside your network.  This seems plausible, as the attacker got enough access to steal the hash.  

There are two classes of tools that let you work from the hash rather than the password.  The first are tools like WCE, which run on windows and allow an administrator to inject arbitrary usernames and hashes into a user’s session.  This allows all subsequent uses of any tool in that session to authenticate as the injected user.  This means that any Windows tool that speaks NTLM will work.  The second class are custom tools that may run on any OS and speak the protocol in question, be it SMB, TDS/SQL, RPC, or whatever, AND they speak NTLM taking a hash rather than password.

For a good list of current tools and tons of great info on PTH, see Still Passing the Hash 15 Years Later.

A good list, granted probably dated, of AV test results for detection of the tools, can be found here.

Controls to consider:

·         Make sure EVERY host inside your firewall has up to date AV.

o   Enforce this with NAC or NAP.

o   Make sure hosts with AV match up to your CMDB, such that all hosts are accounted for.

·         Consider AppLocker and Software Restriction Polices.

o   Make sure to block known tools by hash so the attacker can’t just rename at tool

o   Make sure to block known tools by name, in case the attacker makes code changes but chooses to use the same executable name.

o   Consider white listing known good apps rather than trying to blacklist known bad ones.

·         Minimize the number of local administrators.  A local admin can stop AV or add exclusions prior to copying over and loading up tools.

·         Keep up on the latest version of the tools and test your AV yourself.

Understanding Why Pass the Hash Still Works

The best way to learn this stuff is to go to Eric Glass’s NTLM page and do the math along with him.  I am borrowing heavily here to summarize for lazy.  ;-)  Well, there is a lot more great stuff on his page that you don’t need to know to understand PTH.

There are three different types of NTLM responses:

1.       NTLM Response

2.       NTLM2 Response, not to be confused with NTLMv2 Response

3.       NTLMv2 Response

NTLM Response

1.       Convert password to Unicode and apply MD4 hash.  This is the NT hash.

2.       Pad the NT hash with 0s to make it 21 bytes.

3.       Break the 21 bytes in to 3 keys of 7 bytes each.  This is 56 bits.

4.       Apply odd parity to each key.  This makes each key a valid 64 bit DES key.

5.       Encrypt the NTLM challenge (from the server) with each of the three keys.

6.       Concatenate the three encrypted values, creating the response.

7.       Send it.

As you can see, the challenge is provided by the server, and could be substituted by an attacker with network access.  This allows an attacker to create pre-computed responses (rainbow tables) for that challenge.  Obviously this is scary.

NTLM2 Response

Once again, not to be confused with the NTLMv2 Response.  This one uses nearly the same math as the NTLM Response, but let’s the client add a “client challenge” thus negating the value of an attacker substituting their own challenge.   This is used when the 0x00080000- NTLM 2 session security flag is set.

1.       Convert password to Unicode and apply MD4 hash.  This is the NT hash.

2.       Pad the NT hash with 0s to make it 21 bytes.

3.       Break the 21 bytes in to 3 keys of 7 bytes each.  This is 56 bits.

4.       Apply odd parity to each key.  This makes each key a valid 64 bit DES key.

5.       The client creates a random 8 byte client challenge.

6.       The server challenge and client challenge are concatenated and MD5 is applied, creating the challenge data.

7.       Encrypt the challenge (MD5 output) with each of the three keys.

8.       Concatenate the three encrypted values, creating the response.

9.       Send it.

NTLMv2 Response

This response is next level.  It is totally different that the first two and includes a timestamp, the domain the user belongs to, as well as target information.

1.       Convert password to Unicode and apply MD4 hash.  This is the NT hash.

2.       Concatenate the upper case Unicode username with the Unicode authentication target.

3.       Perform HMAC-MD5 on the result of step 2, using the NT hash.

4.       Construct blob, containing the Blob signature, 4 bytes of all 0s, the time in NT time format, the client challenge, another 4 bytes of all 0s, and the target information from the server Type 2 (challenge) message, and another 4 bytes of all 0s.

5.       The server challenge form the Type 2 message is concatenated to the blob from step 4.

6.       The blob from step 4 is then HMAC-MD5’d using the result of the HMAC-MD5 in step 3.

7.       The HMAC response from step 6 and the blob from 4 are concatenated and constitute the response.

8.       Send it.

Conclusion

Pass the hash attacks are alive and well and are not going away anytime soon.  Protect your systems. 

Tuesday, May 24, 2011

Why We Use Hardware Security Modules

[Updated 5/22/2013] My statement, in the summary, about the limited value of an HSM when using soft keys was poorly articulated.

Hardware Security Modules (HSMs) are a security device that adds a lot of expense, man hours, and complexity to a data processing system. As security and usability are always a trade-off, let’s look at when you want to make the trade. First off, what do HSMs to at a basic level? An HSM is a device used for key management and encryption and decryption of data. The HSM holds the key material on the device and there is no way to export the keys in a usable format. This keeps and attacker from copying your encrypted database and then taking the key and decrypting the data offsite, on his own time, where he is less likely to be caught. Used correctly, this is a big security gain.
There are a few guiding principles to keep in mind when looking at the threats to your data and the protections that the proper use on an HSM can bring.
When considering how to implement key management, the other option we look at is software based keys. Let’s take a quick look at the trade-offs of each. As you will see, HSMs are not a silver bullet.
HSM
Software Keys
Someone with physical access to your server can take your keys*
Maybe
Yes
An attacker who can execute code on your servers can copy your keys
No
Yes
A rogue administrator can copy your keys
No
Yes
Use adds considerable extra expense
Yes
No
Use adds considerable complexity
Yes
No
Someone with root level access to your app server can see data before it is encrypted
Yes
Yes
*Properly configured, the keys are unusable even if the HSM is stolen.
While there are hundreds of specific threats and attack vectors against your data processing systems, it is important to align your controls to specific threats. In the case of using hardware encryption modules, there are three basics threats that might make us consider the use of an HSM over software based keys.
  1. The rogue administrator.
  2. Attackers with physical access to servers.
  3. Attackers who have root access on servers.
While there may be some other benefits offered by an HSM, they are ancillary and redundant to other controls that should be in place.
We need to understand a couple of basic HSM concepts before we can see what they do for us.
  • The Security World – This is a logical concept that can span more than one HSM. It is a group of HSMs that all share a common master key. Members of a security world can share application keys from other members in the world. Keys can be copied to security world members without possibility of comprise.
  • Smart Cards – The security world is run by and protected with smart cards. These cards are actually small computers that that can create keys, store them and perform operations using them. The cards can be protected with a PIN for additional security. The cards are designed to make it very difficult to copy a card in a short time and without destroying it.
  • k of n card sets – Many operations on an HSM require a high level of assurance, so the HSM can be setup to require more than one smartcard be used to perform an operation. The card set is sized and distributed so that it is unlikely that cardholders will be able to collaborate on subversive actions. The number of cards required to perform actions is called a quorum. A large n ensures that if cards are lost or destroyed enough can still be found to maintain uptime. k of n is based on Shamir’s Secret Sharing algorithm.
  • Administrator Card Set - The ACS cards run the security world, in conjunction with the HSM. ACS cards are used to backup and restore the security world. This includes adding new HSMs to the security world. The key that decrypts the backup file for disaster recovery and adding devices to the security world is base on the ACS and protected with the secret sharing algorithm.
  • Operator Cards – The OCS cards are used to access application keys. These are the keys that actually encrypt and decrypt the data. The OCS k of n can be different from the ACS k of n.
  • HSM Soft keys – The HSM soft keys these are application keys that can be used with no action from an OCS card set. All you need to do is boot the server holding the HSM, or the netHSM. If an attacker takes the HSM, they have unrestricted use of the key. They can’t export the key, but they can use the key at will to decrypt any stolen encrypted data.
When properly configured, the HSM keeps and attacker with privileged access or a rogue administrator from taking a copy of your encrypted data and copy of your key and decrypting your data at their leisure. The best the attacker can do is to grab data before it is encrypted or send encrypted data to the HSM for decryption. When looked at in conjunction with proper audit logs and some sort of IDS or IPS solution, this should significantly limit the time that the attacker has access to gather plaintext data.
If an attacker manages to steal an HSM they cannot copy your security worlds as they lack the ACS quorum. They cannot use OCS protected keys without the OCS quorum. HOWEVER, anything protected by HSM soft keys can be decrypted by simply putting the stolen HSM online in a new system.
The bottom line is this:
  • If you use an HSM with HSM Soft keys, you probably are wasting your money as you are not reducing risk when attackers have physical access. You can get the same logical access value with keys stored in the file system of the appropriate application tier. [Update] The HSM still provides lots of value, as a stolen HSM should go noticed.  You still do need to keep in mind that your operations, both physical and logical, may have a weak link that can lower the security of your overall system. 
  • If the attacker has root access at the right tier in your application, at a minimum, they can copy off the data before it is encrypted and worse case, they can call APIs to decrypt data at will.
HSMs are awesome, but don’t assume just they will solve your problems. In my experience, the biggest holes are created by the applications and APIs that rely on the HSMs.

Wednesday, May 27, 2009

Analysis of Oracle Hyperion Web Analysis Studio 9.3 Logon Security

Before I start I'll point out that Oracle does not make any claims that the Hyperion Logins are secure without SSL. This analysis was performed to clear up misconceptions on the part of others.

Analysis of Oracle Hyperion Web Analysis Studio 9.3 Logon Security
Abstract
A quick vetting of how Hyperion handles usernames and passwords shows that their controls offer little protection of credentials while crossing the network, in the absence of SSL. While passwords are not sent across the network as clear text, they are only lightly obfuscated and subject to multiple attacks.
Hyperion should not be used unless the login pages are encrypted using SSL derived from a certificate that chains to a trusted Root Certificate Authority. This is most important when using the LDAP connector as it then puts credentials at risk that might grant access to other systems.

Analysis
There are multiple ways to take a look at Hyperion yielding varying results. Hyperion sends data via Java code to the app server via an unknown application protocol. It uses Java serialized objects, which may be meaningful to some else. At the TCP level, the usernames can be seen on the wire in clear text, along with what appears to be a base64 encoded password.
A message snippet looks like this:
------------------314159265358979323846
Content-Disposition: form-data; name="param type 1"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit

com.hyperion.atf.security.authentication.IAuthenticationHelper

------------------314159265358979323846
Content-Disposition: form-data; name="param type 2"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit

com.hyperion.atf.security.users.IUserManagerCreateTask

------------------314159265358979323846
Content-Disposition: form-data; name="param value 0"
Content-Type: application/x-java-serialized-object
Content-Transfer-Encoding: binary

....sr.
csPasswordt..Ljava/lang/String;L.
csUserNameq.~..xpt..DmFVYnsCImM=t..markgamache


------------------314159265358979323846

The first thing we see is that the protocol breaks up messages with Pi. Who knows… The second thing we see is that the helpful words, Password and UserName can be found. These are followed by DmFVYnsCImM=, presumably my password and then markgamache, my username. By simply trying a few attempts with different usernames and passwords, it becomes clear that we are correct in our assumptions. Third, but for later, we also get a java class name, hyperion.atf.security.authentication.SimplePasswordToken.

Replay Attacks
Before we look at any technical attacks, we’ll look at that messaging format. The TCP data sent along with the username and password contain no sequence numbers, nonces, or timestamps. As you will see in the next section, a username and encrypted password for an account do not change across login sessions. This makes it highly likely that a simple replay would allow access to a session as another user. This does not put the password at risk, only data within the application. If the application data is not encrypted, it is likely that the session could be hijacked as well. This is a smaller concern generally.
The next step is to try and make sense of the password data. The system lets us send as many usernames and passwords as we like.

Chosen Plaintexts
By sending data we select through the password encryptor, we can then analyze the results.

Username: markgamache
Username Hex: 6d 61 72 6b 67 61 6d 61 63 68 65

Password : 1q2w3e4r
Plaintext hex: 31 71 32 77 33 65 34 72
Cyphertext Hex: 0e 61 55 62 7b 02 22 63

Password: 11111111
Plaintext hex : 31 31 31 31 31 31 31 31
Cyphertext Hex : 0e 21 56 24 79 56 27 20

Password: 111111111
Plaintext hex : 31 31 31 31 31 31 31 31 31
Cyphertext Hex 0e 21 56 24 79 56 27 20 e9

Password: 22222222
Password hex: 32 32 32 32 32 32 32 32
Cyphertext Hex : 0d 22 55 27 7a 55 24 23

Password: 33333333
Password hex : 33 33 33 33 33 33 33 33
Cyphertext Hex : 0c 23 54 26 7b 54 25 22

Password: 44444444
Password hex : 34 34 34 34 34 34 34 34
Cyphertext Hex : 0b 24 53 21 7c 53 22 25

Password: 55555555
Password hex : 35 35 35 35 35 35 35 35
Cyphertext Hex : 0a 25 52 20 7d 52 23 24

Password: 12345678
Password hex : 31 32 33 34 35 36 37 38
Cyphertext Hex : 0e 22 54 21 7d 51 21 29


Username: ted
Username Hex: 74 65 64

Password: 11111111
Password hex : 31 31 31 31 31 31 31 31
Cyphertext Hex : ab 28 71 f4 fe cb 1d 46


Username: 1111
Password hex : 31 31 31 31 31 31 31 31
Cyphertext Hex : 51 2b f3 5c a6 76 db 43


Username : 2111
Password hex : 31 31 31 31 31 31 31 31
Cyphertext Hex : af a8 8d c5 48 db 27 7c



From the small sample, we can see a few things:
• If the username is unchanged, then the password data seems to be consistent
o For markgamache, as long as the password starts with 1, the cyphertext starts with 0e
o The transform is not s simple substitution, as the 0e only corresponds to 1 as the first character
o Incrementing the value of a character in a particular position produces predictable results. In pos 1, 0e = 1, 0d = 2, 0c = 3
o The pattern is not completely predictable. In Pos 4, 24 = 1, 27 = 2, 26 = 3
o The value of a position is not varied by the character before or after. The encrypted value of Pos 3, when the plaintext is 2, is 55, both when the password is 1q2w3e4r and 2222222
• If the username changes, the cyphertext value no longer match for a position, with the password unchanged. See users 1111 and 1112 above.
• The values at a position do not vary based on the overall password lenghth. See password 11111111 vs 111111111

This tells us that the encrypted version of the password is derived in part from the username. It also shows us that for any username, we can perform a simple position by position chosen plaintext attack to find the corresponding encrypted values. This means in about 100 attempts, a user’s password can be derived. As the application allows unlimited retries, this cannot be stopped. The account would likely be locked out due to password policy, but in 10 – 30 minutes, it is likely to be unlocked by policy.

Code Attacks
As the password is “encrypted” using the client side Java code, we can take a look at that code. While the app runs automatically when you click on a web link, there is nothing stopping us from getting the code to look at. Remember, we can’t execute the code if we can’t get to it.
A simple curl command allows us to get a copy of the jar file, AnalyzerClient.jar. From there, it is a simple task to extract the jar and decompile the classes. There are lots of them, but we are saved time by the data from the wire, remember hyperion.atf.security.authentication.SimplePasswordToken.
Sure enough, there is a class named hyperion.atf.security.authentication.SimplePasswordToken. The class has both encrypt and decrypt methods referencing com.hyperion.atf.utils.encryption.EncryptionManager.
Upon investigation of EncryptionManager, we see that the username is used as the key and RC4 is used to encrypt the password. This is bad, but is validated by the chosen plaintext operations.
Following the bouncing ball and stripping the error handling for prettiness…
1. We get csPassword and a value from the wire.
2. We get csPassword = EncryptionManager.encrypt(asUserName, asPassword); from SimplePasswordToken
3. From EncryptionManager we get
public static String encrypt(String asEncryptionKey, String asClearText)
{
return encryptRC4(asEncryptionKey, asClearText);
}

And
protected static String encryptRC4(String asEncryptionKey, String asClearText)
{
byte myCypher[];
Rc4Cipher mRc4 = new Rc4Cipher(asEncryptionKey.getBytes("UTF8"));
byte myClear[] = asClearText.getBytes("UTF8");
myCypher = new byte[myClear.length];
mRc4.encrypt(myClear, myCypher);
return Base64Codec.encode(myCypher);
}

Indeed, the encryption key is the username, which is sent in the same packet as the encrypted password. The key is shipped in the lock.
All of our assumptions are confirmed.
Lastly, even thought the client should never need to decrypt the password, that’s the server’s job, the decrypt code is in the classes. This makes creating your own exploit code extra easy.

Character Positions Explained
Now that we know that RC4 is being used with the username as the key, we can see why there is a predictable shift in the cyphertext at any position if the username does not change. If you recall, for username markgamache, a 1 as the first character always yields 0e as the first byte of cyphertext. This is because RC4 is a stream cipher. It acts on a byte stream, one byte at a time. One byte in the stream had no mathematical effect on the previous or next byte. This is why block ciphers are considered better, as a rule of thumb. As our passwords are made up of characters that are, unluckily, one byte each, each character is essentially encrypted by its self. To defeat this, some sort of bit shift or IV (initialization Vector) should be used. It’s all moot though, as the key is shipped with the lock, as it were.

Summary
Hyperion passwords, and any linked SSO directory passwords, are put at considerable risk by simple code inspection or by chosen plain text attacks. While it has not been tested, a session with the application can probably be established via a TCP replay. Without additional controls, it is likely that sessions can also be hijacked. While the last two issues do not put passwords at risk, they do put the application and its data at risk.
Hyperion should not be used without SSL via a certificate that chains to a trusted root certificate authority. This will provide for secure key exchange, secure authentication, stop replay attacks and make the world a better place.

This just reinforces the basic security principal; Trust well vetted cryptosystems (like SSL) over custom solutions.


Inputting falsified referrals to this site violates the terms of service of this site and is considered unauthorized access (hacking).