How does the Deepsound steganography software work, and what are pros and cons of it? I always been fascinated by steganography. I understand that its purpose alone is to provide security by obscurity. However, combining steganography with encryption can actually make it desirable overall.

In my favorite TV show, Mr. Robot, the main character uses a program called "Deepsound". I see that it has an option to encrypt the secret files which sounds promising. Can someone explain to me how this works? For example the steps it takes to provide it's purpose and the pros and cons of it.

Steganography is any method of hiding a message inside something that looks innocent.  It has different goals to encryption, in that encryption stops a party reading the message even if they know it's there, whereas steganography hides the message so if you don't know it's there, you won't discover it.  That's why the two can be used together usefully: to encrypt the message and then hide it, so that somebody not knowing the existence of the message won't discover it, but if they do, then they won't be able to read it.

Steganography should be able to hide the existence of the message with no tell-tale signs that a message is hidden in it.  In an image or audio file its effect on the image or the audio must be imperceptible to human ears, so it's not good enough if it creates a "weird noise in the background" or something to that effect.  Ideally it should even not indicate its presence under regular scrutiny such as zooming in, or analysis with a scope.

Typically it superimposes a noise pattern over the signal in such a way that it's not going to be seen or heard by humans but it can be detected by a digital examination of the file itself, by ensuring that its noise pattern is outside the range that humans will pick up on or is sufficiently masked by actual signal.

Note: steganography doesn't have to be this sophisticated.  Some files allow arbitrary data to be hidden in the file format somewhere that it won't be read by software that reads that file format, by placing it into redundant space that is not referenced by the header of the document.  This is notably possible with ZIP files where you can have innocent looking compressed files in the archive itself but have other data in the file that will never be accessed by a ZIP reader.  The side effect of this type of steganography is that the increase in file size may arouse suspicion, whereas this may not be the case in an uncompressed audio signal where adding extra information will not increase file size.


Is Stegosploit a real concern with modern browsers? http://stegosploit.info/

I looking into having users upload their images directly to AWS S3 to save on costs (rather than going through a traditional server and re-encoded with mozjpeg), but this would theoretically open up the stegosploit vulnerability based on what I've read.

The part that I don't understand is: does the exploit require the image to be loaded in <script></script> (the website admin must be in on the exploit), or does the image itself contain the <script></script> (a website user can upload the image for the exploit)?

To answer the question: The website admin must be in on the exploit.

The encoding technique is there to obfuscate the actual exploit scripts, thus flying under the radar from current detection methods. It still requires HTML/Javascript to be on the webpage in order to decode and run the exploit.

That is to say, if I had encoded an exploit into pleasedontrunthis.jpg, I (the web admin), would still need to open the image like so:

<script src="pleasedontrunthis.jpg">

To answer the question in the title: Not really.

This is an encoding technique, not an exploit. It requires the would-be attacker to serve malicious Javascript in order to... server malicious Javascript. This technique could provide sufficient obfuscation to hide itself from both automated and human scanners for a potentially longer period of time than exploits which offer huge walls of text simply by hitting F12.

In practice this means that someone could hack a website (ie, through a Wordpress vulnerability), and deliver a silent exploit that would take longer to find.

In reality, if an exploit in the toolkit was capable of pwning your machine, it would have most likely pwned your machine either way. The reality being that not all malicious code is going to make itself glaringly obvious, so there's always an inherent risk when deciding to allow it.


Wireless Testing - monitor mode issues I am currently learning about Wireless testing and have stumbled across a couple of little issues.

The system setup I am working on is as outlined below:

Kali Linux - 64-Bit (GNOME v3.4.2) Virtual Machine running on;
Linux Mint 17 64-Bit Base Operating System Version 2.2.16
Intel i7 Processor
Wireless Adapter is: Alfa Networks AWUS051NH 802.11 a/b/g/n Long-Range Wireless USB Adapter
I have been watching the videos and following the tests on Security Tube.

During the tests that Vivek runs, he uses various tools: airmon-ng, airodump-ng and mdk3.

I can connect my adapter to my Kali VM perfectly fine, the USB passthrough is running correctly and the drivers for the adapter are loaded successfully within Kali:

root@Kali64:~# lsusb
Bus 002 Device 003: ID 148f:2770 Ralink Technology, Corp. RT2770 Wireless Adapter

I can start the interface and create the monitor interface using airmon-ng:

root@Kali64:~# airmon-ng start wlan1

Found 2 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after a short period of time,
you may want to kill (some of) them!

-e
PID     Name
2906    dhclient
3222    dhclient

Interface    Chipset               Driver

wlan1        Ralink RT2870/3070   rt2800usb - [phy1]
                (monitor mode enabled on mon0)

root@Kali64:~# iwconfig
mon0      IEEE 802.11abgn  Mode:Monitor  Tx-Power=20 dBm
      Retry short limit:7   RTS thr:off   Fragment thr:off
      Power Management:off

wlan1     IEEE 802.11abgn  ESSID:off/any
      Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
      Retry short limit:7   RTS thr:off   Fragment thr:off
      Encryption key:off
      Power Management:off

eth0      no wireless extensions.

eth1      no wireless extensions.

lo        no wireless extensions.

However, if I try and set both the wlan and mon interfaces onto a channel, I find the monitor interface doesn't actually set - only the wlan interface:

root@Kali64:~# iwconfig wlan1 channel 1
root@Kali64:~# iwconfig mon0 channel 1
root@Kali64:~# iwconfig
mon0      IEEE 802.11abgn  Mode:Monitor  Tx-Power=20 dBm
      Retry short limit:7   RTS thr:off   Fragment thr:off
      Power Management:off

wlan1     IEEE 802.11abgn  ESSID:off/any
      Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated
      Tx-Power=20 dBm
      Retry short limit:7   RTS thr:off   Fragment thr:off
      Encryption key:off
      Power Management:off

So firstly - any ideas on why this may be? I have tried creating a new monitor port - changing the channel on the mon0 port and this appeared to work, however, it should just work first time shouldn't it?

The second thing is, during the Part 3 video- pwning beacon frames, Vivek uses a tool called mdk3 to create a fake AP which distributes beacon frames on various channels.

Each time his adapter hops channels, the MAC address of his adapter changes, however when I run it on my machine, the MAC address just stays as: 2F:00:00:00:00:00:00 and I can't figure out why?

root@ctxKali64:~# mdk3 mon0 b -n TESTING

Current MAC: 00:00:00:00:00:00 on Channel  2 with SSID: TESTING
Current MAC: 2F:00:00:00:00:00 on Channel 10 with SSID: TESTING
Current MAC: 2F:00:00:00:00:00 on Channel  4 with SSID: TESTING
Current MAC: 2F:00:00:00:00:00 on Channel  3 with SSID: TESTING
Current MAC: 2F:00:00:00:00:00 on Channel 10 with SSID: TESTING

Apologies for the lengthy post, I hope someone may have come across this before and might be able to help.

Thanks James

I was able to resolve this issue of the MAC address not changing by adding the -m option to mdk3.

mdk3 wlan0 -b -m


How many people are required to build your own 24x7 security operations center (SOC)? Rough costs? I have received this question from a few clients, but I have 0 experience building a 24x7 SOC.

As the others mentioned this can only be established when you know more requirements.

These might include but not be limited to:

Region
24x7?
scale/type of work involved.  (I.e. how much work/ how often ?)

For a rough idea you could sketch out how the current incidents you mentioned would've been ideally dealt with, and how much work this would've taken from how many people - with generous estimates as always on time actually required.


How stack smashing is prevented? I just read AlephOne's paper on smashing the stack, and implemented it on my machine (Ubuntu 12.04), it was a bit old so had to take a lot of help from the internet but I enjoyed it.

Now, I want to learn how is that prevented in real life.

It would be great if you can suggest me some papers or online resources that demonstrate how it is prevented.

There are two primary techniques for mitigating stack based buffer overflows.

The first technique is attacking the problem at the roots. Buffer overflows occur when a program tries to write outside the bounds of a data structure. The most effective way to stop a buffer overflow is to stop this from occurring. Use a programming language, be it Java, Python, Ruby, that will manage the memory for you. If you must use C, ensure that you perform proper checks before writing to a buffer.

The second technique involves mitigating the damage a buffer overflow can cause. Techniques like stack canaries, DEP and ASLR fall under this category. They work to limit the damage a buffer overflow can cause by making it more difficult for an attacker to execute arbitrary code after an overflow. Such techniques can be defeated. For more information about DEP and ASLR, see this question.


Can ISP block HTTPS selectively? Can ISP block HTTPS selectively i.e. certain websites cannot be accessed using HTTPS while others can be ?

Current browsers all do SNI (Server Name Indication) to make it possible to setup different hostnames on the same IP but with different certificates. To make this work the hostname of the target server is included in clear in the initial handshake packet from the client (ClientHello).

By selectively blocking the ClientHello if it contains specific strings inside the SNI extension a firewall could block specific SSL sites, even without affecting other SSL sites behind the same IP. On less capable firewalls (without deeper inspection) you could simply have broader rules to block access to specific IPs.

Because this is SSL and the firewall has no access to the real certificate it cannot send the client a proper error page, so the client just gets strange error message inside the browser because the connection was either reset or it times out, depending on how the firewalls handles the blocking.


Is there any live ZRTP mitm attack demostrtion? I'm a student and currently try to create demonstration of  libzrtp mitm attack. I've spent hours searching trough google - and there is no any useful information. Does anyone have any experience with ZRTP? All sources just tell - oh ZRTP is so secure and protected from mitm attacks. But how exactly this can be demonstrated? For example: I have two iphones with installed SilentCircle or similar application with implemented ZRTP. Than I sniff traff with Kali Linux like a mitm-man, but what should I do to simulate notification about mitm?
I also research about five different application and there is no such information.
My first question was - If Zrtp is so secure so where all demonstrations of mitm attacks? Or all just use lib from zfoneproject and don't carry about security tests? Please help me if you have any related information. My primary target - to create testlab for ZRTP live attacks.
Thank you!

ZRTP protocol isn't secure because it can't be MiTM'ed. It is secure because a MiTM attacker can not easily predict when and how the short authentication string (SAS) exchange will take place during the conversation.

To successfully MiTM a voice call, an attacker has to know when and how the SAS exchange will take place, and then send synthesized voice packets to the users during the exchange. Moreover, the synthesized voices should sound like the actual voices of the users to successfully pull this off.

SAS exhange can take place during any moment of the conversation.
SAS can be encoded and spelled using a method that's previously known to the users (eg: NATO phonetic alphabet)
If it is a video call, SAS can be exchanged using sign language, or writing SAS on paper and showing it to the other user.

A good place to start would be RFC 6189 - ZRTP: Media Path Key Agreement for Unicast Secure RTP.


Relation between boolean blind SQLi and time blind SQLi? I am part of a team which developing web app penetration testing framework, and I am taking care of SQLi detection. When I tested multiple known vulnerable local sites found Boolean Blind flaw always occur with Time Blind flaw. I want to know is my conclusion is correct or is there a situation where a Boolean Blind can occur without Time Blind?

Whilst I don't think I can provide a concrete example my inclination would be to say that it is possible that there would be an instance of SQLi where boolean based injection would be possible and time-based would not.

The reason being that time-based injection usually relies on modifying the syntax of the query to add additional statements (e.g. WAITFOR DELAY) which may not be supported in every part of a query in every DBMS, whereas boolean based injection relies on inserting logical operators which are more likely to be universally supported.


How to catch a SMS spammer who is using google voice to spam me How do I catch a SMS spammer who is using google voice to spam me?

I have the google voice number and 2 of their burner emails with gmail. How do I gather enough information to inform the authorities?

Don't play cops and robbers,  just report the issue to Google and they will take care of it.  Google and the authorities have better tools and people who are paid to deal with these criminals.

That being said,  one way to identify someone online via chat or sms is to get them to visit a URL.  This could load a page that logs the IP address, and then you can perform a whois or geoip lookup on this address.  More advanced/blackhat/illegal method would have that URL return a page that exploits a vulnerability in the browser and then you can collect personal information from the spammer's machine.


Should users be allowed to reuse/recyle the same login credentials across a network for different systems? Should users be allowed to reuse/recycle the same login credentials across a network for different systems? Should this be disallowed/discouraged, or are the security implications minimal? If it's frowned upon, should the usernames and passwords be unique, or is reusing usernames okay?

(This is an extension of an earlier question: Does username length/complexity/uniqueness positively impact security?)

It depends on the situation really. If you use radius authentication and it's connecting back to you AD infrastructure and your using it within say your routing and switching environment to gain access to the CLI then it's OK. However this only because radius is a aaa service. If you use the same user and password to create domain administrator level changes it's very bad and is not a best practice by any means. In general you should never allow passwords to be reused even if it's say 6 months down the road. Usernames in the windows AD world typically have to be reused. However password as I mentioned before should never be refused as they become more insecure over time.


should I add a sha256 signature to an AES_256_CBC encrypted token? currently I generate a token for an mobile app the way below. I decrypt the token to process the request and assess the user is logged in. I'm on TLS RSA 2048 bits connection. I was wondering if $GLOBALS is safe and if adding an hmac_sha256 would make my token harder to forge or it wouldn't change much.

$GLOBALS['encryption_key'] = <<<'EOT'
 MIGsAgEAAiEAwtvvzQzXiesVUPxXV7+jvUbmXfavBqxdakC1Tn+PpmcCAwEAAQIg
 WtklzWkOWKv0zURJCI09riGVIPIzGx1XPmFVaAbOeBECEQDynUX9BuIv3k6IA1wm
 IcSpAhEAzZwpEHQtbj3xpiWy34/sjwIRAJ2ltmmxBF6obI0S6djZTmkCEQDLpv5h
 hsEs7Xv5lmOK3lJvAhEAxJzS4NEgH2fF7mfaLfIWWg==
 EOT;

function new_auth_token($user) {
  $token_data = [
      'param1'   => 'type',
      'param2'   => $user['p2'],
      'param3'   => $user['p3'],
      'param4'   => $user['p4'],
      'param5'   => $user['p5'],
      'expedite' => (time() + (3600*24*180))
  ];
  $json  = json_encode($token_data);
  $iv    = openssl_random_pseudo_bytes(openssl_cipher_iv_length(AES_256_CBC));
  $ssl   = openssl_encrypt($json, AES_256_CBC, $GLOBALS['encryption_key'], 0, $iv);
  $token = base64_encode($ssl).'.'.base64_encode($iv);
  return $token;
}

You must authenticate the ciphertext because the encryption is malleable. The best way is to use an AEAD. If you can't do that, you should use hmac-sha256 with a key that must remain secret but must be different from the AES key. You must MAC the IV and the ciphertext after you encrypt and store the result in the token (like you store the IV). You must check the MAC before trying to decrypt the ciphertext. You must use a constant time comparison function to verify the MAC.

Otherwise people can decrypt messages, fake messages, maybe extract the AES key.

Notice all the "musts"? It's easy to mess it up. You should prefer a higher level api that does it right and does not allow you to do it wrong. Try libsodium.

EDIT

Notes about your code:

Your AES "encryption key" is an RSA private key. You do know that RSA keys are not AES keys, right? Also, 256 bit RSA is completely useless, broken in minutes on a laptop. BTW, now that you've published the RSA key, you can't use it for anything real, even if it used to be a strong key (RSA keys with modulus of 2048 bits and up are secure).

AES-256 keys are byte arrays of length 32 bytes. In base64 that would be 45 bytes. You need to decode the base64 before you use the string in encryption or decryption. You can generate strong AES keys like so: head -c32 /dev/urandom | base64.

You should use a library with an API that would not let you pass a string with supposed AES key that is of the wrong length.

In conclusion, you should read a lot more about crypto before you try to use it with someone's sensitive information.


Is there any malicious reason to block CRLs? I've noticed that in order to 'illegally' crack certain applications, it is necessary to patch the host file to stop communication with the activation servers.

I've found that with several applications there are entries that don't match the rest. These entries seem to patch the certificate revocation lists (CRL) for Verisign which i find to be quite suspicious.

The entry in question is:

  127.0.0.1 crl.versign.net

Obviously the CRLs don't have anything to do with the application cracking process (so far as i can tell). Is there a malicious reason to do this?

Some operating systems, including Windows, want to enforce verifications of signatures of DLL. The verification entails validating the signature against the signer's public key, which is found in the signer's certificate, which itself needs to be validated. Certificate validation includes revocation status check.

In practice, a Windows OS validating a certificate will download CRL to ascertain that the certificate is not revoked. However, if the same OS cannot download the CRL, then it will just assume that the certificate is probably unrevoked. According to the normal X.509 model, when revocation status cannot be obtained, the certificate should be rejected. However, this means here that the application does not start, and the consumer will be unhappy (that is, significantly unhappier than what is already entailed by using Windows); and it would mean that the machine cannot work without a working Internet connection, which would imply some interesting chicken-and-egg issues.

So adding an entry which prevents connections to Verisign's CRL download server can have a malicious reason: this allows the attacker to sign his nefarious code with a revoked certificate (e.g. a certificate whose private key has been stolen by the attacker some time ago), while still maintaining a working Internet connection for the said machine.


What are these long www bitnik URL? Noticed it here

https://twitter.com/wikileaks/status/446263047812702208

  wwwwwwwwwwwwwwwwwwwwww.bitnik.org

Is this some security feature?

It has nothing to do with security. Anyone who controls DNS records for a domain name (e.g., bitnik.org) can create any number of A records.  Using dig (which queries DNS records) from my location, I'm getting the same two servers (cloudflare) for anywhere from 3-22 w in a row.

drjimbob:~$ for i in $(seq 3  22); do dig +nocmd $(printf 'w%.0s' $(seq 1 $i)).bitnik.org +nocomments +nostats +noquestion; done
www.bitnik.org.     290 IN  A   162.159.243.12
www.bitnik.org.     290 IN  A   162.159.242.12
wwww.bitnik.org.    290 IN  A   162.159.243.12
wwww.bitnik.org.    290 IN  A   162.159.242.12
wwwww.bitnik.org.   290 IN  A   162.159.243.12
wwwww.bitnik.org.   290 IN  A   162.159.242.12
wwwwww.bitnik.org.  290 IN  A   162.159.242.12
wwwwww.bitnik.org.  290 IN  A   162.159.243.12
wwwwwww.bitnik.org. 290 IN  A   162.159.243.12
wwwwwww.bitnik.org. 290 IN  A   162.159.242.12
wwwwwwww.bitnik.org.    290 IN  A   162.159.242.12
wwwwwwww.bitnik.org.    290 IN  A   162.159.243.12
wwwwwwwww.bitnik.org.   290 IN  A   162.159.242.12
wwwwwwwww.bitnik.org.   290 IN  A   162.159.243.12
wwwwwwwwww.bitnik.org.  290 IN  A   162.159.243.12
wwwwwwwwww.bitnik.org.  290 IN  A   162.159.242.12
wwwwwwwwwww.bitnik.org. 290 IN  A   162.159.243.12
wwwwwwwwwww.bitnik.org. 290 IN  A   162.159.242.12
wwwwwwwwwwww.bitnik.org. 290    IN  A   162.159.242.12
wwwwwwwwwwww.bitnik.org. 290    IN  A   162.159.243.12
wwwwwwwwwwwww.bitnik.org. 290   IN  A   162.159.243.12
wwwwwwwwwwwww.bitnik.org. 290   IN  A   162.159.242.12
wwwwwwwwwwwwww.bitnik.org. 290  IN  A   162.159.242.12
wwwwwwwwwwwwww.bitnik.org. 290  IN  A   162.159.243.12
wwwwwwwwwwwwwww.bitnik.org. 290 IN  A   162.159.242.12
wwwwwwwwwwwwwww.bitnik.org. 290 IN  A   162.159.243.12
wwwwwwwwwwwwwwww.bitnik.org. 290 IN A   162.159.243.12
wwwwwwwwwwwwwwww.bitnik.org. 290 IN A   162.159.242.12
wwwwwwwwwwwwwwwww.bitnik.org. 290 IN    A   162.159.243.12
wwwwwwwwwwwwwwwww.bitnik.org. 290 IN    A   162.159.242.12
wwwwwwwwwwwwwwwwww.bitnik.org. 290 IN   A   162.159.242.12
wwwwwwwwwwwwwwwwww.bitnik.org. 290 IN   A   162.159.243.12
wwwwwwwwwwwwwwwwwww.bitnik.org. 290 IN  A   162.159.243.12
wwwwwwwwwwwwwwwwwww.bitnik.org. 290 IN  A   162.159.242.12
wwwwwwwwwwwwwwwwwwww.bitnik.org. 290 IN A   162.159.242.12
wwwwwwwwwwwwwwwwwwww.bitnik.org. 290 IN A   162.159.243.12
wwwwwwwwwwwwwwwwwwwww.bitnik.org. 290 IN A  162.159.242.12
wwwwwwwwwwwwwwwwwwwww.bitnik.org. 290 IN A  162.159.243.12
wwwwwwwwwwwwwwwwwwwwww.bitnik.org. 290 IN A 162.159.243.12
wwwwwwwwwwwwwwwwwwwwww.bitnik.org. 290 IN A 162.159.242.12

Note the semi confusing command is just a bash loop to run the commands:

dig +nocmd www.bitnik.org +nocomments +nostats +noquestion
dig +nocmd wwwwwwwwwwwwwwwwwwwwww.bitnik.org +nocomments +nostats +noquestion

with all the values from 3 to 22 w's.  Note querying more or fewer w's will result in no record found, SOA (source of authority) is dns.cloudflare.com.

Just someone randomly decided to set it up like that -- why? Who knows. Also, if you make an HTTP request to the root for any of the other domains, you will get a temporary redirect (HTTP: 302 Found) to the one with 22 w's ( http://wwwwwwwwwwwwwwwwwwwwww.bitnik.org/).  See the HTTP response headers, which tells your web browser to make another request at the URL given in the Location line.

jimbob:~$ curl -I www.bitnik.org
HTTP/1.1 302 Found
Server: cloudflare-nginx
Date: Thu, 20 Mar 2014 21:13:47 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Set-Cookie: __cfduid=d742e5312b8eb7d1ff745449ae453dfc61395350027711; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.bitnik.org; HttpOnly
Location: http://wwwwwwwwwwwwwwwwwwwwww.bitnik.org/
Vary: Accept-Encoding
CF-RAY: 10e4ea69390e01ed-EWR


How can I keep my programmer collegues informed about security issues? I am currently finishing a college degree in programming and I find that security topics are often barely understood by both students and teachers. It leads me to think that there are a lot of developers out there with nearly no basic knowledge about security. I will eventually work with those developers and I am a bit clueless about how I can, as a programmer, help them to be aware of security issues and keep them informed about security issues. What are the  good approaches and what are the things to avoid?

If you work with these developers on a coding assignment or some other project, you can bring up security issues while you're working together. That could either be during "pair programming" if you work that way, or as part of a code review.

Should you choose this approach, you need to come up with realistic problems based on actual threats. If you mention every paranoid possibility for attacks, then it's likely you'll just annoy people and not get your message across effectively. Even when I was working for a security vendor I found the paranoiacs frustrating.


How can Heap Pollution cause a security flaw I came across this rule in the CERT Secure Coding Standart for Java.
Heap Pollution. I understand this can cause the programm throwing an exception at runtime, but i can't understand how this could cause a security issue like dos or something. Could someone explain an scenario where an attacker could exploit a heap pollution?

I would take the similar example from the link you quoted. In the example i will get the userid (Integer) as argument and try to validate it against database.

class ListUtility {
  private static void addToList(List list, Object obj) {
    list.add(obj); // Unchecked warning
  }

  private static boolean validateUser(List list){
     boolean isValidUser=false;
     Statement stmt = conn.createStatement(); //conn is a jdbc Connection
     String Query="SELECT userid FROM Customers WHERE userid='"+list.get(0)+"'"; //developer expects list.get(0) is a integer
     ResultSet rs = stmt.executeQuery(Query);
     if (rs.next()) {
         System.out.println("Valid User");
         isValidUser=true;
       }
     return isValidUser; //returns true for args[0]=something' or '1'='1
   }

  public static void main(String[] args) {
    List<Integer> list = new ArrayList<Integer> ();
    addToList(list, args[0]); //arg[0] is expected to be a valid userid of type Integer(say)
    validateuser(list);

  }

}

Now If i invoke the program with the argument  something' or '1'='1 it will print "Valid User". This is a typical Sql Injection. But this has succeeded because of Heap Pollution where we added args[0] to list even though the type didn't match.

Heap pollution is possible in this case because the parameterized type information is discarded before execution.

The call to addToList(list,args[0]) succeeds in adding an String to list, although list is of type List<Integer>.  Also, the call to validateUser(List list) takes the list of type List<Object> instead of strict List<Integer> .

This Java runtime does not throw a ClassCastException since the value list was not  read with an invalid type in this example.
Because the list is never read strictly as List<Integer>.


Possible to send generated serialkeys using HTTP and get one right? I have hooked the WS2 library with C++ in a game and found it sends a request to the server using http to check if my serial key is valid.
http://warbandmain.taleworlds.com/handlerservers.ashx?type=chkserial&serial=MBWB-????-????-????-????-????

My question is if I send requests with generated serial keys for lets say over a week would it possible I get one right? The server returns -1 if it is false and an id if it is right.

Note: I don't wish to steal serial keys to sell on ebay or something. I don't even want to try this but I was curious if it would be possible.

I can't comment on this specific scenario as there are unknowns such as rate-limiting by the server (see comment by JonasCz), entropy of the serial keys, etc. Here is a general approach to considering this when protecting your own systems.

Each of the ? in the serial key can take one of a number of values as defined by an alphabet. For example, binary alphabet limits them to [0,1], hex limits them to [0-F], etc. The cardinality (c) of the alphabet is simply the number of options; binary = 2, hex = 16, and so on. There are 20 ? so, best case for protection, we have c^20 possible choices from which to guess (assuming a good entropy source for their original generation).

Caveats

There are probably limitations on the actual choices in the form of checksums or authentication codes to validate a particular serial number. For example, the last 4 characters may be a truncated HMAC of the preceding ones, with security provided by the HMAC's key. There may simply be a non-cryptographic checksum which doesn't have a secret key.
A variant of the birthday problem - we're not looking to match a specific serial number. There are a set of true serial numbers and a set of guessed ones; an intersection of these sets that is not empty is a success.

Feasibility

Once we have reduced the search space given the caveats we can assess the feasibility of the brute-force attack with this excellent calculation. ("Thermodynamic Limitations" in Schneider B. Applied Cryptography pp. 157‐8).


Cross site scripting verification on a field which does not accept more than 20 characters While performing penetration testing, I got stuck to a point. There is a text field which does not accept more than 20 characters(server side validation). I inserted following piece of code to check XSS (From RSnake's XSS cheat sheet):

'';!--"<XSS>=&{()}

and verified the source for <XSS verses &lt;XSS to see if it is vulnerable. I got <XSSin the source which suggests that this field is vulnerable to cross site scripting.

Now I am trying to create some code which should be less or equal to 20 characters and could be executed on this field to confirm the XSS but I am finding it hard. So in this case I have basically two questions:

1: Can someone help with such piece of code?

2: To mitigate XSS, validation for max-length(15-20 characters) could be one of the options other than the combination of data validation + HTML encoding? Please assume business rules agrees with the 15-20 characters limit.

Hope I was able to explain the question and the scenario. Kindly let me know in case of any doubts.

I love irony.  Here's the line that was going to be my response.  And the error I received for posting it.

<script src=//h4k.me

Oops! Your answer couldn't be submitted because:

body must be at least 30 characters; you entered 20

Use variable recasting if at all possible before processing input (if not, regex to throw <'s /s etc out.)


Does a website's session key have to be unguessable if it's signed? I'm creating (what I believe to be) a cryptographically hard to guess session key to keep my users logged in by generating 32 random bytes (using crypto.randomBytes). I'm storing this in a cookie (as hex). The website will be using TLS.
The cookie library I'm using offers an option to sign the cookie with hmac sha256, so I enabled that too.
It just occurred to me now though, if users are unable to tamper with the cookie because I always check the signature, then does it even matter if session key is unguessable? Could I not just use a simple incrementing counter, knowing that the the hmac signature would prevent hacking?
Or perhaps the simple pattern of numbers would make the hmac breakable?

Including the signature in the session token makes it hard to guess.
Assume your token includes a signature and looks like this:
user_id:12,signature:5c9597f3c8245907ea71a89d9d39d08e

Of course, the first parts are easy to guess. The signature part is hard to guess. But what matters is whether the whole token is hard to guess, and since the signature is included, this is the case.
So the value you sign can be a simple incrementing counter, and that would be safe to use as a session token.


HTTP authentication: identify the client We have a web-site, where each user has to log-in to access a private area. Inside the private area, there are some information about the user, a profile, including some sensitive information (home address, bank details, etc.)

Naturally, we follow best practices here (strong hashing, SSL with the correct algorithms, check for weak passwords, etc...).

We also offer an API base on OAuth for third parties. In this way the user knows what a registered application can access, the application does not have to store the user credentials, we can limit what the application gets... all the usual benefits.
For example, the API can read the profile info, but the sensitive information is blanked out or omitted.

The problem is: we have a third party application that decided that using the API was no good; instead, it asks the credentials, store them (in plaintext...), and then authenticates using a POST. And reads user info doing screen-scraping. It actually then uses only the "public" information, but it could access also those sensitive information we would like not to disclose.

I am not particularly worried that the app will leak the user information (I think they did this way because they are sloppy/lazy, not malicious), but still this is less then desirable behavior. And it made me wonder: is there a way to handle this situation at the root?

I want to tackle the problem in the most effective way, and I am starting to wonder: is there a way to let the user login ONLY through your page?
To avoid that someone else authenticates using just a POST?
To the best of my knowledge, you can make it difficult to do (using one-time ids in the page/headers, using client-side (Javascript) hashing, etc.) but there is no way to be 100% sure the post comes from "your page". But I am no security expert, so I may be missing something. And in any case, which is the best way to mitigate the problem, making it impractical enough (but with little or no burden upon the user - no captcha - which will not solve the issue, anyway)?

EDIT: to be clear: I am not talking about solutions for "preventing" screen-scraping. We already have mitigations to make it hard (and others to make it even harder down the line) that will make this particular app desist. I am talking about the login process: what can you do to be sure the username and password came from your own form?
One of the "selling-point" of OAuth is that you give your credentials to someone (google, twitter) you trust; indeed, you are redirected to a form on the "trusted" domain. Besides looking at the url, the provenience of the credentials is enforced somehow? If so, how?

If they're screen-scraping, break their screen-scraper by changing your webpage.  Name the "password" field "username" and the "username" field "password".  Introduce a randomly-named hidden form field with random contents that needs to be posted back during login.  Introduce changes to the page structure that don't change the appearance.  Be creative.

Screen-scraping relies on "landmarks" on the page to find the important content.  If those landmarks are constantly shifting, the person writing the screen-scraper will need to constantly update it to keep it working, and hopefully will get the message that they shouldn't be doing things this way.


Analyzing possible encrypted USB stick I was given an USB stick which was used to secure some data from a work computer. However - the USB stick seems broken now, or encrypted, which would mean the information might be lost.

So, when connecting the USB stick to a computer the following files are being seen:

I had to blacken some titles cause of the privacy of the USB stick owner. As you can see (green arrows) there are normal folders as well as "encrypted" ones on the USB stick (also the the black files can be opened and viewed).

My initial thought was that something encrypted the USB stick - but I thought it was odd that only half of the files are encrypted.

I made a dd copy of the stick and ran fdisk -l on it, with the following results:

As you can see the partition table either doesnt exist or is in an unknown format. Maybe it is just a big FAT32 disk and fdisk tries to match something to have its standard partitions.

However it says in fdisk that there is a novell partition on there - is it possible that netware is using a format that is unknown and maybe different encoding and thats why those cryptic parameters happen?

Also, how is it possible that the file names are so cryptic, but windows is still able to tell that it is e.g. an mp4 file?

My questions basically are:

Is the USB stick rather encrypted or broken (wrong format etc)?
What can I do to restore the "encrypted" folders?

Occasionally, Windows will format the entire device as a FAT or NTFS volume. You can try mounting it (/dev/sdb) instead of looking for a partition on it. That might explain the incorrect partition layout.

As for the filenames, I had a flash drive get corrupted (possibly due to removing it during a write) and it ended up with similar filenames and it had filesizes that aren't possible. If it is a FAT32 device then it could be a damaged FAT.

For the mp4 file, Windows detects files by filename, so it probably just happened to have a .mp4 filename in the random gibberish that the name turned into.


How to properly implement pseudonymization In my company we want to implement pseudonymization to fulfill some GDPR requirements. From what I understand, the purpose of pseudonymization is to prohibit easy access to all information about one person. You give this person a pseudonym, then store his/her data divided in different places. This way, someone using system A, doesn't have easy access to data stored in system B. But what about system administrators who can access databases of all the systems and easily connect the partitioned data?

Is it OK for system administrators to have such option?
How to protect the data from access by system administrators?
Is it possible to have pseudonymized data when there are people with access to all the databases?

Just because a system administrator have access to the database doesn't necessarily mean that the administrator need to have access to all the data. You can encrypt the data to prevent the system administrator from having access to the data. If the encryption happens at the client side and only the users have access to the encryption keys, then you can design it so the system administrator would not be able to decrypt the data. Using public key cryptography, you can allow data entered by one user to be read by a different user, without the first user having to share their own encryption key to the second user.

Of course most real applications need the server to do some work with parts of the data, usually to allow searching the database, you'll need to rethink these aspects of the application. Perhaps, you can store a second hashed_name field so you can search based on the user's name without disclosing the actual name. Perhaps you can store a general location of addresses in plain text and have the full address encrypted.

You'll also need to consider if there are any data that can be correlated with other data to leak information even after encryption/hashing. For example, you may hash a disease's name so you can use the field for searching patients with that disease, but by correlating the frequency of occurrence of the hashed names can be correlated with publicly available data about prevalence of diseases to reduce the number of possibilities that each hashed names can be. You may want to consider whether such advanced attack scenarios would be in scope or to accept tree risk and limit the pseudonymization only to opportunistic attackers.

You can also enforce physical partitioning so that system A and B are managed independently by separate teams, running on separate hardware and resources (share nothing). This way, you ensure that no single system holds all the data and data leak will require at least two person from different teams to collude.


Does this Google Android Note4 activity look legit? I noticed some activity on my phone via myactivity.google.com that has been occurring recently at 3 AM which I am very suspicious of.  While I am frequently up at that hour I know it's happening when I'm not up.  Details:

Started a week or two ago
Always occurs at exactly 3 AM
It may coincide with new/updated apps and or permission changes but I'm not sure
No visible changes to the phone during that time, eg. screen doesn't turn on, indicator lights look normal

Am I being paranoid?

The 2nd part of this question is, presuming this activity is does not appear normal what would be the best approach to acquire more information about what is going on? I'm right at home on with a traditional web/app server, but not sure where to look in Android.  Device is an un-rooted Verizon Note 4

I can vouch that the activity is "normal" at least as "normal" as Google's hive mind panopticon can be.  I have a device running 6.0 and a device running 7.0 (they are unrooted Samsung with minimal apps and no sideloads or Knox triggers which pretty well assures that there's not anything malicious running) and they both also show the 3:00 a.m. activity similar to yours, not every day and not each type but both do show it a few times over the past week.


How do shared hosts protect different sites? I host all my websites from a single VPN, and am about to sell some limited space of my Linode to a friend to host their new blog. It'll simply be another entry in Apache, and then a dedicated folder to that website which will contain all the Wordpress files.

My issue is with security. If someone manages to compromise his Wordpress blog, will my other sites on the same box be compromised?

What is the easiest way to prevent or make an effort to prevent any of the files in his website directory or anyone that gains access there, getting access to any of my other folders or files?

With the setup you've proposed there, yes.  The only solution here is something like suPHP.  If his website runs as the same user as your website, there is nothing that you can do to protect yourself.  You need to set his website up as a different user, and ensure permissions on all the files are tight (0700 ideally).


Noob question on security of localhost This may already have been answered, but I'm having difficulty understanding the technical jargon of various posts.
I have to give a Callback URL to receive some sort of validation, to use an API. Does providing my localhost url (https://...), make it possible for someone on the other end (e.g. the people that run the API) to get into my computer? Also, am I able to provide the localhost url whilst using a VPN? Thanks and apologies for the simpleton nature of this post:)

Localhost is the name that each computer (most computers) has on its loopback interface. You should see this interface as an interface that is attached only to your local system. By definition, the whole 127.0.0.0/8 (or ::1/128 for IPv6) subnet is reserved for this interface. Only your own computer can access this network.
If your service only listens to the loopback address, then the client must be on that loopback network too. And there is only one interface (loopback) on that network.
You can also look at it from the point of IP routing. Suppose I have two computers. A wants to talk to the loopback interface of B. So, what would the IP address be? 127.0.0.1. But that is already A's own loopback interface, so A will try to connect to its own loopback interface and not that of B.
Now, your question is "is it possible", then the answer is that perhaps, having control over both computers, I could start routing on B and get A off the standard 127.0.0.1 for its loopback, than maybe if A and B are on the same switch (L2 connected) I could perhaps make it work.  But for all practical purposes:

An url https://localhost or http://127.0.0.1 cannot be reached from outside your computer
A VPN is for this like an ordinary network, and, as explained that won't work either.


How can I protect myself from Evercookies? I recently learned about the existence of the Evercookie.  Is there any way I can prevent an Evercookie being placed on my computer without disabling JavaScript or cookies entirely?  I don't want tracking cookies constantly on my machine that I can't get rid of.  Apparently even though my antivirus finds and removes the tracking cookies, they are immediately replicated after deletion.

Maybe I'm just being a little too paranoid, but I don't like the idea of someone putting something on my machine that can track my browsing habits and actively resists my attempts to remove it.

If you really are worried, build yourself a new virtual machine each time you want to use the Internet.

If may be that some websites take a signature from everyone who connects to them so if you are that worried you should also connect from a different physical location each time, use TOR etc. But this process will negatively impact your enjoyment of the delights the Internet has to offer.


How to configure SSH public key per user? I have an OpenSSH server running and different users can log into it with different privileges.

I know you can enable public key authentication and place all the allowed public keys in the authorized_keys file. But that only restricts which hosts can log in.

I would like to configure public key authentication so that logging in as user1 would require a different key compared to logging in as user2.

Is there a way to achieve this using OpenSSH?

SSH actually requires you to configure different keys for different users.

Each user account on the destination machine has its own ~/.ssh/authorized_keys (doesn't necessarily have to have, it might not exist).

Let's assume you have server and client.

server has users set up as follows:

/home/srv_user01
                /.ssh/authorized_keys
                        --> contains public key of cli_user01
                                 and public key of cli_user03
/home/srv_user02
                /.ssh/authorized_keys
                        --> empty or non-existing
/home/srv_user03
                /.ssh/authorized_keys
                        --> contains public key of cli_user03

client has three accounts cli_user01, cli_user02, and cli_user03.

On client machine:

cli_user01 can execute ssh srv_user01@server and login to server as srv_user01
cli_user02 cannot connect to server at all
cli_user03 can execute:

ssh srv_user01@server and login to server as srv_user01, or
ssh srv_user03@server and login to server as srv_user03

no user can connect and login as srv_user02 on server

In the example above I used different names on client and server side, but if account name was the same on client and server, user doesn't have to specify the account name in ssh command, thus making the impression of "logging to server". So if I am logged on as user on client and execute ssh serverーit is the same as ssh user@server.

On server one sshd process listens on port 22 (default) and receives connections from each of the connecting users.


Why bother with certain types of 2fa if they can be easily bypassed? In the wild, there is a method of bypassing 2fa.  The gist of it is that the attacker doesn't just phish the password, but they also phish the 2nd factor and use those for a real login on their own machine. (described in detail here https://www.wandera.com/bypassing-2fa/).  In this attack scenario, 2fa gives a false sense of security and makes it more likely to fall victim to phishing.  After all if my only protection against getting phished is checking the certificate and URL, then I'll be more likely to double check it compared to just having bought into a brand new shiny 2nd factor that touts itself to be fool proof.

If I get phished like this with the 2nd factor, the hacker is in and as long as they don't log out, they can stay in for a very long time causing all kinds of trouble.

Clearly the 2fa has a disadvantage of creating a false sense of security.   The only advantages I could see is for users who share the same password across different services or for making subsequent logins using the same credentials impossible.  Aren't those advantages too small relative to the disadvantage?

Obviously the answer here is re-education.  Tell users to use 2fa but be keep being vigilant - make them aware of this type of attack and how nasty it is even with 2fa.  But that's hard to do considering how many 2fa solutions are pushed as "THE" ultimate final solution for phishing.  It's just not true and in many ways it makes the problem worse - especially for websites.  Am I missing something?

Yes, TOTP and HOTP (in addition to email, SMS, etc) are vulnerable to this. Why do we use them? Because they're easy to implement, and they do provide some protection. As long as the majority of people aren't using any sort of 2nd factor, phishers will predominantly target those users, as MitM phishing (debatably) takes more effort.

I've said it before and I'll say it again, once most people have started using 2FA for their important accounts, this sort of MitM phishing will become much more common. The way to prevent this is U2F or WebAuthn, which both use public key cryptography to authenticate to the server, and communicate with the browser to verify that the domain name you've visited matches the domain you registered the key for.

If you want to see a longer and (in my opinion) less biased blog post on the issue, I skimmed this Evilginx 2 blog post and it seems to cover everything pretty well (and even has some stuff about how phishing domains can avoid scanners that try to block them).

I was focused on phishing, but as Ajedi32 points out, 2FA is useful for more than just preventing phishing. It's useful whenever your password may be compromised but the second factor isn't.


Is getting 1-2 outputs from a CSPRNG to seed another CSPRNG less entropy than getting say 5000 outputs from a CSPRNG and using that to seed? This question builds off of this question.
I want to create more entropy from a viable entropy source to seed another CSPRNG.
If I use

window.crypto.getRandomValues(newUint8Array(1))

To seed a CSPRNG, is that less entropy than if I used:

window.crypto.getRandomValues(newUint8Array(65536))

To seed the CSPRNG?
What I mean is if I derive 65536 bits from a CSPRNG, does that generate more entropy than if I just derived 1-2 bits from that CSPRNG?

Yes, more is more. Your terms are a bit off, as you can't generate entropy, and a Uint8 has 8 bits, but your basic assumption is correct. A larger seed will, in theory, produce less predictable results.

In practicals terms, you would need to watch out that your input seed to the CSPRNG accepts the format you generate. For numbers, this is often limited to 32 or 64 bits. If care is not taken in the conversion from 8 bits, you can easily lose entropy. The way around that is to use a modern CSPRNG like fortuna that cannot be over-seeded and is very forgiving about input format.


How to evaluate the damage after being hacked It's well known what measures one should take to prevent hackers from hacking their PC.  But are there any steps that allows a user to evaluate the damage done by a hacker?

Say that I know for sure that someone hacked me yesterday. But I have no idea what they did when they were in my PC. Is there a way to know what files they took (if any) or what exploit the attacker used to gain access?

So there are really two sides to this question.

1. What can I do NOW. I am hacked.

a. You can view your system logs. Instead of trying to parse through the differnet logs on your system, it might be easier to use a timeline tool such as log2timeline. This will gather all timeline evidence artifacts and put them in an easy to read .csv file. Timeline information is really all of the available log sources in one place. This can really help you determine various indicators of compromise and help you find where you need to spend some time digging on your system.

b. You really need to capture a snapshot of your memory as soon as you can. It is very possible that there are still remnants of malware on your system or cached network information about the attacker. There are several free memory acquisition tools available, such as MoonSols DumpIt. Once you have a copy of your memory, you will need to analyze it, and can use a tool like Mandiant Redline (also free).

c. If you are really serious about finding what was taken on your system, you really should take a forensic image of your hard drive and work off of the image, for accountability sake. There are some free HDD imaging tools, like FTK Imager. Once you have a snapshot of your HDD, you can run it through a forensic acquisition toolkit like the Autopsy forensic suite. You can then run the files against a bad file hash list, which will alert on malicious files on your PC based on hashes taken of the malware in the past. You can load the hash lists in your forensic acquisition tool and run it against your file system. You can find free and up to date hash lists at the NSRL (National Software Reference Library).

2. How to prevent getting hacked in the future.

a. It is a good idea to use log collection and analysis tool on your PC's, a HIDS agent. OSSEC is an open source HIDS agent that works very well. It gathers logs from your PC's as well as monitoring system critical files and registry entries.

b. It is a good idea to employ a NIDS system. This will watch for signs of compromise over the wire. Tools such as suricata provide excellent monitoring capabilities. Check out SecurityOnion. It is a linux distro packed with tools such as suricata. It makes setting up a NIDS system super easy.

c. You really need to keep on top of patching. Employ a vulnerability assessment tool such as OpenVAS (Open source). This will help you keep on top of vulnerabilities on your network.

d. Have a solid Incident Response plan!!! This is so important.

e. Follow the SANS top 20 Critical Security Controls.


How reliable is ASP.NET's Request Validation feature? ASP.NET offers an extra layer to protect your application from XSS attacks and injection in general which is called Request validation.

On their official topic, they mention that:

  Even if you're using request validation, you should HTML-encode text that you get from users before you display it on a page.

Assuming that a web application doesn't validate or sanitize any data sent to the server but does have the feature enabled, how could one bypass this extra layer to submit malicious code? Is this feature necessary for an ASP.NET application?

As a penetration tester I have found that "Request Validation" fails in a number of situations.  Developers tend to believe that "Request Validation" == "magic",  and it protects them completely from XSS,  when in fact this false sense of security results in in very serious problems.  All forms of DOM based XSS and Persistent XSS will bypass "Request Validation",  and there are other cases where it fails:

In this next case the attacker does not need to write an HTML tag,  by simply writing a JavaScript URI an attacker can execute JavaScript:

xss

In this case the attacker is already writing within a script tag:


How does SHA3 (Keccak & SHAKE) compare to SHA2? Should I use non-SHAKE parameters? Keccak is the winner of the SHA3 competition. Since Keccak is highly customizable (presumably for security/memory/time/speed tradeoffs) there does seem to be some controversy around how Keccak compares to SHA2.  SHAKE appears to be a set of parameters to reduce friction in the drop-in replacement of SHA2

How does Keccak/SHAKE compare to SHA2 in terms of :

bits of security
bit pre-image resistance
second pre-image resistance
the statement "security strength levels above 256 bits is meaningless."
"SHA-3 is less appropriate for use as a PRF for pbkdf2 than SHA-2"
Any other criteria worthy of comparison

Given that this is a very complex topic, and Keccak having many permutations, I think it's possible the SHAKE simplification may have removed some flexibility, security, and performance from certain scenarios...

That being said, what scenarios are worth diverging from the SHAKE standard and using Keccak directly (for lack of a better analogy)?

NIST has an excellent document detailing the reasons behind why they wanted to create SHA-3 and shortcomings in SHA-2 which seems to address many of your questions. Specifically this document covers both the design challenges and how Keccak addresses these.

http://csrc.nist.gov/groups/ST/hash/sha-3/documents/burr_dimacs2013_presentation.pdf


Risks of letting the browser open local/network file system listing Browsers do not generally allow web pages to interact with client-side file system as a security measure. I would like to know what can go wrong with the following scenario:

  Clicking a special hyperlink in a browser opens a link specified folder in windows file explorer.

Steps to achieve this:

A Protocol handler application is installed on browser machines.
It registers itself for nfx: protocol, (similar to mail clients, which register mailto: protocol)
When a User clicks a hyperlink with an href="nfx://machinename/share/folder/"
The Protocol Handler application is launched with the above URL as a process argument by the browser.
All / are converted to Path Separator (for e.g \), nfx: is removed from the start of the URL. And the result \\machinename\share\folder\ is checked if directory exists.
If it exists, the user is asked to confirm whether they want to open this folder If the user confirms then explorer.exe is launched with \\machinename\share\folder\ as parameter.
Protocol launcher application exits.

Why was this done (In case this a XY problem):

I have a requirement where regularly updated installers are kept on a network path.
A webpage will list all the available installers.
Clicking on the link should take the user to Installer location.
We are not expected to download, or directly launch the installer from the webpage. The user can decide if he wants to run the installer once the folder is opened in windows explorer.

How dangerous will opening a network folder or local folder like this be?

The part I don't like is the network path.

It should be ok if you chceck the path does not contain characters not allowed in path, that the path is a folder and that it is on the local machine.

However, if you allow remote file system, you are suddenly allowing the webpage to request a potentialy insecure connection to an unknown sysytem, that could send back a whole range of garbage to a black box app from Microsoft of all people. There are likely vulnerabilities in explorer that could be abused here.


If two servers are in the same private network, is it better for them to talk to each other through HTTP or HTTPS? Is anyone kind enough to tell me what actual companies do about the matter? This is assuming the company doesn't run the risk of having insiders sniffing the packets.

In general it is more secure for communications to make use of encrypted (https) communications.

For data, that is PII or financial in nature I alway recommend secure protocol.

However, when you introduce encryption it can make some processes more difficult.

Debugging - it is harder to analyze network traffic to find issue.
IDS/IPS - There network appliance analyze traffic and respond to attacks. If they cannot see into traffic they have less info to respond with.
Latency/ CPU cost - Adding encryption increase the time before first connection and the cpu power needed to communicate (https://istlsfastyet.com/). The intro of http2 has lowered the latency somewhat and modern hardway usually has crypto acceleration built in.
PKI management - HTTPS Pki management is difficult is using private certificates for local domains.

On a private network, the need for https is greatly reduced but issues such as snippers and accidental leaks do exist.  It really depends on the private network, data and risk tolerance.
For example:

Log data flowing between two server by a shielded-wire in a datacenter in a locked cage. May not need encryption.
Open wifi with no encryption, I would strongly recommend here.

PKI based tls is more expensive via computations and required more set up.  Instead you may want to use encryption that relies on pre-shared keys. If you can securely enter the keys.


What is the probability of a desktop machine being compromised? I want to do a formal cost-benefit analysis of security measures - and hence am looking for hard statistics about the probability / frequency of desktop machines being compromised (not recommendations of how to avoid this). I appreciate that this will vary massively depending on how well managed a particular estate is, what security controls are in place, and impact will vary massively depending on the nature of the attack, but currently I have nothing to go on apart from vendor propaganda.

My googling only turns up thousands of articles containing the same advice about how to avoid  being compromised.

While this is exactly the question asked here I don't see an answer there.

There is no "hard statistics" on desktop compromise. There is only case study and research into limited contexts where compromise has occurred. But that data is not useful for making inferences in other contexts.

Case studies and "vendor propaganda" study a limited set of systems and compare the historical results. That's great if your system is in the same context, have the same users, threats, processes, etc. etc. They don't tend to include systems in similar contexts that have a different result because that just gets confusing as a narrative.

There's a reason why you can't Google this and get an authoritative data set: the number of factors involved are numerous, interrelated (one factor can affect another), and there is often no linear causal relationship between the factors and the outcome. It's a "Complex Problem" (also known as a "wicked problem").

Probability and cost/benefit analyses depend on a stable system. The problem with information security is that stable digital systems are unusual. Digital systems get more complex with every update, patches alter how systems function, the system context can change, people use and maintain the system, and the external threats to the system are sentient and adaptive. Each of those factors changes the underlying basis for a calculation.

There are ways to get closer to a probability calculation using formal probability approaches. And you will want to read How To Measure Anything in Cybersecurity Risk for that. But the author takes the approach that systems and their context do not change enough to worry about deviations. I debate that as a universal premise. It's true in some contexts, just not any that I have worked in.

If you constrain your analyses to the stable form of a system, then you can end up with a calculation for a system state and context that no longer exists. Fancy answers that are functionally useless as a decision support for what to do next.

To do the analysis that you want to do:

Analyse your systems in context to identify those factors that are linear with known and limited cause/effect contexts. What's linear for you might not be linear in another org (and what's linear for you might change over time). You then work out probabilities for those things.
Then you need to identify the non-linear contexts, the Complex contexts, and get as many people who know the systems and contexts together to get their opinions. For Complex contexts, you can't use linear calculations of probabilities: you need perspectives. Then you track those opinions over time.

There is a very real possibility that you will not be able to perform a cost/benefit forecast analysis, only a retrospective one. Knowing that is very important.

To learn more about this problem, look up:

Dr Nancy Leveson from MIT - she asserts there is a complexity threshold in social-technical systems where impact and likelihood is inherently unpredictable
Dr David Snowden - creator of the Cynefin Framework around making sense of contexts that are a mix of the linear and non-linear (and then what to do about it)
WEF's "Towards Quantification of Cyber Risk" - promoting the "Value-at-Risk" approach, which is a nice way of averaging out the historical data to make some useful inferences
I have also done work in this area for a few years. My first slide deck after I asked this same question six years ago.

The slide deck explains how several frameworks approach this problem:

COSO
ISO 31000/ ISO 27005
NIST 800-39
RISK IT
FAIR
OCTAVE Allegro

The US Government Accountability Office (GAO) has this to say about the problem:

  “Reliably assessing information security risks can be more difﬁcult
  than assessing other types of risks, because the data on the
  likelihood and costs associated with information security risk factors
  are often more limited and because risk factors are constantly
  changing.”

  “Even if precise information were available, it would soon be out of
  date due to fast-paced changes in technology and factors such as
  improvements in tools available to would-be intruders.”


Can I use Qubes through a VM without compromising its security? Like the title says, will using Qubes through a VM compromise its security aspects in any way? Is it "mandatory" to install it properly (like in a dual-boot enviroment) or can I achieve the same results using a VM?

Using Qubes through VM is all about compromising security. Qubes is unique for its Xen kernel which is perfect for sandboxing and written with less code (fewer security holes).

In Qubes, if you somehow get hacked, the attacker can gain access to your AppVM but not dom0, which means that your other AppVMs will most likely stay untouched. If you run Qubes inside insecure host OS, the attacker can gain full access to your host system following everything it runs.

After all, note the official installation text reads: We don’t recommend installing Qubes in a virtual machine! It will likely not work. Best option for you is installing Qubes-only and create as many HVM templates as you want, so you can run more operating systems at once.


Is Java relevant to Information Security? I'm currently studying Computer Science, where we're teached Java programming. I want to get into the IT-security field, but it seems to me that Ruby and Python are more relevant for that, so I have a hard time motivating myself to learn Java.

But do Java have a place in modern IT-Security compared to say, Ruby or Python?

Programming is relevant to IT-Security; it may be subtitled as "yeah, I kinda grasp the concepts of what I am blabbing about". You cannot be a decent practitioner of IT security if you cannot imagine what occurs in a computer beyond something like "then magic occurs". This necessarily implies some basic skills at development.

The exact programming language does not matter much. In fact, if the programming language matters to you, then you don't know enough programming yet. If you want to "get into the IT-security field" then you must reach the point where your question feels ridiculous, as in "how could I have been such a twerp to ask such a silly question ?". Meanwhile, go learn how to do basic programming in at least two or three different languages (Java may be one of them); this is the path to enlightenment.


Validating the ROA certificate Suppose I have a system, where the server requires the clients to attach their ROA certificate to prove that they have the right to that IP Prefix.

Now if the client attaches the ROA certificate ( which has an extension of .roa ) , I am able to pretty print it using rcynic.

When I print it , there are different fields for validity, IP prefix , public key, etc.  N

I have come across the RPKI protocol where the ROA's are cached in the router's database and is constantly updated. But I want to know weather I can assume that If a client posseses a ROA certificate, it is valid(after confirming the fields of validity)? Or is there a way to verify that the certificate is valid.

One of the key factors (pardon the pun) of RPKI is the network of 'trust anchors' (think CAs) that validate the ROA certificates. You need to check with them to see if the submitted ROA is valid.


Printer IP scanning via Nmap I want to scan printer IPs in my organization.  Is there authentic method? I am using Nmap. I have already checked some commands like:

1) nmap -O 10.10x.x.0/24 -oG - | grep printer >> outfile
2) nmap -p 9100,515,631 192.168.1.1/24 -oX printers.xm

With option 2 I have obtained an xml file, but I don't how to read this file to identify printers because I got many IP's whether they are PCs or printers.

Nmap scan report for 192.168.x.x
Host is up (0.00082s latency).
PORT     STATE    SERVICE
515/tcp  filtered printer
631/tcp  filtered ipp
9100/tcp filtered jetdirect

Kindly help me to find out printer IP. I am really messing up. If you want to suggest any command kindly also add some brief instruction for printer IP identification.
One more thing, what is filtered state here?

nmap really isn't designed to do what you're looking for. You would have to know exactly what you are looking for and grep the output for those things, just like you did in your example. But that will only work if the printer responds to pings, and if printers return the results that you expect.

You might be able to eliminate some results by knowing what the OS is on the printers and eliminating results that do not report that OS.


How do I allow only app to view/download files from server? I have an Android app that uploads and downloads pictures from my dedicated server. However, before I go live, I want to know if there is some way I can secure the server to allow only my app to access and view the files on it. The app currently gets the files from the server through a URL. These files are sensitive and I wouldn't want them to be visible to all.

Is there some way I can set a username and password lock on directories on the server and if yes, how do I allow my Android app to open these directories.

You are asking two questions (I'm paraphrasing you...)

  Can I allow only my app to access my server?

No, this is impossible. You cannot control the client. Root  phone. Start debugger. Get your key. Create own app with your key.

  How do I secure my server?

Use a security framework for your app server. If, for example, you are using Java Spring, you could use Spring Security which handles authentication and authorization.


Covert, Overt, and side channels I am really confused between the following three terms:

Overt Channel.
Covert Channel.
Side-Channel.

I feel frustrated! I've been searching about them to find a clear explanation but I keep getting confused more. I REALLY apology if this question is redundant but my brain got stuck from the long search.

Thank you

An overt channel is a communications path that is not hidden.  Anyone can see that Steve connected to Stack Exchange.

A covert channel is an intentional communications path that is hidden, using a technique like steganography.  This might use a technique like a dead drop, where I post a picture on eBay, you view the posting on eBay, but nobody can easily see that John sent a picture to Steve.  That picture might then contain a hidden message, either encoded in the bits of the photo, or in a prearranged meaning of the photo:  "if I post a picture of a teapot with the spout pointing left, that means attack at noon.  If I post a picture of a teapot with the spout pointing right, that means attack at midnight.  If I post a picture of a teacup, the plans are on hold."  This is an example of a covert storage channel.

Another type of covert channel can be created by hiding a message by varying the timing of otherwise normal communications.  Imagine a streaming video that is "suffering" from occasional interruptions in the stream; it would be easy to imagine it's just a system load problem.  The timing of the interruptions could be used to convey information:  a long pause followed by a short pause could be interpreted as the Morse Code letter 'N', for example.  That is a covert timing channel.

The primary differences between these two types is that a storage channel leaves some evidence behind but doesn't require the recipient to be listening for the message; a timing channel leaves almost no trace of its existence, but requires the receiver to be actively listening to receive the hidden message.

A side-channel is typically a case of unintended information leakage, and not the intended means of communication.  Common cases are RF emissions from keyboards or monitors (google for TEMPEST to see examples of this), timing differences (this paper: http://cr.yp.to/antiforgery/cachetiming-20050414.pdf documents a timing attack on SSL), or power consumption differences (see the paper available at this address:  https://www.rambus.com/differential-power-analysis/ ).  Sometimes these differences can be used to discover enough bits of an encryption key to break the encryption.


Secure cookies - set them in application or the webserver? Newbie here.

I am aware that the Secure flag for cookies can be set either in Webserver configuration or in the application. What would be the best approach? Fix them in the code, or fix them in the Webserver? Or fix them at both the places? A lot of times, I have seen IT teams fixing this vulnerability only on the webserver configuration, leaving the application code untouched. Any downside in setting the cookie only in the Webserver and not in the application?

Using the webserver makes sure you don't forget any cookies. Using the application makes sure you can make a cookie without the flags, which may be important especially for httpOnly.

I recommend using both, so that if you need, you can disable the server one and just use the one in application for cookies that need the flag and also create cookies without it. It would be undesirable to have to go trough the code in retrospect looking for all the places cookies are used.

Of course, you may be able to create an exception in the server config as well, but better safe then sorry. Using both is the best option IMO, as there is no reason not to.


Why does it take so much time to create a secret key on a HSM? I was testing key generation on a Hardware Security Module and I noticed that it takes so much time to generate an AES 256 secret key on the HSM.
I've used pkcs11-tool to generate the key and it took about 5 sec to complete the task:
$ pkcs11-tool --module <modules.so> --key-type aes:32 -p <PIN> --token-label SC_TEST --keygen --id 6887513122

Secret Key Object; AES length 32
  VALUE:      622650851419537140e20f58570bf1815d523d7a673dbbfd34d04a635326bb12
  label:
  ID:         6887513122
  Usage:      encrypt, decrypt, wrap, unwrap

real    0m4.847s
user    0m0.022s
sys     0m0.015s

OpenSSL on the other hand is very fast (does not use a HSM):
$ touch file
$ openssl aes-256-cbc -pbkdf2 -nosalt -P -in file -pass pass:testpassphrase

key=4E1F51BCB47608C267B9AE35E4648926D8A9E671521747E942857FC9671FC52B
iv =F773521265678AB0F4D6AA9AFED6912A

real    0m0.026s
user    0m0.023s
sys     0m0.004s

So I wanted to know why does it take so long to generate keys on the HSM? Or am I doing something wrong?
Note that this is high end and expensive HSM.
Edit:
I've tried a native tool (nCipher generatekey) and it is a lot faster (roughly 1 sec), but I think that it does not use PKCS11 to communicate with the HSM.

One reason can be that the random generator is waiting for sufficient entropy.


Unsafe to not provide full path to powershell script? Is the following statement in a batch file unsafe?

powershell -executionpolicy bypass -File .\test.ps1

test.ps1 is located in the same folder as the batch file.

Is it possible to add something in the default powershell profile script (C:\Users\Username\Documents\WindowsPowerShell) so that another test.ps1 is loaded (e.g. a test.ps1 in a %temp% folder, instead of test.ps1 in the same folder as the batch file)

.\test.ps1 is a relative reference to a file in the current subdirectory.

There is no way that I am aware of to change how the OS will treat that path reference via a PS profile.

Note that if your batch file is located in the system path, and it is invoked from a directory other than the one where it is located, the .\test.ps1 reference will fail.

In that case, you need to use a full path to reference the file EG -File c:\scripts\test.ps1


secure use of psexec? As of March 7, 2014 PsExec now "encrypts all communication between local and remote systems, including the transmission of command information such as the user name and password under which the remote program executes."

With that said I still have security issue. If I use PsExec to remotely execute a script on my entire network it will be done using a highly privileged account. Those credentials will remain in memory of each of the workstations Il run the script on. If one of those workstations is infected with malware it can be problematic.  Is there any way to avoid this? If I run PsExec using the system parameter will it still hold my domain account credentials?  Is there any way that my credentials won't be saved in memory using PsExec?

This was answered at SANS' forensic blog in the comments section, here is the excerpt:

QUESTION

  Are not you running all the commands in this article on your trusted
  workstation?

ANSWER

  Yes, I'm running them on my trusted machine. However, if I run 'psexec -u' from my trusted machine, it sends the password to the
  remote untrusted machine and performs an interactive logon. We need to
  avoid this. So one workaround was to use RunAs to lunch a new command
  shell as my privileged account on my trusted machine and then logon
  using psexec without '-u'. This avoids sending the password and
  creating the interactive logon on the remote untrusted host.

QUESTION

  Are not your hashes going to untrusted machine with runAs?

ANSWER

  Not in the scenario I just described, because I would be authenticating with a network logon.

QUESTION

  are your hashes will stored on your trusted workstation or where?

ANSWER

  Yes, the hashes of my privileged account will be stored on my local trusted workstation once I use RunAs to start a command shell as
  that user.

QUESTION

  How a workaroud is that I coudlnt get it.

ANSWER

  If you're asking why it is a workaround, it's a workaround in the sense that I can connect to a remote machine using a privileged
  account without having to use the '-u' option. Instead it uses the
  credentials of the currently logged on privileged user within the
  RunAs session.


Best way to ensure integrity of encrypted data which is kept in a public place I need to keep sensitive data in a de fact public place (i.e. with a user, e.g. in a cookie) and only there (no copy or hash of that data should be kept on the server).

The data was encrypted AES/CBC and the private AES key is kept secret on the server (the kind and safety of this key should not be a concern here, let's say it is beyond doubt).

To make use of the data the user sends the encrypted data to the server, which decrypts it with the private key.

So far so good, but here is my question: I need to ensure the integrity of the data (i.e. make sure the user did not temper with the data).

What are my options to ensure the integrity?

Constraint: ideally I would not have to store any derivate of the encrypted data on the server, not even its HMAC hash.

You can append both the intended recipient, possible a timestamp or counter (see Ángel's comment), and the hash to the original data, and then encrypt. Upon decryption, you can compare the origin, and the original intended recipient, as well as the hash.

This will not prevent other parties from tampering with the encrypted blob before it reaches your server, but it will enable you to verify it when it reaches your server.


Signing JWTs with server's SSL/TLS certificate I have a server that needs to sign JWTs asymmetrically. I can either generate a new public/private keypair or re-use my keypair used for my server certificate. Is there any concern about re-using my server's certificate? That way, anyone verifying the JWT can use the public key in my certificate.

(We can assume the private key meets the JWT recommendations in terms of keylength)

Generally, it is discouraged to re-use cryptographic secrets.

From a security perspective, your private key's exposure will probably increase, as the application signing the JWTs will need to have access to it. Depending on your setup this may or may not be the case. If the process terminating the TLS connection is a reverse proxy or a load balancer than this is extra exposure. You need to decide whether this is acceptable.

Engineering wise, you are creating a hidden dependency here. Certificates are renewed and the underlying keypair used may or may not change. If it does, all your previously signed JWTs will be "invalid" (given that the pub key is taken from the current certificate). Note that the "Web" does not rely on the fact that the key is the same in the renewed certificate.

I do not see anything seriously wrong with this idea but would recommend against it for the reasons stated above.


Would CVE-2016-0728 affect Docker? I ended up having a discussion about Docker and system security today and we came to the point where we asked ourselves of the latest CVE-2016-0728 exploit (privilege escalation) would affect Docker containers as well.

Docker utilizes the system kernel (which may be vulnerable) but isolates the the user (root within it's own little space). My questions are the following:

Does CVE-2016-0728 affect Docker instances?
Will users within a container be able to use CVE-2016-0728 to break out of the container?

This is not a privilege escalation where code gets "only" executed as a higher privileged user. This issue is about execution of code inside the Linux kernel, i.e. the kernel which gets shared between all docker instances and the OS containing the docker instances. This is the highest privilege one could get and at this level one can bypass any kind of restrictions. This means that an unprivileged user which is able to execute this attack can break out of the container.


Is SSL/TLS Sufficient For Safe Transit of Bianry Data via API Traffic We are using object storage from the vendor of our cloud server to store image templates (vhd) of our cloud server in the event that we need to re-provision our server install quickly. We would like to transfer this via an API to another vendor to provide an additional layer of security should something happen to our primary vendor.

Both vendors provide encryption for the vhd in object storage at rest, but there is a concern that the data should also be encrypted during transit. The API will be using the HTTPS protocol, but management thinks that is not sufficient and that we need to encrypt the data itself before it is sent. The vhd file is about 12G, so it will take some time to transfer.
So assuming that both ends of the transaction provide encryption at rest:

Is SSL/TLS sufficient for safe transit of the file?

Does HTTPS/SSL protect binary data or just plain text?

Does the length of time that it will take to transfer a file of that size pose additional security risks over plain text?

Is the concern with the additional layer of encryption justified?

This question can be rephrased as: Is there a situation in which the attacker can compromise TLS, but not additional encryption? The answer lies in the implementation of either system.

  The API will be using the HTTPS protocol, but management thinks that is not sufficient and that we need to encrypt the data itself before it is sent.

Management always seems to think that more is better, but you have to think about where the keys are in order to develop a threat model. Are the servers which have the data the same servers that are establishing the TLS connection? If so, then encrypting it before being sent would provide no benefit, since a compromise of those servers would simultaneously provide both encryption keys.

  Is SSL/TLS sufficient for safe transit of the file?

Assuming it is properly configured, it is safe and sufficient. You want to select a secure cipher suite. There are online guides for selecting a good TLS suite. For an internal API, not all of this is needed, as you can act as your own CA safely.

  Does HTTPS/SSL protect binary data or just plain text?

In the HTTP protocol, the only thing that hints at the type of data is the Content-Type header. This header tells the end application how to interpret what it receives. TLS operates on a layer above that, and as such the encoding is irrelevant. It blindly encrypts all data, including headers.

  Does the length of time that it will take to transfer a file of that size pose additional security risks over plain text?

The amount of time it takes to transfer data over TLS does not impact its security. No modern cipher is going to weaken just because you are encrypting a large amount of data. TLS is fast enough that, on all but the oldest hardware, it will perform equally well as a plain connection.

  Is the concern with the additional layer of encryption justified?

Assuming your network topography is such that TLS will provide end-to-end encryption, then no, there is no justification for additional crypto. The added complexity may introduce bugs. If you control both servers, you can use a self-signed certificate and verify the fingerprint, so you do not need to rely on a CA for authentication.

In other words, the only time that it would not be sufficient is if any of the following is true:

There is a weakness in the design or implementation of TLS.
A feature you require is not present in TLS.
There is a situation where an attacker can obtain the TLS key without obtaining the other key.

If none of these are true, then TLS will provide three primary guarantees:

Authentication - You can be sure that the connection on the other end is who they say they are.
Integrity - In-transit data cannot be modified without the other end being aware of it.
Confidentiality - All traffic will only be readable to intended parties.

Extra encryption using GnuPG for example will provide no additional guarantees.


Using company wifi for inappropriate sites I was using my company's Wifi while I was trying to search inappropriate things. But some pages were blocked. I stopped when I read the block pages saying that "company's name has blocked this site" or something similar. Will this alarm on their computers?

Yes, all traffic that goes through their internet (and blocks) will be logged.

What will trigger an alarm is something only your IT department can tell you. Every company (and IT dept) is different). In my company, you would have HR approaching you very soon...


How to get started in information security with sales background? I am currently a Masters student looking to change career from sales to IT, specifically Information Security. What are some good resources about finding jobs? What skills should I focus on to get a security job?

This was discussed recently here -> How do I get started with security? (beginner). There are some excellent answers there.

Additionally, Robin Wood has recently done some research on this topic and I think you will find it useful. He presented it at BSides London recently and has posted his findings on his blog - http://www.digininja.org/projects/breaking_in_part_1.php.

I also did a blog post with a friend (@securityninja) on something similar a few months ago - http://www.securityninja.co.uk/application-security/random-thoughts-on-education-learning-from-markofu/ - which you might find useful.


Online Shopping password keylogger risk Suppose I do an online shopping they are asking me to enter my card details like four digit number(whatever related to that) and they are asking me to enter the PIN number too.

If I enter all this things, Can't they get all keystroke from me through Javascript and crack my passwords, card details etc ?

I surfed for safety tips on online shopping, few article suggest to check whether it is a secured session layer supported website Means SSL, Here I have one more doubt SSL is used for Secure Transaction Between Client Browser and server so there won't be any intruder to pretend to me or some attack, what if the server person itself capture this details and make a duplicate card or something and they get all money etc?

If I use money transfer from other service like for example (paypal,stripe) then it is completely fine because they use OAuth but What if it is for internet banking? I'll be shopping through my bank account. Shop Website server can crack my passwords etc right?

I think you might be mixing a couple of risks up here.

If you are surfing a site and purchasing goods from them, then they will inevitably have access to any data you enter into their site.  This would include the username/password that they use on the site and likely any payment card details that you use to pay for things on their site.  This is because that data needs to be transferred to them to complete the transaction (no JavaScript needed)

As you say if they use a 3rd party site (e.g. paypal) to process the payment they your credentials for the payment site shouldn't be accessible by the shopping site, although it's here that if they were malicious they could try do something like redirect you to a site which looks like Paypal but isn't...

In terms of accessing your banking details, again, as long as you're not using the same credentials on the banking site as on the shopping site, they shouldn't be able to access your banking credentials.