Listen to this Post
This article introduces a bash script designed to test a target host’s HTTP compatibility by sending requests via different HTTP versions (HTTP/1.0, HTTP/1.1, HTTP/2). The script helps identify weaknesses in server configurations.
Download the Script
wget https://hackertips.today/cmd/bashed.sh
(Short URL: https://lnkd.in/eXY4hQ2J)
How the Script Works
The script defines a function called `bashed` that takes a hostname/URL as input. It then uses `curl` to test the target with:
– HTTP/1.0
– HTTP/1.1
– HTTP/2
– Other variations
Example usage:
./bashed.sh target.com
You Should Know: Practical Implementation
Here’s how to extend the script for deeper testing:
- Manual Curl Commands for HTTP Version Testing
Test HTTP/1.0 curl --http1.0 -I https://target.com Test HTTP/1.1 curl --http1.1 -I https://target.com Test HTTP/2 curl --http2 -I https://target.com Force HTTP/2 Prior Knowledge (no upgrade) curl --http2-prior-knowledge -I https://target.com
2. Automating with a Custom Bash Script
Enhance the original script with additional checks:
!/bin/bash if [ -z "$1" ]; then echo "Usage: $0 <target_host>" exit 1 fi TARGET="$1" echo "[+] Testing $TARGET with different HTTP versions..." HTTP/1.0 echo -e "\n[HTTP/1.0]" curl --http1.0 -I "$TARGET" HTTP/1.1 echo -e "\n[HTTP/1.1]" curl --http1.1 -I "$TARGET" HTTP/2 echo -e "\n[HTTP/2]" curl --http2 -I "$TARGET" HTTP/2 Prior Knowledge echo -e "\n[HTTP/2 Prior Knowledge]" curl --http2-prior-knowledge -I "$TARGET" echo -e "\n[+] Testing complete."
3. Analyzing Weaknesses
- Misconfigured HTTP versions may expose servers to downgrade attacks.
- Missing HTTP/2 support could indicate outdated infrastructure.
- Insecure headers (e.g., missing
Strict-Transport-Security
).
4. Advanced: Nmap HTTP Version Detection
nmap --script http-versions -p 80,443 target.com
What Undercode Say
Testing HTTP versions is crucial for security hardening. Weak configurations can lead to protocol downgrade attacks (e.g., TLS stripping). Combine this script with:
– OpenSSL checks:
openssl s_client -connect target.com:443 -tls1_2
– Web server analysis:
nikto -h target.com
– Traffic inspection:
tcpdump -i eth0 'port 80 or port 443' -w http_traffic.pcap
For penetration testers, always verify:
- HTTP/2 implementation flaws (CVE-2023-44487).
- Server header leaks (
Server: Apache/2.4.1
). - Deprecated cipher suites (
sslscan target.com
).
Expected Output:
[+] Testing target.com with different HTTP versions... [HTTP/1.0] HTTP/1.0 200 OK ... [HTTP/1.1] HTTP/1.1 200 OK ... [HTTP/2] HTTP/2 200 ... [+] Testing complete.
Use this technique to audit web servers and strengthen defenses.
References:
Reported By: Activity 7319669357209391104 – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅