security consultant at immunity inc joel noguera · 2019. 12. 11. · demo. what about the tools?...

57
Unveiling the underground world of ANTI-CHEATS Joel Noguera Security Consultant at Immunity Inc @niemand_sec

Upload: others

Post on 24-Aug-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Unveiling the underground world of

ANTI-CHEATSJoel Noguera

Security Consultant at Immunity Inc

@niemand_sec

Page 2: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Anti-Cheats

Cheats

Analyzing Anti-Cheats

Conclusions& Results

What are we going to talk about?

Page 3: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

FIRST RULE OF THE GAMING CLUB, YOU

DON'T CHEAT(or get caught doing it)

Page 4: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse
Page 5: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

GIF DEL PIBE QUE LO ENCUENTRA CON WORD.exe en medio del torneo

Page 6: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Anti Cheats

Page 7: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

An

ti-C

hea

ts

Page 8: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Let’s see some numbers...

336.500.000EAC

275.000.000

XC3

500.000

BE

30.000.000

VAC

31.000.000

Monthly Active Users

Page 9: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse
Page 10: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse
Page 11: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse
Page 12: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse
Page 13: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Anti-Cheat Components

Page 14: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Kernel Driver

[·] Handle stripping/Access Control

[·] Register kernel callbacks

[·] Rejection of Kernel/User mode debugging

[·] Analysis of privileged process (lsass and csrss)

[·] Block blacklisted/unsigned drivers

[·] Monitoring of kernel function calls

Page 15: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

DLL inside Games

[·] Control of access flags to different sections

[·] Identification of hooks

[·] Thread Hijacking

[·] DLL Injection

[·] Function signatures

[·] VEH/SEH modification

[·] Game resources modification

[·] Detection of virtual environment

Page 16: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

[·] Process/File Controls

[·] Blacklisted programs detection

[·] Manage logic from Driver

[·] Control of game client and DLL hashes

[·] Multi-client detection

[·] Program integrity controls

External Ring 3 Process

Page 17: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Cheats

Page 18: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Pros Cons

External

[·] Quick for small patches[·] Easy to master[·] Can be closed in certain cases

[·] Slow[·] Easy to detect[·] Limited potential[·] Requires a Handle (usually)

Internal[·] Great performance[·] Direct access to memory[·] Hard to detect if you are good enough

[·] Hard to master[·] Easier to detect if you mess it up

Internal (DLL) vs External (Process)

Page 19: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

AimbotsWallhack/ESP

Page 20: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Pro players getting caught? Why not

Page 21: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Parallel Market

Page 22: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Parallel Market

Page 23: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Apex claims:

[·] More than 770k players banned [·] Over 300K account creations blocked [·] Over than 4k cheat sellers accounts (spammers) banned in 20 days

Are they fighting back?

https://unknowncheats.me/

Page 24: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Analyzing Anti-Cheats

Page 25: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Goal:

[·] Read/Write/Alloc Memory (Internal & External)

[·] Run Code inside Game’s Process

[·] Be as stealthy as possible

Methodology

Page 26: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

AC usually control/block/reject new HANDLEs to the game process:

[·] Driver that protects game and AC processes

Some process need to be whitelisted: lsass, csrss, AC

Hijacking techniques come to our rescue:

[·] Handle Hijacking

[·] Stealth Handle Hijacking

[·] Hooking

Hijacking Techniques

Page 27: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hijacking Techniques

Page 28: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hijacking Techniques - NamedPipe

“\Device\NamedPiped\270F59B0075AA3D3”

Page 29: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse
Page 30: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hijacking Techniques - NamedPipeDisadvantages

Page 31: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Imagine a world where our shared memory does not leave an open HANDLE and we can cover better our tracks.

Hijacking Techniques - FileMapping

Page 32: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

“File mapping object does not close until all references to it are released”

We can call CloseHandle without calling to UnmapViewOfFile.

Hijacking Techniques - FileMapping

Page 33: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hijacking Techniques - FileMapping

We can make it even better by delaying the execution

Manual spinlocks to avoid mutex/semaphores HANDLEs

Page 34: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse
Page 35: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hijacking Techniques - FileMappingDisadvantages

Page 36: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

EAC also hook functions on lsass.exe:

Why?

- Validate/Control/Track each action done against the game

Hijacking Techniques - Bypass Hooks

Page 37: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hijacking Techniques - Bypass Hooks

Page 38: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hijacking Techniques - Bypass HooksDisadvantages

Page 39: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hooking

Page 40: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hooking

Hooking Graphic Engines:

[·] IAT hooking

[·] JMPs on Prolog functions

What about 3rd party libraries?

[·] Steam Overlay

[·] Open Broadcaster Software

Page 41: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Redirects execution to gameoverlayrenderer64.dll:$8A480

Redirects to graphics-hook64.7FFEB97AE4D0

Steam Overlay

Open Broadcaster Software

Page 42: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Hooking - Code Caves and NamedPipes?

Page 43: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Refresher- Bypass HooksDisadvantages

Page 44: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Moving to kernel...Drivers

Page 45: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Cheat developers also develop their own to fight inside the kernel.Loading a Driver:

[·] Test Mode

[·] Sign your own Driver ($$$$$$$$)

[·] Abuse of another driver

GIGABYTE Driver

[·] CVE-2018-19320 (ring0 memcpy with VA)

[·] CVE-2018-19321 (read/write arbitrary physical memory)

Drivers

Page 46: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

EAC downgrading the HANDLE

Page 47: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

1) Search for EPROCESS Struct in kerneltypedef struct { CHAR ImageFileName[15]; DWORD PriorityClass; }

2) Obtain the ObjectTable (HANDLE_TABLE)

3) Use ExpLookupHandleTableEntry(HandleTable, Handle)

4) Retrieve HANDLE

5) Modify GrantedAccess

6) Overwrite kernel memory

7) Profit

Driver - DKOM

Page 48: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse
Page 49: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

Refresher- Bypass HooksDisadvantages

Page 50: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

One Last Attempt

Page 51: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

1) Leak handle pointers using NtQuerySystemInformationSystemExtendedHandleInformation (0x40) as SYSTEM_INFORMATION_CLASS

2) Locate valid KPROCESS pointer

_KPROCESS.Header == 0x00B60003

3) Traverse linked list -> _EPROCESS.ActiveProcessLinks4) Obtain DirectoryBaseTable -> _EPROCESS.PEB.DirectoryBaseTable5) Obtain target Base Address -> _EPROCESS.SectionBaseAddress6) Dereference Ring3 virtual addresses

7) Directly modify/read memory

Driver - Just do it from kernel!

Page 52: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

DEMO

Page 53: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

What about thetools?

Page 54: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse
Page 55: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

[·] Fight at kernel level vs Trivial Bypasses

[·] Blacklisting all drivers is impossible

[·] Compatibility with Windows and 3rd applications is a problem

Black Hat Sound Bytes

Page 56: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

ReClass Plugin - Driver Reader

AntiCheat-Testing-Framework

[·] CheatHelper & DriverHelper[·] DriverDisabler & Synapse Driver exploit (Razer)[·] HandleHijackingDLL and HandleHijackingMaster

[·] NamePipes and FileMapping[·] WinApi Hooking Bypass & Lua Hooking[·] Handle Elevation and External Driver

Open Source Projects

niemand-sec/ReClass.NET-DriverReader

niemand-sec/AntiCheat-Testing-Framework

Page 57: Security Consultant at Immunity Inc Joel Noguera · 2019. 12. 11. · DEMO. What about the tools? [·] Fight at kernel level vs Trivial Bypasses ... [·] DriverDisabler & Synapse

niemand-sec/ReClass.NET-DriverReader

THANK YOU!

@niemand_sec

niemand-sec/AntiCheat-Testing-Framework