VAITP Dataset

← Back to the dataset

CVE-2017-13718

Starry Station (Router) HTTP API PIN Brute Force Vulnerability

  • CVSS 8.0
  • CWE-254
  • Authentication, Authorization, and Session Management
  • Remote

The HTTP API supported by Starry Station (aka Starry Router) allows brute forcing the PIN setup by the user on the device, and this allows an attacker to change the Wi-Fi settings and PIN, as well as port forward and expose any internal device's port to the Internet. It was identified that the device uses custom Python code called "rodman" that allows the mobile appication to interact with the device. The APIs that are a part of this rodman Python file allow the mobile application to interact with the device using a secret, which is a uuid4 based session identifier generated by the device the first time it is set up. However, in some cases, these APIs can also use a security code. This security code is nothing but the PIN number set by the user to interact with the device when using the touch interface on the router. This allows an attacker on the Internet to interact with the router's HTTP interface when a user navigates to the attacker's website, and brute force the credentials. Also, since the device's server sets the Access-Control-Allow-Origin header to "*", an attacker can easily interact with the JSON payload returned by the device and steal sensitive information about the device.

CVSS base score
8.0
Published
2019-06-10
OWASP
A07 Identification and Authentication Failures
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Authentication, Authorization, and Session Management
Subcategory
Insecure Authentication Mechanisms
Accessibility scope
Remote
Impact
Unauthorized Access
Fixed by upgrading
Yes

Solution

Update Starry Station firmware to fix the vulnerability.

Vulnerable code sample

from flask import Flask, request, jsonify

app = Flask(__name__)

user_pins = {
    "user1": "secure_pin"
}

@app.route('/api/change_wifi_settings', methods=['POST'])
def change_wifi_settings():
    username = request.json.get('username')
    pin = request.json.get('pin')
    
    if user_pins.get(username) == pin:
        return jsonify({"success": "Wi-Fi settings changed successfully"})
    
    return jsonify({"error": "Unauthorized"}), 403

if __name__ == '__main__':
    app.run()

Patched code sample

from flask import Flask, request, jsonify
import uuid
import hashlib

app = Flask(__name__)

user_pins = {
    "user1": hashlib.sha256("secure_pin".encode()).hexdigest()
}

def verify_pin(username, pin):
    hashed_pin = hashlib.sha256(pin.encode()).hexdigest()
    return user_pins.get(username) == hashed_pin

@app.route('/api/change_wifi_settings', methods=['POST'])
def change_wifi_settings():
    username = request.json.get('username')
    pin = request.json.get('pin')
    
    if not verify_pin(username, pin):
        return jsonify({"error": "Unauthorized"}), 403

    return jsonify({"success": "Wi-Fi settings changed successfully"})

if __name__ == '__main__':
    app.run()

Cite this entry

@misc{vaitp:cve201713718,
  title        = {{Starry Station (Router) HTTP API PIN Brute Force Vulnerability}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2019},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2017-13718},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2017-13718/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::