exam questions

Exam CAS-004 All Questions

View all questions & answers for the CAS-004 exam

Exam CAS-004 topic 1 question 29 discussion

Actual exam question from CompTIA's CAS-004
Question #: 29
Topic #: 1
[All CAS-004 Questions]

During a system penetration test, a security engineer successfully gained access to a shell on a Linux host as a standard user and wants to elevate the privilege levels.
Which of the following is a valid Linux post-exploitation method to use to accomplish this goal?

  • A. Spawn a shell using sudo and an escape string such as sudo vim -c '!sh'.
  • B. Perform ASIC password cracking on the host.
  • C. Read the /etc/passwd file to extract the usernames.
  • D. Initiate unquoted service path exploits.
  • E. Use the UNION operator to extract the database schema.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
AlexJacobson
Highly Voted 2 years, 9 months ago
Selected Answer: A
/etc/passwd doesn't mean anything on modern linux systems. You would need to read /etc/shadow to get hashes if you wanna tray to crack them (and you have to be root for that). The best thing is A as this directly leads to spawning a root shell.
upvoted 10 times
ito4862
2 years, 4 months ago
Would a standard user be able to use any sudo commands? The passwd file doesn't store the hashes but it lets you know the different user accounts. There might be some non-root accounts with some increased privileges that might have easy passwords, which you could find in the passwd file
upvoted 4 times
Trap_D0_r
1 year, 3 months ago
Depends heavily on how well configured your sudoers file is. Short answer is "Yes" on some Linux systems standard users can launch programs such as Vim with Sudo.
upvoted 2 times
...
...
...
Andre876
Highly Voted 2 years, 5 months ago
The answer is C. the account being used does not have super user access so they cant use sudo, as an attacker the best move would be to find out what usernames are available and maybe try to elevate my permissions using one of those user accounts found in the etcppasswd file
upvoted 6 times
...
blacksheep6r
Most Recent 2 months, 2 weeks ago
Selected Answer: A
✅ A) Spawn a shell using sudo and an escape string such as sudo vim -c '!sh'. ❌ C) Read the /etc/passwd file to extract usernames. /etc/passwd contains usernames, UIDs, home directories, and default shells, but not password hashes (those are stored in /etc/shadow). It’s useful for reconnaissance, but it doesn’t escalate privileges. Key Takeaway: 💡 Misconfigured sudo permissions can allow attackers to escalate privileges using escape sequences in certain programs. Always restrict unnecessary sudo access! 🔥 Burn, you’re thinking like an ethical hacker now! Want to hit another CASP+ challenge? 🚀
upvoted 1 times
...
23169fd
9 months, 2 weeks ago
Selected Answer: A
The command sudo vim -c '!sh' is a technique used to escalate privileges on a Linux system by exploiting the capabilities of the vim text editor.
upvoted 2 times
...
BiteSize
1 year, 9 months ago
Selected Answer: A
The likelihood of a passwd being plaintext isn't very likely. This is not a database and service path is not local. Going with A, attempt to gain root Source: Verifying each answer against Chat GPT, my experience, other test banks, a written book, and weighing in the discussion from all users to create a 100% accurate guide for myself before I take the exam. (It isn't easy because of the time needed, but it is doing my diligence)
upvoted 1 times
...
loganharris
1 year, 11 months ago
The escape string "sudo vim -c !sh'" is a commonly used method to spawn a shell as a root user in Linux. This command opens the vim text editor as a root user and executes the "sh" command to spawn a new shell with root privileges. Reading the /etc/passwd file to extract the usernames (Option C) is a reconnaissance technique that helps identify user accounts on the system but does not provide a way to elevate privileges.
upvoted 1 times
...
margomi86
2 years ago
Selected Answer: A
A. Spawn a shell using sudo and an escape string such as sudo vim -c '!sh' is a valid Linux post-exploitation method to elevate privilege levels. This method takes advantage of the sudo command, which allows users to execute commands with elevated privileges, and the escape string "!sh" invokes a shell with root privileges.
upvoted 4 times
...
FoxTrotDG
2 years, 2 months ago
Selected Answer: C
As the account is a standard user, they will not have the rights to edit configuration files (sudoers), so the best option is to access the passwd file (you do not need any privileges to do this).
upvoted 4 times
FoxTrotDG
2 years ago
I think I'll change my answer to A
upvoted 2 times
...
loganharris
1 year, 11 months ago
passwd file should be locked down to only root
upvoted 1 times
...
...
kycugu
2 years, 4 months ago
A can be possible if the Linux system is vulnerable, getting shell using Vim via Sudo If the binary is allowed to run as superuser by sudo, it does not drop the elevated privileges and may be used to access the file system, escalate or maintain privileged access. sudo vim -c ':!/bin/sh' reference: https://gtfobins.github.io/gtfobins/vim/
upvoted 3 times
...
Sloananne
2 years, 7 months ago
Initiate unquoted service path exploits could also work here, no?
upvoted 1 times
...
bigerblue2002
2 years, 9 months ago
/etc/passwd is a plain text-based database that contains information for all user accounts on the system. It is owned by root and has 644 permissions . The file can only be modified by root or users with sudo privileges and readable by all system users. via https://linuxize.com/post/etc-passwd-file/ Seems readable by all users.
upvoted 2 times
...
Big_Harambe
2 years, 10 months ago
The user can't read the /etc/passswd file without elevated privileges. A
upvoted 2 times
...
RevZig67
2 years, 11 months ago
Selected Answer: C
Best thing to do is read /etc/passwd file
upvoted 3 times
...
Pongpisit
3 years, 3 months ago
Selected Answer: A
A https://gtfobins.github.io/gtfobins/vim/
upvoted 5 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago