Implementing a custom stateless token Normally i would use JWT when stateless auth is required, but i was thinking of a simple token system. Which will create a token while authenticating a user and then store that token in a SQL table with additional payloads and expiry date.

The payloads will include the user id and other informations as required.

So when i need to validate a token i would simply query in the table and check if exists and if it is expired or not.

That seems fine but i have a question here, that is if some how the database exposed to a hacker then the hacker will be able to access every users account using their token.

Now my question is, what necessary steps could be taken so that this can be prevented? Or is it a super bad idea?

The basic pattern you describe is basically the simplest way to create a stateful session management system. Your users would get an opaque session Token (a securely-random string of at least 128 bits in length), usually set in a Secure-flagged cookie. Typically you'd then have a table that stores active Sessions, with the session Token as the primary key, and foreign keys pointing to your Users table (plus any necessary metadata, such as session expiration data; don't rely on the cookie going away when it's supposed to). This is, of course, assuming you can't just store the sessions in memory (perhaps they're very long-lived, or need to be stored across servers), and has a substantial performance impact (lots of database calls) so usually you'd use a lot of caching.

If you want to use this model but prevent an attacker who successfully read your Session table from impersonating the active sessions, you can do that by running each Token through a hash function (such as SHA-256*) before storing it in the database (or looking it up in the database). That makes it still possible to quickly check for a given Token in the database, but makes it practically impossible to go from seeing the database to knowing the valid Tokens.

*It is fine to use a fast hash here (unlike for passwords), because the input string is already too high-entropy for an attacker to brute-force search for it. Similarly, you don't need a salt (although adding one won't hurt anything except some performance) because 2^128 is far too large a number for a rainbow table.


Can phone apps read my clipboard? Via Hacker News, I came across a Tweet implying that Facebook's iOS app routinely reads and transmits all content from the user's pasteboard.

Leaving aside whether Facebook's app genuinely does this (which is a separate question), is this possible? I had always naively assumed that an app couldn't access what was on my clipboard unless I explicitly chose to "Paste" into a native text view. Is that assumption wrong? What is the security model for the content of the clipboard on the two major phone OSes? (Or what are the security models, if it's handled differently between iOS and Android?)

Android
Yes, it's possible in Android. Any app/service can read your clipboard data. In fact, there is a lot of code online which creates a service running with a listener in the background, which will inform the app whenever the content on the clipboard changes, along with the content.
There are a few Android apps that I know which use this feature. One is Truecaller: whenever a contact number is copied, an on-screen overlay tells me the phone number's owner's name. Another one is Google Translate: whenever I copy a statement or two, I see a floating icon on my screen, which, upon clicking, gives me an option to translate the copied text to another language.
Here is an example from Stack Overflow for your reference.
iOS
As confirmed in the comments by user 11684, even Apple allows apps to read your clipboard (though only while they are in the foreground). Here is the link to the documentation that returns the data of the clipboard.
Update in iOS 14:
Beta version of iOS 14, reportedly, has a feature which alerts the users whenever any app reads the data from the clipboard.


Write zeros in memory through a buffer overflow Trying to give a command line program an address to overwrite a return address saved in the stack. I could successfully overflow the input argument into the exact return address position but the address I want to give contains zeros (starts with with zeros eg 0x0000555555554bce).

I give the address in from of string, the 00 must be a NUL character (\0) but I can't give that using the command line. Any idea on how can I achieve that?

If I understood correctly the problem has to do with packing your input. You can use any scripting language to pack your input. For example in python you can do (assuming x64-bit arch):

cat <(python -c 'from pwn import p64; print your_padding_here + p64(0x555555554bce)') - | ./your_program

or if for any reason you prefer only built-in modules:

cat <(python -c 'print your_padding_here + __import__("struct").pack("I", 0x555555554bce)') - | ./your_program

Also you can accomplish the same thing by writing the buffer to a file and then pass the file as input.


Is it secure to use the same token as both refresh token and access token? As far as I understand in OAuth there is a refresh token and there is an access token. The access token cannot be revoked but short-lived and on next refresh access there will be no access token if revoked. I have a simple application where I issue tokens myself and consume myself all in one application (both mobile and web, but same API), so I don't need any complex OAuth or OpenIdConnect for 3d parties. I want to use this scheme with just one token for simplicity, but I want to refresh it as well for performance reasons (not to check revocation on each call):

A client provides a username and password to a special endpoint and receives a JWT back that is signed but not encrypted (that's good enough as far as I understand, user can read but not forge). I use JwtSecurityTokenHandler in .NET to issue token myself without Oauth or OpenIdConenct servers to do that. The token is signed using RSA SHA 256 with certificate that I created myself. Token is short-lived, e.g. 1 hour.
All api calls are amended with Bearer authentication and I read the token on the server and verify the signature and expiration (nothing else like Audience, etc.). The server will trust this token and will not check for revocation.
If the server detects that a token is expired it will return some 40x to let the client know to refresh the token. (Client can do pre-verification of expiration date itself since token is not encrypted to save some server calls).
If the token is expired, the client will call refresh and pass the same token to it. The difference will be that this time the revocation status is verified (I have a simple revoke all tokens for user policy, not per token). I will check the additional timestamp of initial issue that is not changed with refreshes and verify it against that it's greater than user's timestamp which is set e.g. when a user changes password. The result is another token of the same type with the same initial timestamp and expiration time of 1 more hour. If revoked, then the user will have to relogon.

I really need to refresh only because of performance considerations, but I am wondering maybe I am missing something and there is really a security issue or maybe some other troubles with this simplified flow with only one token?

If you're in control of both the client and the server and you can ensure that both tokens are always transmitted securely, there is no drawback in using the same token for both.

Normally, the refresh token is the critical token to protect, as this allows indefinite access to the application. It is also easier to control which transports this is transmitted over. However, in your case if you can apply the same security to the access token then there is no extra risk in them being the same.

Also see this answer.


Dangers of self-signing a certificate and having clients import them? There are multiple sources claiming that self-signed certificates are dangerous because ultimately the client has to accept connection to a website that his browser tells him is unsafe and he has got no way to verify whether the website is genuine or an impersonation by a man in the middle. However, what if those certificates are distributed to the clients in a trusted secure manner and they import them. Wouldn't this allow them to actually verify the identity of the website? Are there any additional dangers from that?

I see an additional problem with this type of setup. As self-signed certificates usually are signed by itself, not by a CA (otherwise it would not really be a self-signed certificate), you won't be able to revoke the certificate if the private key is compromised. The only way to revoke the certificate will be removing it from the clients trust store, which usually cannot be done remotely.

If you want to do this setup, create a CA, and save it securely (offline is preferred). Then, create an intermediate certificate signed by your CA and use that to sign the final certificates. Then, you will be able to revoke the certificates (unless base certificate is compromised).


Why do we use asymmetric encryption only for authentication when establishing a SSH connection? When we authenticate with a server we authenticate with a public key (asymmetric encryption) to transfer a symmetric key. Why don't we keep using the asymmetric key pair instead of the symmetric key?

There are several reasons why this can't work in real world (even though it sounds quite ok with the basic knowledge you are presenting).

SSH servers support also password authentication. What asymmetric key would you use in that case?
Transferring huge amount of data and serving many clients would make the host keys extremely prone to the various attacks. In cryptographic algorithm, you need to rekey (exchange the keys) after some time or some amount of transfered data. That would be impossible unless you would need to redistribute the server public key very frequently.
Last but not least as mentioned in the comments, the CPU cycles to achieve the same security strength with RSA is gradually higher than AES and it is similar with other algorithms.


Algorithm and key size to choose for SSL certificates (security and CPU wise) in 2020 (using nginx) I posted this question already on SO, but as it is not really a programmin question I thought it might be a better place to ask here:

I want to setup a new SSL certificate store for generating SSL certs (server certs (nginx) and client certs (linux/windows devices))

I'm searching already for quite some time and I'm not sure I fully understand. especially as some articles are a few years old.

Many articles just talk about RSA end seem to recommend 2048 or 3072 though mentioning that 2048 is today probably still the best choice ( https://expeditedsecurity.com/blog/measuring-ssl-rsa-keys/ )

I found for example one Article ( https://paragonie.com/blog/2019/03/definitive-2019-guide-cryptographic-key-sizes-and-algorithm-recommendations )  but it seems to talk mostly about key encryption as @dave_thompson_085 pointed out on SO

stating in the section "Asymmetric ("Public Key") Encryption"

Use, in order of preference:
    X25519 (for which the key size never changes) then symmetric encryption.
    ECDH with secp256r1 (for which the key size never changes) then symmetric encryption.
    RSA with 2048-bit keys.

The security of a 256-bit elliptic curve cryptography key is about even with 3072-bit RSA.

Although many organizations are recommending migrating from 2048-bit RSA to 3072-bit RSA (or even 4096-bit RSA)
in the coming years, don't follow that recommendation. Instead migrate from RSA to elliptic curve cryptography,
and then breathe easy while you keep an eye out for post-quantum cryptography recommendations.

However they don't mention the impact on server CPU usage compared to RSA 2048/3072/4048.
I also didn't find many other articles suggesting to switch to Elliptic curve algorithms.

Another article ) https://www.thesslstore.com/blog/you-should-be-using-ecc-for-your-ssl-tls-certificates/ _ tries to promote ECC instead of RSA, but comments on the article state, that ECC is less safe than RSA if quantum computers kick in.
And the article cites nowhere numbers for what  performance improvement to expect when using ECC.

https://crypto.stackexchange.com/questions/1190/why-is-elliptic-curve-cryptography-not-widely-used-compared-to-rsa mentions potentially legal issues and fear of being sued.

Though CPU usage is not a major issue Id still like to get some idea as I'd like to use the same CA and cert store also on devices like raspberries.

So what is today the best choice for certificate key algorithms and key sizes for server certs
(old internet explorer not required but PCs, tablets, mobile phones being used today should be able to connect to the server

and what's the best choice for client certs (will not be used on mobile devices)?

I kind of tend to RSA 2048, but I'm really not that sure I interpret all the articles correctly  and don't like to make choices based on feelings.

Benchmarks on a single core in my aging laptop (Skylake, openssl 1.1.1):

$ openssl speed rsa2048 rsa3072 rsa4096
                  sign    verify    sign/s verify/s
rsa 2048 bits 0.000662s 0.000020s   1510.2  49977.8
rsa 3072 bits 0.002078s 0.000040s    481.2  24920.9
rsa 4096 bits 0.004433s 0.000068s    225.6  14614.6

$ openssl speed ecdsap256 ecdsap384 ecdsap521
                              sign    verify    sign/s verify/s
 256 bits ecdsa (nistp256)   0.0000s   0.0001s  37387.6  12823.3
 384 bits ecdsa (nistp384)   0.0012s   0.0009s    855.6   1154.5
 521 bits ecdsa (nistp521)   0.0003s   0.0007s   2881.8   1510.7

$ openssl speed ed25519 ed448
                              sign    verify    sign/s verify/s
 253 bits EdDSA (Ed25519)    0.0000s   0.0001s  21340.9   7981.1
 456 bits EdDSA (Ed448)      0.0004s   0.0006s   2827.1   1599.6

I recommend you run the benchmark on your own hardware and your own version of the TLS library (e.g. SChannel for IIS would have different performance, but openssl adds optimized versions for different microarchitectures as features, so benchmark different openssl versions too).

P-384 is not a great curve, it's slower than P-521 because of the curve parameters, that's not an implementation quirk of openssl. NSA Suite B makes it more popular than it deserves.

In TLS, the server performs "sign" and the client performs "verify", unless client certs are used, then both sides do both (this is rarely used, if you use this you know that you do).

The EdDSA numbers don't matter because although the RFC exists, WebPKI will not use EdDSA, they will upgrade to PQCrypto whenever the HSMs for those standards are out after the standards themselves are out. I suppose for self-signed certs you can use EdDSA (I didn't try that, I don't know what supports this).

You see that the server would prefer to do ECDSA NISP P-256 signatures, because those are fast. The clients would prefer to verify RSA-2048 or bigger RSA and not to verify ECDSA, because that is slow.

The choice between RSA and ECDSA is whether you want to put more load on the server or on the client. Also, some people don't like ECDSA and it's possible some clients are too old to handle ECDSA.

The most popular choice currently is RSA-2048 and it's ok.

Note that if you only allow PFS cipher suites (and you should do that), the key for the certificate becomes useless to the attacker when the certificate expires, so it doesn't need to stay unbroken for decades.

Your ECDH is the part that needs to stay unbroken for a long time to prevent retroactive decryption of recorded traffic.

So if you read that RSA-2048 is no longer considered secure because NSA might soon be able to break it, replace your cert and you're good even for older traffic. But if you read that X25519 or P-256 ECDH is no longer considered secure because NSA might soon be able to break it - too late, they already have records of your TLS traffic protected by those primitives, after you upgrade you only protect future traffic, not older traffic.


What is the "openssh-blacklist" package? Is it related to the Debian OpenSSL bug? What is the "openssh-blacklist" package? Is it related to the Debians OpenSSL bug?

Yes it is related to the Debian OpenSSL "bug". It contains a list of of all DSA-1024 and RSA-2048 keys generated by a Debian sabotaged OpenSSL PRNG.


How to open a .txt.enc file? I have a .txt.enc file. It is an output of openssl enc. I need to open it.
When I try to open it in Emacs, the first some characters(also known characters) are : 'Salted__C' .
how can I understand that which decryption method such as '-aes-256-cbc' or '-cast5-cbc' I should use to open it?

What Adnan says about ciphertext indistinguishability is correct, this can be a hard problem, the only clue you have is "Salted__" string which is how OpenSSL distinguishes salted and unsalted encrypted data.

Assuming the file was encrypted with a password (or key/IV pair) that you have, you will have to try every every method:

ciphers=$(openssl enc -h 2>&1 | nawk '/^Cipher/ {n++; next}; (n) {print}')
password=xyzzy

for cc in $ciphers; do
    openssl enc -d $cc -pass pass:$password \
        -in myfile.txt.enc -out outfile$cc.txt  2> /dev/null
    rc=$?
    # check for non-zero exit, or output file size not > zero bytes
    if [ $rc -ne 0 -o ! -s outfile$cc.txt ]; then
        echo "Failed with $cc"
    else
        echo "Possible success with $cc"
    fi
done

(There are some duplicate ciphers due to name aliases, e.g .aes-128 = aes-128-cbc.)

Now you'll see the next problem, with many algorithms you can decrypt ciphertext with a bad password and not know if the algorithm and/or password were correct.

There are a number of methods to determine if a password was correct and a decryption was successful (e.g. via checksum, integrity (e.g. with HMAC), padding (e.g. with PKCS#5) or other expected structure, or known "left over" state), though sometimes not being able to tell is in fact a feature.


Cisco IOS service password-encryption In Cisco IOS there's the service password-encryption command to encrypt all passwords in the config file to prevent unauthorized individuals from viewing them.

quoting from http://www.cisco.com/c/en/us/td/docs/ios/12_2/security/configuration/guide/fsecur_c/scfpass.html

  Caution  The service password-encryption command does not provide a high level of network security. If you use this command, you should also take additional network security measures.

then it's written:

  Although you cannot recover a lost encrypted password (that is, you cannot get the original password back)

So what do they mean exactly? It does not protect very much because of weak encryption used or because it only protects users from viewing the password in the config file?

I'm confused because in the Networking Academy material they say

  The service password-encryption command applies weak encryption to all unencrypted passwords.

So is it weak because it's easy to crack?

TL;DR Don't use Type 7 refrain from using Type 5 where possible and almost always try to use Type 8 (Unfortunately Type 8 in the world of Cisco isn't always available on all devices.1)

As stated by the users here, there are "two" (I use speech marks here because there are actually more, some only feature on newer versions of code and certain products and I will talk about those later) but the two password types that are common are Type 7 and Type 5.
As you've been told Type 7 is very easily cracked, in-fact with a quick Google search you can find a decrypter online as an example here is one I've used in the past. The point is, it's easy to reverse, there is no security behind it whatsoever so please don't ever use it (unless you're just running labs).
What you've not been told is why it's insecure - Type 7 uses the Vigenère cipher this cipher is now considered to be completely broken in-short this cipher uses

A series of interwoven Caesar ciphers based on the letters of a keyword.

What this essentially means is you take multiple Ceaser ciphers in sequence however you change the shift value each time. So where in a Ceaser you simply use a shift of three in a Vigenère cipher you shift with different values each time. A good website to see how Vigenère ciphers work is Crypto Corner.

So what about Type 5 is that more secure? Yes, it's more secure, Is it good? Well for storing passwords, not really. Type 5 uses MD5. MD5 isn't at all good for storing password see Is MD5 considered insecure? (I suggest reading both CodesInChaos's answer and Thomas Pornins answer below it) both answers are great and will tell you why you shouldn't store passwords in MD5. In essence, MD5 is fast, you can hash billions of passwords per second. Ciscos implementation of MD5 uses a Salt however as mentioned here by Tom Leek, in reality, using Salt in MD5 doesn't make any difference because of speed. So should you use Type 5 it honestly depends on your threat-model but I would advise against it where possible. As I mentioned earlier there are actually other types.
In newer versions of Cisco's IOS, there are now Type 8 and Type 9 passwords. These are much more secure.

Type 8 uses PBKDF2-SHA-256. PBKDF2 is good due to the fact that's it is designed to be slow where MD5 isn't. Type 8 is incredibly slow which can be a problem especially on a router, switch, etc this is because they don't use powerful CPUs, whilst a company like Cisco doesn't disclose specifically what CPUs they use it would be logical to say they're not extremely powerful for example in reality what a switch is doing isn't that intensive so they're not going to be using very powerful hardware. This becomes obvious when you generate an RSA key with 4096 bits on a Cisco switch. In general it seems that PBKDF2 appears to be the standard for password storing as mentioned by Tom here it also appears to be the NIST recommended for storing passwords so if you have the option I would recommend Type 8 it's going to be infinitely more secure than Type 7 and significantly more secure than Type 5 so if you have the ability then use it. Again this is all subjective to your Threat Model. In general, though I would say if you're using this on a customers network (customer being a client perhaps you sell networking solutions too) then where possible try to use Type 8.

Finally you have Type 9 Scrypt whilst I cannot evaluate the security of this that well Scrypt appears to be in general "more secure than Bcrypt" the issue with it, is that it's a lot more recent so that obviously means it has had a lot less time to be looked at by crypto experts. However, put simply Scrypt will be a lot more secure than Type 7 and Type 5 because it is again designed to be slow, which means computation time is a lot longer thus you'd like to think "more secure". Again a good resource for Scrypt is here.

To sum up, should you use Type 7 or Type 5? The answer is no. You should certainly not be using Type 7, it's awful. In regards to Type 5 don't use it either. Storing passwords with MD5 is not secure at all.
In a production environment please refrain entirely from using Type 7 refrain from using Type 5 where necessary/possible and almost certainly try to implement Type 8 or Type 9 considering PBKDF2 is the recommended from NIST as per this I would edge towards using that over Type 9.

One final thing I would like to mention is this - obviously this is only for local credentials (I would hope) if you're going to be installing production networks please use a RADIUS server of some sorts, this is much more secure (especially if you have a NOC where multiple engineers work).

1 - I realise I failed to mention Type 4 but if you're going to implement that on a network you shouldn't be working in I.T and you need to upgrade your devices in order to enjoy that they will no-longer support Type 4


Does improving password complexity improve the security of wireless networks? Does having a complex preshared key improve the security of WPA2-PSK, or is having even a simple PSK enough to secure the wireless network?

A strong passphrase is better than a weak one.

On a WPA2-protected network with a simple passphrase, a naive attacker would be deterred - but a sophisticated attacker would not (because they could simply capture the handshake and crack the passphrase).

On a WPA2-protected network with a complex passphrase, even a sophisticated attacker would be deterred (for that particular attack path, anyway) - because they wouldn't be able to crack the passphrase.


SSL certificate expired Some company was trying to sell me their security system. They said that the SSL certificate was expired on my laptop, which they showed me. They said that I wasn't protected. What are my options?

As a consumer, you do not need to worry about expired SSL certificates on YOUR machine. SSL certificates are owned by web servers and companies.

If this company contacted YOU to tell you something was wrong with your SSL certificates (and you do not own a web server), I can almost guarantee they are trying to scam you.


Is it really required to encrypt files explicitly our self knowing that S3 will keep everything encrypted? As AWS S3 already keeps files encrypted. What could be the use case where we need to encrypt our file using any other library explicitly. Is that required in real world application ?

Is it really required to encrypt files explicitly our self knowing that S3 will keep everything encrypted ?

In terms of explicit versus implicit use of cryptography, most of the time it is the latter that is most widely used on the internet (i.e. when sending an email or making an https connection, it all happens in the background through trusted software) but the choice of which to use should depend on the degree of trust in an implicit process, for example.

Regarding the part of the question about the need to encrypt prior
to uploading to a service that will encrypt the data anyway, I
think that also depends on the level of trust and level of security
needed.

For example: some services don't have access to encrypted data as the encryption takes place client-side, where only the resulting cipher-text is held on the server, however, most of the time this requires a trusted setup where you are trusting the service provider's web interface or desktop software to allow the local client-side encryption to take place.

If a user didn't completely trust this process another option would be to encrypt their data themselves explicitly beforehand, and then import/upload as-is with no subsequent encryption by the service (if that option is available), or the service would encrypt the already encrypted ciphertext anyway (obviously with a different key) so that even if that service was compromised and that ciphertext would be decrypted, it would only decrypt to the initial ciphertext, and not the underlying plain-text (unencrypted data). This would be a form of double-encryption.


Why is ActiveX said to be insecure? I do not have experience with web development, but I have read that ActiveX should be abandoned because it is insecure, in favour of other scripting methods such as JavaScript.

What exactly does ActiveX do, why is it considered insecure and how is it different from JavaScript and VBScript?

I would prefer a simple explanation that does not go into too much technical details (if possible).

ActiveX is a remotely exploitable attack surface exposed by the browser.  ActiveX components are classes exposed to JavaScript.  By their nature,  an ActiveX component is performing sensitive functionality not normally exposed to JavaScript, and this functionality could be exploited.   ActiveX components can be written in C/C++ which means ActiveX components can suffer from buffer overflow or other memory corruption vulnerabilities.  Many exploits have been written to leverage vulnerabilities in ActiveX components,  especially ActiveX component written by Microsoft and enabled by default.

Exploitation of an ActiveX component often leads to remote code execution on the target system.


How are Distributed Denial Of Service (DDOS) attacks resovled I just realised that I don't know how (denial) of service attacks are resolved especially in the long term.

The attacking machines don't get tired and there must be some cooperation involved in dealing with the attack.

How is an attack dealt with long term? Can a company under attack call some kind of special phone number? If an attack is from another country, how do people who deal with these attack cooperate?

Most of the time, you can only prevent a DOS attack, especially during a Distributed Denial-Of-Service attack, as many Botnet computers or even Bot-Free computers causing the problem lead to amounts of information too hard to trace. Here are some methods of prevention:

Application Front-End Hardware:

Buying intelligent hardware that can analyze data packets and determine which ones are safe and which are not.

Bandwidth Management:

Controlling the amount of network traffic through methods such as throttling and server time-outs.

For more information, visit
this website.


Packet analysis of IRC traffic I've been going through this malware traffic analysis exercises and part of the malicious traffic detected is IRC traffic over non-standard port 443. This is picked up by ET Snort rule sid:2000348; rev:15

The content of the rule is

  "JOIN "; nocase; depth:5; pcre:"/&|#|+|!/R"

How would I find this IRC JOIN command if I was to analyze the pcap using Wireshark? Is there a way that I can search the entire pcap for the string "JOIN"? Does Wireshark support using regex like the above Snort rule?

One solution would be to use a utility such as ngrep(http://ngrep.sourceforge.net/usage.html) and pass it the .pcap file along with a regular expression.

EX: ngrep -q -I file.pcap|grep -i user

An example of this can be found on the web HERE

Snippet from trustwave.com

  5) Search for text strings using ngrep

  This is useful to look for any specific string or regex you want e.g
  look for "password", "card","username" etc....This will normally find
  FTP, HTTP, or POP passwords as examples. Although this is a simple
  example, ngrep can be used for complex regex's.

  ngrep -q -I file.pcap|grep -i user

  e.g

  ..........< TRUNCATED>..........

  en" id="secure_username" name="username" value="" />......

  ..........< TRUNCATED>..........

  6) Find emails using ngrep ...

What regex to use:
I would encourage learning how to craft regular expressions if you haven't already as they are very useful.
(Not tested): ~JOIN

EDIT: If you must use wireshark and not ngrep then I believe wireshark uses perl style regular expressions


Is it possible to "protect" against MITM attacks over HTTP? In a conversation on twitter I warned a site about a security vulnerability. Specifically, the possibility of a MITM (Man in the Middle) attack used to compromise their registration form.

The response to my warning was that "We protect against man in the middle attacks. So still doesn't apply."

Is it possible to "protect" against a MITM attack without implementing SSL (I'm aware SSL isn't bulletproof either, but always thought it was the first step)?

They are doing post submission over SSL.  This will provide protection against a passive MITM since the credentials would be encrypted on the post back, however, it does effectively nothing against an active attacker that is able to alter traffic since they could simply alter the postback URL and the user experience would not change.

A smart client could verify the integrity of the postback URL prior to credential submission (including inspecting the page for any javascript that may alter the URL) and avoid a MITM attack, but practically, for the average internet user, it is not secure.  The site you were visiting really should switch to providing the login screen on a fully HTTPS page.


Firefox Add-ons: "x" as Add-on name? Is this normal? Why is the Add-on named "x"? - not just this one, any add-on that I want to install named "x"..

Why?

p.s.: from the https://addons.mozilla.org/en-US/firefox/ site

It seems like that URL points to Adblock Plus (as does the author's name). My guess is that something was accidentally pushed to release with a placeholder for the version / name. I tend to use "x", and various combinations of "foo" and "bar".

Unfortunately, your question doesn't give me anything else to go on and is too point-in-time to really get anything useful.


Encrypt file with many passwords I am looking for a way to encrypt a file using many passwords for decryption.
I was use AES encryption as solution or any compatible one.

I have suggestion:

Encrypt file with one password, and when we decrypt, we can use many passwords but related to the first one like (RANDOM_KEY.password.RANDOM_KEYS) and encode it ... in the decrypt function we decode the password and remove random_keys.

I want make a file decryptable with many passwords, but the other passwords generated from the main password ... like this a user1 can't share the password with a user2.

But how to make this pratical in a C language for example ?

You can encrypt the file with a randomly generated key. And then you can encrypt that key many different ways.

Some terminology and notation. Alice will have her password, pA which is processed by a Key Derivation Function (KDF). The result of running the KDF on pA will be Alice's Key Encryption Key (KEK). Let's just call the randomly generated key that encrypts the file, k.

So in Alice's case k will be encrypted with her KEK which is derived from running the KDF on pA. So

KEKA = KDF(pA)

WA = Enc(withKey: KEKA), data: k)

WA is the "wrapped" key. Along with the file encrypted with k, you store the wrapped keys: WA, WB, WC, ...

You may wish to look at  RFC 3394 for recommended ways to encrypted a key with a KEK.


Is password reuse a problem if the password is very strong? I always read that using the same password on multiple sites is a risk. I'm wondering what is the real reason for this?

In my case, I use the same password on multiple sites everywhere. My password is, however, very strong and complicated and long that I saved in a text file and then copy for each connection on sites to which I subscribe. Does this method protect me from the risk because my password is too complicated and long?

Password reuse is a security bad practice because of of a simple attack scenario like this one:

Source: XKCD
With reusing a long and complicated password, you are still facing the same threats as highlighted in the above schema.
In addition to this, saving a password in a text file is an unsafe practice in that the privacy of your password depends also on the safety of your computer (think of malicious browser plugins you may install, drive-by download attacks installing spyware on your machine ...) and that of your network. You may also consider other scenarios like with phishing attacks on which the strength of your password does not play a role.


Can I gain access by nmap? I have a Debian machine with nginx 1.14.0 (Ubuntu), and I found an exploit, https://www.rapid7.com/db/modules/exploit/linux/http/nginx_chunked_size

But, is it possible to gain access by only nmap?

Nmap is a software for discover information in the network like open ports, SO versions, host discover... but as far as I know, you can't get access with nmap. You will need other aps like Armitage or aircrack-ng to exploit the vulnerabilities you found with nmap.


If we know CAPTCHA can be beat, why are we still using them? If we know CAPTCHA can be beat, why are we still using them?

A 35% to 90% success rate like wikipedia is stating means software is better at solving CAPTCHAs then I am.

CAPTCHAs are a trade-off between the patience of the attackers, and the patience of the normal users. Even if they can be beaten, they still serve their purpose if they slow down attackers sufficiently to discourage at least some of them, while not frightening too many potential users.

Of course, as is customary in IT, a lot of systems are used and deployed and adopted because of cargo cult. CAPTCHAs are fashionable and this is sufficient to ensure their widespread usage.


Reading keystrokes of other applications Is it possible for other application running in the OS to read the keystrokes that my application uses?

What about mouse events and window handles?

Is there any security wall that the OS uses to shield my application from other potential
dangerous applications that have might infiltrated into the machine?

Is there any difference between Windows in Mac in this issue?

Thank you

the windows developer tool 'spyxx' can capture all windows messages, including keystrokes and mouse events of other applications, so it is certainly possible.

It uses SetWindowsHookEx.


Potential intrusion on home network? I was browsing through my home network linksys router logs today and noticed an incoming connection from 41.212.36.114 to port 44543.  I checked out this IP address at it's coming from Kenya.  I'm in the USA and don't know anyone or any service that I use based in Africa.  In addition, I found another African IP address hitting this same specific port. In addition, I looked at my port forwarding on my router and I don't see anywhere on the linksys EA9200 where I have port 44543 open, but sure enough, when I use a publicly available web-based port scanner, it shows this port is open.

I'm obviously not super network knowledgeable (probably know enough to be dangerous as they say), but now these logs have me a little worried.  The EA9200, I'm finding out, is pretty bad since I can't seem to maintain historical logs in a a log file from the router (beyond about 20 entries) and apparently, I can't blacklist IP addresses and have no idea how this port is open.

So my question to this community is, what steps could I take, to (1) determine if my network was compromised with such terrible LINKSYS logging (e.g. someone got into the network and took anything or did something nefarious such as browsing personal documents) and (2) determine why or how this port is open since I haven't explicitly opened this port up and (3) how to close this port since it is apparently, open.

If there are questions or you'd need more info, I'm happy to update the post as needed.

Thanks.

UPDATE:

My main computer is running Windows 10, Version 1703 (OS Build 15063.540).  However, I have a number of other devices on the network that use various Linux distros and android.

My ISP is Comcast Business Class.

First you have to check which process is running or using that port. How can you do that:

netstat -a -b

You can use also TCPView.

Than make sure that running process is not affected by any security issue.

Attackers are just scanning randomly and trying to find new victims.

To keep them away use firewall or IPS/IDS.


Is it PCI compliant to send credit card details to the server without saving them there? Considering I use SSL the whole process.

I have an IOS client that I want to use to enter the user's credit card details. I want to do the whole charging and processing on the server side, so I send the credit card details to the server where it is being used to process. I don't save the details there on any permanent storage.

Is this okay / enough ?

No.  You can not handle PCI without meeting PCI-DSS requirements for handling PCI.  Not storing it just means you don't have to worry about storage requirements, but things like network segmentation and server security still apply, even if it only transits across your server.


Is my authentication persistence system design secure? This system is for a personal file upload and sharing web application made with PHP.

When a user logs into the application, it has the option to "stay logged in" after closing and reopening their browser, just like most other web applications. What this actually does is that it sets an HTTP cookie, named auth, with an expiration of 90 days on the client browser that contains a string in the following format: UserIdentifier:SeriesNumber:Token where : is the delimiter. The same data is also persisted in the database table user_auths, but the token will be hashed before it is.

The UserIdentifier is the user identifier of the user that opted to stay logged in, the SeriesNumber is a generated random number between 0 and 2147483647 (inclusive) and the Token a generated random 60 character string of alphabetic, numerical and symbolic characters. An example value would be: 1:902449381:j7j]fP%CxIzcKSg/'wG]XzJd.OsX8"K0FlY')xXQz.5.Q]+KJnXi<>p/t7nz

Every time a user visits the application and is not found in the HTTP session I will:

Try to find the auth cookie on the client browser. If it's found, I check if the value of it contains two : delimiters (checking for the right format), if the correct amount of delimiters is not found I delete the cookie of the client browser and the user is not authenticated.
If above test is passed, I will use the user identifier to search in the db table if the user of the given identifier has any rows in the table (meaning that the user has opted to "stay logged in" on one or more browsers). If the user identifier is not found in the table, I delete the cookie of the client browser and the user is not authenticated.
If the above test is passed, I'll now use both the user identifier and series number to check for a matching row in the db table. If found, I verify the cleartext token from the cookie with the hashed token from the corresponding matching row. If not found or the token is not verified, I assume that either a cookie theft has occurred OR the cookie value has been manipulated. I invalidate / delete ALL the authentication persistence data of this user so that it won't "stay logged in" anymore on ANY browser it opted for, and is not authenticated.
If the cookie has passed the above test, it means that the cookie and its data was valid and the user is considered authenticated. I regenerate the session identifier and put the user in the session. I generate a new token, hash and update it in the corresponding table row and issue the user browser a new cookie auth with the same user identifier, series number and expiration date but with the new token (cleartext version).

This all is processed per browser on each request. For every browser the process is  identical. A user can opt to "stay logged in" on multiple browsers it wants to and will also have the option to invalidate all the persisted logins of their account.

To finish it off, I have a script that checks the db table every N minutes for rows older then 90 days and deletes them to keep the table clean and invalidate users persistent logins after the expiration time.

Some things to consider:

make sure you set the domain/path of the cookie so that only your domain (and no sub-domains can read it)
You seem to be using HTTP rather than HTTPS. This makes your cookie subject to eavesdropping. Consider using a HTTPS session and a cookie using the secure attribute.
90 days is a long time to hold such a session open. The longer the validity period of the cookie the greater the risk of theft.
By leaving the user effectively logged in you are exposing them to a Cross-Site Request Forgery

This thread from Stack Exchange might also be useful


Is AES-GCM recommended for SSL? I'm looking at turning on site-wide SSL for a website I manage, and I'm wondering what the best practices for SSL configuration. I'm not too worried about compatibility with old browsers and more obscure mobile devices, so I'd like to cut down the supported cipher suite list.

The main issues I'm trying to avoid are CRIME and BEAST. The first one is easily mitigated by disabling compression, but the second one isn't quite as clear to me. The way I understand it, BEAST is an attack against CBC mode rather than a particular cipher, but it's generally been targeted against AES. As such, would AES-GCM be a good choice of cipher to use for SSL?

GCM is recommended; it is even approved by NIST. However, AEAD ciphers are supported in TLS only since TLS 1.2; see section 6.2.3.3, which is new, when compared to TLS 1.1. The actual GCM-able cipher suites are defined in RFC 5288. Note that TLS 1.2 (and, for that matter, TLS 1.1 too) is immune to BEAST-like attacks when using CBC.

Therefore you will have a hard time finding a Web browser which supports GCM right now (I write these lines in January 2013; hopefully, TLS 1.2+GCM support will become widespread at some point in time). It is still fine to enable it, and if the client supports it, so much the better; GCM will be most lightweight on recent x86 processors with the AES-NI opcodes (these opcodes have been designed specially for GCM, in particular PCLMULQDQ which implements multiplications in GF(2)[X]). Not that the CPU cost of traditional TLS cipher suites is that high, but it is intellectually pleasing to know that each server core could support 5 Gbit/s bandwidth.

But if you want existing browsers to actually, say, browse your server, then you will need to allow for more "primitive" cipher suites as well, if only as a fallback.


How can i read the source code of this encoded powershell script from the registry? I get this line by ProcessExplorer

  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile
  -windowstyle hidden -executionpolicy bypass iex ([Text.Encoding]::ASCII.GetString([Convert]::FromBase64String((gp
  'HKCU:\Software\Classes\ZXWNMNLIMAGAL').LOOTDA)));

Now i'm sure that can be an encoded virus when i read this from the registry :

  Google Update    REG_SZ
  "C:\Users\michael\AppData\Local\Google\Update\GoogleUpdate.exe" /c
      {BE9473EA-5660-4BF7-91C3-2A2258213EE1}    REG_SZ    C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noprofile
  -windowstyle hidden -executionpolicy bypass iex ([Text.Encoding]::ASCII.GetString([Convert]::FromBase64String((gp
  'HKCU:\Software\Classes\ZXWNMNLIMAGAL').LOOTDA)));

So, i exported the data value LOOTDA from the registry and i copy it as text file and i upload
it here

So, i'm looking for any expert in encryption and decryption to decode and decrypt this kind of virus in order to read its source code and what it could be a harmful for us !

Thank you !

This malware tries to avoid using files and processes by having the payload reside in the registry and using the PowerSploit methods to load code directly into memory via PowerShell commands. The Invoke-ReflectivePEInjection gives it away. It belongs to the Terkop malware family.


forwarding company email to a contractor's email address We use contractors from out of state and from other countries.
An Active Directory account is created, which creates an Exchange email account. We forward email from the Exchange email address to a contractor's email address.
The company email accounts contain proprietary information and we are forwarding company data to a non-company account.

Can we block logging into our company network with the AD account?
Should we force contractors to use the company email address?

How do other companies handle data sharing with contractors? I'm looking for standard operating procedure or process guidance. Thank you.

Not certain about blocking login but I think you can - I'm fairly sure there is a setting in AD that blocks login but whether that has other impacts, I don't know.

In regard to data sharing...

You should, at a minimum, have a data sharing contract between you and the contractor so that you can legally hold them to account.

If you need to keep tighter control on the information, you should restrict them to using your own mail system. Remember that, once the data leaves your email system, you have little control over the channels it goes over nor control over whether those channels are secure.

Ultimately, this will come down to a balance between cost, convenience and security and you need to understand both the risks and the impacts before you can make a sensible decision. If you work in a regulated industry or are a high-risk organisation then the risks and impacts are much higher and you should almost certainly be using only your internal system and be restricting to controlled devices. At the other end of the scale, you may see little impact at losing data occasionally or little risk that someone might be interested enough to try intercepting data and in that case, you wouldn't bother.


How secure is my private key in the Windows Digital Certificate store? Many files we download don't have digital signatures. Files may get infected or someone may intentionally modify them on our hard disk.

So I wrote a simple file hashing program in c# that creates a SHA-256 hash of each file & stores it in a signed XML document. The private key is taken from the Windows certificate store with a High security level. (That is, each time I use the private key it asks me for the password.) I also created a Property sheet for folders & icon overlays (basically shows a check image on a file's icon if hash is ok) so that I can see at a glance which files are ok. This program also backs up the list of hashes on Google Drive and automatically syncs our hash database. I also added Authenticode to my program files.

So I have some questions in mind:

Is it possible for malware or any kind of exploit which is running with admin privileges to dump the private key without the password? (The keys are in User Store with High security.)
Is it possible to exploit my program so that even if a file is modified it will show it as still matching the stored hash? (I am on Windows 8 x64 with DEP & ASLR on.)
The program's executable checks its own digital signature & other DLLs it loads. So if it is invalid it exists. Is this ok?
If the program is not secure how can I improve it to be secure?

Primarily, I want to make sure that files I use are not tampered with even if my computer is compromised. ( I know Open PGP but I just want to store file hash & other attributes like file length in bytes, which user created each signature, date/time in cleartext in signed XML so that my friends can also check hash with other software, etc.)

Basic rules:

Code with "admin privileges" can do everything it wishes with your machine. You cannot protect against it. At best, the malicious code will have to wait for the next time you type your password, at which point it will plunder your private key (and all your secrets).
The same "admin exploit" will modify your icon overlays so as to hide any modification it wishes to perform.
It is useless for a program to verify its own signature. A malicious executable put in place of yours will claim that everything is fine regardless of signature invalidity.

There is some effort put by Windows into more protection for private key storage; this is called DPAPI. It amounts to about nothing against active attackers with Administrator privileges. DPAPI will add some resistance to attackers in another context: laptop thieves. When your laptop is stolen, you don't have it anymore, so you will not type your password again. Since secrets in DPAPI are ultimately encrypted with a key derived from your password, the attacker will have to crack your password, which can take some time (depending on how well you choose it).

To avoid tampering with your files, there are several strategies:

Boot your machine off read-only media (e.g. a DVD, or an USB key which has an external "read-only" switch).
Apply all published security fixes for your OS (this, of course, is at odds with read-only media).
Don't run software of dubious provenance. Ideally, don't browse the Web at large except a few select sites from your machine. If you must access the Web, apply isolation: run a virtual machine with the browser in it, isolating it from the rest of the system. That way, if the attackers enter your system through careless browsing, the attacker will take control of the VM, not of your main system. The Qubes OS is an operating system which uses this principle (albeit with Linux, not with Windows).


How can I use a unique salt for each user I know there are various questions that seem similar, for instance, this one. However, it does not answer my question.
I'm creating a signup/login system (with node.js to be particular), and I'm trying to hash the user's password (with bcrypt), as well as use aes-256 for the rest of the user information. I've been told that I should use a different salt for each user.
My problem is when a user creates an account, his password is hashed with a special salt and stored inside a database along with other user information. When the user logs in, I hash this password with the salt I assigned it when he signed up. However, how do I know which salt to use out of all the salts in my database?
There's also this option out there (comparing a plain text to a hash):
bcrypt.compare(myPlaintextPassword, hash, function(err, result) {
    // result == true
});

But how do I know which hash (of all the other hashes in the database) to compare to the user input? Also, if bcrypt could check if it matches without a salt, couldn't anyone do that?
I believe there must be a better implementation of this... is there?

But how do I know which hash (of all the other hashes in the database) to compare to the user input?

Each user has a row in your database with entries for columns: (1) username; (2) bcrypt output.

Also, if bcrypt could check if it matches without a salt, couldn't anyone do that?

bcrypt can not check without the salt.

However, how do I know which salt to use out of all the salts in my database?

The brcypt output looks like this:
$2b$[cost]$[22 character salt][31 character hash]

So, the bcrypt salt and the bcrypt hash are both stored in the bcrypt output entry that is in your database (and associated with a given username by row).


How is data Encrypted and Decrypted from a database with PHP Sodium I'm a PHP web developer who has been trying to learn and understand how to encrypt and secure the data stored on a database with PHP Sodium.

In terms of security knowledge I am very new to the area besides applying basic password_hash / password_verify with bycrypt for passwords and use PDO actively when handling data, otherwise I have little to no understanding of how to encrypt / decrypt e.g. messages, files or other sensitive information.

What I'm trying to understand

How to encrypt and store data with PHP Sodium to a database. "do unique keys need to be stored with each piece of data or each row of data?"
What should and shouldn't be encrypted. "only sensitive data? or all data?"
How to search for encrypted database data "by user search or by website/application request".
How to Decrypt data stored on a database with PHP sodium.

Example

If an article named "StackExchange" is encrypted and then stored in the database as e.g. "TO+/ve+/vUTvv73v...".

How is it possible to search/load that encrypted information and return it in a plainText format either by viewing a public page or accessing it with an authorized user account?

Objectives

To learn the basics / find out where to look for resources "in relation to the above"
Understanding how PHP Sodium works with encryption & decryption for databases "mainly using mysql / postgresql"
Decrypting encrypted data were appropriate.

If you have information that is encrypted, you can not search inside of it without decrypting it first.

If the information that you're using to search for something is not sensitive, such as a user ID, message ID, or otherwise only tangentially related to your sensitive information, then use that information as an index for your encrypted data.  A popular choice is an auto-incrementing primary key.

If the information that you're using for the basis of your search is sensitive, then your index should be implemented through a cryptographic hash function.  Keep in mind that, while hash collisions are rare, the fact that unrelated plaintexts will have hashes that collide is an important feature of cryptographic hash functions.  After you've found candidate row, you need to verify it.

You're definitely not going to be able to do any full-text searches of the encrypted data without decrypting every row.  Construct your indexes wisely.


Server based pdf signing using etoken from a client browser I have a requirement where a PDF document is generated on the application server in a web based .Net application and the same is digitally signed and mailed to the recepient. The signing and mail action will happen on user's action in the web application (on his browser on the desktop). The users signing digital signature will be in a USB etoken attached to his local desktop.

Is this feasible and how can we do the same?

If the signature is supposed to assert document ownership or acceptance by the user, then the power to sign should remain in the hands of the user (precisely where his "USB etoken" resides). Since signature algorithms begin by a hash function invocation (the message to sign is hashed, and the rest of the algorithm uses the hash value as input), at least the hash of the PDF file should be sent to the user's machine.

Javascript in Web browsers does not have (yet) the ability to access hardware devices on the user's side. You won't be able to do such a thing without some kind of user-side native or pseudo-native code; this means ActiveX, Silverlight (subject to user's authorization), a (signed) Java applet, or some non-Web executable that the user runs on his machine. None of these technologies is really easy to deploy. None of these will work with tablets / smartphones (for these, a full-blown app will be needed).

Anyway, if you want the user to sign, then you want to potentially make the user accountable for whatever he signs. This is a partly legal issue, for which technology is only part of the solution. You will need a signature solution that would potentially "hold in court", which depends a lot on the local jurisdiction.


How much data should I store on a user's computer about their login info? I'm currently saving a user's "login" information (not their raw password, of course!). Every device/browser gets its own secure ID from the server, all well and good.

However, should I verify more info about the user's previous sessions, too? For example, keep track of the city or something that a user logs in from (if it is not a mobile device login, save that on the server too)

I know user-agents can be easily spoofed, but it seems that if an attacker happens to get a hold of the user's device-specific ID there would be some serious issues.

Any insight would be greatly appreciated!

You should only store a single login token on the user's computer. Nothing more. That token should be created after verifying the user's credentials through a secure login process. The token should expire at some point. On the back end, that token should be associated with all of the user's info. It's generally acceptable to use the user's email address as their login. You should verify the user's email before granting them access to your system.

Also, you can keep track of the IP address or Cities that the user logs in from. That's your perogative. Keep in mind that some users consider tracking their IP to be a violation of their privacy. However, lots of sites track IP now anyway, so it's not as big a deal anymore.

Some systems, like Google, track IP addresses and user-agents. But I would suggest starting with keeping track of the bare minimum, and grow as your needs grow.


What datastructure would/have you used to store ACLs within a hybrid ACL/RBAC system? In our system, every resource has an access control list (ACLs), which list entries (ACEs) that have a specific kind of access to that resource. The ACE can be for end-entities (eg: users like "Mr Q") or group entities (eg: "North Atlantic"); the inclusion of the group entities makes this a hybrid ACL/RBAC system.

ACL data

Resource #1 => ACL
ACL => ACE#1 Entity(Type:User, ID:006), Rights(~Read, ~Write)) /* Deny */
       ACE#2 Entity(Type:User, ID:007), Rights(Read, Write))
       ACE#3 Entity(Type:User, ID:101), Rights(Write))
       ACE#4 Entity(Type:Group, ID:A01), Rights(Read, Write))
       ACE#5 Entity(Type:Group, ID:B04), Rights(Read, Write))

Anything that doesn't appear on the ACL will be denied and DENY's overrule anything else.

System info

There is a central online server that mediates access to said resources . Writes to the ACL will be rare, mostly it'll be reads (perhaps at 1:50 ratio or more).

Question

What is a suitable data structure to store the above ACL? Storing the entire ACL as a single JSON string in a NoSQL store seems simple but then we can also normalize the ACL data and store it in SQL tables. If someone has operational experience on the pros/cons on either approaches, would like to hear from them. We're also wondering if it's worth exploring storing this in LDAP but wanted to stay away from X.500/DER and other telecomm sourced technologies ... maybe there are modern LDAP options (rooted in CS world) to explore beyond NoSQL/SQL?

The best way to structure an ACL is as a bitmask which makes it easy to quickly determine complex access rights for a resource.

The best way to store that might be a key-value store such as Redis or any object-caching technology that integrates well with your environment. The decision to go with NoSQL vs SQL would be more of a business or IT decision rather than technical because a simple lookup could be just as fast either way.

Of course LDAP would also be an excellent way to go but doesn't make much sense unless you are integrating permissions with some other system.


Generating backup codes for a 2FA implementation I have implemented the login/verification aspect of a two factor auth system as per RFC 6238.

It works fine with Google Authenticator, which is great.

Now I am turning my attention to the backup codes, that are provided by services implementing 2FA such as Google and GitHub.

I notice they are of a different length and/or format to the usual 6 digit direct authentication code.

So, do I:

Generate an arbitrary number of codes when a user sets up 2FA
Store them in the DB alongside the user
Make use of the fact they are a different length or format in order to decide how to check them?

Are they supposed to be random, or generated based on some hash of the user?

Usually the backup codes are opaque random credentials, not mathematically based on the 2FA seed or anything else known about the user, and generated with sufficient length and entropy as to avoid dictionary attacks.

Treat them like single use passwords- hash them before storage so you don't have the originals; discard after one use in authentication; limit the number of and rate of authentication attempts; and allow authenticated users to generate a new set, which invalidates the previous set.


How to exploit LDAP injection? BurpSuite marked a website I am testing with having a potential LDAP injection vulnerability. It seems that when I put an asterisk in a parameter ex. getStuff?id=* I get a 500 error and Java error output. When I set it to something normal like 123 I get a 200 response (the page is just blank however). I'm not sure how I can further exploit this, maybe someone knows?

I'm not sure how I can further exploit this, maybe someone knows?

There is need of enumeration here to know what kind of protection is in place and if there is any known way to bypass it?. Try supplying clean ldap queries and looking for change at response's characteristics or values then try for other techniques like blind ldap queries and other known techniques. You may also receive help by reading burp suite's description over the vulnerability and follow their blog to see what techniques they have mentioned and follow the methodology to conclude if the techniques work in your favor. Hope this helps.


EIP pointer is overwritten but EBP remains intact I was trying out a simple stack buffer overflow exploit by creating a malicious crash.m3u file.

as you can see the EIP pointer is overwritten by "A" but EBP hasn't changed.
isn't EBP supposed to get overwritten before EIP??

Well, registers are not values in the memory waiting to be overwritten by your buffer!

In the context of a buffer overflow, you do not simply keep writing until you reach some EIP register "location": instead, you replace values on the stack and one of them may end up being the return address of your function. After you've overwritten the stack, the execution resumes as if nothing had happened. The instructions are carried on, and depending on what they are, EBP may or may not be modified.

Finally, provided no exception has occurred in between, you reach the ret of the function. That's when the return value is read from the stack and moved to EIP.

So in your case, if the ret instruction is never reached, there are still some ways to get command execution. The most likely candidate here is through SEH manipulation.

Have fun!


Physical computer security, how to disable USB ports when the computer is 'locked'? Lets say my PC & server is in an environment where a theoretical attacker has physical access to the machine while I'm not there. Now the data is encrypted on the hard drive with TrueCrypt. However if I'm not there I usually don't bother dismounting the encrypted containers as it's time consuming to enter the long password to remount them each time. So the data is readable if you have access to the machine and know the password to log in. Now I assume the data must also be readable if I'm not logged in either as they could plug a device into one of the USB ports and copy the unencrypted data on the hard drive partitions that are mounted.

My plan is to stop a casual attacker, e.g. flatmate, colleague etc plugging in and copying data from the hard drive. Obviously it's less likely they're going to open up the case and hot plug in something into the PCI bus to do it. Also it's unlikely they will walk off with the PC to do a thorough job of it.

How do I disable unused USB ports etc when the computer is in 'locked' mode so that they can't just plug in and copy data from the hard drive? Any other precautions that I could take?

Methods and or suggestions for Windows 7 and Linux would be great. Thanks!

The standard approach is to fill the USB ports with epoxy resin. Of course, this must be combined with similar approaches to seal the case, so the attacker can't get in via the PCI bus, etc.
Note that even if you do this, law 3 still applies: if a bad guy has unrestricted physical access to your computer, it's not your computer anymore.
EDIT: reflecting update to question:
In the specific scenario you outline, then to block it, just turn off auto-run. It should already be off in Windows if you've got it patched properly; in Linux how to turn it off (or even if it's on) depends on Distro, Desktop Environment, etc.
However, please do note that the specific scenario you outline does not make sense. If the attacker is serious enough to build a custom USB stick to do this, then they are not going to be so casual that they give up when it doesn't work, and will try something else. Boot from a LiveCD, copy your TrueCrypt volumes, install a keylogger, and wait to get the password in the mail, for example. Law 3: it's their computer now.
Actually an attacker serious enough to build such a stick probably isn't going to bother because they'll not expect auto-run to still be on.


Reject IP packets with an ICMP error, or just drop them? Consider an internet-facing host (the outer firewall). What should be done with undesired traffic: just drop it, or send back an ICMP error such as port unreachable? (In Linux terms: iptables -P DROP or iptables -j REJECT?)

This isn't about the security of our network, the packets aren't getting in either way. It's about being a good citizen. REJECT could make our firewall participate in a DDoS, if the incoming packets have a spoofed origin. But is it always the right choice? Are there circumstances where it's better to send back a proper ICMP error?

I usually vote for sending back an ICMP error for UDP and a RST packet for TCP. It does make debugging issues so much easier. And it prevents annoying timeouts: Mail and IRC servers often attempt to do an ident query or check that the client is not an open proxy.

If it is done at the out-most firewall there will be no relevant information disclosed. Depending on the setup it may even conceal that there is a firewall. If there were no answer, it would be obvious that there is a black hole.

It's important that servers send no answer for packets sent to a broadcast address in order to prevent an amplifying effect in a DoS situation. It's okay for the firewall to send the error message in this situation, resulting in only one answer.

ICMP-errors and TCP-RST packets are not larger than the smallest original packet. So these are not interesting for DDoS attacks.

Edit: DNS authoritative servers (and missconfigured DNS resolvers) are a lot more interesting for reflective DDoS attacks because the DNS answers are larger than the queries and therefore grant the attacker an amplification free of charge.


Does the "Key Encipherment" key usage make sense when using ECDH P384? I configured a Windows CA and created a certificate template to issue certificates with ECDH_P384 keys:

Then I noticed that it's not possible to set the "Key Encipherment" key usage in the "Extensions" tab:

What is the reason behind this limitation?
Is it correct to say that the "Key Encipherment" key usage makes no sense when using ECDH since it's already a key agreement protocol?

The relevant spec is section 3 of RFC 5480 ("Elliptic Curve Cryptography Subject Public Key Information") which extends RFC 5280 ("Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile").

A key used for ECDSA is used for digitalSignature.

If the key is used for signing things other than certificates and CRLs (and TLS handshakes) then use nonRepudiation, if the key is controlled by hardware device and certificate was issued in a way you can't later claim "it wasn't me". It can have specific legal meaning in some jurisdictions.

A key can be used for keyAgreement (ECDH), but modern TLS uses ephemeral DH to provide forward secrecy, so the key for the certificate is not itself used for ECDH.

It is generally not used for ECIES (encryption), though technically you can do that. It is a best practice to not use the same key for both signatures and encryption, though I am not aware of any vulnerabilities if you do. But generally, if you encrypt backups using a public key, use another key.

Look at the google.com and cloudflare.com ECC certs. They use bare digitalSignature bit in keyUsage. A CA ECC cert uses Digital Signature, Certificate Sign, CRL Sign.


Using MySQL 'encrypt' / crypt() to store passwords? I've been tasked with deploying a FTP instance with a MySQL backend for storing user logins.

Looking online I found Pure-FTPD, which on paper is great. However documentation states it only allows these hashing / encryption options for passwords:

#MYSQLCrypt md5, cleartext, crypt() or password()

MD5 and cleartext fall outside the requirements, password() should apparently be avoided (according to MySQL documentation) which leaves crypt().

Usage of crypt() to insert a value into a database relies on 'encrypt', which in turn is a crypt() system call.
See: https://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html#function_encrypt

So come's the question, how secure is this encryption method to actually store sensitive data, wikipedia states that crypt() -

  "Rather than encrypting the password with a key, which would have
  allowed the password to be recovered from the encrypted value and the
  key, it used the password itself as a key, and the password database
  contained the result of encrypting the password with this key."

Which seems great, however I can't seem to find any info on this 'password' database it speaks of, the inserted value also are stripped down to a max of 16 bits if I recall correctly, which really doesn't seem secure.

Any input on this would be appreciated, thanks!

If you read the documentation: SHA1, MD5 and MySQL password() are only supported for legacy reason and scrypt or crypt(3) are advised. However, that would not really answer your question, so let me emphasize which one I would choose.

crypt(3) This is Unix's password hashing (some call it encryption) function. This is a modified DES cipher that uses a 12-bit salt based on the system clock, for per-user diversification. The really downside of this function is that it takes only eight ASCII characters (equals 56 bit) as the key. That key is then used to encrypt a 64-bit string of 0 and the modified DES cipher. The output is again encrypted with the key and this procedure is repeated 25 times. The repetition was chosen to slow down dictionary attacks. However, cracking crypt(3) password hashes is not really a big deal and greatly depends on the password strength of your users. Bear in mind, this solution dates back to the 1970s and all modern Unix/Linux systems use modern hash algorithms, such as SHA-256 or SHA-512.

scrypt This method was developed by Colin Percival who identified that password hashing was predominately CPU-hard, but not memory-hard. The problem when a password hashing algorithm is only CPU-hard is, that the more CPUs are present, the quicker you can brute-force it. The limiting factor is memory and CPU power. Therefore scrypt consists of a series of functions that extend the CPU-hard approach by a memory-hard approach.

Conclusion If you have the option to choose for either password protection method, I would go for scrypt rather than crypt(3). The reason being that crypt(3) is actually deprecated already and scrypt offers more protection against brute-force attacks. However, it also depends on the number of users your solution should serve. Naturally, a CPU-,Memory-hard function will not only use more resources during brute-forcing, but also during normal authentication compared to functions which do not offer this.


What "hacking" competitions/challenges exist? I have always enjoyed trying to gain access to things I'm not really supposed to play around with. I found Hack This Site a long time ago and I learned a lot from it. The issue I have with HTS is that they haven't updated their content in a very long time and the challenges are very similar. I'm no longer 13 and I want bigger and more complex challenges.

I was thinking about challenges like Cyber Security Challenge and US Cyber Challenge (@sjp wrote about these on the meta)

Also, are there any big social engineering competitions besides the one at Def Con?

Current list:

Wargames:

Over The Wire They have lots of small hacking challenges like: analyze the code, simple TCP communication application, crypto cracking.
We Chall We Chall is similar to Over The Wire. Lots of challenges. They also have a large list of other sites with similar challenges.
Smash The Stack
spider.io

Downloads:

Damn Vulnerable Web Application
Google Jarlsberg
exploit Exercises

Competitions:

DC3 Is the DOD:s Forensic Challenge. It's an annual competition with different scenarios that you gain points for solving.
NetWars Offers tournaments at some conferences. And one longer challenge over 4 months. With scenario challenges.
Cyber Security Challenge Needs description
US Cyber Challenge Needs description
Codegate Quals

CRT:

iCTF iCTF is a capture the flag contest held once a year.
PlaidCTF
Hack.lu CTF 2012
Defcon Quals
RuCTFe

Other list like this one:

http://captf.com/practice-ctf/
http://www.stumbleupon.com/su/1YNSxi/www.brighthub.com/internet/security-privacy/articles/77093.aspx/
http://www.wechall.net/challs

Other interesting sites:

http://captf.com/, calendar
http://facebook.com/hackercup

Please help me add more to the list.

I don't know a good reference to point to for further reading. Thus I will try to list a few time-wasters that I personally enjoy.
In the following I will allow myself to differentiate between various styles of hacking competitions. I don't know if this is a canonical approach, but it will probably help explaining the differences between the ones I know:
Wargames
These games take place on given server, where you start with an ssh login and try to exploit setuid-binaries to gain higher permissions. These games are usually available 24/7 and you can join whenever you want.

Over The Wire
Smash The Stack
Intruded

Challenge based competitions
These games will present you numerous tasks that you can solve separately. The challenges mostly vary from exploitation, CrackMes, crypto, forensic, web security and more. These games are usually limited to a few days and the team with the most tasks solved is announced the winner.
I will list my favorite, since I am quite convinced that you will easily find more of them. Some of the listed have just taken place and others will take place in the following months.

Defcon Quals
Codegate Quals
CSAW CTF (usually during summer)
Hack.lu CTF 2011 (end of September this year) and Hack.lu CTF 2010
PlaidCTF

Capture The Flag
These actually require you to capture and protect "flags". The best known is probably iCTF, which underwent some rule changes within the last years. This game is also limited to a certain time frame. Contestants are typically equipped with a Virtual Machine that they are to connect to a VPN. Your task is to analyze the presented machine, find security bugs, patch them and exploit the bugs on other machines in your VPN. The "flags" are stored and retrieved by a central game-server that checks a team's availability and whether previously stored flags have not been stolen.

iCTF (typically in December)
CIPHER CTF (will be renewed by new organizers this year)
RuCTF and RuCTFe (a Russian CTF and its international version)

Other
There are also a bunch of downloadable virtual machines available to play offline, which is some kind of mix between 3) and 2) I suppose.

Damn Vulnerable Web Application
Damn Vulnerable Linux
Google Jarlsberg

Edit:
Tag
I have just come across a fifth game-type that I have not seen anywhere else. All teams compete with each other during several rounds and each round is a match between two teams. Phase 1: Both teams get root on a Linux System and try to hide as many back-doors within 15 minutes as possible. After these 15 minutes, the teams swap PCs and try to discover and remove as many back-doors as possible (also with root access). In the third phase, each team gets its server back (without root access) and is supposed to exploit as many back-doors to gain root access again.  Remotely exploitable back-doors get bonus points :)
It appears that games like this has been carried out during the LinuxTag Linux Conventions in Germany in the last years.
The scenario is explained more detailed here (German only!)
/Edit
I hope this post has not become too confusing due to its length ;)
Unordered list of lists of Hacking competitions:

http://capture.thefl.ag/practice-ctf/, Calendar
http://www.wechall.net/sites.php
http://exploit-exercises.com/
http://www.stumbleupon.com/su/1YNSxi/www.brighthub.com/internet/security-privacy/articles/77093.aspx/


Attacks on server-side web What types of attacks are specific for server-side web, but not client-side?
From what I have found on the Web the most attacks focus on client-side rather than server-side.

Just looking at the OWASP Top 10, most issues are server-side:

A1 Injection: SQL Injection, Command Injection, etc.
A2 Broken Authentication
A3 Sensitive Data Exposure
A4 XXE
A5 Broken Access Control (OWASP places eg directory traversal here, as well as IDOR, privilege escalation, etc)
A6 Security Misconfiguration (mostly server-side)
A8 Insecure Deserialization
A9 Using Components with Known Vulnerabilities (mostly server-side)
A10 Insufficient Logging & Monitoring

They also list some server-side issues under "Additional risks to consider" such as unrestricted file upload, application-level DOS, or SSRF.

The only issue that could be classified as client-site is:

A7 XSS

OWASP doesn't list a lot of client-site issues though. Some, such as CSRF, Open Redirect, or Clickjacking are listed under additional risks. OWASP also places some issues that are exploited client-side in the above categories (eg CORS issues under broken access control).

Note also that while XSS is often considered a client-side issue, classification isn't that easy, as the vulnerability itself is mostly introduced server-side.


How to verify if a source code is safe before compiling it? Sometimes Linux users need to to download a source code to be compiled then executed (the root privileges is granted).

Is it possible for a source code to hide malicious code as a part of it? And how does one verify that the source code is safe before compiling?

Short of reading and understanding every line of code and how it all fits together you realistically can't.  The best you can really do it to download it as a package from a reputable source who vet the packages in advance, to minimise the risk to the user.

However there are times when even full blown operating systems are are hacked (such as Mint Linux earlier this year) so you can't really be sure what you're getting is safe.

As with most things I've found when thinking about security, a lot of it comes down to balancing trust and common sense.


using rel="noreferer" without rel="noopener" or without target="_blank" I have been reading about the security and performance implications of rel="noopener" and rel="noreferrer" in links with target="_blank". These are some of the observations:

if you open a link in a new tab from your app, by default it would have access to window.opener and would be able to change the url for it (reverse tabnabbing)
the new tab would share the resources of your page by default, which means if it is resource intensive it might make your page slow.

these things can be fixed by adding rel="noopener"

On top of this, there is another security concern, when the link is opened in a new tab, the referrer information is sent in the referer header and some sensitive data may be exposed in the url to the target site.

This can be fixed by adding rel="noreferer" (or restricting your CSP for referrer info)
Though I understand this, I have some questions which i am seeking clarifications for:

It seems that adding rel="noreferrer" alone should be enough as by default it enables all the things that rel="noopener" enables, while also adding referer security on top of it. If that is true, why do all the examples in the wild specify rel="noopener noreferrer" and not just rel="noreferrer"
I understand that rel="noopener" is only applicable when the link is opened in a new tab, but as much as I understand, the same shouldn't be true for rel="noreferrer". I haven't seen any examples where rel="noreferrer" is specified without target="_blank" . Wouldn't links that open in the same tab also leak the referrer information?

After a search on the internet, it looks like "noopener" is really not needed, if you already have "noreferrer". However, I believe it is usually still included for clarity (so the intended behavior is stated clearly), and because most developers feel it is "safer" to include it to avoid possible compatibility issues in some browsers (maybe "noreferrer" in some browsers doesn't imply "noopener"? Apparently not, but most developers aren't sure.)
Look at this question in StackOverflow, to see how confused developers can be about this issue: why people use rel noopener instead of just rel noreferrer.
Then also take a look at this discussion, to see some more confusion, and finally a guy who ended up running lots of automated tests in lots of browsers, to find out the truth (that is, there are no browsers that require both keywords): discussion on Github, answer with tests.
As for "noreferrer" to avoid leaking referrers, that's exactly what is does. I don't know how much it's used in practice. What I know though, is that there are better ways to control referrers with specific HTTP headers or HTML meta tags.


Single or double quotes in PHP? In general which is safer to use, with regards to XSS evasion in particular?

echo '<input name="'.$input_name.'">';
echo "<input name='$input_name'>";

I'm guessing single quotes, but wondering why & hoping to find recommended reading.

It doesn't make a difference if used correctly.

The first version is standard though. Single quotes are less often used around HTML attribute values, so you need to be a bit more careful when using various functions meant to protect against XSS, as they may not necessarily take this case into consideration.

htmlspecialchars for example does not encode ' by default, you need to specifically set ENT_QUOTES. Any custom function your project or framework may use may have the same problem.


802.11 data frames missing from Wireless frames capturing By working on the Wireless QoS (WMM/802.11e), I captured with airmon-ng and airodump-ng on Kali Linux, the 802.11 raw wireless frames, on my BSSID and channel.

I generate some traffic from my Wireless client connected to the access point sniffed, but only few frames appear, and very few 802.11 Data frames, which should transport the data from the generated traffic.
Are there any reasons to didn't get all the wireless frames ?

Config: Start the monitoring: airmon-ng start wlan1, WLAN discovering with airodump-ng wlan1mon, selection of the WLAN with specific BSSID airodump-ng -c 11 --bssid 00:01:02:03:04:05 -w dump wlan1mon, then traffic generation from my endpoint

Since you specify that you are getting some data frames (indicating you are indeed in monitor mode), the most likely issue is that the capabilities of the wireless device generating data exceeds the capabilities of the wireless device capturing data.

For example, if the data client is 802.11ac and the capture device is 802.11n, the capture will only include frames that the 802.11n chipset recognizes. Or the data client could be 3x3:3 chipset while the capture devices is a 3x3:2 or a 2x2:2.

In this type of situation, your capture device will only be able to "see" frames that are transmitted within it's capabilities to understand.

On the other hand you are able to capture the management frames because those typically are sent at the lowest base/required data rate configured for the SSID (which must be supported by all associated clients and is typically uses a single spatial stream and lower data rates).


Is there any reason to disable copy/paste in a website? I'm asking nearly the same question, but today is related to my bank website, they disabled several functions, including: right click, copying, pasting.
Is there any real security implication about allowing doing this? Today I was registering an account to do a transfer, and had to type manually the number. Very annoying, to be honest.
I think that they are just exaggerating, I can't see anything wrong about copying my balance or pasting an account number.
Important: They use an on screen keyboard for typing passwords, so copying and pasting passwords is not a reason to do this.
This is not the same that related question: Is there any reason to disable paste password on login?

Is there any real security implication about allowing doing this?

No.

Lets look at each of these things:

disabling right click

There is no security benefit to this at all, as there is no dangerous action that is performed with a right click.

Some websites disable right click so that users can't copy or save images easily, but this can of course be easily bypassed.

It's very difficult to even come up with a contrived example of the dangers of right click. Some corner-case clickjacking attack may exist, but the defense against that would of course not be to disable right click, but to not allow clickjacking in general.

disabling copying

See above. There is no reason for this at all. Any contrived clickjacking attack should be mitigated by proper clickjacking defenses.

disabling pasting

This is the only functionality that some would argue provides a security benefit, as it disallows the pasting of passwords. They would be wrong.


What are the biggest security risks/considerations for hosting your own private website? I have a small personal website hosted through go-daddy. I also have an old machine sitting in my garage collecting dust. I know enough to make my old dumpy machine a Linux server for my tiny website and save a few bucks on hosting. But what are the biggest risks attached to hosting my own site? What should I know/do before I decide that's the direction I want to go?

Well if you are hosting from inside your own network then you have a little bit more work to do.  ( ps don't use windows , install Linux instead , not only will it be safer but in general all the typical things that you expect to use for hosting a website are designed for Linux , apart from iis windows support is always "hacked in" )

If hosting from a third party provider and assuming that you have no sensitive information stored then you are pretty much set. Just don't reuse passwords and there is nothing of value to worry about.

If hosting from your home network then you effectively have a internet visible IP address which is easy to find ( via your domain name ), so you have to worry about ensuring that everything on that server is completely locked down ( due to the fact that if the web server gets compromised then you have to deal with the possibility that you have a malicious machine on the inside of your home network which gives access to all your data, and the potential to even sniff or inject all network data if your network is appropriately mis configured.


How could I be sure that the network cable is safe to use? There are Cat 5 network cables in the office going from some rooms to some other rooms through the walls and the ceiling.

The office belonged to another company in the past, which means that there is no guarantee that nobody installed a tracking device in the walls, or that the cable doesn't go to a different office in the building, where it can be tampered with.

Is there anything which can be done using hardware or software on both sides of the cable to ensure that the cable was not tampered with (in other words, that this is indeed a single cable, and not two ones connected through a device such as a switch)? Or the actual, physical inspection is the only way?

To reduce the scope of the question, I'm talking about ordinary tampering by introducing a basic switch which can track what gets through it (and possibly redirect the traffic to another port for inspection, as most switches are able to do). Of course, this excludes military-grade devices which are specifically designed to not only trace the communication, but also resist any attempt to identify them.

I would try to use a cable analyzer for example the DSX-5000 from Fluke. This analyzer should be able to guarantee the continuity of each cable and its characteristics. That should be enough to detect the presence of an unwanted switch or any port mirroring device.

Maybe a simple continuity tester could be enough, but a more professional/expensive cable analyzer could give the cable length, propagation delay, and many other physical elements that could be changed even by a derivation on a line. The hard part would still be to correctly interpret the results, but any strong difference from the standard measures would be a hint that something weird could be there...


How Hathaway ISP shows renewal reminder in non secure website? I am using prepaid broadband plan of Hathaway (in India). Few more days are left for the plan to get expired and I observed the below screenshot.

This popup comes only when I visit any non-secure website (without https in their website's URL).

How do the ISP do this?

The official name for this process is called man in the middle. This is usually used by hackers trying to extract data but, as seen here can be used in non-harmful ways as well.

Basic Diagram:

(INTERNET)=>(ISP)=>(YOU)

Explanation: Since the ISP is in the middle of you and the internet it can inject extra data into network packets.

The reason it doesn't work for HTTPS: HTTPS is an SSL wrapper for HTTP so the ISP can't inject any HTML because the HTTPS packet is encrypted and to inject data into an SSL packet you would need to decrypt, inject and then re-encrypt the packet with the modified data enclosed.

PS: And yes, your isp can read ANY HTTP(plain text) traffic.


Does Mozilla's Firefox browser repeatedly connect to Google Analytics servers? While inspecting some logs, I noticed that Mozilla's Firefox web browser appears to repeatedly connect to servers for Google Analytics.

Can others confirm this issue?

Is there any way to turn this off from within Firefox?

(Obviously google-analytics.com can be completely blocked at many lower levels, including at the router or hardware/software firewalls.)

Given that Mozilla touts Firefox as a privacy-centric browser, repeatedly connecting to Google tracking servers seems to be a violation of their credo.  Yes, Google Analytics is supposed to be anonymous, but it still requires connecting directly to Google servers.  And Google is the mega-corporation that drove vehicles around our planet collecting everyone's WiFi transmissions, and then denied that they had any idea they were collecting all that data.

UPDATE

I tested this using a clean install of Firefox version 48.0.2 (current stable release) with no non-default add-ons (extensions, plugins, themes, services) installed, and with the When Firefox starts option set to Show a blank page.  By "no non-default add-ons", I am simply referring to the fact that, by default, Firefox installs a plugin for OpenH264.

Note that I see the traffic from Firefox to the google-analytics.com domain without browsing any web pages at all.  Just opening Firefox shows traffic to google-analytics.com in Process Monitor.

Mozilla Firefox does not make connections to Google on it's own. It could be:

One of the add-ons or plugins, but then you would have to look at the full URL string of such request. It's OK to disable all plugins and all add-ons which are not very popular or known to be  malware, or recently turned malware (some organizations are taking over old add-ons and load them with malware)
Website you are visiting can be simply making there requests

There was once "Tracking Protection" initiative in Firefox but today it seems broken. However you can try give it a shot, see here: Firefox Tracking Protection  (you need to enable privacy.trackingprotection.enabled)

Another alternative is to use Private Browsing. Private Browsing

Finally, there's 3rd party add-on uBlock Origin - with this you can be sure no more requests to Google Analytics while keeping the websites working. Of course 3rd party add-ons are not so very safe, and may become a malware in future, so deployment to many users is not recommended.


Phone Hacked. How serious is it? I was in an argument online with a guy and he sent me a fake youtube link. I clicked on it like an idiot and he asked me how my city is (he knows the name) and he knows my cable provider.
Does anyone know how serious this is and if I should be worried?

You aren't hacked.

Well, not by this link anyway.

I opened the link you provided on a cloud instance and proxied the connection through Burp Suite so I could track exactly what happened with the redirects.

Turns out it is a grabify.link link. Grabify offers url shortening and provides some level of detailed information about who follows the link. This includes IP address, user-agent header, hostname, and time the link was followed. This is all standard metadata that gets sent every time you send traffic anyway. At this point the person knows at least your IP address and the type of operating system/browser you are using (unless you modified your user-agent already, which many do for privacy reasons anyway). If you have open ports/ listening services on your router, there is a good chance they will try attacking these if they are malicious.

The bad news:
They have any info they can glean from your IP, hostname, and user-agent header. This includes your cable provider since your cable provider owns the netblock you are in.

The good news:
They can't do much with this alone. They can scare you by pretending to have hacked you, but by this link alone they haven't gained access to your network/phone.

What to do now:

If you have a dynamic IP from your ISP (most do), release and renew your DHCP lease. This will change your IP address, and they will no longer know how to find your router. Sometimes you can do this in your router, some ISPs you need to call them and say you want to release/renew your DHCP lease. You can verify this worked by googling 'what is my IP' before and after the release/renew.
Check what ports are open and what services are listening on the router.

This is easiest to do on a linux machine, but can also be done on
   Windows and Mac by getting the nmap tool. For reference, this is
   the command I use on linux to scan my own public IP address when I want to see
   what ports I have exposed:

dig +short myip.opendns.com @resolver1.opendns.com | xargs nmap -p0-

This gets your public IP address and scans all of it's ports. If this looks strange to you, I would google around for how to scan you public IP, or search other answers. This is not the most standard way of finding and scanning your public IP but is efficient on linux, especially when the first half of the command is aliased to whatismyip.

Bottom line:

You are probably safe.. for now.
If every one of your ports on the WAN side of your router is closed, you're fine. If you release/renew your DHCP lease through your ISP, you're extra fine. If you have ports open/ services listening on the WAN side, definitely get new DHCP lease, as the person can now sit back and try to find vulnerabilities in them, and possibly hack you from there. If you happen to be an unfortunate soul with a static public IP (unlikely), buckle down and figure out how to best secure your router, because this person knows its address now.