Index

Note: Page numbers followed by f and t indicate figures and tables, respectively. Footnotes are indicated by n.

A

ABA problem, 393398

ABI (application binary interface), 127128

Absolute path name, 405406, 432

Accelerated Requirements Method (ARM), 484

Access control lists (ACLs), 413

Access right(s), analysis and reduction, 494495

ACLs. See Access control lists (ACLs)

ActiveX controls, vulnerabilities in, 515

Addition operations, 260267

one’s complement, 233

Address space layout randomization (ASLR), 111116

Adve, Vikram, 506

AHP (Analytical Hierarchical Process), 485

AIR. See As-if infinitely ranged (AIR) integer model

Alert TA06-081A, 428

aligned_alloc() function, 146, 148149, 153

return values on success and error, 217, 217t

Alignment(s)

definition, 147

extended, 148

fundamental, 148

stronger/stricter, 148

weaker, 148

alloca() function, 149150

Allocation function(s), 163168

for array types, 163

and deallocation functions, correct pairings, 176, 176t

failure, 164168, 172

incorrect pairing of C and C++ allocation and deallocation functions and, 172173

for nonarray types, 163

Amdahl’s law, 361, 362f

American National Standards Institute (ANSI)

C Standard, 20

X3J11 committee, 1920

Analytical Hierarchical Process (AHP), 485

The Annotated C++ Reference Manual (Ellis and Stroustrup), 20

ANSI. See American National Standards Institute (ANSI)

Apple file system forks, and equivalence errors, 436437

Application binary interface (ABI), 127129

Application Verifier, 222

Arbitrary memory write, 124125, 127

and atexit() function, 133134

and .dtors section, 129131

and global offset table, 127129

and longjmp() function, 134136

and structured exception handling, 138139

and system default exception handling, 139

and virtual pointers, 133

Arbitrary write condition, 288

Arbitrary-precision arithmetic, 227, 292293

Arc injection, 64, 6970

Architecture and design, in software development, 486503

Arena(s), jemalloc, 216

Argument(s), 309310

command-line, 4344

direct access to, 335337

malicious, 64

naming, 313

passing, 313

sequentially ordered, 312313, 312f

variable number of, 309312

Argument pointer(s), 323, 323f

advancing, 324325

and buffer expansion, 346

and variadic function implementation, 344345

moving, 324325

Ariane 5 launcher, 301

Arithmetic. See also Integer(s)

arbitrary-precision, 227, 292293

C language solution, 293

bignum, 227

GMP (GNU Multiple-Precision Arithmetic Library), 292

Java BigInteger, 292

modulo (modwrap semantics), 302

one’s complement, 233

pointer, 260, 304

usual integer conversions, 249

Arithmetic operations

addition, 260267

one’s complement, 233

division and remainder, 274279

multiplication, 269274

subtraction, 267269

ARM (Accelerated Requirements Method), 484

Arrays, 30

character, 30

count, 40

fixed-length, and data from unbounded sources, 43

length, 40

scalars and, 174175

size, 3132, 40

variable-length (VLAs), 150151

The Art of Computer Programming (Knuth), 181182

As-if infinitely ranged (AIR) integer model, 303304, 505

and observation point, 303304

As-if rule, 369

ASLR (address space layout randomization), 111116

asprintf() function, 340

atexit() function, 133134

ATM, application-specific misuse case, 485, 486t

Atomic operations, 376378

relaxed, 371

use, 463

Attack surface

analyzing, 494

reducing, 494495

review, 516517

Attack Surface Analyzer, 517

Attackers, definition, 14

AusCERT, 28

Advisory AA-2000.02, 348

Automated teller machine (ATM), application-specific misuse case, 485, 486t

Autovectorization, 358359

Avoidance strategy(ies). See Mitigation(s)

B

Basic character set, 32

Basic Combined Programming Language (BCPL), 19

Basic Fuzzing Framework (BFF), 514

basic_string, 3637

basic_string class, 8081

mistakes using, 8183

BCPL. See Basic Combined Programming Language (BCPL)

Best-fit memory allocation, 181

BFF (Basic Fuzzing Framework), 514

Black-box fuzzing, 513514

Blacklisting, 501502

Blaster worm, 15, 2f, 117

flawed logic exploited by, 5, 5f

Block devices, 407

Boehm-Demers-Weiser conservative garbage collector, 169

Bound, definition, 30

Boundary(ies), exploitable, 500501, 501f

Boundary tags, 181, 181n, 201202, 201f

Branching

conditional, 7172

unconditional, 7172, 72f

BSS segment, 123124

Buffer overflow(s), 5354, 53f, 70, 118120. See also String(s)

arc injection, 64, 6970

code injection, 6470

detection, 72, 101102

dlmalloc

frontlink technique, 191195

unlink technique, 185191

formatted output functions and, 319321

in heap, 185191

frontlink technique, 191195

unlink technique, 185191

inadequately bounded loops and, 122123

mitigation strategies, detection and recovery, 72, 101102

prevention, 72, 102

RtlHeap, 202207

secure recovery from, 72, 101102

in stack segment, 59

vulnerabilities, 117118

__builtin_object_size() function, 102106

__builtin___strcpy_chk() function, 105106

Butenhof, David, 368

C

C*, 20

C and C++

alternatives to, 25

descendants of, 20

history of, 1920

and implementation-defined behavior, 22, 23

legacy code, 24

and locale-specific behavior, 21, 23

popularity, 1718, 18t, 19t

portability, 2324

security problems with, 2124

standards, 20

and type safety, 24

and undefined behavior, 2224

and unspecified behavior, 2122

and vulnerabilities, 21

C11 Annex K bounds-checking interfaces, 7376, 282, 340341

C++ Coding Standards: 101 Rules, Guidelines, and Best Practices (Sutter and Alexandrescu), 83

The C Programming Language (Kernighan and Ritchie), 19, 181182

C range error detector (CRED), 107108

C runtime (CRT) library, in Win32, 197198

C Standard, memory management functions, 146147

calloc() function, 147, 152, 153154, 173

and integer wraparound vulnerability, 284

return values on success and error, 217, 217t

Canary(ies)

Random XOR, 109

stack, 108109, 140

Canonicalization, 439442, 499500

Case sensitivity, and equivalence errors, 436

Casts, 38

CDE ToolTalk, 348349

__cdec1, 313

Center for Strategic and International Studies (CSIS), list of significant cyber events, 10

Cerb CerbNG, concurrency vulnerabilities, 400

CERT Advisory

CA-1996-20, 428

CA-1996-24, 428

CA-1996-25, 428

CA-1997-05, 428

CA-1997-06, 118

CA-2000-06, 118

CA-2000-13, 348

CA-2001-27, 349

CA-2002-33, 223

CA-2003-02, 223

CA-2003-07, 428

CA-2003-12, 428

CA-2003-16, 2

CA-2003-25, 428

The CERT C Secure Coding Standard (Seacord), 482483, 510

“Arrays (ARR),” 30

ARR01-C, 3132

ARR32-C, 150

DCL03-C, 273

DCL12-C, 292

DCL34-C, 366367

ERR00-C, 76

ERR02-C, 88

ERR03-C, 75

ERR38-CPP, 179180

EXP33-C, 151

EXP34-C, 155

FIO01-C, 429, 432

FIO02-C, 440

FIO03-C, 432, 455, 456

FIO04-C, 45, 53

FIO05-C, 450, 464

FIO15-C, 429

FIO30-C, 338

FIO32-C, 445

FIO33-C, 45

FIO34-C, 86

FIO35-C, 86

FIO37-C, 64

FIO43-C, 460

INT01-C, 290

INT06-C, 339

INT07-C, 240

INT13-C, 281

INT15-C, 244

INT30-C, 293294, 296

INT31-C, 293, 296297

INT32-C, 293, 297

INT34-C, 280

MEM03-C, 152

MEM04-C, 156, 159

MEM07-C, 152

MEM09-C, 151

MEM11-C, 153

MEM32-C, 153154

MEM35-C, 156

MEM36-C, 149

MEM08-CPP, 172173

MEM39-CPP, 176

MSC06-C, 153

MSC10-C, 33

MSC14-C, 264, 268

MSC23-C, 162

MSC34-C, 42

POS01-C, 467

POS35-C, 466

POS36-C, 426

POS37-C, 428

SIG30-C, 355

“Signals (SIG),” 279

STR00-C, 39

STR01-C, 73

STR07-C, 74, 282

STR30-C, 35

STR31-C, 39, 41, 76

STR32-C, 49

STR35-C, 43

STR36-C, 36

CERT Vulnerability Note, 11

VU#29823, 348

VU#159523, 154

VU#192038, 222

VU#210409, 433

VU#286468, 349

VU#542081, 223

VU#568148, 2

VU#595507, 349

VU#650937, 223

VU#866472, 224

CERT/CC

and coding standards, 482483

Insider Threat Center, 9

role in security training, 481

ROSE Checkers SourceForge, 305

vulnerabilities reported to, 11, 12, 18

Vulnerability Disclosure Policy, 9n

Chamber of Commerce, U.S., computer network, hacker penetration of, 10

Change state property, 363, 469

Channel(s), analysis and reduction, 494495

char, 30, 35, 3739

Character devices, 407

Character set

basic, 32

execution, 32

multibyte, 32. See also UTF-8

Character string literals, 3436

Character strings, 2941

Character types, 3739

integer, 240241

Checklists, for software development, 516

Check-use-check pattern, 463466

chroot jail, 470, 487n

chroot() system call, 487, 487n

clear(), 31

close() function, 410411, 411t

cmd.exe, 4

Code audits, 515

for integer range errors, 306

Code injection, 6469, 70

CodeSonar, 506

COFF (common object file format), 207n

Common desktop environment (CDE), 348

Common object file format (COFF), 207n

Compass/ROSE tool, 506507, 511

Competitive intelligence professionals, as threat, 910

Compilation flags, 503504, 504f

Compiler(s), 2627

security features, 503505

Compiler checks, 342343

Compiler optimization, undefined behaviors in C and, 23

Compiler reordering, and thread safety, 369370

Compiler-generated runtime error checks, 106, 300301

Complete mediation, 488489, 490f

Complete object, 148

Computer Crime and Security Survey, 2010/2011, 6

Computer security, 12

Concatenating strings, 4347

Concatenation functions, 8993, 93t

truncating, 9399, 99t

Concurrency

and ABA problem, 393398

deadlocks, 385391, 462

definition, 353

interleaved, 355, 356f

livelock, 385

and lock contention, 383, 392393

mitigation pitfalls, 384398

mitigation strategies, 368384

atomic operations, 376378

concurrent code properties, 383384

data races, 370371

happens before, 371

immutable data structures, 383

lock guards, 375

lock-free approaches, 379380

memory barriers (fences), 378379

memory model, 368370

message queues, 380

mutexes, 374375

reentrant functions, 383384

relaxed atomic operations, 371

semaphores, 379

synchronization primitives, 371374

thread safety, 383384

parallel, 355, 356f

and parallelism, 355359

and prematurely releasing a lock, 391392

programming for, common errors, 362368

corrupted values, 364365

race conditions, 362364

volatile objects, 365368

single-threaded programs and, 354355

spinlocks, 398

starvation, 385

vulnerabilities, 399401

DoS attacks in multicore DRAM systems, 399

in system call wrappers, 400401

time-of-audit-to-time-of-use (TOATTOU), 401

time-of-check-to-time-of-use (TOCTTOU), 401

time-of-replacement-to-time-of-use (TORTTOU), 401

Concurrent Versions System (CVS). See CVS

Concurrent-C, 20

Conforming program, 23

Conover, Matt, 198

const char, 35

Constructor attribute, 129131

Container virtualization, 470

Contention, 383, 392393

Control flow(s)

trusted, 450451

untrusted, 450451

Control transfer instructions, 125

Conversion specification, 314315

Conversion specifier(s), 315, 315t316t

Conversions, integer. See Integer conversions

Copy functions, string, 8992, 92t

truncating, 9399, 99t

Copying strings, 4347

Costs

of Blaster worm, 4

of cybercrime, 67, 7t8t

Counted minus loop, 290

Countermeasure(s). See Mitigation strategy(ies)

_countof(array), 40

cqual, 343344

Crackers. See also Attackers

definition, 9

CRED (C range error detector), 107108

Crimes. See Cybercrime

Criminals. See also Attackers

as threat, 9

Critical section, 363

Critical undefined behavior, 303304

CSIS. See Center for Strategic and International Studies (CSIS)

.ctors section, 130

CVS buffer overflow vulnerability, 222

CVS server double-free, 214, 223224

Cybercrime

costs of, 67, 7t8t

traditional crimes becoming, 6, 8t

trends in, 6

underreporting of, 6

unnoticed, 6

unreported, 6

CyberSecurity Watch Survey, 2010, 6

Cyberterrorism, 10

Cyclone, 25

Cygwin, 25, 25n

D

D programming language, 25

DAG. See Directed acyclic graph (DAG)

Data

ad hoc, processing, 498

encapsulation, 497

external, trusted vs. untrusted, 50

input validation and, 497498

locations, 122123

in nonstandard formats, processing, 498

sanitization, 500. See also Blacklisting; Whitelisting

specifications for, 497

tainted, 5152

Data execution prevention (DEP), 114115

Data model(s), 241, 241t

Data parallelism, 357359, 357f

Data pointer(s), 121, 124125

Data races, 370371. See also Deadlocks

Data streams, 408

Deadlocks, 385391, 462

Deallocation function(s), 163, 164, 168169

and allocation functions

correct pairings, 176, 176t

incorrect pairing, 172173

for array types, 163

for nonarray types, 163

throwing an exception, 179180

decode_pointer() function, 140142

Defect report (DR) 400, 161162

Defense in depth, 72, 120, 511512

Defensive strategy(ies). See Mitigation strategy(ies)

Déjà vul, 152

Dekker’s example, 369, 378

delete expression, 162, 172173

Denial-of-service (DoS), 4, 4n

DEP (data execution prevention), 114115

Department of Homeland Security, Software Assurance Curriculum Project, 481

Destructor attribute, 129131

Detection and recovery strategy(ies)

buffer overflow, 72, 101102

runtime protection, 111113

Development, software. See Software development

Development platforms, 2527

Device files, 407, 445448

preventing operations on, 445448

Dhurjati, Dinakar, 506

Direct access, to arguments, 335337

Directed acyclic graph (DAG), 404

Directory(ies), 405, 406

secure, 429, 470

shared, 458461

Directory traversal, 432435

vulnerable products, 434, 434t

Division operations, 274279

dlmalloc, 182191

allocated and free memory chunks, structure, 182183, 183f

buffer overflow

frontlink technique, 191195

unlink technique, 185191

double-free vulnerabilities, 191195

free list double-linked structure, 183184, 183f

unlink() macro, 184, 185f

writing to freed memory, 195196

DoS. See Denial-of-service (DoS)

Double-free vulnerability(ies), 157, 158, 160, 177178. See also CVS server double-free

dlmalloc, 191195

RtlHeap, 208211

DRAM. See Dynamic random-access memory (DRAM) systems

Dranzer tool, 515, 515n

.dtors section, 129131

Dynamic analysis, in race condition detection, 471

Dynamic memory allocator, 146

Dynamic memory management, 145224

aligned_alloc() function, 146, 148149, 153

alignment, 147149

alloca() function, 149150

allocation functions, 146147

best-fit allocation, 181

C++, 162172

common errors, 172180

handling of allocation failures, 172

calloc() function, 147, 152154

common errors, 151162, 172180

checking return values, 153155

dereferencing null or invalid pointers, 155156

DR #400, 161162

freeing memory multiple times, 157158

improperly paired functions, 172176

initialization, 151153

memory leaks, 158

referencing freed memory, 156157

scalars and arrays, 174175

zero-length allocations, 159160

consistent conventions for, 212213

first-fit allocation, 181

free() function, 147

improperly paired memory management functions and, 172176

incorrect pairing of C and C++ allocation and deallocation functions and, 172173

incorrect pairing of scalar and array operators and, 174175

malloc function, 146147

mitigation strategies, 212222

notable vulnerabilities, 222224

and randomization, 215

realloc() function, 146, 149, 153

Dynamic random-access memory (DRAM) systems, multicore, DoS attacks in, 399

Dynamic randomized-input functional testing, 513514

Dynamic storage allocation, 181182

Dynamic storage duration, 162

Dynamic use of static content, 338339

E

ECLAIR, 506, 506n

Economy of mechanism, 488489

e-crime. See Cybercrime

Edison Design Group (EDG) compiler, 507

Education

online secure coding course, 481

in secure coding, 480481

Effective C++ (Meyers), 341

Effective group ID (EGID), 416427

Effective user ID (EUID), 415427

Eiffel, 20

eip register. See Instruction pointer (eip)

ELF (executable and linking format), 127129

encode_pointer() function, 140142

Environment(s), supervised, 496

Equivalence errors, 435437

Error conditions

concurrency programming, 362368

corrupted values, 364365

race conditions, 362364

volatile objects, 365368

dynamic memory management, 151162, 172180

checking return values, 153155

dereferencing null or invalid pointers, 155156

DR #400, 161162

freeing memory multiple times, 157158

improperly paired functions, 172176

initialization, 151153

memory leaks, 158

referencing freed memory, 156157

scalars and arrays, 174175

zero-length allocations, 159160

integers, 242t, 255t256t. See also Integer overflow

conversion errors, 285, 288

exceptional condition errors, 256257, 257t

integer type range errors, 288

nonexceptional integer logic errors, 287288

sign errors, 251, 254

truncation errors, 251, 254, 256257, 257t, 259260, 285287, 288

string manipulation, 4250

null-termination errors, 4849

off-by-one errors, 47

string truncation, 49

unbounded string copies, 4247

without functions, 4950

Escape sequences, 34

EServ password-protected file access vulnerability, 436

Ettercap version NG-0.7.2, 349

Evans, Jason, 216. See also jemalloc memory manager

Event thread, 380

Exception, definition, 136

Exception handling, 136139, 206

for new operator, 165

structured, 136139

system default, 136137, 139

vectored, 136137

Exec Shield, 346

Executable and linking format (ELF), 127129

eXecute Disable (XD) bit, 114

eXecute Never (XN) bit, 114

Execution character set, 32

“Exploiting Concurrency Vulnerabilities in System Call Wrappers” (Watson), 400

Exploits, 1617

arc injection, 6970

code injection, 6469, 70

definition, 16

for IsPasswordOK program, stack smashing, 5964

proof-of-concept, 16

remote procedure call, Blaster worm and, 34

return-oriented programming, 7172

Extended alignment, 148

Extended base pointer (ebp) register, 5657

Extended characters, 32

Extended integers, 226, 241

Extraction operator, 4647

F

Fail-safe defaults, 488489

Failure Observation Engine (FOE), 514, 514n

Fallon, Elias, 512

False negatives, in static analysis, 507509, 508t

False positives, 304

in static analysis, 507509, 508t

__fastcall, 313

fchmod() function, 430431

fclose() function, 410

fgets() function, 64, 8486, 87, 89t

File(s)

attributes, 448450

closing, 217

create without replace, 453456

identification, 432450

using multiple file attributes, 448450

opening and closing, 409410

secure delete, 444

special, 406407, 445

stream, 408

temporary

and appropriate privileges, 460, 461t

create without replace, 460, 461t

creation functions, 459460, 461t

creation in shared directories, 459460, 461t

and exclusive access, 460, 461t

and removal before termination, 460, 461t

with unique and unpredictable file names, 459460, 461t

File I/O

access control, 413432

changing privileges, 417421

privilege management functions, 419421

process privileges, 415417

UNIX file permissions, 413415

basics of, 403407

byte input/output functions, 407

in C++, 412

concurrency, 467469

advisory locks, 458

exclusive locks, 458

file locking, 456458

mandatory locks, 458

named mutex object, 457458

named semaphores, 457458

shared locks, 458

synchronization primitives, 456458

synchronizing across processes, 456458

trusted/untrusted control flows, 450451

data streams, 408

and exclusive access, 456458

interfaces, 407412

mitigation strategies, 461471

atomic operations, 463

checking for symbolic links, 464467

chroot jail, 470

closing the race window, 462467

container virtualization, 470

controlling access to race object, 469471

dynamic analysis tools, 471

eliminating race objects, 467469

exposure control, 470471

file descriptors versus file names, 468469

Helgrind tool, 471

mutual exclusion migration, 462

principle of least privilege, 469

race detection tools, 471

reopening files, 463464

secure directories, 470

shared resources, 467468

static analysis tools, 471

Thread Checker, 471

thread-safe functions, 462463

and synchronizing across processes, 456458

vulnerabilities

directory traversal, 432435

path equivalence, 435437

privilege escalation, 418

symlink-related, 438439

time of check, time of use (TOCTOU), 451453, 455

wide-character input/output functions, 408, 412

File lock, 458

advisory, 458

exclusive, 458

mandatory, 458

shared, 458

File name(s), 405406

binding to file objects, 432

canonicalization, 439442

unique and unpredictable, for temporary files, 459460, 461t

using file descriptors instead of, 468469

File system(s), 404406

distributed, 404

hierarchical, 404

Financial loss(es). See Costs

Finite-state automaton (FSA), 420, 420f

First-fit memory allocation, 181

Flags, 316

compilation, 503504, 504f

Floating point, 299300, 324

fmemopen() function, 7879

FOE (Failure Observation Engine), 514, 514n

foo() function, 57

function epilogue for, 5859

function prologue for, 58, 58t

Foote, Jonathan, 514

fopen() function, 409410, 411t

and file creation, 453456

and permissions, 429432

fopen_s() function, 456

Format string(s), 309310, 314318

conversion specifications in, 314315

conversion specifier, 315, 315t316t

dynamic, 338339

excluding user input from, 338

flags, 316

interpretation, 314

length modifier, 317, 317t318t

ordinary characters in, 314

precision, 316

width, 316

Format string vulnerability(ies), 319320, 349351

brute-forcing, 351

and crashing a program, 321322

defeating stack randomization and, 332333

detection, static taint analysis and, 343344

and direct parameter access memory write, 335337

exploitable, 321, 349351

heap-based, exploiting, 351

and viewing memory content, 324326, 325f

and viewing stack content, 322324, 323f

wide-character, 332

and writing addresses in two words, 334335

WU-FTP, 319

FormatGuard, 346347

Formatted output, 309351

mitigation strategies, 337348

C11 Annex K bounds-checking interfaces, 340341

compiler checks, 342343

dynamic use of static content, 338339

excluding user input from format strings, 338

Exec Shield, 346

FormatGuard, 346347

iostream versus stdio, 341342

modifying variadic function implementation, 344346

restricting bytes written, 339340

static binary analysis, 347348

static taint analysis, 343344

testing, 342

-Wformat flag, 343

-Wformat-nonliteral flag, 343

-Wformat-security flag, 343

variadic functions, 309313, 344346

vulnerabilities

buffer overflow, 319321

CDE ToolTalk, 348349

crashing a program, 321322

direct argument access, 335337

Ettercap version NG-0.7.2, 349

internationalization, 331

output streams, 321

overwriting memory, 326331

viewing memory content, 324326, 325f

viewing stack content, 322324, 323f

Washington university FTP daemon, 348

wide-character, 332

writing addresses in two words, 334335

Formatted output functions, 313319

and buffer overflow, 319321

exploiting, 319332

GCC implementation, 318

limits, 318

Visual C++ implementation, 318319

length modifier, 319

limits, 319

precision, 319, 319t

Forrester, Justin, 514

Fortify, 506

fprintf(), 314

Frame, definition, 56

Free lists, 198200, 200f

FreeBSD, 214215, 216

free() function, 152, 156157, 162, 173, 181, 181n

fstat() function, 449450

FTP session, directory traversal vulnerability, 433434

Function(s). See specific function

Function epilogue, 5859

Function pointer(s), 121, 123124

decoding, 140142

decryption, 140142

encoding, 140142

encryption, 140142

Function prologue, 58

Fuzz testing, 513515

fwrite() function, 39

G

Gadget(s)

definition, 71

return-oriented programming set of, 7172, 71f

Turing-complete set of, 71

Garbage collection, 169172, 212

GCC (GNU Compiler Collection), 2627, 506

object size checking, 102106

security diagnostics, 507

“The Geometry of Innocent Flesh on the Bone” (Shacham), 72

getchar() function, 8486

getdelim() function, 88

GetFileType() function, 448

getline() function, 77, 8789, 89t

gets() function, 4243, 46, 5153, 64, 84

alternatives to, 8489, 89t

gets_s() function, 8687, 89t

Global offset table (GOT), 128129

Gloger, Wolfram, 182

GLSA 200506-07, 349

GMP (GNU Multiple-Precision Arithmetic Library), 292

GNU Compiler Collection (GCC), 2627, 506

object size checking, 102106

GNU libc allocator, 182

GNU Multiple-Precision Arithmetic Library (GMP), 292

GOT (global offset table), 128129

Group ID (GID), 413

/GS flag, 503504, 504f

GSWKT (Generic Software Wrappers Toolkit), concurrency vulnerabilities, 400

Guard pages, OpenBSD, 216

Guide to the Software Engineering Body of Knowledge (Bourque and Dupuis), 483484

Guidelines, for software development, 516

H

Hackers

politically motivated attacks by, 10

as threat, 89

Hacker’s Delight (Warren), 299

Happens before, 371

Hard links, 442445, 443f

versus soft links, 444, 444t

Hazard pointers, 395396

Heap exhaustion, 153155

Heap memory

randomization, in Windows, 113

Win32 API, 197, 197f

Heap-based exploits, 146. See also Dynamic memory management

Heap-based vulnerabilities

mitigation strategies, 212222

RtlHeap, 196212

Helgrind tool, 471

Hi, definition, 30

Hocevar, Sam, 514, 514n

Horovitz, Oded, 198

Householder, Allen, 514515

Howard, Michael, 298

HP Fortify Static Code Analyzer, 344

Hyperthreading, 354

I

IAT (import address table), 129

Implementation

definition, 22

and undefined behavior, 2223

Import address table (IAT), 129

Independent security reviews, 516517

Information warriors, as threat, 10

i-node, 405, 405f

and hard links, 442444, 444t

Input validation, 102, 497498, 500, 518

Insiders, as threat, 9

Instruction pointer (eip), 57

modifying, 125127

Insure++, 221

int, 232

minimum width, 237

int type, 3839

Integer(s)

character types, 240241

compiler- and platform-specific integral limits, 228, 228t

data types, 226246

abstract, 291292

selection, 289291

definition, 225

error conditions, 242t, 255t256t. See also Integer overflow

conversion errors, 285, 288

exceptional condition errors, 256257, 257t

integer type range errors, 288

nonexceptional integer logic errors, 287288

sign errors, 251, 254

truncation errors, 251, 254, 256257, 257t, 259260, 285287, 288

extended, 226, 241

int, 232

minimum width, 237

intmax_t, 243244

intptr_t, 245

long int, 232

minimum width, 237

long long int, 232

minimum width, 237

mitigation strategies, 288306

abstract data types, 291292

arbitrary-precision arithmetic, 292293

as-if infinitely ranged (AIR) integer model, 303304

GCC -ftrapv flag, 300301

GNU Multiple-Precision Arithmetic Library (GMP), 292

integer type selection, 289291

Java BigInteger, 292

Microsoft Visual Studio c4244 warning, 305

Microsoft Visual Studio runtime error checks, 106, 300

modwrap semantics, 302

overflow detection, 299300

postcondition testing, 297

precondition testing, 295297

range checking, 288, 293295

restricted range usage, 302303

saturation semantics, 302

secure integer libraries, 297299

source code audit, 306

static analysis, 304305

testing, 305306

type safety, 292

verifiably in-range operations, 301303

one’s complement, 232, 233, 234235, 235t

operations, 256283

addition, 260267

assignment, 258260

data parallelism and, 357358

division and remainder, 274279

error detection, 275276

postcondition, 277279

precondition, 276277

and exceptional condition errors, 256257, 257t

multiplication, 269274

downcast from a larger type, 272273

postcondition test using status flags, 270272

precondition test, general, 273274

shifts, 279283

subtraction, 267269

postcondition test using status flags, 267268

verifiably in-range, 301303

operators

that can result in overflow, 239, 239t240t

that can result in wrapping, 231, 231t

packed, 358

platform-independent types for controlling width, 245

platform-specific types, 245246

ptrdiff_t, 242243

range checking, 293295

and integer wraparound vulnerability, 284285

representation, 226227

comparisons of, 234235, 235t

paddings bits, 226227

precision, 227

width, 227, 237

rsize_t, 289290

security flaws involving, 225226, 283

shifts, 279283

arithmetic (signed), 281, 281f

left shift, 279281, 280f, 283

logical (unsigned), 281, 281f

right shift, 279, 281282

short int, 232

minimum width, 237

sign and magnitude, 232, 234235, 235t

signed, 231235, 240241

ranges, 235237, 235t236t, 236f

signed char, 232, 240

minimum width, 237

size_t, 242, 289291

standard, 226, 232

truncation toward zero, 274

two’s complement, 232233, 234235, 234f, 234t, 235t, 239

and unary negation (), 279

to unsigned conversion, 254, 255f

typedefs, 241

uintmax_t, 243244

uintptr_t, 245

unary negation (–), 279

unsigned, 227229, 240241

to two’s complement conversion, 251, 251f

unsigned char, 232, 240241

vulnerabilities, 283288. See also Integer wraparound

conversion errors, 285

nonexceptional integer logic errors, 287288

truncation errors, 285287

Integer conversions, 246256

explicit, 246

implicit, 246, 256

and loss of sign, 251, 254, 256

and loss of value, 251, 254, 256

promotions, 247249

rank, 246247

from signed types, 253255, 255t256t

loss of precision, 253, 255t256t

to unsigned, 253255, 255t256t

from unsigned types, 250253, 252t

loss of precision, 250, 252t

to signed, 250252, 252t

usual arithmetic, 249

Integer overflow, 237239, 239t240t, 256257, 257t, 261, 288

detection, 299300

fussy, 294295

signed

resulting from addition, 261262

avoiding or detecting, 262265

downcast from a larger type, 265

postcondition test using status flags, 263264

precondition test, general, 264265

precondition test, two’s complement, 264

resulting from division, 274

detecting and avoiding, 276279

resulting from multiplication, 269

detecting or avoiding, 271274

resulting from subtraction

avoiding or detecting, 268

precondition test, 268

Integer wraparound, 229231, 256257, 257t, 283285

resulting from addition, 261

avoiding or detecting, 265267

postcondition test, 266267

using status flags, 265266

precondition test, 266

resulting from multiplication, detecting or avoiding, 271274

resulting from subtraction

avoiding or detecting, 269

postcondition test, 269

postcondition test using status flags, 269

precondition test, 269

Intellectual property, theft of, 9

Interface(s), exploitable, 500501, 501f

Internationalization, formatted output vulnerability, 331

Internet Security Glossary, version 2, 483

Internet Security Systems Security Advisory, 349

Interprocess communication (IPC) mechanism(s), 459

intmax_t, 243244

intptr_t, 245

I/O. See File I/O

iOS, ASLR (address space layout randomization), 116

iostream, 341342

islower() function, 21

ISO/IEC

9899-1990, 20

9899:1999, 482

14882:2011, 20

24731, 74

TR 24731-1, 282, 299, 483

TR 24731-2, 7677, 8788, 92, 93, 99, 483

TS 17961 C Secure Coding Rules, 15, 217, 483, 509510

conformance test suite for, 510

IsPasswordOK(), 5153, 52f

security flaw in, 5253, 53f, 5964, 62f, 63f

istream class, 46

Iterators, 81

invalid, 8182

J

Java, 25

Java BigInteger, 292

Java Native Interface (JNI), 25

jemalloc memory manager, 216217

JIT. See Just-in-time (JIT) compiler

jmp_buf type, 134136

Jones, Richard, 506

JPEG files, comment field, unsigned integer wraparound vulnerability, 283284

Just-in-time (JIT) compiler, and W^X policy, 114115

K

Kamp, Poul-Henning, 213. See also phkmalloc

Kelly, Paul, 506

Kerberos

buffer overrun vulnerability, 118

double-free vulnerabilities, 224

Klocwork, 506

Knuth, Donald, 181182

K&R. See The C Programming Language

L

Lam, Monica, 506

Last Stage of Delirium (LSD) Research Group, 2

LDRA, 506

Lea, Doug, 146

memory allocator (dlmalloc), 182191. See also dlmalloc

lea instruction, 6566

Least common mechanism, 489, 492

Least privilege, 70, 489492, 494

Legacy code, C and C++, 24

Lesk, M. E., 309n

libpng library, 155156

Libsafe, 107

libsafe library, 496

Libverify, 107

Linux, 26

address space layout randomization, 112

file systems supported, 404

PaX patch, 112, 115116

Livelock, 462

Lo, definition, 30

Load effective address (lea) instruction, 6566

Locale, 32

Lock guards, 375

long int, 232

minimum width, 237

long long int, 232

minimum width, 237

longjmp() function, 134136

Look-aside lists, 200, 200f, 212

LSD (Last Stage of Delirium Research Group), 2

M

Mac OS X

ASLR (address space layout randomization), 116

file systems supported, 404

Mail transfer agent (MTA), privilege management, 424

main() function, 43

malloc, return values on success and error, 217, 217t

malloc() function, 151155, 173, 181

Manadhata, Pratyusa, 517

mbstowcs(), 35

MDAC. See Microsoft Data Access Components (MDAC)

Memcheck, 219221

memcpy() function, 39, 100

and object size checking, 104105

memcpy_s() function, 100

memmove() function, 100

memmove_s() function, 100

Memory. See also Dynamic memory management

chunks, 201202, 201f

double-free, 157, 158, 160

RtlHeap, 208211

freed

accessing, 217

referencing, 156157

writing to, dlmalloc, 195196

writing to, RtlHeap, 207208

freeing, 217

multiple times, 157158, 176179, 218

heap

randomization, in Windows, 113

Win32 API, 197, 197f

management modes, string-handling functions, 73

overwriting, 326331

process, organization, 54, 55f

data declarations and, 123

read-only, 54

stack, randomization, in Windows, 113

uninitialized, referencing, 218

virtual, Win32 API, 196197, 197f

zero-length allocations, 159160

Memory fence(s), 368, 378379

Memory leak(s), 158, 177

automatic detection of, 158

detection

Insure++, 221

Purify, 218

Valgrind tool, 221

Memory manager(s), 146, 180182

memset() function, 152

memset_s() function, 152

Message queues, 380

Messier, Matt, 498

Metasploit Project, 3

Meyers, Scott, 341

Microsoft Data Access Components (MDAC), buffer overflow vulnerability, 223

Microsoft Office, vulnerabilities in, SDL and, 474, 475f

Microsoft OpenOffice, vulnerabilities in, SDL and, 474, 475f

Microsoft Security Bulletin

MS02-65, 223

MS03-026, 2

Microsoft Visual Studio. See Visual Studio

Microsoft Windows. See Windows

Miller, Barton, 514

MIT krb5 library, 213

MIT krb5 Security Advisory 2004-002, 224

Mitigation(s), definition, 17

Mitigation pitfalls, concurrency, 384398

Mitigation strategy(ies)

applications, 474

broad, 473

buffer overflow, detection and recovery, 72, 101102

concurrency, 368384

atomic operations, 376378

concurrent code properties, 383384

data races, 370371

happens before, 371

immutable data structures, 383

lock guards, 375

lock-free approaches, 379380

memory barriers (fences), 378379

memory model, 368370

message queues, 380

mutexes, 374375

reentrant functions, 383384

relaxed atomic operations, 371

semaphores, 379

synchronization primitives, 371374

thread safety, 383384

dynamic memory management, 212222

file I/O, 461471

atomic operations, 463

checking for symbolic links, 464467

chroot jail, 470

closing the race window, 462467

container virtualization, 470

controlling access to race object, 469471

dynamic analysis tools, 471

eliminating race objects, 467469

exposure control, 470471

file descriptors versus file names, 468469

Helgrind tool, 471

mutual exclusion migration, 462

principle of least privilege, 469

race detection tools, 471

reopening files, 463464

secure directories, 470

shared resources, 467468

static analysis tools, 471

Thread Checker, 471

thread-safe functions, 462463

formatted output, 337348

C11 Annex K bounds-checking interfaces, 340341

compiler checks, 342343

dynamic use of static content, 338339

excluding user input from format strings, 338

Exec Shield, 346

FormatGuard, 346347

iostream versus stdio, 341342

modifying variadic function implementation, 344346

restricting bytes written, 339340

static binary analysis, 347348

static taint analysis, 343344

testing, 342

-Wformat flag, 343

-Wformat-nonliteral flag, 343

-Wformat-security flag, 343

heap-based vulnerabilities, 212222

integers, 288306

abstract data types, 291292

arbitrary-precision arithmetic, 292293

as-if infinitely ranged (AIR) integer model, 303304

GCC -ftrapv flag, 300301

GNU Multiple-Precision Arithmetic Library (GMP), 292

integer type selection, 289291

Java BigInteger, 292

Microsoft Visual Studio C4244 warning, 305

Microsoft Visual Studio runtime error checks, 106, 300

modwrap semantics, 302

overflow detection, 299300

postcondition testing, 297

precondition testing, 295297

range checking, 288, 293295

restricted range usage, 302303

saturation semantics, 302

secure integer libraries, 297299

source code audit, 306

static analysis, 304305

testing, 305306

type safety, 292

verifiably in-range operations, 301303

pointer subterfuge, 139142

race conditions, 461

strings, 7283

C11 Annex K bounds-checking interfaces, 7376, 282, 340341

C++ std::basic_string, 8081

detection and recovery, 101102

dynamic allocation functions, 7680

input validation, 102

invalidating string object references, 8183

object size checking, 102106

runtime protection, 101117

mkstemp function, secure and insecure use of, 461t

mkstemp() function, 431432

mktemp function, secure and insecure use of, 461t

Mode(s), file opening, 409410

Modula 3, 20

Moore, H. D., 3

Morris worm, 117

msblast.exe, 4

MTA. See Mail transfer agent (MTA)

Multibyte character set, 32. See also UTF-8

Multibyte string, 32

Multiplication operations, 269274

Multithreading, 354355, 368

Mutex(es), 374375. See also Named mutex object

N

Named mutex object, 457458

Named pipes, 407

Named semaphores, 457458

NASA. See National Aeronautics and Space Administration (NASA)

National Aeronautics and Space Administration (NASA), advanced persistent threat attacks against, 10

National Institute of Standards and Technology (NIST), Static Analysis Tool Exposition (SATE), 509

National Vulnerability Database (NVD), vulnerabilities cataloged by, 11, 11f

Negative zero, 234

NEON instructions, 357

NetBSD Security Advisory 2000-002, 284

Network administrators, definition, 13

New expression, 162163, 172173, 175

incorrect use, 172

nothrow form, 172

New handler, 167168

NIST. See National Institute of Standards and Technology (NIST)

No eXecute (NX) bit, 114

Normalization, 499500

NTBS (null-terminated byte string), 3637

NTMBS (null-terminated multibyte string), 36

Null character, 32, 34, 332

Null pointer(s), 212

Null-terminated byte string (NTBS), 3637

Null-terminated multibyte string (NTMBS), 36

NVD. See National Vulnerability Database (NVD)

NX (No eXecute) bit, 114

O

Object pointer(s), 121, 124125

Objective-C, 20

Obsolescent feature(s), 162

Off-the-shelf software, 495496

on_exit() function, 133134

Open design, 489, 490

OpenBSD, 215216

security options for, 216, 216t

open() function, 410411, 411t

and file creation, 453456

and permissions, 429431

open_memstream() function, 78

OpenSHH

privilege escalation vulnerability, 418

secure shell implementation, 487488, 487f

open_wmemstream() function, 78

Operating system(s), 26

and runtime protection strategies, 111116

detection and recovery, 111113

operator delete() function, 163, 164, 168169, 173, 174

operator delete[]() function, 163, 168, 173175

operator new, 162163

operator new() function, 163, 164, 173175

and member new() function, failure to properly pair, 175

operator new[]() function, 163, 173175

Out-of-bounds store, 304

_output() function, 318319

Overaligned type, 148

P

Padding bits, 226227

Page(s), in Win32 virtual memory API, 196

Parallelism, 355359

achievable, program structure and, 360, 360f

Amdahl’s law, 361, 362f

data, 357359, 357f

limits, 360, 361f

and performance goals, 359361

task, 359, 359f

and work-to-span ratio, 360, 361f

passwd program, 422

Path(s), canonical, 499500

Path equivalence errors, 435437

Path name(s), 405406, 406f

absolute, 405406, 432

canonicalization, 439442

relative, 406, 432, 435

resolution, 432

PCLint, 506

Penetration testing, 513

Permission(s)

definition, 413

management, 428432

on newly created files, 429432

Pethia, Richard, 4

Phishing, 9

phkmalloc, 213215. See also OpenBSD

security implications, 214, 214t

ping program, 423424

Placement new, 163

correct and incorrect use of, 175176

PLT (procedure linkage table), 129

Pointer(s), 30, 31

data, 121, 124125

disguised, and garbage collection, 169170

function, 121, 123124

decoding, 140142

decryption, 140

encoding, 140142

encryption, 140

hazard, 395396

invalid

dereferencing, 155156

formed by library function, 218

to member type, 121

null, 212

dereferencing, 155156

object, 121, 124125

out-of-domain, dereferencing, 217

safely derived, 170

safety, management, 170171

smart, 178179

reference-counted, 178179

to wide string, 34

Pointer arithmetic, 260, 304

Pointer subterfuge

definition, 121

mitigation strategies, 139142

pointer_safety, 170

Portability, C and C++, 2324

Portable executable (PE) file, 129, 207, 207n

“A Portable I/O Package” (Lesk), 309n

POSIX

file descriptors, 410411

open and close file functions, 410411

threading library, 368

umask process, 429432, 430f

Preservation, and type safety, 24

Prevent, 506, 512

printf() function, 309, 314

Privilege(s)

appropriate, 420

changing, 417421

definition, 413

dropping, 418, 425426

revocation order for, 426

elevated, 418

escalation, 418

least, 489492, 494

management, vulnerabilities associated with, 427428

management functions, 419421

managing, 422428

process, 415417

separation of, 489, 490

Procedure linkage table (PLT), 129

Process, definition, 54

Process environment block (PEB), 198, 199f

Process group IDs, 416

Process memory, organization, 54, 55f

data declarations and, 123

Process privileges, 415417

Process user IDs, 415416

Programmer, definition, 13

Programming language(s)

alternatives to C, 25

popularity

long-term trends in, 18, 19t

TIOBE index of, 1718, 18t

Progress, and type safety, 24

Promotions, integer conversions, 247249

ProPolice. See Stack-Smashing Protector (ProPolice)

Psychological acceptability, 489, 492493

Pure binary notation, 39

Purify, 218219, 512

PurifyPlus, 218219

puts() function, 51

Q

Quality management, software development, 479480

Quality requirements engineering, 483485

R

Race conditions, 362364, 450461

canonicalization and, 441

change state property, 363, 469

and concurrency property, 363

detection

dynamic analysis tools, 471

static analysis tools, 471

using check-use-check pattern, 465466

and exclusive access, 456458

file-related, eliminating, 467469

from GNU file utilities, 451

and shared directories, 458461

and shared object property, 363

time of check, time of use (TOCTOU), 451453, 455

vulnerabilities related to, mitigation strategies, 461

Race object

controlling access to, 469471

eliminating, 467469

Race window, 451

closing, 462467

critical section, 363

definition, 363

identification, 363

RAII. See Resource Acquisition Is Initialization (RAII)

rand() function, 285

Random XOR canaries, 109

Range checking, integers, 293295

Ranges of integers, 235237, 235t236t, 236f

Read-only memory, 54

Real group ID (RGID), 416

Real user ID (RUID), 415417

realloc, return values on success and error, 217, 217t

realloc() function, 146, 149, 153, 159162

realpath() function, 440441, 495496

Reentrant functions, 383384

Reference-counted smart pointer(s), 178179

Region(s), in Win32 virtual memory API, 196

Relative path name, 406, 432, 435

Remote login, 117118

Remote procedure call (RPC), buffer overflow vulnerability, 23, 2n

Resource Acquisition Is Initialization (RAII), 165166, 375

Resource-exhaustion attack, 158

Return-oriented programming, 7172

Risk assessment. See Threat assessment

rlogin program, 117118

ROSE, 304305, 506507

RPC (remote procedure call), buffer overflow vulnerability, 23, 2n

RTL (runtime linker), 129

RtlHeap, 146, 146n

buffer overflows, 202207

data structures, 198202

free lists, 198200, 200f

look-aside lists, 200, 200f, 212

memory chunks, 201202, 201f

process environment block, 198, 199f

double-free vulnerabilities, 208211

heap-based vulnerabilities, 196212

and writing to freed memory, 207208

Runtime analysis tools, 218222

Runtime bounds checkers, 106108, 506

Runtime error checks

compiler-generated, 106, 300301

GCC -ftrapv flag, 300301

Microsoft Visual Studio, 106, 300

Runtime linker (RTL), 129

Runtime protection strategies, 101117

advances in (future directions for), 116117

operating system, 111116

Runtime-constraint handler, 7576, 299300

RUS-CERT Advisory 2002-08:02, 284

Ruwase, Olatunji, 506

S

Safe-Secure C/C++ (SSCC), 116117, 117f, 505506, 507f

SAFE SEH, 138, 138n

Sanitization, 500. See also Blacklisting; Whitelisting

Saved set-group-ID (SSGID), 416

Saved set-user-ID (SSUID), 415416

SCADA (supervisory control and data acquisition), terrorist threat to, 10

Scalar registers, 357

SCALe (Source Code Analysis Laboratory), 510511

Scott, Roger, 512

SDL. See Security Development Lifecycle (SDL)

Secunia Advisory SA15535, 349

Secure design patterns, 488

Secure wrappers, 496

Security

developmental elements, 12

independent reviews, 516517

operational elements, 12

requirements, 481486

Security analyst, definition, 13

Security concepts, 1217, 13f

Security Development Lifecycle (SDL), 474480, 474f, 505. See also Simplified SDL

Security flaw(s)

definition, 14

elimination of, 17

and vulnerabilities, 15

Security policy

definition, 14

explicit, 14

implicit, 14

Security quality requirements engineering (SQUARE), 483485

Security researcher, definition, 14

Security Tracker Alert ID 1014084, 349

Security training, 480481

Security use/misuse cases, 485, 485t, 486t

SecurityFocus Bugtraq ID 1387, 348

SEH. See Structured exception handling (SEH)

Semaphores, 379. See also Named semaphores

Sendmail, vulnerabilities, 428

Separation of privilege, 489, 490

SESS (Summit on Education in Secure Software), 480481

setegid() function, 419, 425

seteuid() function, 419421

Setgid programs, 422

setgid() function, 425

setjmp() macro, 134135

setlocale() function, 32

setresgid() function, 425

setresuid() function, 419, 421

setreuid() function, 419, 421

Setuid programs, 422428

setuid() function, 419428

Set-user-ID-root program, 422424

Shacham, Hovav, 72

Shannon, Gregory E., 11

Shared directories, 458461

Shellcode, 64

injected, location of, 69

Shift state(s)

initial, 32

locale-specific, 32

short int, 232

minimum width, 237

Shortcuts, 453

Signal(s), in management of division errors, 278279

Signal handler(s), concurrency issues and, 354355

signed char, 3738, 232, 240241

minimum width, 237

Signed integer(s), 231235, 240241

ranges, 235237, 235t236t, 236f

Simplified Implementation of the Microsoft SDL, 475

Simplified SDL, mapping of resources and tools to, 475, 475t476t

Single instruction, multiple data (SIMD) computing, 148149, 357

sizeof(array), 31, 40

sizeof operator, 3132

slprint() function, 340

Smart pointer(s), 178179

snprintf() function, 45, 314, 339340

Sockets, 407

Software, off-the-shelf, 495496

Software components, 12

Software defect(s), 1415

definition, 14

per thousand lines of code, 27

static analysis, 512

Software development

architecture and design, 486503

blacklisting, 501502

code audits, 515

data sanitization, 500

defect removal in, 479480

defense in depth, 511512

fuzz testing, 513515

guidelines and checklists, 516

implementation, 503512

independent security reviews in, 516517

input validation, 497498

penetration testing, 513

planning, 477479, 478f

quality management, 479480

requirements, 481486

secure launch, 477479, 478f

secure wrappers, 496

security principles, 488493

complete mediation, 488489, 490f

economy of mechanism, 488489

fail-safe defaults, 488489

least common mechanism, 489, 492

least privilege, 489492, 494

open design, 489, 490

psychological acceptability, 489, 492493

separation of privilege, 489, 490

testing, 503

threat modeling, 493494

tracking, 477479, 478f

trust boundaries, 498501

TSP-Secure, 477480

validation, 500

verification, 512517

and vulnerabilities in existing code, 495496

whitelisting, 502503

Software security, threats to, 1112

Source code, 1213

audits, 515

for integer range errors, 306

Source Code Analysis Laboratory (SCALe), 510511

SourceForge, 511, 511n

Special files, 406407, 445

Spies, corporate. See Competitive intelligence professionals

Spinlocks, 398, 457

Splint, 305

sprintf() function, 43, 4547, 77, 309, 314, 339340

SQUARE. See Security quality requirements engineering (SQUARE)

sscanf() function, 77

SSCC. See Safe-Secure C/C++ (SSCC)

SSE. See Streaming SIMD Extensions (SSE)

SSP. See Stack-Smashing Protector (ProPolice)

StackShield, 143

Stack(s)

and calling a subroutine, 5556, 56f

management, 5559, 55f

nonexecutable, 113

randomization, 332337

defeating, 332333

Exec Shield and, 346

smashing, 59, 60f, 61f. See also Stack-Smashing Protector (ProPolice)

structure, 55, 55f

Stack-Smashing Protector (ProPolice) and, 110, 111f

Stack buffer overrun detection, 108109

Stack canaries, 108109

Stack memory, randomization, in Windows, 113

Stack pointer, 57

StackGap, 116

StackGuard, 108, 109, 143

Stack-Smashing Protector (ProPolice), 108, 110, 111f

Standard library error, detection and handling of, 217

Standard template library (STL), checked implementation, 82

Standards, secure coding, 481483

State-dependent encoding, 32

stat() function, 449450

Static analysis, 217218, 304305

for format string vulnerabilities, 343344

and implementation, 506510

in race condition detection, 471

thread role analysis, 382383

and verification, 512

Static assertion, 273

Static binary analysis, 347348

-std flag, 27

std::bad_array_new_length, 166167

std::basic_string, 36

__stdcall, 313

stdio, 341342

std::stream class, 46

std::string class, 8081

Sticky bit, 415

STL (standard template library), checked implementation, 82

Storage duration, 147, 162

allocated, 147

dynamic, 162

strcat() function, 43, 49, 73, 89, 93t, 94

strcat_s() function, 73, 9092, 93t

strcmp() function, 5153

strcpy() function, 4344, 48, 6667, 67t68t, 73, 8990, 92t, 94

and object size checking, 104105

strcpy_s() function, 73, 9092, 92t

strdup() function, 45, 92, 92t

Stream

associated with memory buffer, 7778

opening, to write to memory, 7879

Stream files, 408

Streaming SIMD Extensions (SSE), 148149, 357

Strictly conforming program, 23

String(s)

in C++, 3637

concatenating, 4347

concatenation functions, 8993, 93t

copy functions, 8992, 92t

copying, 4347

data type, 3032

definition, 30

error conditions, 4250

null-termination errors, 4849

off-by-one errors, 47

string truncation, 49

unbounded string copies, 4247

without functions, 4950

length, 30, 30f, 40

definition, 31

mitigation strategies, 7283

C11 Annex K bounds-checking interfaces, 7376, 282, 340341

C++ std::basic_string, 8081

detection and recovery, 101102

dynamic allocation functions, 7680

input validation, 102

invalidating string object references, 8183

object size checking, 102106

runtime protection, 101117

multibyte, 32

null-terminated, 3637, 4849

definition, 31

pointer to, 30

sizing, 3941

storage for, 76

symbolic verification technique (Yu et al.), 306

truncating concatenation functions, 9399, 99t

truncating copy functions, 9399, 99t

truncation, 49

value of, 30

vulnerabilities and exploits, 5072, 117118

wide, 3334

sizing, 4041

String class(es), 3637

String literals, 3436

String-handling functions, 73, 84101

strlcat() function, 90, 93t, 98, 99t

strlcpy() function, 90, 92t, 96, 99t

strlen() function, 31, 37, 4041, 44, 48, 100101

strncat() function, 49, 73, 9395, 93t, 98, 99t

strncat_s() function, 73, 95, 9798, 99t

strncpy() function, 4849, 73, 90, 92t, 9395, 96, 99t

strncpy_s() function, 73, 9598, 99t

strndup() function, 99, 99t

strnlen() function, 101

strnlen_s() function, 100101

strtok() function, 49

Structured exception handling (SEH), 136139, 277278

Subobject(s), 148

Subroutine, calling, 5556, 56f

Summit on Education in Secure Software (SESS), 480481

Sun tarball vulnerability, 152

Supervised environments, 496

Supervisory control and data acquisition (SCADA), terrorist threat to, 10

Supplementary group IDs, 416, 426427

svchost.exe, 4

Symbolic links, 406, 437439, 437f, 452453

checking for, 464467

symlink() system call, 437

SYN flooding, 4, 4n

syslog() function, 314

System administrator, definition, 13

System call wrappers, concurrency vulnerabilities, 400401

System default exception handling, 136137, 139

System integrator, definition, 13

Systrace, 496

concurrency vulnerabilities, 400

T

Tainted value(s), 51

tar program, 152, 152n

tar utility, 152

Target(s), analysis and reduction, 494495

Target size, definition, 31

Task parallelism, 359, 359f

tcp_wrappers package, 502503

Team Software Process for Secure Software Development (TSP-Secure), 477480

TEBs. See Thread environment blocks (TEBs)

Temporary file(s)

and appropriate privileges, 460, 461t

create without replace, 460, 461t

creation functions, 459460, 461t

creation in shared directories, 459460, 461t

and exclusive access, 460, 461t

and removal before termination, 460, 461t

with unique and unpredictable file names, 459460, 461t

Terrorists. See also Attackers

as threat, 10

Thread Checker, 471

Thread environment blocks (TEBs), 198

Thread role(s), 381, 381n

Thread role analysis, 380383

annotation language, 381382

static analysis, 382383

Thread safety, 368370, 383384

Thread support, 368

Thread usage policies, 380381

Thread-safe functions, 462463

Threat(s)

competitive intelligence professionals as, 910

criminals as, 9

definition, 8

hackers as, 89

information warriors as, 10

insiders as, 9

to software security, 1112

terrorists as, 10

Threat assessment, 512

Threat modeling, 493494

Threat Modeling Tool, 494, 494n

Time of check, time of use (TOCTOU), 401, 451453, 455

Time-of-audit-to-time-of-use (TOATTOU), 401

Time-of-check-to-time-of-use (TOCTTOU), 401

Time-of-replacement-to-time-of-use (TORTTOU), 401

TIOBE index, 1718, 18t

TIS. See Tool Interface Standards committee (TIS)

tmpfile function, secure and insecure use of, 461t

tmpfile_s function, secure and insecure use of, 461t

tmpnam function, secure and insecure use of, 461t

tmpnam_s function, secure and insecure use of, 461t

TOATTOU. See Time-of-audit-to-time-of-use (TOATTOU)

TOCTOU. See Time of check, time of use (TOCTOU)

TOCTTOU. See Time-of-check-to-time-of-use (TOCTTOU)

TooFar, definition, 30

Tool Interface Standards committee (TIS), 127128, 128n

TORTTOU. See Time-of-replacement-to-time-of-use (TORTTOU)

Training, in secure coding, 480481

Trampoline(s), 206207

Truncation toward zero, 274

Trust boundaries, 498501, 499f

Tsize, definition, 31

TSP-Secure, 477480

Type safety, 24

preservation and, 24

progress and, 24

typedefs, 241

U

Uadd() function, 298

UFS. See UNIX file system (UFS)

Umask process, 429432, 430f

Unhandled exception filter, 206207

Unicode, wide-character format string vulnerability, 332

Uniform resource locator. See URL

UNIX

file permissions, 413415, 414f

process memory organization, 54, 55f

data declarations and, 123

UNIX file system (UFS), 404405

unsigned char, 3739, 232, 240241

Unsigned integer(s), 227229, 240241

to two’s complement conversion, 251, 251f

URL, host and path name in, 435

Usability problems, 489, 492493

US-CERT

Technical Cyber Security Alert

TA04-147A, 222

TA04-247A, 224

Vulnerability Note, VU#132110, 390

Use/misuse cases, 485, 485t, 486t

User ID (UID), 413

User name, 413

UTF-8, 3233

decoders, as security hole, 33

encoding, 3233, 33t

UTF-16, 40

V

Valgrind tool, 219221, 512

Validation, 500. See also Input validation

Variable-length arrays (VLAs), 150151

Variadic functions, 309313, 344346

vasprintf() function, 340

Vector registers, 357358

Vectored exception handling (VEH), 136137

Vectorization, 358

VEH. See Vectored exception handling (VEH)

Venema, Wietse, 502503

vfprintf() function, 314

Viega, John, 498

Virtual function(s), 131132

Virtual function table (VTBL), 132133, 132f

Virtual pointer (VPTR), 132133, 132f

Visibility, and thread safety, 370

Visual C++, 26

/GS and function protection, 108109

/GS flag, 503504, 504f

security diagnostics, 507

stack canary implementation, 108

Visual C++ 2012

autovectorizer, 358359

loop pragma, 358

/Qpar compiler switch, 358

Visual Studio

C4244 warning, 305

compiler-generated runtime checks, 106, 300

/GS flag, 504505

/sdl switch, 505

stack buffer overrun detection, 108109

Visual Studio 2010, formatted output vulnerability, 326n

VLAs. See Variable-length arrays (VLAs)

volatile type qualifier, 366368

vprintf() function, 314

VPTR (virtual pointer), 132133, 132f

vsnprintf() function, 314, 339340

vsprintf() function, 314

VTBL (virtual function table), 132133, 132f

Vulnerability(ies), 21

in ActiveX controls, 515

buffer overflow, 117118

concurrency, 399401

DoS attacks in multicore DRAM systems, 399

in system call wrappers, 400401

time-of-audit-to-time-of-use (TOATTOU), 401

time-of-check-to-time-of-use (TOCTTOU), 401

time-of-replacement-to-time-of-use (TORTTOU), 401

definition, 15

disclosure of, by hackers, 89

double-free, 157, 158, 160, 177178. See also CVS server double-free

dlmalloc, 191195

RtlHeap, 208211

dynamic memory management, 222224

in existing code, 495496

file I/O

directory traversal, 432435

path equivalence, 435437

privilege escalation, 418

symlink-related, 438439

time of check, time of use (TOCTOU), 451453, 455

filtering out, in software development, 479480

format string. See Format string vulnerability(ies)

formatted output

buffer overflow, 319321

CDE ToolTalk, 348349

crashing a program, 321322

direct argument access, 335337

Ettercap version NG-0.7.2, 349

internationalization, 331

output streams, 321

overwriting memory, 326331

viewing memory content, 324326, 325f

viewing stack content, 322324, 323f

Washington University FTP daemon, 348

wide-character, 332

writing addresses in two words, 334335

heap-based, 196212

mitigation strategies, 212222

integer, 283288. See also Integer wraparound

conversion errors, 285

nonexceptional integer logic errors, 287288

truncation errors, 285287

intentional, 16

in Microsoft Office versus OpenOffice, 474, 475f

in programs, versus in systems and networks, 16

security flaws and, 15

string, 5072, 117118

Vulnerability analyst, definition, 13

Vulnerability reports, sources of, 11

W

W xor X. See W^X policy

wall program, 422

Warren, Henry S., 299

Washington University FTP daemon, 348

Watson, Robert, 400

W32.Blaster.Worm, 15, 2f, 117

flawed logic exploited by, 5, 5f

wchar_t, 30, 35, 39, 40

wcslen() function, 41

-Wformat flag, 343

-Wformat-nonliteral flag, 343

-Wformat-security flag, 343

Whitelisting, 111, 502503

Wide string(s), 3334

sizing, 4041

Wide-character input/output functions, 408, 412

Wide-character vulnerability, 332

Widening-multiplication instruction, 271

Win32

CRT memory functions, 197198, 197f

heap memory API, 197, 197f

local, global memory API, 197, 197f

memory management APIs, 196, 197f

memory-mapped file API, 197f, 198

virtual memory API, 196197, 197f

Windows, 26

address space layout randomization, 112113

process memory organization, 54, 55f

data declaration and, 123

Wing, Jeannette, 517

Worms, damage potential of, 4

Wraparound, 229231

Wrappers, secure, 496

Writing addresses in two words, 334335

Writing to freed memory

dlmalloc, 195196

RtlHeap, 207208

WU-FTP, format string vulnerability, 319

wu-ftpd vunerability, 348

W^X policy, 113115, 140

X

XD (eXecute Disable) bit, 114

Xfocus, 3

XN (eXecute Never) bit, 114

Y

Yu, Fang, et al., symbolic string verification technique, 306

Z

zzuf tool, 514, 514n

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

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