Looking for the vulnerability index of Invicti's legacy products?
Lotus Notes formula injection - Vulnerability Database

Lotus Notes formula injection

Description

This vulnerability occurs when user-supplied input is passed directly to the LotusScript Evaluate() function without proper validation or sanitization. The Evaluate() function executes Lotus Notes Formula Language statements, and when untrusted input is included, attackers can inject malicious formula commands that will be executed by the server. This is analogous to SQL injection, but targets the Lotus Notes Formula Language instead of SQL databases.

Remediation

Implement strict input validation and sanitization for all user-supplied data before passing it to the Evaluate() function. Specifically:

1. Avoid using the Evaluate() function with user input whenever possible. Use alternative LotusScript methods that don't execute dynamic formulas.

2. If Evaluate() must be used, implement a whitelist approach that only allows specific, safe characters and rejects any formula metacharacters such as @, ;, [, ], {, }, and quotes.

3. Escape or remove special characters that have meaning in Lotus Notes Formula Language before processing user input.

4. Use parameterized approaches or predefined formula templates rather than concatenating user input directly into formula strings.

Example of vulnerable code:

Dim userInput As String
userInput = doc.FieldGetText("UserField")
result = Evaluate("@UpperCase(" & userInput & ")")
Safer alternative:
Dim userInput As String
userInput = doc.FieldGetText("UserField")
' Validate input contains only alphanumeric characters
If Not IsValidInput(userInput) Then
  ' Reject invalid input
  Exit Sub
End If
' Use LotusScript functions instead of Evaluate when possible
result = UCase(userInput)

References

Related Vulnerabilities