Rust Dynamodb Nosql Injection
Description
This detector identifies NoSQL injection vulnerabilities in Rust applications using AWS DynamoDB. It finds locations where user-controlled data from Actix Web requests is directly used in DynamoDB expressions without proper sanitization, allowing attackers to manipulate database queries and potentially access or modify unauthorized data.
Detection Strategy
• The code must import both AWS SDK DynamoDB library (aws_sdk_dynamodb) and Actix Web framework (actix_web)
• The detector scans for vulnerable DynamoDB expression patterns where user input flows into database query expressions
• A vulnerability is reported when user-controlled data from web requests is used directly in DynamoDB operations without proper validation or parameterization
Vulnerable code example
use aws_sdk_dynamodb::Client;
use aws_sdk_dynamodb::types::AttributeValue;
use std::collections::HashMap;
// DynamoDB Expression Injection vulnerability
async fn vulnerable_dynamodb_query(
client: &Client,
user_input: &str,...✅ Secure code example
use aws_sdk_dynamodb::Client;
use aws_sdk_dynamodb::types::AttributeValue;
use std::collections::HashMap;
// FIXED: Using parameterized expressions to prevent injection
async fn safe_dynamodb_query(
client: &Client,
user_input: &str,...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.