How to measure the integrity of the OS (Linux)? I am working on a project which requires Integrity measurement of OS (Linux). One way to do that is using IMA but I am not sure if it fits in the scenario below.

The scenario of the project is some what like this:

The systems boots up and measurement is done using trusted-grub. So the PCR 0-7 are filled up. Then the OS is loaded (linux). Then I have a software named "Checker". The purpose of this software is to check if something is modified in the system or not. What I am thinking is that I will store the PCRs values for the "checker". Once the system is restarted and new values are extended into the PCRS, the existing (stored) PCRs values are then compared to the new PCRs values.

One thing I did is, I used a check-file feature in trusted-grub to ensure the integrity of my "checker" software as it will be only one executable file.

The problem is that now I want to measure the OS (preferably Linux) and extend the measurement into a PCR. But I am not getting any clue how to do that. I would be great if I can get any comment on how to solve this problem.


Proper Passing of Oauth2 Key to RobinHood API Original question is here https://stackoverflow.com/questions/59256905/r-and-shiny-app-secure-connection-to-third-party-robinhood-api

To summarise there is an R package that allows users to enter their login credentials to access their Robinhood account. The user assigns a variable which is sent to Robinhood, Robinhood then sends back an Oauth2 token and a user id.

The user then uses this Oauth2 token to call various functions that can do things like view account details, fetch historical trading data, and place orders. All these functions essentially construct URL's or Headers to interact with the Robinhood API using either a POST or GET request. The token and uid are never encrypted or protected in anyway once the user makes a request to the Robinhood API.

Is this safe to use?

Follow up question, which is likely to specific. Is this safe to use in an R Shiny web application and hosted over the web?

Is this safe to use?

The said R application will have access to all the functionality (view account details, fetch historical trading data, and place orders). You need to ask yourself if you truly trust this application.


Paths in web servers Using sqlmap I was able to gain access to one database and using --current-user and --privileges. I can confirm that the user is root@localhost with full privileges.
The part I have problem with is that I don't understand how the --os-shell works. I have googled a lot but all the tutorials are using easy targets which doesn't help in my case.
So here is the command I use for using the --os-shell function:
python sqlmap.py -u 'http://www.example.com/th/dim-news-detail.php?id=9&page_num=0' --identify-waf --tamper=between,randomcase,space2comment -v 3 --random-agent --level 3 --risk 3 --dbs --os-shell

After this, sqlmap wants me to choose a programming language and I choose PHP. After that, it asks me for a location to upload the shell. This is the part I have problem with. I don't know what location I should choose. Whatever I enter, sqlmap tries to upload it in directions after public_html and it fails to do so. I mean when I enter /var/www for example, sqlmap tries example.com/var/www which obviously doesn't exist! Can anyone please let me know how to process works and how I need to figure out the path?
I'm using webmin panel on this target server if that helps. I just need to know what criteria should the directory have in order for sqlmap to upload files to it and also I need to know how to upload --os-shell before public_html. I mean actual /var/www not example.com/var/www.

Unless there is a configuration issue or a specific vulnerability, the root directory will be /var/www. That means that anything you upload will be within that directory.


PFS on nginx: only RC4 gets used (TLS_ECDHE_RSA_WITH_RC4_128_SHA) I'm trying to configure my webserver for perfect forward secrecy.

I'm using

ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+ECDSA+AESCBC:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+aRSA+AESCBC:EECDH+aRSA+RC4:EDH+aRSA:EECDH:RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;

the problem is that, at least on mac os 10.9, all major browsers (chrome, firefox, safari, all up to date) will use RC4 as the cipher (TLS_ECDHE_RSA_WITH_RC4_128_SHA)

Disabling RC4 on the server will result in an ssl error on the client.

what I'm doing wrong, and is it reasonable to have pfs with a not-to-secure cypher?

edit: now I'm using

ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA;

It works with chrome and safari, but firefox 25 fails to establish a connection

If you connect to this site with your Web browser, it will show you what protocol versions and cipher suites are supported by that browser. Notably, Firefox does not seem to support (yet) TLS 1.1 and 1.2, so this prevents it from using any cipher suite ending in "_SHA256" because these are for TLS-1.2 only.

If your server is accessible from the Internet, SSL Labs also offers a test page for servers that can tell you what your server is indeed advertising. Alternatively, if your server is private in some way, you may try to use this tool, which won't tell you as much but can work on private networks (the C#/.NET version has less bugs than the Java version).

Perfect Forward Secrecy relates to the protection of the confidentiality of the data against ulterior theft of the server's private key. This kind of risk is all-or-nothing: either the key is stolen (and every non-PFS past connection is revealed, if it was recorded of course), or not. With RC4, issues are more of a statistical nature; the known problems of RC4 are small biases which, usually, don't reveal much. Both risks are not exactly of the same kind, so you cannot really compare one with the other except in a very general view where, for instance, you try to estimate the average costs induced by breaches. But "average" does not apply well to a single Web site...

Personally, I'd go for PFS, even if it implies using RC4.


Possible Ransomware Infection, want to clarify some things I am not sure whether ransomware attacked a pc in my home setup. An adware popup came up and locked the browser however i ended the process and ran my av, nothing was detected. There were usb drives connected. I reinstalled windows, however i plugged the usb drive back in to format. first i am not sure if i even got ransomware but i reinstalled to be safe, i wanted to re use the usb drive so i formatted however i am not sure if ransomeware can spread like a virus or a trojan and if i formatted the usb drive even though i plugged it back in to the pc, will there be any possible spread of possible ransomware? There is a chance this could of been adware however if the browser is locked and has to have the process ended does this indicate ransomware?

An adware popup came up and locked the browser.
  ...
  if the browser is locked and has to have the process ended does this
  indicate ransomware?

It could be a harmless bug in the JS engine etc.
If it is indeed malware, it's not necessarily ransomware, it could be anything.

...

Assuming it was malware:

  ran my av, nothing was detected

What the AV says or not says doesn't matter. Generally, AVs are pretty useless on already infected devices.

  however i plugged the usb drive back in to format.

After reinstallation? Not good. A different OS is a better choice for such tasks. ... Well, maybe (probably?) you got rid of it with reinstalling alone, but understand there is no 100% guarantee (even with different OS etc.)

  i am not sure if ransomeware can spread like a virus or a trojan

Ransomware can do everything normal malware can do, because it's just normal malware with some payment demand added. It could spread not at all, or over Mails, USB, Wifi, infect EFI etc.etc.

...

Ransomware often waits a long time without doing anything, before encrypting the files. If it is ransomware, what you should do now is to create a backup on a external disk and keep it. Ideally, you would have done this before a suspected infection, but's still useful. In case you really need it, however, don't just reinstall and plug the disk in to copy the files back.  A different OS etc. is very helpful, and take only the files you really need, ideally as little as possible.


Does avira firewall need to be enabled along with comodo firewall? I'm currently using Comodo Firewall along with Avira antivirus. The new update for Avira also includes the firewall with the free plan and its enabled by default.

Do I need to enable both on my Windows 10 system? I think Comodos firewall will be much stronger than Aviras.

No. To be clear, you should not use more than one firewall per computer. Choose the best choice you can, meaning the one which offers the best comprehensive protection against network-based attacks, on a per-network basis. I don't think you should exclude your other options.

In fact, don't necessarily use this as an example but many home networks go without firewalls on local workstations, with the exception of perhaps one in the form of home router/modem combination. It's generally accepted that the most significant risks are external/public facing or are facilitated by entirely different components such as the USB controller, and firewalls can be seen as a nuisance to some.

I have virtual machines installed. Each virtual machine has its own connection to a virtual network. If I were to install firewalls on each virtual machine, this would probably bottleneck the network connectivity I have between the host OS and guest OSes. I wouldn't recommend installing a firewall onto a VM instance, unless it's a commercially hosted VM instance, and even then your host provider might have a perfectly usable external firewall for you to try out!


HTTPS Everywhere vs. NoScript What does HTTPEverywhere gives compared to NoScript with Firefox (Options|Advanced|HTTPS|Behavior)?

Why use HTTPEverywhere, when NoScript also can strict websites to use only HTTPS?

HTTPS Everywhere uses an EFF produced whitelist of sites and rules to use and can have rules like redirecting wikipedia.org to secure.wikipedia.org.

NoScript has only a user defined whitelist of domains and no such rule abilities.


Is SSL terminated at a load balancer PCI compliant? I've read this nice question:

Should SSL be terminated at a load balancer?

And I have the same question, but with PCI-DSS compliance in mind.

Is SSL terminated at the load balancer, with clear communication between the load balancer and the web servers, PCI compliant?

I'm using AWS Elastic Beanstalk, which under the hood uses EC2 instances and load balancers.

According to section 4.1 of the PCI Data Security Standard any merchant handling credit card data should:

  "...use strong cryptography and security protocols such as SSL/TLS or
  IPSEC to safeguard sensitive cardholder data during transmission over
  open, public networks.”

This means that Front End SSL is allowed, as once the data reaches the LB, it is considered to have entered a secure private network.

Also, the PCI Approved Scanning Vendors Program Guide states that all servers behind a load balancer are exempt from internal scans if they share a similar configuration.


Detecting when a screenshot is taken by a software (spyware) in Windows Most trojaning, spyware and keylogger tools have the ability to take screenshots. Is there a way to detect if an app or software is taking a screenshot in Windows? Maybe a Windows API call or dll?

This would be helpful for finding malware.

My answer would require writing some code. I'm only posting this answer because you mentioned a programming related solution in your question.

Ever since Window Vista, the windows kernel raises an event for basically every single thing that happens on your computer. Microsoft provides a library called TraceEvent for .NET that makes it absolutely trivial to hook into these events.

For detecting a screenshot, you could monitor memory write events, file write events and so on. You can also hook into notifications for socket IO and the like. You can do all of this in around 30 lines of code.

From there, depending on how invasive and thorough you want to be, you could do a number of things. You could hook calls in the unknown processes such as Winsock's send function, and wind up scraping a copy of all data that the process writes to a socket, and check it. You could look for a JPEG or PNG header in scraped data and fire off the alarm bells if you find one. You could open and analyze files it writes, etc.

It's at this point that things can get complicated, but you could probably hook the send function with a library like EasyHook with a hundred or so LOC.

Another approach would be look at what libraries/WinAPI functions such an application would need to load to perform this function. You can detect when a process starts and when it loads an assembly (.dll) with these kernel events, so you could just look for the right (or wrong) combination of loaded assemblies. You could automatically hook WinAPI or OpenGL or DirectX functions that provide screen capture capability in every process that starts up, and directly monitor when applications access these capabilities.

For more information about this general approach you can see my other answer here.

I'd like to make it clear that the only thing I'm advertising as being easy is the process of hooking right into the heart of the OS and getting notifications about things happening. The art of correctly using this data to effectively catch malicious code is a much, much more difficult task.


To what extent is FREE 3rd party antivirus software better than Windows 8 defender (if any)? As someone who is not in a position to currently purchase an antivirus suite, I would like to know if having a free Avira or Avast or similar program is worth the overall system performance drop (I don't have a high-end desktop, so having an antivirus running in the background does slow thing down a bit). How secure am I if I stick to using only Windows defender? Note that I am not a fan of browser flash games, and don't tend to download suspicious content without some sort of review, so that sort of threat is minimal.

From the reviews I've seen of Windows 8 defender (which includes what was security essentials in Windows 7 and earlier), it's a pretty solid middle of the road A-V suite with some anti-spyware features.

I don't think that it's as fully featured as the paid for security suites, but then it is free.

From a personal perspective I use it as it seems fairly unobtrusive in general running and doesn't cause too many problems but does catch viruses that hit the system.


Find private key from private certificate I have a private certificate from my email server in order to
sign emails. At Section "Your S/MIME Personal Certificate" I can view my:

private certificate
public certificate

My public certificate starts with:

-----BEGIN CERTIFICATE-----

My private certificate starts with:

Key Attributes
    X509v3 Key Usage: 10
-----BEGIN ENCRYPTED PRIVATE KEY-----

This private certificate contains a private key?
If yes is there any way to find it?

First of all, there are no private certificates. There are only private keys.

This is private key, but only in its encrypted form:

Key Attributes
    X509v3 Key Usage: 10
-----BEGIN ENCRYPTED PRIVATE KEY-----

You are able decrypt that and you will get your private key. A common tool for this is for example OpenSSL.


Explain SSL advantages for e-commerce to layperson? I need to explain why having a SSL certificate is a good investment for an e-commerce. How do I do this when the other person is a intelligent business owner but not that tech smart?

There are a couple of angles:

I they have no technical interest at all, the first aspect is that, as far as I know, the credit card industry requires the encryption of the transmission (and various other things). From a regulatory point of view, this should be enough to push to use HTTPS.
For those two want to know a bit more, first explain that plain HTTP traffic happens in clear.

Then, if you want to run a demo, you can simulate a MITM attack, but you can also demonstrate passive eavesdropping more easily: plug a machine running Wireshark on the same router1 as their machine and show them what they're browsing. Of course, only do this if you have obtained the permission from whoever is connected to that network; make sure what you do is legal first in your jurisdiction. Then, explain that anyone with access to the network between their machine and the server could do this. To the non-technical user, this demonstrates at least the need for encryption.

Certificates in SSL/TLS are really used for authentication, which protects against (active) MITM attacks. Depending on how much attention your users are willing to give to this demo, they may or may not need/want to see a MITM attack in the same way (you can try sslstrip or other kits, although it doesn't necessarily demonstrate the same aspect).

If they understand the need for encryption, they'll understand the need for SSL/TLS (HTTPS) on a website. Thankfully, browsers do implement certificate verification anyway when HTTPS is used, thereby protecting you from both passive eavesdropping and active MITM attacks. This makes the usage of a certificate necessary2 (I'm not sure whether your question is specifically on the certificate aspect, or more generally about having to use HTTPS).

Users must never be driven to ignore browser warnings. This also means that they'll need a certificate that's recognised by most browsers by default (this is why an e-commerce website shouldn't use a self-signed cert). PKIs and CAs have their flaws, but they're overall a reasonable compromise for most users.

Then, whether you want to go for an EV certificate or not is up to you. CAs certainly have a vested interest in promoting them. I'm not sure whether this is working, but their marketing is certainly well done and should work for someone who uses their brochures as a starting point without wanting to know too much.

In addition to all this, an e-commerce website should be implemented correctly: no mixed content in particular. Secure cookies are good too. Use HTTP Strict Transport Security if you can.

1. I use that term loosely here, assuming a home router, that's also acts as a hub/switch.

2. I'm not sure any browser supports null ciphers or certificates other than X.509 anyway. They certainly don't with the default settings


Does this registry entry for implementing custom protocol handlers in Windows present a security risk? Background
Some features are not yet available on the web platform and thus require cooperation with a native application in order to provide them. One method for a web application and a native application to communicate with each other is a custom protocol handler.
For instance, the web application can call mycustomproto://some/params, where mycustomproto must first be registered with the operating system as a valid URI protocol. On Windows, this is done in the registry. There are a few keys/subkeys/values etc that must be added to the registry, but only one actually deals with specifying the executable and its parameter(s).
Note that once the protocol handler is registered with the operating system, it can be launched by any website that knows of its existence, subjecting it to potential abuse.

Example Windows registry value for this purpose
All of the examples that I've found documenting this show the following:
C:\myapp.exe "%1"

Primary Question
Assuming that the registered handler (e.g. "myapp.exe") has zero possible security flaws, is the above example registry value sufficient for ensuring that malicious websites are unable to piggyback additional commands and/or arguments?

Clarifications

For the purpose of this question, please assume that the protocol handler (e.g. "myapp.exe") is incapable of exposing vulnerabilities of its own - it's idle - it launches, does nothing, and quits. This question is specifically related to the browser and/or OS and the "execution" of this registry value.
Can malicious actors somehow escape out of the "%1" double quotes and cause the browser and/or OS to run additional commands (e.g.  && C:\Win32\do-something-malicious.example.exe)?
Similarly, can malicious actors somehow send additional arguments to the protocol handler? Or does the "%1" ensure that the handler will only ever receive a single argument?
If this registry value is insufficient to only ever call the protocol handler (and nothing more) with a single argument, is there a better way?

Yes, this should be sufficient to prevent malicious websites from executing additional unexpected commands. Chromium both escapes and quotes the url before passing it to the protocol handler, and I expect other browsers do the same, since not doing so would be a major vulnerability.


What are some good ways to secure personal computers I see that many topics here are related to securing data, equipment at an enterprise level. Good advice includes stuff like blocking all unused ports, allowing only whitelisted traffic and installing firewalls, IPS and such.

However, many of these steps are inapplicable on a personal computer level. Normal users cannot be expected to have good hardware based firewalls, IPS and other expensive equipment. Allowing only whitelisted traffic isn't also very manageable, considering the amount of applications using different ports, connecting to different IPs a personal computer has.

What are some of the more useful steps a more security-savvy person could take to better protect his/her personal computer, besides the common advice such as installing an anti-virus, not visiting suspicious sites or downloading suspicious attachments from emails.

Answers for both Windows and common Linux distributions would be great.

Note: Some help retagging the question would be great, I cannot think of an appropriate tag for this question.

There are all sorts of ways that home users can keep their data and / or identities secure while still having a usable computer. Below are a few of the most common ways the average Joe can secure his machine:

Choosing a strong passphrase

Yes, we've all heard it time and time again, but there is probably no easier way to improve your security. If you're a fan of passwords, make sure to choose something that contains enough entropy to be reasonably secure, while still being easy to memorize. A random series of letters and numbers is great, but you probably won't be able to memorize a very long string of them. Anything that includes personal information should also be avoided. Mixing your name with your birthdate is not secure, no matter how long and random it might look.

Personally, I'm a fan of pass phrases. Pick a few random words from a dictionary (I choose somewhere between 5 and 10 depending on the required ammount of entropy), and you've probably generated enough entropy to keep an attacker guessing for much longer than will be practical (see the XKCD on the topic for a laugh).

Other people prefer to use pass-sentences. While these may be longer than your typical passphrase, they may or may not be anymore secure.

For more information on passphrases and passentences see, `Linguistic properties of multi-word passphrases' by Bonneau and Shutova of the University of Cambridge  [PDF], or their blog post on Light Blue Touch Paper.

Encrypting your data

There are plenty of great options for full-disk encryption on both Linux and Windows. Remember, encryption is only as strong as the password you choose (see above).

Windows

TrueCrypt is a fantastic piece of software for full disk encryption on Windows machines. It's transparent, easy to use, and provides a nice little interface for mounting / unmounting your various drives, USB keys, etc. and for creating hidden disk images that can give you plausible deniability when taking encrypted data into / outof countries that don't like encryption. The down side is that you'll need to have it installed on any computer on which you want to mount your drives.

Windows also has built in File System Level encryption, but I've had some issues with it randomly deleting my private key in the past (make sure to have a backup, possibly on a TrueCrypt encrypted volume), so I don't often recommend it.

Linux

Most linux distros come bundled with an encryption subsystem called dm-crypt, often hiding behind a nice key management interface called LUKS. You might also find loop-aes useful, but it sounds more likely that you'd want to use the (often) built in system. For more info you'll have to look at your specific distro's help pages.

Securing your network

You may not have a fancy hardware firewall, but properly configuring the firewall on your router, and the one built into Windows / Linux can go a long way towards keeping your network secure. I know nothing about Windows Firewall, so I'm afraid I can't recommend anything here, but a quick Google Search turned up several articles that appeared to be good guides to configuring it.

Use a supported operating system

If you are running Windows XP or earlier, make sure you update to a later operating system, preferably the most recent stable release.  Windows XP is now end of life and no longer patched.  Windows XP and older systems are becoming increasingly vulnerable because attackers keep finding new vulnerabilities, and nothing is being done to prevent them on these older operating systems.

Don't automatically run programs

Most systems now are configured not to automatically run programs when you stick in a CD or USB key, but some older (unpatched) versions of Windows might not be. If you are running Windows XP, and are not willing to upgrade, at least make sure the last available patches are applied.

Install security related updates

Actually, if you're running anything make sure you've got the latest security updates. Simply turning on Automatic Updating in Windows, or making sure to run updates often in Linux can go a long way towards keeping you safe.

Use SSL / secure wifi

Make sure you're not sending your password over a plaintext connection. Even the least tech-savvy user can check for the little green lock icon ane make sure the site they're logging into says "https" in the nav bar. It may not protect you from much, but at least it will prevent the guy sitting next to you in the coffeeshop from snooping out your password.

On that same note, secure your wifi networks with WPA (and choose a good password... again, see above), and try not to connect via unsecured wireless networks (including those that use WEP).

SSH

If you're using SSH to access your computer remotely, make sure to turn it off for the root account, and always use public key authentication. This is a bit more advanced topic (and probably only applicable to Linux, or not at all for the average home user), but still worth talking about. Other things you can do include disabling protocol 1, allowing only certain users to login remotely, and disabling X-forwarding (depending on your requirements). For more info, see this article on the CentOS wiki.

Conclusion

While most of these techniques are widely known, or may seem laughably simple, you'd be supprised how many people don't follow them and how many attackers can be detered by a little common sense, and basic security policies.


IE11 on windows 8.1 and ssl fallback I'm having problems with SSL certs and my SSL accelerator.  I have a Sonicwall SSL-R and it only supports SSLv2, SSLv3, and TLS1.0.  I have it configured to decode SSL with SSLv3 as the TLS1.0 implementation on it doesn't seem to work with most browsers.  So with it configured as SSLv3, it works with Chrome, Safari, and Firefox, but not IE11.

It seems that IE11 on Windows 8.1 will not fall back to using SSLv3.  Strangely, if I go into advanced setting on IE11 and disable all TLS options and leave only SSLv3 checked, then it WILL work.  It just doesn't seem to fallback properly unless I uncheck the TLS settings in advanced options.

Anyone have any idea why IE11 isn't falling back to using SSLv3?

Thanks in advance for any light you can shed upon this.

Can you explain exactly how the other browsers fall back? I've seen the following scenarios with servers and middleboxes:

try to connect with TLS 1.0 or higher, peer responds with SSLv3 and thus the connection continues with SSLv3. This usually succeeds.
try to connect with TLS 1.0 or higher, peer closes connection and browser tries again with lower TLS version. This usually succeeds.
try to connect with TLS 1.0 or higher, peer drops client hello and does not close connection. This times out after a while. In this case the browser does not retry with a lower version because it does not assume an SSL-related problem.

IE11 on Win8 does the initial client hello without offering RC4 cipher. If sonicwall just drops this client hello instead of closing the connection or sending an TLS alert you might run into the case where the browser does not retry.

You might make a packet capture (wireshark) to see what is going on.


Authorize transitive communication between applications on behalf of the user I'm trying to wrap my head around to following web security question for a while now. Say we have a system set up as depicted in the picture below.

There is one main application with which the user interacts most of the time through a front end. Apart from the main application, there are multiple smaller applications. These applications also have front-ends with which the user can interact. Since we do not want to have a different user database for each of these applications, we decided to use oAuth2 for authentication.

The main application can interact with these other systems and vice versa. Most of the time it's in the context of a user interaction.

The request from main application to other application has to be (1) authorized and (2) we would like to know in "other application" on behalf of which user the call has been initiated (not "Main application", but "User").

It is really tempting to just send the user oAuth token from main application to other application. But this might have serious security implications as "other application" would now have all the rights of the user to temper with the main application (https://tools.ietf.org/html/rfc6749#section-10.3).

This might not be that bad, since we are managing these services ourselves, but this is certainly not the right approach in case we are dealing with 3rd party applications.

In summary, my question is: If the user initiates a request on an application, which in turn has to call another application to complete the request, how can we:

Authorize this second call from application to other application (given the user is authorized and we have a central oAuth authentication system)
And still somehow know on behalf of which user the call was initiated.

Ideally, the receiver end of the call would not even know that the call was initiated by the other application (it would just think it is a direct call from a user). It would just use the oAuth security interceptors already in place.

EDIT:

A thought I have is to add some additional authorization grant type to the Authorization server which takes as input:

valid resource owner credentials
a valid token of the user initiating the request
the id of the resource server we will be accessing

The authorization server knows, given the requesting resource owner credentials:

which resource server ids are allowed
which permissions can be retained from the original token

The Authorization server:

validates the requesting resource server credentials
validates the user token
validates whether the requesting resource server is allowed to request a token for the requested resource server
retains intersection of the user permission on the user tokens and the allowed user permissions for the requesting resource server

The result is a short lived (non-refreshable) token

on behalf of the requesting user
only having the id of the resource server we will be accessing as audience
having a subset of permissions of the original token.

Since (I hoped) I couldn't be the first person ever to be in this situation, I've managed to find several references on the web talking about "delegation" grant types:

https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-10#section-1.1
https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-on-behalf-of
http://docs.identityserver.io/en/release/topics/extension_grants.html
https://auth0.com/docs/tokens/delegation

This is exactly what I was talking about in my idea. Hope this might help other people with in the same situation.


Does changing the keyfile of a LUKS volume after opening it increase key security? Assuming there is a LUKS volume that uses a keyfile and the keyfile is autogenerated before opening the volume and deleted after use, does changing the keyfile prevent it from being stolen from the RAM in this scenario?

Creating the LUKS volume using a keyfile:

Create a keyfile using an OTP algorithm, like HOTP with a secret key and counter
Store the counter value
Create the LUKS volume and assign the keyfile
Securely delete the keyfile

Using the volume:

Recreate the keyfile using the secret key + counter
Open LUKS volume via:
cryptsetup --key-file keyfile luksOpen /dev ..
Increment the counter
Create a new keyfile with the new counter value
Add the new keyfile to the LUKS volume via:
cryptsetup --key-file keyfile luksAddKey /dev newkeyfile
Remove the old key from the container via:
cryptsetup --key-file newkeyfile luksRemoveKey /dev keyfile
Securely delete keyfile and newkeyfile

What I want to know is that if the system memory was probed after step 7 and while the volume is still mounted, would it be possible to recover the volume masterkey, or the key used to open the volume in step 2, or the new key assigned to the volume in step 5?

Shortly no.

If you've strongly flushed ram and securely deleted your keyfile, there seem not exist a way for retriving previous keys **.

Even if step 6 was not done, on LUKS metadata you will only find hash of them : the key isn't store in cleartext:

cryptsetup  luksDump /dev/sde2

Will show all keys in detailed form.

** (HOTP: Hack Only Transform the Problem)

But, with this method, you are not really more protected than using unchanged password: If an used key was dicovered, (by keylogger, camere or direct vue on your keyboard), next time you hit them, this will be easy to see where are differences and how the two key differ.

h.o.t.p. but the problem stay same...

Good method

Anyway, the procedure seem correct.

I use LUKS on live-persistent partitions on my Debian live USB key.

In my mind, for having such a transportable key, using strong security. I generate a luks key with 10 strong passphrases, (to be stored in my powerfull brain) and each time I use a suspect environment, I delete the last used key, before continuing to use running session.

No matter about memory, if the key is dropped from luks header, I only have to use one of the other, next time.

With 5 different secret passphrases, I could work a lot of time

My prefered desktop stay my laptop.
Mostly when I use my key, it's on hardware I work on (openned and without keylogger)
There are extremely rare operation I do in really suspect environment.

(Next 6 month, I've dropped only 1 key, and I'm not sure this was really required).

But your procedure could become usefull for strong operations against the whole key list... maybe.


Can law enforcement track a criminal through dynamic IP address? I ask because a week ago my home was broken into and, among other things, my iMac computer was stolen. I am desperate to get it back because it has all the pictures of my daughters from the last several years (did not back up any where else).

I just learned of iCloud so did not have that on my Mac, however I did have Dropbox on my computer and learned that every time the computer is turned on Dropbox is activated and logs your IP address for which ever device is being used.

I was able to access my account and find the last IP address logged for my Mac, which was the day after it was stolen.

I've forwarded this info onto the local police. I was wondering if it possible to catch the person(s) who did this with this information alone.

It depends on how smart the thief is.  We work with police to catch criminals based on their IP address on a regular basis.  We've got a high success rate, but we can't catch them all.

Usually, the IP address is enough to trace the connection back to the ISP (Internet Service Provider). Generally, ISPs will work with law enforcement in cased of known fraud or theft.  They usually require a warrant, but that is usually not difficult for law enforcement to get.  As long as the ISP knows who connected when, they can be of assistance.

Savvy criminals will, however, use anonymizers and other tools/approaches to mask themselves to make the process much more difficult.  Also, if they are logging on from public locations, it becomes exceedingly difficult.  At that point, you often need to enlist the aid of those locations to review surveillance footage.  That takes time, and a trained eye.  You've generally got to have enough login instances, and be able to review the video for multiple time frames to figure out who is in each of the videos and then try to identify the perpetrator.  It is possible, but very, very time-consuming, and the amount of time spent isn't always justified, given limited resources.

We've met with limited success on enlisting other businesses to let us use their security camera footage.  Some companies are willing to help because they are also victims of fraud, and view it as doing our part to protect each other.  Others may not have surveillance video, or it may have been overwritten, or they may just not want to provide it.


Are staggered roll outs of security patches bad? Many Android devices, including the Google Nexus line, are now receiving monthly security patches via OTA updates, accompanied by the Android Security Bulletins. However, these updates are often released in what is known as "staggered roll outs," where the update is available for more devices (of the same model) over time, instead of becoming available to all users instantaneously.

I understand that for feature updates, gradual roll outs allow errors or bugs to be fixed before all users receive the new software. However, for security patches, wouldn't a staggered release make it much easier for blackhat hackers to utilize the now-public vulnerabilities against users whose devices have not yet received the OTA, even though a patch for their device model is already available?

For example, I have a Google Nexus phone that is supposed to be among the first to receive all Android updates. The latest Android security update was publicly released on May 4, 2016, along with its source code; it is already May 16, 2016, and my Nexus device is still telling me that my "system is up to date," even when I click the "check for update" button. Of course, I can manually download the latest firmware images and flash it manually; but shouldn't security updates be made available to all devices of the same model as quickly as possible once it becomes public?

Edit: Thank you for the very thoughtful responses. While this question is intended to be widely applicable to different devices, my specific concern is the intentional "staggered roll out" to identical devices of the same model, once a patch has already been developed for that specific model. For example, the May 2016 security update has been released for the Google Nexus 6P at the beginning of the month, but as of May 16 not all Nexus 6P devices have received the OTA update. Google releases security patches for Nexus devices every month, and each month some devices receive them a few weeks later than other devices of the same model.

Excellent question.

Yes, your understanding is correct, as well as your rationale behind it.

Staggering roll outs for new features often makes good sense.

Staggering roll outs for security patches rarely is a good idea.  As you pointed out, this gives even more opportunity for the vulnerabilities to be exploited.  Perhaps even more importantly, the patches can be quickly reverse engineered to develop exploits in a rapid fashion.

Microsoft often publicly releases their patches on the second Tuesday of the month (and also sometimes on the fourth Tuesday).  This has commonly been referred to as "Patch Tuesday".  There's a reason we call the next day "Exploit Wednesday".

It's unfortunate that a significant chunk of the Android ecosystem has not learned from this phenomenon.

Updates:
Several knowledgeable people have pointed out potential impact on internet infrastructure, including fears of overloading the entire internet.  The volume of internet traffic is monumental; security patches, even extremely large ones, are tiny drops in the bucket.  Microsoft releases large patches to hundreds of millions of users on the same day each month, and they have yet to "crash the internet".  Netflix, YouTube, and Twitch stream videos to millions of people every day, and even with their combined traffic, they have yet to "crash the internet".

On the other hand, Android patches are predominately (but not exclusively) delivered to wireless users.  There are solutions to any potential issues:

Provide users with a choice of when to download the patches.  This provides numerous benefits:

Does not disrupt the user's workflow
Creates traffic staggering due to human interaction and decision variability
Allows the user to wait until they are connected to a higher bandwidth system (perhaps at work, their university, at home WiFi)
Allows the user, at their own risk, to wait and see if others report problems with the patches

When distributing patches to specific regions known to have limited infrastructure that could be impacted, stagger the patches over the minimal number of days to avoid overloading infrastructure.

In regards to specifically the Google Nexus 6P security updates not being released to all users promptly, that's simply a poor choice by Google that is not in the best interest of their customers.  Compared to the massive volume of internet traffic, those patches are minuscule.

On top of that, that device is relatively rare in the Android ecosystem.    This further supports the statement that releasing the patches to all customers at once would not harm any internet providers.

Even the entire Google Nexus product line comprises only a tiny part of the Android world.  As a product line, however, there could be a little impact on infrastructure in select regions.  As such, the following methodology, while combined with the recommendations outlined above, will minimize infrastructure impact while maximizing patch distribution:

Release zero-day exploit patches immediately
Release scheduled updates on different days each month, a different day for each product
If a product has significant market share that could reasonably impact infrastructure in a region, stagger the roll out over the minimal number of days required to avoid infrastructure overload in that region only

Finally, according to your statements, it has been over two weeks since Google initially released those patches for the Google Nexus 6P.  That's more than enough time to know if their patches are causing havoc.  I have found no documentation from Google recognizing or apologizing for a bad bunch of patches, nor anecdotal evidence of any serious problems.

One could make the argument that staggering patches out over a few days could possibly be reasonable in order to detect flawed patches and to reduce traffic load.  But leaving customers unpatched for weeks is unreasonable, unnecessary, and not an effective policy from an information security standpoint.

In conclusion, based on the statements above, and your statement that Google has not rolled out the security patches to your device, my conclusion is that Google, by not delivering security patches to all affected Google Nexus 6P customers, is making a poor decision and is doing a disservice to their customers.


sniffed packets , is there a way to put together the file? I would like to know, in case an attacker manged to capture some packets from my network traffic, can he build from them a file or any easy to understand thing?

I know that the TCP/IP protocol is using the TCP/UDP for segmenting the files (or whatever is being sent) in order to send it over the network, so if the file is large enough is segmented to some packets.
In case all what you can get from sniffing is just a needle of text inside the blob (as much as i have seen that is the results of sniffing), why bother to encrypt the traffic of wireless networks, there is the SSL/TLS that are used mainly to encrypt the first authentication (username/password), why to encrypt all the traffic ?

My main concern is about the ability to build a file from the captured  packets , is there an easy way to do so ?

Capturing packets already produces an output file (a capture file, actually) which includes packet contents, timing information, headers, etc. If you want to separate these packets into individual streams, a program like wireshark can do the appropriate searching and filtering for you. It can even decrypt SSL/TLS traffic if you have the certificate key.

If all you want to do is separate out the contents of individual TCP streams, a program called tcpflow will do that for you. Note that doing so discards a lot of useful data, including timing, headers, etc. But it can be very useful if you have a lot of traffic you'd like to grep. And on the subject of grepping traffic, have a look at ngrep to search traffic contents real-time.

And this barely scratches the surface of network interception, analysis, modification, and related tools.


Spam email with my address details I have registered domain under .xyz 123reg domain registration company. Recently I got an email from ummed.org company informing me that my SEO engine will be going to expire soon and I need to make the payment. I am pretty sure it is fake email but question is how do they have all my address details.
Is there any way to report it somewhere to remove those data and not to spread out.

Thanks for advice.

WHOIS

It sounds like your details are in your website's WHOIS records. You can check what is in them here. The data stored include your name, address, e-mail, and often much more.

According to ICANN's specifications:

  Until otherwise specified by a Consensus Policy, such data shall consist of the following elements as contained in Registrar's database:

    3.3.1.1 The name of the Registered Name;

    3.3.1.2 The names of the primary nameserver and secondary nameserver(s) for the Registered Name;

    3.3.1.3 The identity of Registrar (which may be provided through Registrar's website);

    3.3.1.4 The original creation date of the registration;

    3.3.1.5 The expiration date of the registration;

    3.3.1.6 The name and postal address of the Registered Name Holder;

    3.3.1.7 The name, postal address, e-mail address, voice telephone number, and (where available) fax number of the technical contact for the Registered Name; and

    3.3.1.8 The name, postal address, e-mail address, voice telephone number, and (where available) fax number of the administrative contact for the Registered Name.

Privacy

There are ways of hiding this information. Some registrars have whois privacy which will replace your details with those of a company.


Randomness of hash token in password reset link I want to know what are the points to be kept in mind while creating a hash token for my password reset links.

In particular, how to make it un-predictable for an attacker?

Most random number generators just generate pseudorandom numbers. They create a series of numbers which appears random at first glance, but the numbers do follow an exact algorithm. To prevent them from generating the same series of numbers everytime they are used, they are initialized by seeding them with a start value. A good pseudorandom number generator should output a different series of numbers for every possible seed value.

In practice, a pseudorandom number generator is often initialized with the current time. Because the time will be different everytime a program is run, it will never generate the same stream of numbers. Unfortunately this is insufficient for any security purpose, because the time of initialization is very predictable. For that reason you need to combine values from other entropy sources which are hard or impossible to predict for an outside attacker.

Which entropy sources are feasible depends on your environment.


Unknown Google Account Signed into Browser An unknown Google account is signed into Firefox on my Arch Linux machine. The computer is in my apartment (where I live alone) and I lock the screen when I leave.

Some observations:

The unknown account is has a domain of @pages.plusgoogle.com and a random-number-looking user name.
The "Signing in to Google" page for the unknown account shows no password option: .
The Google Timeline for the unknown account is the same as my real account.
The unknown account is now NOT showing up in new tabs when selecting a Google account, however, I still have tabs open that are logged into the unknown account.
The only machine listed under my devices in the unknown account's "Your devices" section is the current Arch Linux machine.
My real account has 2FA using the Google Authenticator app (and the backup codes are unused and unchanged)
My real account shows no unknown devices logged in

Searching for things like "unknown Google account logged into laptop browser" only results in suggestions that someone has gained physical access to your laptop. This is of course not impossible, but it is unlikely. Has someone broken in to my apartment or my wifi/lan?

My question is to ask people's advice or thoughts here. I am a software engineer but I only have rudimentary security knowledge at best.

It looks like Google (owner of Youtube) creates brand accounts tied to pages.plusgoogle.com domain if you change a name on your YouTube channel. If you own a Youtube channel, that's where it probably came from. More information here: https://support.google.com/youtube/answer/9367690?hl=en


What is the most secure way to store the password on a physical medium (paper, etc)? Let's assume that I have to store the password on a material medium (paper, etc). What is the most secure way to do that? I mean a way of storing the password that does not needs any electronic tools for extraction of the password.

How about writing it on good stock paper using a pigment ink pen so it does not fade (within a few decades).

But write only two thirds of it on one sheet, another 2/3 on another sheet, and the last 2/3 on a third piece, and give them to three (trusted, obviously) friends - that way, any one of them don't have your password, but any two of them together do.

Eg. Jim gets APPLxx, Joe gets xxPLES, and Jack gets APxxES. Any two of them will be able to reconstruct APPLES, alone they would be guessing.


Secure authorization for subscription-based games or services Let's suppose I'm developing a subscription-based desktop game: the player pays a fee in order to get access to certain levels of the game for a certain time. For example, the player pays $1 to get access to one special level of the game for one month.

Every time the game loads, it sends a request to the back-end API in order to check what levels can the player access, and then enables the corresponding levels for the player. However, the player may use a MITM (man-in-the-middle) attack to intercept and modify the server response so it tells the game that the player has access to every level of the game.

How should the authorization process be implemented in this situation to avoid the player getting unauthorized access to levels?

Let's assume two player profiles for two different scenarios:

Scenario 1: the player can sniff the network.
Scenario 2: the player can sniff the network and has access to the source code of the game (not of the server).

Scenario 1: the player can sniff the network.

This can be kind of prevented with HTTPS.
Only, if the player has full control of the client he might patch the client in order to provide and maybe modify the plain text information directly at the application (i.e. game). But this is not covered by your assumptions in scenario 1.

  Scenario 2: ... and has access to the source code of the game (not of the server).

Make sure that the source code the client has is not sufficient to play the game, i.e. implement relevant parts of the games logic out of reach of the client: at the server. How this can be done depends a lot on how the game works.

Apart from that you can try to obfuscate the code to make reverse engineering harder, digitally sign any messages from the server so that an attacker cannot fake these (although he might just change the code to disable the signature check) ... But at the end you can only make it harder and not impossible. Knowledgeable players might for example try to write their own server which implements a similar game logic you have in order to be no longer dependent on your servers.

This means is must be easier and more attractive to pay you instead of trying to hack the game. It can help for this if the game is cheap enough to begin with. Or if there are attractive out-of-game items which make it worth to pay.

As for making hacking harder it might be useful to have several versions of the game with different kind of protections in it so that "generic" hacks will only cover few of the game versions which makes it again more cheap just to buy instead of to hack the game. Or make parts of the communication specific for each game installation, i.e. depending on the user id user for authentication. Another way against the spread of generic hacks is to release new versions regularly which interact differently with the server and which would require the development of a new hack, thus frustrating users which rely on the hacks instead of paying.


Where does the list of trusted content authorities come from when using a web browser? I was asked "how do browsers know whether or not to trust the certificate from the server it's connecting to" and thought it was a pretty good question. After doing some googling I found two answers:

According to this person a list of root content authorities are built into the operating system, and any further CA's are trusted (or not) by the root ones.

  Just so you know, Microsoft determines which Trusted Root CAs are
  automatically loaded into their operating system.  It’s the same story
  with Apple.

However Wikipedia makes it sound like it sound like the list of trusted CAs is built into the web browser:

  The browser already possesses the public key of the CA and
  consequently can verify the signature, trust the certificate and the
  public key in it

So which is it? Does both the operating system and browser come with a built in list of trusted certificate authorities and if a certificate is signed by an entry in either one of the list it's trusted?

So which is it? Does both the operating system and browser come with a built in list of trusted certificate authorities and if a certificate is signed by an entry in either one of the list it's trusted?

It depends.

Windows and MacOS X come with a their own certificate store filled with the trusted CA and both the builtin browsers (i.e. Internet Explorer or Safari) and Chrome use this CA store. Firefox instead comes with its own CA store and only this CA store.
With Android and iOS the situation is similar, although I don't know about the behavior of Firefox on Android.

Linux and *BSD also have a CA store built in but this one is not used by the common browsers. Firefox again uses its own store and on this platform also Chrome uses its own store.


Can any web proxies differentiate between JScript and Javascript files? Its a relatively common best practice to filter executables and scripts from a standard user at the proxy/gateway level in corporate environment. While EXE/BAT/CMD files are easy enough, and arguably .VBS (though I suppose it could in theory be used in a website that is only IE compatible), are there simple to deploy solutions for Microsoft JScript (.JS)?

It seems like a tricky one as the file extension is the same and the language is near identical.

Alternatively are content-type header inspections necessary to check if it is being downloaded, rather than executed in the relatively safe/necessary web browser context?

Or is reconfiguration of the OS prevent execution of .js files by wscript more common to mitigate this? Or content inspection to detect the use of dangerous methods (WScript object instantiation springs to mind).

For what its worth, I'm concerned with accidental downloading and execution of malicious (but non AV flagged) scripts by users here.

According to Wikipedia (https://en.wikipedia.org/wiki/JScript):

  [Microsoft] did not want to deal with Sun Microsystems about the trademark issue, and so they called their implementation JScript. A lot of people think that JScript and JavaScript are different but similar languages. That's not the case. They are just different names for the same language, and the reason the names are different was to get around trademark issues

So to answer the question in your title, they are the same thing.

Edit: Per comment below from @dandavis, Jscript is actually worse.

I don't know anything about Windows/IE, but I believe you can configure IE to not execute JS (or only for certain sites) - which should mean you could potentially only allow JS to execute for trusted sites, which should limit the attack surface.

If a bit of Javascript was being download by something other than a browser, you could check what the User-Agent for the request is (although you should expect it to be spoofed).

I think (but again, not really my area) things like EMET might be of some assistance, as would something like application whitelisting (I think the functionality is part of AppLocker, but I don't know to what extent it can help).

Realistically, I don't think you would be able to globally block Javascript, because it would break a fair number of sites that people may want to be able to use.

Edited to account for extra info in comment below:

OK - for that case (thanks for specifying), I think there are two ways:

per https://social.technet.microsoft.com/Forums/ie/en-US/11f13026-fbe2-4002-b190-3cc4521247ec/disable-shell-handler-internet-explorer-11?forum=ieitprocurrentver, it seems possible to disable shell extensions, which I think does what you want.
I would expect (but do not know) that either EMET or AppLocker would have something in their options to block Wshell calls (I think I would check EMET first)

If you had a proxy that could do content introspection (and not have to deal with TLS-protected data), you might be able to block specific scripts that contain calls to wshell, but as you say, that is almost certainly going to be a long game of whack-a-mole that only ever mostly works.

Edit: Another thought occured to me, which was to try and force users to select the download dir for all downloads - I assume most would at least pause when seeing a .JS download. Unfortunately, per https://superuser.com/questions/250057/is-there-a-way-to-make-internet-explorer-9-always-prompt-for-download-location#261007, this is no longer possible for IE. It seems to be for e.g. Chromium (https://support.google.com/chrome/a/answer/2657289?hl=en), but that probably doesn't help. It is also a fairly weak protection - and may for that reason be a bit of a dead end.


Question about compare Bell-LaPadula and Biba models with Chinese wall policy what the Chinese wall  models try to achieve and how it differ from or improve upon the Bell-LaPadula and Biba models

Chinese Wall Model

This is an access control confidentiality policy. The access control policy states that a subject may access information from any company provided that the subject has never accessed information from a different company in the same conflict class. Consider the following conflict classes:

{Ford, Honda, Toyota}
{Bank of America, Wells Fargo, Chase}
{Microsoft}

If you access a file from Honda, you're prohibited from accessing files from Ford and Toyota, but you can access files from Bank of America, Wells Fargo, Chase, and Microsoft. The policy restricts access according to two properties:

Simple security rule: A subject can be granted access to an object only if the object (a) is in the same company datasets as the objects already accessed by the subject and (b) belongs to a different conflict of interest class
Star property: write access is only permitted if (a) access is permitted by the simple security rule and (b) no object can be read which is (i) in a different company dataset than the one for which write access is requested and (ii) contains sanitized information

The Chinese wall model addresses a specific concern: conflicts of interest by a consultant or contractor.

Biba Model

This model aims at the preservation of data integrity. Data integrity has three goals:

Prevent data modification by unauthorized parties
Prevent unauthorized data modification by authorized parties
Maintain internal and external consistency (i.e. data reflects the real world)

In short, it's characterized by the phrase: "read up, write down." This differs from the Bell-LaPadula model, which is captured by the phrase "read down, write up." In the Biba model, users can create content at or below their integrity level. For instance, a monk can write a prayer book that can be read by the common folk, but not by the high priest. On the other hand, users can only view content at or above their own integrity level. To continue the analogy, a monk may read a book written by a high priest, but may not read something written by a commoner.

The security rules for the Biba model are below. Note that they are the reverse of the Bell LaPadula model:

Simple Integrity Property: a subject at a given level of integrity must not read data at a lower integrity level (read up).
Star Integrity Property: a subject at a given level of integrity must not write to data at a higher level of integrity (write down).
Invocation Property: a process from below cannot request higher access; only with subjects at an equal or lower level.

Chinese Wall vs Bell LaPadula vs Biba

Now, to your questions:

  what the Chinese wall models try to achieve and how it differ from or improve upon the Bell-LaPadula and Biba models

I described what the Chinese wall model and the Biba model try to achieve above. In doing so, I also explained how they are different. The Chinese wall model is an improvement on Bell LaPadula and Biba because it provides confidentiality and integrity of data, whereas Bell LaPadula provides confidentiality, and Biba provides integrity alone.

Please see these sources for additional reading:

https://coronaluo.wordpress.com/2013/10/08/chinese-wall-vs-blp-vs-biba/
https://www.cs.utexas.edu/~byoung/cs361/lecture25.pdf
https://en.wikipedia.org/wiki/Chinese_wall#Computer_security
https://en.wikipedia.org/wiki/Biba_Model


What is a LUKS cipher-name "@"? In analyzing the LUKS header on an encrypted volume, the cipher-name field shows a single-character = '@'. What does that mean?

The LUKS On-Disk Format Specification originally published by Clemens Fruhwirth in 2005 clearly defines the encoding of the LUKS header, which states that the first three data fields are as follows:

+-------+--------+-------------+
| Start | Length | Field Name  |
+-------+--------+-------------+
|     0 |      6 | magic       |
|     6 |      2 | version     |
|     8 |     32 | cipher-name |
+-------+--------+-------------+

On an older drive, this works as expected, and it's obvious that the cipher-name is "aes"

root@disp8551:~# hexdump -Cs 0 -n 6 luksVol1
00000000  4c 55 4b 53 ba be                                 |LUKS..|
00000006
root@disp8551:~# hexdump -Cs 6 -n 2 luksVol1
00000006  00 01                                             |..|
00000008
root@disp8551:~# hexdump -Cs 8 -n 32 luksVol1
00000008  61 65 73 00 00 00 00 00  00 00 00 00 00 00 00 00  |aes.............|
00000018  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000028
root@disp8551:~#

But on a newer drive, the only printable character in the cipher-name field is '@'

root@disp85:~# hexdump -Cs 0 -n 6 luksVol2
00000000  4c 55 4b 53 ba be                                 |LUKS..|
00000006
root@disp85:~# hexdump -Cs 6 -n 2 luksVol2
00000006  00 02                                             |..|
00000008
root@disp85:~# hexdump -Cs 8 -n 32 luksVol2
00000008  00 00 00 00 00 00 40 00  00 00 00 00 00 00 00 03  |......@.........|
00000018  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000028
root@disp85:~#

What cipher is LUKS using here with @? What does the at symbol in the cipher-name field mean?

The cipher-name in your example is not '@'. The field you're looking at is actually the hdr_size field.

The mistake you've made is trying to decode a LUKS2 container with LUKS1 encoding. In the table provided, you've shown that the second field (bytes 6-8) are the version data field. And your hexdump clearly shows that the first LUKS container (luksVol1) has version = 00 01 while the second LUKS container (luksVol2) has version = 00 02. These hex values directly correlate the former to LUKS1 and the latter LUKS2.

Quoting from OP that demonstrates this:

root@disp8551:~# hexdump -Cs 6 -n 2 luksVol1
00000006  00 01                                             |..|
00000008
...
root@disp85:~# hexdump -Cs 6 -n 2 luksVol2
00000006  00 02                                             |..|
00000008

Your encoding table in the OP was correct only for LUKS1 as defined in the LUKS On-Disk Format Specification published by Clemens Fruhwirth in 2005.

LUKS2 uses a different encoding that's defined in the LUKS2 On-Disk Format Specification published by Milan Brož in 2018. Here's the updated encoding table for LUKS2. Note that binary headers in LUKS2 must be exactly 4096 bytes long.

+-------+--------+--------------+
| Start | Length |  Field Name  |
+-------+--------+--------------+
|     0 |      6 | magic        |
|     6 |      2 | version      |
|     8 |      8 | hdr_size     |
|    16 |      8 | seqid        |
|    24 |     48 | label        |
|    72 |     32 | csum_alg     |
|   104 |     64 | salt         |
|   168 |     40 | uuid         |
|   208 |     48 | subsystem    |
|   256 |      8 | hdr_offset   |
|   264 |    184 | _padding     |
|   448 |     64 | csum         |
|   512 |   3584 | _padding4096 |
+-------+--------+--------------+

And here's the relevant hexdumps for the data fields shown above on an example LUKS2 container's primary header.

# magic
root@disp4117:~# hexdump -Cs 0 -n 6 luksVol2
00000000  4c 55 4b 53 ba be                                 |LUKS..|
00000006

# version
root@disp4117:~# hexdump -Cs 6 -n 2 luksVol2
00000006  00 02                                             |..|
00000008

# hdr_size
root@disp4117:~# hexdump -Cs 8 -n 8 luksVol2
00000008  00 00 00 00 00 00 40 00                           |......@.|
00000010

# seqid
root@disp4117:~# hexdump -Cs 16 -n 8 luksVol2
00000010  00 00 00 00 00 00 00 03                           |........|
00000018

# label
root@disp4117:~# hexdump -Cs 24 -n 48 luksVol2
00000018  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000048

# csum_alg
root@disp4117:~# hexdump -Cs 72 -n 31 luksVol2
00000048  73 68 61 32 35 36 00 00  00 00 00 00 00 00 00 00  |sha256..........|
00000058  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00     |...............|
00000067

# salt
root@disp4117:~# hexdump -Cs 104 -n 64 luksVol2
00000068  4f b1 7c b2 bf 7d da 1f  15 64 df cc ab 74 68 5c  |O.|..}...d...th\|
00000078  9a f9 3d 02 42 67 0f 92  ee 1d bf 98 11 5b 3d b8  |..=.Bg.......[=.|
00000088  87 e4 e0 a8 76 23 68 86  2f fc e1 98 a7 a1 5a a9  |....v#h./.....Z.|
00000098  b6 c5 e5 e2 9a 87 f7 ff  55 52 dc 07 07 dd fa a4  |........UR......|
000000a8

# uuid
root@disp4117:~# hexdump -Cs 168 -n 40 luksVol2
000000a8  65 63 30 32 36 64 64 66  2d 37 37 36 32 2d 34 34  |ec026ddf-7762-44|
000000b8  64 63 2d 39 65 37 30 2d  62 35 36 66 36 61 65 62  |dc-9e70-b56f6aeb|
000000c8  63 31 32 38 00 00 00 00                           |c128....|
000000d0

# subsystem
root@disp4117:~# hexdump -Cs 208 -n 48 luksVol2
000000d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000100

# hdr_offset
root@disp4117:~# hexdump -Cs 256 -n 8 luksVol2
00000100  00 00 00 00 00 00 00 00                           |........|
00000108

# _padding
root@disp4117:~# hexdump -Cs 264 -n 184 luksVol2
00000108  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*

# csum
000001c0
root@disp4117:~# hexdump -Cs 448 -n 64 luksVol2
000001c0  d0 9a e0 f8 96 ed 8f db  42 5f 58 19 99 2a 72 18  |........B_X..*r.|
000001d0  01 5e f7 81 34 99 f7 c5  17 a2 07 2f 60 be 40 bd  |.^..4....../`.@.|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200

# _padding4096
root@disp4117:~# hexdump -Cs 512 -n 3584 luksVol2
00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001000
root@disp4117:~#

Note that none of the above fields actually contain the cipher-name. In LUKS2, that's stored in the JSON object. In LUKS2, there's actually six header areas:

  \/ primary binary header          alignment padding \/
+----+----------+----+----------+-------------------+----+
| /\ | 1st JSON | \/ | 2nd JSON |   Keyslots area   | /\ |
+----+----------+----+----------+-------------------+----+
                  /\ secondary binary header

The hexdump shown above only shows the "primary binary header" area. To get the cipher-name, we must look at the JSON area.

In LUKS2, there's actually two copies of the data stored in the "primary binary header" and the "1st JSON" area (the second copy is called the "secondary binary header" and "2nd JSON" area, respectfully). In most cases the data in the "primary binary header" exactly matches the "secondary binary header" and the data in the "1st JSON" area exactly matches the "2nd JSON" area. The data is stored twice to aid in recovery and protect against corruption.

While the "1st JSON" area always starts at byte 4096 (immediately after the "primary binary header" area), its length is variable. The length can be determined by looking at the binary header's hdr_size (ie the same field that you confused for the cipher-name). From the above hex dump, we clearly see the hdr_size field has a value of 0x4000 (hex) = 16384 (decimal). But the hdr_size field defines the size of the the "primary binary header" plus the "1st JSON" area. So the length of the "1st JSON" area is the hdr_size value minus the "primary binary header" length. In this case, that's 16384 - 4096 = 122881. Depending on the length of the LUKS2 container's metadata stored in the JSON object, the JSON area could be up to 4194304 - 4096 = 4190208 bytes long.

So here's a hexdump of the "1st JSON" area, starting at byte offset 4096 with length 122881:

root@disp4117:~# hexdump -Cs 4096 -n 12288 luksVol2
00001000  7b 22 6b 65 79 73 6c 6f  74 73 22 3a 7b 22 30 22  |{"keyslots":{"0"|
00001010  3a 7b 22 74 79 70 65 22  3a 22 6c 75 6b 73 32 22  |:{"type":"luks2"|
00001020  2c 22 6b 65 79 5f 73 69  7a 65 22 3a 36 34 2c 22  |,"key_size":64,"|
00001030  61 66 22 3a 7b 22 74 79  70 65 22 3a 22 6c 75 6b  |af":{"type":"luk|
00001040  73 31 22 2c 22 73 74 72  69 70 65 73 22 3a 34 30  |s1","stripes":40|
00001050  30 30 2c 22 68 61 73 68  22 3a 22 73 68 61 32 35  |00,"hash":"sha25|
00001060  36 22 7d 2c 22 61 72 65  61 22 3a 7b 22 74 79 70  |6"},"area":{"typ|
00001070  65 22 3a 22 72 61 77 22  2c 22 6f 66 66 73 65 74  |e":"raw","offset|
00001080  22 3a 22 33 32 37 36 38  22 2c 22 73 69 7a 65 22  |":"32768","size"|
00001090  3a 22 32 35 38 30 34 38  22 2c 22 65 6e 63 72 79  |:"258048","encry|
000010a0  70 74 69 6f 6e 22 3a 22  61 65 73 2d 78 74 73 2d  |ption":"aes-xts-|
000010b0  70 6c 61 69 6e 36 34 22  2c 22 6b 65 79 5f 73 69  |plain64","key_si|
000010c0  7a 65 22 3a 36 34 7d 2c  22 6b 64 66 22 3a 7b 22  |ze":64},"kdf":{"|
000010d0  74 79 70 65 22 3a 22 61  72 67 6f 6e 32 69 22 2c  |type":"argon2i",|
000010e0  22 74 69 6d 65 22 3a 34  2c 22 6d 65 6d 6f 72 79  |"time":4,"memory|
000010f0  22 3a 32 37 34 35 33 30  2c 22 63 70 75 73 22 3a  |":274530,"cpus":|
00001100  32 2c 22 73 61 6c 74 22  3a 22 71 4a 6e 79 2b 4a  |2,"salt":"qJny+J|
00001110  5c 2f 6f 35 71 77 57 77  35 78 2b 57 31 30 7a 47  |\/o5qwWw5x+W10zG|
00001120  59 54 6f 64 44 64 57 6f  39 6e 74 5c 2f 6c 67 49  |YTodDdWo9nt\/lgI|
00001130  41 61 61 6f 78 5c 2f 45  3d 22 7d 7d 7d 2c 22 74  |Aaaox\/E="}}},"t|
00001140  6f 6b 65 6e 73 22 3a 7b  7d 2c 22 73 65 67 6d 65  |okens":{},"segme|
00001150  6e 74 73 22 3a 7b 22 30  22 3a 7b 22 74 79 70 65  |nts":{"0":{"type|
00001160  22 3a 22 63 72 79 70 74  22 2c 22 6f 66 66 73 65  |":"crypt","offse|
00001170  74 22 3a 22 31 36 37 37  37 32 31 36 22 2c 22 69  |t":"16777216","i|
00001180  76 5f 74 77 65 61 6b 22  3a 22 30 22 2c 22 73 69  |v_tweak":"0","si|
00001190  7a 65 22 3a 22 64 79 6e  61 6d 69 63 22 2c 22 65  |ze":"dynamic","e|
000011a0  6e 63 72 79 70 74 69 6f  6e 22 3a 22 61 65 73 2d  |ncryption":"aes-|
000011b0  78 74 73 2d 70 6c 61 69  6e 36 34 22 2c 22 73 65  |xts-plain64","se|
000011c0  63 74 6f 72 5f 73 69 7a  65 22 3a 35 31 32 7d 7d  |ctor_size":512}}|
000011d0  2c 22 64 69 67 65 73 74  73 22 3a 7b 22 30 22 3a  |,"digests":{"0":|
000011e0  7b 22 74 79 70 65 22 3a  22 70 62 6b 64 66 32 22  |{"type":"pbkdf2"|
000011f0  2c 22 6b 65 79 73 6c 6f  74 73 22 3a 5b 22 30 22  |,"keyslots":["0"|
00001200  5d 2c 22 73 65 67 6d 65  6e 74 73 22 3a 5b 22 30  |],"segments":["0|
00001210  22 5d 2c 22 68 61 73 68  22 3a 22 73 68 61 32 35  |"],"hash":"sha25|
00001220  36 22 2c 22 69 74 65 72  61 74 69 6f 6e 73 22 3a  |6","iterations":|
00001230  36 31 39 34 33 2c 22 73  61 6c 74 22 3a 22 46 69  |61943,"salt":"Fi|
00001240  4c 67 31 35 56 5c 2f 55  56 4b 47 72 72 4e 39 4f  |Lg15V\/UVKGrrN9O|
00001250  52 2b 5c 2f 69 59 46 51  70 38 38 59 44 77 50 4c  |R+\/iYFQp88YDwPL|
00001260  6a 4f 6f 4c 70 6a 77 6d  78 58 77 3d 22 2c 22 64  |jOoLpjwmxXw=","d|
00001270  69 67 65 73 74 22 3a 22  49 70 34 31 5a 58 70 44  |igest":"Ip41ZXpD|
00001280  76 77 52 76 6d 41 73 33  30 58 69 72 6c 48 65 6d  |vwRvmAs30XirlHem|
00001290  57 72 44 67 6c 5c 2f 44  4a 31 36 79 33 31 41 71  |WrDgl\/DJ16y31Aq|
000012a0  66 42 55 6f 3d 22 7d 7d  2c 22 63 6f 6e 66 69 67  |fBUo="}},"config|
000012b0  22 3a 7b 22 6a 73 6f 6e  5f 73 69 7a 65 22 3a 22  |":{"json_size":"|
000012c0  31 32 32 38 38 22 2c 22  6b 65 79 73 6c 6f 74 73  |12288","keyslots|
000012d0  5f 73 69 7a 65 22 3a 22  31 36 37 34 34 34 34 38  |_size":"16744448|
000012e0  22 7d 7d 00 00 00 00 00  00 00 00 00 00 00 00 00  |"}}.............|
000012f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00004000
root@disp4117:~#

To get the cipher-name specific for encrypting the data in the LUKS container (as opposed to the cipher used to symmetrically encrypt the a given keyslot), we need to check the segments object in the above JSON. Here's the same segments section from above, but formatted for readability:

  "segments": {
    "0": {
      "type": "crypt",
      "offset": "16777216",
      "iv_tweak": "0",
      "size": "dynamic",
      "encryption": "aes-xts-plain64",
      "sector_size": 512
    }
  },

LUKS supports many distinct segments, but this LUKS container only has one. The attribute we want is encryption, which has a value in the dm-crypt notation. In this case, it's aes-xts-plain64 -- which means the cipher-name is aes and the cipher-mode is xts-plain64.

This also matches the cipher listed in a cryptsetup luksDump on the LUKS2 container

root@disp4117:~# cryptsetup luksDump luksVol2 | grep -i cipher | head -n1
    cipher: aes-xts-plain64
root@disp4117:~#


Encrypting local HTTP traffic using a self-signed certificate For the past couple of hours I've been trying to create a self-signed certificate which I'd like to use to encrypt HTTP traffic between computers and a server on my home network (because I'm paranoid like that). However, I'm not sure if I'm doing this right because I keep getting security warnings in my web browsers. Especially Google Chrome does not like what I'm doing.

Hopefully someone more experienced can provide guidance.

My server (a Synology DiskStation) can be reached both internally (via its local IP address or hostname), or through the internet (via a public IP address or DNS name). Unfortunately, the public IP address is dynamic. However, a service running on my server updates the DNS entry every 60 minutes.

What I've done is I've used OpenSSL to generate a self-signed X.509 certificate (using default settings for the biggest part). I did not specify a CN (Common Name), because during earlier testing I found that it would cause even more security warnings when accessing the server internally. Instead, I included the DNS name, hostname and local IP address in the subjectAltName extension field.

My server's certificate now looks like this: https://dl.dropbox.com/u/14454764/cert.crt

I then proceeded to install this certificate in the Trusted Root Certification Authorities certificate store on my windows machine. I can now access the webserver using HTTPS, but not without warning.

Errors include:

(Google Chrome) Server's certificate does not match the URL. (when using hostname)
(Google Chrome) The identity of this website has not been verified. (when using local IP)
(Internet Explorer) The security certificate presented by this website was issued for a different website's address. (when using local IP)

These warnings return whenever I restart the browser. If I access the webserver from the internet (using the DNS name), none of my browsers complain and everything is fine.

Can I generate certificates for internal use which do not trigger such errors? I'd greatly appreciate your help.

When doing SSL access to a server, the client performs the following verifications:

The client validates the certificate with regards to the local "trust anchors", also known as "root CA", which are embedded in the client (the browser or the operating system). Validation is about building a chain of certificates from a trust anchor down to the SSL server's certificate, each certificate signing the next. Algorithm is a bit complex in its details (section 6 of RFC 5280).
The client verifies that the name of the intended server appears in the server's certificate (validation tells him that it is a valid certificate for some server; this step is about checking that it is the right server, not any other). This step is described in RFC 2818.

For the first step, you need to tell your client system that it should accept the self-signed certificate as valid. Since you talk about Internet Explorer, I infer a Windows operating system; see this answer for how to do it (since Chrome also uses the OS trust stores, chances are that it will fix it for Chrome too).

For the second step, you must use a URL with a server name (not IP address) which matches the name of type dNSName which appears in the Subject Alt Name extension of the certificate (when there is no dNSName in that extension, or when the extension is missing altogether, the Common Name in the subjectDN field is used). If the URL looks like this:

https://www.example.com/path/to/whatever.html

then the browser will try to find www.example.com in the certificate. If it does not find it, then you are due for a scary warning, as you experience.

You may have to play a bit with your DNS settings so that the same name can be used regardless of the network place you are. Remember that it is a name matching: it does not work with IP addresses. Also, note that you can put several names of type dNSName in a Subject Alt Name extension, which is useful for SSL servers who are to be contacted under several names.


Revoke and regeneration in FIDO U2F / FIDO UAF One of the benefits of using Software based Strong Authentication apps (e.g. RSA SecurID Software Tokens) is that if the device that is running the Token generation app is compromised or lost, the ID can be revoked from a centralized system and the end-user provisioned a new ID.

How is this addressed in FIDO UAF / FIDO U2F? Does the user has to individually go and revoke the FIDO enrollment from each service he / she is using to authenticate to using that FIDO device?

Yes, you have to revoke with each service. One of the design elements of U2F is that a site X cannot in any way test or reveal if site Y is registred on the U2F device. Also, its even designed so if someone has 2 accounts on site X, the site X cannot detect that those 2 accounts are stored on the same U2F device.
This to ensure the users privacy so multiple sites cannot track the same user across different sites.

Having a revocation scheme would reveal this fact to the site.

Theres no standarized way of revocation and regeneration, but each site has to implement its own scheme based on security requirements. One scheme can be that using only your username/password, you can revoke your U2F device. To then tie a new U2F device to your account, one scheme could be a physical letter with a one-time code, Another scheme could be SMS in combination with a email. There also possible to issue a revocation certificate.
Or even 2 U2F devices could be tied to the same account at signup, where usage of the second U2F device would disable the first, and then you have to order a third one (that then needs to be activated with the service in question and this third becomes the backup key for the now activated second one).


Detect non HTTP packets using port 80 We are currently doing port whitelisting on our firewalls which is working well but this of course does not prevent the implementation of side channels or the misuse of these ports for other purposes. For example, an attacker could still initialize a netcat backconnect session when the outside listener is listening on port 80.

Is there a way to analyze the payload of every packet to ensure that it is using the protocol that is usually assigned to the destination port?

This is of course only an example and I'm aware of the possibility to hide the payload in a seemingly correctly designed payload. It's all about making it harder for the bad guys.

IDSs and several deep inspection firewalls (sometimes called NGFW or UTM) can usually detect whether the traffic is HTTP or not. Also a HTTP proxy in front would simply block anything which is not proper HTTP.

But be aware that it is possible to build a reverse shell where the traffic will look like HTTP, so this filtering will only help a bit.


Types of risks for my router Recently I've read about viruses and worms that attack routers and do some nasty things, incl. DNS changes etc. In the beginning, I just read that some people have issues that their DNS server address being substituted for something fake and evil. To me it didn't make sense, 'cos normally only me and my ISP would have access to the router's admin panel. Then I heard that there's a primitive web server operating in the router and that way we get to see web interface of the device's admin panel. And those viruses and worms use the inner server's vulnerabilities. So from what I understood (correct me if I'm wrong here), it's not some hacker sitting somewhere and seeing my login window. Also I read that those types of attacks are pretty rare due to the fact that the virus must be written specifically for a certain type of a device.
Frankly, I feel bad that such an experienced person like me when it comes to computers wasn't even aware of all that. I just happened to read couple of articles recently and they brought my attention to the matter.
So I wanted to hear your comments, suggestions and corrections. Is there something else I should know when it comes to the risks as far as routers are concerned? Here I'm not asking about a remedy. Just want to know the dangers.

There are lots of vulnerable routers out there which can be easily be hacked. A typical attack exploits that there is no or a known password for the administrative interface or that the user is logged into the router or that some critical pages on the router can be accessed without authorization. The attack itself then can be executed just visiting a web site, where silently a CSRF request to your router, maybe through some advertisement. This is far from new or rare, see this report) about hacking of millions of routers in brazil 3 years ago.

Other attacks exploit the problem that some routers have the administrative interface open to the internet or that the router has backdoors usable from the internet.

For more information see also routersecurity.org.


Is Kaspersky Total Security a good choice against malware? I've been using Kaspersky Total Security for quite some time even though I'm not an Information Security professional, I heard it was considerably efficient. Yesterday, though, I was navigating through some suspicious websites and I'm afraid my PC might have been infected by something (mostly because of a weird task in my Task Manager named KMS Connection Broker as well as a weird app named only "Program", with no provider informed, being initialized with my PC).

By only using Kaspersky Total Security and executing some verifications, can I make sure my PC is clean and safe from viruses? And if not, what should I do to solve it?

My question is: by only using Kaspersky Total Security and executing some verifications, can I make sure my PC is clean and safe from viruses?

No you can't. Especially not if you are running the security product from inside a potentially compromised system since in this case you (and the security product) can not really trust anything what the system reports.

Apart from that no security product is perfect. They might cover most of the normal non-risky behavior but if your are deliberately increase your risk (i.e "navigating through some suspicious websites") don't expect them to rescue you in all cases.

If you don't want to avoid such sites use another level of separation like a virtual machine - which is not totally secure either but much safer than using the normal system. See Does a Virtual Machine stop malware from doing harm? for more.

  And if not, what should I do to solve it?

Unfortunately the safest way is to burn or at least reinstall everything which might have been affected and restore from the latest known good backup (which you hopefully have). This not only includes the current system but also the router (which is a common target for infection) and also any other system which is connected to yours or to the router.

A less destructive option would be to boot from a definitely not infected medium (i.e. CD-ROM) and do the analysis from there. Since this only looks for known bad things this is not as safe as restoring from a known good backup. But it is definitely less destructive which is important if you don't have a current known good backup. Kaspersky offers such an analysis medium too (Kaspersky Rescue Disk).


Storing UK bank account and sort code in MongoDB database The company I work for has to send monthly payments to 20 to 50 users at a time. These users can change from month to month. Generally, each user will receive money from us for 2-3 months.

The users complete a form in which they enter their details.

We want to be able to store their bank account number and sort code into our database, at least for the period in which they are paid. We are using HTTPS, but I want to know if we should take any more security measures.

I've searched all over trying to find an answer, but did not come across anything relevant to this use case. We are based in the UK and only send payments to UK accounts.

HTTPS is mandatory of course. But there are a lot more of security options. I can provide you some basics:

Server technologies

You should implement HSTS (Http Strict Transport Security) to force clients to use your HTTPS connection.

You didn't specified what is your back-end technology (Java, PHP, etc). You should update your server to the latest versions to avoid known exploits. For example in case of PHP, old versions have a lot of possible exploits.

You should configure your perimetral firewalls to avoid DoS (Denial of Service) attacks as we'll see later, but you can avoid some very basic and known DoS attacks like for example Slow Loris only hardening your server configuration.

Disable banners and server signatures as much as possible in order to try to make harder identification of your software and version (O.S., web server technology, etc).

Code

Is your backend injection proof? You must be pretty sure about filtering and sanitizing "dangerous" chars to avoid XSS, SQL injection and other possible attacks. This is one of the more important points.

CSRF attacks must be avoided. You should perform a correct session handling with some kind of mechanism (usually session hashes, tokens or similar) to prevent this.

Perimetral Security

WAF (Web Application Firewall) is a good option to try to filter a lot of attacks against your site. Anyway, this must be a complement of secure coding. Never the security must depend only on this element.

IDS/IPS (Intrusion Detection System/Intrusion Prevention System) are mandatory (in my opinion) if you are managing sensible information like bank accounting data. You must be able to detect/prevent attacks.

There are more... but as a start is enough I think. :)


Why is systrace insecure? Why is the:

http://www.openbsd.org/cgi-bin/man.cgi?query=systrace&sektion=4

Systrace marked as insecure?

Can someone explain the "why"?

I did not find anything on that page that describes Systrace as insecure.

Systrace was the result of groundbreaking research, described here:

Improving Host Security with System Call Policies, Niels Provos, USENIX Security 2003.

Later research reported vulnerabilities in system call monitoring tools (including Systrace):

Exploiting Concurrency Vulnerabilities in System Call Wrappers, Robert Watson, WOOT 2007.  blog post.

I do not know the status of those vulnerabilities.  I don't know whether Systrace has been patched to defend against those attacks.


Block specific packets/sequences of packets to remove disturbing client "feature" Recently, one of my client-server application started to disturb me with some very annoying "notifications". Basically, what happens is that the remote server sends a few packets to my client, which translates them into a message it displays in its interface. Thing is : these notifications really annoy me.

Since these notifications are nothing vital to the client, I started to analyse my TCP streams coming from the remote server. I noticed an obvious pattern : every time the notifications pops up, 4 specific packets are sent to me. For instance :

Flags [P.],  seq 60:297,                 ack 1,          win 257,    options [nop,  nop,    TS val 108022880 ecr 914609],    length 237
Flags [.],                               ack 6,          win 257,    options [nop,  nop,    TS val 108022891 ecr 915061],    length 0
Flags [P.],  seq 297:534,                ack 6,          win 257,    options [nop,  nop,    TS val 108022891 ecr 915061],    length 237
Flags [.],                               ack 11,         win 257,    options [nop,  nop,    TS val 108022904 ecr 915090],    length 0

I observed the TCP communication for a while, and let several notifications appear. Here's what I noticed :

The server always sends 4 packets when requesting the client to "notify" me.
These packets are always organised in the same order : 237 bytes, 0 byte, 237 bytes, 0 byte.
The rest of the communication between the server and the client doesn't follow any pattern (except when I repeatedly make the same requests to the client of course).

Since I've been able to identify a pattern, I would now like my machine to detect it when it occurs, and block the associated packets before they reach the client.

I have tried using the size as a blocking parameter using :

iptables -I INPUT -p tcp -s [server-IP] -m length --length 237 -j DROP

Unfortunately, I can stil see the 237-byte-long packets reaching the client... Is there any way I could be specific enough with iptables, in order to block this particular sequence, without shutting off the whole communication stream ?

Edit : the Don't show disturbing notifications option does not exist in the client, that would be far too easy, wouldn't it ? These notifications are very much like ads.

No.  If you drop packets from the middle of a connection, the server will resend those packets until they succeed.  If they don't succeed for a sufficiently long time, the server will assume the entire connection has failed and will close the connection.

The reason your IPTables rule is not matching is that IPTables matches against the entire packet length, whereas your 237 bytes is the length of the data in the TCP packet.  The full packet length is at least 20 bytes longer (may be more, depending on TCP options).

You could proxy the connection and actually remove the message at the application layer, but that'd depend on the protocol in use.


Amazon RDS MySQL SSL connection, is the password sent in clear? I am testing Amazon RDS MySQL and I want to connect to MySQL instance using SSL. It works pretty well, but there is something that is not clear to me: reading the FAQs (https://aws.amazon.com/rds/faqs/):

  SSL support within Amazon RDS is for encrypting
  the connection between your application and your DB Instance; it
  should not be relied on for authenticating the DB Instance itself.

it seems that once the connection is established, data is encrypted during communication but the authentication part is not; so: are MySQL passwords sent in clear?

If you look at the MySQL Internals Documentation, you can see that the protocol initialises SSL/TLS after the initial handshake packet, but before the authentication step:

The two paths shown from the first state are based on whether SSL/TLS is enabled or not. As such, if SSL/TLS is enabled, the authentication occurs after the secure channel is created, and the credentials are not sent in plaintext.

The key thing about the wording of the documentation you quoted is that it says "should not be relied on for authenticating the DB Instance itself", and not "authenticating to the DB instance itself". I suspect the point they're making is that, since each DB instance has an auto-generated certificate, you shouldn't rely upon this for verifying that you're speaking to the database instance you requested.