SlideShare uma empresa Scribd logo
1 de 29
C++ and Assembly: Debugging
and Reverse Engineering
Mike Gelfand
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
About me
• Mike Gelfand
• Principal developer at SolarWinds MSP
• Used a handful of programming languages in the past 10+ years
• Love cats
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Agenda
• What is the assembly language and how does it compare to C++?
• How do we leverage assembly knowledge in everyday life?
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Assembly Language,
whatever that is
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Typical use in modern age
•Operating systems (bootloaders,
hardware setup)
•Compilers (intermediate language, inline
assembler)
•Performance-critical code (encryption,
graphics, scientific simulations)
•Reverse engineering
•Debugging
leal -12(%ecx, %eax, 8), %edi
movzbl %ah, %ebp
fsub %st, %st(3)
(AT&T)
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Just how bad could it be?
CAN I HAZ
CLARITY?!
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Just how bad could it be?
leal -12(%ecx, %eax, 8), %edi
movzbl %ah, %ebp
fsub %st, %st(3)
(AT&T)
lea edi, [ecx + eax * 8 - 12]
movzx ebp, ah
fsub st(3), st
(Intel)
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Switching between Intel and AT&T flavors
Switch to Intel:
(gdb) set disassembly-flavor intel
(lldb) settings set target.x86-disassembly-flavor intel
Switch to AT&T (but why?):
(gdb) set disassembly-flavor att
(lldb) settings set target.x86-disassembly-flavor att
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
x86 registers overview © Wikipedia
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
General-purpose registers in the wild
Register Name Meaning [Extra] Use
RAX, EAX, AX Accumulator Result of multiplication or division
RBX, EBX, BX Base index Array index
RCX, ECX, CX Counter Number of iterations left in the loop or string operation
RDX, EDX, DX Data Multiplication result or dividend upper bits
RSP, ESP, SP Stack pointer Address of the top of the stack
RBP, EBP, BP Stack base pointer Address of the current stack frame
RSI, ESI, SI Source index Address of the current source operand of string operations
RDI, EDI, DI Destination index Address of the current destination operand of string operations
RIP, EIP Instruction pointer Address of the current instruction being executed
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
C++ vs. Assembly: Basic stuff
C++
int a = 5;
a += 7;
int b = a - 4;
a |= b;
bool c = a & 7;
a *= b;
b = *(int*)(a + b);
Assembly (AT&T)
mov $5, %eax
add $7, %eax
lea -4(%eax), %ebx
or %ebx, %eax
test $7, %eax
imul %ebx
mov (%eax, %ebx), %ebx
Assembly (Intel)
mov eax, 5
add eax, 7
lea ebx, [eax - 4]
or eax, ebx
test eax, 7
imul ebx
mov ebx, [eax + ebx]
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Flags register
Flag Meaning Category Use
CF Carry Status Carry or borrow indication (addition, subtraction, shift)
PF Parity Status Floating-point C2 flag check (e.g. FUCOM with NaN value)
AF Adjust Status Same as CF but just for the lower nibble (think BCD)
ZF Zero Status Result is zero/non-zero
SF Sign Status Result is negative/positive
OF Overflow Status Sign bit changed when adding two numbers of same sign, or subtracting two numbers of
different signs
DF Direction Control Specifies string processing direction
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
C++ vs. Assembly: Branching
C++
int a = 10;
while (a > 0)
{
if (a % 2 == 0)
a -= 3;
else
a /= 2;
}
Assembly (compiler)
[0x1f73] <+3>: mov ecx, 10
[0x1f76] <+6>: test ecx, ecx
[0x1f78] <+8>: jle 0x1f93 ; <+35>
[0x1f7a] <+10>: nop word ptr [eax + eax]
[0x1f80] <+16>: lea edx, [ecx - 0x3]
[0x1f83] <+19>: mov eax, ecx
[0x1f85] <+21>: shr eax
[0x1f87] <+23>: test cl, 0x1
[0x1f8a] <+26>: cmove eax, edx
[0x1f8d] <+29>: test eax, eax
[0x1f8f] <+31>: mov ecx, eax
[0x1f91] <+33>: jg 0x1f80 ; <+16>
[0x1f93] <+35>:
Assembly (human)
mov eax, 10
loop_start:
cmp eax, 0
jle finish
test eax, 1
jnz divide
sub eax, 3
jmp loop_start
divide:
sar eax, 1
jmp loop_start
finish:
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Calling conventions
• Where parameters and results reside
• In which order parameters are passed
• Who cleans up after the call
• What registers are preserved and who does it
• etc.
Currently in wide use:
• x86: cdecl, stdcall
• x64: MS, System V
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
C++ vs. Assembly: Calling functions (non-virtual, cdecl)
int f(int a, int b)
{
return a + b;
}
int g()
{
return f(2, 3) + 4;
}
f(int, int):
mov eax, DWORD PTR [esp + 0x8]
add eax, DWORD PTR [esp + 0x4]
ret
g():
push 0x3
push 0x2
call 0x8048520 <f(int, int)>
pop edx
add eax, 0x4
pop ecx
ret
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
C++ vs. Assembly: Calling functions (virtual, cdecl)
struct I
{
virtual int f(int a, int b) = 0;
};
struct A : public I
{
int f(int a, int b) override
{
return a + b;
}
};
int g(I& x)
{
return x.f(2, 3) + 4;
}
A::f(int, int):
mov eax, DWORD PTR [esp + 0xc]
add eax, DWORD PTR [esp + 0x8]
ret
g(I&):
sub esp, 0x10
mov eax, DWORD PTR [esp + 0x14]
mov edx, DWORD PTR [eax]
push 0x3
push 0x2
push eax
call DWORD PTR [edx]
add esp, 0x1c
add eax, 0x4
ret
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Assembly & Disassember
The Rescue Rangers
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Example #1: Waiting in kernel mode
// In a header far, far away
ULONG const TimeoutMs = 30000;
// Waiting up to 30 seconds for event to happen
LARGE_INTEGER timeout;
timeout.QuadPart = -1 * TimeoutMs * 10 * 1000;
NTSTATUS const waitResult =
KeWaitForSingleObject(&event, Executive,
KernelMode, FALSE, &timeout);
mov eax, dword ptr [TimeoutMs]
lea rcx, [rsp + 0x48] ; 1st arg
imul eax, eax, 0xFFFFD8F0
xor r9d, r9d ; 4th arg
xor r8d, r8d ; 3rd arg
xor edx, edx ; 2nd arg
mov qword ptr [rsp + 0x40], rax
lea rax, [rsp + 0x40]
mov qword ptr [rsp + 0x20], rax ; 5th arg
call qword ptr [_imp_KeWaitForSingleObject]
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Example #1: Waiting in kernel mode
// In a header far, far away
LONG const TimeoutMs = 30000;
// Waiting up to 30 seconds for event to happen
LARGE_INTEGER timeout;
timeout.QuadPart = -1 * TimeoutMs * 10 * 1000;
NTSTATUS const waitResult =
KeWaitForSingleObject(&event, Executive,
KernelMode, FALSE, &timeout);
mov eax, dword ptr [TimeoutMs]
lea rcx, [rsp + 0x48] ; 1st arg
imul eax, eax, 0xFFFFD8F0
xor r9d, r9d ; 4th arg
xor r8d, r8d ; 3rd arg
xor edx, edx ; 2nd arg
cdqe
mov qword ptr [rsp + 0x40], rax
lea rax, [rsp + 0x40]
mov qword ptr [rsp + 0x20], rax ; 5th arg
call qword ptr [_imp_KeWaitForSingleObject]
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Example #2: Magic statics
struct Data
{
int x;
Data() : x(123) {}
};
Data& GetData()
{
static Data data;
return data;
}
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Example #2: Magic statics
GCC 4.2.1 (released 10 years ago)
0x08048560 <_Z7GetDatav+0>: push ebp
0x08048561 <_Z7GetDatav+1>: mov ebp,esp
0x08048563 <_Z7GetDatav+3>: sub esp,0x8
0x08048566 <_Z7GetDatav+6>: cmp BYTE PTR ds:0x8049790,0x0
0x0804856d <_Z7GetDatav+13>: je 0x8048576 <_Z7GetDatav+22>
0x0804856f <_Z7GetDatav+15>: leave
0x08048570 <_Z7GetDatav+16>: mov eax,0x8049798
0x08048575 <_Z7GetDatav+21>: ret
0x08048576 <_Z7GetDatav+22>: mov DWORD PTR [esp],0x8049790
0x0804857d <_Z7GetDatav+29>: call 0x80483e4 <__cxa_guard_acquire@plt>
0x08048582 <_Z7GetDatav+34>: test eax,eax
0x08048584 <_Z7GetDatav+36>: je 0x804856f <_Z7GetDatav+15>
0x08048586 <_Z7GetDatav+38>: mov DWORD PTR [esp],0x8049798
0x0804858d <_Z7GetDatav+45>: call 0x80485e0 <Data>
0x08048592 <_Z7GetDatav+50>: mov DWORD PTR [esp],0x8049790
0x08048599 <_Z7GetDatav+57>: call 0x8048414 <__cxa_guard_release@plt>
0x0804859e <_Z7GetDatav+62>: mov eax,0x8049798
0x080485a3 <_Z7GetDatav+67>: leave
0x080485a4 <_Z7GetDatav+68>: ret
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Example #2: Magic statics
MSVC 12 (Visual Studio 2013)
example!GetData [example.cpp @ 14]:
14 00e61040 a14485e800 mov eax,dword ptr [example!$S1 (00e88544)]
15 00e61045 a801 test al,1
15 00e61047 7512 jne example!GetData+0x1b (00e6105b)
example!GetData+0x9 [example.cpp @ 15]:
15 00e61049 83c801 or eax,1
15 00e6104c b94085e800 mov ecx,offset example!data (00e88540)
15 00e61051 a34485e800 mov dword ptr [example!$S1 (00e88544)],eax
15 00e61056 e8aaffffff call example!ILT+0(??0DataQAEXZ) (00e61005)
example!GetData+0x1b [example.cpp @ 16]:
16 00e6105b b84085e800 mov eax,offset example!data (00e88540)
17 00e61060 c3 ret
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Example #2: Magic statics
MSVC 15 (Visual Studio 2017)
example!GetData [example.cpp @ 14]:
14 010765a0 64a12c000000 mov eax,dword ptr fs:[0000002Ch]
15 010765a6 8b0d80fc0c01 mov ecx,dword ptr [example!_tls_index (010cfc80)]
15 010765ac 8b0c88 mov ecx,dword ptr [eax+ecx*4]
15 010765af a14cfc0c01 mov eax,dword ptr [example!type_info `RTTI Type Descriptor'+0x128 (010cfc4c)]
15 010765b4 3b8104010000 cmp eax,dword ptr [ecx+104h]
15 010765ba 7f06 jg example!GetData+0x22 (010765c2)
example!GetData+0x1c [example.cpp @ 16]:
16 010765bc b848fc0c01 mov eax,offset example!data (010cfc48)
17 010765c1 c3 ret
example!GetData+0x22 [example.cpp @ 15]:
15 010765c2 684cfc0c01 push offset example!type_info `RTTI Type Descriptor'+0x128 (010cfc4c)
15 010765c7 e8d9afffff call example!ILT+1440(__Init_thread_header) (010715a5)
15 010765cc 83c404 add esp,4
15 010765cf 833d4cfc0c01ff cmp dword ptr [example!type_info `RTTI Type Descriptor'+0x128 (010cfc4c)],0FFFFFFFFh
15 010765d6 75e4 jne example!GetData+0x1c (010765bc)
example!GetData+0x38 [example.cpp @ 15]:
15 010765d8 b948fc0c01 mov ecx,offset example!data (010cfc48)
15 010765dd e857c1ffff call example!ILT+5940(??0DataQAEXZ) (01072739)
15 010765e2 684cfc0c01 push offset example!type_info `RTTI Type Descriptor'+0x128 (010cfc4c)
15 010765e7 e89eb6ffff call example!ILT+3205(__Init_thread_footer) (01071c8a)
15 010765ec 83c404 add esp,4
15 010765ef ebcb jmp example!GetData+0x1c (010765bc)
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Example #3: Code obfuscation
push edx
push 0x4920
mov dword ptr [esp], ecx
mov dword ptr [esp], edi
mov edi, 0x16BC2A97
push eax
mov eax, 0x7C4B60CD
add dword ptr [esp + 8], eax
mov eax, dword ptr [esp]
add esp, 4
add dword ptr [esp + 4], edi
sub dword ptr [esp + 4], 0x7C4B60CD
pop edi
push dword ptr [esp]
pop eax
push esi
mov esi, esp
add esi, 4
add esi, 4
xchg dword ptr [esp], esi
pop esp
push ebp
mov ebp, 0x16BC2A97
sub eax, ebp
pop ebp
mov edx, dword ptr [esp]
add esp, 4
void f(x86_regs32_t& regs, std::vector<std::uint32_t>& stack)
{
stack.push_back(regs.edx);
stack.push_back(0x4920);
stack[stack.size() - 1 - 0] = regs.ecx;
stack[stack.size() - 1 - 0] = regs.edi;
regs.edi = 0x16BC2A97;
stack.push_back(regs.eax);
regs.eax = 0x7C4B60CD;
stack[stack.size() - 1 - 2] += regs.eax;
regs.eax = stack[stack.size() - 1 - 0];
stack.pop_back();
stack[stack.size() - 1 - 1] += regs.edi;
stack[stack.size() - 1 - 1] -= 0x7C4B60CD;
regs.edi = stack[stack.size() - 1 - 0]; stack.pop_back();
stack.push_back(stack[stack.size() - 1 - 0]);
regs.eax = stack[stack.size() - 1 - 0]; stack.pop_back();
stack.push_back(regs.esi);
regs.esi = 0;
regs.esi += 1;
regs.esi += 1;
std::swap(stack[stack.size() - 1 - 0], regs.esi);
stack.resize(stack.size() - stack[stack.size() - 1 - 0] + 1);
stack.push_back(regs.ebp);
regs.ebp = 0x16BC2A97;
regs.eax -= regs.ebp;
regs.ebp = stack[stack.size() - 1 - 0]; stack.pop_back();
regs.edx = stack[stack.size() - 1 - 0];
stack.pop_back();
}
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Example #3: Code obfuscation
mov eax, edx
add edx, 0x16BC2A97
void f(std::uint32_t& eax, std::uint32_t& edx)
{
regs.eax = regs.edx;
regs.edx += 0x16BC2A97;
}
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
The Stuff
in case you’re interested
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Want to learn assembly and contribute at the same time?
• FASM — modern and fast assembler written in assembly
http://flatassembler.net/
• Menuet OS, Kolibri OS, BareMetal, and whole lot more
http://wiki.osdev.org/Projects
• KOL & MCK by Vladimir Kladov (achtung: Delphi)
http://kolmck.ru/
© 2017 SolarWinds MSP UK Ltd. All rights reserved.
Questions?
mike.gelfand@solarwinds.com
mikedld@mikedld.com
The SolarWinds and SolarWinds MSP trademarks are the
exclusive property of SolarWinds MSP UK Ltd. or its affiliates
and may be registered or pending registration with the U.S.
Patent and Trademark Office and in other countries. All other
SolarWinds MSP UK and SolarWinds trademarks, service
marks, and logos may be common law marks or are registered
or pending registration. All other trademarks mentioned
herein are used for identification purposes only and are
trademarks (and may be registered trademarks) of their
respective companies.

Mais conteúdo relacionado

Mais procurados

The Ring programming language version 1.5.4 book - Part 25 of 185
The Ring programming language version 1.5.4 book - Part 25 of 185The Ring programming language version 1.5.4 book - Part 25 of 185
The Ring programming language version 1.5.4 book - Part 25 of 185Mahmoud Samir Fayed
 
General Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics HardwareGeneral Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics HardwareDaniel Blezek
 
Use C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoUse C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoChih-Hsuan Kuo
 
Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"Yulia Tsisyk
 
IoT to the Database: Soldering, Python and a little PL/SQL
IoT to the Database: Soldering, Python and a little PL/SQLIoT to the Database: Soldering, Python and a little PL/SQL
IoT to the Database: Soldering, Python and a little PL/SQLBlaine Carter
 
Pandas+postgre sql 實作 with code
Pandas+postgre sql 實作 with codePandas+postgre sql 實作 with code
Pandas+postgre sql 實作 with codeTim Hong
 
A comparison of apache spark supervised machine learning algorithms for dna s...
A comparison of apache spark supervised machine learning algorithms for dna s...A comparison of apache spark supervised machine learning algorithms for dna s...
A comparison of apache spark supervised machine learning algorithms for dna s...Valerio Morfino
 
The elements of a functional mindset
The elements of a functional mindsetThe elements of a functional mindset
The elements of a functional mindsetEric Normand
 
Cosmological Perturbations and Numerical Simulations
Cosmological Perturbations and Numerical SimulationsCosmological Perturbations and Numerical Simulations
Cosmological Perturbations and Numerical SimulationsIan Huston
 
【論文紹介】Relay: A New IR for Machine Learning Frameworks
【論文紹介】Relay: A New IR for Machine Learning Frameworks【論文紹介】Relay: A New IR for Machine Learning Frameworks
【論文紹介】Relay: A New IR for Machine Learning FrameworksTakeo Imai
 
PyTorch 튜토리얼 (Touch to PyTorch)
PyTorch 튜토리얼 (Touch to PyTorch)PyTorch 튜토리얼 (Touch to PyTorch)
PyTorch 튜토리얼 (Touch to PyTorch)Hansol Kang
 
Scala for Java programmers
Scala for Java programmersScala for Java programmers
Scala for Java programmers輝 子安
 
Evaluation of X32 ABI for Virtualization and Cloud
Evaluation of X32 ABI for Virtualization and CloudEvaluation of X32 ABI for Virtualization and Cloud
Evaluation of X32 ABI for Virtualization and CloudThe Linux Foundation
 
Fast Wavelet Tree Construction in Practice
Fast Wavelet Tree Construction in PracticeFast Wavelet Tree Construction in Practice
Fast Wavelet Tree Construction in PracticeRakuten Group, Inc.
 
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)Maho Nakata
 
A compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCoreA compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCoreTadeu Zagallo
 
Verification of Concurrent and Distributed Systems
Verification of Concurrent and Distributed SystemsVerification of Concurrent and Distributed Systems
Verification of Concurrent and Distributed SystemsMykola Novik
 

Mais procurados (20)

The Ring programming language version 1.5.4 book - Part 25 of 185
The Ring programming language version 1.5.4 book - Part 25 of 185The Ring programming language version 1.5.4 book - Part 25 of 185
The Ring programming language version 1.5.4 book - Part 25 of 185
 
General Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics HardwareGeneral Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics Hardware
 
Use C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoUse C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in Gecko
 
Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"
 
IoT to the Database: Soldering, Python and a little PL/SQL
IoT to the Database: Soldering, Python and a little PL/SQLIoT to the Database: Soldering, Python and a little PL/SQL
IoT to the Database: Soldering, Python and a little PL/SQL
 
AA-sort with SSE4.1
AA-sort with SSE4.1AA-sort with SSE4.1
AA-sort with SSE4.1
 
Pandas+postgre sql 實作 with code
Pandas+postgre sql 實作 with codePandas+postgre sql 實作 with code
Pandas+postgre sql 實作 with code
 
ANPR FPGA Workshop
ANPR FPGA WorkshopANPR FPGA Workshop
ANPR FPGA Workshop
 
A comparison of apache spark supervised machine learning algorithms for dna s...
A comparison of apache spark supervised machine learning algorithms for dna s...A comparison of apache spark supervised machine learning algorithms for dna s...
A comparison of apache spark supervised machine learning algorithms for dna s...
 
The elements of a functional mindset
The elements of a functional mindsetThe elements of a functional mindset
The elements of a functional mindset
 
Cosmological Perturbations and Numerical Simulations
Cosmological Perturbations and Numerical SimulationsCosmological Perturbations and Numerical Simulations
Cosmological Perturbations and Numerical Simulations
 
【論文紹介】Relay: A New IR for Machine Learning Frameworks
【論文紹介】Relay: A New IR for Machine Learning Frameworks【論文紹介】Relay: A New IR for Machine Learning Frameworks
【論文紹介】Relay: A New IR for Machine Learning Frameworks
 
PyTorch 튜토리얼 (Touch to PyTorch)
PyTorch 튜토리얼 (Touch to PyTorch)PyTorch 튜토리얼 (Touch to PyTorch)
PyTorch 튜토리얼 (Touch to PyTorch)
 
Network security
Network securityNetwork security
Network security
 
Scala for Java programmers
Scala for Java programmersScala for Java programmers
Scala for Java programmers
 
Evaluation of X32 ABI for Virtualization and Cloud
Evaluation of X32 ABI for Virtualization and CloudEvaluation of X32 ABI for Virtualization and Cloud
Evaluation of X32 ABI for Virtualization and Cloud
 
Fast Wavelet Tree Construction in Practice
Fast Wavelet Tree Construction in PracticeFast Wavelet Tree Construction in Practice
Fast Wavelet Tree Construction in Practice
 
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
 
A compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCoreA compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCore
 
Verification of Concurrent and Distributed Systems
Verification of Concurrent and Distributed SystemsVerification of Concurrent and Distributed Systems
Verification of Concurrent and Distributed Systems
 

Destaque

C++Now Trip Report
C++Now Trip ReportC++Now Trip Report
C++Now Trip Reportcorehard_by
 
Ускоряем сборку С++ проектов. Практика использования unity-сборок
Ускоряем сборку С++ проектов. Практика использования unity-сборокУскоряем сборку С++ проектов. Практика использования unity-сборок
Ускоряем сборку С++ проектов. Практика использования unity-сборокcorehard_by
 
Analysis and interpretation of monitoring data
Analysis and interpretation of monitoring dataAnalysis and interpretation of monitoring data
Analysis and interpretation of monitoring datacorehard_by
 
Restinio - header-only http and websocket server
Restinio - header-only http and websocket serverRestinio - header-only http and websocket server
Restinio - header-only http and websocket servercorehard_by
 
(Не)чёткий поиск
(Не)чёткий поиск(Не)чёткий поиск
(Не)чёткий поискcorehard_by
 
C++ в играх, больших и не очень
C++ в играх, больших и не оченьC++ в играх, больших и не очень
C++ в играх, больших и не оченьcorehard_by
 
MxxRu::externals: Repositoryless Dependency Manager
MxxRu::externals: Repositoryless Dependency ManagerMxxRu::externals: Repositoryless Dependency Manager
MxxRu::externals: Repositoryless Dependency Managercorehard_by
 
Actors for fun and profit
Actors for fun and profitActors for fun and profit
Actors for fun and profitcorehard_by
 
The beast is becoming functional
The beast is becoming functionalThe beast is becoming functional
The beast is becoming functionalcorehard_by
 
Обработка потока данных на примере deep packet inspection: внутренняя архитек...
Обработка потока данных на примере deep packet inspection: внутренняя архитек...Обработка потока данных на примере deep packet inspection: внутренняя архитек...
Обработка потока данных на примере deep packet inspection: внутренняя архитек...corehard_by
 
C++ in kernel mode
C++ in kernel modeC++ in kernel mode
C++ in kernel modecorehard_by
 
Субъекторная модель
Субъекторная модельСубъекторная модель
Субъекторная модельcorehard_by
 
Abseil - let the savior come?
Abseil - let the savior come?Abseil - let the savior come?
Abseil - let the savior come?corehard_by
 
Поиск уязвимостей с использованием статического анализа кода
Поиск уязвимостей с использованием статического анализа кодаПоиск уязвимостей с использованием статического анализа кода
Поиск уязвимостей с использованием статического анализа кодаcorehard_by
 
Battle: BDD vs notBDD
Battle: BDD vs notBDDBattle: BDD vs notBDD
Battle: BDD vs notBDDCOMAQA.BY
 
Mixing C++ & Python II: Pybind11
Mixing C++ & Python II: Pybind11Mixing C++ & Python II: Pybind11
Mixing C++ & Python II: Pybind11corehard_by
 
Слои тестового фрамеворка. Что? Где? Когда?
Слои тестового фрамеворка. Что? Где? Когда?Слои тестового фрамеворка. Что? Где? Когда?
Слои тестового фрамеворка. Что? Где? Когда?COMAQA.BY
 
Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...
Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...
Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...Ontico
 
Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)
Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)
Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)Ontico
 

Destaque (20)

C++Now Trip Report
C++Now Trip ReportC++Now Trip Report
C++Now Trip Report
 
Ускоряем сборку С++ проектов. Практика использования unity-сборок
Ускоряем сборку С++ проектов. Практика использования unity-сборокУскоряем сборку С++ проектов. Практика использования unity-сборок
Ускоряем сборку С++ проектов. Практика использования unity-сборок
 
Analysis and interpretation of monitoring data
Analysis and interpretation of monitoring dataAnalysis and interpretation of monitoring data
Analysis and interpretation of monitoring data
 
Restinio - header-only http and websocket server
Restinio - header-only http and websocket serverRestinio - header-only http and websocket server
Restinio - header-only http and websocket server
 
(Не)чёткий поиск
(Не)чёткий поиск(Не)чёткий поиск
(Не)чёткий поиск
 
C++ в играх, больших и не очень
C++ в играх, больших и не оченьC++ в играх, больших и не очень
C++ в играх, больших и не очень
 
MxxRu::externals: Repositoryless Dependency Manager
MxxRu::externals: Repositoryless Dependency ManagerMxxRu::externals: Repositoryless Dependency Manager
MxxRu::externals: Repositoryless Dependency Manager
 
Benchmark it
Benchmark itBenchmark it
Benchmark it
 
Actors for fun and profit
Actors for fun and profitActors for fun and profit
Actors for fun and profit
 
The beast is becoming functional
The beast is becoming functionalThe beast is becoming functional
The beast is becoming functional
 
Обработка потока данных на примере deep packet inspection: внутренняя архитек...
Обработка потока данных на примере deep packet inspection: внутренняя архитек...Обработка потока данных на примере deep packet inspection: внутренняя архитек...
Обработка потока данных на примере deep packet inspection: внутренняя архитек...
 
C++ in kernel mode
C++ in kernel modeC++ in kernel mode
C++ in kernel mode
 
Субъекторная модель
Субъекторная модельСубъекторная модель
Субъекторная модель
 
Abseil - let the savior come?
Abseil - let the savior come?Abseil - let the savior come?
Abseil - let the savior come?
 
Поиск уязвимостей с использованием статического анализа кода
Поиск уязвимостей с использованием статического анализа кодаПоиск уязвимостей с использованием статического анализа кода
Поиск уязвимостей с использованием статического анализа кода
 
Battle: BDD vs notBDD
Battle: BDD vs notBDDBattle: BDD vs notBDD
Battle: BDD vs notBDD
 
Mixing C++ & Python II: Pybind11
Mixing C++ & Python II: Pybind11Mixing C++ & Python II: Pybind11
Mixing C++ & Python II: Pybind11
 
Слои тестового фрамеворка. Что? Где? Когда?
Слои тестового фрамеворка. Что? Где? Когда?Слои тестового фрамеворка. Что? Где? Когда?
Слои тестового фрамеворка. Что? Где? Когда?
 
Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...
Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...
Метаданные для кластера: гонка key-value-героев / Руслан Рагимов, Светлана Ла...
 
Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)
Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)
Честное перформанс-тестирование / Дмитрий Пивоваров (ZeroTurnaround)
 

Semelhante a C++ and Assembly: Debugging and Reverse Engineering

Implement an MPI program to perform matrix-matrix multiplication AB .pdf
Implement an MPI program to perform matrix-matrix multiplication AB .pdfImplement an MPI program to perform matrix-matrix multiplication AB .pdf
Implement an MPI program to perform matrix-matrix multiplication AB .pdfmeerobertsonheyde608
 
Gettingstartedwithmatlabimageprocessing
GettingstartedwithmatlabimageprocessingGettingstartedwithmatlabimageprocessing
Gettingstartedwithmatlabimageprocessingtvanii
 
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itEvgeniy Muralev, Mark Vince, Working with the compiler, not against it
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itSergey Platonov
 
Scale17x buffer overflows
Scale17x buffer overflowsScale17x buffer overflows
Scale17x buffer overflowsjohseg
 
Vectorization on x86: all you need to know
Vectorization on x86: all you need to knowVectorization on x86: all you need to know
Vectorization on x86: all you need to knowRoberto Agostino Vitillo
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityDefconRussia
 
The forgotten art of assembly
The forgotten art of assemblyThe forgotten art of assembly
The forgotten art of assemblyMarian Marinov
 
Basic ASM by @binaryheadache
Basic ASM by @binaryheadacheBasic ASM by @binaryheadache
Basic ASM by @binaryheadachecamsec
 
Fast, stable and scalable true radix sorting with Matt Dowle at useR! Aalborg
Fast, stable and scalable true radix sorting with Matt Dowle at useR! AalborgFast, stable and scalable true radix sorting with Matt Dowle at useR! Aalborg
Fast, stable and scalable true radix sorting with Matt Dowle at useR! AalborgSri Ambati
 
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdf
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdfTranslate the following CC++ code into MIPS Assembly Codevoid ch.pdf
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdffcsondhiindia
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
C++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerAndrey Karpov
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)bolovv
 
WCTF 2018 binja Editorial
WCTF 2018 binja EditorialWCTF 2018 binja Editorial
WCTF 2018 binja EditorialCharo_IT
 
MySQL Optimizer: What’s New in 8.0
MySQL Optimizer: What’s New in 8.0MySQL Optimizer: What’s New in 8.0
MySQL Optimizer: What’s New in 8.0oysteing
 
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovWorkshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovFwdays
 
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...Positive Hack Days
 
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06ManhHoangVan
 
Melbourne Groundbreakers Tour - Upgrading without risk
Melbourne Groundbreakers Tour - Upgrading without riskMelbourne Groundbreakers Tour - Upgrading without risk
Melbourne Groundbreakers Tour - Upgrading without riskConnor McDonald
 

Semelhante a C++ and Assembly: Debugging and Reverse Engineering (20)

Implement an MPI program to perform matrix-matrix multiplication AB .pdf
Implement an MPI program to perform matrix-matrix multiplication AB .pdfImplement an MPI program to perform matrix-matrix multiplication AB .pdf
Implement an MPI program to perform matrix-matrix multiplication AB .pdf
 
Gettingstartedwithmatlabimageprocessing
GettingstartedwithmatlabimageprocessingGettingstartedwithmatlabimageprocessing
Gettingstartedwithmatlabimageprocessing
 
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itEvgeniy Muralev, Mark Vince, Working with the compiler, not against it
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it
 
Scale17x buffer overflows
Scale17x buffer overflowsScale17x buffer overflows
Scale17x buffer overflows
 
Vectorization on x86: all you need to know
Vectorization on x86: all you need to knowVectorization on x86: all you need to know
Vectorization on x86: all you need to know
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
 
Qemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System EmulationQemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System Emulation
 
The forgotten art of assembly
The forgotten art of assemblyThe forgotten art of assembly
The forgotten art of assembly
 
Basic ASM by @binaryheadache
Basic ASM by @binaryheadacheBasic ASM by @binaryheadache
Basic ASM by @binaryheadache
 
Fast, stable and scalable true radix sorting with Matt Dowle at useR! Aalborg
Fast, stable and scalable true radix sorting with Matt Dowle at useR! AalborgFast, stable and scalable true radix sorting with Matt Dowle at useR! Aalborg
Fast, stable and scalable true radix sorting with Matt Dowle at useR! Aalborg
 
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdf
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdfTranslate the following CC++ code into MIPS Assembly Codevoid ch.pdf
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdf
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
C++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical Reviewer
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
 
WCTF 2018 binja Editorial
WCTF 2018 binja EditorialWCTF 2018 binja Editorial
WCTF 2018 binja Editorial
 
MySQL Optimizer: What’s New in 8.0
MySQL Optimizer: What’s New in 8.0MySQL Optimizer: What’s New in 8.0
MySQL Optimizer: What’s New in 8.0
 
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen TatarynovWorkshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
Workshop "Can my .NET application use less CPU / RAM?", Yevhen Tatarynov
 
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
 
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
 
Melbourne Groundbreakers Tour - Upgrading without risk
Melbourne Groundbreakers Tour - Upgrading without riskMelbourne Groundbreakers Tour - Upgrading without risk
Melbourne Groundbreakers Tour - Upgrading without risk
 

Mais de corehard_by

C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...corehard_by
 
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...corehard_by
 
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений ОхотниковC++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотниковcorehard_by
 
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр ТитовC++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титовcorehard_by
 
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...corehard_by
 
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья ШишковC++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишковcorehard_by
 
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...corehard_by
 
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...corehard_by
 
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...corehard_by
 
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...corehard_by
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...corehard_by
 
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...corehard_by
 
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел ФилоновC++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филоновcorehard_by
 
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan ČukićC++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukićcorehard_by
 
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia KazakovaC++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakovacorehard_by
 
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон ПолухинC++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухинcorehard_by
 
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...corehard_by
 
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019corehard_by
 
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019corehard_by
 
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019corehard_by
 

Mais de corehard_by (20)

C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
 
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
 
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений ОхотниковC++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
 
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр ТитовC++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
 
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
 
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья ШишковC++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
 
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
 
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
 
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
 
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
 
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
 
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел ФилоновC++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
 
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan ČukićC++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
 
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia KazakovaC++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
 
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон ПолухинC++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
 
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
 
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
 
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
 
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
 

Último

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Último (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

C++ and Assembly: Debugging and Reverse Engineering

  • 1. C++ and Assembly: Debugging and Reverse Engineering Mike Gelfand
  • 2. © 2017 SolarWinds MSP UK Ltd. All rights reserved. About me • Mike Gelfand • Principal developer at SolarWinds MSP • Used a handful of programming languages in the past 10+ years • Love cats
  • 3. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Agenda • What is the assembly language and how does it compare to C++? • How do we leverage assembly knowledge in everyday life?
  • 4. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Assembly Language, whatever that is
  • 5. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Typical use in modern age •Operating systems (bootloaders, hardware setup) •Compilers (intermediate language, inline assembler) •Performance-critical code (encryption, graphics, scientific simulations) •Reverse engineering •Debugging
  • 6. leal -12(%ecx, %eax, 8), %edi movzbl %ah, %ebp fsub %st, %st(3) (AT&T) © 2017 SolarWinds MSP UK Ltd. All rights reserved. Just how bad could it be? CAN I HAZ CLARITY?!
  • 7. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Just how bad could it be? leal -12(%ecx, %eax, 8), %edi movzbl %ah, %ebp fsub %st, %st(3) (AT&T) lea edi, [ecx + eax * 8 - 12] movzx ebp, ah fsub st(3), st (Intel)
  • 8. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Switching between Intel and AT&T flavors Switch to Intel: (gdb) set disassembly-flavor intel (lldb) settings set target.x86-disassembly-flavor intel Switch to AT&T (but why?): (gdb) set disassembly-flavor att (lldb) settings set target.x86-disassembly-flavor att
  • 9. © 2017 SolarWinds MSP UK Ltd. All rights reserved. x86 registers overview © Wikipedia
  • 10. © 2017 SolarWinds MSP UK Ltd. All rights reserved. General-purpose registers in the wild Register Name Meaning [Extra] Use RAX, EAX, AX Accumulator Result of multiplication or division RBX, EBX, BX Base index Array index RCX, ECX, CX Counter Number of iterations left in the loop or string operation RDX, EDX, DX Data Multiplication result or dividend upper bits RSP, ESP, SP Stack pointer Address of the top of the stack RBP, EBP, BP Stack base pointer Address of the current stack frame RSI, ESI, SI Source index Address of the current source operand of string operations RDI, EDI, DI Destination index Address of the current destination operand of string operations RIP, EIP Instruction pointer Address of the current instruction being executed
  • 11. © 2017 SolarWinds MSP UK Ltd. All rights reserved. C++ vs. Assembly: Basic stuff C++ int a = 5; a += 7; int b = a - 4; a |= b; bool c = a & 7; a *= b; b = *(int*)(a + b); Assembly (AT&T) mov $5, %eax add $7, %eax lea -4(%eax), %ebx or %ebx, %eax test $7, %eax imul %ebx mov (%eax, %ebx), %ebx Assembly (Intel) mov eax, 5 add eax, 7 lea ebx, [eax - 4] or eax, ebx test eax, 7 imul ebx mov ebx, [eax + ebx]
  • 12. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Flags register Flag Meaning Category Use CF Carry Status Carry or borrow indication (addition, subtraction, shift) PF Parity Status Floating-point C2 flag check (e.g. FUCOM with NaN value) AF Adjust Status Same as CF but just for the lower nibble (think BCD) ZF Zero Status Result is zero/non-zero SF Sign Status Result is negative/positive OF Overflow Status Sign bit changed when adding two numbers of same sign, or subtracting two numbers of different signs DF Direction Control Specifies string processing direction
  • 13. © 2017 SolarWinds MSP UK Ltd. All rights reserved. C++ vs. Assembly: Branching C++ int a = 10; while (a > 0) { if (a % 2 == 0) a -= 3; else a /= 2; } Assembly (compiler) [0x1f73] <+3>: mov ecx, 10 [0x1f76] <+6>: test ecx, ecx [0x1f78] <+8>: jle 0x1f93 ; <+35> [0x1f7a] <+10>: nop word ptr [eax + eax] [0x1f80] <+16>: lea edx, [ecx - 0x3] [0x1f83] <+19>: mov eax, ecx [0x1f85] <+21>: shr eax [0x1f87] <+23>: test cl, 0x1 [0x1f8a] <+26>: cmove eax, edx [0x1f8d] <+29>: test eax, eax [0x1f8f] <+31>: mov ecx, eax [0x1f91] <+33>: jg 0x1f80 ; <+16> [0x1f93] <+35>: Assembly (human) mov eax, 10 loop_start: cmp eax, 0 jle finish test eax, 1 jnz divide sub eax, 3 jmp loop_start divide: sar eax, 1 jmp loop_start finish:
  • 14. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Calling conventions • Where parameters and results reside • In which order parameters are passed • Who cleans up after the call • What registers are preserved and who does it • etc. Currently in wide use: • x86: cdecl, stdcall • x64: MS, System V
  • 15. © 2017 SolarWinds MSP UK Ltd. All rights reserved. C++ vs. Assembly: Calling functions (non-virtual, cdecl) int f(int a, int b) { return a + b; } int g() { return f(2, 3) + 4; } f(int, int): mov eax, DWORD PTR [esp + 0x8] add eax, DWORD PTR [esp + 0x4] ret g(): push 0x3 push 0x2 call 0x8048520 <f(int, int)> pop edx add eax, 0x4 pop ecx ret
  • 16. © 2017 SolarWinds MSP UK Ltd. All rights reserved. C++ vs. Assembly: Calling functions (virtual, cdecl) struct I { virtual int f(int a, int b) = 0; }; struct A : public I { int f(int a, int b) override { return a + b; } }; int g(I& x) { return x.f(2, 3) + 4; } A::f(int, int): mov eax, DWORD PTR [esp + 0xc] add eax, DWORD PTR [esp + 0x8] ret g(I&): sub esp, 0x10 mov eax, DWORD PTR [esp + 0x14] mov edx, DWORD PTR [eax] push 0x3 push 0x2 push eax call DWORD PTR [edx] add esp, 0x1c add eax, 0x4 ret
  • 17. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Assembly & Disassember The Rescue Rangers
  • 18. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Example #1: Waiting in kernel mode // In a header far, far away ULONG const TimeoutMs = 30000; // Waiting up to 30 seconds for event to happen LARGE_INTEGER timeout; timeout.QuadPart = -1 * TimeoutMs * 10 * 1000; NTSTATUS const waitResult = KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, &timeout); mov eax, dword ptr [TimeoutMs] lea rcx, [rsp + 0x48] ; 1st arg imul eax, eax, 0xFFFFD8F0 xor r9d, r9d ; 4th arg xor r8d, r8d ; 3rd arg xor edx, edx ; 2nd arg mov qword ptr [rsp + 0x40], rax lea rax, [rsp + 0x40] mov qword ptr [rsp + 0x20], rax ; 5th arg call qword ptr [_imp_KeWaitForSingleObject]
  • 19. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Example #1: Waiting in kernel mode // In a header far, far away LONG const TimeoutMs = 30000; // Waiting up to 30 seconds for event to happen LARGE_INTEGER timeout; timeout.QuadPart = -1 * TimeoutMs * 10 * 1000; NTSTATUS const waitResult = KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, &timeout); mov eax, dword ptr [TimeoutMs] lea rcx, [rsp + 0x48] ; 1st arg imul eax, eax, 0xFFFFD8F0 xor r9d, r9d ; 4th arg xor r8d, r8d ; 3rd arg xor edx, edx ; 2nd arg cdqe mov qword ptr [rsp + 0x40], rax lea rax, [rsp + 0x40] mov qword ptr [rsp + 0x20], rax ; 5th arg call qword ptr [_imp_KeWaitForSingleObject]
  • 20. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Example #2: Magic statics struct Data { int x; Data() : x(123) {} }; Data& GetData() { static Data data; return data; }
  • 21. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Example #2: Magic statics GCC 4.2.1 (released 10 years ago) 0x08048560 <_Z7GetDatav+0>: push ebp 0x08048561 <_Z7GetDatav+1>: mov ebp,esp 0x08048563 <_Z7GetDatav+3>: sub esp,0x8 0x08048566 <_Z7GetDatav+6>: cmp BYTE PTR ds:0x8049790,0x0 0x0804856d <_Z7GetDatav+13>: je 0x8048576 <_Z7GetDatav+22> 0x0804856f <_Z7GetDatav+15>: leave 0x08048570 <_Z7GetDatav+16>: mov eax,0x8049798 0x08048575 <_Z7GetDatav+21>: ret 0x08048576 <_Z7GetDatav+22>: mov DWORD PTR [esp],0x8049790 0x0804857d <_Z7GetDatav+29>: call 0x80483e4 <__cxa_guard_acquire@plt> 0x08048582 <_Z7GetDatav+34>: test eax,eax 0x08048584 <_Z7GetDatav+36>: je 0x804856f <_Z7GetDatav+15> 0x08048586 <_Z7GetDatav+38>: mov DWORD PTR [esp],0x8049798 0x0804858d <_Z7GetDatav+45>: call 0x80485e0 <Data> 0x08048592 <_Z7GetDatav+50>: mov DWORD PTR [esp],0x8049790 0x08048599 <_Z7GetDatav+57>: call 0x8048414 <__cxa_guard_release@plt> 0x0804859e <_Z7GetDatav+62>: mov eax,0x8049798 0x080485a3 <_Z7GetDatav+67>: leave 0x080485a4 <_Z7GetDatav+68>: ret
  • 22. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Example #2: Magic statics MSVC 12 (Visual Studio 2013) example!GetData [example.cpp @ 14]: 14 00e61040 a14485e800 mov eax,dword ptr [example!$S1 (00e88544)] 15 00e61045 a801 test al,1 15 00e61047 7512 jne example!GetData+0x1b (00e6105b) example!GetData+0x9 [example.cpp @ 15]: 15 00e61049 83c801 or eax,1 15 00e6104c b94085e800 mov ecx,offset example!data (00e88540) 15 00e61051 a34485e800 mov dword ptr [example!$S1 (00e88544)],eax 15 00e61056 e8aaffffff call example!ILT+0(??0DataQAEXZ) (00e61005) example!GetData+0x1b [example.cpp @ 16]: 16 00e6105b b84085e800 mov eax,offset example!data (00e88540) 17 00e61060 c3 ret
  • 23. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Example #2: Magic statics MSVC 15 (Visual Studio 2017) example!GetData [example.cpp @ 14]: 14 010765a0 64a12c000000 mov eax,dword ptr fs:[0000002Ch] 15 010765a6 8b0d80fc0c01 mov ecx,dword ptr [example!_tls_index (010cfc80)] 15 010765ac 8b0c88 mov ecx,dword ptr [eax+ecx*4] 15 010765af a14cfc0c01 mov eax,dword ptr [example!type_info `RTTI Type Descriptor'+0x128 (010cfc4c)] 15 010765b4 3b8104010000 cmp eax,dword ptr [ecx+104h] 15 010765ba 7f06 jg example!GetData+0x22 (010765c2) example!GetData+0x1c [example.cpp @ 16]: 16 010765bc b848fc0c01 mov eax,offset example!data (010cfc48) 17 010765c1 c3 ret example!GetData+0x22 [example.cpp @ 15]: 15 010765c2 684cfc0c01 push offset example!type_info `RTTI Type Descriptor'+0x128 (010cfc4c) 15 010765c7 e8d9afffff call example!ILT+1440(__Init_thread_header) (010715a5) 15 010765cc 83c404 add esp,4 15 010765cf 833d4cfc0c01ff cmp dword ptr [example!type_info `RTTI Type Descriptor'+0x128 (010cfc4c)],0FFFFFFFFh 15 010765d6 75e4 jne example!GetData+0x1c (010765bc) example!GetData+0x38 [example.cpp @ 15]: 15 010765d8 b948fc0c01 mov ecx,offset example!data (010cfc48) 15 010765dd e857c1ffff call example!ILT+5940(??0DataQAEXZ) (01072739) 15 010765e2 684cfc0c01 push offset example!type_info `RTTI Type Descriptor'+0x128 (010cfc4c) 15 010765e7 e89eb6ffff call example!ILT+3205(__Init_thread_footer) (01071c8a) 15 010765ec 83c404 add esp,4 15 010765ef ebcb jmp example!GetData+0x1c (010765bc)
  • 24. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Example #3: Code obfuscation push edx push 0x4920 mov dword ptr [esp], ecx mov dword ptr [esp], edi mov edi, 0x16BC2A97 push eax mov eax, 0x7C4B60CD add dword ptr [esp + 8], eax mov eax, dword ptr [esp] add esp, 4 add dword ptr [esp + 4], edi sub dword ptr [esp + 4], 0x7C4B60CD pop edi push dword ptr [esp] pop eax push esi mov esi, esp add esi, 4 add esi, 4 xchg dword ptr [esp], esi pop esp push ebp mov ebp, 0x16BC2A97 sub eax, ebp pop ebp mov edx, dword ptr [esp] add esp, 4 void f(x86_regs32_t& regs, std::vector<std::uint32_t>& stack) { stack.push_back(regs.edx); stack.push_back(0x4920); stack[stack.size() - 1 - 0] = regs.ecx; stack[stack.size() - 1 - 0] = regs.edi; regs.edi = 0x16BC2A97; stack.push_back(regs.eax); regs.eax = 0x7C4B60CD; stack[stack.size() - 1 - 2] += regs.eax; regs.eax = stack[stack.size() - 1 - 0]; stack.pop_back(); stack[stack.size() - 1 - 1] += regs.edi; stack[stack.size() - 1 - 1] -= 0x7C4B60CD; regs.edi = stack[stack.size() - 1 - 0]; stack.pop_back(); stack.push_back(stack[stack.size() - 1 - 0]); regs.eax = stack[stack.size() - 1 - 0]; stack.pop_back(); stack.push_back(regs.esi); regs.esi = 0; regs.esi += 1; regs.esi += 1; std::swap(stack[stack.size() - 1 - 0], regs.esi); stack.resize(stack.size() - stack[stack.size() - 1 - 0] + 1); stack.push_back(regs.ebp); regs.ebp = 0x16BC2A97; regs.eax -= regs.ebp; regs.ebp = stack[stack.size() - 1 - 0]; stack.pop_back(); regs.edx = stack[stack.size() - 1 - 0]; stack.pop_back(); }
  • 25. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Example #3: Code obfuscation mov eax, edx add edx, 0x16BC2A97 void f(std::uint32_t& eax, std::uint32_t& edx) { regs.eax = regs.edx; regs.edx += 0x16BC2A97; }
  • 26. © 2017 SolarWinds MSP UK Ltd. All rights reserved. The Stuff in case you’re interested
  • 27. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Want to learn assembly and contribute at the same time? • FASM — modern and fast assembler written in assembly http://flatassembler.net/ • Menuet OS, Kolibri OS, BareMetal, and whole lot more http://wiki.osdev.org/Projects • KOL & MCK by Vladimir Kladov (achtung: Delphi) http://kolmck.ru/
  • 28. © 2017 SolarWinds MSP UK Ltd. All rights reserved. Questions? mike.gelfand@solarwinds.com mikedld@mikedld.com
  • 29. The SolarWinds and SolarWinds MSP trademarks are the exclusive property of SolarWinds MSP UK Ltd. or its affiliates and may be registered or pending registration with the U.S. Patent and Trademark Office and in other countries. All other SolarWinds MSP UK and SolarWinds trademarks, service marks, and logos may be common law marks or are registered or pending registration. All other trademarks mentioned herein are used for identification purposes only and are trademarks (and may be registered trademarks) of their respective companies.