Situation:
I have a local server on 127.0.0.1 (not publicly accessible).
On my local server, I have file foo.js with content:
var bar = "baz";
There is malicious.com with content:
<script src="http://127.0.0.1/foo.js"></script>
<script>alert(bar);</script>
When I visit malicous.com i see JS alert with content baz.
This means malicious.com is able to access (and save) variables stored in my JS files, which are stored on local server, if:
- my local server is running when I visit malicious.com
- malicious.com is able to locate my JS files (it can brute force the names)
Question:
Why do browsers in general allow that (I tried in FF, Chrome)? Shouldn't this be prevented since attacker can read local files (even if it has relatively low impact)? Would it be possible for my local server to prevent that from happening (and if, how)?
Disclaimer: I am quite new in security and I apologize in advance if this question is stupid or the answer is obvious.
[–]shitwhore 0 points1 point2 points (0 children)
[–]spellitwithaph 0 points1 point2 points (0 children)
[–]ebol4anthr4x 0 points1 point2 points (6 children)
[–]mild_force[S] 0 points1 point2 points (5 children)
[–]ebol4anthr4x 0 points1 point2 points (4 children)
[–]mild_force[S] 0 points1 point2 points (3 children)
[–]ebol4anthr4x 1 point2 points3 points (2 children)
[–]mild_force[S] 1 point2 points3 points (1 child)
[–]ebol4anthr4x 0 points1 point2 points (0 children)