INDEX

Symbols and Numbers

(backlash), 47, 220

/ (forward slash), 81, 220

- (minus sign), 55

+ (plus sign), 55

7-bit integer, 3940

8-bit integer, 3839

32-bit system, 263

32-bit value, 4041

64-bit system, 263

64-bit value, 4041

8086 CPU, 114

A

A5/1 stream cipher, 159

A5/2 stream cipher, 159

ABI (application binary interface), 123124, 259260

Abstract Syntax Notation 1 (ASN.1), 5354

accept system call, 123

acknowledgment (DHCP packet), 72

acknowledgment flag (ACK), 41

active network capture, 20, 280282. See also passive network capture

add() function, 124

ADD instruction, 115

add_longs() method, 198

add_numbers() method, 197

Address Resolution Protocol (ARP), 67, 7477

addresses, 4

32-bit, 5

destination, 5

MAC, 68, 7477

source, 5

address sanitizer, 243244

address space layout randomization (ASLR)

bypassing with partial overwrites, 272273

exploiting implementation flaws in, 271272

memory information disclosure vulnerabilities, 270271

Adleman, Leonard, 160

Advanced Encryption Standard (AES), 133, 150, 152

AJAX (Asynchronous JavaScript and XML), 57

algorithms

complexity of, 224225

cryptographic hashing, 164165

Diffie–Helman Key Exchange, 162164

hash, 165

key-scheduling, 151

message digest (MD), 164

MD4, 165

MD5, 133, 165167

RSA, 149, 160162, 165

secure hashing algorithm (SHA), 164, 202

SHA-1, 133, 165166

SHA-2, 165

SHA-3, 168

signature, 146

asymmetric, 165

cryptographic hashing algorithms, 164165

message authentication codes, 166168

symmetric, 166

AMD, 114

American Fuzzy Lop, 285286

AND instruction, 115

antivirus, 23

application, 3

content parsers, 4

network communication, 4

passive network traffic capture, 11

user interface, 4

application binary interface (ABI), 123124, 259260

application layer, 3

apt command line utility, 31

arbitrary writing of memory, 253254

ARM architecture, 42, 118

ARP poisoning, 7477

ASCII

character encoding, 42

code pages, 44

control characters, 43

printable characters, 43

text-encoding conversions, 229230

ASLR. See address space layout randomization (ASLR)

ASN.1 (Abstract Syntax Notation 1), 5354

assembler, 113, 258

assemblies, 138

assembly language, 113

assembly loading, 190193

asymmetric key cryptography, 159164. See also symmetric key cryptography

private key, 160

public key, 160

RSA algorithm, 160162

RSA padding, 162

trapdoor functions, 160

asymmetric signature algorithms, 165

Asynchronous JavaScript and XML (AJAX), 57

AT&T syntax, 116

attributes (XML), 58

authentication bypass, 209

authorization bypass, 209210

automated code, identifying, 133134

B

backslash (), 47, 220

base class library, 141

Base64, 6061

Berkeley packet filter (BPF), 180

Berkeley Sockets Distribution (BSD), 15

Berkeley Sockets model, 15, 121

big endian, 42, 52, 122

Big-O notation, 225

binary conversions, 9092

binary protocols. See also protocols

binary endian, 4142

bit flags, 41

Booleans, 41

formats, 5354

numeric data, 3841

strings, 4246

variable binary length data, 4749

bind system call, 15

bit flags, 41

bit format, 38

block ciphers. See also stream ciphers

AES, 150, 152

common, 152

DES, 150151

initialization vector, 154

modes, 152155

cipher block chaining, 153155

Electronic Code Book, 152

Galois Counter, 155

padding, 155156

padding oracle attack, 156158

Triple DES, 151

Blowfish, 152

Booleans, 41, 55

BPF (Berkeley packet filter), 180

breakpoints, 135, 137

BSD (Berkeley Sockets Distribution), 15

bss data, 120

Bubble Sort, 224

bucket, 225

buffer overflows

fixed-length, 211213

heap, 248249

integer, 214215

stack, 246248

variable-length, 211, 213214

Burp Suite, 283284

bytes, 38

C

C# language, 112, 189, 210

C++ language, 112, 132

ca.crt file, 203

CALL instruction, 115

Camellia, 152

Canape Core, 2122, 25, 103105, 280281

Canape.Cli, xxiv, 202

canonicalization, 220221

ca.pfx file, 203

capture.pcap file, 180

capturing network traffic

active method, 20

passive method, 1220

proxies

HTTP, 2935

man-in-the-middle, 20

port-forwarding, 2124

SOCKS, 2429

resending captured traffic, 182183

system call tracing

Dtrace, 1718

Process Monitor tool, 1819

strace, 16

carriage return, 56

carry flag, 117

CBC (cipher block chaining), 153155

CDB (debugger), 236241

cdecl, 199

cdll, 199

Cert Issuer, 200202

Cert Subject, 200201

certificate

authority, 170, 202

chain verification, 170172

pinning, 177

revocation list, 171

root, 170

store, 204

X.509, 5354, 169171, 173

certmgr.msc, 203

CFLAGS environment variable, 243

change cipher spec (TLS), 176

char types, 212

character encoding

ASCII, 43

Unicode, 4445

character mapping, 4445

chat_server.csx script, 187

ChatClient.exe (SuperFunkyChat), 8081, 200

ChatProgram namespace (.NET), 190

ChatServer.exe (SuperFunkyChat), 80

checksum, 9394, 107

Chinese characters, 44

chosen plaintext attack, 162

CIL (common intermediate language), 137138

Cipher and Hash algorithm, 202

cipher block chaining (CBC), 153155

cipher feedback mode, 159

cipher text, 146

ciphers, 146

block, 150159

stream, 158159

substitution, 147

CJK character sets, 44

CLANG C compiler, 243244

C language, 112, 123, 132, 210, 212

Class files, 141

Class.forName() method (Java), 194

client certificate (TLS), 175

client random (TLS), 173

C library, 268

CLR (common language runtime), 137

CMD command, 255

CMP instruction, 115, 119

code

error, 262

executable. See executable codes

message authentication. See message authentication codes (MACs)

pages (ASCII), 44

point, 44

section, 120

collision attacks, 166168

collision resistance (hashing algorithm), 165

command injection, 228

common intermediate language (CIL), 137138

common language runtime (CLR), 137

Common Object Request Broker Architecture (CORBA), 22

compiled languages, 113

compilers, 113, 132, 243

compression, 20, 108, 217

conditional branches, 118119

CONNECT HTTP method, 30

Connect() method, 185, 192193

CONNECT proxy, 32

connect system call, 15

content layer, 810

content parsers, 4

Content-Type values, 57

control characters (ASCII), 43

control flow, 118

control registers, 117

Conversations window (Wireshark), 8485

cookies, 212, 273276

CORBA (Common Object Request Broker Architecture), 22

counter mode, 159

CPU, 39

8086, 114

assembly language and, 113

exhaustion attacks, 224226

instruction set architecture, 114116

registers, 116118

signed integers, 39

x86 architecture, 114119, 125

crashes

debugging, 238240

example, 240243

finding root cause of, 243245

CreateInstance() method (.NET), 191

cron jobs, 254

cross-site scripting (XSS), 58

Crypt32.dll, 132

CryptoAllPermissionCollection.class, 142

cryptanalysis, 146

cryptography

asymmetric key, 159164

configurable, 226

hashing algorithms, 164165

libraries, 132

symmetric key, 149159

CS register, 116, 118

ctypes library (Python), 195

curl command line utility, 31

D

Dante, 27

data

controlling flow of, 2

encapsulation, 47

endianness of, 41

formatting and encoding, 2

implicit-length, 4849

inbound, 92

integrity, 164

numeric, 3841

padded, 49

terminated, 4748

transmission, 2, 67

variable-length, 56

Data Encryption Standard (DES), 150151

data execution prevention (DEP), 267268

data expansion attack, 217

DataFrame, 108

datagram, 5

datagram socket, 122

Datagram Transport Layer Security (DTLS), 172

data section, 120

dates, 4950, 55

.ddl extension, 137138

debuggers, 111, 134137, 236240, 243245, 258259

debugging, 236243

analyzing crash in, 238240

applications, 236

default or hardcoded credentials, 218

shell code, 258259

starting, 236237

debugging symbols package (dSYM), 131

DEC instruction, 115

decimal numbers, 55

decompilation, 113

decryption. See also encryption

asymmetric, 160

block cipher, 150

breakpoints, 137

cipher block chaining, 155, 157158

dealing with obfuscation, 143144

padding, 155157

RSA, 161, 165

TLS, 200202

Triple DES, 151

default credentials, 218

default gateway, 8, 66

defined memory pools, 252253

delimited text, 56

denial-of-service, 208

DEP (data execution prevention), 267268

DER (Distinguished Encoding Rules), 53

DES (Data Encryption Standard), 150151

DES cracker, 151

destination address, 5

destination network address translation (DNAT), 24, 6871

DHCP. See Dynamic Host Configuration Protocol (DHCP)

Diffie, Whitfield, 162

Diffie–Hellman Key Exchange (DH), 162164

Digital Signature Algorithm (DSA), 165

disassembly, 113

discover (DHCP packet), 71

dissector() function, 99

dissector.lua file, 98

dissectors

creating, 97

Lua, 99

message packet parsing, 100103

Wireshark, 95103

Distinguished Encoding Rules (DER), 53

DLL extension, 80, 120, 189

DNAT (destination network address translation), 24, 6871

DNSMasq, 287

dnsspoof, 34

Domain Name System (DNS) protocol, 3

Dotfuscator, 143144

dotnet binary, 81

downgrade attack, 176

DSA (Digital Signature Algorithm), 165

DS register, 116, 118

dSYM (debugging symbols package), 131

Dtrace, 1618

Dynamic Host Configuration Protocol (DHCP), 63, 66

packets, 7172

spoofing, 7174

dynamic libraries, 130, 195196

dynamic linking, 113114, 121

dynamic reverse engineering

breakpoints, 135, 137

defined, 134

general purpose registers, 136

E

EAX register, 116, 123, 242, 258, 270

EBP register, 116117, 124

EBX register, 116, 124

ECDH (Elliptic Curve Diffie–Hellman), 202

ECX register, 116, 124

EDI register, 116117, 124

EDX register, 116, 123124

EFAULT, 262

EFLAGS register, 117, 119, 136

EIP register, 116117, 135

Electronic Frontier Foundation, 151

elements (XML), 58

ELF (Executable Linking Format), 120, 131, 144

Elliptic Curve Diffie–Hellman (ECDH), 202

elliptic curves, 160

encoding

Base64, 6061

binary data, 5961

hex, 5960

percent, 60

encoding layer, 810

encryption, 20, 30. See also decryption

AES, 133, 150, 152

asymmetric, 160

block cipher, 150

breakpoints, 137

cipher block chaining, 153155

DES, 150151

Electronic Code Book, 153

HTTP connection to, 108

key, 146

libraries, 132

magic constants, 133

one-time pad, 148

padding, 155

public key. See asymmetric key cryptography

RSA, 155, 161

substitution ciphers, 147

TLS, 175176, 200206

Triple DES, 151

XOR, 108109, 148149, 153154

encryption libraries, 132

endianness, 4142

errno, 262

errors

codes, 262

detecting and correcting, 2

off-by-one, 213

verbose, 221222

ES register, 116, 118

ESI register, 116, 124

ESP register, 116117, 124, 136, 270

eth0, 180

Ethernet, 3

ARP poisoning, 7475

frame, 6, 8

MAC addresses, 6, 74

network routing, 78

passive network capture, 1213

simple network, 6

Ettercap, 7275, 287288

executable codes

address space layout randomization, 272

file formats, 119120

function calls in, 123

memory corruption and, 210, 246

partial overwrites, 272

repurposing, 188199

in .NET applications, 189193

in Java applications, 193195

ROP gadgets, 269

system calls, 259

unmanaged, 195199

executable file formats, 119120, 137

Executable Linking Format (ELF), 120, 131, 144

.exe extension, 120, 137138, 189

exit system call, 260261

Extensible Markup Language (XML), 58

Extensible Messaging and Presence Protocol (XMPP), 58

F

false, 55

fd argument, 261

Federal Information Processing Standard (FIPS), 151

Feistel network, 151

File Transfer Protocol (FTP), 24, 28

FILETIME (Windows), 50

Financial Information Exchange (FIX) protocol, 56

finished packet, 176

fixed-length buffer overflows, 211213

floating-point data, 4041

Follow Stream button (Wireshark), 85

Follow TCP Stream view (Wireshark), 8889

footers, 45

format string vulnerability, 227

forward slash (/), 81, 220

forwarding HTTP proxy. See also reverse HTTP proxy

advantages and disadvantages of, 31

redirecting traffic to, 3031

simple implementation of, 3031

fragmentation, 5152

FreeBSD, 16

FreeCAP, 27

free-list, 251

frequency analysis, 147

FS register, 116, 118

FTP (File Transfer Protocol), 24, 28

function monitors, 111

fuzz testing

defined, 234

mutation fuzzer, 235

simplest, 234

test cases, 235236

tools

American Fuzzy Lop, 285286

Kali Linux, 286

Metasploit, 286

Scapy, 287

Sulley, 287

G

Galois Counter Mode (GCM), 155

gateway

configuring, 6667

ARP poisoning, 7477

DHCP spoofing, 7174

default, 8, 66

forwarding traffic to, 7177

hops, 65

nodes, 64

routing tables on, 6566

GB2312, 44

GCC compiler, 196

GCM (Galois Counter Mode), 155

GDB (debugger), 236241

General Public License, 14

general purpose registers, 116117, 136

GET request, 8, 29

GetConstructor method (.NET), 191

getDeclaredConstructor() (Java), 195

GetMethod() method (.NET), 192193

Google, 170, 176177

GS register, 116, 118

guard pages, 245

GUI registry editor, 67

GVSP protocol, 182

gzip, 217

H

handshake, 172

hardcoded credentials, 218

hash table, 225

hashed message authentication codes (HMAC), 168169

hashing algorithms

collision resistance, 164

cryptographic, 164165

nonlinearity of, 164

pre-image resistance, 164

secure, 164165, 202

SHA-1, 133, 165166

SHA-2, 165

SHA-3, 168

HEAD, 29

Header,, 45

C, 17, 262

Ethernet, 6

HTTP, 24, 3234

IP, 6

system call number, 260

TCP, 5, 87

UDP, 5

heap buffer overflows, 248249

heap implementations, 250251

heap memory storage, 253

Hellman, Martin, 162

Hex Dump (Wireshark), 8695

determining protocol structure in, 8889

information columns in, 87

viewing individual packets in, 87

hex editor, 125

hex encoding, 5960

Hex Rays, 125

high privileges, 254255

HMAC (hashed message authentication codes), 168169

Hopper, 289290

hops, 65

host header, 24, 3233

host order, 42

hosts file, 23, 34

Hping, 282

HTTP (HyperText Transport Protocol), 3, 56

host header, 24

network protocol analysis, 810

proxies. See also protocols

forwarding, 2931

reverse, 3235

I

IBM, 151

ICS (Internet Connection Sharing), 69

IDA Pro, 289

analyzing stack variables and arguments in, 128

analyzing strings in, 132

debugger windows, 135136

EIP window, 135

ESP window, 136

disassembly window, 127128

extracting symbolic information in, 129131

free version, 125128

graph view, 126

identifying automated code in, 133134

Imports window, 131132

main interface, 127

viewing imported libraries in, 131132

windows, 126127

IEEE format, 4041

IEEE Standard for Floating-Point Arithmetic (IEEE 754), 40

ILSpy, 138, 290

analyzing type in, 140141

main interface, 139

Search window, 139

implicit-length data, 4849

in-band method, 253

inbound bytes, 8992

inbound data, 92

INC instruction, 115

incorrect resource access, 220223

canonicalization, 220221

verbose errors, 221222

inet_pton, 122123

information disclosure, 209

initialization vector, 154

inner padding block, 168

instruction set architecture (ISA), 114116

integer overflows, 214215

integers

signed, 39

text protocols, 55

unsigned, 38

variable-length, 3940

Intel, 114

Intel syntax, 116

Internet Connection Sharing (ICS), 69

Internet layer, 3

Internet Protocol (IP), 2

Internet Protocol Suite (IPS)

data encapsulation, 47

data transmission, 67

defined, 3

layers, 3

network routing, 78

interpreted languages, 112

interpreters, 112

Invoke() method (.NET), 192193

IP (Internet Protocol), 2

IP address

32-bit, 24

ARP poisoning, 7477

data transmission, 67

destination, 18, 22

DNAT, 6971

DNS spoofing, 34

hosts file, 34

NAT, 68

network routing, 78

reverse shell, 266

SNAT, 68

SOCKS connection, 25

ipconfig command, 69

iptables command, 69

IPS. See Internet Protocol Suite (IPS)

IPv4, 3, 5, 24, 52, 122

IPv6, 3, 56, 25, 52, 67

ISA (instruction set architecture), 114116

J

Japanese characters, 44

Java, 112, 210

applications, 141142

reflection types, 194

repurposing codes in, 193195

Java archive (JAR), 141, 193194

Java byte code, 137

Java Decompiler, 288

Java Runtime, 27

JavaScript, 252

JavaScript Object Notation (JSON), 5758

Java TCP client, 27

Jcc instruction, 115

JD-GUI, 142

JMP instruction, 115, 119

K

Kali Linux, 286

kernel mode, 14

key-scheduling algorithm, 151

Korean characters, 44

Krypto Analyzer, 134

L

least significant bit (LSB), 38

length-extension attacks, 166168

length-prefixed data, 48

lengths, 107

LibPCAP, 278279

line feed, 56

line oriented protocols, 56

linking, 113114

link layer, 3, 6

Linux, 120

ASLR implementation flaws in, 272

configuring SNAT on, 69

cron jobs, 254

debug symbols, 129

debugger, 236241

dynamic libraries, 196

enabling routing on, 67

error codes, 262

executable file format, 131

loading library on, 197

SOCKS proxy, 27

strace, 16

little endian, 42, 122

LLDB (debugger), 236241

Load() method (.NET), 190

LoadFrom() method (.NET), 190

local variables, corrupting, 274275

localhost, 12

low-privileged file writes, 255

Lua, 95103

M

MAC (Media Access Control) addresses, 67, 8, 7477

machine code, 112114, 120, 125

macOS, 16, 2728, 120

debug symbols, 129

debugger, 236241

dynamic libraries, 196

enabling routing on, 67

Mach-O format, 120, 131, 144

MACs. See message authentication codes (MACs)

magic constants, 132

mail application, 3

main thread, 121

Mallory, 281282

malware, 23

man 2 syscall_name command, 16

managed languages

Java, 141142

.NET applications, 137141

reverse engineering, 137144

man-in-the-middle proxy, 20, 201

masquerading, 68

master secret (TLS), 175

MD algorithm. See message digest (MD) algorithm

Media Access Control (MAC) addresses, 67, 8, 7477

memory

arbitrary writing of, 253254

heap memory storage, 253

information disclosure vulnerabilities, 270271

wasted, 250

memory canaries (cookies)

bypassing by corrupting local variables, 274275

bypassing with stack buffer underflow, 275276

detecting stack overflows with, 273276

memory corruption. See also vulnerabilities

buffer overflows, 210215

data expansion attack, 217

dynamic memory allocation failures, 217

exploit mitigations, 266276

address space layout randomization, 270273

data execution prevention, 266267

return-oriented programming, 268270

exploiting, 245253

heap buffer overflows, 248249

stack buffer overflows, 246248

memory-safe vs. memory-unsafe languages, 210

off-by-one error, 213

out-of-bounds buffer indexing, 216217

memory exhaustion attacks, 222223

memory index registers, 117

memory sections, 120

memory-safe languages, 210

memory-unsafe languages, 210

Message Analyzer, 278

message authentication codes (MACs)

collision attacks, 166168

hashed, 168169

length-extension attacks, 166168

signature algorithms, 166168

Message command, 101102

message digest (MD) algorithm, 164

MD4, 165

MD5, 133, 165167

message packet, 100103

Metasploit, 286

accessing payloads, 265

advantages and disadvantages of, 265266

executing payloads, 266

generating shell code with, 265266

MethodInfo type (.NET), 192

Microsoft, 170

Microsoft Message Analyzer, 278

MIME (Multipurpose Internet Mail Extensions), 5657

minus sign (-), 55

MIPS, 42, 137

Mitmproxy, 284285

mnemonic instruction, 114

modulo arithmetic, 214

modulus, 161, 214

mono binary, 80

Mono Project, 137

most significant bit (MSB), 38

MOV instruction, 115

Mozilla Firefox, 26

MSCORLIB, 141

MS-DOS, 119

msfvenom tool, 265266

multibyte character sets, 44

multiplexing, 5152

Multipurpose Internet Mail Extensions (MIME), 5657

multitasking, 120

N

namespace, 193

name-value pairs (XML), 58

nasm assembler, 256, 258, 263

NAT. See network address translation (NAT)

.NET applications

base class library, 141

file formats, 137138

ILSpy, 138141

reflection binding types, 192

reflection types, 190

repurposing codes in, 189193

repurposing executable codes in

assembly loading, 190193

using Reflection APIs, 190

.NET Core, 80

.NET Reflector, 290291

Netcat, 180182, 234, 282

NetClientTemplate class, 184185

netstat -r command, 65

Netwide Assembler, 256

network, 1

connectivity and protocol testing tools

Hping, 282

Netcat, 282

Nmap, 282283

monitoring connections with DTrace, 1618

proxies, 2035

routing, 78

network address, 7, 20, 22, 5253, 66, 71, 123

network address translation (NAT), 6871

defined, 68

destination, 24, 68

source, 6869

network communication, 4

Berkeley Sockets model, 15

layers, 3

man-in-the-middle attack on, 20

symmetric ciphers, 150

user-to-kernel, 15

network interface, 121124

client connection to TCP server, 122

TCP client connection to server, 121122

Network News Transfer Protocol (NNTP), 59

network order, 42

newInstance() method (Java), 195

Nmap, 282283

NNTP (Network News Transfer Protocol), 59

nodes, 1

gateway, 64

identifying through addressing, 2

no-execute (NX) mitigation, 267

nonlinearity, 165

nonpersistent denial-of-service, 208

NULL, 263264

numeric data

decimal numbers, 55

floating-point data, 4041

integers, 55

signed integers, 39

text protocols, 55

unsigned integers, 38

variable-length integers, 3940

NX (no-execute) mitigation, 267

O

OAEP (Optimal Asymmetric Encryption Padding), 162

obfuscation, 143144

octets, 3840

octet-stream, 57

off-by-one error, 213

offer (DHCP packet), 71

one-time pad encryption, 148

open system call, 18

OpenSSL, 132

operands, 115

operating system

application binary interface, 123124

executable file formats, 119120

networking interface, 121124

processes, 120121

sections, 120

threads, 120121

Optimal Asymmetric Encryption Padding (OAEP), 162

OR instruction, 115

outbound bytes, 89

outbound traffic, 89

outer padding block, 168

out-of-band method, 253

out-of-bounds buffer indexing, 216217

output feedback mode, 159

overflow flag, 117

P

package-private scoped classes, 193

packets, 6

calculating checksum of, 9394

capturing, 8384

finding, 8788

identifying structure with Hex Dump, 8695

sniffing, 1214

viewing, 8788

packing tools, 134

padded data, 49

padding

block ciphers, 155156

decryption, 155157

encryption, 155

inner block, 168

OAEP, 162

oracle attack, 156158

outer block, 168

RSA encryption, 155, 162

Page Heap, 244245

parity flag, 117

Parser class, 106, 185

parser.csx script, 183184

parsing

binary conversion and, 90

decimal numbers and, 55

endianness of data and, 41

HTTP header, 33

message command, 101102

message packet, 100103

mutation fuzzer and, 235

protocol, 107108

Python script for, 91

traffic, 183

URL, 230

variable-length integers, 40

partial overwrites, 272273

passive network capture

advantages and disadvantages of, 1920

Dtrace, 1618

packet sniffing, 1214

Process Monitor tool, 1718

strace, 16

system call tracing, 1416

tools

LibPCAP, 278279

Microsoft Message Analyzer, 278

TCPDump, 278279

Wireshark, 1213, 279280

path, 220

$pc, 239

PDB (program database) file, 129131

PDP-11, 42

PDU (protocol data unit), 4

PE (Portable Executable) format, 120, 134, 144

PEiD, 134

PEM format, 202

percent encoding, 60

perfect forward secrecy, 177

permutation boxes (P-Box), 152

persistent denial-of-service, 208

PGP (Pretty Good Privacy), 169

PHP, 255

PKI. See public key infrastructure (PKI)

plain, 57

plaintext, 146

plus sign (+), 54

Point-to-Point Protocol (PPP), 3

POP3 (Post Office Protocol 3), 4

POP instruction, 115

port, 2

port numbers, 5

Portable Executable (PE) format, 120, 134, 144

port-forwarding proxy. See also proxies

advantages and disadvantages of, 2324

binding to network addresses, 22

redirecting traffic to, 2223

simple implementation of, 2122

POSIX, 15

POSIX/Unix time, 50

POST, 29

Post Office Protocol 3 (POP3), 4

PowerPC, 38

PPP (Point-to-Point Protocol), 3

Practical Packet Analysis, 14

pre-image resistance (hashing algorithm), 165

pre-master secret (TLS), 175

Pretty Good Privacy (PGP), 169

printable characters (ASCII), 43

printf function, 227

private Connect() method (.NET), 192

private exponent, 161

private key, 161, 165

PRNGs (pseudorandom number generators), 149

Process() method, 275276

Process Monitor tool, 1718

processes, 120121

processor architectures, 42

program database (PDB) file, 129131

program flow, 118119

ProGuard, 143144

promiscuous mode, 12

PROT_EXEC flag, 257

protocol data unit (PDU), 4

protocol stack, 3

protocols

analysis, 810, 105106

binary, 3849

changing behavior of, 108109

checksum, 9394

dates, 4950

determining structure of, 8889

fragmentation, 5152

functions of, 2

multiplexing, 5152

network address, 5253

network connectivity and protocol testing

Hping, 282

Netcat, 282

Nmap, 282283

parsing, 107108

security, 145178

structured binary formats, 5354

tag, length, value (TLV) pattern, 5051

text, 5458

times, 4950

unknown parts, 93

proxies

HTTP, 2935

man-in-the-middle, 20

port-forwarding, 2124

protocol analysis with, 105106

setting up, 103105

SOCKS, 2429, 103

traffic analysis with, 103110

Proxifier, 27

pseudo registers, 239

pseudorandom number generators (PRNGs), 149

public Connect() method (.NET), 192

public exponent, 161

public key, 160161, 165

Public Key Cryptography Standard #1.5, 162

Public Key Cryptography Standard #7 (PKCS#7), 155156

public key encryption. See asymmetric key cryptography

public key infrastructure (PKI), 169172

certificate chain verification, 170172

defined, 169

web of trust, 169

X.509 certificates, 169170

PublicClass class, 189

PublicMethod() method, 189

PUSH instruction, 115

Python, 210

binary conversions, 9092

calling functions with, 199

ctypes library, 195

data types, 198

dissecting protocol with, 9095

loading library with, 197

resending captured UDP traffic with, 182183

struct library, 9092

Q

quoted string, 4748

R

rand() function, 149

random number generators, 149

RAX register, 257260

RC4 stream cipher, 176

RDP (Remote Desktop Protocol), 51

read system call, 15, 18, 122

read_bytes() function, 91

ReadData() function, 108

ReadOutbound() function, 109

Real Time Messaging Protocol (RTMP), 29

Receive() method (.NET), 193

recv system call, 15, 122123

recvfrom system call, 15

reflection, 189

registers

control, 117

CS, 116, 118

DS, 116, 118

EAX, 116, 123, 242, 258, 270

EBP, 116117, 124

EBX, 116, 124

ECX, 116, 124

EDI, 116117, 124

EDX, 116, 123124

EFLAGS, 117, 119, 136

EIP, 116117, 135

ES, 116, 118

ESI, 116, 124

ESP, 116117, 124, 136, 270

FS, 116, 118

general purpose, 116117, 136

GS, 116, 118

memory index, 117

pseudo, 239

RAX, 257260

scratch, 123

selector, 118

SS, 116

x86 architecture, 116118

remote code execution, 208

Remote Desktop Protocol (RDP), 51

Remote Method Invocation (RMI), 29

Remote Procedure Call (RPC), 22

request (DHCP packet), 72

Request for Comments (RFCs), 42, 5657

request line, 30

rerouting traffic, 6466

RESP field, 25

RET instruction, 115

Ret2Libc, 269

RETN instruction, 115

return-oriented programming (ROP), 268270

reverse engineering

dynamic, 134137

managed languages, 137144

obfuscation, 143144

resources, 144

static, 125134

tools

Hopper, 289290

IDA Pro, 289

ILSpy, 290

Java Decompiler, 288

.NET Reflector, 290291

reverse HTTP proxy. See also forwarding HTTP proxy

advantages and disadvantages of, 35

host header, 3233

redirecting traffic to, 34

simple implementation of, 33

reverse shell, 266

Rich Site Summary (RSS), 58

Rijndael, 152

Rivest, Ron, 160

RMI (Remote Method Invocation), 29

root certificate, 170

ROP (return-oriented programming), 268270

route print command (Windows), 65

router, 78

ARP poisoning, 7577

configuring, 6667

defined, 64

enabling DNAT, 70

enabling SNAT, 6869

routing

on Linux, 67

on macOS, 67

on Windows, 66

routing table, 8, 6566

RPC (Remote Procedure Call), 22

RSA encryption, 149

algorithm, 160162

padding, 155, 162

signature algorithm, 165

RSS (Rich Site Summary), 58

Ruby, 210

Run() function, 187

runtime, 137

S

say_hello() method, 197

say_string() method, 197

say_struct() function, 199

Scan for Hosts (Ettercap), 76

Scapy, 287

scratch registers, 123

scripting languages, 112

sections (memory), 120

secure hashing algorithm (SHA), 164

SHA-1, 133, 165166

SHA-2, 165

SHA-3, 168

Secure Sockets Layer (SSL). See Transport Layer Security (TLS)

security, 145178

encryption, 146149

public key infrastructure (PKI), 169172

random number generators, 149

requirements, 145146

signature algorithms, 164169

symmetric key cryptography, 149159

Transport Layer Security, 172177

segment, 5, 87

SELECT statement, 229

selector registers, 118

self-signed certificate, 170

Send() method (.NET), 192193

send system call, 15, 122123

sendfrom system call, 15

Serpent, 152

server random (TLS), 173

session key, 162

session state, 2

set detach-on-fork off command, 237

setAccessible() (Java), 195

SGML (Standard Generalized Markup Language), 58

SHA. See secure hashing algorithm (SHA)

Shamir, Adi, 160

shared key, 163

shell code

accessing payloads, 265

debugging technique, 258259

generating with Metasploit, 265266

relative address on 32- and 64-bit systems, 263

reverse shell, 266

setting breakpoint on, 258259

system calls, 259

exit, 260261

write, 261263

writing, 255266

shell_bind_tcp, 265

Shift-JIS, 44

SHL instruction, 115, 119

SHR instruction, 115

sign flag, 117

signature algorithms, 146, 164169

asymmetric, 165

cryptographic hashing algorithms, 164165

DSA, 165

message authentication codes, 166168

RSA, 165

symmetric, 166

signed integers, 39

simple checksum, 9394

Simple Mail Transport Protocol (SMTP), 34, 56, 59

Simple Network Management Protocol (SNMP), 53

sketches, 150

sniffing, 1214, 73

sockaddr_in structure, 17, 122

socket system call, 15

SOCKS proxy, 103. See also proxies

advantages and disadvantages of, 2829

Firefox proxy configuration, 26

Java TCP client, 27

overview, 24

redirecting traffic to, 2627

simple implementation of, 2526

versions, 2425

socksProxyHost system property, 27

socksProxyPort system property, 27

SOH (Start of Header), 56

Solaris, 16, 120

source address, 5

source code, 112

source network address translation (SNAT)

configuring on Linux, 69

enabling, 6869

$sp, 239

SPARC architecture, 42, 118, 137

spoofing

DHCP, 7174

DNS, 34

tools, 287288

sprintf string function, 212

SQL. See Structured Query Language (SQL)

SS register, 116

stack buffer overflows, 246248, 273276

stack buffer underflow, 275276

stack trace, 239240

stack variables, 128

Standard Generalized Markup Language (SGML), 58

start address, 120

Start of Header (SOH), 56

static linking, 113114

static reverse engineering, 125134. See also reverse engineering

analyzing strings in, 133

extracting symbolic information in, 129131

identifying key functionality in, 129134

stack variables and arguments, 128

stdcall, 199

storage exhaustion attacks, 223224

strace, 16

strcat string function, 212

strcpy string function, 212

strcpy_s string function, 212

stream ciphers, 158159. See also block ciphers

strings, 4246

analyzing, 132

ASCII standard, 4244

Strip tool, 131

struct library (Python), 90

Structure class, 199

structured binary formats, 5354

Structured Query Language (SQL)

injection, 228229

Server, 229

structured text formats, 5658

SUB instruction, 115

subroutine calling, 118119

substitution boxes (S-Box), 152

substitution ciphers, 147

substitution-permutation network, 152

Sulley, 287

SuperFunkyChat

analysis proxy

captured traffic, 183187

simple network client, 184186

simple server, 186188

ChatClient, 81, 8384, 106, 200

ChatServer, 80, 106

commands, 81

communicating between clients, 81

dissectors, 95103

parser code for, 107

starting clients, 8081

starting the server, 80

UDP mode, 97

switch device, 6

symbolic information, 129131

symmetric key cryptography, 149. See also asymmetric key cryptography

block ciphers, 150159

stream ciphers, 158159

symmetric signature algorithms, 166

synchronize flag (SYN), 41

system API, 268

System assembly, 141

system calls

accept, 123

bind, 15

connect, 15

exit, 260261

open, 18

read, 15, 18, 122

recv, 15, 122123

recvfrom, 15

send, 15, 122123

sendfrom, 15

shell code, 259262

socket, 15

tracing, 1419

Unix-like systems, 1516, 122

write, 15, 18, 122, 261263

system function, 228

System.Activator class (.NET), 191

System.Reflection.Assembly class (.NET), 190

System.Reflection.ConstructorInfo class (.NET), 190

System.Reflection.FieldInfo class (.NET), 190

System.Reflection.MethodInfo class (.NET), 190

System.Reflection.PropertyInfo class (.NET), 190

System.Type class (.NET), 190

T

tag, length, value (TLV) pattern, 5051, 89, 9495

TCP. See Transmission Control Protocol (TCP)

TCPDump, 278279

TCP/IP, 2, 910, 121, 262

TCP/IP Guide, 16

TcpNetworkListener (ILSpy), 140

terminated data, 4748

terminated text, 56

TEST instruction, 115, 119

testy virtual buffer (TVB), 99

text protocols, 54

Booleans, 55

dates, 55

numeric data, 55

structured text formats, 5658

times, 55

variable-length data, 55

text-encoding character replacement, 229231

threads, 120121

times, 4950, 55

TLS. See Transport Layer Security (TLS)

TLS Record protocol, 172

TLV (tag, length, value) pattern, 5051, 89, 9495

ToDataString() method, 186

token, 56

tools

for active network capture and analysis

Canape, 280281

Canape Core, 281

Mallory, 281282

fuzz testing

American Fuzzy Lop, 285286

Kali Linux, 286

Metasploit, 286

Scapy, 286

Sulley, 286

network connectivity and protocol testing

Hping, 282

Netcat, 282

Nmap, 282283

for network spoofing and redirection

DNSMasq, 287

Ettercap, 287288

for passive network capture and analysis

LibPCAP, 278279

Microsoft Message Analyzer, 278

TCPDump, 278279

reverse engineering

Hopper, 289290

IDA Pro, 289

ILSpy, 290

Java Decompiler, 288

.NET Reflector, 290291

for web application testing

Burp Suite, 283284

Mitmproxy, 284285

Zed Attack Proxy, 284

traceconnect.d file, 16

traceroute, 6465

tracert (Windows), 6465

traffic

analysis using proxy, 103

capturing

active method, 20

HTTP, 2935

man-in-the-middle, 20

passive method, 1220

port-forwarding, 2124

proxies, 2035

SOCKS, 2429

system call tracing, 1419

capturing tools

Dtrace, 1718

Netcat, 180182

Process Monitor tool, 1819

strace, 16

generating, 8384

outbound, 89

Transmission Control Protocol (TCP), 23, 21

bit flags, 41

client connection to server, 121123

header, 5, 87

HTTP proxy, 30

packets, 8788

port numbers, 5

port-forwarding proxy, 2122, 201

reading contents of sessions, 8586

reverse shell, 265266

SOCKS proxy, 2428

stream, 1314

transport layer, 3, 6, 810

Transport Layer Security (TLS)

certificate pinning, 177

client certificate, 175

decryption, 201202

encryption, 175176, 200201

endpoint authentication, 174175

forcing TLS 1.2, 202

handshake, 172173

initial negotiation, 173

perfect forward secrecy, 177

replacing certificate in, 202206

security requirements, 176177

TLS Record protocol, 172

trapdoor functions, 160

Triple DES, 151

true, 55

trusted root certification authorities, 204

Tshark, 180182

TVB (testy virtual buffer), 99

Twofish, 152

two’s complement, 39

U

UCS (Universal Character Set), 4445

UDP. See User Datagram Protocol (UDP)

UI (user interface), 4

uname command, 263264

Unicode

character encoding, 4445

character mapping, 4445

UCS-2/UTF-16, 45

UCS-4/UTF-32, 45

Unicode Transformation Format (UTF), 4445

Unified Sniffing mode (Ettercap), 76

Uniform Request Identifier (URI), 30, 32

uninitialized data, 120

Universal Character Set (UCS), 4445

Unix-like systems, 5

ASLR implementation flaws in, 272

AT&T syntax, 116

command injection, 228

command line utilities on, 31

configuring DNAT on, 70

Dtrace, 16

enabling routing on, 67

error codes, 262

executable format, 120

hosts file, 23

read and write calls, 122

routing tables on, 65

system calls, 1516, 122

traceroute, 64

Unk2 value, 9395

unmanaged executables, 195199

dynamic libraries, 195196

unsafe keyword, 210

unsigned integers, 38

UPX, 134

URI (Uniform Request Identifier), 30, 32

User Datagram Protocol (UDP), 3

captured traffic, 182183

dissectors, 9899

payload and header, 5

port forwading, 21

socket, 122

user enumeration, 218219

user interface (UI), 4

user mode, 14

user-after-free vulnerability, 249250

UTF (Unicode Transformation Format), 4445

UTF-8, 4546

V

variable binary length data

implicit-length data, 4849

length-prefixed data, 48

padded data, 49

terminated data, 4748

variable-length buffer overflows, 211, 213214

variable-length data, 56

variable-length integers, 3940

verbose errors, 221222

Verisign, 170

virtual function table, 242, 248249

virtual hosts, 24

virtual machine, 137

VirtualAlloc, 250

Visual C++, 129

vulnerabilities

authentication checking, 226

classes

authentication bypass, 209

authorization bypass, 209210

denial-of-service, 208

information disclosure, 209

remote code execution, 208

command injection, 228

CPU exhaustion attacks

algorithmic complexity, 224225

configurable cryptography, 224225

default or hardcoded credentials, 218

exploiting

arbitrary writing of memory, 253254

defined memory pool allocations, 252253

heap layout manipulation, 249250

heap memory storage, 253

high-privileged file writes, 254256

low-privileged file writes, 255

memory corruption, 245253

user-after-free vulnerability, 249250

format string, 227

fuzz testing, 234236

incorrect resource access

canonicalization, 220221

verbose errors, 221222

memory corruption

buffer overflows, 210215

data expansion attack, 217

dynamic memory allocation failures, 217

exploit mitigations, 267268

memory-safe vs. memory-unsafe languages, 210

out-of-bounds buffer indexing, 216217

memory exhaustion attacks, 222223

shell code, 255266

SQL injection, 228229

storage exhaustion attacks, 223224

text-encoding character replacement, 229231

triaging, 236245

user enumeration, 218219

W

W3C, 58

web application testing tools, 283285

Burp Suite, 283284

Mitmproxy, 284285

Zed Attack Proxy, 284

web of trust (WOT), 169

wget, 31

windll, 199

Windows

ASLR implementation flaws in, 272

calling functions with Python on, 199

certificate manager, 203

debug symbols, 129

debugger, 236241, 244245

dynamic link libraries, 196

enabling routing on, 67

FILETIME, 50

loading library on, 197

Page Heap, 244245

registry, 67

Winsock library, 121

XP SP2, 270

WinDump, 278

WinPcap, 278

Winsock, 121

Wireshark, 1214, 81, 279280

basic analysis, 8485

capture interfaces dialog, 8283

Conversations window, 8485

dissectors, 95103

generating network traffic in, 8384

Hex Dump view, 8695

main window, 82

reading contents of TCP sessions in, 8586

Tshark command line version, 180182

WOT (web of trust), 169

write system call, 15, 18, 122, 261263

WriteData() function, 108

WritePackets() method, 22

ws2_32.dll Windows network library, 130131

X

X.509 certificates, 5354, 169171, 173

X.680 series, 53

x86 architecture, 42, 125

history, 114

instruction mnemonics, 115

instruction set architecture, 114116

mnemonic forms, 115

program flow, 118119

registers, 116118

xcalc, 228

XML Schema, 58

XOR encryption, 108109, 148149, 153154

XOR instruction, 115

XOR parameter, 108109

xp_cmdshell function, 229

xxd tool, 90, 181

Z

Zed Attack Proxy (ZAP), 284

zero flag, 117

ZLib compression library, 132

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset