Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2018-14847 — Analysis and PoC for CVE-2018-14847, MikroTik RouterOS Winbox information disclosure vulnerability allowing unauthenticated read access to the credential database. | Kitploit
Tools/GitHubGitHub/themalwareguardian/cve-2018-14847
Embedded Systems SecurityPassword CrackingIoT SecurityVulnerability AnalysisExploitationInformation Gathering
GitHubthemalwareguardian/cve-2018-14847

CVE-2018-14847

Analysis and PoC for CVE-2018-14847, MikroTik RouterOS Winbox information disclosure vulnerability allowing unauthenticated read access to the credential database.

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
View Repository
3 months agoNot yet reviewed

🐞 MikroTik CVE-2018-14847

Unauthenticated path traversal in MikroTik's Winbox protocol leaking admin credentials from /flash/rw/store/user.dat




📑 Table of Contents

  • Overview
  • Affected Versions
  • Vulnerability
    📂
    • Winbox Protocol
    • Path Traversal
    • Password Decryption
    • Developer Backdoor
  • Exploit
  • References



📋 Overview

CVE-2018-14847 is a path traversal vulnerability in MikroTik RouterOS affecting the Winbox management protocol (TCP port 8291). An unauthenticated remote attacker can read arbitrary files from the router's filesystem, including the user credential database /flash/rw/store/user.dat, which stores passwords encrypted with a weak static XOR key.

The vulnerability was originally disclosed by Jacob Baines (Tenable) in July 2018 through the By the Way exploit. This repository contains a standalone Python3 reimplementation with full protocol documentation.




🎯 Affected Versions

Download Tool
ChannelVersions
Longterm6.30.1 - 6.40.7
Stable6.29 - 6.42
Beta6.29rc1 - 6.43rc3

MikroTik patched this vulnerability in April 2018. Devices running RouterOS older than the fixed versions remain vulnerable.




🔬 Vulnerability

🧠 Winbox Protocol

Winbox is MikroTik's proprietary binary management protocol running on TCP port 8291. Frames are structured as:

root@kitploit:~
[total_len - 2][0x01][0x00][total_len - 4]["M2"][fields...]

The 4-byte header encodes the total frame size. It is not a standard little-endian u16 - each byte encodes total_length - 2 and total_length - 4 independently.

Field encoding inside each frame:

Type byteMeaningValue
0xffExtended field markerfollowed by field_id and value
0x09u8 integer1 byte
0x21String1-byte length prefix + data
0x88Reply-expected markerno value
0xfeExtended field id3-byte id + type + value

The filesystem handler lives at endpoint (sys=5, handler=0) and exposes three relevant commands:

  • 0x06 - open file
  • 0x04 - read file
  • 0x01 - create file

🧨 Path Traversal

The Winbox filesystem handler does not sanitize the path passed to the open-file command. By embedding '/////./../' sequences, an attacker escapes the sandbox boundary and reaches the root filesystem:

root@kitploit:~
/////./..//////./..//////./../flash/rw/store/user.dat

Each '/////./../' segment (10 bytes) steps one directory level up. Three segments reach the root, after which flash/rw/store/user.dat is the RouterOS user credential database. The request requires no authentication.

The exploit sends two frames:

  1. Open request: open-file command with the traversal path
    • Response byte [38] → session_id
  2. Read request: read-file command with session_id patched in
    • Response from byte [55] onwards → raw user.dat contents

🔐 Password Decryption

user.dat is a sequence of nv::message records. Each record is preceded by a 2-byte LE length field and starts with the magic bytes M2. Fields inside each record use a 3-byte LE field id:

Field idTypeMeaning
0x01stringusername
0x02u8group - 3 = full admin access
0x11stringencrypted password (empty if not set)

Passwords are encrypted with a static XOR key derived from a hardcoded salt compiled into RouterOS:

root@kitploit:~
key      = MD5(username + "283i4jfkai3389")
password = XOR(encrypted_pass[i], key[i % len(key)])  until null byte

This means any user.dat extracted from any affected device can be decrypted offline without brute force.


🧬 Developer Backdoor

After obtaining the admin password, the attacker can authenticate via Winbox and use the create-file command to write two files that activate the hidden developer login:

root@kitploit:~
/pckg/option                       activates the option package
/flash/nova/etc/devel-login        enables the devel user

Once these files exist, the router exposes a BusyBox root shell via Telnet and SSH under the user devel, using the admin's password.

Telnet must be connected first for SSH to work on some RouterOS versions.




⚙️ Exploit

Exploit_CVE_2018_14847.py is a self-contained Python3 exploit with zero external dependencies. It implements the Winbox binary protocol from scratch and performs:

  1. Unauthenticated path traversal to extract user.dat.
  2. Binary parsing of nv::message records.
  3. MD5-XOR password decryption.
root@kitploit:~
# Default port 8291
python3 Exploit_CVE_2018_14847.py 192.168.1.10

# Custom port
python3 Exploit_CVE_2018_14847.py 192.168.1.10 8291

Post-exploitation - developer backdoor shell:

root@kitploit:~
# Telnet (must connect first)
telnet -l devel 192.168.1.10

# SSH (after Telnet session)
ssh -oHostKeyAlgorithms=+ssh-dss [email protected]



📚 References

  • MikroTik Security Advisory

    • Official patch advisory and timeline from MikroTik.
  • Tenable - By the Way PoC

    • Original C++ exploit by Jacob Baines.
  • NVD - CVE-2018-14847

    • CVSS 9.1 (Critical).