# Unsanitized user input in 'eval' type function

## Overview

* **Rule ID**: `java_lang_eval_using_user_input`
* **Applicable Languages**: Java
* **Weakness ID**: CWE-95

## Description

Using 'eval' or similar functions with unsanitized user input poses a significant security risk. This can result in command injection attacks, enabling attackers to execute arbitrary code within your application.

## Remediation Guidelines

* **Avoid** using `eval` or similar functions with user-supplied data, as this can make your application vulnerable to severe security risks.
* **Always validate** and sanitize all user input before incorporating it into your code, ensuring inputs comply with a strict set of rules.
* **Opt** for safer alternatives to `eval` for dynamic code execution needs, using functions that do not run user-supplied data as code.

## References

* [**OWASP Code injection explained**](https://owasp.org/www-community/attacks/Code_Injection)
* [**CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')**](https://cwe.mitre.org/data/definitions/95.html)
* [**OWASP Top 10: A03:2021 - Injection**](https://owasp.org/Top10/A03_2021-Injection/)

## Configuration

To omit this rule during a scan, and to provide you with continuous 24/7 code-level scanning, you can employ our [**SAST TOOL**](https://scopy.sec1.io/login)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sec1.io/user-docs/4-sast/2-java/unsanitized-user-input-in-eval-type-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
