Overview

If you experience unexpected behavior with Datadog Application Security Management (ASM), there are common issues you can investigate, as mentioned below. If you continue to have trouble, reach out to Datadog support for further assistance.

ASM rate limits

ASM traces are rate-limited to 100 traces per second. Traces sent after the limit are not reported. Contact Datadog support if you need to change the limit.

No security traces detected by ASM

There are a series of steps that must run successfully for threat information to appear in the ASM Trace and Signals Explorer. It is important to check each step when investigating this issue. Additional troubleshooting steps for specific languages are in the language tab at the end.

Confirm ASM is enabled

You can use the metric datadog.apm.appsec_host to check if ASM is running.

  1. Go to Metrics > Summary in Datadog.
  2. Search for the metric datadog.apm.appsec_host. If the metric doesn’t exist, then there are no services running ASM. If the metric exists, the services are reported with the metric tags host and service.
  3. Select the metric, and in the Tags section, search for service to see which services are running ASM.

If you are not seeing datadog.apm.appsec_host, check the in-app instructions to confirm that all steps for the initial setup are complete.

ASM data is sent with APM traces. See APM troubleshooting to confirm APM setup and check for connection errors.

Send a test attack to your application

To test your ASM setup, trigger the Security Scanner Detected rule by running a file that contains the following curl script:

for ((i=1;i<=250;i++));
do
# Target existing service's routes
curl https://your-application-url/existing-route -A Arachni/v1.0;
# Target non existing service's routes
curl https://your-application-url/non-existing-route -A Arachni/v1.0;
done

A few minutes after you enable your application and exercise it, and if it’s successful, threat information appears in the Trace and Signals Explorer.

Security Signal details page showing tags, metrics, suggested next steps, and attacker IP addresses associated with a threat.

Check if required tracer integrations are deactivated

ASM relies on certain tracer integrations. If they are deactivated, ASM won’t work. To see if there are deactivated integrations, look for disabled_integrations in your startup logs.

The required integrations vary by language.

For Ruby, the Rack integration is required. Ruby tracer version 1.0.0 or higher is also required. See information on migrating from 0.x to 1.x.

Note: Rack can be manually added or automatically added with the Rails or Sinatra integration. If manually added, the tracer middleware must appear before the security middleware in the Rack stack.

Check Datadog Agent configuration

To troubleshoot this step of the process, do the following:

  • Check the details of the running Agent at this address http://<agent-machine-name>:<agent-port>/info, usually http://localhost:8126/info.
  • Ensure there are no Agent transmission errors related to spans in your tracer logs.
  • If the Agent is installed on a separate machine, check that DD_AGENT_HOST and, optionally, DD_TRACE_AGENT_PORT are set, or that DD_TRACE_AGENT_URL is set for the application tracing library.

Check if spans are successfully transmitted to Datadog

ASM data is sent over spans. To confirm that spans are successfully transmitted to Datadog, check that your tracer logs contain logs that look similar to this:

2021-11-29 21:19:58 CET | TRACE | INFO | (pkg/trace/info/stats.go:111 in LogStats) | [lang:.NET lang_version:5.0.10 interpreter:.NET tracer_version:1.30.1.0 endpoint_version:v0.4] -> traces received: 2, traces filtered: 0, traces amount: 1230 bytes, events extracted: 0, events sampled: 0

If spans are not being transmitted, then the tracer logs will contain logs similar to this:

2021-11-29 21:18:48 CET | TRACE | INFO | (pkg/trace/info/stats.go:104 in LogStats) | No data received

Troubleshooting by language

Below are additional troubleshooting steps for specific languages.

For Ruby, if you don’t see ASM threat information in the Trace and Signals Explorer after a few minutes, enable tracer diagnostics for debug logs. For example:

Datadog.configure do |c|
  c.diagnostics.debug = true  # increase general log level to debug
  c.appsec.waf_debug = true   # also enable WAF-specific log verbosity to highest level
end

Debug logs are verbose but useful. If you open up a ticket with Datadog support, forward the logs with your request.

Is ASM correctly enabled?

ASM has been correctly enabled if you see logs such as:

D, [2021-12-14T11:03:32.167125 #73127] DEBUG -- ddtrace: [ddtrace] (libddwaf/lib/datadog/appsec/waf.rb:296:in `block in logger=') {:level=>:ddwaf_log_info, :func=> "ddwaf_set_log_cb", :file=>"PowerWAFInterface.cpp", :message=>"Sending log messages to binding, min level trace"}
D, [2021-12-14T11:03:32.200491 #73127] DEBUG -- ddtrace: [ddtrace] (libddwaf/lib/datadog/appsec/waf.rb:296:in `block in logger=') {:level=>:ddwaf_log_debug, :func= >"parse", :file=>"parser_v2.cpp", :message=>"Loaded 124 rules out of 124 available in the ruleset"}

If you do not see those logs, check the following:

  • If the correct ASM environment variables are set for your application process.
  • The latest gem version is installed.
  • The tracer is configured correctly and sending APM traces to your APM dashboard.

Is ASM called for each HTTP request?

To confirm that ASM is called for each HTTP request, trigger a test attack and look for these logs:

D, [2022-01-19T21:25:50.579745 #341792] DEBUG -- ddtrace: [ddtrace] (/home/lloeki/src/github.com/DataDog/dd-trace-rb/lib/datadog/appsec/reactive/operation.rb:14:in `initialize') operation: rack.request initialize
D, [2022-01-19T21:25:50.580300 #341792] DEBUG -- ddtrace: [ddtrace] (/home/lloeki/src/github.com/DataDog/dd-trace-rb/lib/datadog/appsec/contrib/rack/gateway/watcher.rb:25:in `block (2 levels) in watch') root span: 964736568335365930
D, [2022-01-19T21:25:50.580371 #341792] DEBUG -- ddtrace: [ddtrace] (/home/lloeki/src/github.com/DataDog/dd-trace-rb/lib/datadog/appsec/contrib/rack/gateway/watcher.rb:26:in `block (2 levels) in watch') active span: 964736568335365930
D, [2022-01-19T21:25:50.581061 #341792] DEBUG -- ddtrace: [ddtrace] (/home/lloeki/src/github.com/DataDog/dd-trace-rb/lib/datadog/appsec/contrib/rack/reactive/request.rb:34:in `block in subscribe') reacted to ["request.headers", "request.uri.raw", "request.query", "request.cookies", "request.body.raw"]: [{"version"=>"HTTP/1.1", "host"=>"127.0.0.1:9292", "accept"=>"*/*", "user-agent"=>"Nessus SOAP"}, "http://127.0.0.1:9292/", [], {}, ""]

If you don’t see those logs, try the following:

  • Check that another upstream security system is not filtering requests based on the test header value, which would prevent the request from reaching the application.
  • Send another test attack using another user agent value in the curl command to see if the threat information is successfully sent.
  • Look in the application logs for the exact request you ran to confirm the request reached the application, and was not responded to by another upstream system.

If the Rack integration was configured manually, sometimes a known issue prevents ASM from working. For example:

Datadog.configure do |c|
  c.tracing.instrument :rails
  ...
  c.tracing.instrument :rack, web_service_name: "something", request_queuing: true

If c.tracing.instrument :rack is present, remove it to see if the check passes.

Is ASM detecting HTTP request security threats?

To confirm that ASM is detecting security threats, trigger a test attack, and look for these logs:

D, [2021-12-14T22:39:53.268820 #106051] DEBUG -- ddtrace: [ddtrace] (ddtrace/lib/datadog/appsec/contrib/rack/reactive/request.rb:63:in `block in subscribe') WAF: #<struct Datadog::AppSec::WAF::Result action=:monitor, data=[{"rule"=>{"id"=>"ua0-600-10x", "name"=>"Nessus", "tags"=>{"type"=>"security_scanner", "category"=>"attack_attempt"}}, "rule_matches"=>[{"operator"=>"match_regex", "operator_value"=>"(?i)^Nessus(/|([ :]+SOAP))", "parameters"=>[{"address"=>"server.request.headers.no_cookies", "key_path"=>["user-agent"], "value"=>"Nessus SOAP", "highlight"=>["Nessus SOAP"]}]}]}], perf_data=nil, perf_total_runtime=20519>

If you don’t see those logs, check that another upstream security system is not filtering out the requests or altering them based on the test header value.

Is the tracer sending traces with security data?

ASM data is sent with APM traces. To confirm that ASM correctly detects and inserts security data into traces, trigger a test attack, and look for these tracer logs:

Tags: [
   runtime-id => 0c3dfc67-9cf3-457c-a980-0229b203d048,
   _dd.runtime_family => ruby,
   appsec.event => true,
   _dd.appsec.json => {"triggers":[{"rule":{"id":"ua0-600-10x","name":"Nessus","tags":{"type":"security_scanner","category":"attack_attempt"}},"rule_matches":[{"operator":"match_regex","operator_value":"(?i)^Nessus(/|([ :]+SOAP))","parameters":[{"address":"server.request.headers.no_cookies","key_path":["user-agent"],"value":"Nessus SOAP","highlight":["Nessus SOAP"]}]}]}]},
   http.request.headers.host => 127.0.0.1:9292,
   http.request.headers.accept => */*,
   http.request.headers.user-agent => Nessus SOAP,
   http.response.headers.content-type => text/plain,
   http.host => 127.0.0.1,
   http.useragent => Nessus SOAP,
   network.client.ip => 127.0.0.1,
   _dd.origin => appsec,
   http.method => GET,
   http.url => /,
   http.base_url => http://127.0.0.1:9292,
   http.status_code => 200,
   http.response.headers.content_type => text/plain]
Metrics: [
   _dd.agent_psr => 1.0,
   system.pid => 155644.0,
   _dd.appsec.enabled => 1.0,
   _dd.measured => 1.0,
   _sampling_priority_v1 => 2.0]]

Wait a minute for the agent to forward the traces, then check that the traces show up in the APM dashboard. The security information in the traces may take additional time to be processed by Datadog before showing up as security traces in the ASM Trace and Signals Explorer.

No vulnerabilities detected by Software Composition Analysis

There are a series of steps that must run successfully for vulnerability information to appear either in the Software Catalog Security View or in the Vulnerability Explorer. It is important to check each step when investigating this issue.

Confirm ASM is enabled

You can use the metric datadog.apm.appsec_host to check if ASM is running.

  1. Go to Metrics > Summary in Datadog.
  2. Search for the metric datadog.apm.appsec_host. If the metric doesn’t exist, then there are no services running ASM. If the metric exists, the services are reported with the metric tags host and service.
  3. Select the metric, and in the Tags section, search for service to see which services are running ASM.

If you are not seeing datadog.apm.appsec_host, check the in-app instructions to confirm that all steps for the initial setup are complete.

ASM data is sent with APM traces. See APM troubleshooting to confirm APM setup and check for connection errors.

Confirm tracer versions are updated

See the Application Security product set up documentation to validate you you are using the right version of the tracer. These minimum versions are required to start sending telemetry data that includes library information.

Ensure the communication of telemetry data

Ensure the DD_INSTRUMENTATION_TELEMETRY_ENABLED environment variable (DD_TRACE_TELEMETRY_ENABLED for Node.js) is set to true, or the corresponding system property for your language is enabled. For example in Java: -Ddd.instrumentation.telemetry.enabled=true

Disabling threat management and protection

To disable threat management, remove the DD_APPSEC_ENABLED=true environment variable from your application configuration, and restart your service.

If no DD_APPSEC_ENABLED=true environment variable is set for your service, do one of the following:

  • If it’s a PHP service: explicitly set the environment variable to DD_APPSEC_ENABLED=false, and restart your service.
  • If threat management was activated using Remote Configuration, do the following:
    1. Go to Services (ASM > Catalog > Services).
    2. Select Threat Management in Monitoring Mode.
    3. In the Threat Management facet, enable Monitoring Only, No data, and Ready to block.
    4. Click on a service.
    5. In the service details, in Threat Detection, click Deactivate.
If threat management was activated using Remote Configuration, you can use a Deactivate button. If threat management was activated using local configuration, the Deactivate button is not an option.
  • To disable threat management on your services in bulk, do the following:
    1. Go to Services.
    2. In the Threat Management facet, enable Monitoring Only, No data, and Ready to block.
    3. Select the check boxes for the services where you want to disable threat detection.
    4. In Bulk Actions, select Deactivate Threat detection on (number of) services.

Disabling Code Security

To disable Code Security, remove the DD_IAST_ENABLED=true environment variable from your application configuration or set it to false as DD_IAST_ENABLED=false, and restart your service.

Need more help?

If you continue to have issues with ASM, contact Datadog support with the following information:

Further Reading

PREVIEWING: vishalshah/add-missing-functions-sql-reference