CVE-2019-5485

10.0 CRITICAL

📋 TL;DR

CVE-2019-5485 is a critical command injection vulnerability in the gitlabhook NPM package that allows attackers to execute arbitrary commands on the server by injecting malicious payloads through the repository name parameter. This affects any system using gitlabhook version 0.0.17 to handle GitLab webhooks, potentially leading to complete system compromise.

💻 Affected Systems

Products:
  • gitlabhook
Versions: 0.0.17
Operating Systems: All platforms running Node.js
Default Config Vulnerable: ⚠️ Yes
Notes: Any system using gitlabhook 0.0.17 to process GitLab webhooks is vulnerable regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full remote code execution leading to complete system takeover, data exfiltration, lateral movement, and persistent backdoor installation.

🟠

Likely Case

Remote command execution allowing attackers to run arbitrary commands with the privileges of the gitlabhook process, potentially gaining shell access.

🟢

If Mitigated

Limited impact if proper input validation and sandboxing are implemented, restricting command execution to safe operations.

🌐 Internet-Facing: HIGH - The vulnerability can be exploited remotely without authentication through webhook endpoints exposed to the internet.
🏢 Internal Only: MEDIUM - Still exploitable by internal attackers or through compromised internal systems, but attack surface is reduced.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation is trivial with publicly available proof-of-concept code showing command injection through repository name parameter.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.0.18 and later

Vendor Advisory: https://www.npmjs.com/advisories/1490

Restart Required: Yes

Instructions:

1. Update gitlabhook package: npm update gitlabhook
2. Verify version is 0.0.18 or higher: npm list gitlabhook
3. Restart any services using gitlabhook
4. Test webhook functionality

🔧 Temporary Workarounds

Input Validation Filter

all

Implement strict input validation to reject repository names containing shell metacharacters

// JavaScript example: if (repoName.match(/[;&|`$()\n]/)) { rejectRequest(); }

Network Isolation

linux

Restrict webhook endpoint access to trusted IP ranges only

// Use firewall rules: iptables -A INPUT -p tcp --dport [PORT] -s [TRUSTED_IP] -j ACCEPT
iptables -A INPUT -p tcp --dport [PORT] -j DROP

🧯 If You Can't Patch

  • Immediately disable or remove gitlabhook 0.0.17 from production systems
  • Implement network segmentation to isolate systems using vulnerable gitlabhook version

🔍 How to Verify

Check if Vulnerable:

Check package.json or run: npm list gitlabhook | grep gitlabhook

Check Version:

npm list gitlabhook

Verify Fix Applied:

Confirm version is 0.0.18+: npm list gitlabhook | grep 'gitlabhook@0.0.1[8-9]\|gitlabhook@[1-9]'

📡 Detection & Monitoring

Log Indicators:

  • Unusual command execution in system logs
  • Webhook requests with shell metacharacters in repository field
  • Process spawning from gitlabhook with unusual arguments

Network Indicators:

  • HTTP POST requests to webhook endpoints containing shell metacharacters
  • Outbound connections from gitlabhook process to unexpected destinations

SIEM Query:

source="application.log" "gitlabhook" AND ("&";"|";"`";"$";"(";")")

🔗 References

📤 Share & Export