1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
On Error Resume Next
'Dim objFirewall
'Set objFirewall = CreateObject("HNetCfg.FwMgr")
strComputer = "."
Set Reg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Reg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", OSTYPE
' Si pas XP=>FIN
If OSTYPE <> "Microsoft Windows XP" Then
msgbox OSTYPE
End if
'Restriction anonymous
'Windows XP/2000 présentent une faille dans la confiance qu'il accorde aux protocoles CIFS/ SMB
'et netbios, Ceci permettant un hack par connexion nulle !
'Ces protocoles comprennent des API qui donnent des informations
'sur le poste via le port 139 netbios, et ce même à des utilisateurs non identifiés.
'La première étape de l'accès à distance de ces API consiste justement à créer
'une connexion non authentifiée sur un système XP ou 2000 en utilisant
'une commande de "connexion nulle " dans l'hypothèse ou le port TCP 139
's'est révélé actif lors d'un scan de port.
'En cas de succès, l'attaquant peut alors disposer d'un canal ouvert par le biais duquel il peut exploiter pour piller un maximum d'informations
'( réseau, ressources partagées, registres etc...)
'Un mécanisme permet d'empêcher tout action de prises d'informations
'sensibles par les connexions nulles en désactivant SMB.
'Ce mécanisme s'appelle "RestrictAnonymous"
'1 pour XP et 2 pour Windows 2000
RestrictAnonymous = Reg.GetDWORDValue(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\L sa", "RestrictAnonymous" )
If RestrictAnonymous = 0 Then
intReturn = Reg.SetDWORDValue(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\L sa", "RestrictAnonymous", 1)
End If
'Activation du partage avancé
ForceGuest = Reg.GetDWORDValue(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\L sa", "ForceGuest" )
If ForceGuest = 1 Then
intReturn = Reg.SetDWORDValue(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\L sa", "ForceGuest", 0)
End If
'Vérification du service pack2 et désactivation du Firewall
ServicePackType = Reg.GetStringValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDVersion" )
If (ServicePackType = "Service Pack 2" And OSTYPE = "Microsoft Windows XP" ) Then
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
objPolicy.FirewallEnabled = False
End If
AutoShareWks = Reg.GetDWORDValue(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\ lanmanserver\parameters", "AutoShareWks" )
If AutoShareWks = 0 Then
intReturn = Reg.SetDWORDValue(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\ lanmanserver\parameters", "AutoShareWks", 1)
Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2" ).ExecQuery("select * from Win32_OperatingSystem where Primary=true" )
For Each OpSys In OpSysSet
Call OpSys.Win32Shutdown(6) ' 6 force reboot, 7 reboot simple.
Next
End If
Err.Clear |
Partager