-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IAST taint tracking for DB values #8072
Conversation
internal-api/src/main/java/datadog/trace/api/iast/TaintableDb.java
Outdated
Show resolved
Hide resolved
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 59 metrics, 4 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.46.0-SNAPSHOT~8c5291ee75, baseline=1.46.0-SNAPSHOT~692835e608
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.056 s) : 0, 1056292
Total [baseline] (10.467 s) : 0, 10467195
Agent [candidate] (1.054 s) : 0, 1053954
Total [candidate] (10.468 s) : 0, 10467527
section appsec
Agent [baseline] (1.189 s) : 0, 1188883
Total [baseline] (10.717 s) : 0, 10716538
Agent [candidate] (1.2 s) : 0, 1199823
Total [candidate] (10.734 s) : 0, 10734023
section iast
Agent [baseline] (1.188 s) : 0, 1188378
Total [baseline] (10.957 s) : 0, 10956628
Agent [candidate] (1.192 s) : 0, 1191982
Total [candidate] (10.999 s) : 0, 10999279
section profiling
Agent [baseline] (1.255 s) : 0, 1254706
Total [baseline] (10.859 s) : 0, 10858940
Agent [candidate] (1.258 s) : 0, 1257705
Total [candidate] (10.927 s) : 0, 10927349
gantt
title petclinic - break down per module: candidate=1.46.0-SNAPSHOT~8c5291ee75, baseline=1.46.0-SNAPSHOT~692835e608
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (713.846 ms) : 0, 713846
BytebuddyAgent [candidate] (714.659 ms) : 0, 714659
GlobalTracer [baseline] (255.76 ms) : 0, 255760
GlobalTracer [candidate] (256.188 ms) : 0, 256188
AppSec [baseline] (56.669 ms) : 0, 56669
AppSec [candidate] (55.086 ms) : 0, 55086
Remote Config [baseline] (719.515 µs) : 0, 720
Remote Config [candidate] (750.728 µs) : 0, 751
Telemetry [baseline] (14.244 ms) : 0, 14244
Telemetry [candidate] (12.203 ms) : 0, 12203
section appsec
BytebuddyAgent [baseline] (731.24 ms) : 0, 731240
BytebuddyAgent [candidate] (738.928 ms) : 0, 738928
GlobalTracer [baseline] (253.35 ms) : 0, 253350
GlobalTracer [candidate] (255.184 ms) : 0, 255184
AppSec [baseline] (170.776 ms) : 0, 170776
AppSec [candidate] (171.678 ms) : 0, 171678
Remote Config [baseline] (676.504 µs) : 0, 677
Remote Config [candidate] (688.234 µs) : 0, 688
Telemetry [baseline] (8.177 ms) : 0, 8177
Telemetry [candidate] (8.263 ms) : 0, 8263
IAST [baseline] (19.25 ms) : 0, 19250
IAST [candidate] (19.759 ms) : 0, 19759
section iast
BytebuddyAgent [baseline] (835.416 ms) : 0, 835416
BytebuddyAgent [candidate] (838.765 ms) : 0, 838765
GlobalTracer [baseline] (248.759 ms) : 0, 248759
GlobalTracer [candidate] (248.599 ms) : 0, 248599
AppSec [baseline] (58.003 ms) : 0, 58003
AppSec [candidate] (58.477 ms) : 0, 58477
Remote Config [baseline] (691.559 µs) : 0, 692
Remote Config [candidate] (688.059 µs) : 0, 688
Telemetry [baseline] (8.9 ms) : 0, 8900
Telemetry [candidate] (8.845 ms) : 0, 8845
IAST [baseline] (21.577 ms) : 0, 21577
IAST [candidate] (21.519 ms) : 0, 21519
section profiling
ProfilingAgent [baseline] (95.275 ms) : 0, 95275
ProfilingAgent [candidate] (95.944 ms) : 0, 95944
BytebuddyAgent [baseline] (703.084 ms) : 0, 703084
BytebuddyAgent [candidate] (704.707 ms) : 0, 704707
GlobalTracer [baseline] (350.442 ms) : 0, 350442
GlobalTracer [candidate] (351.69 ms) : 0, 351690
AppSec [baseline] (54.467 ms) : 0, 54467
AppSec [candidate] (53.725 ms) : 0, 53725
Remote Config [baseline] (656.122 µs) : 0, 656
Remote Config [candidate] (664.076 µs) : 0, 664
Telemetry [baseline] (8.849 ms) : 0, 8849
Telemetry [candidate] (8.859 ms) : 0, 8859
Profiling [baseline] (95.299 ms) : 0, 95299
Profiling [candidate] (95.967 ms) : 0, 95967
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.46.0-SNAPSHOT~8c5291ee75, baseline=1.46.0-SNAPSHOT~692835e608
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.056 s) : 0, 1056165
Total [baseline] (8.648 s) : 0, 8648147
Agent [candidate] (1.06 s) : 0, 1060113
Total [candidate] (8.665 s) : 0, 8664888
section iast
Agent [baseline] (1.184 s) : 0, 1183939
Total [baseline] (9.203 s) : 0, 9203386
Agent [candidate] (1.186 s) : 0, 1185831
Total [candidate] (9.215 s) : 0, 9215057
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.182 s) : 0, 1181778
Total [baseline] (9.209 s) : 0, 9209189
Agent [candidate] (1.183 s) : 0, 1183434
Total [candidate] (9.17 s) : 0, 9169930
section iast_TELEMETRY_OFF
Agent [baseline] (1.185 s) : 0, 1184611
Total [baseline] (9.231 s) : 0, 9230611
Agent [candidate] (1.185 s) : 0, 1185281
Total [candidate] (9.252 s) : 0, 9251932
gantt
title insecure-bank - break down per module: candidate=1.46.0-SNAPSHOT~8c5291ee75, baseline=1.46.0-SNAPSHOT~692835e608
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (714.551 ms) : 0, 714551
BytebuddyAgent [candidate] (715.863 ms) : 0, 715863
GlobalTracer [baseline] (256.292 ms) : 0, 256292
GlobalTracer [candidate] (257.978 ms) : 0, 257978
AppSec [baseline] (55.163 ms) : 0, 55163
AppSec [candidate] (55.851 ms) : 0, 55851
Remote Config [baseline] (726.027 µs) : 0, 726
Remote Config [candidate] (723.257 µs) : 0, 723
Telemetry [baseline] (14.447 ms) : 0, 14447
Telemetry [candidate] (14.658 ms) : 0, 14658
section iast
BytebuddyAgent [baseline] (832.654 ms) : 0, 832654
BytebuddyAgent [candidate] (833.915 ms) : 0, 833915
GlobalTracer [baseline] (247.273 ms) : 0, 247273
GlobalTracer [candidate] (247.828 ms) : 0, 247828
AppSec [baseline] (57.888 ms) : 0, 57888
AppSec [candidate] (57.988 ms) : 0, 57988
IAST [baseline] (21.63 ms) : 0, 21630
IAST [candidate] (21.465 ms) : 0, 21465
Remote Config [baseline] (668.634 µs) : 0, 669
Remote Config [candidate] (669.299 µs) : 0, 669
Telemetry [baseline] (8.793 ms) : 0, 8793
Telemetry [candidate] (8.842 ms) : 0, 8842
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (831.446 ms) : 0, 831446
BytebuddyAgent [candidate] (832.549 ms) : 0, 832549
GlobalTracer [baseline] (246.526 ms) : 0, 246526
GlobalTracer [candidate] (246.954 ms) : 0, 246954
AppSec [baseline] (57.996 ms) : 0, 57996
AppSec [candidate] (58.007 ms) : 0, 58007
IAST [baseline] (21.421 ms) : 0, 21421
IAST [candidate] (21.374 ms) : 0, 21374
Remote Config [baseline] (675.894 µs) : 0, 676
Remote Config [candidate] (685.498 µs) : 0, 685
Telemetry [baseline] (8.746 ms) : 0, 8746
Telemetry [candidate] (8.73 ms) : 0, 8730
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (832.875 ms) : 0, 832875
BytebuddyAgent [candidate] (834.066 ms) : 0, 834066
GlobalTracer [baseline] (248.088 ms) : 0, 248088
GlobalTracer [candidate] (247.74 ms) : 0, 247740
AppSec [baseline] (58.146 ms) : 0, 58146
AppSec [candidate] (57.978 ms) : 0, 57978
IAST [baseline] (20.942 ms) : 0, 20942
IAST [candidate] (20.987 ms) : 0, 20987
Remote Config [baseline] (665.98 µs) : 0, 666
Remote Config [candidate] (682.105 µs) : 0, 682
Telemetry [baseline] (8.727 ms) : 0, 8727
Telemetry [candidate] (8.622 ms) : 0, 8622
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 1 performance regressions! Performance is the same for 10 metrics, 17 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.46.0-SNAPSHOT~8c5291ee75, baseline=1.46.0-SNAPSHOT~692835e608
dateFormat X
axisFormat %s
section baseline
no_agent (1.353 ms) : 1333, 1374
. : milestone, 1353,
appsec (1.738 ms) : 1714, 1761
. : milestone, 1738,
appsec_no_iast (1.764 ms) : 1741, 1786
. : milestone, 1764,
iast (1.495 ms) : 1473, 1518
. : milestone, 1495,
profiling (1.495 ms) : 1471, 1519
. : milestone, 1495,
tracing (1.491 ms) : 1466, 1516
. : milestone, 1491,
section candidate
no_agent (1.372 ms) : 1352, 1392
. : milestone, 1372,
appsec (1.753 ms) : 1729, 1776
. : milestone, 1753,
appsec_no_iast (1.753 ms) : 1728, 1778
. : milestone, 1753,
iast (1.494 ms) : 1469, 1518
. : milestone, 1494,
profiling (1.498 ms) : 1475, 1521
. : milestone, 1498,
tracing (1.461 ms) : 1436, 1486
. : milestone, 1461,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.46.0-SNAPSHOT~8c5291ee75, baseline=1.46.0-SNAPSHOT~692835e608
dateFormat X
axisFormat %s
section baseline
no_agent (373.531 µs) : 354, 393
. : milestone, 374,
iast (494.303 µs) : 472, 516
. : milestone, 494,
iast_FULL (653.602 µs) : 632, 675
. : milestone, 654,
iast_GLOBAL (527.917 µs) : 505, 551
. : milestone, 528,
iast_HARDCODED_SECRET_DISABLED (491.177 µs) : 470, 513
. : milestone, 491,
iast_INACTIVE (456.085 µs) : 435, 478
. : milestone, 456,
iast_TELEMETRY_OFF (484.391 µs) : 462, 506
. : milestone, 484,
tracing (440.413 µs) : 420, 461
. : milestone, 440,
section candidate
no_agent (369.885 µs) : 350, 389
. : milestone, 370,
iast (511.704 µs) : 489, 534
. : milestone, 512,
iast_FULL (738.764 µs) : 717, 761
. : milestone, 739,
iast_GLOBAL (555.711 µs) : 533, 578
. : milestone, 556,
iast_HARDCODED_SECRET_DISABLED (502.221 µs) : 481, 524
. : milestone, 502,
iast_INACTIVE (453.498 µs) : 432, 475
. : milestone, 453,
iast_TELEMETRY_OFF (492.632 µs) : 471, 514
. : milestone, 493,
tracing (448.696 µs) : 427, 470
. : milestone, 449,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.46.0-SNAPSHOT~8c5291ee75, baseline=1.46.0-SNAPSHOT~692835e608
dateFormat X
axisFormat %s
section baseline
no_agent (1.462 ms) : 1451, 1474
. : milestone, 1462,
appsec (2.348 ms) : 2305, 2390
. : milestone, 2348,
iast (2.095 ms) : 2040, 2149
. : milestone, 2095,
iast_GLOBAL (2.134 ms) : 2080, 2189
. : milestone, 2134,
profiling (1.962 ms) : 1918, 2006
. : milestone, 1962,
tracing (1.928 ms) : 1887, 1970
. : milestone, 1928,
section candidate
no_agent (1.464 ms) : 1452, 1475
. : milestone, 1464,
appsec (2.349 ms) : 2307, 2392
. : milestone, 2349,
iast (2.099 ms) : 2045, 2154
. : milestone, 2099,
iast_GLOBAL (2.134 ms) : 2080, 2188
. : milestone, 2134,
profiling (1.961 ms) : 1918, 2004
. : milestone, 1961,
tracing (1.932 ms) : 1890, 1974
. : milestone, 1932,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.46.0-SNAPSHOT~8c5291ee75, baseline=1.46.0-SNAPSHOT~692835e608
dateFormat X
axisFormat %s
section baseline
no_agent (15.008 s) : 15008000, 15008000
. : milestone, 15008000,
appsec (14.753 s) : 14753000, 14753000
. : milestone, 14753000,
iast (18.656 s) : 18656000, 18656000
. : milestone, 18656000,
iast_GLOBAL (18.103 s) : 18103000, 18103000
. : milestone, 18103000,
profiling (15.64 s) : 15640000, 15640000
. : milestone, 15640000,
tracing (14.758 s) : 14758000, 14758000
. : milestone, 14758000,
section candidate
no_agent (15.405 s) : 15405000, 15405000
. : milestone, 15405000,
appsec (15.242 s) : 15242000, 15242000
. : milestone, 15242000,
iast (18.91 s) : 18910000, 18910000
. : milestone, 18910000,
iast_GLOBAL (18.116 s) : 18116000, 18116000
. : milestone, 18116000,
profiling (15.0 s) : 15000000, 15000000
. : milestone, 15000000,
tracing (14.882 s) : 14882000, 14882000
. : milestone, 14882000,
|
...tion/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/IastResultSetInstrumentation.java
Outdated
Show resolved
Hide resolved
dd-java-agent/agent-iast/src/test/groovy/com/datadog/iast/taint/RangesTest.groovy
Outdated
Show resolved
Hide resolved
...tion/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/IastResultSetInstrumentation.java
Outdated
Show resolved
Hide resolved
@Mariovido rebase the branch and resolve the conflicts in internal-api/src/main/java/datadog/trace/api/Config.java :) |
@jandro996 Solved the conflicts :) |
dd-trace-api/src/main/java/datadog/trace/api/config/IastConfig.java
Outdated
Show resolved
Hide resolved
dd-java-agent/instrumentation/jdbc/src/test/groovy/IastResultSetInstrumentationTest.groovy
Show resolved
Hide resolved
dd-java-agent/agent-iast/src/main/java/com/datadog/iast/sink/SinkModuleBase.java
Show resolved
Hide resolved
dd-java-agent/agent-iast/src/main/java/com/datadog/iast/model/VulnerabilityType.java
Show resolved
Hide resolved
dd-java-agent/agent-iast/src/main/java/com/datadog/iast/model/VulnerabilityType.java
Outdated
Show resolved
Hide resolved
dd-java-agent/agent-iast/src/main/java/com/datadog/iast/taint/Ranges.java
Outdated
Show resolved
Hide resolved
import java.util.function.BiFunction; | ||
import java.util.zip.CRC32; | ||
import javax.annotation.Nonnull; | ||
|
||
public interface VulnerabilityType { | ||
|
||
VulnerabilityType WEAK_CIPHER = type(VulnerabilityTypes.WEAK_CIPHER).build(); | ||
VulnerabilityType WEAK_HASH = type(VulnerabilityTypes.WEAK_HASH).build(); | ||
BitSet DB_EXCLUDED = new BitSet(SourceTypes.SQL_TABLE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually wrong, the parameter is the size in bits of the bitset (aka be the biggest bit we want to address)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in this PR #8212
What Does This Do
This PR introduces a solution to taint database values. The goal is to detect potential security vulnerabilities, specifically SQL Injection and XSS as a first step. Key changes include:
sql.row.value
ResultSet
methods that return aString
ResultSet
will be given by this environment variable:DD_IAST_DB_ROWS_TO_TAINT
(default1
)Motivation
This will increase the number of detections for the first two types of vulnerabilities (SQL Injection and XSS). Apart from that, this will improve our propagation taint tracking.
Additional Notes
See the RFC where this change is documented: RFC
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: APPSEC-55328