Sign inSign up

techantidote/gdb

By techantidote

•Updated almost 8 years ago

Learning Debugging |Core dump analysis|GNU Debugger

Image
0

111

techantidote/gdb repository overview

⁠Debugging/Core Dump Analysis with GDB:

⁠To run the debian container:
docker run -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined techantidote/gdb:debian-stretch
⁠To run the ubuntu container:
docker run -it  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined techantidote/gdb:ubuntu-18.04

⁠Example Program and debugging

  • program.c
#include <stdio.h>
#include <string.h>

int main(int argc, char** argv)
{
        char whatever[20];
        strcpy(whatever, argv[1]);

        return 0;
}
  • Compile by Disabling stack protector in gcc:
gcc -fno-stack-protector -z execstack -o program program.c
⁠Buffer Overflow
  • Run in gdb with > 20 chars.
gdb program

(gdb) run AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Starting program: /program AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Program received signal SIGSEGV, Segmentation fault.
0x0000555555554679 in main ()
⁠Dockerfile for debian:
FROM debian:stretch
RUN apt update && apt upgrade -y && apt install vim make gcc gdb strace -y
CMD ["bash"]
⁠Dockerfile for ubuntu:
FROM ubuntu:18.04
RUN apt update && apt upgrade -y && apt install vim make gcc gdb strace -y
CMD ["bash"]`
⁠Sources/References:

Tag summary

Content type

Image

Digest

Size

134.4 MB

Last updated

almost 8 years ago

docker pull techantidote/gdb:ubuntu-18.04