Penetration Testing with Kali Linux
PWK - Copyright © 2023 OffSec Services Limited. All rights reserved.
74
We previously examined the
-rwxr-xr-x
portion of the output. We’ll also notice a number, “147176”
in the case of the first command, in the output. This number indicates the size of the file. After we
run the cat command, we’ll observe that the file name and the permissions are still the same as
before, but the file size is now “64448”. This output indicates that the
contents of the file have
changed, but the permissions remained intact.
Let’s return to the beginning and try to run chmodfix +x on our script.
kali@kali:~$
./chmodfix +x find_employee_names.py
kali@kali:~$
./find_employee_names.py
R. Jones
R. Diggs
G.
Grice
C. Smith
C. Woods
D. Coles
J.
Hunter
L. Hawkins
E. Turner
D. Hill
Listing 22 - Our fix worked!
Excellent! We were able to restore our permission to execute our script and run it. It’s certainly a
relief to receive our list of employees again.
Let’s go one step further and restore our system so that we don’t run into this problem again.
Let’s try and run the chmodfix command on the original chmod file to fix things.
kali@kali:~$
./chmodfix +x /usr/bin/chmod
./chmodfix: changing permissions of '/usr/bin/chmod':
Operation not permitted
Listing 23 - Another obstacle.
We’ve hit another obstacle. We don’t have permission to modify /usr/bin/chmod.
Whoever set up this system made it so the average user could not interrupt system files in
/usr/bin/
(like chmod). Copying the file or the contents of the file was clearly allowed, but we’re
trying to write to a file in that folder, and we don’t have permission to do that.
Right now we are trying to run this command as the
kali
user. Let’s
try running the command
again, but this time as a Super User. To do this, we’ll use the sudo command,
162
followed by our
original command. The system will prompt us for our password.
kali@kali:~$
Yüklə
Dostları ilə paylaş: