how one can find out sub-domains of a domain without brute-force? I had to edit my original question after several answers were submitted.
Original question was:
how one can find out sub-domains of a domain without brute-force? is there a way to request a domain hosting provider or a name server for sub-domains?
as far as I know one can only access a sub-domain if the name is known but if the sub-domain is not known then there is no other way to find it unless you do a brute-force, am I correct?

Edited:
The domain or sub-domains I am referring to do not have any robots.txt or TXT records or PTR
The they all are hosted with very good hosting provider like Godaddy and other such like providers.
So, there is no issue of insecure DNS!
Also, the sub-domains have not been shared with any one or used anywhere in internet, these were created only for a test, plus on top of it these sub-domains, the technician and the VPS that these subdomains were pointing too were in the same country.

My understanding was that if a sub-domain is known only with your hosting provider and you and it is not shared with any one there would be no way to find that sub-domain, except brut force.

Reason I am asking this question, I came across to this site “securitytrails.com” that had my sub-domains I was suppressed

For a test I have created a sub-domain “aonfactuurportz.[myDomain]”  and after some time it appeared in there.

regards

There are a bunch of tricks for subdomain discovery:

Brute force.
The CNAME and PTR DNS records may contain the name of a different subdomain.
The MX and SPF records contain information about mail servers, which may be subdomains.
Looking at zone transfer records (AXFR). These can contain subdomain names for the purposes of replication.
HTTPS certificates for the parent domain or other subdomains may be issued against multiple subdomains. The "Certificate Subject Alt Name" record is the most common place to find them; for example, you can look at Amazon UK's certificate and see "www.amazon.co.uk", "uedata.amazon.co.uk", and "amazon.co.uk" in the subject alt name record.
Certificate transparency records can be searched and may turn up subdomains or other associated domains.
If you know that a domain points to an IP address within a block of IPs that is owned by the company of interest, you can perform reverse DNS scanning of each IP in that block in order to try to discover new domains.
Use whois to identify the owner of the domain (unless they enabled WhoisGuard) and then use a reverse whois service to search for that person's email.
Google (or Bing, DDG, StartPage, etc.) for it! You'll often find they indexed a subdomain.

There's a tool called dnsrecon which might be useful in trying some of these tricks out in an automated fashion.


What is the proper flow for authentication? I'm tasked with migrating a group of .Net WebForms applications from a current custom username/password login scheme to an oauth2/openid connect based authentication and authorization.  This specific application is very mature and broad.  As a result, the goal is to change as little of the underlying infrastructure as possible.

Currently, users log in with a username and password combination.  Many people have more than one username/password combination.  We want to change this to an email/password combination instead.  I have an IdP set up to do authentication this way that can provide an id token.  I think this part is relatively straightforward.

The wrinkle comes from the multiple accounts that each user currently has.  Because of the nature of the applications, I need to support the multiple accounts, linked together through the email address.

Would it make sense to have a second IdP which can provide the list of accounts linked to the email address that can then provide a token based on the account chosen?  If so, what is the best way to provide the email address to this second IdP?

Thanks for any insight.

The way you described your problem indicates, that oauth is not what you are looking for. Oauth is used to allow your users to use their credentials from a different entity (identity provider) to log in to your application and to access user data from the idp.
The idp and the application that uses the idp are two different entities (e.g. two different companies). So for example: on honeypot.io i use my github username and password. Honeypot forwards me to the github idp. I log in and grant honeypot access to my user information (name email etc). The github idp forwards me to honeypot again with an access token und honeypot.io gets my user data along with the guarantee that i own that account. Honeypot will then create an account for me with my github data.

If there is only one party involved (your case) you dont need an idp and no oauth. Depwnsing on the concrete use cases you might just want to allow accounts to use multiple usernames, which would be a simple array / list.


Why to use username and password instead of just a long password? Why do most websites use the pair of username and password as we can just use a long password like a token to identify a user?

A simple example: On the server, we create a JSON file with user data inside of it (email, role etc.) and give it a random 32-characters name. Then if a user wants to log in, he just copy/paste his long password into one form input and submits the form. If submitted password matches with the name of JSON file on the server, the authorization is successful and the server identifies the user.

So why not and why username and password?

You've just described API keys and that concept is used everywhere.

You want a username and password pair for two practical reasons:

if users can create their own passwords, you risk people having the same password
if a user needs to change their password, doing so won't invalidate the identity of the user on the system if the password is also the user's identity


Are address bars unphishable? I've taken, out of curiosity, the Phishing Quiz by OpenDNS that tries to teach the general public about detecting phishing:

  Ever wonder how good you are at telling the difference between a legitimate website and one that's a phishing attempt? Take this quiz to find out.

I did it mostly because my phishing detection process basically looks like this:

Does the address bar look legit?

...and if it does I'll think the site is legit. That is most likely simplistic, but (spoiler alert!) you can get all 14 questions right just by looking at the address bar. "Yahoo!! is upgrading!!!" from "docs.google.com/spreadsheets"? Yeeeeah, that kind of barely smells like phishing.

Assuming the DNS server is not compromised, is the address bar really that bulletproof, though? If it isn't, how can I detect whether it's been tampered with or not?

The answer depends upon what kind of browser you are using, so I'll break it down.

Mobile browsers. You can't trust anything you see.  Sorry.  Life on a small screen sucks.  That's just the way it is.

(Did you want an explanation why?  Any web page can go full-screen, using mobile-specific tricks like scrolling the page down so that the address bar is not showing.  Then, it can draw a fake address bar.  As a user, there is no reasonable method you can use to detect this forgery by looking at the screen.  See also the research paper iPhish: Phishing Vulnerabilities on Consumer Electronics, where the authors implemented this attack and tried it out; they learned that users could not detect it, not even computer science graduate students with knowledge of security, not even when they had been warned in advance of phishing attacks.)

So basically, there is no reliable way to detect phishing attacks on mobile browsers by looking at the screen.  The only way to protect yourself is to go straight to the site yourself (e.g., by clicking on a bookmark) before entering your credentials: never get there via a link.

Older desktop browsers. On older browsers, like IE6 or Firefox 2, I don't know whether there is anything you can trust.  They are so riddled with security holes that I would not count on them for security.  The only way to protect yourself is to simply avoid those browsers: friends don't let friends use IE6.  But you said you are not interested in them, so I think we can disregard them.

Modern desktop browsers. This is the nub of the issue, and I suspect what you were most interested in.  On modern desktop browsers, there are only a few things you can trust:

Domain name. You can trust the domain name in the address bar to indicate the site you are currently on.
Blue/green glow. You can trust the blue/green glow behind the name in the address bar to indicate the presence of SSL.  You can also trust the `https://`` schema to indicate the use of SSL, but the glow may be easier to check for.

That's essentially it.  You can not trust the icon next to the URL (the favicon), even if it looks like a padlock or something; you cannot trust anything below the address bar; you cannot trust the text in the status bar when you hover over a link before clicking on it.  You should not rely upon anything in the URL after the domain name, as the same-origin policy makes no distinction between different URLs on the same domain.

How to protect yourself.  Let's put it all together.  If you want to be safe when visiting some site -- say, your bank -- there are two viable strategies you can use to protect yourself:

Prevention: use a bookmark. To prepare, make a bookmark to the login page for your bank.  (Make sure it is a https page you are bookmarking.)  Then, when you want to log in, click on the bookmark, then enter in your credentials and use the site.  Never navigate to your bank's site by clicking on links; if you find yourself on your bank's site from some other source, then make sure you're on the right page by clicking on the bookmark before you use the site.  This essentially prevents any opportunity for a phishing attack on your bank credentials.
Detection: check the address bar. Alternatively, you can try to detect phishing attacks.  Every time you visit your bank web site, check to make sure that the domain name in the address bar matches your bank's domain name before entering your credentials or using the site.  This will be a pretty reliable way to detect phishing attacks -- as long as you always remember to check the address bar.  The primary shortcoming of the approach is the obvious one: you have to always remember to check the address bar.  Apart from that caution, this is a viable strategy, too.

Also, you may want to check that you are currently using SSL, by checking for the blue/green glow (this is especially important when using a wireless network); if you happen to know that your bank has had a green glow in the past, then on subsequent visits make sure the glow is still green.  Alternatively, if you use Firefox, you could install HTTPS Everywhere and save yourself from having to check for SSL.

Caveats and attacks. I need to qualify the above remarks a bit.  Checking the address bar is not a foolproof defense.  There are some sophisticated presentation attacks that could potentially fool you, even if you look at the address bar.  Let me outline the major ones:

Picture-in-picture attacks. Recall that a web page can completely control what pixels are drawn on the portion of the browser window where it is displayed (e.g., by providing a bitmap image, which will be displayed exactly as is).  In a picture-in-picture attack, a malicious web page arranges to draw something inside its window, so visually it looks like there a second, smaller browser window has popped up on top (and its outline is completely contained within the outer window).  This is hard to describe in words, so here is an example image:

Credits: Fig.2 of An Evaluation of Extended Validation and Picture-in-Picture Phishing Attacks by Jackson, SImon, Tan, and Barth.

In this example, the user is visiting a malicious web page: http://paypal.login.com, as shown in the outermost address bar.  The malicious page controls the contents of all the pixels inside this outer window (except for the chrome around the border).  In this area, the attacker has drawn an image that replicates the appearance of a second smaller browser window, popped up on top.  Since the attacker controls all of the pixels of that image, the attacker can completely control the "address bar" of the "inner window".  The attacker has chosen to spoof an "address bar" containing https://www.paypal.com.  If you weren't careful, you might conclude that the inner "window" has focus, look at its address bar, conclude you are talking to Paypal, and enter your Paypal password or other personal details into the inner "window".  If you do that, you've actually revealed your Paypal password to the attacker.

This attack can be tricky to mount successfully.  It relies upon the user not getting suspicious when a new browser window appears to pop up for no good reason, when they weren't trying to visit Paypal.  It also requires significant engineering effort from the attacker to make it look and feel correct.  For instance, the attacker would need to use Javascript to identify what browser and operating system you are using, then craft a spoofed image that matches your browser version, and for full fidelity, the attacker might need to implement Javascript handlers to let you drag the inner window around (you won't be able to drag it outside the confines of the outer window), interact with the spoofed chrome of the inner window, and so on.

For more on this attack, read An Evaluation of Extended Validation and Picture-in-Picture Phishing Attacks by Jackson, SImon, Tan, and Bart.  I'm only aware of one instance of this sort of attack in the wild.
Homograph attacks. See "The Homograph Attack" by Gabrilovich and Gontmakher, and "The methodology and an application to fight against unicode attacks" by Fu, Deng, Wenyin, and Little.
Full-screen attacks.  (TBD)

To my knowledge, these attacks are rarely (if ever) seen in practice, and they might have only a partial chance of fooling users, but I wanted to outline them so you are aware of the ways in which browser security is not perfect.


Detect and remove rootkit from Debian 8.5 (x64) My Debian 8.5 (x64) server is infected with a rootkit, which I have detected by using a live CD to display the contents of /tmp and /var/tmp.

I found out about the infection by seeing high CPU loads due to a cryptominer.

The above directories contain binaries that ls does not display, when the system is running - I guess, the rookit is intercepting system calls?

I've already runned chkrootkit and lynis, but without any results, except warnings (changed) about:

kernel.core_uses_pid
kernel.dmesg_restrict
kernel.kptr_restrict
kernel.sysrq
kernel.yama.ptrace_scope

I want to achieve:

Locate the rootkit.
Remove the rootkit (if possible).

Any suggestions?

The best way to really identify if you have a rootkit is performing a forensic analysis.
But first of all: be sure you have and updated backup.

If you are seeing files "offline" with the liveCD, and not with the normal system running, maybe they have some kernel hooks. To verify this point, you can compile busybox with -static flag in a different computer, then check if the results with the system ls and busybox ls are different.

Usually rootkits hide themselves from system commands, you can also check for process with system ps and busybox ps to see if there are any differences.

Finally, you can use volatility to analyze a memory dump from your system to see the process you have running and discover that rootkit.


how to force openvpn client to use TLS instead of SSL connection i'm trying to use openvpn client to connect TLS VPN server

here is my .ovpn file

client
tls-client
dev tun
proto tcp
remote example.com 443
resolv-retry infinite
auth-user-pass
persist-key
persist-tun
nobind
#remote-cert-tls server
tls-version-min 1.2
ca "/path/pem.pem"
cert "/path/cert.cert"
key "/path/key.key"
verify-client-cert require
verb 7
route 10.77.80.177/32

problem is when connecting, client uses SSL instead of TLS (see screenshots below)

the correct way is below

is there anyone to force openvpn client to use TLS ??

You have tls-version-min 1.2 in your configuration file, so you are using TLS. It appears that your logging tools is simply referring to SSLv2, SSLv3, TLSv1.0, TLSv1.1, TLSv1.2, and TLSv1.3 all as simply "SSL". This is technically incorrect, but it's very common. You don't have to worry about SSL-specific vulnreabilities in your application just because the protocol itself has been labeled as SSL.


OAuth: how to prevent phishing with malicious redirect URIs To quote the OAuth spec:

  If the resource owner denies the access request or if the request fails for reasons other than a missing or invalid redirection URI, the authorization server informs the client by adding the following parameters to the fragment component of the redirection URI using the "application/x-www-form-urlencoded" format, per Appendix B:

  ...

Let's say I'm trying to phish an Example.com account. What prevents me from doing an attack like this:

Register a similar-looking domain. We'll use https://exámple.com for this example.
Set up exámple.com/login to look like the real Example.com's login so I can steal credentials.
Register an OAuth app with a redirect URI of https://exámple.com/login.
Construct a deliberately-invalid OAuth authorization request and get a user to visit it. It might look like this: https://example.com/oauth/authorize?redirect_uri=https%3A%2F%2Fex%C3%A1mple.com%2Flogin&client_id=MY_CLIENT_ID&scope=bogus
When the user visits it, the real example.com will see that my request is invalid (scope was bogus).
example.com will redirect to https://exámple.com/login?error=invalid_request (or similar), which I've set up to phish Example.com users.

This isn't the biggest vulnerability in the world, but if I can trick you into clicking on a link, I can take over your account. I expect a lot of users would click any URL where the domain was google.com, for example.

What steps can an OAuth provider take against such an attack? In the example above, what could Example.com do?

In this case, it's up to Example.com to decide whether it wants to allow arbitrary users to create applications and use it as an OAuth2 provider.

Typically there is some kind of approval process for your app to go "live", and part of that process should be vetting the legitimacy of the application, and hopefully malicious uses like this would be prevented.

Facebook is an example of a OIDC/OAuth provider that allows anybody to register any application, but requires approval before your application can be accessed by other people. I don't actually know if approval involves manual review for things like the phishing attack you describe, but it probably should.

To directly answer your question,

  What steps can an OAuth provider take against such an attack?

Example.com should recognize that allowing users to register arbitrary applications exposes them to this kind of attack, and mitigate it by requiring all applications go through a review process. A portion of that review process could be automated by checking whether there is a high degree of similarity between the registered application's redirect URI, and the provider's own domain.


Is it useful to use 'dot' and 'at' in email addresses in documents on the web? My question seems to be a mash up of two questions. The first is that over at TeX.SE there is a question about creating PDFs with crawler resistant email addresses. There are some good answers about creative ways that go way beyond just the boring name<at>domain<dot>com, but my question is, do these method cut down on spam? This question: Is using 'dot' and 'at' in email addresses in public text still useful? provides an answer for webpages, but not documents like .pdf and .doc files. The answer highlights a set of methods based on "dynamic" CSS and PHP methods which are not available for static documents. Further, .doc files, and to some extent .pdf, files are not the same as plain text HTML so it is not clear what the crawlers are working on. Crawling through a .doc binary file to find an email is presumably much harder than crawling through plain text. This makes me think that protection in files is potentially different from protection in webpages. Is obfuscation useful for files posted on webpages?

It really depends on how sophisticated the crawler is.  I doubt that the vast majority would go to the trouble of downloading word and excel documents, mainly due to the potential size.

There are libraries available thought that make reading of doc, xls(x), pdf, etc. relatively easy.  It is not out of the realm of possibility that some crawlers do download files.  It's not feasible to protect against every possible threat, so let's consider how difficult it would be to obscure email addresses in documents vs. the security benefits.

You would need different strategies for likely different document formats, and this may lead to them rendering poorly, and thus losing usability (ability to receive legitimate emails).  You could include specific instructions like "In the subject mention 'assistance'.", or something to that end.


discover virus or spyware under Linux I suspect to be the target of very skilled hackers.

5 or 6 years ago I found spyware on my Linux webserver, it was lkm masked as ppp_deflate module with md5 hash hijacked. I mean with the same md5 hash of the original ppp_deflate.
Everything started because 2 sites were looking offline but they weren't.

I suspected that the only way to be infected from that spyware was to connect to a p2p network. Then I formatted a new PC, upgraded, md5 of all files and I connected it to emule network. After few minutes it was infected in an totally invisible way. No kernel crash/dump, no emule crash, no trace of intrusion. Also, at runtime the md5 hash of all file was OK, every file match his original hash. But from the live cd the ppp_deflate module had a different md5 from its original.

Then I made the last test. I formatted again and compared the md5 of original ppp_deflate and the infected ppp_deflate. And they was different.
After that I did:

# rmmod ppp_deflate

and then I load the infected one

# modprobe ppp_deflate

.. now the hash of the infected module was the same of the original!!!
I went to the police with my problem... but the policeman said that my Windows PC had probably been poorly configured...

5 or 6 years ago I had suspected that my box had been hacked because I found a strange guy on irc and other chat forums that knew some of my personal information. On these months was happening the same strange things..

I don't want to use antirootkit tools because I know they don't work.

Then my question is:
Where should I search on my linux box to find a spyware ?
My ideas are:

firmware (efi,nic,vga,cd/dvd burner etc) (very difficult)
MBR and bootsector (boot kit..) (maybe)
statically compiled kernel (unlikely)
lkm (maybe)
initrd (maybe)
binaries (init, core bin, etc) (too stupid)
libraries (libc and so on) (too stupid)
limited process automatically started by gnome (easy)
firefox or chrome extensions (easy)

My distro is the last Ubuntu with last kernel 3.0..)
I am sorry... the last thing..
I don't want to solve my problem with yet another format..
I want find if there is problem. So I want to have the most complete checklist to find malware.

I haven't any services running, also I have 2 firewalls: one on my pc and one on my router.
The passwords have been changed.

Thanks very much for your answer[s].

Well you made a very common mistake. Once a system is compromised you should reinstall the system and restore from backups. You can't trust it anymore. You also  change every single password.

If they are skilled enough to change your MD5sum binary, they will probably be skilled enough to install a rootkit or similar.

Was anything vulnerable, possibly vulnerable (something on the internet you wrote yourself, etc)?
Did you reuse any passwords?
Are there any services running?
Does anyone else have physical access
Do you go to dodgy sites and download cracked/special/homebrew software?


Is using Basic Authentication in an iOS App safe? I am working on an iOS app that will be sending the user's username and password for each URL request. Currently, only because for simplicity until it's ready to be launched, the username and password is being passed over HTTPS in a GET request like the below.

https://www.example.com/api/login.php?username=user&password=pass

The HTTPS secures the parameters for transmission, but I know that the security concern with this is that the URL can be stored in browser history and any server logs.

My question is... if I get rid of passing the username and password like I currently am doing and I base64 encode them prior to being sent, include them in the header like below, is this safe? Will the username and password be stored in any history or logs?

Authorization: Basic aHR0cHdhdGNoOmY=

EDIT: I already know base64 can easily be reversed... that's not what I'm asking about. I'm just asking about the security of putting usernames and passwords in HTTPS GET parameters vs. the header.

UPDATE: I am now using basic authentication for the login endpoint and returning a JSON Web Token to be used for all requests thereafter.

Will the username and password be stored in any history or logs?

Commonly authorization headers are not logged but, of course, one could configure the application or server to log these data. Thus check your setup.

As for storing in the history: In case of a browser, such credentials will not be stored in the history but might be stored similar to cookies and automatically sent when visiting the site. Yet, since you are not using a browser but your own app, it is up to you how you manage this information.


For TLS how to instruct IIS 7 to include Intermediate CAs to be included in the Certificate Request frame? I am observing an issue in which the TLS handshake is failing between a Java Client and a web service hosted under IIS 7.  Upon wiresharking the attempt it seems that the problem is the list of trusted authorities provided in the Certificate Request Frame does not include the Intermediate CA which signed the client cert that is intended to be used.  In looking at the RFC it states that the frame should include

  A list of the distinguished names of acceptable certificate
  authorities. These distinguished names may specify a desired
  distinguished name for a root CA or for a subordinate CA; thus, this
  message can be used both to describe known roots and a desired
  authorization space.

To me this means that the intermediate should have been included.  Is there some hidden setting to force the Intermediate CA to be include or am I incorrect in my interpretation of the spec.  If I am incorrect I do not see how the proper client cert could ever be identified.

Edit:
To give a little more background.  The trust chain in question in from Entrust and is three levels deep, the CA, an Intermediate CA and the leaf.  In this case the service is secured by a Server Cert signed by the intermediate and the client is calling using a Client Cert signed by the same intermediate.

It's possible to work around the somewhat liberal IIS interpretation of the SSL/TLS spec by exporting your client certificate in PEM format (base64 ASCII), appending the public certificates for the CAs in the trust chain, and then importing the certificate back into the keystore under the same alias.

To clarify: it's not enough to have all the certificates in the chain in the keystore - they have to be imported with the client certificate itself as a bundle. See this thread at StackOverflow for details: why doesn't java send the client certificate during SSL handshake?

I've just used this method to resolve this exact issue with a Java client and an IIS 7.5 server.

EDIT:

Note that after you import the certificate in bundle form (with its CAs) you won't notice any new entries with keytool -list. Also, if you export the alias again, you'll still only get the client certificate itself. The only difference you'll notice is an extra couple of KB on the file.

Use a tool like KeyStore Explorer to see all of the certificates associated with a keystore entry. In fact, KeyStore Explorer also lets you append certificates to the in-keystore certificate chain for any entry, as an alternative to the export/edit/import route.


Is it safe to use 2 password derivation functions to one password? The example I'm working on is this:

i store the user password using Argon2 in my database

and then use PBKDF2 to derive an AES key from the user password , and store only the salt used in PBKDF2, i use the output from this function to encrypt some files for the user

my question is this method safe ?

If you use multiple password hashing algorithms independent of each other to process the same password, then passwords are protected only as well as the weakest algorithm protects them. PBKDF2 is easier to crack than Argon2. An attacker with only a few bytes of ciphertext can then bruteforce passwords, attacking just PBKDF2 and bypassing Argon2.

If you process them sequentially, as in Argon2(PBKDF2(pwd)) or PBKDF2(Argon2(pwd)) then that's not the problem anymore. (As long as you don't use the intermediate hash output for anything else.)

That's still a bad idea. Giving 100% of your CPU time to Argon2 is better than sharing time between the two. Instead of splitting time 50-50, you can use that 50% you're wasting on PBKDF2 to increase one of Argon2's cost parameter.

You could use that extra time to fill more RAM by increasing memory cost. That reduces an attacker's password hash rate by making the hashing harder to parallelize. Increasing the memory cost also increases run time of each Argon2 evaluation for the attacker, further reducing their hash rate.

Or you could use it to increase the time cost. That makes Argon2 do more passes over the memory allocated to it. This reduces an attackers hash rate because each evaluation takes longer. It also helps decrease the effectiveness of a time-memory-tradeoff attack if you're not already using several iterations. (Increasing the memory cost is preferable if you're already using at the recommended number of iterations.)

Argon2 can be used for key derivation just as well as user authentication. If for some reason you can't do that, then derive one master key using Argon2 and hold onto that key in RAM to use for deriving other keys. There are key-based KDFs as well as password-based KDFs. HKDF, for example.

Technically using PBKDF2 with c = 1 (one iteration) is okay to use as a key-based KDF. (Scrypt uses this technique.) There's no security issue if you're only giving 0.00000000000001% of your password-stretching budget to PBKDF.


somewhat complex dev domain https on local network cert problems I was trying to mirror my setup to prod as much as possible so I only serve my dev site over https. The setup goes like this...

I have a trusted CA on my machine made by devcert
I generated some certs and mounted them in a docker container and serve them on my site, I've added a .dev domain to the /etc/hosts in both the container, my local machine, and my mobile device, all of them get directed to the proper location when I point my browser to the .dev domain

Problems:

My android mobile device does not trust the certificate. I can't seem to use the chome thisisunsafe hack because I cannot get a keyboard on the warning screen on mobile...

I've tried adding the CA as a trusted certificate on my phone via settings > secutiry > install from SD card but chrome still fails

Firefox (on my local dev machine) doesn't accept the certificate and fails with SEC_ERROR_BAD_SIGNATURE even though chrome works

I badly need to do some mobile debugging so I need to get this in a working condition ASAP, any ideas where I am going wrong?

I ended up going back through the whole process and manually deleting my custom root CA from firefox and clearing the cache. After that everything seemed to be ok


What role do hashes play in TLS/SSL certificate validation? After coming across this question in the Hot Network Questions section and reading the related blog post by Google, I'm starting to become curious as to what role these hash functions play in TLS/SSL certificate validation.

I was under the impression that an SSL certificate was just a link between a set of domain names and a public key (the site owner's public key to be precise), cryptographically signed by the private key of a certificate authority. Why is a hash function needed for validating it?

Basically, hash functions are a necessary part of the process of creating a digital signature.

Most signature algorithms are not designed to be able to securely and/or efficiently sign long messages directly, so the first step of each algorithm is usually to hash the message being signed, reducing it to a fixed length which the rest of the signature algorithm is able to effectively process. Similarly, signature verification algorithms involve hashing the message being verified, then performing some set of operations on the signature to check whether it corresponds to that hash.

For example, with RSA signatures the signature can be thought of as a hash of the data being signed, "encrypted" with the signer's private key:

Image from the Wikimedia Commons

The verification process involves "decrypting" the signature (using the signer's public key), and comparing the resulting hash with the hash of the data the signature applies to. In the case of SSL certificates, the data is the SSL certificate itself.

Note: I wrote "encrypted" and "decrypting" in quotes here because in reality the operations used in the RSA signature algorithm aren't exactly the same as those used for RSA encryption. They are close enough though to make for an effective analogy here. With other signature algorithms like ECDSA, the signing and verification algorithms are totally different, not involving "encryption" or really anything resembling the process above, but the message is still hashed as part of the signing and verification process.

For more detailed information on the use of hashing in specific signature algorithms, see:

Why hash the message before signing it with RSA?
Why the need to hash before signing small data?
Wikipedia: Elliptic Curve Digital Signature Algorithm

This answer was derived from reading the questions linked in dave_thompson_085's comment.


Watching movie from a potentially infected device I went on holiday with a friend. He filmed and made a movie from our trip. He put the movie on my usb key.

I was about to plug this, but realised my friend does not have good security practices, so my usb key might now be infected.

I know I should never plug that usb key back into my computer.
However, I am wondering if I could put it into a standalone DVD/Bluray player (device not linked to a computer, that plugs into the TV via HDMI).

Can such a device get infected by a malware, and then spread it to my network?

This is mostly a question of targeting. In a case like this, we're most likely talking about opportunistic infection. What this means is that some malware may copy itself to any USB stick that is inserted, perhaps with an autorun.ini file that attempts to start the malware when you plug it in (this doesn't work by default on Windows 7 or later), or with some interesting looking file name that it entices you to click on. Generally speaking any malware is going to target Windows.

In an very rare case, the malware may also bundle a payload designed to attack a common smart TV operating system, such as Android TV or webOS. These embedded operating systems used to run some very old Linux packages with vulnerabilities in them; the vulnerable package I most commonly see on these types of infotainment systems is libpng. However, for opportunistic USB stick infection from a Windows host, I don't think I've ever heard of malware that targets one of those platforms.

Technically speaking a standalone Blu-Ray player can suffer the same problems. It's a surprisingly richly featured system, including a Java ME runtime for BD-J content. Since most Blu-Ray players never get software updates it is reasonable to assume that there are vulnerabilities in most of them and they never get patched. However, a standalone Blu-Ray player is exceedingly unlikely to be targeted, for a number of reasons: the chances of you plugging the USB stick into a Blu-Ray player are small; the chances of that Blu-Ray player being the one they happened to target are smaller still; the chances of that Blu-Ray player happening to run the right version of the software for their payload is even smaller; and most of the time the Blu-Ray player isn't connected to the network anyway so there's little point in infecting it - it doesn't have access to anything useful and can't talk back to the attacker.

Usually the way I deal with untrusted devices is to load them in an environment that I can just throw away. Booting from a live Linux USB on a system with no other mass storage devices is a good way to do this. If you've got a spare laptop hanging around you can just pull out the hard disk and use it to scrub everything on the flash drive aside from the one file you care about. Chances are the malware can't run on Linux anyway, and even if it did there's no easy way for it to persist in a live boot environment.

As an aside, I recommend that you update your video player software to the latest version, because video players can have vulnerabilities too.


How to pass credentials across applications securely? To simplify the user experience , if we want to design a system such that the user login password for the desktop account itself can be shared with various applications like chat/email/skype etc.

How do we pass credentials across applications without asking the user to give them again / seperately? I understand it's not safe and can cause a single point of failure. But I am curious about the technology for credential sharing across applications than single point of failure stuff .

If you want something centrally managed across an enterprise domain (i.e. federated identity), then you'll want to look into some sort of solution mentioned on this Wikipedia article. Identity management is complex, time consuming, and will take a lot of engineering and administrative resources - especially if your users have access to multiple information systems across your enterprise.

If your environment or user base is smaller, or you don't care about centrally managing credentials or a federated identity, you can look into a utility like LastPass for Applications


Bruteforce - Using Hydra with JSON Trying for the life of me to get Hydra to work with a JSON request.

General:

Request URL: https://api.myapp.app/api/accounts/login/
Request Method: POST
Status Code: 401 Unauthorized
Remote Address: xx.xxx.xxx.xxx
Referrer Policy: no-referrer-when-downgrade

Response Headers:

Access-Control-Allow-Methods: GET, POST

Request Headers:

Content-Type: application/json
Origin: https://myapp.app
Referer: https://myapp.app/login
User-Agent: Mozilla/5.0

Request Payload:

{username: "root", password: "toor"}
password: "toor"
username: "root"

Response for Invalid Login:
{"error":"username or password incorrect"}

I have tried many iterations, but keep getting the following error message:
Receiving the following error message: [ERROR] Invalid target definition!

hydra https://api.myapp.app https-form-post "api/account/login:username=^USER^&password=^PASS^:F={\"error:\" \"username \" \"or \" \"password \" \"wrong\"}" -l root -p toor

I could not get the Hydra command to work, but I did learn about patator, https://github.com/lanjelot/patator, which worked.

Patador command: python patator.py http_fuzz url=https://api.myapp.app/api/login/ method=POST body='username=root&password=FILE0' 0=/home/[your dictionary file]

If anyone is a Hyrda expert, I am still interested in learning how to use Hydra for the same. While the patator tool works, I am not sure it supports rate limits and other features found in Hydra. Thank you.


Risks of sharing information just "protected" by a unguessable url I recently started to use grafana to visualize a lot of different metrics. Grafana also enables me to share dashboard snapshots directly via a link. Which is pretty comfortable since I can share the dashboard without the need for others to be registered at my site. Such a link would look like the following:

https://my-website.com:3000/dashboard/snapshot/2yFejTCJX4G8Q4Ea2XiCpMhQuiUTDvyu

In the process of creating such a link grafana warns me about the following:

Its clear to me that for the case I send the link to person A, I can never say to whom he will send that link too.

But if we consider a scenario where the dashboard snapshot shows data which is related to person A. Person A obviously don't want that random strangers can access his information.

1) Is it a bad idea now if I create the link and send it to person A with the warning he should not share it with others since every one with the link can access his dashboard?

2)Is this approach more risky than the normal login way? Since with the normal login approach there is also the risk person A shares his login/password with others?

3) Is it generally possible to get access to all of the dasboard snapshots with some kind of brute force attack ?

Link to the documentation about dashboard sharing: Link

An "unguessable" link is exactly analogous to a username/password protected link - as you surmise, users could just as easily share the username/password for a guessable link as they could an "unguessable" link.  In fact, because unguessable links can have far more entropy and because they aren't susceptible to bad password practices, it can end up being even more secure.

As far as brute forcing, there are 62^32 possible links in the scheme they appear to be using (upper and lower case letters + numbers, 32 characters long).  That means that even if they could try hundreds of thousands of links a second, it would still take many, many more times than the lifetime of the universe to exhaust the search space.  Even if there are hundreds of millions of links, they could probably try until the sun goes dark without finding one.

62^32 is an enormous number.

(This assumes that the urls are generated randomly, using good sources of randomness and are not predictable.  If they are predictable (hashed from the time + account or something), all bets are off.)


Would 'spam' mail really avoid eavesdropping? spammimic.com offers a service that 'encrypts' your mail as 'spam', the rationale being that all mail services automatically filter out spam, and so if you're wanting to communicate with someone without an eavesdropper noticing, disguising your message as spam will do this.

Is there any evidence that this would actually work though? In order for your message to get through, it would have to be sufficiently not like spam in order not to be deleted outright. Assuming you send it from your own account, headers etc. will be intact, and isn't this the first thing that spam filters check? Wouldn't it be the first thing the eavesdropper would check too?

In short:

  Dear Friend , Especially for you - this red-hot announcement
  ! If you no longer wish to receive our publications
  simply reply with a Subject: of "REMOVE" and you will
  immediately be removed from our club . This mail is
  being sent in compliance with Senate bill 1621 ; Title
  1 ; Section 309 . This is NOT unsolicited bulk mail
  . Why work for somebody else when you can become rich
  within 61 DAYS ! Have you ever noticed nobody is getting
  any younger and people are much more likely to BUY
  with a credit card than cash . Well, now is your chance
  to capitalize on this ! We will help you SELL MORE
  & use credit cards on your website . You are guaranteed
  to succeed because we take all the risk . But don't
  believe us ! Mrs Ames who resides in Delaware tried
  us and says "I've been poor and I've been rich - rich
  is better" ! We are licensed to operate in all states
  ! Do not go to sleep without ordering . Sign up a friend
  and your friend will be rich too ! Cheers . Dear Friend
  ; Especially for you - this cutting-edge intelligence
  ! This is a one time mailing there is no need to request
  removal if you won't want any more ! This mail is being
  sent in compliance with Senate bill 2416 , Title 3
  ; Section 302 ! This is not a get rich scheme ! Why
  work for somebody else when you can become rich within
  71 weeks ! Have you ever noticed society seems to be
  moving faster and faster and most everyone has a cellphone
  ! Well, now is your chance to capitalize on this !
  We will help you SELL MORE and increase customer response
  by 170% ! You are guaranteed to succeed because we
  take all the risk . But don't believe us . Mr Jones
  of Georgia tried us and says "Now I'm rich many more
  things are possible" ! This offer is 100% legal ! So
  make yourself rich now by ordering immediately ! Sign
  up a friend and you'll get a discount of 60% . Best
  regards !

It would help if you elaborated on if you are defending from a targeted attack or just being cautious, and what vector the potential adversary would be using to eavesdrop.

That being said, the method you are referring to is called 'security through obscurity', and is

  "… discouraged and not recommended by standards bodies."

I would say that is putting it nicely. Security though obscurity is very BAD (on it's own).

Try watching this video from Def Con 21, told from the perspective of forensic investigators. They show several examples of why security through obscurity is a bad idea. You can also get an understanding of the capabilities of the tools used by forensic investigators.


MDNS activity-- is this a network risk/vuln? I am connected to a wireless network that is huge (think large organization).  After opening up Wireshark and capturing pcap for about 15 minutes I am seeing lots of MDNS Standard Query traffic with devices and printers also connected to this network.

1) Is it weird that my machine is seeing this multi-cast traffic?

2) Is this something concerning/ a potential security risk?  For example, does the the nae "Joe's-Macbook.local" or a printer name being sent over the network open up an attack vector?

3) Should I be taking precaution so my information is not leaking out over the network?

A link about what mDNS is.

Answering your questions:

No, is not weird. If it is a large network, lots of devices can be using that kind of protocol, like for example Apple Bonjour software packages.
If a hacker is on the network, of course any information could be useful. It is not a security risk itself, but can help.
The presence of mDNS packets on the network doesn't mean in any case a security risk. Anyway, take the standard precautions... use firewall, antivirus, use always secure protocols if available (SSL, SSH, etc).


Is VirusTotal useful for finding malware in a WordPress database SQL export? Does VirusTotal detect malware in an SQL export? I have an infected WordPress site. I removed the malware with various tools, however I know from experience, that sometimes it hides itself somewhere deep in the database. I did a manual search for suspicious code in the database and didn't find anything. However, I'm just a novice in these kind of things and only know some basic functions to search for, that are typically used by malware.

Is VirusTotal actually able to find malware in sql export files? Or can I use some other software for that?

No, from VirusTotal support:

  VirusTotal inspects items with over 70 antivirus scanners and URL/domain blacklisting services, in addition to a myriad of tools to extract signals from the studied content.

If the attack you received was a SQL Injection, the best you could do is to fix the vulnerability that let the attacker to inject malicious code in your web page and of course deleting the malicious code that have been uploaded.

SQL Injections are usually easy to clean (removing the injected content) but hard to fix (avoiding that the injection to rehappen in the same way).

You could check for some very known and typical cross-site scripting attack strings here and here.

A good explanation of how and which settings let those attack work is given here.


Django and Mindspark I have a Django based website that collects data using forms. All users have to login to access the forms.

Today I saw a strange error where a user submitted a form with a combination of form values that could not be generated from the form webpage. In fact the POST data was so bizarre, it caused the code to crash and gave me a stack trace.

Most of the stack trace looked pretty normal, except the cookies:

COOKIES:{'csrftoken': 'VZJsrl3MsZzNOttdmmeS2AshrH3Wsk3Y',
 'mindspark_extension_api_features_223931006': 'TOOLBAR_CLEANER',
 'mindspark_extension_api_features_233005932': 'TOOLBAR_CLEANER',
 'mindsparktb_223931006': 'true',
 'mindsparktb_233005932': 'true',
 'mindsparktbsupport_223931006': 'true',
 'mindsparktbsupport_233005932': 'true',
 'sessionid': 'removed by me'},

I have never seen the mindspark entries. I believe the cookie is Django specific, so I am not sure why these mindspark entries are showing up. I know the user is not sophisticated enough to manually generate the POST. Nor does the user have any incentive.

Any ideas on how to figure out how this POST is generated?

MindSpark is a "Potentially Unwanted Program" flagged by several anti-malware/spyware tools. It is installed with many unwanted browser toolbars, and serves largely as a way of boosting advertising revenue and improving user tracking. I believe the cookies are injected across sessions including private/incognito browsing to allow websites to identify a user, even if they are taking the regular precautions to avoid it.

The browser sends it to all domains; websites that can benefit from MindSpark users, use this cookie to generate other actions from the user's machine, that are likely used to boost revenues.

The user is not intentionally generating POSTs that cause failures in your web server. It's just that his/her browser has a PUP toolbar that he/she likely installed by not paying close attention to it. You may want to inform this end user.

References:

Kotzias, Platon, Leyla Bilge, and Juan Caballero. "Measuring PUP prevalence and PUP distribution through Pay-Per-Install services." Proceedings of the USENIX Security Symposium. 2016.
Malwarebytes blog post


Is there a difference in security between an IP address white list and a domain white list with TLS? It seems to me that an IP address white list relies on easily spoofed information, while a domain white list, if it forces TLS, at least, relies on the validity of the certificate systems.

I may be framing this question incorrectly, or comparing apples and oranges here, but I still think what I'm trying to get at has a specific answer.

This seems related to the following two questions I came across on this site:

How should an outgoing connection white-list be created? <<< This could be a duplicate, but I think what I'm trying to get at is a bit more specific to auto-scaling the corporate security policy enforcement.
White list or black list sanitation for international input?

Business units, customers, colleagues, etc. keep asking about IP addresses for security purposes when certified, TLS-enabled domains, sometimes even internally, are available already.

Maybe there's no difference, but I feel like something's wrong, here with the "please send us the IP ranges" approach.

I've seen this get in the way of everything from phone calls to continuous deployment to trying to use GitHub, so I want to know:

IP address filtering vs. TLS domain filtering: Is there an increase in security?

tl;dr: different things, both useful for different scenarios, IP whitelisting is not a bad sign

You are indeed comparing apples and oranges.

IP-based filtering happens at the network layer of the OSI model, whereas certificate validation happens on the transport (and/or application) layer.

Allowing access only to/from specific IP addresses reduces the possible attack vectors whereas certificate validation is ensuring the connection is indeed with the expected party.

IP address based filtering is rather a

  I don't want to talk to people, except my friends

approach, whereas certificate validation is rather a

  Let's see what you have to say and then decide if we talk

approach.

There are several reasons IP based filtering is used, here are some that I find important to mention:

It reduces the surface area of a network or machine massively

If you let your system communicate with everyone, you must be sure that all communicating processes are following the rule.

If you choose to use IP address based whitelisting, you at least can make sure that the communicating processes, as far as they establish connections, are expected to not try and break your system.
It is easy to maintain

A system-wide setting is easier to update than, let's say, 20 web applications.
It is fast

establishing a TLS session is relatively costly, discarding packets based on origin is not.

So if both technologies are used together, they are very useful - and being asked for IPs for a whitelist is no sign of bad security meassures. Often, quite the opposite is true.

There is another part of your question I'd like to address:

  It seems to me that an IP address white list relies on easily spoofed information[.]

While it is true that you can spoof the originating IP address of a packet, this usually does not allow to establish connections.

A TCP handshake will fail and on UDP you are not getting the response - except if you are a man in the middle.


Logging in to a VPS using ssh and ssh to another VPS using ssh. Does it improve the security of the second VPS? By configuring ssh, only set IP can log in over ssh. I found this important since I'm going to provide public-facing web services which would expose my IP. Moreover, I can't use a CDN for some reason I prefer not to share. Furthermore, I need to protect against zero-days in sshd. (Credits: @mti2935 )

However, I don't have a static public IP and do not have control of the network environment. People on the network I'm using are potential attackers and I can't move to a new network. Plus the VPS provider does not provide a console application (or something that can change the configuration) in its web interface. For some other reason, I prefer not to pick another provider.

Thus, it is infeasible for me to whitelist my current public IP in the target server.

Thus, I decided to rent another VPS and use it as the midpoint. On this VPS, I follow the best practices for ssh without setting up IP whitelisting. On the target server, I only whitelist the midpoint. Then I ssh to the target server using the midpoint. Both VPS are of one provider. The midpoint is not going to be used for anything else.

Does it improve the security of the target server, or does it pose additional risks to it?

Is this problem better solved using other methods?

By allowing SSH connections to the midpoint VPS from any source IP, then allowing SSH connections from the midpoint VPS to the target VPS, you are just moving the security hole from one location to another.  At best, this is 'security by obscurity'.

I would suggest you scrap the idea of the midpoint VPS, and try to harden security on the target VPS as much as possible.  First, you might be surprised that the IP address dynamically assigned to you by your ISP changes less frequently than you think.  The IP address assigned to me by my residential ISP provider (Comcast) has not changed in over a year.  So, allowing SSH connections only from your ISP-assigned IP address may be feasible.  If your IP changes, you can always access the console of your VPS via your VPS provider's web interface, and update that firewall rule with your new IP.

If your IP changes too frequently, and this gets to be a hassle, then you might want to use a dynamic DNS service, like DynDNS, which will create a hostname that will always point to your current IP address.  Then, you could create a cron job on your server to update the firewall rule automatically, when your IP changes.

Last but not least, you might want to disable password-based authentication, and only enable public key based authentication, on the SSH server.  I think if you do this, and only allow connections from your (current) IP, you should be able to sleep reasonably well.


Are subkeys full-fledged keys in gnupg? I understand the key management and security benefits of using subkeys. However, I'm not sure whether subkeys are partial keys with limitations or full-fledged keys (just as the master key). Both the master key and the subkey look like a pair of numbers to me so that I'm wondering whether the word sub really comes from their usage but not their capability.

Yes, they're fully fledged keys.

The difference is that you have a master key, which you probably don't want to revoke or let expire often, and subkeys, which you actually use for crypto.

The subkey can be revoked, expire etc, but it's also proof that you're the owner of the master key. In essence, people trust you (i.e. you master key), but you just use the subkey. So, when the life time of one of the subkeys ends, you just use a new one – and don't have to rebuild your web of trust.


How do websites recognize visitors? Being more specific, I would like to know which are the possibilities for a webbsite owner to detect whether the same user logs with different accounts, and how to bypass each of them. For example, I already know coockies and I guess it is enough to use the private browsing function of the browser, and to be sure to carry out temporary files removal with some program as CCleaner. That is my first question so I hope it is everything correct. I apologize whether actually it is not. Thanks in advance for every answer and suggestion.

You could use browser fingerprinting, most browsers are unique in the plugins they use, version of those plugins, screen resolution (if you use your browser in full size) etc.

You can check your browser fingerprint here


How to verify if a phone number is an online SMS account as opposed to a genuine SIM card We are using Authy for phone number verification on our website. It is very easy to create a free online SMS account through Twilio or other providers.

Is there any way to determine whether the phone number is tied to a genuine SIM card and not from an online SMS account?

I know that individuals can still buy a load of SIM cards, but being able to check this aspect during verification would improve things.

Most VoIP system tries to behave like a real phone, so unless you have access to the internals of a telco, you can never be sure what kind of device is behind a number.

One alternative is to make the user call a special number (premium, toll-free, etc.) that requires contracts to be setup to call, then you can control exactly which telcos you'd setup the contracts with.

Similarly, you can establish ties with major telcos so they can tell you if the number belongs to a subscriber.

Another unsupported ways is finding SMS gateway addresses of popular carriers and asking the user to select the carrier to receive the text. Only numbers that are actually with the carrier can receive the text.

Also, if you can write an app to be installed on the user's phone, you can access their SIM info.


Why is MITM required for Session Hijacking? As I understand, the basic concept of Session Hijacking is intercepting a packet in which the victim sends its cookie/session credentials to a server, be it Facebook/Twitter/YouTube/Whatever.

But wherever I look and whatever I read, a MITM (Man In The Middle) attack is required. And I do not understand why. Packets are broadcast to the entire network. I can see (or at least should see) those packets with Wireshark regardless. Given that if I enter with my laptop in a coffee shop, I should see all traffic on that network, why do I have to perform a MITM attack?

Session Hijacking can also hijack a session that has already been established. And you're right, all you need is the packet, and not to be in the middle of the flow. For instance, if the session management is improperly configured, you could reestablish the same session if the user disconnects from the server.

Perhaps what you are reading is making a differentiation between "session hijacking" and "sidejacking".

Perhaps the most famous case of session hijacking is Firesheep. Their slides explain how it does what it does, and it does not require to be in the middle.


Does use of fixed padding pattern compromise AES-ECB I'm working on an application where AES-256-ECB has been specified. It has been asked that a fixed pattern is included at the end of the message to allow the decoding end to ensure the decryption has been successful. I was thinking to use a fixed padding value, and add 16-bytes of padding if no padding was originally required.

I know a better way of doing this is to use an authentication code (and to use AES in a different mode) but the client does not want to add extra complexity.

Will the use of a fixed pattern at the end of the message compromise the AES-ECB encryption if an attacker guessed the presence of the pattern? (I'm remembering what happened in the Imitation Game movie!)

Update: features of the data to  be encoded mean the same encoded data will not be repeated.

Update: I appreciate the advice about other modes, and have raised this myself. But for whatever reason ECB is the mode of choice.

To answer your question: Yes. You are facing two problems:

1) ECB is inherently unsafe to use and is only meant to be used as a building block for more safe operations. ECB mode produces the same output for the same input each time so it is extremely deterministic.

2) Because of the properties mentioned in 1 it will become trivial for an attack to determine what you exact padding is when he gathers a bunch of texts.

You should really consider using a more complex operation mode.
I strongly suggest that you use CBC (Cipher Block Chianing) or any of the other more secure modes (OFB, CFB, CTR) <- look these up if you have to.

EDIT: I made you a list down below that references wikipedia and also explains that ECB should not be used:

ECB:

  The simplest of the encryption modes is the Electronic Codebook (ECB)
  mode. The message is divided into blocks, and each block is encrypted
  separately. The disadvantage of this method is that identical
  plaintext blocks are encrypted into identical ciphertext blocks; thus,
  it does not hide data patterns well. In some senses, it doesn't
  provide serious message confidentiality, and it is not recommended for
  use in cryptographic protocols at all.

CBC:

  In CBC mode, each block of plaintext is XORed with the previous
  ciphertext block before being encrypted. This way, each ciphertext
  block depends on all plaintext blocks processed up to that point. To
  make each message unique, an initialization vector must be used in the
  first block. CBC has been the most commonly used mode of operation.
  Its main drawbacks are that encryption is sequential (i.e., it cannot
  be parallelized), and that the message must be padded to a multiple of
  the cipher block size. One way to handle this last issue is through
  the method known as ciphertext stealing. Note that a one-bit change in
  a plaintext or IV affects all following ciphertext blocks.

CFB:

  The Cipher Feedback (CFB) mode, a close relative of CBC, makes a block
  cipher into a self-synchronizing stream cipher. Operation is very
  similar; in particular, CFB decryption is almost identical to CBC
  encryption performed in reverse.

OFB:

  The Output Feedback (OFB) mode makes a block cipher into a synchronous
  stream cipher. It generates keystream blocks, which are then XORed
  with the plaintext blocks to get the ciphertext. Just as with other
  stream ciphers, flipping a bit in the ciphertext produces a flipped
  bit in the plaintext at the same location. This property allows many
  error correcting codes to function normally even when applied before
  encryption.

CTR:

  Like OFB, Counter mode turns a block cipher into a stream cipher. It
  generates the next keystream block by encrypting successive values of
  a "counter". The counter can be any function which produces a sequence
  which is guaranteed not to repeat for a long time, although an actual
  increment-by-one counter is the simplest and most popular.


Wiping magnetic stripe on card with magnet? I asked a question a while back on using magnets (for example powerful Neodymium ones) to wipe a HDD, and got shown a good article proving it is not possible to wipe data.

Pretend I am about to destroy a credit/debit card. If I run a magnet across the black magstrip how much data (if any) would be destroyed? Would it be a bad idea as it would take a long time?

Assume this needs to be done fairly quickly, without specialist tools (aside from special magnets), using things available in an average home.

Please forget about the chip EMV, RFID touch and go, physical printed numbers, CVV, and physical destruction in this question.

With a weak kitchen magnet this can take many passes and a fair amount of time. In fact if all you have is a fridge magnet you may be better off scraping the strip off. However a more powerful magnet can erase the card fairly quickly. See http://www.creditcards.com/credit-card-news/video-magnets-make-credit-card-mag-stripe-not-work-1457.php for details. Whether or not, with heroic effort, some of the information can be recoverable is open for debate.

Now for a personal anecdote not involving household tools. I used to work at a lab with NMRs (Nuclear Magnetic Resonance). These have incredibly powerful magnets, in fact there are circles on the floor showing the closest you may approach with any metal. If a researcher forgot to take off their ID card or credit card and entered the room then they would need a new card as the strip was demagnetized.


If I connect to a website using a cellular network, and change the sim card and connect again with the same phone, will they find its the same phone? I read on a blog that when you connect to a website with your phone
they track the model number id of the device, or something like it. I don't remember what its called. Even if you change your sim card and connect again over cellular network, the website can detect that you connected with the same device. Is this true? Can it be prevented?

This is not true in general. Your connection is made via HTTP or HTTPS. Both don't carry your IMEI number. Some mobile carriers do transmit ADids, that are somewhat unique. It depends on your carrier wherever this id is generated from your phone number, your IMEI or not at all.

Other HTTP techniques such as cookies, flash cookies, local storage, your browser's cache (list incomplete) can still expose to the website that you're the same visitor.

If your carrier uses adids, than there is not much you can do except for using https on those sites (where it cannot be injected) or a VPN, which itself is an indicator due to the shared IP between sessions. If your carrier does not use adids you can clear your browser from cookies and similar or use it's private browsing mode.


SFTP server: should we prevent SSH host key changes? We host a SFTP server and we encourage our customers to check the SSH host key when connecting.

I was always under the impression that the SSH host key was fixed - it would only change when reinstalling the OS.

But in the past the SSH host key was changed (not sure, we don't monitor it) unexpectedly and that was raising (valid) questions by our customers.

We use the Cerberus FTP Server on Windows for hosting SFTP and FTPS. It looks like the SSH host key was changed when we replaced the SSL certificate for FTPS...

My questions:

Is changing the SSH host key a bad thing or is there a security benefit by changing it?
Is it valid to assume that the SSH host key is unrelated to FTPS/ SSL certificate changes?
Should the consider the unexpected change of the SSH host key as a bug in the used software?
Should we have to monitor our own SSH host key on changes?

Is changing the SSH host key a bad thing or is there a security benefit by changing it?

You should change it mainly if is has been compromised. Examples of such compromissions: an employee that could have knowledge of it is fired or leaves the company for any reason, you had to let an extersal support tech administrate the machine.

You could change it on a timely manner, but it should have a typical certificate lifetime, IMHO several years. That would allow to collect a possible undisclosed attach

  Is it valid to assume that the SSH host key is unrelated to FTPS/ SSL certificate changes?

AFAIK, yes

  Should the consider the unexpected change of the SSH host key as a bug in the used software?

I would considere that as a flaw in the administrative procedures: the key should be archived so that it can be restored after a (eventually partial) reinstallation

  Should we have to monitor our own SSH host key on changes?

A change of the SSH host key should never occur by accident. That means the the change should be prepared and all users warned of it some time before and the day it is done. The change should be noted in the operational log.


Assigning random IPv6 ranges to ISPs as a security measure Pinging all the IPv4 address space takes about 5 hours (and can generate beautiful maps). Port-scanning doesn't take much longer and can reveal vulnerable services, such as remote administration of routers with default credentials or misconfigured servers.

Assuming it scales linearly, scanning the IPv6 address space could take around 10 quadrillion years.

How feasible would it be to assign dynamic, random ranges of the IPv6 address space to ISPs? Those ranges could change every few days and clients would have their IP address change when the DHCP lease expires.

Most IPv6 subnets are no smaller than /64. It's not a protocol requirement, but it is de facto standard and also necessary for networks that run SLAAC.

Each of those networks contains 18446744073709551616 IP addresses, and, in each network, only a handful of those addresses will ever be used.

Therefore, even if you know exactly what subnets are assigned and which are unassigned, it's infeasible to scan even a single IPv6 subnet to find the host addresses that are in use inside that subnet. So making it hard to guess which subnets are assigned doesn't really help.

Put that together with the fact that even if ISPs must move their address blocks around from time to time, they must still document their assignments in WHOIS so that outsiders can find out who is responsible for a given IP address and contact the right abuse desk. We intentionally do the opposite of hiding IP network assignments!

Exceptions: if you guess an IPv6 subnet that is in use, you actually have better than 1/18446744073709551616 chance of finding an assigned IP address within that subnet. For example, if SLAAC is in use and who can guess the MAC address of a host on the subnet, you can generate its IP address. Privacy addresses mitigate this. Also, servers will often have well known, simple addresses like <subnet>::1 so you can guess those too (but then again, they're servers, so they're supposed to have well known addresses). Still, it's sufficiently daunting that I think it's still a futile task to try to "portscan" IPv6.


Basic questions about a buffer overflow attack example People say buffer overflows are serious security bugs that can usually be exploited.  Here is an artificial buffer overflow
#include <stdio.h>

int main(){
    int a[3]={0,1,2};
    printf("value = %d\n",a[10]);

}

I have two basic questions:

Does "exploit the buffer overflow" mean to change the code? If so, how to change the code above to make an attack?
What if the code is read-only? Can attackers still do something?

In order for a buffer overflow to occur, you would need to have a buffer that an attacker can input data into while exceeding the intended size of the buffer. The example code you shared does not contain a buffer overflow, but rather a memory leak/information disclosure vulnerability. When running the program, it will print out contents of the stack beyond your array, or potentially crash if it reads completely past the stack's memory region. Without any other functionality in the program, there is nothing to exploit; such a leak may be useful for defeating exploit mitigations but it is no good on its own.
The actual code segment that is loaded into memory is generally read-only, so most attacks do not involve trying to change it. Instead, attacks will redirect program execution to memory the attacker can write to, or reuse legitimate parts of the code to perform arbitrary actions.


Why is SYSTEM failing to grant SeTcbPrivilege? I'm attempting to grant a Windows interactive console process the SeTcbPrivilege privilege from a non-interactive SYSTEM process using OpenProcessToken(...) with TOKEN_ADJUST_PRIVILEGES.

Despite running as SYSTEM, the SeTcbPrivilege grant fails; as demonstrated by an audit failure in the Event Viewer when trying to perform an action with those rights and cross-checking with PrivilegeCheck(...). Granting the process SeDebugPrivilege and any other grants succeed.

My supposition is that this fails because of the 'Act as the part of the operating system' group policy, preventing even SYSTEM from granting this right to a non-SYSTEM process. Is this assumption valid, or is there some other hurdle that needs to be overcome? This is on an up-to-date, somewhat hardened, Windows 10 system.

For each of the possible privileges on a token, there are three possible states:

Enabled: The privilege is present on the token and is active.
Disabled: The privilege is present on the token, but not currently active.
Not present: The privilege was either not included when the token was created, or has been removed.

There is no way to add a privilege that the token doesn't already have. It sounds like that's what you're trying to do, though; take a token belonging to a process without SeTcbPrivilege, and add SeTcbPrivilege to it. You can't do that (not from user-mode, at least; a kernel driver presumably could). If SeTcbPrivilege is in the third state - either it wasn't there originally (because the process didn't have "Act as art of the operating system" when it was created) or it was removed by a previous call to AdjustTokenPrivileges - then what you're trying to do is impossible.

Without knowing more of what your end-goal is, I can't provide an alternative approach to the problem.


How can I be pwned if I'm not registered on the compromised site? I recently was emailed from HaveIBeenPwned.com (which I am signed up on) about the ShareThis website/tool (not signed up on).

I have no memory of signing up for that service.

When I go to recover the account (I might as well close/change password), I get this:

The two facts seem mutually exclusive:

Either I had an account and it was pwned, or I didn't have an account (and thus HIBP is in error)?

How do I find out the true situation, and what is the most secure course of action?

From the FAQ:

  Why do I see my email address as breached on a service I never signed up to?

  When you search for an email address, you may see that address appear against breaches of sites you don't recall ever signing up to. There are many possible reasons for this including your data having been acquired by another service, the service rebranding itself as something else or someone else signing you up. For a more comprehensive overview, see Why am I in a data breach for a site I never signed up to?

It's likely some services allow signing up without confirming an email address, or that accounts that haven't confirmed email addresses are still stored indefinitely but cannot be logged in to, or any number of similar issues.


Does a SIM card still require a PIN even after being deactivated by the SIM-providing company? For example, if I lost my SIM card (and stopped using it for years), and someone found it years later (after being deactivated by the SIM providing company due to extended nonuse), would the person who found it still have to enter the PIN code? Say I moved countries and stopped using the number.

Yes.

Provider companies does not cancel the SIM by sending some kind of data to it, instead they blacklist the identifier of it so celular instruments does not accept requests from that specific chip. Since unlocking the SIM card has nothing to do with carrier services and it occurs internally between the phone and the SIM, you can still access to data inside and even use it as a data storage.

However, it wouldn't be possible to access celular services.


Is this behavior the result of malware? I  have setup a new set of servers to test a software in Amazon EC2, and had set up my application. I've given it public access and a DNS entry, so its easily reachable by those that need to test it out.

Today I've found the following in the application logs (beside from the regular application requests):

GET /manager/html 404 2ms
HEAD / 200 1ms - 2.65kb
GET /manager/html 404 2ms
GET /w00tw00t.at.blackhats.romanian.anti-sec:) 404 1ms
GET /phpMyAdmin/scripts/setup.php 404 1ms
GET /phpmyadmin/scripts/setup.php 404 0ms
GET /pma/scripts/setup.php 404 1ms
GET /myadmin/scripts/setup.php 404 1ms
GET /MyAdmin/scripts/setup.php 404 1ms
GET / 200 2ms - 2.65kb
GET /w00tw00t.at.blackhats.romanian.anti-sec:) 404 1ms
GET /phpMyAdmin/scripts/setup.php 404 1ms
GET /phpmyadmin/scripts/setup.php 404 0ms
GET /pma/scripts/setup.php 404 1ms
GET /myadmin/scripts/setup.php 404 1ms
GET /MyAdmin/scripts/setup.php 404 1ms
GET /manager/html 404 2ms

I've been reading about software that makes these types of requests, and it seems to be just an automated tool to find vulnerabilities in the system.

Now, I know that only me and a second person have ever accessed this service, it is not published or mentioned anywhere else but Amazon. I also know that none of us is running vulnerability checking against the application.

So I wanted to know before I raise alarms, am I or this other person infected by malware?

No, this is definitely a scanner trying various URLs on the server to see which URL it can find.

For example, if it finds "/phpmyadmin/scripts/setup.php" it knows you have phpmyadmin installed, and where it's installed.  The attacker can then find the version, and run a known exploit to get access.

As for how they found it, it could be several ways:

Amazon has a certain IP block assigned for their use.  It's publicly known, so you could just hit each IP address in that block.
You could fuzz urls, using a dictionary of words and a dictionary of TLDs.
Google will have indexed the site, as Google is notified of all domain registrations (as per it's status as a registrar (See here for an illustration of the trouble it cas cause)


What is the risk of running VPN on VPS? Let me try to sum up this question; I want to buy VPS from (vultr - I'm not promoting them), but before that I'm wondering how secure is to run VPN on this kind (or any kind) of VPS in sense that I can endanger myself by choosing wrong company, which can tap/monitor my traffic.

I'm not trying to ask how secure is KVM virtualization, but which infrastructure is the safest for running a VPN, dedicated server, VPS (both are almost same, from my question perspective) or building own server or something else?

What is the risk of running VPN on VPS?

The main risk is that all traffic inside the VPN can be passively sniffed by the entity hosting the server.

Basically it is similar to giving someone physical access to a physical server. Actually the risk is a bit higher, because VPS could be passively replicated, so it's more like giving someone an unprotected, unlimited access to a real-time replica of a physical server.

All the secrets required to set up a VPN connection are stored on the VPS itself and the traffic can be easily captured, so whoever has access to the underlying virtualisation platform can utilise them to monitor the communication in real time or afterwards.

By extension, you also open your own (connecting) network to the party hosting the VPS. So if you were targeted, they could utilise this connection to get into your internal network, behind your perimeter defenses.

This of course should be addressed separately, regardless whether you were connecting to a hosted VPS or not, but the risk might be considered higher with VPS in comparison to a VPN on a device which you fully control.

The bottom line is: if you don't trust the company, don't do it. You are storing more vital information with VPN than if you used the VPS for other purposes.


How useful is CISSP to a recent graduate? I am a recent graduate and would like to move into the IT Security field. My degree was just straight CS with no particular security focus.

I have recently acquired a copy of a CISSP study guide and have started to work through it. Having discovered that candidates with less than 5 years experience can only sit the exam as an associate, I'm wondering: is it worth it at this stage in my career? Are there other certifications that would be more suitable for recent graduates?

The CISSP certification is intended to demonstrate two things:

Knowledge of the material in the ISC2 CBK, and
Significant real-world experience in the field

To an employer, a CISSP on a resume is supposed to mean that the application knows what s/he is doing and has demonstrated it with years of experience.

Note that an employer looking for a CISSP for an entry-level position does not know what they are doing.  It's like requiring 10 years experience with Ruby on Rails, which has only been around for 7.  Also, requiring a senior-level cert for an entry-level job probably means the compensation won't match the job's responsibilities.

While you could take the exam now and become an Associate of ISC2, that doesn't buy you much.  An alternative could be to take the less rigorous SSCP exam, which only requires one year professional experience, or the Security+ exam which is a good starting point with essentially no prerequisites.


Web Hosting companies asking for password in plain text Recently, on live chat, a representative of a web hosting company (will not disclose the company name for liability issues), asked me for my password to the server in plain text in order to verify the identity of the account holder (me)

He then proceeded to tell me that  "your password does match it" -- He's reffering to the password I sent him over HTTPS.

Should I be changing my password every time I make a support request?

Furthermore, they MUST be storing passwords for user accounts in plain-text somewhere, correct?

This seems like a major compromise of security for their customers

Being slightly in the hosting business I realize what you mean. To put it simply, it is extremely bad practice to ask clients to give their passwords in plain text but all companies do it. They either ask the full password or simply a few characters from the end.

My point is that, at some places like dedicated servers it's impossible to provide support without asking for the admin/root password in many cases, then again for shared servers the support should able to get right in with their own accounts.

I'm assuming at the least that he used your password to compare it to a stored hash, but security procedures can be flawed in many such hosting companies. I say this definitively because I know that cPanel, Plesk, etc do not store passwords in plain text, therefore he'd have no way to just "read" it.

You should however change your credentials every time you contact support. You should also write about this on an open forum so that the host takes a good initiative to prevent such malpractices as they can easily use a secondary question answer or a phone call, etc to verify one's identity.


IP address filtering vs web application security We have a web application behind a firewall that requires no user authentication.

If we open up access to this application via the firewall to a small list of IP addresses what is the risk of unauthorized access from other hosts?

Is there a risk to the web server and other hosts behind the firewall.

If there is a risk what else can be done to minimize the risk?

If you're using IP only authentication, attacker can still use the web application through pivot attacks against a host that is allowed by firewall to access your application.

For example, let's assume your application is inside intranet (http://192.168.0.5) and one of the clients (192.168.0.100) is browsing the internet and visits a malicious web page that does intranet fingerprinting, requesting http://192.168.0.x/ (x=0..255) URLs through the victim (192.168.0.100) browser, effectively finding IPs with port 80 open and reporting them to attackers. Attacker can do it e.g. with BeEF framework. Later on, using the victim browser like a proxy, attacker can issue requests to the target application (http://192.168.0.5). There even is a framework for detecting what types of software do you have installed in the intranet - e.g. Yokoso. Using these will make further attacks easier.

Of course, attacker can also attack OS on one of the clients (e.g. with spear phishing or drive-by-download attack), so that he has more possibilities to attack the intranet application and is not restricted by Same Origin Policy.

If you're allowing access to the application only for some hosts in the same subnet (and other hosts are denied access), internal attacker has more possibilites because he has more knowledge (e.g. he might know the exact URLs for the application, it's version number) and is within the same network, so he can try e.g. ARP spoofing attack to hijack traffic between application and one of allowed clients.

I would recommend hosting the application only on SSL (to protect from man-in-the-middle) and adding login/password authentication (either cookie-based or a simple HTTP authentication)


Risk when attacker has only physical access to a computer's USB port Attacker has only access to USB port and can either attach a device or pen-drive to a computer, that can be on or off. Imagine a scenario where non-reliable people have access to offices, either because they clean after-hours (off scenario) or because they sit near the running computer (on scenario) but only that, what is the risk to this computer? Could you connect a pen-drive to it when the computer is turned off and run some malicious software on it? If the computer is running, can you connect a cable to this USB port and extract some information?

If a USB port was available, any attack could potentially trick the computer into believing a small plug was a keyboard, making it possible to save and run scripts on the computer.

They could also run a program on your computer by using the Autorun feature on your computer, although that feature could also be disabled.

Practically anything can be done, but it's dependent on whether or not the computer will allow it to be done.


Setting up a remote test environment correctly My setup:

- Main Box (connected to network)
  - VM1 : Linux
  - VM2 : Windows 7

Both the VMs are running off VM Player and using Bridged: connected directly to the physical network and replicating the physical network state. The user will connect to the Windows 7 box via a remote application like LogMeIn then have access to the Linux box as well via the Windows box to development testing.

This however would in turn give them direct access to my personal inside network as well if I am right. Is there a way to set this up and prevent that?

If we treat this like a networking problem, one solution could be as follows;

    internet
       |
   adsl_router
       |
    -------------------------------
    |              |              |
firewall      dirty_host_a   dirty_host_b
    |
    |
    --------------------------------------
    |                  |                 |
clean_host_a      clean_host_b      clean_host_c

In order for your clean network to remain safe;

Forward whatever ports you like on the router nat to your dirty hosts.
Configure your firewall to disallow all inbound connections.
Configure your firewall to only allow administration from the LAN side.

The 'firewall' node could be an actual hardware firewall, like a netgear FVS338, or a linux machine with two network interfaces, coupled with a switch and running iptables. Whatever you have lying around.


How to exploit the "PHP_MAGIC_QUOTES ON" vulnerability in order to cause max damage? I've found a whole lot of SQL injection exploits in some systems I maintain. I know how to prevent the injection, but I would like to demonstrate to my CEO and CTO how dangerous it is if we don't have enough focus on keeping our applications safe.

Many times we need to react instead of proact when it comes to security, mainly because when a vulnerability is found it is not prioritized to be fixed because its unlikely to be exploited.

The following query is one of these examples. The server is running with PHP_MAGIC_QUOTES ON (yes I know thats really bad) and thus prevent exploits several places because the programmers have explicitly added ' ' around everyone input value used in queries (so you cant break out of it). The query I've found vulnerable now is however treated as an integer instead of string, and contains no ' ' around it.

Here is the example:

$sql = "select * from vulnerable_table where id = " . $_GET['id'] . " limit 1";
$result= mysql_query($sql);

How would you do max damage to the system considering you control the id variable.

Some examples I've come up with on my own:

id = 1;drop table mysql.user
Only if semi colon is accepted

id = 1;SELECT '<?php exec($_get['cmd'])?>' INTO OUT_FILE('/var/www/backdoor.php')
Only if I could bypass the magic_quotes somehow

In PHP you cannot stack querys with a semicolon. However you can nest a query into another with parentheses (commonly called subqueries), e.g.:

SELECT * FROM vulnerable_table WHERE id = (SELECT number from other_table)

Using this technique (disregarding whether you output your SQL result or not) a keen attacker may extract all data from your database.

Example (with output on the web page)

SELECT * FROM vulnerable_table WHERE id = (SELECT group_concat(table_name) from information_schema.tables WHERE version = 10)

This query will result in a list (as a string) of all user-defined tables in your database.
Further queries will reveal the columns and let the adversary gain full knowledge of your table structure (for example: "tbl_accounts, tbl_passwords, tbl_guestbook").

If you don't give any output on your web page an attacker might still inject a conditional (think: case-when) statement with his SQL subquery, which will result in an SQL error in one case and no error in the other case. Deriving from "no output at all" and your normal webpage you can gather 1 Bit of information and perform a binary search through your database.

Generating strings in an SQL query like the one you suggested to upload a PHP-Backdoor (depending on whether the current MySQL user has the FILE privilege, which he shouldnt ;)) is also not that hard to come by: Using the ascii(), and ord() functions you can just create your strings with integer inputs. Also a value like 0x414141 will automatically converted to 'AAA' in MySQL.

Regarding very advanced attack and filter evasion techniques I also recommend you to read Reiners' blog on SQL security: http://websec.wordpress.com/

For completeness's sake: To fix this vulnerability, you can just perform a typecast and transform $_GET['id'] to an integer.


Degree of Obfuscation Let us assume that I have the following code:

namespace MobileApp
{
    public class Storage
    {
        public Storage()
        {

        }

        public bool Save()
        {
            bool success = false;

            try
            {
                var settings = IsolatedStorageSettings.ApplicationSettings;

                if (settings.Contains("AppInformation7563"))
                {
                    settings["AppInformation7563"] = "GG3MDhlxnZDdDx7";
                }
                else
                {
                    settings.Add("AppInformation7563", "GG3MDhlxnZDdDx7");
                }

                settings.Save();
                success = true;
            }
            catch (Exception)
            {
                success = false;
            }
            return success;
        }

        public string Load()
        {
            string app = "false";

            try
            {
                var settings = IsolatedStorageSettings.ApplicationSettings;

                if (settings.Contains("AppInformation7563"))
                {
                    app = settings["AppInformation7563"].ToString();
                }
            }
            catch (Exception)
            {
                app = "false";
            }
            return app;
        }
    }
}

Basically, this code stores a secret password in Windows Phone isolated storage so that this password is passed whenever a web service call is made.

If I obfuscate the code using DotFuscator, will the "AppInformation7653" and "GG3MDhlxnZDdDx7" be obfuscated as well?  Or will they remain the same, just the names of the classes and variables are changed?

Thank you very much :)

DotFuscator will "encrypt" string literals, although I cringe at the use of the word "encryption" in that context. Your string values "AppInformation7653" and "GG3MDhlxnZDdDx7" won't appear "as is" in the resulting assembly, but the code necessarily contains everything that is needed to rebuild their respective values at runtime. So don't believe that such obfuscation will actually thwart reverse engineering; it may just deter the least motivated or competent of attackers, but skilled attackers will just laugh at your feeble attempts at obfuscation.

As usual, code obfuscation is more about giving a feeling of security than actually making things more secure. The real value of obfuscation is that it demonstrate your intent of keeping the code internals somewhat secret, which can be handy in some legal situations (a reverse-engineer will not be able to claim that he "didn't know", in good faith, that the code was not supposed to be scrutinized that way). As will all things legal, this may or may not work in any specific jurisdiction, and I am not competent to give any specific legal advice anyway.


Antivirus, antimalware and antispyware software. What is the difference? What is the difference between antivirus, antimalware and antispyware software? If any clear distinction can be defined.

I don't think this is the definitive definition of them, however I would say the difference:

Antivirus searches for 100's of signatures of well-known viruses, regardless of what file they're in.
Antimalware searches for lists of known evil programs. (Perhaps there are smarter products that actually search for programs that do bad stuff, I'm not familiar).
Anti-spyware I think searches for registry keys, 3rd party cookies, and other tracking devices.
Also should mention anti-rootkit, these search specifically for malware that is designed to hide from the operating system (and thus standard anti-malware).

As you said though, not sure any clear distinction still exists, since most of the vendors are effectively packaging the different scanning engines in single product or suite.


Download an OS image via torrent If you take the Ubuntu alternative download page for example, there, you have the possibility to download the OS also via torrent. Being a peer to peer where files are stored on anyone's machine got me wondering on just how safe would that be compared to downloading an OS image directly from the provider website? Be it for desktops or even for servers where the implications of a security breach in the OS would be huge.

I'm a bit surprised that there's no signature hash that you can use to verify your download...

  BitTorrent

  BitTorrent is a peer-to-peer download network that sometimes enables
  higher download speeds and more reliable downloads of large files. You
  will need to install a BitTorrent client on your computer in order to
  enable this download method.

file piece ("chunk") hashing is actually an essential, core feature of BitTorrent (the downloaded pieces are immediately and automatically verified), and a part of the BT protocol - the .torrent file contains the hashes needed for verification. So, unless the .torrent file is altered by an attacker (which is a very different issue), the integrity of the files is verified while they are downloaded, automatically (and invalid parts are silently discarded).

So: if you trust the source of your .torrent file (which is always questionable for a plain HTTP connection, plus see the Mint incident with hacked site), the subsequent download is indeed the same as the source claims.

Even so, if you want to verify the integrity later,

the signature hash for an ISO is the same regardless of download method - see e.g. http://cdimage.ubuntu.com/releases/15.10/release/SHA256SUMS and http://cdimage.ubuntu.com/releases/15.10/release/SHA256SUMS.gpg for the 15.10 release hashes and signatures.

See also: Is Torrent safe for sharing legitimate files (file verification)? Does it use SHA1 or SHA256?


How to know an Apache web server mod_cgi module is enabled? I am currently working on penetration test of a web site that uses an Apache HTTP server. To test a vulnerability which is related to mod_cgi module, I need to know whether this web site uses mod_cgi module of Apache or not? How can I determine this?

The first place to look is the server header. Depending on the server configuration it may report all enabled modules. Alternately you can use a specially formulated request which will provide a less reliable detection. The AddHandler directive allows a script to answer with a non 501 response to incorrect HTTP verbs. I'm using this technique in my Apache profiling script (aprof) from my lbmap project: https://github.com/wireghoul/lbmap