Global Objects in Javascript- Possible to Exploit?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Global Objects in Javascript- Possible to Exploit?
I was told that if you use global objects in a Javascript that it possible that a malicouse user could exploit the web page. Would this be true even with static web pages?
Hi dman777,
The problem using global variables is the NameSpace cluttering (efficiency loose) ans libraries conflicts, no necessarily exploits. But if there is any exploitable bug, it will be easier to exploit if you use global variables. See http://www.javascripttoolbox.com/bes...ces/#namespace for more details and good JS practices (or use Google for it).
There is no difference between static or dynamic pages (browsers don't really know where pages come from). But, of course, if it's a static page there is no DB and, therefore, there are no users, passwords, etc. Might still be other bugs or sensible data, or other apps in the same server that could still be exploitable by JS bugs in the static page.
I've never heard of a Javascript global object exploit, and my nose tells me that this exploit does not exist. I mean, is the ubiquitous jQuery global variable an attack vector?
I've never heard of a Javascript global object exploit, and my nose tells me that this exploit does not exist. I mean, is the ubiquitous jQuery global variable an attack vector?
No, absolutely. The exploitable bugs are in the server side, when some controls are left to javascript instead of doing it in server side, too. Whenever I load a page on my browser (Firefox, Chromium), I always can tell the browser to execute customized JS code (with Firebug on FF or Developer tools on Chromium). So JS is not where exploitable bugs live, it's always on server side. JS is there just to help the user, so you cannot delegate security matters only to JS.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.