0

I'm trying to route certain requests through burp. These would be HTTPS requests

I have burp properly installed, and placed the cacert.der certificate in the current working directory that the code is contained. I've looked at https://curl.haxx.se/libcurl/c/curl_easy_setopt.html, but can't get it working.

This is the current code I'm using to attempt this

@classmethod
def CURLpageThroughBurp(cls, encodedURL):
    buffer = BytesIO()
    c = pycurl.Curl()

    c.setopt(c.URL, str(encodedURL))
    c.setopt(c.CAINFO, certifi.where())

    c.setopt(c.PROXY, '127.0.0.1')
    c.setopt(c.PROXYPORT, 8080)
    c.setopt(c.PROXY_SSLCERT, "cacert.der")
    c.setopt(c.PROXY_SSLCERTTYPE, "DER")

    c.setopt(c.FOLLOWLOCATION, True)
    
    ##c.setopt(c.PROXYTYPE, c.PROXYTYPE_SOCKS5_HOSTNAME)

    c.setopt(c.WRITEDATA, buffer)
    c.perform()
    c.close()

    webpage = buffer.getvalue()
    return webpage

Here's the error I receive:

File "randomcode,py", line 111 c.perform()
pycurl.error: (60, 'SSL certificate problem: self signed certificate in certificate chain')

HTTP requests:

When I have "intercept on" enabled on Burp, the HTTP requests are intercepted, and they actually successfully can be forwarded and I receive responses from the destination server.

HTTPS requets:

When I have "intercept on" enabled on Burp, the HTTPS requests aren't intercepted, so I am unable to forward them, because they don't pop on the intercept tab. And I get the pycurl.error seen above.

NOTE: I can successfully send both HTTP and HTTPS requests with curl when not using Burp proxy

user5423
  • 135
  • 13
  • Does this answer your question: https://stackoverflow.com/questions/21187946/curl-error-60-ssl-certificate-issue-self-signed-certificate-in-certificate-cha – hrokr Jul 24 '20 at 19:43
  • I installed burp today, which included downloading the cacert.der certificate. I have been using certifi successfully in other functions today aswell. So i don't think it's to do with outdated certificates. – user5423 Jul 24 '20 at 19:48
  • So, you think the error message 'SSL certificate problem: self signed certificate in certificate chain' is wrong? – hrokr Jul 24 '20 at 21:30
  • I really don't know. I guess it's possible that this error message can result from reasons other than outdated certificates. I installed burp today, and reinstalled Certifi today just in case. I can send HTTPS request with no issue, and I can send HTTP requests through Burp without issues. It's only when I use HTTPS requests with burp, that it doesn't work. – user5423 Jul 24 '20 at 21:54
  • Follow instructions in http://pycurl.io/docs/latest/troubleshooting.html#transfer-related-issues. – D. SM Jul 31 '20 at 00:28

0 Answers0