β οΈ WARNING: This is a demonstration bot that intentionally introduces security vulnerabilities. It is the inverse of Renovate and Mend.
Demolition Bot is a GitHub bot that automatically creates pull requests to downgrade your dependencies to vulnerable versions. While tools like Renovate help keep dependencies up-to-date and secure, Demolition Bot does the opposite - perfect for security testing, penetration testing demonstrations, or educational purposes.
- π Vulnerability Discovery: Queries the GitHub Advisory Database to find known vulnerabilities
- π Automatic Downgrades: Creates PRs to downgrade dependencies to vulnerable versions
- π― Severity Filtering: Target specific severity levels (critical, high, medium, low)
- βοΈ Configurable: Control which packages to target and how many PRs to create
- π Detailed PRs: Each PR includes vulnerability details, CVE information, and severity
- Monitors Repository: Listens for push events to main/master branches
- Scans Dependencies: Parses
package.jsonto find all dependencies - Queries Vulnerabilities: Checks GitHub Advisory Database for known vulnerabilities
- Creates PRs: Automatically creates pull requests with downgraded versions
- Provides Context: Each PR includes detailed vulnerability information
-
Clone this repository
-
Install dependencies:
npm install
-
Set up environment variables (copy
.env.exampleto.env):GITHUB_APP_ID=your_app_id GITHUB_PRIVATE_KEY=your_private_key GITHUB_WEBHOOK_SECRET=your_webhook_secret GITHUB_TOKEN=your_personal_access_token PORT=3000
-
Build and start the bot:
npm run build npm start
Create a .demolition-bot.json file in your repository root:
{
"enabled": true,
"maxPRsPerRun": 5,
"ignoredPackages": [
"typescript",
"eslint"
],
"targetSeverity": [
"critical",
"high"
]
}- enabled (boolean): Enable/disable the bot for this repository
- maxPRsPerRun (number): Maximum number of PRs to create per run (default: 5)
- ignoredPackages (string[]): List of package names to skip
- targetSeverity (string[]): Target severity levels - options:
critical,high,medium,low
Once installed as a GitHub App, Demolition Bot will automatically:
- Monitor push events to your main branch
- Scan for dependencies
- Create PRs with vulnerable versions
You can also trigger the bot programmatically:
import { DemolitionBot } from './src/bot';
const bot = new DemolitionBot(process.env.GITHUB_TOKEN);
const config = await bot.loadConfig('owner', 'repo');
await bot.processRepository('owner', 'repo', config);When Demolition Bot finds a vulnerability, it creates a PR like this:
## β οΈ Demolition Bot: Dependency Downgrade
This PR downgrades **lodash** to introduce a known vulnerability.
### Change Summary
- Package: lodash
- Current Version: 4.17.21
- Target Version: 4.17.19
### Vulnerability Details
- Severity: HIGH
- CVE: CVE-2020-8203
- Published: 2020-07-15
[Detailed vulnerability information...]
β οΈ WARNING: DO NOT MERGE in production environments!src/
βββ index.ts # Main server and webhook handler
βββ bot.ts # Core bot logic
βββ dependency-parser.ts # Parses package.json and dependencies
βββ vulnerability-finder.ts # Queries GitHub Advisory Database
βββ pr-creator.ts # Creates pull requests
Currently supported:
- β npm (JavaScript/Node.js)
Planned support:
- π§ pip (Python)
- π§ Maven (Java)
- π§ Go modules
- π§ RubyGems
- π§ Cargo (Rust)
- Security research and testing
- Educational purposes
- Penetration testing demonstrations
- Security training
DO NOT:
- Use in production environments
- Merge the PRs created by this bot
- Run on repositories with sensitive data
- Use without proper authorization
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run in development mode
npm run dev
# Run tests
npm testGET /- Bot informationGET /health- Health checkPOST /webhook- GitHub webhook endpoint
Contributions are welcome! This is a demonstration/educational project.
ISC
This tool is provided for educational and security testing purposes only. The authors are not responsible for any misuse or damage caused by this tool. Always obtain proper authorization before testing security on systems you do not own.
Built with β€οΈ (and a bit of chaos) as the inverse of Renovate