@@ -330,6 +330,7 @@ describe("DVWS-Node Vulnerability Tests", function () {
330330 const authFailed = responses . every ( res => res . status === 401 ) ;
331331 expect ( authFailed ) . to . eql ( true ) ;
332332 } ) ;
333+
333334 } ) ;
334335
335336 describe ( "26. CRLF Injection (Log Pollution)" , function ( ) {
@@ -453,4 +454,35 @@ describe("DVWS-Node Vulnerability Tests", function () {
453454 expect ( adminUser ) . to . have . property ( 'password' , 'letmein' ) ;
454455 } ) ;
455456 } ) ;
457+
458+ describe ( "36. Rate Limit Bypass" , function ( ) {
459+ it ( "should allow bypassing IP-based rate limit using X-Forwarded-For header" , async function ( ) {
460+ // 1. Flood from a specific IP to trigger ban
461+ const blockedIP = "192.168.1.200" ;
462+ const attempts = 110 ; // Max is 100
463+ const promises = [ ] ;
464+
465+ for ( let i = 0 ; i < attempts ; i ++ ) {
466+ promises . push (
467+ request
468+ . post ( "/login" )
469+ . set ( "X-Forwarded-For" , blockedIP )
470+ . send ( { username : "admin" , password : "wrong" + i } )
471+ ) ;
472+ }
473+
474+ const responses = await Promise . all ( promises ) ;
475+ const rateLimited = responses . some ( res => res . status === 429 ) ;
476+ expect ( rateLimited ) . to . eql ( true , "Rate limit should have been triggered" ) ;
477+
478+ // 2. Bypass using a different IP via X-Forwarded-For
479+ const bypassIP = "192.168.1.201" ;
480+ const response = await request
481+ . post ( "/login" )
482+ . set ( "X-Forwarded-For" , bypassIP )
483+ . send ( { username : "admin" , password : "password" } ) ;
484+
485+ expect ( response . status ) . to . not . equal ( 429 , "Rate limit should be bypassed with new IP" ) ;
486+ } ) ;
487+ } ) ;
456488} ) ;
0 commit comments