PCFreak Logo (c) Der PCFreak

Archive for the 'Windows' Category


Google-Authenticator – a nice and flexible tool! 0

I recently wrote a lot of documentation about the Google-Authenticator, how to use it with PAM or RADIUS and how to implement a Freeradius-Proxy to be able to use Google-Authenticator in addition to your current RADIUS setup.

Feel free to take a look at my public Wiki to read more about:

Here are some nice screenshots to the above contents:

Google-Authenticator iPhone App

Custom Webmin Module for Google-Authenticator

Different Windows Clients

 

VirtualBox VRDP Verbindung klappt nicht 0

Ich bin hier unter Windows 7 Professional (64bit) auf ein kleines Problem gestoßen und zwar habe ich hier mit VirtualBox eine virtuelle Maschine am Laufen, die per NAT ans Netzwerk angeschlossen ist. Ich habe das VRDP aktiviert und  den Port 3390 gewählt, damit sich VRDP nicht mit meinem lokalen Port 3389 in die Haare kommt.

Trotz dieser Vorkehrungen konnte ich von der physikalischen Maschine (Win7) nicht per RDP in die virtuelle Maschine verbinden (127.0.0.1). Windows 7 bringt dabei immer die Fehlermeldung, dass man bereits eine Verbindung hätte: “Your computer could not connect to another console session on the remote computer because you already have a console session in progress.”

Da ich die Netzwerkkarte der virtuellen Maschine im sogenannten “NAT-Modus” betreibe, dachte ich eine Verbindung auf 127.0.0.1 auf Port 3390 sollte klappen, weit gefehlt. Windows 7 bemerkt, dass man eine RDP-Verbindung auf den eigenen Rechner machen möchte und bricht mit obiger Fehlermeldung ab. – Was kann man tun?

Die Lösung ist ganz einfach, man benutzt anstatt der Adresse 127.0.0.1 (localhost) einfach die Adresse 127.0.0.2 und schon klappts. Endlich wieder saubere RDP-Verbindungen in die virtuellen Maschinen aufbauen!

Audiograbber und Mp3Tag unter Linux 0

Audiograbber und Mp3tag sind meiner Meinung nach zwei Programme, die man im Umgang mit MP3-Dateien unbedingt benötigt. Mit Audiograbber kann man aus Musik-CDs oder Musikdateien MP3-Dateien erstellen. Mp3tag ist ein sehr komfortables Programm, um die Tags der MP3-Dateien zu ändern, MP3-Dateien umzubenennen uvm.

Da ich mittlerweile privat fast ausschließlich mit Linux arbeite, mir die obigen Programme jedoch sehr ans Herz gewachsen sind, hier eine kurze Anleitung wie man diese Programme mit WINE unter Linux (in meinem Fall Kubuntu 11.10) problemlos zum Laufen bekommt.

Zunächst benötigen wir die Setup-Dateien für Audiograbber, Mp3tag und das Lame-Plugin für Mp3tag, diese gibt es über die Homepages der beiden Tools:

  Audiograbber http://www.audiograbber.de
  Mp3tag http://www.mp3tag.de/

Im Detail sind das dann folgende Dateien:

Audiograbber
agsetup183se.exe

Lame Plugin für Audiograbber
lameplugin_setupX86.exe oder lameplugin_setupX64.exe

Mp3tag
mp3tagv250setup.exe

Um die obigen Windows Programme unter Linux zu installieren muss zunächst WINE installiert werden. Mit WINE können viele Windows Programme unter Linux installiert und ausgeführt werden.

Der Befehl

  sudo apt-get install wine

in einem Terminal installiert WINE

WINE arbeitet mit sogenannten “Flaschen”, man kann sich diese “Flaschen” als jeweils separate Windows-Instanzen vorstellen. Dadurch ist es z.B. möglich, 2 Windows-Programme, die sich nicht “vertragen” in jeweils separate “Flaschen” zu installieren oder mehrere Windows-Programme die sich untereinander nicht beeinflussen in eine “Flasche” zu packen. Ich trenne meine “Flaschen” gerne nach Aufgabengebiet. Da sich Audiograbber und Mp3tag problemlos vertragen, möchte ich sie beide in eine “Flasche” installieren. Diese “Flasche” soll im Ordner /home/pcfreak/winprogs/mp3 liegen, also lege ich diesen Ordner mit folgendem Befehl in einem Terminal an:

  mkdir -p /home/pcfreak/winprogs/mp3

Um WINE mitzuteilen, dass es den soeben angelegten Ordner als Ordner für eine “Flasche” benutzen soll, muss man die Variable WINEPREFIX vor der Installation von Programmen definieren. Folgender Befehl übernimmt dies für den soeben angelegten Ordner:

  export WINEPREFIX=/home/pcfreak/winprogs/mp3

Nun können wir mit der Installation beginnen. Wir beginnen mit Mp3tag. Die Befehle werden wieder in einem Terminal eingegeben und wenn das grafische Setup von Mp3tag startet, bedienen wir es wie wenn wir das Programm unter Windows installieren würden.

Mit der auf dem Desktop erstellten Verknüpfung kann man nun Mp3tag starten. Wer das Ganze noch mit einem schönen Icon versehen möchte, der muss eben selbst Hand anlegen und für die Desktop-Verknüpfung schnell mit The Gimp ein Symbol erstellen.

Da wir nun wissen, wie man ein Windows-Programm mittels WINE installiert, führen wir nun die Installation von Audiograbber und dem Lame-Mp3-Plugin auf die gleiche Weise durch:

Nun noch das Lame-Plugin für Audiograbber:

Auch für Audiograbber habe ich mir selbst ein Symbol erstellt und es für die Desktop-Verknüpfung verwendet:

Beide Programme lassen sich nun problemlos vom Kubuntu Desktop starten und verwenden!

Beide Programme funktionieren wirklich einwandfrei. Mit Audiograbber kann problemlos aus WINE heraus das CD-Rom zum “grabben” von Audio angesprochen werden. Innerhalb der Windows-Programme stehen die wichtigsten Ordner als Links zu den Ordnern in Kubuntu (Musik, Bilder usw.) bereit, sodass man sich schnell zurechtfindet.

Top Screenshot und Screenrecording Software 1

Ich möchte kurz auf ein super Programm hinweisen, welches mir von meinem Arbeitskollegen empfohlen wurde. Ich bin total begeisert. Das besagte Programm heißt Screenpresso und ist für Windows.
Man kann damit nicht nur Screenshots machen, sondern auch Videos (Freeversion nur 20 Sekunden). Nahezu alle Funktionen sind uneingeschränkt privat und kommerziell nutzbar. Hier sind die Features aufgelistet und die Free- und Proversion gegenübergestellt.

Hier das Feature Video auf Youtube.


Endlich mal eine Software die sehr viele Funktionen aufgeräumt und mit einem tollen UI unter einen Hut bekommt.

Ich habe mir Screenpresso Pro bestellt, da ich die Videofunktion sehr gut gebrauchen kann!

PAExec – PsExec zum Verteilen 0

Fast jeder Administrator kennt das Tool PsExec von Sysinternals (Mark Russinovich). Es hat leider 2 störende Probleme:

  • man darf es nicht mit eigenen Programmen distributieren
  • Benutzernamen und Passwörter werden im Klartext übergeben

Abhilfe schafft das kleine Programm PAExec, welches von jedermann heruntegeladen werden kann und explizit in OpenSource, Freeware und sogar kommerziellen Produkten eingesetzt werden darf.

PAExec kann hier heruntergeladen werden: http://www.poweradmin.com/PAExec/

Hier die Hilfe zum Programm:

Usage: PAExec [\\computer[,computer2[,...] | @file]][-u user [-p psswd][-n s][-l]
[-s|-e][-x][-i [session]][-c [-f|-v] [-csrc path]][-lo path][-rlo path][-ods]
[-w directory][-d][-][-a n,n,...][-dfr] cmd [arguments]

Standard PAExec\PsExec command line options:

-a Separate processors on which the application can run with commas where 1 is the lowest numbered CPU. For example, to run the application on CPU 2 and CPU 4, enter:
-a 2,4
-c Copy the specified program to the remote system for execution. If you omit this option the application must be in the system path on the remote system.
-d Don’t wait for process to terminate (non-interactive).
-e Does not load the specified account’s profile.
-f Copy the specified program even if the file already exists on the remote system.
-i Run the program so that it interacts with the desktop of the specified session on the specified system. If no session is specified the process runs in the console session.
-h [NOT IMPLEMENTED] If the target system is Vista or higher, has the process run with the account’s elevated token, if available.
-l [EXPERIMENTAL] Run process as limited user (strips the Administrators group and allows only privileges assigned to the Users group). On Windows Vista the process runs with Low Integrity.
-n Specifies timeout in seconds connecting to remote computers.
-p Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.
-s Run the process in the System account.
-u Specifies optional user name for login to remote computer.
-v Copy the specified file only if it has a higher version number or is newer on than the one on the remote system.
-w Set the working directory of the process (relative to remote computer).
-x Display the UI on the Winlogon secure desktop (local system only).
-priority Specifies -low, -belownormal, -abovenormal, -high or -realtime to run the process at a different priority. Use -background to run at low memory and I/O priority on Vista.
computer Direct PAExec to run the application on the remote computer or computers specified. If you omit the computer name PAExec runs the application on the local system, and if you specify a wildcard (\\*), PAExec runs the command on all computers in the current domain.
@file PAExec will execute the command on each of the computers listed in the file.
program Name of application to execute.
arguments Arguments to pass (note that file paths must be absolute paths on the target system).

Additional options only available in PAExec:

-cnodel If a file is copied to the server with -c, it is normally deleted (unless -d is specified). -cnodel indicates the file should not be deleted.
-csrc When using -c (copy), -csrc allows you to specify an alternate path to copy the program from. Example: -c -csrc “C:\test path\file.exe”
-dbg Output to DebugView (OutputDebugString)
-dfr Disable WOW64 File Redirection when launching the new process
-lo Log Output to file. Ex: -lo C:\Temp\PAExec.log
The file will be UTF-8 with a Byte Order Mark at the beginning.
-rlo Remote Log Output: Log from remote service to file (on remote server).
Ex: -rlo C:\Temp\PAExec.log
The file will be UTF-8 with a Byte Order Mark at the beginning.

The application name, copy source, working directory and log file entries can be quoted if the path contains a space. For example:
PAExec \\test-server -w “C:\path with space” “C:\program files\app.exe”

Input is sent to the remote system when Enter is pressed, and Ctrl-C stops the remote process and stops PAExec.

PsExec passes all parameters in clear-text. In contrast, PAExec will scramble the parameters to protect them from casual wire sniffers, but they are NOT encrypted. Note that data passed between PAExec and the remote program is NOT scrambled or encrypted — the same as with PsExec.

PAExec will return the error code it receives from the application that was launched remotely. If PAExec itself has an error, the return code will be one of:
-1 = internal error
-2 = command line error
-3 = failed to launch app (locally)
-4 = failed to copy PAExec to remote (connection to ADMIN$ might have failed)
-5 = connection to server taking too long (timeout)
-6 = PAExec service could not be installed/started on remote server
-7 = could not communicate with remote PAExec service
-8 = failed to copy app to remote server

Windows 7 Profilordner komplett auf anderes Laufwerk legen 1

Junction to moved user folder

Windows 7 unterstützt wie seine Vorgänger die Option, z.B. den Ordner für Eigene Dateien in der grafischen Benutzeroberfläche zu verschieben. Da im Benutzerprofil (z.B. C:\Users\<benutzername> aber auch viele Konfigurationsdateien für Anwendungen liegen, diese jedoch nicht so einfach verschoben werden können, hier kurz ein Weg, wie es trotzdem klappt.

  1. Mit der Windows 7 CD in den Wiederherstellungskonsole booten und die Eingabeaufforderung wählen
  2. Feststellen, auf welchem Laufwerksbuchstaben NUN das installierte Windows liegt, in meinem Fall war es D:\
  3. Feststellen, auf welches Laufwerk wir die Benutzerprofile verschieben wollen, in meinem Fall war es E:\
  4. Mit robocopy die Profile kopieren
    robocopy D:\Users E:\Users /mir /xj /copyall
    (/xj ist extrem wichtig, dadurch werden Junction Points NICHT mitkopiert)
  5. Sicherstellen, dass die Dateien erfolgreich kopiert wurden
  6. C:\User umbenennen in C:\Users.bck (REN C:\Users C:\Users.bck)
  7. Link anlegen
    Hier ist wichtig, dass man den späteren Ort (wenn Windows 7 wieder normal gebootet hat) als Ziel angibt, bei mir z.B.
    MKLINK D:\Users D:\Users
    weil im Moment (Wiederherstellungskonsole) C:\Users auf D:\Users liegt, jedoch bei gebootetem Windows auch wieder
    auf D:\Users zeigen soll!
  8. Wiederherstellungskonsole verlassen und Windows 7 wieder normal booten.
  9. Wenn die Anmeldung klappt, hat es funktioniert, ansonsten zurück in die Wiederherstellungskonsole und weiter üben!
  10. Den Ordner C:\Users.bck löschen.

Windows 7 Bootzeiten drastisch reduzieren 0

Windows 7 hat eine interne Optimierung, die mitunter die Bootzeiten drastisch reduziert. Leider kann es je nach Auslastung des Systems vorkommen, dass Windows diese Optimierung nie durchführt, da vor allem sehr ausgelastete Systeme eben nie “idle” sind. Hier hilft es weiter, diesen Prozess manuell anzustarten:

  start /wait Rundll32.exe advapi32.dll,ProcessIdleTasks

Nach einiger Wartezeit startet das System merklich schneller! Es empfielt sich übrigens auch, diesen Befehl auch vor dem Imagen einer Musterinstallation abzusetzen um allen zukünftigen Nutzern des Images bereits von Anfang an schnelle Bootzeiten zu ermöglichen.

Eine weitere Bremse können Netzlaufwerke sein.
Es kursiert das Gerücht, dass folgender Registry Key:

  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
  DWORD 32bit
  NoNetCrawling = 1

die Bootzeiten drastisch beschleunigen soll, leider ist das Gegenteil der Fall, Windows 7 bootet damit sogar noch langsamer, also einfach vergessen!

Stattdessen folgenden Registry-Key setzen, dieser stellt ein, dass Netzlaufwerke erst dann wieder verbunden werden, wenn man sie nutzt:

  HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider
  DWORD (32bit)
  RestoreConnection = 0

Probiert es einfach mal aus, die obigen 2 Tipps beschleunigen den Bootvorgang wirklich!

Fehlender Schlüssel HKCU\Software\Classes – ACCESS DENIED 0

Ich hatte das Problem, dass bei einem Windows 7 System der Schlüssel “HKEY_CURRENT_USER\Software\Classes” nicht zugänglich war. Aufgefallen ist das aber erst bei der Installation eines neuen Programms. Da ich wegen der Fehleranalyse sowieso schon den Process Monitor von Sysinternals angeworfen hatte, dache ich mir, das Problem wirst du jetzt lösen.

Zunächst aber ein paar Hintergrundinformationen:

“HKEY_CURRENT_USER\Software\Classes” ist kein Registry-Schlüssel sondern ein Registry-Link, der beim Anmelden des Benutzers durch die “Winlogon.exe” erzeugt wird. Das kann man ganz leicht nachprüfen, da sich in der Datei “ntuser.dat” (ruhig mal von einem anderen Account aus als Hive laden) dieser Schlüssel nicht befindet.

Der Registry Link “HKEY_CURRENT_USER\Software\Classes” zeigt eigentlich auf “HKEY_USERS\<user-SID>_Classes”. “HKEY_USERS\<user-SID>_Classes” wiederum kommt aus der Datei “%userprofile%\AppData\Local\Microsoft\Windows\UsrClass.dat”.

Nun also zurück zu meinem Problem:
Bei meinem Benutzeraccount fehlten sämtliche Unterschlüssel von “HKEY_CURRENT_USER\Software\Classes”. Der Schlüssel “HKEY_USERS\<user-SID>_Classes” für diesen Benutzer war aber vorhanden und konnte mit einem administrativen Account eingesehen werden.

Ich vermutete ein Rechte-Problem und habe (während ich mit Process Monitor die Registry auf ACCESS_DENIED prüfte) einfach mal im Schlüssel “HKEY_USERS\<user-SID>_Classes” versucht, die Berechtigungen komplett durchzuvererben.

Tatsächlich spuckte der Process Monitor bei einigen Schlüsseln einen “ACCESS_DENIED”-Fehler aus. In meinem Fall waren es einige Schlüssel unterhalb von “HKEY_USERS\<user-SID>_Classes\VirtualStore\MACHINE\SOFTWARE\Wow6432Node”.

Für die betroffenen Schlüssel musste ich zunächst den Besitz übernehmen und dann die Rechte abändern. Zum Schluss lief dann die Rechtevererbung ohne Fehler durch und der Process Monitor zeigte auch keine Probleme mehr an.

Zusätzlich habe ich noch überprüft, ob der Benutzer überhaupt Schreibrechte für die Datei “%userprofile%\AppData\Local\Microsoft\Windows\UsrClass.dat” hat, das war der Fall.

Nachdem ich den Benutzer abgemeldet und neu angemeldet hatte, waren wieder alle Unterschlüssel unter “HKEY_CURRENT_USER\Software\Classes” vorhanden.

Ich vermute das Problem kam dadurch, dass jemand eine etwas betagte Software als Domänen-Administrator installiert hatte. Ich bin froh, dass es jetzt funktioniert.

Dieser Artikel hat mich auf die richtige Spur geführt, deswegen möchte ich ihn hier auch nochmal erwähnen:
Troubleshooting the Missing Classes Root Key…

Check if VBScript runs with correct interpreter cscript.exe/wscript.exe 2

If you ever want to make sure, that your VBScript gets executed with the correct interpreter, just add the following code to your script header:

  Set args = WScript.Arguments
   ‘check if executed with cscript
   if UCASE(right(wscript.fullname,11)) <> “CSCRIPT.EXE” then
   ‘Thanks to PCFreak from germany for that!
   Msgbox “Make your life easier and run this script with cscript.exe”
   WScript.Quit
  end if

This will prevent the ugly popups! Change “CSCRIPT.EXE” to “WSCRIPT.EXE” if you want to check the other way.

Most sophisticated utilman exploit for Teensy and other HID emulators 0

These days it is very cheap and easy to to build your own “evil” USB-dongle that emulates a USB HID (Human Interface Device) and sends keystrokes. You could use the very easy to program “USB Rubber Ducky” or the cheaper “Teensy USB Development Board“. So you now have a very nice “Phantom Keystroker” that you can use for pen testing.

You could find many payloads for the “Ducky” and also for the “Teensy” on the internet. For me, the most interesting payload was the “Utilman exploit” for Windows 7, but I was not comfortable with the way it worked.

  • take ownership fo utilman.exe
  • change permissons of utilman.exe
  • replace utilman.exe with something else (cmd.exe)

A sample payload, that does exactly this can be found here: Utilman Exploiter by Xcellerator for the “Ducky”

This is a huge change to the operating system and you leave your marks on the target system. So how could we do the same without going to deep into the target system? ….. I remembered a registry key that could exactly do that!!!

If you want to run CMD.EXE everytime the system tries to execute UTILMAN.EXE just add the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Utilman.exe
REG_SZ: Debugger VALUE: cmd.exe

Now every try to execute UTILMAN.EXE will result in opening CMD.EXE instead. It even works if you type UTILMAN (without the extension).

Based on this knowledge, it is now very easy to write a payload for our “Phantom Keystroker”, that:

  • Press WIN key
  • Enter “cmd.exe”
  • Press “APP” key
  • press “a” (will do Run as Administrator)
  • press “LEFT” (brings cursor on YES on UAC prompt)
  • press “ENTER” (to open the administrative CMD.EXE)
  • enter a command that sets the registry key
  • enter EXIT to close the command prompt

This was very easy to accomplish by using the Teensy 2.0.

Here you can download the working exploit for Teensy 2.0 here: Most_Sophisticated_Utilman_Exploit.zip

 

Here a post in the hak5-Forum with a working exploit for the USB Ruberducky.

The following video will show you how to run CMD.EXE instead of UTILMAN.EXE just by adding a registry key!

Video of a possible attack.

Links
Inside ‘Image File Execution Options’ debugging
Launching the debugger automatically

Nächste Seite »

Switch to our mobile site