This repository was archived by the owner on Mar 20, 2020. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 7 files changed +61
-2
lines changed Expand file tree Collapse file tree 7 files changed +61
-2
lines changed Original file line number Diff line number Diff line change 11module . exports  =  { 
22  nosqlInjection : require ( './nosqlInjection' ) , 
3+   xpathInjection : require ( './xpathInjection' ) , 
34  xxe : require ( './xxe' ) 
45} ; 
Original file line number Diff line number Diff line change 1+ module . exports . xml  =  ` 
2+ <?xml version="1.0"?> 
3+ <users> 
4+   <user> 
5+     <username>admin</username> 
6+     <password>admin</password> 
7+   </user> 
8+   <user> 
9+     <username>user1</username> 
10+     <password>123456</password> 
11+   </user> 
12+   <user> 
13+     <username>tony</username> 
14+     <password>ynot</password> 
15+   </user> 
16+ </users> 
17+ ` ; 
Original file line number Diff line number Diff line change @@ -96,5 +96,13 @@ module.exports = {
9696    products : [ 'Protect' ] , 
9797    inputs : [ 'query' ] , 
9898    sinks : sinks . untrustedDeserialization 
99+   } , 
100+   xpathInjection : { 
101+     base : '/xpathInjection' , 
102+     name : 'XPath Injection' , 
103+     link : 'https://owasp.org/www-community/attacks/XPATH_Injection' , 
104+     products : [ 'Assess' ] , 
105+     inputs : [ 'query' ] , 
106+     sinks : sinks . xpathInjection 
99107  } 
100108} ; 
Original file line number Diff line number Diff line change @@ -11,5 +11,6 @@ module.exports = {
1111  unvalidatedRedirect : require ( './unvalidatedRedirect' ) , 
1212  xss : require ( './xss' ) , 
1313  xxe : require ( './xxe' ) , 
14-   untrustedDeserialization : require ( './untrustedDeserialization' ) 
14+   untrustedDeserialization : require ( './untrustedDeserialization' ) , 
15+   xpathInjection : require ( './xpathInjection' ) 
1516} ; 
Original file line number Diff line number Diff line change 1+ 'use strict' ; 
2+ const  xpath  =  require ( 'xpath' ) ; 
3+ const  {  DOMParser }  =  require ( 'xmldom' ) ; 
4+ const  {  xml }  =  require ( '../content/xpathInjection' ) ; 
5+ const  doc  =  new  DOMParser ( ) . parseFromString ( xml ) ; 
6+ 
7+ module . exports [ 'xpath.select' ]  =  async  function  select ( 
8+   input , 
9+   {  safe =  false ,  noop =  false  }  =  { } 
10+ )  { 
11+   if  ( noop )  return  'NOOP' ; 
12+ 
13+   const  path  =  safe  ? encodeURIComponent ( input )  : input ; 
14+ 
15+   return  new  Promise ( ( resolve )  =>  { 
16+     const  searchString  =  `//user[username/text()='${ path }  ; 
17+     const  user  =  xpath . select ( searchString ,  doc ) . toString ( ) ; 
18+     resolve ( user ) ; 
19+   } ) ; 
20+ } ; 
Original file line number Diff line number Diff line change 3636    "request" : " ^2.88.0" 
3737    "sequelize" : " ^5.21.1" 
3838    "sql-template-strings" : " ^2.2.2" 
39-     "superagent" : " ^5.0.5" 
39+     "superagent" : " ^5.0.5" 
40+     "xmldom" : " ^0.2.1" 
41+     "xpath" : " 0.0.27" 
4042  },
4143  "devDependencies" : {
4244    "@contrast/eslint-config" : " ^1.0.3" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments