Skip to content

Conversation

@odaysec
Copy link

@odaysec odaysec commented May 23, 2025

data := fmt.Sprintf(`{
"transfer_requests": [
{
"transfer_request": {
"paths": %s,
"tags": {
"aspera": {
"node": {
"storage_credentials": %s
}
}
}
}
}
]
}
`, jsonPaths, credentials)

Fix the issue should avoid directly embedding jsonPaths into the data string using fmt.Sprintf. Instead, we can construct the JSON object in a structured manner using Go's native JSON handling capabilities. This approach ensures that all special characters are properly escaped and avoids the risk of injection.

Specifically:

  1. Replace the fmt.Sprintf construction of the data string with a structured approach using Go's map or struct types.
  2. Use json.Marshal to serialize the entire data object into a JSON string, ensuring proper escaping and formatting.

References

SQL injection
Command Injection
CWE-78
CWE-89
CWE-94

@odaysec
Copy link
Author

odaysec commented May 23, 2025

Signed-off-by: Zeroday BYTE [email protected]

@odaysec odaysec closed this by deleting the head repository Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant