2018. 6. 14.

[웹 취약점] Curl

curl 의 강점은 아래와 같다.

  • CURL is an easy to use command line tool to send and receive files, and it supports almost all major protocols(DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS,  LDAP,  LDAPS,  POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP) in use.
  • Can be used inside your shell scripts with ease
  • Supports features like pause and resume of downloads
  • It has around 120 command line options for various tasks
  • It runs on all major operating systems(More than 40+ Operating systems)
  • Supports cookies, forms and SSL
  • Both curl command line tool and libcurl library are open source, so they can be used in any of your programs
  • It supports configuration files
  • Multiple upload with a single command
(download : https://winampplugins.co.uk/curl/)


  • Progress bar, rate limiting, and download time details

    • IPV6 Support
    (curl download : https://www.lesstif.com/pages/viewpage.action?pageId=14745703#curl%EC%84%A4%EC%B9%98%EB%B0%8F%EC%82%AC%EC%9A%A9%EB%B2%95-HTTPGET/POST,RESTAPI%EC%97%B0%EA%B3%84%EB%93%B1-%EA%B0%9C%EC%9A%94)


    Command Injection


    버프스위트에서 copy as curl command 를 하면 손쉽게 curl 문법 형태로 변환되어 저장된다.

    그렇다면 어떨때 curl 를 사용하는 것일까. 예를 들면, 웹 페이지에서는 c.jsp 로 접속하려면 a > b > c.jsp 라는 구조가 있다고 할때, 루틴(?) 을 밟고나서야 접속할 수 있다. 그러나
    이것을 curl 로 시도하면 특정 url로 body 까지 포함한 데이터로 request 를 보낼 수 있다.

    post 데이터를 변조하여 요청할 일이 있을때 유용하게 사용된다.

    다운로드 후 환경변수에 추가하면 된다.

    • https://winampplugins.co.uk/curl/


    사례 1) 비밀번호 변경 page 에서 본인인증을 마치고 신규 비밀번호를 입력하는 부분의 페이지를 보니 post 로 userid, pw를 전송한다. 이럴때 userid 와 pw를 입력하면 특정 user의 pw를 인증없이 변경할 수 있다.

    curl -i -s -k -X $'POST'  .... -H $'Referer: http://test.co.kr' -H $'Content-Type: application/x-www-form-urlencoded' -H $'User-Agent: Mozilla/5.0 (Windows NT 6.1; --data-binary $UserID=test$password=test.....

    대충 위와 같은 방식

    사례 2)
    curl -L "http://xxx.xxx.xxx.xxx/multillidae/index.php?page=view-someones-blog.php" 2> /dev/null | grep -i \"admin\" | sed 's/"//g' | awk 'BEGIN{FS=">"}{for (i=1; i<=NF; i++) print $i}' | grep -v value | sed s'/<\/option//g'



    curl -L 주소는 웹 페이지의 소스코드를 가져온다.
    2> /dev/null 은 에러가 있더라구 무시하라
    grep -i  \"admin\" 은 admin 이라는 문자를 포함하는 curl 을 출력하라
    sed 's/"//g' 는 " 를 없는 것으로 치환
    awk 'BEGIN{F=">"}{for (i=1; i<=NF; i++) print $i}' 은 > 문자를 구분자로 짤라라
    grep -v value 는 value 문자만 포함하는 배열 요소를 추출하고
    sed s'/<\/option//g' 는 </option" 을 없는 것으로 치환하라

    (참고

    • https://blog.naver.com/thescream/220227784445
    • http://www.computersecuritystudent.com/cgi-bin/CSS/process_request_v3.pl?HID=f10d6dc6c6c21a10f3aaf29a7ee18eca&TYPE=SUB
    • CURL 을 이용한 웹 취약점 점검 - http://www.hackingarticles.in/web-application-penetration-testing-curl/


    Popular Posts

    Recent Posts

    Powered by Blogger.