scriptableviruseswithmarshalling - 2016.eicar.org · vollständigen computer darzustellen this...

43
This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission Scriptable Viruses with Marshalling Lehner Franz [email protected] Eicar Bonn 2012

Upload: vubao

Post on 17-Aug-2019

217 views

Category:

Documents


0 download

TRANSCRIPT

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Scriptable Viruses with Marshalling

Lehner Franz

[email protected] Bonn 2012

CPU Ringe ?

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

DOS/Win3.1/95/98/Me

3

Ring 0

Einfache CPU ArchitekturNon Multitasking(Cooperatives Multitasking)Nur ein Ring !

Vorteil:• Schnell • Resourcenschonend• Einfach zu Programmieren (Treiber)

Nachteil:• Jedes Programm kann alles crashen• Keine Resourcenverwaltung• Multitasking Probleme

(Blocking/Hangs)

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Ring 0

WinNT , Linux, Unix

„Theoretische Sicht“

4

Komplexe CPU ArchitekturMultitasking

Vorteil:• Programm (2) kann nie Kernel (0)

crashen• Kernel steht über allem• Abschottung der Programme• CPU Limitiert Speicherzugriffe

Nachteil:• Treiber und Schnittstellen Konzepte

notwendig• Komplexere Programmierung• Multitasking Probleme (Timing)

0

12

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

5

Kernel

Userspace

Windows Nt/2000/XP

„Praktische Sicht - 2003“

Excel

Firefox

Word

Flash

USB

Grafik

OS

Stabil im Betrieb !

-- Aber --nicht sicher gegen Gezielte Angriffe

Einnisten in den Kernel möglich, wenn User gleichzeitig Administrator ist

Verstecken des Echten OS‘shinter dem VirusUnsichtbar gegenüber Userspace

File

Syst

em

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

6

Userspace

Windows 7

„Praktische Sicht“

Excel

Firefox

Word

Flash

„Kernel Firewall UAC“Ist eine art „System Rechte Layer“Jeder Benutzer ist „limitiert“

Kernel Rechte Benötigt:• Signaturen• Zustimmung („wollen sie

..“)• Microsoft Hydra

Extensions

Kernel

USB

Grafik

OS

File

Syste

m

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

7

Userspace

Windows 7

„Exploits Everywhere“

ExcelFirefox

Word

Flash

Kernel

USB

Grafik

OS

File

Syste

m

PDF

FlashPDF

PDF

PDF

„Sandbox“ ==Virtuelle Maschine

Acrobat X

Ring 4

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

9

Moderne Browser(sind eigentlich Betriebsysteme)

Java

script

Daten

Austausch

Grafik

File

System

HTML

Redering

PDF

Flash

Menü

System

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

10

Moderne BrowserUnd haben sogar schon Viren ! (Plugins)

Java

script

Daten

Austausch

Grafik

File

System

HTML

Redering

PDF

Flash

Menü

System

Virus

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

BrowserViren

11

Mehrere Viren „Stämme“ BekanntDer Leistungsfähigste den wir bis jetzt gesehen haben war Expirio.QLief im Firefox als Plugin, installiert von einem Exploit im FlashPlugins sind im Home Verzeichnis, volle Rechte ohne Admin Rechte

• SSL Proxy Redirect Funktionalität• Keyboard Hook & Logger • SSL Zertifikate „fake“ (damit es Grün wird)• Firefox Update Faker• Daten Transfer per HTTP Header Variablen

Für Interessierte:Decodierter Virus

http://db.tt/HTNzxCdF

Ring 0

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Flat View Compare

13

Kernel RechteBrowser

JavascriptSandbox

Flash

PDF

Kernel Browser

Javascript

Flash

PDF

Einfallspunkt

Es ist mittlerweile fast unmöglich, von „ganz oben“bis nach „ganz unten“ zu kommen (Kernel Space)

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Exploits um mehr Rechte zu bekommen

14

Dennoch Existieren Exploits die es von Oben bis nach Unten geschafft haben

• CVE-2011-5046(Exploit im Kernel (Grafiksystem im Browser - einfache HTML Seite))Jedes Windows

• CVE-2010-3147(UAC Override - Windows Adressbuch)Jedes Windows

• CVE-2010-2729 (Stuxnet)Privilege Elevation (UAC Override)Windows < XP SP3

• CVE-xx-xxxx (Stuxnet)Privilege Elevation (UAC Override – Task Scheduler)Windows > XP SP3

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Anforderungen an Neue Viren

15

Kernel RechteBrowser

JavascriptSandbox

Flash

PDF

Einnisten ?(Schwer) – Auffällig

„Schwer“

Einfallspunkt

• Das Infizieren ist sehr schwer.• Das Updaten ist kaum möglich oder würde auffallen• Treiber sind signiert• Bei Windows 8 Muss Microsoft Treiber signieren• Selbst Gestohlene Zertifikate sind nicht ewig nutzbar

(Timestamp AblaufZeit)

Updaten ?Kann auffällig sein

Viren mit Scriptsteuerung

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Virus

Idee: Modularisiere und Scripte den Virus

17

Filesystem

Hook

Keyboard

Hook

Netzwerk

Kommunikation

Script

sprache

Harddisk

Hook…

Virus „exe“ mit Signatur

Virus

Programm

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

18

Steuere die Module von der Scritpsprache

„marshalling“

Function (Filehook()) {If (OS_Filehook.Name == „Bauplan“) {

Comm.SendFile(OS_Filehook.Name)}If (OS_Process == VirenscannerXYZ) {

Deactivate_Trojan();}

}

VirusFilesystem

Hook

Keyboard

Hook

Netzwerk

Kommunikation

Script

sprache

Virus „exe“ mit Signatur

• Updatebar ohne den Virus selbst zu ändern.• Minimalistischer Scriptinterpreter kann sehr sehr klein sein (3-4 kbytes)• Simulator kann mit dem Virus nichts anfangen• Kann per Default ein unauffälliges Programm sein• Programm kann per Internet geladen werden• Sehr Stabil, da Scriptsprache nicht abstürzt• Kann Bestandteil jedes Grafikkarten/Netzwerkkarten Treibers sein.

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Code Verstecke

19

Verteilen des „Codes“ öffentlich über Facebook Postings ?(Browser Cache, Icons, DNS Sidechannels, Netzwerkkarten Paket ?)

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Code Verstecke

20

Speichern des „Codes“ über die Registry mittels Fehlerkorrektur(Software Licensing Speicher Tricks)

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Optimale Einsatzmöglichkeiten

21

• Überall wo es schwer ist, mehrmals hinzukommen• Überall, wo Updaten potentiell riskant ist (Auffällig)• Updaten ohne Reboot !• Hohe Ähnlichkeit zur ROP Programmierung

Targets:• AppStores (Apple / Google Play)

Sobald einmal „drinnen“ erlaubt er Zweckentfremdung• APT „preinstalled“ -> Industriespionage / Sabotage

• Konzept anwendbar auch bei Buffer Exploit CPU

Weitere Verwendbarkeit:

„nicht auf das Betriebsystem beschränkt !“ (Ring –x)

Beispiel Flame

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Beispiel Flame

23

KernelSystem

Rights

Browser

JavascriptSandbox

Flash

PDF

Einnisten ?Unauffällig

Windows Update -> „Sehr Schwer“Erkennbarkeit: -> „Unauffällig“Viren Update: -> Auffällig wenn zu oft

• Das Infizieren ist sehr schwer ( Windows Update)• Häufiges Updaten ist kaum möglich oder würde auffallen• Trojaner Treiber sind signiert (Microsoft Zertifikat …)• Selbst Rouge Zertifikate sind nicht ewig nutzbar

(Timestamp AblaufZeit)

Daher ist ein Scritping Modularer Virus Optimal für diesen Zweck

Updaten ?Kann auffällig sein

Ring – X ?

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Ringe

Klassische Betrachtung

25

Kernel RechteBrowser

JavascriptSandbox

Flash

PDF

Kernel Browser

Javascript

Flash

PDF

Einfallspunkt

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Ring – X ?

26

KernelSystem

RightsProgramme

Hyper

visorCPU

Kernel RechteBrowser

JavascriptSandbox

Flash

PDF

PhysischeHardware

Hypervisor Ring-1 Viren

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

28

Windows• Volle Kontrolle über das OS• Ändern des Hauptspeichers• Ändern von Hardware

zugriffen

• Unterbrechen des Betriebbsystems

• Unerkennbar(Kaum detektierbar)

• Einschränken des Betriebsystems

Hypervisor Viren

Hypervisor

Virus

Windows

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Hypervisor Viren

„Programm Update“

29

Kernel RechteBrowser

JavascriptSandbox Flash

Update Punkt

Hyper

visor

Viru

sCPU

• Scripting Hypervisor Viruses• Update per Speicherinhalt, Registry, Bilder, …..• Unerkennbar

Ring-x Viren

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Ring – X ?

31

KernelSystem

RightsProgramme

Hyper

visor

System

Management

Memory

Controller

Netzwerkkarte

Grafikkarte

Soundkarte

CPU

USB

IDE/SATA

Kernel RechteBrowser

JavascriptSandbox

Flash

PDF

PhysischeHardware

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Hardware IST Software !

Ein „Flip Flop“ in Verilog

reg register_value; // als Register oder Speichervariable

wire reset, clock, set, en, datain;

always @(posedge clock or negedge reset)

begin // reagiert auf positive clock-Flanke oder fallende reset-Flanke.

if (!reset) //asynchrones Rücksetzen, wenn reset = LOW

register_value <= 1'b0;

else if (set) // synchrones Setzen, wenn set = HIGH

register_value <= 1'b1;

else if (en)

register_value <= datain;

end

Moderne CPU‘s wie eine „Core“ besteht aus Millionen Zeilen „Code“ mit Fehlern !

Sehr Bekannt: Pentium Divisions Bug

Intel Core CPU hat um die 80 Bekannte Fehler (siehe Errata)http://download.intel.com/design/mobile/SPECUPDT/30922214.pdf

32

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Ring – X ?

33

KernelSystem

RightsProgramme

Einnisten ?Unauffällig

Einfallspunkt: Unklar

• Hardware wird kaum geprüft (Wie ?)• Hardware ist „Software“• Kann Bugs ,Exploits oder Backdoors haben• Jedes Subsystem kann eine Firmware und eine CPU haben• Subsysteme sind auch Firmware updatebar• Sämtliche Systeme haben vollen Speicherzugriff

Hotfix ?Nicht möglich

Hyper

visor

System

Management

Memory

Controller

Netzwerkkarte

Grafikkarte

Soundkarte

CPU

USB

IDE/SATA

Update Punkt

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Erster Ring -4 Hack?

34

Xbox == PC17 Mistakes Microsoft Made In The Xbox Security

http://db.tt/QTMYc9bEhttp://events.ccc.de/congress/2005/fahrplan/attachments/674-slides_xbox.pdf

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Erster Ring -4 Hack?

35

Diese MicroCPU war imstande, beim Sarten die Komplette Sicherheit abzuschalten

Exploiting Micro CPU‘s

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Micro CPU‘s

37

Manchester Mark 1 (1948)

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Micro CPU‘s

38

Manchester Mark 1 (1948)

6 Befehle sind komplett ausreichend um einen Vollständigen Computer darzustellen

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Micro CPU‘s

39

Die Manchester Mark 1 CPUwürde heute etwa 100 Bytes groß sein (als Virtuell CPU)(und ähnlich der hier ausschauen)

6 Befehle sind komplett ausreichend um einen Vollständigen Computer darzustellen

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Execution of CPU‘s

40

Als „CPU“ für diesen Code würde ein einfacher Buffer Overflow reichen

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Execution of CPU‘s

41

KernelSystem

RightsProgramme

Der Bug könnte zb. im TPM Controller liegenUnd beim Verarbeiten vom Namen auftreten

Hotfix ?Nicht möglich

Hyper

visor

System

Management

Memory

Controller

Netzwerkkarte

Grafikkarte

Soundkarte

CPU

TPM

IDE/SATA

EinfallspunktUpdate PunktCodeAblage

CPU

Virus

• Ändern von Schlüsseln• Code Injektion• Password Override

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Conclusio

42

• Einen Virus dort zu erstellen ist sehr hart• Wenige Befehle• Geringe Geschwindigkeit• Kein vorkommen von „0“ im Programm• Aktuell kein Compiler für so etwas verfügbar

„Cpu ist nicht Compiler freundlich“• Ausführung ohne Spuren zu hinterlassen• Kaum detektierbar

• Hardware kann nicht upgedated werden• Verlust der Integrität des Rechners

This document is intellectual property of Ikarus Security Software and may not be reproduced or transmitted electronically without permission

Fragen