Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6825293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:00:20+00:00 2026-05-26T22:00:20+00:00

Original Question Is there any way to read a HTTPOnly 1 cookie with JavaScript?

  • 0

Original Question

Is there any way to read a HTTPOnly1 cookie with JavaScript?
I tried to do it using document.cookie and as far as I can see on this article about secure cookies and HttpOnly flag, I cannot access a secure cookie this way.

Can anyone suggest a workaround?


1To clarify, there are two types of secure cookies:

  1. Secure as in sent over the https:// protocol — i.e. cookie is not sent in plaintext. Known as the "secure flag". The question is not about these cookies.

  2. Secure as in the cookie cannot be read by JavaScript running in the
    browser — i.e.
    document.cookie will not work. Known as the "HttpOnly" flag. The question is about these cookies.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:00:20+00:00Added an answer on May 26, 2026 at 10:00 pm

    Different Browsers enable different security measures when the HTTPOnly flag is set. For instance Opera and Safari do not prevent javascript from writing to the cookie. However, reading is always forbidden on the latest version of all major browsers.

    But more importantly why do you want to read an HTTPOnly cookie? If you are a developer, then disable the flag – if the value isn’t a sensitive value like an authentication token then it doesn’t need to have this security flag enabled. The HTTPOnly security precaution is to help defend against XSS, but even with this flag enabled you need to still test your code for XSS vulnerabilities because this class of bugs are still fully exploitable. I recommend avoiding disabling security features, but sometimes the HTTPOnly flag gets in the way of application behavior, and if it isn’t an authentication token or personal information (PII) then it likely doesn’t need this flag.

    If you are an attacker, then you want to hijack a session. But there is an easy way to hijack a session, even when the HTTPOnly flag is enabled. You can still ride on the session without knowing the session id which is how the The MySpace Samy worm spread. This worm used an XHR to read a CSRF token and then perform an authorized task of posting itself to your wall – thus infecting everyone on your feed. In a session riding attack, the attacker can do almost anything that the logged user could do – even without access to the session id stored as a cookie value.

    People have too much faith in the HTTPOnly flag, XSS can still be exploitable. You should setup barriers around sensitive features. Such as the change password filed should always require the current password. Requiring a 2fa step for sensitive administrative features can make it more difficult for an attacker to access using stolen credentials or via CSRF aka "session riding" attacks.

    While adding a CAPTCHA can make CSRF more difficult, if the attacker has XSS they will be able to bypass a CAPTCHA challenge response by using a BeEF proxy to view and then bypass the CAPTCHA. A Same-Origin Policy bypass maybe used to view a CAPTCHA’s challenge response (or a CSRF token), a good example is Universal-Cross-Site-Scripting or UXSS. Requiring 2fa raises the bar over a CAPTCHA, as it would still require additional human interaction and that introduces another opportunity for the session-riding attack to be discovered and stopped.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(The original question was asked there : http://www.ogre3d.org/phpBB2/viewtopic.php?t=44832 ) Someone asked : While I
Original Question: i read that for RESTful websites. it is not good to use
My original question can be found here , for which I've gotten some great
I wish an easy way to communicate mathematical equations with gmail. There's a javascript
The answere is here, and my original question is below..... Changing the document workspace
Is there any way to Highlight Properties/Functions on your custom classes in intellisense? It's
SOLVED: Removed edittext and showed keyboard using imgr.toggleSoftInput(0, 0); Original question: Hello, I am
Curious if there are any disadvantages to using an ElementHost to host a WPF
I'm pretty sure this is a duplicate question, but I can't find the original(s).
Original Question I want to be able to generate a new (fully valid) MP3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.