-
Notifications
You must be signed in to change notification settings - Fork 291
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 XSS support for JSP #6944
Add XSS support for JSP #6944
Conversation
...et/src/main/java/datadog/trace/instrumentation/servlet/jsp/IastJspWriterInstrumentation.java
Outdated
Show resolved
Hide resolved
...et/src/main/java/datadog/trace/instrumentation/servlet/jsp/IastJspWriterInstrumentation.java
Outdated
Show resolved
Hide resolved
...et/src/main/java/datadog/trace/instrumentation/servlet/jsp/IastJspWriterInstrumentation.java
Outdated
Show resolved
Hide resolved
...et/src/main/java/datadog/trace/instrumentation/servlet/jsp/IastJspWriterInstrumentation.java
Outdated
Show resolved
Hide resolved
96e85d0
to
6a5f885
Compare
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 49 metrics, 14 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.35.0-SNAPSHOT~75a330fd71, baseline=1.35.0-SNAPSHOT~0946fa5eba
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.076 s) : 0, 1076037
Total [baseline] (8.547 s) : 0, 8546640
Agent [candidate] (1.077 s) : 0, 1077068
Total [candidate] (8.542 s) : 0, 8541740
section iast
Agent [baseline] (1.2 s) : 0, 1200418
Total [baseline] (9.006 s) : 0, 9005705
Agent [candidate] (1.207 s) : 0, 1206784
Total [candidate] (9.047 s) : 0, 9047087
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.202 s) : 0, 1202298
Total [baseline] (8.985 s) : 0, 8984716
Agent [candidate] (1.215 s) : 0, 1215364
Total [candidate] (9.038 s) : 0, 9037974
section iast_TELEMETRY_OFF
Agent [baseline] (1.197 s) : 0, 1197492
Total [baseline] (9.008 s) : 0, 9007821
Agent [candidate] (1.203 s) : 0, 1203351
Total [candidate] (9.023 s) : 0, 9023427
gantt
title insecure-bank - break down per module: candidate=1.35.0-SNAPSHOT~75a330fd71, baseline=1.35.0-SNAPSHOT~0946fa5eba
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (673.479 ms) : 0, 673479
BytebuddyAgent [candidate] (674.118 ms) : 0, 674118
GlobalTracer [baseline] (310.574 ms) : 0, 310574
GlobalTracer [candidate] (310.562 ms) : 0, 310562
AppSec [baseline] (49.373 ms) : 0, 49373
AppSec [candidate] (49.759 ms) : 0, 49759
Remote Config [baseline] (664.845 µs) : 0, 665
Remote Config [candidate] (662.074 µs) : 0, 662
Telemetry [baseline] (7.606 ms) : 0, 7606
Telemetry [candidate] (7.597 ms) : 0, 7597
section iast
BytebuddyAgent [baseline] (793.587 ms) : 0, 793587
BytebuddyAgent [candidate] (799.404 ms) : 0, 799404
GlobalTracer [baseline] (290.307 ms) : 0, 290307
GlobalTracer [candidate] (290.956 ms) : 0, 290956
AppSec [baseline] (51.452 ms) : 0, 51452
AppSec [candidate] (51.678 ms) : 0, 51678
IAST [baseline] (23.575 ms) : 0, 23575
IAST [candidate] (22.259 ms) : 0, 22259
Remote Config [baseline] (590.116 µs) : 0, 590
Remote Config [candidate] (561.436 µs) : 0, 561
Telemetry [baseline] (6.569 ms) : 0, 6569
Telemetry [candidate] (7.332 ms) : 0, 7332
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (795.249 ms) : 0, 795249
BytebuddyAgent [candidate] (804.061 ms) : 0, 804061
GlobalTracer [baseline] (290.62 ms) : 0, 290620
GlobalTracer [candidate] (293.423 ms) : 0, 293423
AppSec [baseline] (49.555 ms) : 0, 49555
AppSec [candidate] (51.288 ms) : 0, 51288
IAST [baseline] (24.526 ms) : 0, 24526
IAST [candidate] (24.436 ms) : 0, 24436
Remote Config [baseline] (1.326 ms) : 0, 1326
Remote Config [candidate] (585.911 µs) : 0, 586
Telemetry [baseline] (6.679 ms) : 0, 6679
Telemetry [candidate] (6.729 ms) : 0, 6729
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (790.618 ms) : 0, 790618
BytebuddyAgent [candidate] (794.802 ms) : 0, 794802
GlobalTracer [baseline] (290.258 ms) : 0, 290258
GlobalTracer [candidate] (291.856 ms) : 0, 291856
AppSec [baseline] (48.946 ms) : 0, 48946
AppSec [candidate] (49.707 ms) : 0, 49707
IAST [baseline] (25.464 ms) : 0, 25464
IAST [candidate] (25.511 ms) : 0, 25511
Remote Config [baseline] (596.832 µs) : 0, 597
Remote Config [candidate] (612.926 µs) : 0, 613
Telemetry [baseline] (7.275 ms) : 0, 7275
Telemetry [candidate] (6.505 ms) : 0, 6505
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.35.0-SNAPSHOT~75a330fd71, baseline=1.35.0-SNAPSHOT~0946fa5eba
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.085 s) : 0, 1084621
Total [baseline] (10.347 s) : 0, 10346879
Agent [candidate] (1.078 s) : 0, 1078113
Total [candidate] (10.41 s) : 0, 10409834
section appsec
Agent [baseline] (1.198 s) : 0, 1197810
Total [baseline] (10.522 s) : 0, 10522095
Agent [candidate] (1.193 s) : 0, 1192659
Total [candidate] (10.471 s) : 0, 10471410
section iast
Agent [baseline] (1.201 s) : 0, 1201323
Total [baseline] (10.722 s) : 0, 10721926
Agent [candidate] (1.219 s) : 0, 1219117
Total [candidate] (10.748 s) : 0, 10748194
section profiling
Agent [baseline] (1.267 s) : 0, 1266782
Total [baseline] (10.571 s) : 0, 10570609
Agent [candidate] (1.273 s) : 0, 1272573
Total [candidate] (10.684 s) : 0, 10684170
gantt
title petclinic - break down per module: candidate=1.35.0-SNAPSHOT~75a330fd71, baseline=1.35.0-SNAPSHOT~0946fa5eba
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (679.217 ms) : 0, 679217
BytebuddyAgent [candidate] (674.887 ms) : 0, 674887
GlobalTracer [baseline] (312.826 ms) : 0, 312826
GlobalTracer [candidate] (311.172 ms) : 0, 311172
AppSec [baseline] (49.639 ms) : 0, 49639
AppSec [candidate] (49.307 ms) : 0, 49307
Remote Config [baseline] (663.881 µs) : 0, 664
Remote Config [candidate] (655.822 µs) : 0, 656
Telemetry [baseline] (7.626 ms) : 0, 7626
Telemetry [candidate] (7.645 ms) : 0, 7645
section appsec
BytebuddyAgent [baseline] (698.736 ms) : 0, 698736
BytebuddyAgent [candidate] (696.574 ms) : 0, 696574
GlobalTracer [baseline] (294.186 ms) : 0, 294186
GlobalTracer [candidate] (293.989 ms) : 0, 293989
AppSec [baseline] (152.554 ms) : 0, 152554
AppSec [candidate] (149.333 ms) : 0, 149333
IAST [baseline] (19.329 ms) : 0, 19329
IAST [candidate] (19.291 ms) : 0, 19291
Remote Config [baseline] (620.905 µs) : 0, 621
Remote Config [candidate] (618.03 µs) : 0, 618
Telemetry [baseline] (7.532 ms) : 0, 7532
Telemetry [candidate] (8.112 ms) : 0, 8112
section iast
BytebuddyAgent [baseline] (793.446 ms) : 0, 793446
BytebuddyAgent [candidate] (807.681 ms) : 0, 807681
GlobalTracer [baseline] (290.911 ms) : 0, 290911
GlobalTracer [candidate] (294.642 ms) : 0, 294642
AppSec [baseline] (49.534 ms) : 0, 49534
AppSec [candidate] (52.409 ms) : 0, 52409
IAST [baseline] (25.09 ms) : 0, 25090
IAST [candidate] (22.253 ms) : 0, 22253
Remote Config [baseline] (1.356 ms) : 0, 1356
Remote Config [candidate] (569.512 µs) : 0, 570
Telemetry [baseline] (6.626 ms) : 0, 6626
Telemetry [candidate] (6.65 ms) : 0, 6650
section profiling
BytebuddyAgent [baseline] (676.142 ms) : 0, 676142
BytebuddyAgent [candidate] (679.473 ms) : 0, 679473
GlobalTracer [baseline] (380.813 ms) : 0, 380813
GlobalTracer [candidate] (381.868 ms) : 0, 381868
AppSec [baseline] (50.139 ms) : 0, 50139
AppSec [candidate] (50.278 ms) : 0, 50278
Remote Config [baseline] (727.349 µs) : 0, 727
Remote Config [candidate] (708.947 µs) : 0, 709
Telemetry [baseline] (7.453 ms) : 0, 7453
Telemetry [candidate] (7.468 ms) : 0, 7468
ProfilingAgent [baseline] (95.138 ms) : 0, 95138
ProfilingAgent [candidate] (96.254 ms) : 0, 96254
Profiling [baseline] (95.162 ms) : 0, 95162
Profiling [candidate] (96.278 ms) : 0, 96278
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 insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.35.0-SNAPSHOT~75a330fd71, baseline=1.35.0-SNAPSHOT~0946fa5eba
dateFormat X
axisFormat %s
section baseline
no_agent (364.652 µs) : 345, 384
. : milestone, 365,
iast (465.15 µs) : 445, 486
. : milestone, 465,
iast_FULL (538.266 µs) : 517, 559
. : milestone, 538,
iast_GLOBAL (489.554 µs) : 469, 510
. : milestone, 490,
iast_HARDCODED_SECRET_DISABLED (467.339 µs) : 446, 488
. : milestone, 467,
iast_INACTIVE (440.721 µs) : 420, 461
. : milestone, 441,
iast_TELEMETRY_OFF (463.089 µs) : 442, 484
. : milestone, 463,
tracing (442.086 µs) : 422, 463
. : milestone, 442,
section candidate
no_agent (361.961 µs) : 342, 382
. : milestone, 362,
iast (485.502 µs) : 464, 507
. : milestone, 486,
iast_FULL (552.278 µs) : 531, 574
. : milestone, 552,
iast_GLOBAL (507.764 µs) : 486, 530
. : milestone, 508,
iast_HARDCODED_SECRET_DISABLED (474.829 µs) : 454, 496
. : milestone, 475,
iast_INACTIVE (453.16 µs) : 432, 474
. : milestone, 453,
iast_TELEMETRY_OFF (465.442 µs) : 444, 487
. : milestone, 465,
tracing (443.931 µs) : 423, 465
. : milestone, 444,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.35.0-SNAPSHOT~75a330fd71, baseline=1.35.0-SNAPSHOT~0946fa5eba
dateFormat X
axisFormat %s
section baseline
no_agent (1.339 ms) : 1320, 1358
. : milestone, 1339,
appsec (1.722 ms) : 1699, 1746
. : milestone, 1722,
appsec_no_iast (1.692 ms) : 1667, 1716
. : milestone, 1692,
iast (1.473 ms) : 1450, 1497
. : milestone, 1473,
profiling (1.496 ms) : 1472, 1520
. : milestone, 1496,
tracing (1.459 ms) : 1435, 1484
. : milestone, 1459,
section candidate
no_agent (1.344 ms) : 1325, 1364
. : milestone, 1344,
appsec (1.718 ms) : 1695, 1741
. : milestone, 1718,
appsec_no_iast (1.72 ms) : 1696, 1744
. : milestone, 1720,
iast (1.474 ms) : 1450, 1497
. : milestone, 1474,
profiling (1.555 ms) : 1530, 1581
. : milestone, 1555,
tracing (1.477 ms) : 1453, 1501
. : milestone, 1477,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 1 performance regressions! Performance is the same for 11 metrics, 0 unstable metrics.
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.35.0-SNAPSHOT~75a330fd71, baseline=1.35.0-SNAPSHOT~0946fa5eba
dateFormat X
axisFormat %s
section baseline
no_agent (1.458 ms) : 1447, 1469
. : milestone, 1458,
appsec (2.206 ms) : 2171, 2240
. : milestone, 2206,
iast (1.886 ms) : 1850, 1921
. : milestone, 1886,
iast_GLOBAL (1.908 ms) : 1873, 1944
. : milestone, 1908,
profiling (1.848 ms) : 1815, 1880
. : milestone, 1848,
tracing (1.834 ms) : 1802, 1866
. : milestone, 1834,
section candidate
no_agent (1.457 ms) : 1445, 1468
. : milestone, 1457,
appsec (2.208 ms) : 2173, 2243
. : milestone, 2208,
iast (1.949 ms) : 1909, 1990
. : milestone, 1949,
iast_GLOBAL (1.993 ms) : 1953, 2034
. : milestone, 1993,
profiling (1.841 ms) : 1807, 1876
. : milestone, 1841,
tracing (1.821 ms) : 1790, 1853
. : milestone, 1821,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.35.0-SNAPSHOT~75a330fd71, baseline=1.35.0-SNAPSHOT~0946fa5eba
dateFormat X
axisFormat %s
section baseline
no_agent (15.124 s) : 15124000, 15124000
. : milestone, 15124000,
appsec (15.166 s) : 15166000, 15166000
. : milestone, 15166000,
iast (18.723 s) : 18723000, 18723000
. : milestone, 18723000,
iast_GLOBAL (17.943 s) : 17943000, 17943000
. : milestone, 17943000,
profiling (14.904 s) : 14904000, 14904000
. : milestone, 14904000,
tracing (14.919 s) : 14919000, 14919000
. : milestone, 14919000,
section candidate
no_agent (15.043 s) : 15043000, 15043000
. : milestone, 15043000,
appsec (15.183 s) : 15183000, 15183000
. : milestone, 15183000,
iast (18.829 s) : 18829000, 18829000
. : milestone, 18829000,
iast_GLOBAL (17.63 s) : 17630000, 17630000
. : milestone, 17630000,
profiling (14.755 s) : 14755000, 14755000
. : milestone, 14755000,
tracing (15.191 s) : 15191000, 15191000
. : milestone, 15191000,
|
efb1441
to
02641ec
Compare
183a51c
to
ae313e3
Compare
@CallSite.Before("void jakarta.servlet.jsp.JspWriter.println(char[])") | ||
@CallSite.Before("void jakarta.servlet.jsp.JspWriter.write(char[])") | ||
@CallSite.Before("void jakarta.servlet.jsp.JspWriter.write(char[], int, int)") | ||
public static void beforeCharArrayParam(@CallSite.Argument(0) @Nonnull final char[] buf) { |
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 should only be enabled in full detection mode, check datadog.trace.instrumentation.java.lang.StringFullDetectionCallSite
@CallSite.Before("void javax.servlet.jsp.JspWriter.print(java.lang.String)") | ||
@CallSite.Before("void javax.servlet.jsp.JspWriter.println(java.lang.String)") | ||
@CallSite.Before("void javax.servlet.jsp.JspWriter.write(java.lang.String)") | ||
@CallSite.Before("void javax.servlet.jsp.JspWriter.write(java.lang.String, int, int)") |
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.
For this kind of methods you need the offset and length to check if the range is actually tainted (maybe there's no intersection so there is indeed no XSS).
Are the write
methods inherited from Writer
used by the compilation of JSPs? (maybe we can skip them altogether and remove the problem)
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.
Thanks for the advice! I think that the offset methods are not used in JSP, I will remove the callSites for this PR
What Does This Do
Add instrumentation to call XSS module:
Add smoke tests
Motivation
Being able to report XSS vulnerabilities in JSP
Additional Notes
Jira ticket: APPSEC-16777