Perfect forward secrecy in Instant Messaging with multiple devices

I have read multiple sites online about PFS and DH but I still have a few questions.

I understand that in order to have PFS you must use different keys to encrypt messages. So your IM client could be generating a new key for… Continue reading Perfect forward secrecy in Instant Messaging with multiple devices

Shell program risks and precautions [on hold]

You are writing a program that makes a call out to a shell program. Explain the security risks involved and explain the precautions you should take.

I thought this was the answer but I was told it’s not correct and they didn’t supply the actual answer if it’s not this what is it. I was told the risks were to do with the keys.

SQL injection

A program takes user input and creates an SQL query using string concatenation. For example, suppose the user is prompted for user name and password.
Never construct SQL statements using String concatenation. Use PreparedStatements or the equivalent. If not you would need to check user input values (possibly using regular expressions), and checking for all possible metacharacters.
Java – Use PreparedStatements.

Buffer Overrun

A program writing data to a buffer, overruns the buffer’s boundary and overwrites adjacent memory
If the buffer overrun goes over the end to the data segment in a program, this results in a segmentation fault and core dump. If not, the error can sometimes be exploited by an attacker. Change the values of nearby variables. Change the value of the return address. To the address of a user input buffer which can contain a program. Libraries exist for safe manipulation of buffers. Buffer overflow protection is used to detect the most common buffer overflows by checking that the stack has not been altered when a function returns. If it has been altered, the program exits with a segmentation fault.

Cross Site Scripting

User data in cookies relevant to a (vulnerable) Web Application is disclosed to a malicious third party. Can happen when a Web Application echos user input to a page.  The user can then enter script code (Javascript) which gets executed by the browser. A Cross Site Scripting attack can access cookies. Can access the DOM model and change links. Web Application accepts user input Does not check it. Echos the user input directly to the browser.
The solution Check user input using regular expressions URL encode the output. – Prevents text being interpreted as html/Javascript Add the httponly option to cookies – Cookie can’t be accessed in Javascript

Continue reading Shell program risks and precautions [on hold]