1 (c) Boldizsár Bencsáth Rosszindulatú programok, botnetek Webes sérülékenységek Etikus hacking módszerek2 How a typical hacker compromises a system T...
Many attacks are successful by multiple steps! Pseudo-random number generators (PRNG)
2
The named version of BME DNS server
boldi@hbgyak:~$ dig version.bind @ns.bme.hu txt ch ; <<>> DiG 9.5.1-P3 <<>> version.bind @ns.bme.hu txt ch ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18923 ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;version.bind. CH
TXT
;; ANSWER SECTION: version.bind. 0 CH
TXT
"9.5.1-P3"
;; AUTHORITY SECTION: version.bind. 0 CH
NS
version.bind.
Pseudo-random number generators (PRNG)
3
Version.bind So You can check the version of bind But You cannot be sure it is not faked As sysadmin, You might want to set this to something fake That will be security-through-obscurity But If You are lazy to upgrade whenever it is needed- at least, fake the version info…
Pseudo-random number generators (PRNG)
4
Zone transfer – if allowed boldi@hbgyak:~$ dig crysys.hu @ns2.crysys.dc.hu in axfr ; <<>> DiG 9.5.1-P3 <<>> crysys.hu @ns2.crysys.dc.hu in axfr ;; global options: printcmd crysys.hu. 3000 IN SOA ns1.crysys.dc.hu. netadmin.ns1.crysys.dc.hu. 2003030439 43200 14400 2592000 3000 crysys.hu. 3000 IN NS ns1.crysys.dc.hu. crysys.hu. 3000 IN NS ns2.crysys.dc.hu. crysys.hu. 3000 IN A 152.66.249.135 crysys.hu. 3000 IN MX 10 shamir.crysys.hu. crysys.hu. 3000 IN MX 50 eternal.datacontact.hu. crysys.hu. 3000 IN TXT "Datacontact - your nameserver..." aggregator.crysys.hu. 3000 IN A 195.228.45.178 albifrons.crysys.hu. 3000 IN A 10.105.1.95 clamav.crysys.hu. 3000 IN A 152.66.249.132 cypio.crysys.hu. 3000 IN A 152.66.249.135 db.crysys.hu. 3000 IN A 152.66.249.139 deserecprj.crysys.hu. 3000 IN A 152.66.249.132 deserecvclt1.crysys.hu. 3000 IN A 152.66.249.131 deserecvclt2.crysys.hu. 3000 IN A 152.66.249.133 deserecvhost1.crysys.hu. 3000 IN A 152.66.249.130 deserecvirtclt1.crysys.hu. 3000 IN A 152.66.249.131 deserecvirtclt2.crysys.hu. 3000 IN A 152.66.249.133 ….
Pseudo-random number generators (PRNG)
5
Zone transfer authorization boldi@fw:~$ dig crysys.hu @ns1.crysys.dc.hu in axfr ; <<>> DiG 9.5.1-P1 <<>> crysys.hu @ns1.crysys.dc.hu in axfr ;; global options: printcmd ; Transfer failed. Limiting zone transfer in named.conf: allow-transfer { 195.228.45.175; 152.66.249.135; … ) Pseudo-random number generators (PRNG)
6
News 2010… valasztas.hu- info leak – bad access rights http://valtor.valasztas.hu/valtort/jsp/ http://valtor.valasztas.hu/valtort/jsp/vlt_init_jsp_inc.txt http://valtor.valasztas.hu/valtort/jsp/vlt_start_jsp_inc.txt http://valtor.valasztas.hu/valtort/jsp/vlt_end_jsp_inc.txt Idézet: PoolSet.add("VALTORT",new Pool(new OraclePoolFactory("jdbc:oracle:thin:@172.31.100.104:1521: EKPD","valtort","valtort"),1,1,0,0,0,0,false,false)); van am szekuriti! http://209.85.135.132/search?q=cache:k0QfKgAgN1IJ:valtor. valasztas.hu/valtort/jsp/vlt_start_jsp_inc.txt+%22jdbc:oracle:t hin:%40172.31.100.104:1521:EKPD%22,%22valtort%22,%2 2valtort%22%29,&cd=3&hl=hu&ct=clnk&gl=hu&client=firefox -a Pseudo-random number generators (PRNG)
7
Google stored version – leak after deletion <%! String hstr(int i){return StatData.hstr(i);}%> <%! String dstr(java.sql.Date d){return StatData.dstr(d);}%> <%! String ifA(boolean l, String qstr, String[] param, int n) { return StatData.ifA(l, qstr, param, n);}%> <%! String ifA(boolean l, String qstr, String[] param, String link) { return StatData.ifA(l, qstr, param, link);}%> <%! String ifA(String qstr, String[] param, int n) { return StatData.ifA(qstr, param, n);}%> <% PoolSetObj pso = null; Connection c = null; PreparedStatement st[] = new PreparedStatement[0]; try { Class l_c = this.getClass(); java.lang.reflect.Field f = l_c.getDeclaredField("sqln"); int l_n = f.getInt(l_c); st = new PreparedStatement[l_n]; }catch (Exception e) {} PreparedStatement pst = null; ResultSet rs = null; String sql = null; try { if (PoolSet.get("VALTORT")==null) PoolSet.add("VALTORT",new Pool(new OraclePoolFactory("jdbc:oracle:thin:@172.31.100.104:1521:EKPD","valt ort","valtort"),1,1,0,0,0,0,false,false)); pso = PoolSet.getSetObj("VALTORT",funcName); c = (Connection)pso.getObj(); StatData.loadData(c); %> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2"> Pseudo-random number generators (PRNG)
8
Example Web info leak video here End of part talking about info gathering /leak Security by obscurity -> is it good?
Pseudo-random number generators (PRNG)
9
VULNS Main web vulns will be covered here XSS Code injection SQL injection
Pseudo-random number generators (PRNG)
10
Case study: Hacker attack against valasztas.hu 2010
The parameter “NEV” is not used carefully on the server Possibility of Cross-site-scripting
Pseudo-random number generators (PRNG)
12
What is XSS (cross site scripting)? Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications which enable malicious attackers to inject client-side script into web pages viewed by other users. An exploited cross-site scripting vulnerability can be used by attackers to bypass access controls such as the same origin policy. Cross-site scripting carried out on websites were roughly 80% of all security vulnerabilities documented by Symantec as of 2007.[1] Their impact may range from a petty nuisance to a significant security risk, depending on the sensitivity of the data handled by the vulnerable site, and the nature of any security mitigations implemented by the site's owner. Pseudo-random number generators (PRNG)
13
XSS Exploit scenarios Attackers intending to exploit cross-site scripting vulnerabilities must approach each class of vulnerability differently. For each class, a specific attack vector is described here. The names below are technical terms, taken from the cast of characters commonly used in computer security. Non-persistent: Alice often visits a particular website, which is hosted by Bob. Bob's website allows Alice to log in with a username/password pair and store sensitive information, such as billing information. Mallory observes that Bob's website contains a reflected XSS vulnerability. Mallory crafts a URL to exploit the vulnerability, and sends Alice an email, enticing her to click on a link for the URL under false pretenses. This URL will point to Bob's website, but will contain Mallory's malicious code, which the website will reflect. Alice visits the URL provided by Mallory while logged into Bob's website. The malicious script embedded in the URL executes in Alice's browser, as if it came directly from Bob's server (this is the actual XSS vulnerability). The script can be used to send Alice's session cookie to Mallory. Mallory can then use the session cookie to steal sensitive information available to Alice (authentication credentials, billing info, etc) without Alice's knowledge. Persistent attack: Mallory posts a message with malicious payload to a social network. When Bob reads the message, Mallory's XSS steals Bob's cookie. Mallory can now hijack Bob's session and impersonate Bob.[16] [not too much difference between the two] Pseudo-random number generators (PRNG)
14
root@hbgyak:/data/html# more xss.php Hello echo "$nev"; ?> (register_globals=On)