security

Buffer overflow works in gdb but not without it

随声附和 提交于 2019-12-27 16:26:06
问题 I am on CentOS 6.4 32 bit and am trying to cause a buffer overflow in a program. Within GDB it works. Here is the output: [root@localhost bufferoverflow]# gdb stack GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1) Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and

Why do salts make dictionary attacks 'impossible'?

被刻印的时光 ゝ 提交于 2019-12-27 16:26:02
问题 Update: Please note I am not asking what a salt is, what a rainbow table is, what a dictionary attack is, or what the purpose of a salt is. I am querying: If you know the users salt and hash, isn't it quite easy to calculate their password? I understand the process, and implement it myself in some of my projects. s = random salt storedPassword = sha1(password + s) In the database you store: username | hashed_password | salt Every implementation of salting I have seen adds the salt either at

How can I avoid SQL injection attacks in my ASP.NET application?

送分小仙女□ 提交于 2019-12-27 14:54:10
问题 I need to avoid being vulnerable to SQL injection in my ASP.NET application. How might I accomplish this? 回答1: Even though your question is very generic, a few rules always apply: Use parameterized queries ( SqlCommand with SqlParameter ) and put user input into parameters. Don't build SQL strings out of unchecked user input. Don't assume you can build a sanitizing routine that can check user input for every kind of malformedness. Edge cases are easily forgotten. Checking numeric input may be

Using PHP/Apache to restrict access to static files (html, css, img, etc)

南笙酒味 提交于 2019-12-27 12:52:09
问题 Lets say you have lots of html, css, js, img and etc files within a directory on your server. Normally, any user in internet-land could access those files by simply typing in the full URL like so: http://example.com/static-files/sub/index.html Now, what if you only want authorized users to be able to load those files? For this example, lets say your users log in first from a URL like this: http://example.com/login.php How would you allow the logged in user to view the index.html file (or any

Using PHP/Apache to restrict access to static files (html, css, img, etc)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-27 12:51:10
问题 Lets say you have lots of html, css, js, img and etc files within a directory on your server. Normally, any user in internet-land could access those files by simply typing in the full URL like so: http://example.com/static-files/sub/index.html Now, what if you only want authorized users to be able to load those files? For this example, lets say your users log in first from a URL like this: http://example.com/login.php How would you allow the logged in user to view the index.html file (or any

Handling Java crypto exceptions

独自空忆成欢 提交于 2019-12-27 12:05:00
问题 This, pretty basic, piece of code is quite common when handling encryption\decryption in Java. final Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, key, iv); cipher.doFinal(*something*); These three lines alone, potentially throw six exceptions and I'm not sure what's the cleanest (in terms of code readability) way to handle them. A try with six catch clauses really looks like a smell to me. Are there micropatterns or best practices, I am obviously

What is cross site scripting?

二次信任 提交于 2019-12-27 11:05:14
问题 On this site (archived snapshot) under “The Theory of XSS’, it says: the hacker infects a legitimate web page with his malicious client-side script My first question on reading this is: if the application is deployed on a server that is secure (as is the case with a bank for example), how can the hacker ever get access to the source code of the web page? Or can he/she inject the malicious script without accessing the source code? 回答1: With cross-site scripting, it's possible to infect the

What is cross site scripting?

烂漫一生 提交于 2019-12-27 11:04:24
问题 On this site (archived snapshot) under “The Theory of XSS’, it says: the hacker infects a legitimate web page with his malicious client-side script My first question on reading this is: if the application is deployed on a server that is secure (as is the case with a bank for example), how can the hacker ever get access to the source code of the web page? Or can he/she inject the malicious script without accessing the source code? 回答1: With cross-site scripting, it's possible to infect the

Why the cross-domain Ajax is a security concern?

只谈情不闲聊 提交于 2019-12-27 11:03:54
问题 Why was it decided that using XMLHTTPRequest for doing XML calls should not do calls across the domain boundary? You can retrieve JavaScript, images, CSS, iframes, and just about any other content I can think of from other domains. Why are the Ajax HTTP requests not allowed to cross the domain boundaries? It seems like an odd limitation to put, considering the only way I could see it being abused, would be if someone were to inject Javascript into the page. However, in this case, you could

Why the cross-domain Ajax is a security concern?

℡╲_俬逩灬. 提交于 2019-12-27 11:03:13
问题 Why was it decided that using XMLHTTPRequest for doing XML calls should not do calls across the domain boundary? You can retrieve JavaScript, images, CSS, iframes, and just about any other content I can think of from other domains. Why are the Ajax HTTP requests not allowed to cross the domain boundaries? It seems like an odd limitation to put, considering the only way I could see it being abused, would be if someone were to inject Javascript into the page. However, in this case, you could