Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
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.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
tough-cookie-2.5.0-cve-2023-26136-fix — ecurity patch for CVE-2023-26136 in tough-cookie 2.5.0 - Prototype pollution vulnerability fix with backward compatibility | Kitploit
Tools/GitHubGitHub/uriyahav/tough-cookie-2.5.0-cve-2023-26136-fix
Static AnalysisVulnerability AnalysisCode AnalysisWeb SecurityPapers & ResearchLearning & Education
GitHuburiyahav/tough-cookie-2.5.0-cve-2023-26136-fix

tough-cookie-2.5.0-cve-2023-26136-fix

ecurity patch for CVE-2023-26136 in tough-cookie 2.5.0 - Prototype pollution vulnerability fix with backward compatibility

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
View Repository
1 year agoNot yet reviewed

CVE-2023-26136 Fix for tough-cookie 2.5.0

Mission Overview

This project addresses CVE-2023-26136, a critical prototype pollution vulnerability in tough-cookie versions before 4.1.3. The vulnerability affects Penguin Software Inc.'s web application, which uses [email protected] for cookie processing.

Vulnerability Description

CVE-2023-26136 is a prototype pollution vulnerability that occurs when CookieJar is used with rejectPublicSuffixes=false. The issue arises from improper object initialization in the MemoryCookieStore class, allowing attackers to inject properties into the Object.prototype through maliciously crafted cookie domains.

Technical Details

The vulnerability exists in lib/memstore.js where cookies are stored using plain JavaScript objects ({}). Since these objects inherit from Object.prototype, attackers can exploit this by setting cookies with domains like __proto__, constructor, or prototype, leading to prototype pollution.

Solution

Patch Implementation

The fix replaces all instances of {} with Object.create(null) in the MemoryCookieStore class:

root@kitploit:~
// Before (vulnerable)
this.idx = {};

// After (fixed)
this.idx = Object.create(null);

This change prevents prototype pollution by creating objects with no prototype chain, effectively isolating cookie storage from unintended inheritance.

Files Modified

  • lib/memstore.js: Updated object initialization to use Object.create(null)

Project Structure

root@kitploit:~
├── README.md                    # This file
├── changes.diff                 # Git-compatible diff file
├── test-cve-2023-26136.js      # Unit test for the fix
├── tough-cookie/
│   ├── index.js                 # Exploit demonstration
│   ├── Original v2.5.0/         # Original vulnerable version
│   ├── v2.5.0-PATCHED/          # Patched version
│   │   └── tough-cookie-2.5.0.tgz  # Packed version
│   └── package.json
└── mission.txt                  # Original mission requirements

Installation and Testing

1. Packed Version (.tgz)

The patched version is available as tough-cookie/v2.5.0-PATCHED/tough-cookie-2.5.0.tgz.

To install:

root@kitploit:~
npm install ./tough-cookie/v2.5.0-PATCHED/tough-cookie-2.5.0.tgz

2. Test Suite Execution

The original tough-cookie test suite should pass. To run tests:

root@kitploit:~
cd tough-cookie/v2.5.0-PATCHED
npm install
npm test

Note: The original tough-cookie 2.5.0 doesn't include a test directory in this distribution, but the patched version maintains full compatibility with the original API.

3. Unit Test for Vulnerability Fix

Run the custom unit test to verify the fix:

root@kitploit:~
node test-cve-2023-26136.js

Expected output:

root@kitploit:~
Testing CVE-2023-26136 fix...
✅ CVE-2023-26136 fix verified: No prototype pollution detected
✅ Test passed: The vulnerability has been successfully patched

4. Exploit Demonstration

The project includes an exploit demonstration in tough-cookie/index.js:

root@kitploit:~
cd tough-cookie
node index.js

This will test both the original vulnerable version and the patched version, showing:

  • EXPLOITED SUCCESSFULLY for the original version
  • EXPLOIT FAILED for the patched version

Changes Documentation

changes.diff

The changes.diff file contains a git-compatible diff that can be applied using:

root@kitploit:~
git apply changes.diff

This diff includes only the necessary changes to fix the vulnerability without any unintended modifications.

Exploit Details

The exploit works by:

  1. Creating a CookieJar with rejectPublicSuffixes: false
  2. Setting a malicious cookie with domain __proto__
  3. This pollutes the Object.prototype chain
  4. New objects inherit the polluted properties

Potential Damage:

  • Application behavior manipulation
  • Security bypasses
  • Denial of service
  • Data corruption

Node.js Compatibility

✅ Tested and verified on Node.js 20 (LTS)

Repository Information

GitHub Repository: Forked tough-cookie repository

Git Tag: v2.5.0-patched-cve-2023-26136-fix

CI/CD Experience

Continuous Integration Tools Used:

  1. GitHub Actions - Expert level

    • Automated testing and deployment
    • Security scanning and dependency management
    • Multi-platform testing
  2. Jenkins - Advanced level

    • Pipeline development and maintenance
    • Docker containerization
    • Integration with various tools
  3. Travis CI - Intermediate level

    • Build automation
    • Test execution
    • Deployment workflows
  4. CircleCI - Intermediate level

    • CI/CD pipeline configuration
    • Docker support
    • Parallel job execution
  5. GitLab CI/CD - Advanced level

    • Pipeline development
    • Kubernetes deployment
    • Security scanning integration

Additional Tools:

  • Docker - Expert level (containerization and orchestration)
  • Kubernetes - Advanced level (deployment and scaling)
  • SonarQube - Intermediate level (code quality analysis)
  • Snyk - Intermediate level (security vulnerability scanning)

References

  • CVE-2023-26136 - NVD
  • tough-cookie GitHub Repository
  • Prototype Pollution Security Guide

License

This project maintains the original tough-cookie license (BSD-3-Clause) while adding the security fix.


Note: This is a security-focused patch that maintains full backward compatibility while eliminating the CVE-2023-26136 vulnerability.

Download Tool