JSON insecure deserialization (JID) is another type of cyber threat that has become prominent over the past decade. This mode of attack involves manipulating serialized objects that can be passed through a JSON application, ultimately leading to its control. Since this isn’t your run-of-the-mill threat, it is frequently missed by basic threat detection; to avoid this vulnerability in your system, you can use the following API in Python to instantly detect JID attacks from text input.
To start the process, we will first install the API client:
pip install cloudmersive-security-api-client
Next, we can configure the API key and call the threat detection function with the below example code:
from __future__ import print_function
from cloudmersive_security_api_client.rest import ApiException
from pprint import pprint# Configure API key authorization: Apikey
configuration = cloudmersive_security_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'# create an instance of the API class
api_instance = cloudmersive_security_api_client.ContentThreatDetectionApi(cloudmersive_security_api_client.ApiClient(configuration))
value = 'value_example' # str | User-facing text input.try:
# Detect Insecure Deserialization JSON (JID) attacks in a string
api_response = api_instance.content_threat_detection_detect_insecure_deserialization_json_string(value)
except ApiException as e:
print("Exception when calling ContentThreatDetectionApi->content_threat_detection_detect_insecure_deserialization_json_string: %s\n" % e)
And that’s it! If you need to obtain an API key, you can do so by registering for a free account on the Cloudmersive website; this provides 800 calls/month across our library of APIs.