Discovering Passwords in The Memory by Abhishek Kumar
Discovering Passwords in The Memory by Abhishek Kumar
Discovering Passwords in The Memory by Abhishek Kumar
While servers and applications store passwords encrypted or in digest form in the
hard disk, we have seen several instances when such encryption is not applied while
storing passwords in memory. Frequently access to memory is not restricted based
on privilege levels. Thus attackers with local access to the system can read the
memory and extract passwords. Using a memory viewer1 they can locate a specific
process in memory and read its contents that can include passwords. These
passwords could be an administrator password for a server, a user password for an
application, or a database login password. Once a password is discovered attackers
could escalate their privileges in the application. Thus any application that uses
password for authentication could be vulnerable if it leaves the password
unencrypted in memory.
1
Memory viewers as the name implies are tools used to read the memory of the
system. Many of these graphical tools let you select a process and walk through its
memory space. WinHex is one such memory viewer that we used - it is available
from: http://www.x-ways.net/index-e.html
Paladion Networks 1
White Paper
A memory viewer displays all the code and data associated with a process in
memory. The data is generally huge and may include both encrypted as well as plain
text data.
Passwords can be located in memory by following either of the two approaches:
1) By searching for the password at a fixed address in memory - All installations of
an application might contain the password in the same fixed location in the
memory. For example, all instances of a server might store the password variable
in say, location 10BD862C. Once this location is known, then the password can
be extracted from the memory if an attacker can read the memory. To discover
the location of the password for an application, attackers could install the
application in their own system first. Then they could search for the location of
the password in memory, as they know the password that has been used. Once
they have the location, they could discover the password of any instance of the
application that they have local access to.
2) By locating a particular pattern within the memory – The data near the password
might follow a pattern. For example, all instances of the server might have a
pattern like “auth-password” next to which the password is stored. Attackers
could discover this pattern after installing the application in their own system-
they could search for their password in the memory viewer and note the pattern
near the password. Once they have the pattern, they could discover the
password of any instance of the application that they have local access to.
Sometimes identifying the password becomes easy because of distinct and
identifiable strings in the memory such as ‘username’ and ‘password’. This is
illustrated through a screen shot.
Paladion Networks 2
White Paper
When the application server is started it reads the Java command line
arguments and the environment variables and binds itself to a TCP port. The
application takes the identity of an operating system user and security group.
The application also consults a configuration file to get all its configuration
information.
On startup the server loads the administrator password into its memory in
plain text. Among other things, the configuration file could provide information
on database connection sources which contain database login passwords. The
server also loads these passwords into memory in plain text.
Alternatively the passwords may not be loaded when the server starts up but
appear in the memory when the administrator or a user is authenticated.
Thereafter the passwords remain in the memory even after the user has
logged off.
Paladion Networks 3
White Paper
Identifiable string…
Password…
Auth-password
europe123
The above figure shows the administrator password for an application server stored
in the memory near an identifiable string.
- In a different situation, the server may not load the administrator password at
startup. But the password is loaded in the memory when the administrator is to
be authenticated. Thereafter the password may stay in the memory as long as
the server is running. Even though the administrator accessed the configuration
console of the server from a remote machine, the server’s memory contains the
password in plain text and can be discovered.
Paladion Networks 4
White Paper
This vulnerability is quite easy to exploit as the attacker is not required to write any
exploit code. If attackers have read access to the memory of an application, they
could use a memory viewer to extract passwords. Memory viewers are easily
available and simple to use. In several applications we tested, access to the memory
is not restricted based on user privilege. Hence low privileged OS users could
inflict damage by logging in to their OS account and finding high privileged
passwords. Once the password is discovered it could be used to read and modify
sensitive information. It is difficult to track and detect these breaches because only
the memory is being accessed to locate the password and no easily detectable trails
are left.
This vulnerability requires local access to be exploited. Attackers need to log in to the
system to find the passwords. They also need to install a memory viewer on the
victim and that may not be possible always.
This vulnerability results from storing critical information in plain text in the memory.
Information in the memory should not be neglected and passwords should be stored
encrypted in memory. If the password is used as plain text then it should be
immediately reset to an encrypted value in the memory.
Paladion Networks 5
White Paper
Appendix
WinHex
The figure below shows the interface of WinHex. WinHex is a memory viewer that
can be purchased at http://www.x-ways.net/index-e.html.
Contact information
Paladion Networks
307, Devarata
Plot No. 83, Sector -17
Vashi, Navi Mumbai – 400 703
Ph: +91 22 55910513
FAX: +91 22 55912429
Website: http://www.paladion.net
Paladion Networks 6