Sebastián Guerrero - Ke ase Android? [Rooted CON 2013]RootedCON
El objetivo de la charla es la de acercar al usuario al desarrollo de LKM's que amplien la funcionalidad del Kernel, abriendo la posibilidad de tomar el control del dispositivo.
La presentación, se dividirá en dos ramas, por un lado, se mostrará como troyanizar y explotar un teléfono a través de un rootkit, explicando diferentes métodos de obtención de la syscall_table, con el objetivo final de desplegar nuestros módulos infectados.
Por otro lado, se explicará y desguazará la estructura de los ficheros de clases DEX, mostrando cómo ocultar malware dentro de ellos para infectar un terminal desde el desconocimiento del usuario utilizando como soporte vulnerabilidades que afectan a todos los terminales en sus diferentes versiones de Android. Conectando entre sí ambas partes
This document provides an overview of debugging techniques for x64 and x86 architectures, including key differences and commands. It discusses debugging tools in Windows Vista and Windows Server, architectural changes, and answers the top 10 questions on debugging topics such as breakpoints, scripts, pseudo registers, and more. Recommended resources and related training sessions are also provided.
The document provides an overview and tutorial on using the Debug program to debug assembly language programs on DOS and Windows systems. It describes Debug's basic commands for assembling, viewing memory and registers, tracing program execution, and manipulating memory. The commands are grouped into categories for program creation/debugging, memory manipulation, miscellaneous, and input/output. Individual commands like A, D, G, R are explained with examples.
This document summarizes a presentation about attacking the DirectComposition component of the Windows graphics subsystem. It discusses:
1) An overview of DirectComposition and its architecture.
2) Two zero-day vulnerabilities the researchers found - a double free bug and integer overflow bug that were exploited to achieve code execution.
3) Their fuzzing approach and how they increased coverage of important DirectComposition functions.
4) Mitigation techniques Microsoft employed in later versions and ways the researchers bypassed them, such as abusing tagWND and bitmap objects.
The document discusses vulnerabilities and exploits in computer systems. It defines a vulnerability as a weakness that makes a system open to attack, and an exploit as an attack designed to target a known vulnerability. It then classifies vulnerabilities and explores various types of exploits, including stack buffer overflows, heap buffer overflows, format string attacks, and off-by-one errors. Specific examples are provided to illustrate how each type of vulnerability can be exploited to compromise systems or applications.
This document provides an overview of fuzzing techniques and the Sulley fuzzing framework. It begins with definitions of fuzzing and different fuzzing techniques like static testing, randomized fuzzing, and mutation-based fuzzing. The rest of the document demonstrates how to setup and use the Sulley framework to fuzz protocols like HTTP and file formats. It includes explanations of the Sulley API and how to generate test cases, monitor for crashes, and analyze results. Examples are provided of fuzzing HTTP servers and file formats.
Debugging linux kernel tools and techniquesSatpal Parmar
This document discusses tools and techniques for debugging the Linux kernel, including debuggers like gdb, built-in debugging facilities, system logs, and crash dump analysis tools like LKCD. It outlines common issues like kernel crashes and hangs, and provides an example of analyzing an "oops" crash dump to identify the failing line of code through tools like ksymoops. It also covers generating a full system memory dump using LKCD for thorough crash investigation.
Possibility of arbitrary code execution by Step-Oriented Programmingkozossakai
Step-Oriented Programming (SOP) allows executing arbitrary code on embedded systems by repeating step execution and changing the program counter value. A debugger communicates with a target system's stub using the Remote Serial Protocol to read/write memory and registers, enabling full control via simple commands if the connection is compromised. SOP constructs code by combining pieces of existing machine code and executes it without needing to directly inject new code. Therefore attacks are possible even if execution from data areas is prevented. The presentation will demonstrate this attack principle and results from actual experimentation.
The document discusses I/O multiplexing using select and poll functions. It introduces select which allows a process to check if one or more file descriptors are ready for certain I/O conditions (e.g. reading, writing). Select blocks until one of the descriptors satisfies the specified conditions. It also describes how to use select to check read/write readiness of input/output devices and sockets. The document then rewrites an example client program to use select instead of separate system calls, allowing it to simultaneously wait for input from a socket or standard input.
Davide Berardi - Linux hardening and security measures against Memory corruptionlinuxlab_conf
The exploding popularity of Embedded/IoT computing facilitate this security problems using low or non-existent security policies and exploits countermeasures. So why not explore some security measures that are widely available in the Linux world? We will focus on memory corruption techniques.
The Linux kernel was always focused on security features and giving bad times to the exploiters. This talk will introduce some common exploits and techniques, showing the mitigations employed by the kernel. By focusing on the major threats that affects modern Linux boxes, we will see which are the main features that can give problems to the system administator and how a preliminary penetration test can be done, ensuring that the system is in a sane state. The talk will also focus on problematics of embedded/IoT Unix systems, showing how some recent attacks gained control over a big network of devices and how a simple embedded system can be analyzed, hunting for bugs. Talk outline: Penetration testing, Linux, netfilter/bpf, memory corruption, ASLR, Spectre/Meltdown.
Windows persistence presentation made by Oleh Levytskyi (https://twitter.com/LeOleg97) for Lviv Polytechnic National University
The document discusses reverse engineering the firmware of Swisscom's Centro Grande modems. It identifies several vulnerabilities found, including a command overflow issue that allows complete control of the device by exceeding the input buffer, and multiple buffer overflow issues that can be exploited to execute code remotely by crafting specially formatted XML files. Details are provided on the exploitation techniques and timeline of coordination with Swisscom to address the vulnerabilities.
ebpf and IO Visor: The What, how, and what next!Affan Syed
Extended BPF (eBPF) provides a mechanism for running custom programs inside the Linux kernel that can be used for filtering network packets, monitoring system activity, and more. eBPF programs are written in a restricted subset of C and compiled to bytecode that is verified by the kernel for safety before being run. The BCC toolkit makes it easier to write and load eBPF programs. The IO Visor project aims to further develop eBPF and provide tools and use cases for networking, security, and system tracing applications.
The document introduces Program Semantics-Aware Intrusion Detection (PAID), a host-based intrusion prevention system that uses compiler techniques to automatically generate an accurate system call policy for applications. It extracts system call sites, ordering, and arguments from source code to build a finite state automaton for checks. PAID can prevent control hijacking attacks and mimicry attacks by checking system call ordering, sites of entry, and return addresses on the stack. It incurs low performance overhead of around 5% for most applications.
fd0 is the listening socket descriptor
The other descriptors are initialized to -1 to indicate they are unused.
Max is the highest descriptor number currently in use, which is fd0 (the listening socket).
rset is the read file descriptor set for select. It has a 1 bit for fd0 to indicate the listening socket should be checked for connections. All other bits are 0.
Client[] array tracks the client socket descriptors and is initialized to -1.
So initially it is just waiting for a connection on the listening socket fd0.
Penetration Testing and Intrusion Detection SystemBikrant Gautam
This document provides an overview of penetration testing techniques, including forms of cyber attacks like buffer overflows and SQL injection. It discusses using Metasploit and other commercial tools like Canvas to conduct network penetration testing. It also covers post-exploitation techniques such as password cracking, privilege escalation, and data exfiltration. The goal of a penetration test is to simulate a real attack to evaluate system defenses and identify vulnerabilities.
The document discusses transaction-based hardware-software co-verification using emulation. It describes how traditional cycle-based co-verification is slow due to communication overhead between the testbench and emulator. Transaction-based co-verification improves speed by only synchronizing when required and allowing parallel execution. Transactors are used to convert high-level commands from the testbench to a bit-level protocol for the emulator. This allows emulation speeds of tens of MHz, orders of magnitude faster than cycle-based. An example transactor for a virtual memory is presented.
The document discusses porting the Linux kernel to run on the Encore Simputer, an ARM-based handheld device. It describes building the kernel from source, adding support for the Simputer's hardware including memory, display and peripherals. Finally, it mentions porting the 2.6 test kernel to the Simputer and thanks the audience.
TRENDnet IP Camera Multiple Vulnerabilitiesinsight-labs
1. The TRENDnet IP camera models TV-IP422W contains multiple vulnerabilities, including an arbitrary file upload vulnerability that allows attackers to upload malicious files like webshells to the device.
2. The camera stores its configuration file unencrypted except for a simple bitwise NOT and XOR encryption that is easily reversible. This exposes passwords and credentials to attackers.
3. The SecurViewMobile Android app for the camera stores passwords and credentials in plaintext in an insecure manner, allowing extraction from its database.
The document discusses building an embedded Linux system on a Samsung 2410 platform. It covers basic concepts like cross-development environments, developing on a host machine to target embedded devices. It also covers configuring and building the Linux kernel, creating a root filesystem with BusyBox utilities, setting up the boot process, and developing device drivers. The goal is to provide guidance on creating a custom embedded Linux system targeting specific hardware.
LCU14 302- How to port OP-TEE to another platformLinaro
This document describes how to port the open source Trusted Execution Environment (OP-TEE) to a new platform. It involves cloning the existing platform code, modifying compiler and linker options, configuring platform-specific settings, updating memory mappings, and initializing platform-specific components. The document provides details on each of these porting steps and recommends OP-TEE documentation resources.
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...CanSecWest
The document discusses techniques for bypassing Control Flow Guard (CFG) protections on Windows. It begins by introducing the author and their background in security research. It then outlines several potential attack surfaces for bypassing CFG, including using functions like VirtualAlloc and VirtualProtect that can mark memory as valid call targets, writing return addresses, and leveraging indirect calls without CFG checks. The document analyzes six CFG bypass vulnerabilities found by the author in Microsoft Edge and Chakra, and provides details on exploitation methods. It concludes by discussing improvements to harden CFG protections further.
The document summarizes the SSHPro 3.4 software package release notes. It describes how to install the software using the setup.exe file and silent installation commands. It outlines enhancements including improved ping scanning and new XServer startup features. It also details bug fixes to settings refreshing and terminal initialization. Undocumented features are listed such as disabling log output and using wildcard IP addresses for ping scanning.
This document provides VHDL code for implementing various logic gates and basic digital circuits. It includes code for AND, OR, NOT, NAND, NOR, XOR and XNOR gates. It also provides code for half adder, full adder, multiplexer, demultiplexer, decoder, encoder, comparator, BCD to binary converter, JK flip-flop, and an n-bit counter. For each circuit, the VHDL code and a sample waveform output is given. The purpose is to design these basic digital components using VHDL and simulate their behavior.
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru OtsukaCODE BLUE
This document discusses methods for jailbreaking iOS devices by exploiting vulnerabilities to escalate privileges and disable security mitigations. It summarizes 3 key steps:
1) Using CVE-2016-7637 and CVE-2016-7661 to perform privilege escalation to root level access via a man-in-the-middle attack on the com.apple.iohideventsystem port.
2) Using CVE-2016-7644, a use-after-free bug, to gain the kernel task port, allowing control of the kernel.
3) Overwriting ipc_port data structures to fake the kernel task port and obtain full kernel write privileges, bypassing security mechanisms like AMCC
This document discusses buffer overflow attacks. It begins with an overview of the topics that will be covered, including vulnerabilities, exploits, and buffer overflows. It then provides definitions for key terms and describes different types of memory corruption vulnerabilities. The bulk of the document focuses on stack-based buffer overflows, explaining how they work by overwriting the return address on the stack to point to injected shellcode. It includes diagrams of stack layout and function prologue and epilogue. The document concludes with a demonstration of a buffer overflow and discusses some mitigations like stack cookies and ASLR.
Andrea Righi - Spying on the Linux kernel for fun and profitlinuxlab_conf
Do you ever wonder what the kernel is doing while your code is running? This talk will explore some methodologies and techniques (eBPF, ftrace, etc.) to look under the hood of the Linux kernel and understand what it’s actually doing behind the scenes.
This talk explores methodologies that allow to take a look “live” at kernel internal operations, from a network perspective, to I/O paths, CPU usage, memory allocations, etc., using in-kernel technologies, like eBPF and ftrace. Understanding such kernel internals can be really helpful to track down performance bottlenecks, debug system failures and it can be also a very effective way to approach to kernel development.
ironSource's security application expert, Tomer Zait, shares his insights on engineering in the stack. Tomer, an Ort Singalovsky alumnus himself, gave this presentation to the Ort Singalovsky students on their tour of ironSource's headquarters in Tel Aviv.
Want to learn more about ironSource? Visit our website: www.ironsrc.com
Follow us on Twitter @ironSource
ironSource is looking for new talent! Check out our openings: http://bit.ly/Work-at-ironSource
Shellcode is machine code that executes a shell when run. This document discusses shellcode, including:
- Shellcode injects machine code into a vulnerable application to spawn a shell.
- Three examples of shellcode are provided: an exit system call, displaying a message, and spawning a shell.
- Registers, assembly instructions, and system calls used in Linux are explained for creating shellcode.
The document discusses I/O multiplexing using select and poll functions. It introduces select which allows a process to check if one or more file descriptors are ready for certain I/O conditions (e.g. reading, writing). Select blocks until one of the descriptors satisfies the specified conditions. It also describes how to use select to check read/write readiness of input/output devices and sockets. The document then rewrites an example client program to use select instead of separate system calls, allowing it to simultaneously wait for input from a socket or standard input.
Davide Berardi - Linux hardening and security measures against Memory corruptionlinuxlab_conf
The exploding popularity of Embedded/IoT computing facilitate this security problems using low or non-existent security policies and exploits countermeasures. So why not explore some security measures that are widely available in the Linux world? We will focus on memory corruption techniques.
The Linux kernel was always focused on security features and giving bad times to the exploiters. This talk will introduce some common exploits and techniques, showing the mitigations employed by the kernel. By focusing on the major threats that affects modern Linux boxes, we will see which are the main features that can give problems to the system administator and how a preliminary penetration test can be done, ensuring that the system is in a sane state. The talk will also focus on problematics of embedded/IoT Unix systems, showing how some recent attacks gained control over a big network of devices and how a simple embedded system can be analyzed, hunting for bugs. Talk outline: Penetration testing, Linux, netfilter/bpf, memory corruption, ASLR, Spectre/Meltdown.
Windows persistence presentation made by Oleh Levytskyi (https://twitter.com/LeOleg97) for Lviv Polytechnic National University
The document discusses reverse engineering the firmware of Swisscom's Centro Grande modems. It identifies several vulnerabilities found, including a command overflow issue that allows complete control of the device by exceeding the input buffer, and multiple buffer overflow issues that can be exploited to execute code remotely by crafting specially formatted XML files. Details are provided on the exploitation techniques and timeline of coordination with Swisscom to address the vulnerabilities.
ebpf and IO Visor: The What, how, and what next!Affan Syed
Extended BPF (eBPF) provides a mechanism for running custom programs inside the Linux kernel that can be used for filtering network packets, monitoring system activity, and more. eBPF programs are written in a restricted subset of C and compiled to bytecode that is verified by the kernel for safety before being run. The BCC toolkit makes it easier to write and load eBPF programs. The IO Visor project aims to further develop eBPF and provide tools and use cases for networking, security, and system tracing applications.
The document introduces Program Semantics-Aware Intrusion Detection (PAID), a host-based intrusion prevention system that uses compiler techniques to automatically generate an accurate system call policy for applications. It extracts system call sites, ordering, and arguments from source code to build a finite state automaton for checks. PAID can prevent control hijacking attacks and mimicry attacks by checking system call ordering, sites of entry, and return addresses on the stack. It incurs low performance overhead of around 5% for most applications.
fd0 is the listening socket descriptor
The other descriptors are initialized to -1 to indicate they are unused.
Max is the highest descriptor number currently in use, which is fd0 (the listening socket).
rset is the read file descriptor set for select. It has a 1 bit for fd0 to indicate the listening socket should be checked for connections. All other bits are 0.
Client[] array tracks the client socket descriptors and is initialized to -1.
So initially it is just waiting for a connection on the listening socket fd0.
Penetration Testing and Intrusion Detection SystemBikrant Gautam
This document provides an overview of penetration testing techniques, including forms of cyber attacks like buffer overflows and SQL injection. It discusses using Metasploit and other commercial tools like Canvas to conduct network penetration testing. It also covers post-exploitation techniques such as password cracking, privilege escalation, and data exfiltration. The goal of a penetration test is to simulate a real attack to evaluate system defenses and identify vulnerabilities.
The document discusses transaction-based hardware-software co-verification using emulation. It describes how traditional cycle-based co-verification is slow due to communication overhead between the testbench and emulator. Transaction-based co-verification improves speed by only synchronizing when required and allowing parallel execution. Transactors are used to convert high-level commands from the testbench to a bit-level protocol for the emulator. This allows emulation speeds of tens of MHz, orders of magnitude faster than cycle-based. An example transactor for a virtual memory is presented.
The document discusses porting the Linux kernel to run on the Encore Simputer, an ARM-based handheld device. It describes building the kernel from source, adding support for the Simputer's hardware including memory, display and peripherals. Finally, it mentions porting the 2.6 test kernel to the Simputer and thanks the audience.
TRENDnet IP Camera Multiple Vulnerabilitiesinsight-labs
1. The TRENDnet IP camera models TV-IP422W contains multiple vulnerabilities, including an arbitrary file upload vulnerability that allows attackers to upload malicious files like webshells to the device.
2. The camera stores its configuration file unencrypted except for a simple bitwise NOT and XOR encryption that is easily reversible. This exposes passwords and credentials to attackers.
3. The SecurViewMobile Android app for the camera stores passwords and credentials in plaintext in an insecure manner, allowing extraction from its database.
The document discusses building an embedded Linux system on a Samsung 2410 platform. It covers basic concepts like cross-development environments, developing on a host machine to target embedded devices. It also covers configuring and building the Linux kernel, creating a root filesystem with BusyBox utilities, setting up the boot process, and developing device drivers. The goal is to provide guidance on creating a custom embedded Linux system targeting specific hardware.
LCU14 302- How to port OP-TEE to another platformLinaro
This document describes how to port the open source Trusted Execution Environment (OP-TEE) to a new platform. It involves cloning the existing platform code, modifying compiler and linker options, configuring platform-specific settings, updating memory mappings, and initializing platform-specific components. The document provides details on each of these porting steps and recommends OP-TEE documentation resources.
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...CanSecWest
The document discusses techniques for bypassing Control Flow Guard (CFG) protections on Windows. It begins by introducing the author and their background in security research. It then outlines several potential attack surfaces for bypassing CFG, including using functions like VirtualAlloc and VirtualProtect that can mark memory as valid call targets, writing return addresses, and leveraging indirect calls without CFG checks. The document analyzes six CFG bypass vulnerabilities found by the author in Microsoft Edge and Chakra, and provides details on exploitation methods. It concludes by discussing improvements to harden CFG protections further.
The document summarizes the SSHPro 3.4 software package release notes. It describes how to install the software using the setup.exe file and silent installation commands. It outlines enhancements including improved ping scanning and new XServer startup features. It also details bug fixes to settings refreshing and terminal initialization. Undocumented features are listed such as disabling log output and using wildcard IP addresses for ping scanning.
This document provides VHDL code for implementing various logic gates and basic digital circuits. It includes code for AND, OR, NOT, NAND, NOR, XOR and XNOR gates. It also provides code for half adder, full adder, multiplexer, demultiplexer, decoder, encoder, comparator, BCD to binary converter, JK flip-flop, and an n-bit counter. For each circuit, the VHDL code and a sample waveform output is given. The purpose is to design these basic digital components using VHDL and simulate their behavior.
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru OtsukaCODE BLUE
This document discusses methods for jailbreaking iOS devices by exploiting vulnerabilities to escalate privileges and disable security mitigations. It summarizes 3 key steps:
1) Using CVE-2016-7637 and CVE-2016-7661 to perform privilege escalation to root level access via a man-in-the-middle attack on the com.apple.iohideventsystem port.
2) Using CVE-2016-7644, a use-after-free bug, to gain the kernel task port, allowing control of the kernel.
3) Overwriting ipc_port data structures to fake the kernel task port and obtain full kernel write privileges, bypassing security mechanisms like AMCC
This document discusses buffer overflow attacks. It begins with an overview of the topics that will be covered, including vulnerabilities, exploits, and buffer overflows. It then provides definitions for key terms and describes different types of memory corruption vulnerabilities. The bulk of the document focuses on stack-based buffer overflows, explaining how they work by overwriting the return address on the stack to point to injected shellcode. It includes diagrams of stack layout and function prologue and epilogue. The document concludes with a demonstration of a buffer overflow and discusses some mitigations like stack cookies and ASLR.
Andrea Righi - Spying on the Linux kernel for fun and profitlinuxlab_conf
Do you ever wonder what the kernel is doing while your code is running? This talk will explore some methodologies and techniques (eBPF, ftrace, etc.) to look under the hood of the Linux kernel and understand what it’s actually doing behind the scenes.
This talk explores methodologies that allow to take a look “live” at kernel internal operations, from a network perspective, to I/O paths, CPU usage, memory allocations, etc., using in-kernel technologies, like eBPF and ftrace. Understanding such kernel internals can be really helpful to track down performance bottlenecks, debug system failures and it can be also a very effective way to approach to kernel development.
ironSource's security application expert, Tomer Zait, shares his insights on engineering in the stack. Tomer, an Ort Singalovsky alumnus himself, gave this presentation to the Ort Singalovsky students on their tour of ironSource's headquarters in Tel Aviv.
Want to learn more about ironSource? Visit our website: www.ironsrc.com
Follow us on Twitter @ironSource
ironSource is looking for new talent! Check out our openings: http://bit.ly/Work-at-ironSource
Shellcode is machine code that executes a shell when run. This document discusses shellcode, including:
- Shellcode injects machine code into a vulnerable application to spawn a shell.
- Three examples of shellcode are provided: an exit system call, displaying a message, and spawning a shell.
- Registers, assembly instructions, and system calls used in Linux are explained for creating shellcode.
The document provides an introduction to exploit development. It discusses preparing a virtual lab with tools like Immunity Debugger, Mona.py, pvefindaddr.py and Metasploit. It covers basic buffer overflow exploitation techniques like overwriting EIP and using RETURN oriented programming. The document demonstrates a basic stack-based buffer overflow exploit against the FreeFloat FTP server as a tutorial, covering steps like generating a cyclic pattern, finding the offset and using mona to find a JMP ESP instruction to redirect execution. It also discusses using msfpayload to generate Windows bind shellcode and msfencode to escape bad characters before testing the proof of concept exploit.
The document discusses exploiting a buffer overflow vulnerability in Internet Explorer's VML implementation (MS06-055) to execute arbitrary code. It describes overwriting the structured exception handler to gain control of the instruction pointer, using heap spraying to load a buffer in memory, and having the instruction pointer jump to the buffer to execute shellcode and spawn a command shell. Metasploit is introduced as an open-source framework for developing exploits.
This document provides an overview of WebAssembly (WASM) and analyzes its attack surface. It begins with a brief history of WASM and describes its Minimum Viable Product (MVP) 1.0 specification, which defines its instruction set and file format. It then discusses WASM's implementation in web browsers and interaction with JavaScript, highlighting its potential attack surface. Examples of past vulnerabilities leveraging WASM are also provided, such as CVE-2017-5116 which used a race condition to redirect execution to attacker-controlled code. The document concludes by discussing the future of WASM and taking questions.
You're Off the Hook: Blinding Security SoftwareCylance
User-mode hooking is dead. It’s also considered harmful due to interference with OS-level exploit mitigations like Control Flow Guard (CFG). At BlackHat US 2016, the “Captain Hook” talk revealed there were multiple serious security issues in AV hooking — we will put the final nail in the coffin by showing how trivial it is to bypass user-mode hooks. We will demonstrate a universal user-mode unhooking approach that can be included in any binary to blind security software from monitoring code execution and perform heuristic analysis. The tool and source code will be released on GitHub after the talk.
Alex Matrosov | Principal Research Scientist
Jeff Tang | Senior Security Researcher
Chapter 1
Syllabus
Catalog Description: Computer structure, machine representation of data,
addressing and indexing, computation and control instructions, assembly
language and assemblers; procedures (subroutines) and data segments,
linkages and subroutine calling conventions, loaders; practical use of an
assembly language for computer implementation of illustrative examples.
Course Goals
0 Knowledge of the basic structure of microcomputers - registers, mem-
ory, addressing I/O devices, etc.
1 Knowledge of most non-privileged hardware instructions for the Ar-
chitecture being studied.
2 Ability to write small programs in assembly language
3 Knowledge of computer representations of data, and how to do simple
arithmetic in binary & hexadecimal, including conversions
4 Being able to implementing a moderately complicated algorithm in
assembler, with emphasis on efficiency.
5 Knowledge of procedure calling conventions and interfacing with high-
level languages.
Optional Text: Kip Irvine, Assembly Language for the IBM PC, Prentice
Hall, 4th or 5th edition
1
Additional References: Intel and DOS API documentation as presented
in Intel publications and online at www.x86.org; lecture notes (to be sup-
plied as we go).
Prerequisites by Topic. Working knowledge of some programming lan-
guage (102/103: C/C++); Minimal programming experience
Major Topics Covered in the Course:
1 Low-level and high-level languages; why learn assembler?
2 How does one study a new computer: the CPU, memory, addressing
modes, operation modes.
3 History of the Intel family of microprocessors.
4-5 Registers; simple arithmetic instructions; byte order; Arithmetic and
logical operations.
6 Implementing longer integer type support; carry and overflow.
7 Shifts, multiplication and division.
8 Memory layout.
9 Direct video memory access; discussion of the first project.
10 Assembler syntax; how to use the tools.
11-13 Conditional & unconditional jumps; loops; emulating high-level lan-
guage constructions; Stack; call and return; procedures
14-15 String instructions: effcient memory-to-memory operations.
16 Interrupts overview: interrupt table; how do interrupts work; classif-
cation.
17 Summary of the most important interrupts.
18-20 DOS interrupt; File I/O functions; file-copy program; discussion of
the second project
21 Interrupt handlers; keyboard drivers; timer-driven processes; viruses
and virus-protection software.
2
22 Debug interrupts; how do debuggers and profilers work.
23-24 (Optional).interfacing with high level languages; Protected mode fun-
damentals
Grading The grading is based on two projects, midterm project is 49%
and the final is 51%. Please note that the projects are individual, submitting
projects that are similar to submissions of others and/or are essentially
downloads from the Web would result in a fail.
Office Hours My hours this term for CSc 210 will be 3:45 ¶Ł 4:45 on
Mondays.
Zoom links:
11am https://ccny.zoom.us/j/8 ...
This document discusses stack-based buffer overflows, including:
- How they occur when a program writes outside a fixed-length buffer, potentially corrupting data or code.
- Their history and use in attacks like the 2001 Code Red worm.
- Technical details like how the stack and registers work.
- Career opportunities in security analysis and development to prevent and respond to such vulnerabilities.
- The ethical responsibilities of developers to write secure code and disclose vulnerabilities responsibly.
This document discusses various low-level exploits, beginning with creating shellcode by extracting opcodes from a compiled C program. It then covers stack-based buffer overflows, including return-to-stack exploits and return-to-libc. Next it discusses heap overflows using the unlink technique, integer overflows, and format string vulnerabilities. The document provides code examples and explanations of the techniques.
Smash the Stack: Writing a Buffer Overflow Exploit (Win32)Elvin Gentiles
This document provides an overview of buffer overflow exploits on Windows 32-bit systems. It discusses the lab environment that will be used, basic assembly concepts like registers and instructions, the Windows 32 memory layout, how the stack works, and the general steps for exploit development. These include causing a crash, identifying the offset, determining bad characters, locating space for shellcode, generating shellcode, and redirecting execution to the shellcode. The document concludes by listing some hands-on exercises that will be covered, and recommending additional learning materials on exploit writing.
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹GangSeok Lee
This document contains information about various techniques for hooking functions in the Windows kernel, including kernel hooks, SSDT hooking, IDT hooking, one-byte hooking, and blind hooking using debug registers. It discusses the motivations, concepts, and demonstrations of each technique. The document also contains information on kernel structures like EPROCESS, ETHREAD, KPCR, TEB, and PEB. It provides code samples and explanations for techniques like modifying the SSDT, hooking interrupts, and using debug registers to dynamically hook functions without directly patching memory or tables.
The document discusses various techniques for deception and bypassing security checks, including:
1) Using iptables and the TARPIT and DELUDE targets to deceive port scanners by simulating open ports or terminating connections.
2) Writing x64 shellcode and understanding differences from x86 in CPU registers and the kernel ABI.
3) Performing DL-injection attacks by injecting a dynamic library to override functions like getuid() and bypass authentication.
4) Demonstrating process hijacking using ptrace() to inject shellcode and escalate privileges.
5) Mounting a local privilege escalation attack after gaining initial user access.
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...Toradex
Read our blog for the latest on demystifying the development of embedded systems using Heterogeneous Multicore Processing architecture powered SoCs! This might provide you with the jump start you need for your development. https://www.toradex.com/blog/first-steps-developing-embedded-applications-using-heterogeneous-multicore-processors
Swug July 2010 - windows debugging by sainathDennis Chung
The document provides an overview of basic debugging terms and tools like process, thread, registers, exceptions, memory dumps, and AdPlus. It discusses setting up a debugger, understanding assembly code, using important CPU registers and variables, reading memory types, and examining stacks. The document also asks questions to check understanding of debugging concepts.
This document discusses software vulnerabilities and exploits. It begins with an introduction to remote code execution and provides legal aspects of data interception for Germany and Switzerland. It then discusses the goals of preventing teaching how to write malware or hack systems illegally. The document covers basics of function calls, stack smashing vulnerabilities, and how to redirect program flow to injected shellcode through buffer overflows. It provides examples of finding vulnerabilities using debuggers and generating exploits in Python to execute shellcode by overwriting return addresses. Methods discussed include placing shellcode in registers or on the stack and dealing with gaps between the stack pointer and shellcode.
Finding Xori: Malware Analysis Triage with Automated DisassemblyPriyanka Aash
"In a world of high volume malware and limited researchers we need a dramatic improvement in our ability to process and analyze new and old malware at scale. Unfortunately what is currently available to the community is incredibly cost prohibitive or does not rise to the challenge. As malware authors and distributors share code and prepackaged tool kits, the corporate sponsored research community is dominated by solutions aimed at profit as opposed to augmenting capabilities available to the broader community. With that in mind, we are introducing our library for malware disassembly called Xori as an open source project. Xori is focused on helping reverse engineers analyze binaries, optimizing for time and effort spent per sample.
Xori is an automation-ready disassembly and static analysis library that consumes shellcode or PE binaries and provides triage analysis data. This Rust library emulates the stack, register states, and reference tables to identify suspicious functionality for manual analysis. Xori extracts structured data from binaries to use in machine learning and data science pipelines.
We will go over the pain-points of conventional open source disassemblers that Xori solves, examples of identifying suspicious functionality, and some of the interesting things we've done with the library. We invite everyone in the community to use it, help contribute and make it an increasingly valuable tool for researchers alike."
AAME ARM Techcon2013 003v02 Software DevelopmentAnh Dung NGUYEN
This document provides an overview of the Keil MDK development tools and environment for software development on ARM Cortex-M microcontrollers. It describes the μVision IDE, ARM compiler, debugger and other tools. It discusses the embedded development process, including considerations when moving from a development environment to a standalone application such as memory maps, application startup, and C library usage. It also covers optimization levels, language support, variable types, and default memory maps and C libraries provided by the tools.
Shellcode Disassembling - Reverse EngineeringSumutiu Marius
This document provides a basic guide to reverse engineering Linux x86 shellcode. It summarizes reversing two sample shellcodes: 1) A simple shellcode that reads the /etc/passwd file, and 2) An XOR encrypted shellcode that launches a new ksh shell with root privileges. It explains breaking down the shellcode using a debugger to understand what it is doing by examining registers, system calls and related functions. The goal is to understand how the shellcode works rather than just trusting its described purpose.
The document summarizes a presentation given by Tomer Teller about the Stuxnet malware. It describes how Stuxnet infected industrial control systems by exploiting Windows vulnerabilities, spreading on removable drives, and ultimately reprogramming PLCs to sabotage Iran's nuclear program. Key infection techniques discussed include exploiting LNK and Print Spooler vulnerabilities, using autorun.inf files and rootkit techniques to propagate, and replacing DLL files to monitor and inject commands to PLCs.
There’s two things I really like: Capture the flag competitions and Python.
Fortunately, I have found out that there are challenges that combine both.
In my session I will talk about challenges from 3 different CTF competitions and about the upgraded challenges I wrote from PwCTF.
I will explain the difficulties of creating Python Sandbox and I will show the security issues in the wild.
Things you will learn from my session:
* Why Python Sandbox is a bad idea
* How to exploit Python Sandbox using knowledge of Python language to execute code remotely
* Why it’s hard to protect Python from code execution using Web Application Firewall
* At the end of the session you will get 3 pySandbox challenges to solve in order to check your abilities
The evolution of credential hijacking
The login interfaces haven’t changed much over the years, at least not on the client side. many companies have been breached including some well-known ones like myspace, dropbox and linkedin. Brute-force attacks have improved, both through statistics and by manipulating & bypassing the defense systems implemented. This talk will present the various attacks, the logic behind them, the possible results of these attacks and conclude with some tools and ideas to mitigate them
* Presented in "Geektime Code Elevation"
https://techfest.geektime.co.il/code/
This document discusses a tool that can be used to test credentials from data breaches against various websites and applications. The tool operates in a proxy mode and can take leaked username and password combinations to attempt logins on target apps and services. It reports back success rates and breached organizations identified to help evaluate potential impact and risk.
PyMultitor – Bypass restrictions based on IP counters like a Boss
PyMultitor enables to perform multiple web requests from multiple IP addresses by using TOR network. Adding an ability of this sort to some of the most common attacks often makes them leathal and unstoppable.
Why? Is this limited to TOR? How can we stay safe?
We will talk about edge cases we don't usually think about, show examples from the real world, and share some tips and best practices on how to make your code safer in the real world.
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Eric D. Schabell
It's time you stopped letting your telemetry data pressure your budgets and get in the way of solving issues with agility! No more I say! Take back control of your telemetry data as we guide you through the open source project Fluent Bit. Learn how to manage your telemetry data from source to destination using the pipeline phases covering collection, parsing, aggregation, transformation, and forwarding from any source to any destination. Buckle up for a fun ride as you learn by exploring how telemetry pipelines work, how to set up your first pipeline, and exploring several common use cases that Fluent Bit helps solve. All this backed by a self-paced, hands-on workshop that attendees can pursue at home after this session (https://o11y-workshops.gitlab.io/workshop-fluentbit).
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >Ranking Google
Copy & Paste on Google to Download ➤ ► 👉 https://techblogs.cc/dl/ 👈
Internet Download Manager (IDM) is a tool to increase download speeds by up to 10 times, resume or schedule downloads and download streaming videos.
Cryptocurrency Exchange Script like Binance.pptxriyageorge2024
This SlideShare dives into the process of developing a crypto exchange platform like Binance, one of the world’s largest and most successful cryptocurrency exchanges.
Adobe Media Encoder Crack FREE Download 2025zafranwaqar90
🌍📱👉COPY LINK & PASTE ON GOOGLE https://dr-kain-geera.info/👈🌍
Adobe Media Encoder is a transcoding and rendering application that is used for converting media files between different formats and for compressing video files. It works in conjunction with other Adobe applications like Premiere Pro, After Effects, and Audition.
Here's a more detailed explanation:
Transcoding and Rendering:
Media Encoder allows you to convert video and audio files from one format to another (e.g., MP4 to WAV). It also renders projects, which is the process of producing the final video file.
Standalone and Integrated:
While it can be used as a standalone application, Media Encoder is often used in conjunction with other Adobe Creative Cloud applications for tasks like exporting projects, creating proxies, and ingesting media, says a Reddit thread.
AI in Business Software: Smarter Systems or Hidden Risks?Amara Nielson
AI in Business Software: Smarter Systems or Hidden Risks?
Description:
This presentation explores how Artificial Intelligence (AI) is transforming business software across CRM, HR, accounting, marketing, and customer support. Learn how AI works behind the scenes, where it’s being used, and how it helps automate tasks, save time, and improve decision-making.
We also address common concerns like job loss, data privacy, and AI bias—separating myth from reality. With real-world examples like Salesforce, FreshBooks, and BambooHR, this deck is perfect for professionals, students, and business leaders who want to understand AI without technical jargon.
✅ Topics Covered:
What is AI and how it works
AI in CRM, HR, finance, support & marketing tools
Common fears about AI
Myths vs. facts
Is AI really safe?
Pros, cons & future trends
Business tips for responsible AI adoption
Launch your own super app like Gojek and offer multiple services such as ride booking, food & grocery delivery, and home services, through a single platform. This presentation explains how our readymade, easy-to-customize solution helps businesses save time, reduce costs, and enter the market quickly. With support for Android, iOS, and web, this app is built to scale as your business grows.
Digital Twins Software Service in Belfastjulia smits
Rootfacts is a cutting-edge technology firm based in Belfast, Ireland, specializing in high-impact software solutions for the automotive sector. We bring digital intelligence into engineering through advanced Digital Twins Software Services, enabling companies to design, simulate, monitor, and evolve complex products in real time.
Trawex, one of the leading travel portal development companies that can help you set up the right presence of webpage. GDS providers used to control a higher part of the distribution publicizes, yet aircraft have placed assets into their very own prompt arrangements channels to bypass this. Nevertheless, it's still - and will likely continue to be - important for a distribution. This exhaustive and complex amazingly dependable, and generally low costs set of systems gives the travel, the travel industry and hospitality ventures with a very powerful and productive system for processing sales transactions, managing inventory and interfacing with revenue management systems. For more details, Pls visit our website: https://www.trawex.com/gds-system.php
Top 12 Most Useful AngularJS Development Tools to Use in 2025GrapesTech Solutions
AngularJS remains a popular JavaScript-based front-end framework that continues to power dynamic web applications even in 2025. Despite the rise of newer frameworks, AngularJS has maintained a solid community base and extensive use, especially in legacy systems and scalable enterprise applications. To make the most of its capabilities, developers rely on a range of AngularJS development tools that simplify coding, debugging, testing, and performance optimization.
If you’re working on AngularJS projects or offering AngularJS development services, equipping yourself with the right tools can drastically improve your development speed and code quality. Let’s explore the top 12 AngularJS tools you should know in 2025.
Read detail: https://www.grapestechsolutions.com/blog/12-angularjs-development-tools/
How to avoid IT Asset Management mistakes during implementation_PDF.pdfvictordsane
IT Asset Management (ITAM) is no longer optional. It is a necessity.
Organizations, from mid-sized firms to global enterprises, rely on effective ITAM to track, manage, and optimize the hardware and software assets that power their operations.
Yet, during the implementation phase, many fall into costly traps that could have been avoided with foresight and planning.
Avoiding mistakes during ITAM implementation is not just a best practice, it’s mission critical.
Implementing ITAM is like laying a foundation. If your structure is misaligned from the start—poor asset data, inconsistent categorization, or missing lifecycle policies—the problems will snowball.
Minor oversights today become major inefficiencies tomorrow, leading to lost assets, licensing penalties, security vulnerabilities, and unnecessary spend.
Talk to our team of Microsoft licensing and cloud experts to look critically at some mistakes to avoid when implementing ITAM and how we can guide you put in place best practices to your advantage.
Remember there is savings to be made with your IT spending and non-compliance fines to avoid.
Send us an email via [email protected]
Maximizing ROI with Odoo Staff Augmentation A Smarter Way to ScaleSatishKumar2651
Discover how Odoo Staff Augmentation can help your business achieve faster ERP implementation, reduced project costs, and a significantly higher return on investment (ROI). In this presentation, we dive deep into the challenges of in-house ERP resource management and showcase a clear, data-backed comparison between traditional hiring and on-demand Odoo staff augmentation.
Whether you're a startup scaling quickly or an enterprise optimizing your ERP workflows, this SlideShare provides valuable insights into:
✅ What is Odoo Staff Augmentation
✅ Key business benefits of augmenting your Odoo team
✅ ROI framework with real-world metrics
✅ Visual cost vs. value comparison
✅ Case study from a successful Odoo implementation
✅ When and why to consider staff augmentation
✅ Engagement models that work for businesses of all sizes
This presentation is ideal for CTOs, project managers, ERP leads, and decision-makers evaluating cost-effective strategies to enhance their Odoo ERP journey.
Download Link 👇
https://techblogs.cc/dl/
Autodesk Inventor includes powerful modeling tools, multi-CAD translation capabilities, and industry-standard DWG drawings. Helping you reduce development costs, market faster, and make great products.
WinRAR Crack for Windows (100% Working 2025)sh607827
copy and past on google ➤ ➤➤ https://hdlicense.org/ddl/
WinRAR Crack Free Download is a powerful archive manager that provides full support for RAR and ZIP archives and decompresses CAB, ARJ, LZH, TAR, GZ, ACE, UUE, .
Robotic Process Automation (RPA) Software Development Services.pptxjulia smits
Rootfacts delivers robust Infotainment Systems Development Services tailored to OEMs and Tier-1 suppliers.
Our development strategy is rooted in smarter design and manufacturing solutions, ensuring function-rich, user-friendly systems that meet today’s digital mobility standards.
2. root@kali:~# whoami
ironSourceTomer Zait
• Application Security Engineer at
• Practical Software Engineer (Ort Singalovsky)
• Offensive Security Certified Professional (OSCP)
• OpenSource Projects:
o PyMultitor
o HackMe Credit
o AutoBrowser
o SubDomain Analyzer
o Proxist
• 1st Place at The Israel Cyber Challenge, 2014
3. Today we will focus on:
• Past Events
• What Is Stack
• Assembly – Registers
• Stack Overflow
• Shell Code
• Exploit Development
5. • Exploits a buffer overflow vulnerability in Microsoft DCOM RPC interface.
• Worm downloads a copy of mblast.exe to compromised host from infecting host via TFTP
and runs commands to execute it.
• mblast.exe attempts to carry out SYN flood attack on windowsupdate.com as well as
scanning/infecting other hosts.
BLASTER WORM
Hex dump of the Blaster worm
6. • DOS attack on windowsupdate.com failed - the regular domain name is
windowsupdate.microsoft.com.
• Windowsupdate.com was just a pointer to the windowsupdate.microsoft.com - so
Microsoft just decomissioned it.
BLASTER WORM - EFFECTS
7. • August 11, 2003: Original version of the worm appears on the internet.
• August 12, 2003: The number of infected systems is reported at 30,000.
• August 15, 2003:The number of infected systems is reported at 423,000.
• August 16, 2003: DDoS attack against windowsupdate.com starts.
(Largely unsuccessful because that url is merely a redirect to the real site,
windowsupdate.microsoft.com)
• January 28, 2005: The creator of the "B" variant of MSBlaster is sentenced to 18 months in
jail.
BLASTER WORM - TIMELINE
8. • Exploits a buffer overflow vulnerability in Microsoft NET BIOS interface (MS08-067).
• Dictionary attack on ADMIN$ shares.
• Creates DLL-based AutoRun trojan on attached removable drives.
• Downloads daily from any of 250 pseudorandom domains over 5 TLDs (Top-level domains).
• Updates self to Conficker B, C or D.
CONFICKER WORM
9. • Account lockout policies being reset automatically.
• Certain Microsoft Windows services such as Automatic Updates, Background Intelligent
Transfer Service (BITS), Windows Defender and Windows Error Reporting disabled.
• Domain controllers responding slowly to client requests.
• Congestion on local area networks (ARP flood as consequence of network scan).
• Web sites related to antivirus software or the Windows Update service becoming
inaccessible
CONFICKER WORM - EFFECTS
10. • Discovered in early November 2008.
• The French Navy computer network, was infected with Conficker on 15 January 2009.
• An infection of Manchester City Council's IT system caused an estimated £1.5m worth of
disruption in February 2009.
• The estimated number of infected computers ranged from almost 9 million to 15 million.
• Microsoft has reported the total number of infected computers detected by its
antimalware products has remained steady at around 1.7 million from mid-2010 to mid-
2011.
CONFICKER WORM - TIMELINE
12. It's a special region of your computer's memory that stores temporary variables created by
each function (including the main() function),
The stack is a “LIFO” (last in , first out) data structure.
Principal operations:
• push adds an element to the collection.
• pop removes the last element that was added.
• Stack Real Life example is weapon's magazine
STACK - EXPLANATION
14. On today’s average WinTel CPU you have 9 32bit registers (w/o flag registers).
Their names are:
EAX: Extended Accumulator Register
EBX: Extended Base Register
ECX: Extended Counter Register
EDX: Extended Data Register
ESI: Extended Source Index
EDI: Extended Destination Index
EBP: Extended Base Pointer
ESP: Extended Stack Pointer
EIP: Extended Instruction Pointer
CPU REGISTERS
15. The ESP register serves as an indirect memory operand pointing to the top of the stack at any
time.
WORD takes 2 bytes In memory.
• When a word value is pushed onto the stack, the assembler decreases the ESP (Stack
Pointer) register by 2.
• When a word value is popped off the stack, the assembler increases the ESP register by 2.
ESP REGISTER
16. The instruction pointer register points to the memory addresswhich the processor will next
attempt to execute.
it cannot be directly accessed in 16-bit or 32-bit mode,
but a sequence like the following can be written to put the address of next_line into eax:
call next_line
next_line:
pop eax
This sequence of instructions generates position-independent code because call takes an
instruction-pointer-relative immediate operand describing the offset in bytes of the target
instruction from the next instruction (in this case 0).
EIP REGISTER
18. A stack overflow is an undesirable condition in which a particular computer program tries to
use more memory space than the call stack has available.
In programming, the call stack is a buffer that stores requests that need to be handled.
The size of a call stack depends on various factors.
It is usually defined at the start of a program.
Its size can depend on the architecture of the computer on which the program runs,
the language in which the program is written,
and the total amount of available memory in the system.
When a stack overflow occurs as a result of a program's excessive demand for memory space,
that program (and sometimes the entire computer) may crash.
STACK OVERFLOW - EXPLANATION
20. # Metasploit generated – write.exe – x86 – Windows XP Pro SP2
shellcode="x68x97x4Cx80x7CxB8x4Dx11x86x7CxFFxD0”;
Let’s disassemble these bytes into instructions :
You don’t need to run this code to figure out what it will do.
SHELLCODE - WINDOWS XP PRO SP2 32BIT (1)
C:shellcode>"c:program filesnasmndisasm.exe" -b 32 c:tmpshellcode.bin
00000000 68974C807C push dword 0x7c804c97
00000005 B84D11867C mov eax,0x7c86114d
0000000A FFD0 call eax
21. If the exploit is indeed written for Windows XP Pro SP2 then this will happen:
at 0x7c804c97 on XP SP2, we find (windbg output) :
So push dword 0x7c804c97 will push “Write” onto the stack.
SHELLCODE - WINDOWS XP PRO SP2 32BIT (2)
0:001> d 0x7c804c97
7c804c97 57 72 69 74 65 00 42 61-73 65 43 68 65 63 6b 41 Write.BaseCheckA
7c804ca7 70 70 63 6f 6d 70 61 74-43 61 63 68 65 00 42 61 ppcompatCache.Ba
7c804cb7 73 65 43 6c 65 61 6e 75-70 41 70 70 63 6f 6d 70 seCleanupAppcomp
7c804cc7 61 74 43 61 63 68 65 00-42 61 73 65 43 6c 65 61 atCache.BaseClea
7c804cd7 6e 75 70 41 70 70 63 6f-6d 70 61 74 43 61 63 68 nupAppcompatCach
7c804ce7 65 53 75 70 70 6f 72 74-00 42 61 73 65 44 75 6d eSupport.BaseDum
7c804cf7 70 41 70 70 63 6f 6d 70-61 74 43 61 63 68 65 00 pAppcompatCache.
7c804d07 42 61 73 65 46 6c 75 73-68 41 70 70 63 6f 6d 70 BaseFlushAppcomp
22. Next, 0x7c86114d is moved into eax and a call eax is made.
At 0x7c86114d, we find :
Conclusion : this code will execute “write” (=wordpad).
SHELLCODE - WINDOWS XP PRO SP2 32BIT (3)
0:001> ln 0x7c86114d
(7c86114d) kernel32!WinExec | (7c86123c) kernel32!`string'
Exact matches:
kernel32!WinExec =
23. SHELLCODE TEST - WINDOWS XP PRO SP2 32BIT
char code[] = "x68x97x4Cx80x7CxB8x4Dx11x86x7CxFFxD0";
int main(int argc, char **argv) {
int (*func)();
func = (int (*)()) code;
(int)(*func)();
}
25. VULNERABLE CODE - EXAMPLE
#include <string.h>
void foo (char *bar) {
char c[12];
strcpy(c, bar); // no bounds checking
}
int main (int argc, char **argv) {
foo(argv[1]);
}
27. VULNERABLE CODE - EXPLOTION
This code takes an argument from the command line and copies it to a local stack variable c.
This works fine for command line arguments smaller than 12 characters (as you can see in
figure B below).
Any arguments larger than 11 characters long will result in corruption of the stack.
(The maximum number of characters that is safe is one less than the size of the buffer here
because in the C programming language strings are terminated by a zero byte character.
A twelve-character input thus requires thirteen bytes to store, the input followed by the
sentinel zero byte. The zero byte then ends up overwriting a memory location that's one byte
beyond the end of the buffer.)
28. THE PROGRAM STACK IN foo() WITH VARIOUS INPUTS (1)
A. - Before data is copied.
29. THE PROGRAM STACK IN foo() WITH VARIOUS INPUTS (2)
B. - "hello" is the first
command line argument.
30. THE PROGRAM STACK IN foo() WITH VARIOUS INPUTS (3)
A. - Before data is copied.
31. VULNERABLE CODE - SUMMARY
Notice in figure C above, when an argument larger than 11 bytes is supplied on the command
line foo() overwrites local stack data, the saved frame pointer, and most importantly,
the return address. When foo() returns it pops the return address off the stack and jumps to
that address (i.e. starts executing instructions from that address).
Thus, the attacker has overwritten the return address with a pointer to the stack buffer char
c[12], which now contains attacker-supplied data.
In an actual stack buffer overflow exploit the string of "A"'s would instead be shellcode suitable
to the platform and desired function.
If this program had special privileges (e.g. the SUID bit set to run as the superuser),
then the attacker could use this vulnerability to gain superuser privileges on the affected
machine.