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

  • Home
  • SEARCH
  • 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 421879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:01:35+00:00 2026-05-12T19:01:35+00:00

I recently started looking into building web applications using .NET MVC and I stumbled

  • 0

I recently started looking into building web applications using .NET MVC and I stumbled upon this blog post by Phil Haack: JSON Hijacking. For those of you who aren’t aware of this vulnerability when using JSON to transfer sensitive data it’s really a must read.

It seems that there are three ways to handle this vulnerability.

  1. Require a POST instead of GET in your JSON service.
  2. Wrap your JSON array responses in a JSON object.
  3. Don’t expose sensitive data in any service that isn’t protected by 1 or 2.

The third alternative isn’t really an option since it really limits the use of JSON.

So which one of the other two do you prefer?

The .NET MVC 2 preview requires a POST for JSON responses by default, I think this is a great way to protect any developer that doesn’t know about this problem yet. But to me it feels a little "hacky" to break REST in this way. Unless someone talks me out of it I’m sticking to wrapping my arrays in another object and unwrapping it client side.

  • 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-12T19:01:35+00:00Added an answer on May 12, 2026 at 7:01 pm

    I personally wrap all my responses in a comment:

    /* {
        "foo": 3,
        "bar": "string with *\x2F sequence in"
    } */
    

    and strip that off before JSON.parsing. This makes it useless as a target for script tags.

    It’s worth noting that this problem is not only to do with JSON, but any HTTP response you serve that could be interpreted as JavaScript. Even, say, a .htaccess-protected text file is vulnerable to leaking through third-party script tag inclusion, if it’s in a format that happens to be valid JavaScript.

    And here’s the crunch: thanks to E4X, even normal, static XML documents are also valid JavaScript. E4X is a disastrous and useless extension to JavaScript, implemented and invented at Mozilla, which allows you to write <element>content</element> XML literals inline in JS; as such, a protected XML file is now vulnerable to the same cross-site-leakage risks as JSON. Thank you Mozilla. See Google doctype‘s article on this.

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

Sidebar

Ask A Question

Stats

  • Questions 246k
  • Answers 246k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In your question you describe a Gaussian filter, for which… May 13, 2026 at 8:21 am
  • Editorial Team
    Editorial Team added an answer Yes, basically you want to code a pivot table. First,… May 13, 2026 at 8:21 am
  • Editorial Team
    Editorial Team added an answer Since we needed this to work in Linux, we ended… May 13, 2026 at 8:21 am

Related Questions

I've recently begun building version 2 of my year-old custom MVC framework. It's worked
I recently started looking into the new Policy Management in SQL Server 2008 and
I recently started looking into Qt (I installed Qt 4.5.2 and installed their Eclipse-CDT
I have recently started looking into Google Charts API for possible use within the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.