close browser totally - browser

is there any solution how can i close the browser completely? I need this because I am using Single Sign On from other page and on that page it is written that only closing the browser will log out the user.

You can't close the users browser, but if you can identify the cookie which contains the session, you may be able to clear it. How you would do this depends on the language you are using.
In Javascript, you would have be operating on the same domain as the cookie you want to clear
var expired = new Date();
expired.setTime(mydate.getTime() - 86400);
document.cookie = "my_session_cookie_name=; expires=" + expired.toGMTString();
On the server-side, you can output headers to set or clear cookies. Depending on the users browser settings, you may be able to set cookies on 3rd party domains. Here's an example in PHP
setcookie ('my_session_cookie_name', '', time() - 86400);
//clear cookie for example.com
setcookie('my_session_cookie_name', '', time()-86400, '/', '.example.com');

No, you cannot.
that page it is written that only closing the browser will log out the user
If you could run JavaScript in the right domain (the Single Sign On server's domain), I bet that you can log the user out just by deleting the session cookie.

No you cannot force a user's browser to close without their permission.
Edit: Even though there are workarounds for some browsers, it is a bad practice and considered intrusive.

Atleast not in Firefox, otherwise it will be a big usability issue.
delete the cookies when you close the tab.

it's possible to close browser opened via javascript but since the user open the first browser it won't be possible to close all browsers.
your SSO should have some kind of logout function, it would be better. This function would clear the user cookies or clear the session on the server side.

If each SSO site is given its own cookie, you may need to log the user out of each SSO site individually. Hopefully each site has its own "log me out" URL and you can open a page with multiple iframes to each SSO site.

You can set them across domains, but
depending on the security settings in
the browser, they may be blocked, the
user may be prompted to confirm, or
they may be silently accepted. Here's
how you would configure Firefox to
block 3rd party cookies:
support.mozilla.com/en-US/kb/…
And how can I set them across domains?

Its very simple,
just add javascript
<td width="10%"><div align="center"><font color="#ffffff">Close</font></div></td>

Related

Why is Instagram showing to logins when I've only logged in once Everytime

Each time I log into Instagram, it shows that there are two sessions under Login Activity even though I've only logged in once and have only one session open in the browser? Is anyone else experiencing this? Been seeing this for the past few months.
It must have to do with session cookies. I would be storing a new session cookie instead of updating it and passing them both while validating your session. Although, I do not think this should pose a security threat unless these cookies are safe. You can verify that by inspecting the cookies passed by intercepting the requests either from the Network tab in the browser Developer Tools or by using a tool like Burp Suite or OWASP ZAP if you're looking for an open source alternative.

If user in session, copies and pastes url in another window, the app should get logged out

I am working on a financial web application.
There is a client requirement that if user is logged in and already browsing the app. If he copies and pastes the browser url to another window. In another window, the user should get logged out.
I know http is stateless and there is no inbuilt browser mechanism (cookies etc) to solve it, this needs to be implemented by programming only. I guess people have already solved this problem. Do you know know possible solution to solve this issue?
Sadly, there is no solution.
The browser keeps the cookies and all of the user informations for all the Tabs & Windows you open. It will clear the datas (like cookies that ask to be removed after the session) as soon as you close ALL tabs and windows of your browser. Note that if the user use another browser, the behaviour your want will be respected — browsers dnn't (yet ?) share this kind of informations.
It is simply not possible to solve the problem with code, and you'll have to find work-around.
As a researcher, I've seen one of these solutions : de-auth the user on the HTTP_REFERER (Apache Env. Variable). As soon as the referer was not the application itself (except for the login form), the user was de-authed. But take care of it : the Referer is an info sent by the browser. And no information sent by the browser should be trusted :). The advice remains, if only you want to use Javascript. You'll find someone to use a JS-disabled-browser to bypass your verification.
That's why Application Development is not yet dead ;)
Cheers.
K.

Is it possible to prevent a web browser from saving website credentials?

I have a website protected by basic auth, so when someone hits it, they get a standard username/password box. This website is accessed often from shared computers.
Is there any way to prevent the various "Remember my Credentials" functionality on browsers? I would like to prevent any browser from saving this username/password in any client-side repository.
I realize this is purely a function of the browser, but is there any commonly-accepted HTTP header or any other method of asking a website not to do this?
The answer is no. I'm really sorry but even if you could do this how would you stop an independent add-in from scraping web sites for username and password boxes and then storing that information.
Even if this were possible in code it could be easily circumvented by simply ignoring any directives you give. Thus rendering such headers pointless.
As stated before it is not possible to circumvent a browser feature it could easily save the credentials before it sent the POST thus stopping anything on the server from preventing it being cached.

Inherit session even if opening a new instance of IE7

I understand that sessions are kept when opened in a new tab but is it possible to inherit the session when opening a new instance of IE7 or IE6?
For example, I opened a web application, if I opened a new browser and I went to the same URL, it will keep me logged in.
I think this is more related to cookies then sharing session between tabs or windows.
You have cookies from a site that retains some information about you. These are sent to the server when you connect to the same site within another window and you are identified based on the content in the cookie.
The following post presents some details, although I am not sure if you are asking "why?" or "how?" you are keept logged in... either way, it involves cookies on the client machine.

Isn't CSRF a browser security issue?

Regarding cross-site request forgery (CSRF) attacks, if cookies are most used authentication method, why do web browsers allow sending cookies of some domain (and to that domain) from a page generated from another domain?
Isn't CSRF easily preventable in browser by disallowing such behavior?
As far as I know, this kind of security check isn't implemented in web browsers, but I don't understand why. Did I get something wrong?
About CSRF:
On wikipedia
On coding horror
Edit: I think that cookies should not be sent on http POST in the above case. That's the browser behavior that surprises me.
Why wouldn't the browser send cookies?
Site A (http://www.sitea.com) sets a cookie for the user.
User navigates to site B (http://www.siteb.com). Site B features integration with site A - click here to do something on site A! The users clicks "here".
As far as the browser can tell, the user is making a conscious decision to make a request to site A, so it handles it the same way it would handle any request to site A, and that includes sending site A cookies in the request to site A.
Edit: I think the main issue here is that you think there is a distinction between authentication cookies and other cookies. Cookies can be used to store anything - user preferences, your last high score, or a session token. The browser has no idea what each cookie is used for. I want my cookies to always be available to the site that set them, and I want the site to make sure that it takes the necessary precautions.
Or are you saying that if you search yahoo for "gmail", and then click on the link that takes you to http://mail.google.com, you shouldn't be logged in, even if you told gmail to keep you logged in, because you clicked on the link from another site?
It isn't that a browser is sending the cookie to or from an outside domain, it's the fact that you're authenticated and the site isn't validating the source of the request, so it treats it as if the request came from the site.
As far as whether a browser should disallow that... what about the many situations where cross-site requests are desirable?
Edit: to be clear, your cookie is not sent across domains.
I don't know that there's much the browser can do in that situation since the point of an XSRF attack is to direct the browser to another point in the application that would perform something bad. Unfortunately, the browser has no idea whether or not the request it's being directed to send is malicious or not. For example, given the classic example of XSRF:
<img src="http://domain.com/do_something_bad" />
it's not apparent to the browser that something bad is happening. After all, how is it to know the difference between that and this:
<img src="http://domain.com/show_picture_if_authenticated" />
A lot of the old protocols have big security holes -- think back to the recently-discovered DNS vulnerabilities. Like basically any network security, it's the responsibility of the end-points; yeah, it sucks that we have to fix this ourselves, but it's a lot harder to fix at the browser level. There are some obvious ones (<img src="logoff.php"> looks damn fishy, right?), but there will always be edge cases. (Maybe it's a GD script in a PHP file after all.) What about AJAX queries? And so on...
The cookies for a site are never sent to another site. In fact, to implement a successful CSRF attack, the attacker does not need to have access to these cookies.
Basically, an attacker tricks the user, who is already logged in to the target website, into clicking a link or loading an image that will do something on the target site with that user's credentials.
I.e., the user is performing the action, and the attacker has tricked the user into doing so.
Some people have said they don't think there's a lot the browser can do.
See this:
http://people.mozilla.org/~bsterne/content-security-policy/origin-header-proposal.html
It's an overview of a proposal for a new HTTP header to help mitigate CSRF attacks.
The proposed header name is "Origin" and it's basically the "Referer" header minus the path, etc.

Resources