HTB Introduction to Windows Command Line Skills Assessment
HTB Introduction to Windows Command Line Skills Assessment
注1:每一个主机(除了第一个)的密码都是上一个主机的问题答案。
注2:使用 powershell 的 cmdlet 命令需要输入 powershell 进入 powershell 命令行环境。
Question 1
The flag will print in the banner upon successful login on the host via SSH.
通过SSH成功登录主机后,该 flag 将打印在 banner 中。
使用 ssh 命令通过提供的用户和密码登录,在输入密码之前的 banner 中有一串提示文字,其中包含了 flag 。
1 | ################################################################# |
可以发现 flag 为 D0wn_the_rabbit_H0!3 。
Question 2
Access the host as user1 and read the contents of the file “flag.txt” located in the users Desktop.
以user1身份访问主机,并读取位于用户桌面中的文件“flag.txt”的内容。
在终端中使用 cd 命令进入 Desktop 文件夹,使用 type 命令输出文件 flag.txt 的内容。
1 | cd Desktop |
输出内容 Nice and Easy! 为 flag。
Question 3
If you search and find the name of this host, you will find the flag for user2.
如果您搜索并找到此主机的名称,您将找到user2的 flag 。
使用 systeminfo 命令查询主机属性
1 | Host Name: ACADEMY-ICL11 |
或者加入筛选指令使得输出更改简单
1 | systeminfo | Select-String "Host Name" |
输出
1 | Host Name: ACADEMY-ICL11 |
可得到 flag 为 ACADEMY-ICL11 。
Question 4
How many hidden files exist on user3’s Desktop?
user3 的桌面上存在多少个隐藏文件?
使用命令查询和统计隐藏文件数量
1 | cd Desktop |
输出 101 即为 flag 。
Question 5
User4 has a lot of files and folders in their Documents folder. The flag can be found within one of them.
User4 的 Documents 文件夹中有很多文件和文件夹。flag 可以在其中一个中找到。
使用 Get-ChildItem 的递归查询参数 -Recurse 配合 Where-Object 筛选文件大小得到该 flag 文件位置,并且使用 Get-Content 命令读取。
1 | cd Documents |
输出结果为 Digging in The nest 为 flag 。
Question 6
How many users exist on this host? (Excluding the DefaultAccount and WDAGUtility)
此主机上有多少用户?(不包括 DefaultAccount 和 DAGUtility)
使用 Get-LocalUser 命令并且统计,因为排除了2个用户则需要减去 2 。
1 | (Get-LocalUser).Count - 2 |
输出 14 即为 flag 。
Question 7
For this level, you need to find the Registered Owner of the host. The Owner name is the flag.
对于此级别,您需要找到主机的注册所有者。所有者名称就是 flag 。
使用 systeminfo 命令查询 Registered Owner 即可
1 | systeminfo | Select-String "Registered Owner" |
输出
1 | Registered Owner: htb-student |
其中的注册所有者 htb-student 即为 flag 。
Question 8
For this level, you must successfully authenticate to the Domain Controller host at 172.16.5.155 via SSH after first authenticating to the target host. This host seems to have several PowerShell modules loaded, and this user’s flag is hidden in one of them.
对于此级别,您必须在首次向目标主机进行身份验证后,通过 SSH 在 172.16.5.155 向域控制器主机成功进行身份验证。此主机似乎加载了多个 PowerShell 模块,其中一个模块中隐藏了此用户的 flag 。
在登录的终端使用 ssh 登录 AD 域主机 172.16.5.155 。并且使用 Get-Module 查询安装的 powershell 模块。
1 | # 原始登录的主机 ssh 登录的密码为上题答案 htb-student |
输出
1 | ModuleType Version Name ExportedCommands |
从中可以发现一个叫做 Flag-Finder 的模块,其中有一个 Get-Flag 的命令,运行该命令可以获取 flag。
1 | The |
其中 flag 为 Modules_make_pwsh_run!
Question 9
This flag is the GivenName of a domain user with the Surname “Flag”.
此 flag 是 Surname 为“Flag”的域用户的 GivenName。
使用 Get-ADUser 命令配合 like 筛选 Surname 为 Flag 的用户。
1 | Get-ADUser -Filter 'Surname -like "*Flag*"' |
输出为
1 | DistinguishedName : CN=Rick F. Flag,CN=Users,DC=greenhorn,DC=corp |
可以获取 GivenName 为 Rick 即为 flag。
Question 10
Use the tasklist command to print running processes and then sort them in reverse order by name. The name of the process that begins with “vm” is the flag for this user.
使用 tasklist 命令打印正在运行的进程,然后按名称按相反顺序对其进行排序。以“vm”开头的进程名称是此用户的 flag 。
使用命令 tasklist 之后,使用 Sort-Object 命令排序,并且使用 Where-Object 命令筛选出 “vm” 开头的进程名。
1 | tasklist | Sort-Object -Descending | Where-Object { $_ -like "vm*" } |
输出为
1 | vmtoolsd.exe 3164 Services 0 21,668 K |
可以获取到第一个为 vmtoolsd.exe 即为 flag 。
Question 11
What user account on the Domain Controller has many Event ID (4625) logon failures generated in rapid succession, which is indicative of a password brute forcing attack? The flag is the name of the user account.
域控制器上的哪个用户帐户连续快速生成许多事件ID(4625)登录失败,这表明存在密码暴力攻击? flag 是用户帐户的名称。
首先需要先使用 user10 登录之前的 AD 域主机(172.16.5.155),使用 Get-WinEvent 命令查询 Security 日志中的 4625 事件,并且分组计数其中的登录失败目标账户的用户名。根据查询,返回的事件对象列表中的 Properties 参数的第 5 个为目标用户名。
下列是根据 AI 给出的事件ID为 4625 的 Properties 结构:
索引 | 属性名 | 示例值 |
---|---|---|
0 | SubjectUserSid | S-1-5-18 |
1 | SubjectUserName | SYSTEM |
2 | SubjectDomainName | NT AUTHORITY |
3 | SubjectLogonId | 0x3e7 |
4 | TargetUserSid | S-1-0-0 |
5 | TargetUserName | user10@greenhorn.corp |
6 | TargetDomainName | - |
7 | Status | 0xc000006d |
8 | FailureReason | %%2313 |
9 | SubStatus | 0xc000006a |
10 | LogonType | 3 |
11 | LogonProcessName | NtLmSsp |
12 | AuthenticationPackageName | NTLM |
13 | WorkstationName | WORKSTATION1 |
14 | IpAddress | 192.168.1.100 |
15 | IpPort | 0 |
1 | Get-WinEvent -FilterHashtable @{LogName='Security';Id=4625} | Group-Object {$_.Properties[5].value} | Select-Object Count,Name | Sort-Object Count -Descending |
返回结果为
1 | Count Name |
可以得到最多访问的用户为 justalocaladmin 即为 flag 。