anselal / antminer-monitor

Cryptocurrency ASIC mining hardware monitor using a simple web interface
GNU General Public License v3.0
228 stars 145 forks source link

Fixes EDB-50267 (security) #186

Closed Paradoxis closed 2 years ago

Paradoxis commented 2 years ago

An exploit guide on this particular piece of software was published on Exploit-DB (source: https://www.exploit-db.com/exploits/50267).

In the event an administrator forgets to set up the SECRET_KEY environment variable, the server can be bypassed by cracking the server's session cookie using Flask-Unsign. An attacker can then create a crafted Flask cookie which bypasses any authentication mechanism and logging.

This patch ensures a random value is chosen on boot if the secret is not set, and disables DEBUG by default as that also allows an attacker to obtain remote code execution if the pin is obtained somehow.