Skip to content
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

Email HTML Injection detection in IAST #8205

Open
wants to merge 60 commits into
base: master
Choose a base branch
from

Conversation

sezen-datadog
Copy link
Contributor

@sezen-datadog sezen-datadog commented Jan 15, 2025

What Does This Do

Controls the mails to detect tainted content for javax mail methods, in particular, Transport.send

Motivation

Email HTML injection is a vulnerability where user input is included in the content of an email without proper validation and sanitization. This vulnerability can have severe consequences as it opens the door for various attacks, including phishing, social engineering exploits, and the exploitation of email client vulnerabilities.

This modification provides a control of the body of the email that is meant to be sent. If an injection occurred in the mail body and no sanitization has taken place, the sink will raise an alert.

Jira ticket: APPSEC-56330

@sezen-datadog sezen-datadog added type: enhancement comp: asm iast Application Security Management (IAST) inst: java Core Java language instrumentation labels Jan 15, 2025
@smola smola removed the inst: java Core Java language instrumentation label Jan 15, 2025
@jandro996
Copy link
Member

jandro996 commented Jan 15, 2025

Nice work @sezen-datadog! you are in the right direction, we can discuss offline the caveats if you want 😃

My comments related to the new iast module can be extended if we need an Object instead of an String

Just in case no one had shared with you before, this is an interesting document when we need to implement new iast vulnerabilities

https://datadoghq.atlassian.net/wiki/spaces/APS/pages/3643539583/Adding+New+Vulnerability+Types+A+Practical+Guide

sezen-datadog and others added 3 commits January 16, 2025 14:53
…/trace/instrumentation/javax/mail/JavaxMailInstrumentation.java

Co-authored-by: Alejandro González García <[email protected]>
…/trace/instrumentation/javax/mail/JavaxMailInstrumentation.java

Co-authored-by: Alejandro González García <[email protected]>
@sezen-datadog
Copy link
Contributor Author

setContext and setText of Part
mimebodypart

StringEscapeUtilsCallsite

smola
smola previously requested changes Jan 22, 2025
dd-java-agent/instrumentation/javax-mail/build.gradle Outdated Show resolved Hide resolved
@sezen-datadog sezen-datadog marked this pull request as draft January 22, 2025 13:54
@sezen-datadog sezen-datadog marked this pull request as ready for review January 28, 2025 08:23
@sezen-datadog sezen-datadog marked this pull request as draft January 28, 2025 10:07
@sezen-datadog sezen-datadog marked this pull request as ready for review January 28, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: asm iast Application Security Management (IAST) type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants