petunia
10-22-2008, 05:48 AM
Here I am To explain what u do with the Data You get when u Use a LFI exploit on some Site. and will further advance ... I hope Everyone knws the basics of LFI
/etc/passwd Data and Form
username:[password]:UID:GID:[comment]:directory:[program]
The second and third fields are password and user id:
password
Encrypted password. If this field is null, no password is demanded. If the shadow(F) file exists on the system, then an ``x'' is stored in this field; the encrypted password and password aging information are stored in the shadow file instead.
UID
Numerical user ID.
Others are not Very Useful
Now if You Find Username is x it means The Pass file is shadowed and you will get info in
/etc/shadow
For example:
username:kbeMVnZM0oL7I:503:100:FullName:/home/user name:/bin/sh
All you need to do then is grab the username and decode the password. If the passwd file is shadowed then you'll see something like this:
username:x:503:100:FullName:/home/username:/bin/sh
As you can see the password is now a x and the encoded password is now in /etc/shadow (you will probably not have access to etc/shadow because is only readable/writeable by root and etc/passwd has to be readable by many
processes, thats why you have access to it).
You can also sometimes see something like this:
username:!:503:100:FullName:/home/username:/bin/sh
The ! indicates that the encoded password is stored in the etc/security/passwd file.
Now I explain you the whole work by adding a new user / Group
The following steps illustrate what happens if the command useradd ROBOT is issued on a system that has shadow passwords enabled:
1. A new line for ROBOT is created in /etc/passwd. The line has the following characteristics:
o It begins with the username ROBOT.
o There is an x for the password field indicating that the system is using shadow passwords.
o A UID greater than 499 is created. (Under Red Hat Enterprise Linux, UIDs and GIDs below 500 are reserved for system use.)
o A GID greater than 499 is created.
o The optional GECOS information is left blank.
o The home directory for ROBOT is set to /home/ROBOT/.
o The default shell is set to /bin/bash.
2. A new line for ROBOT is created in /etc/shadow. The line has the following characteristics:
o It begins with the username ROBOT.
o Two exclamation points (!!) appear in the password field of the /etc/shadow file, which locks the account.
Note
If an encrypted password is passed using the -p flag, it is placed in the /etc/shadow file on the new line for the user.
o The password is set to never expire.
3. A new line for a group named ROBOT is created in /etc/group. A group with the same name as a user is called a user private group.
The line created in /etc/group has the following characteristics:
o It begins with the group name ROBOT.
o An x appears in the password field indicating that the system is using shadow group passwords.
o The GID matches the one listed for user ROBOT in /etc/passwd.
4. A new line for a group named ROBOT is created in /etc/gshadow. The line has the following characteristics:
o It begins with the group name ROBOT.
o An exclamation point (!) appears in the password field of the /etc/gshadow file, which locks the group.
o All other fields are blank.
5. A directory for user ROBOT is created in the /home/ directory. This directory is owned by user ROBOT and group ROBOT. However, it has read, write, and execute privileges only for the user ROBOT. All other permissions are denied.
6. The files within the /etc/skel/ directory (which contain default user settings) are copied into the new /home/ROBOT/ directory.
These are the some Advanced Things u need to know before we can move Further
Now a script to parse the /etc/passwd file Which will help you further
#!/bin/bash
for i in `awk -F: '{print $1}' /etc/passwd`; do
zmprov ca ${i}'@domain.com' welcome1
done
/etc/passwd Data and Form
username:[password]:UID:GID:[comment]:directory:[program]
The second and third fields are password and user id:
password
Encrypted password. If this field is null, no password is demanded. If the shadow(F) file exists on the system, then an ``x'' is stored in this field; the encrypted password and password aging information are stored in the shadow file instead.
UID
Numerical user ID.
Others are not Very Useful
Now if You Find Username is x it means The Pass file is shadowed and you will get info in
/etc/shadow
For example:
username:kbeMVnZM0oL7I:503:100:FullName:/home/user name:/bin/sh
All you need to do then is grab the username and decode the password. If the passwd file is shadowed then you'll see something like this:
username:x:503:100:FullName:/home/username:/bin/sh
As you can see the password is now a x and the encoded password is now in /etc/shadow (you will probably not have access to etc/shadow because is only readable/writeable by root and etc/passwd has to be readable by many
processes, thats why you have access to it).
You can also sometimes see something like this:
username:!:503:100:FullName:/home/username:/bin/sh
The ! indicates that the encoded password is stored in the etc/security/passwd file.
Now I explain you the whole work by adding a new user / Group
The following steps illustrate what happens if the command useradd ROBOT is issued on a system that has shadow passwords enabled:
1. A new line for ROBOT is created in /etc/passwd. The line has the following characteristics:
o It begins with the username ROBOT.
o There is an x for the password field indicating that the system is using shadow passwords.
o A UID greater than 499 is created. (Under Red Hat Enterprise Linux, UIDs and GIDs below 500 are reserved for system use.)
o A GID greater than 499 is created.
o The optional GECOS information is left blank.
o The home directory for ROBOT is set to /home/ROBOT/.
o The default shell is set to /bin/bash.
2. A new line for ROBOT is created in /etc/shadow. The line has the following characteristics:
o It begins with the username ROBOT.
o Two exclamation points (!!) appear in the password field of the /etc/shadow file, which locks the account.
Note
If an encrypted password is passed using the -p flag, it is placed in the /etc/shadow file on the new line for the user.
o The password is set to never expire.
3. A new line for a group named ROBOT is created in /etc/group. A group with the same name as a user is called a user private group.
The line created in /etc/group has the following characteristics:
o It begins with the group name ROBOT.
o An x appears in the password field indicating that the system is using shadow group passwords.
o The GID matches the one listed for user ROBOT in /etc/passwd.
4. A new line for a group named ROBOT is created in /etc/gshadow. The line has the following characteristics:
o It begins with the group name ROBOT.
o An exclamation point (!) appears in the password field of the /etc/gshadow file, which locks the group.
o All other fields are blank.
5. A directory for user ROBOT is created in the /home/ directory. This directory is owned by user ROBOT and group ROBOT. However, it has read, write, and execute privileges only for the user ROBOT. All other permissions are denied.
6. The files within the /etc/skel/ directory (which contain default user settings) are copied into the new /home/ROBOT/ directory.
These are the some Advanced Things u need to know before we can move Further
Now a script to parse the /etc/passwd file Which will help you further
#!/bin/bash
for i in `awk -F: '{print $1}' /etc/passwd`; do
zmprov ca ${i}'@domain.com' welcome1
done