Your IP: Unknown · Your Status: ProtectedUnprotectedUnknown

Skip to main content

JSON hijacking

JSON hijacking

JSON hijacking definition

JSON hijacking is a security vulnerability during which a website exposes sensitive data in JSON format without adequate protection. It allows an attacker to exploit the cross-domain capabilities of JSONP to hijack the data using malicious JavaScript code.

During a JSON hijacking attack, the attacker crafts a malicious website that tricks the victim’s browser into making a request to the target website. The attacker’s JavaScript code is injected into the victim’s page, and the JSON response from the target website is loaded as a JavaScript file. As a result, the attacker’s code gains access to the JSON data and can extract confidential information.

Real-life JSON hijacking examples

One notable example of JSON hijacking involved social networking sites that exposed user profile data through JSONP endpoints without proper security measures. Attackers exploited this vulnerability to harvest users’ personal information and perform targeted phishing attacks.

JSON hijacking prevention

  • Avoid exposing sensitive information in JSON responses, or use additional authentication and encryption mechanisms to protect the data.
  • Implement proper input validation and output encoding to prevent injection attacks.
  • Enforce strict content security policies to restrict the execution of external scripts.
  • Implement strong session management and use anti-CSRF (Cross-Site Request Forgery) techniques to prevent unauthorized requests.
  • Regularly update web application frameworks and libraries to incorporate the latest security patches and best practices.

Further reading

Ultimate digital security