Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ This vulnerable application contains the following API/Web Service vulnerabiliti
* XML Bomb Denial-of-Service
* SOAP Injection
* Cross-Site Request Forgery (CSRF)
* Rate Limit Bypass
* Client Side Template Injection

## Set Up Instructions
Expand Down
32 changes: 32 additions & 0 deletions test/vulnerabilities.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ describe("DVWS-Node Vulnerability Tests", function () {
const authFailed = responses.every(res => res.status === 401);
expect(authFailed).to.eql(true);
});

});

describe("26. CRLF Injection (Log Pollution)", function () {
Expand Down Expand Up @@ -453,4 +454,35 @@ describe("DVWS-Node Vulnerability Tests", function () {
expect(adminUser).to.have.property('password', 'letmein');
});
});

describe("36. Rate Limit Bypass", function () {
it("should allow bypassing IP-based rate limit using X-Forwarded-For header", async function () {
// 1. Flood from a specific IP to trigger ban
const blockedIP = "192.168.1.200";
const attempts = 110; // Max is 100
const promises = [];

for (let i = 0; i < attempts; i++) {
promises.push(
request
.post("/login")
.set("X-Forwarded-For", blockedIP)
.send({ username: "admin", password: "wrong" + i })
);
}

const responses = await Promise.all(promises);
const rateLimited = responses.some(res => res.status === 429);
expect(rateLimited).to.eql(true, "Rate limit should have been triggered");

// 2. Bypass using a different IP via X-Forwarded-For
const bypassIP = "192.168.1.201";
const response = await request
.post("/login")
.set("X-Forwarded-For", bypassIP)
.send({ username: "admin", password: "password" });

expect(response.status).to.not.equal(429, "Rate limit should be bypassed with new IP");
});
});
});