Recently I've been trying to find a way to steal HTTP Basic Authentication credentials via CSRF. For example, if a site is using basic authentication is it possible for an attacker to grab the Authorization header with some sort of proxy hidden in an iframe, or steal it any other way?

I've done some research and nothing I can find really proves this is logically possible.

If anyone has a solid answer, whether this is 100% impossible or actually possible, thanks in advance!

1 Answer 1


CSRF is a write-only read-none action. Because of the Same Origin Policy the attacker can make a request happen, but he can neither read the details of the request nor read the response. This unreadable parts of the request include cookies (incl. session cookies) and also the information for Basic Authentication.

  • So you can't use a proxy to intercept the request in JavaScript?
    – user206890
    Commented May 2, 2019 at 4:31
  • @Frinto: What has a proxy to do with JavaScript? And of course you could intercept a request with a proxy and read the basic authentication information - but this has nothing to do with CSRF and thus with your question. Commented May 2, 2019 at 4:50
  • I was asking if you could send an HTTP GET request through a proxy with JS. It relates to CSRF since you're making a request to the site using HTTP Basic Auth in a hidden iframe.
    – user206890
    Commented May 2, 2019 at 5:07
  • Unless CSRF is strictly ONLY actions executed on behalf of the victim, like transferring money. Pardon me, but I thought just accessing the site on a malicious website, was considered CSRF.
    – user206890
    Commented May 2, 2019 at 5:10
  • @Frinto: you cannot make CSRF send a request through a proxy which was not configured inside the browser. You can also not use CSRF to make the browser send basic authentication information which it has stored for site A to the attacker controlled site B instead. Commented May 2, 2019 at 5:16

You must log in to answer this question.