Why aren't mixed-content connections allowed on localhost? Recently I had to redo something at work. It involved a servlet on Tomcat that accepted requests from external users (Connection A), which in turn connected via SOAP to a Web Service on the same box (Connection B). If Connection A used a secure connection, Connection B had to use one as well, otherwise my servlet would keep throwing connection errors and logging that the connection was reset. When I used an unsecure connection for both, they worked  fine, so it was a certificate issue in the lab.

In general, I understand why mixed-content connections are discouraged or just refused by the client. But given that this was explicitly sent over localhost, it struck me as a bit of a hassle. So, if a connection is over localhost, why is this still neccessary?

Mixed-content requests are generally discouraged as they leak information about secure content over insecure channels.

Localhost isn't considered special in that regard.  In fact localhost can be seen as a higher risk since a page being able to load something on localhost could bypass the browser sandbox.


What kind of attacks can target static resources? Static resources and their caching interests me from the security perspective. Let's say we have an .jpg file requisted from the origin -> going through a reverse proxy with caching -> reaching the browser (and is also cached).

What attack vectors can be exploited here (assuming all possible misconfigurations of the server, errors in the code and such).

Here are some issues about static resources (SR) that I can think of:

SR that are not served via HTTPS in combination with cookies that don't have the Secure flag will leak the respective sensitive cookies and also cause browser warnings
JS resources that are not served via HTTPS can be modified by an attacker with a privileged network position and can be made to be stored and used on the client for a long time
JavaScript SRs can have vulnerabilities like XSS, DOM XSS and open redirects. Most old JS libraries introduce vulnerabilities.
Flash files can also be vulnerable to XSS, open redirects and others like HTML injection and Cross Site Flashing
Leftover SRs can leak information and indicate the version of a framework
Unlinked SRs can leak sensitive information if the attacker can guess its name. ex: 2010_price_offer.jpg, final_offer.jpg vs draft_offer.jpg
SRs with predictable names and no proper authorisation can leak information. ex: profile_picture10.jpg, profile_picture11.jpg, profile_picture12.jpg, etc
Verbose errors when accessing static resources or invalid resources can leak info such as internal paths and webservers used
A SR that is available only to a logged-in user can leak if the user is logged-in or not. See http://www.tomanthony.co.uk/blog/detect-visitor-social-networks/
A large-ish resources can be targeted in a denial-of-service attack. Imagine including a large 10-20 MB picture from the targeted server in a high traffic website.
If a SR is controlled by the attacker then it opens the door to all kinds of vulnerabilities

resources can be made to look like an image and also be something else. ex: Gifar
if the server doesn't specify a content type of the SR, some browsers will attempt to guess it and be manipulated
etc.


Web application firewall using machine learning and how to implement it I want to create a web application firewall from scratch. I am going to use machine learning to train it to classify malicious and clean queries. My dilemma is that I am a beginner and am unable to choose which language to code it n and also should I make it a reverse proxy or as a server plugin?

It is an idea that everyone in security is hoping to solve sooner and better than the others! Of course there are also people who say it's an overkill for a WAF. But hey, All the best! :)

  unable to choose which language to code it in

I'll assume that you did study ML (not just read about it) - in which case you may have used some ML libraries and done some coding.
If your milestone goal is to get a working prototype / POC, you should just choose the language that you used while learning.
This is a challenging project and you don't want to add "learn a new language" to the list of challenges.

  reverse proxy or server plugin

Again, choose what you are familiar with. That will get you soonest to the goal of a minimum viable product (MVP).
e.g., When we developed our product ActiFend, our development team was already familiar with WordPress Plugins, so for an MVP, we chose that path - and got something to show in weeks instead of months. It's another matter that we got stuck there for a long time now (scope creep), but if I were to choose again with hindsight, I'd do the same.

It won't matter whether you are just a one-person-army doing this or you have a large team. As an Agile practitioner and evangelist - I say: get something small working ASAP.


How to practically detect current system net traffic? I know that some viruses or trojans can install rootkits or bootkits to change system's  normal behaviour; AFAIK for example filter queries for running processes or even hide active TCP ports.

My question is consider a system in which an imaginary virus/trojan installed on it that has a C&C center and this malware installed a rootkit that hides it's transmitting port. How can I detect (please suggest a program) REAL open ports on this system or detect what applications are connecting or transmitting data?

You can't. Once your machine is infected with a rootkit / bootkit, it's no longer your computer. The malware has control of all system calls, so you have no way of identifying spoofed results. At best you can use an external device to identify what traffic is going in/out of the box.

If you're lucky, something like tcpview will trace particular TCP sockets back to a process, but you cannot possibly know whether a rootkit is spoofing such traces.


Isn't OS X's Single-User Mode a bad idea? Recently, I had a Mac which fried its video logic board. Luckily, Apple had concluded that this was a design flaw and was fixing the affected models for free (see more here). However, I did not find this page for a while, and during that time had to think about recovering my data. So, I looked around the interwebs and found single-user mode.

When the computer is off, press the Power On button while holding the down the command and s keys. Keep holding these down, and instead of booting to the Apple loading screen, it boots to the underlying Unix terminal. Once there, you can enter the following commands:

mount -uw /
cd /Users/
ls

And all of the users' home folders are displayed. Continuing to cd into these folders and ls to view contents, you can browse all of the users' files, without needing a password.

I then found that you are also able to plug in a USB stick and copy files to it (or from it), or perform actions on the files such as move and delete.

While this was helpful for me recovering data from my fried Mac, how is this a good idea? If I ever got hold of the MacBook of a friend and it was locked, I could just shut it down, boot into single-user mode and mess with their files - or even make a copy of them to a USB stick for later use. Macs are used by many people, a lot of whom have very important files that they need to protect.

This obviously isn't a bug, as Apple has a support article on how to enter single-user mode. I also know that one of the original purposes of single-user mode is to reset your password if you lost it, but giving access to the entire computer through the command line does not seem like a good way to go about it.

So, is this a problem? Is single-user mode bad? As far as I see it it is a security hole, but I could be missing something.

Physical access is total access, right?  How is this any worse than a boot CD or yanking the hard drive and popping it into another system?

Not that I'm a fan of OSX or this particular feature, but if someone has physical access to a computer with an unencrypted disk, they have access to everything on that disk anyway, so single user mode doesn't make that any worse, either.


Tomcat IP restriction vs Two Legged OAuth We have a server side API that is completely REST based. We are coding to secure them with two legged oAuth type authentication. We are planning to iPhone and Android apps in the future, but for now, we have a client application that will be allowed to connect to our server APIs. The UI and back end (REST) may be on the same server or different server.

My front end team tells me that given that this is an internal app, we don't need to secure them with oAuth, just as we would not need a key for each room of our own house. We can just use Tomcat IP restrictions as to what servers/IPs can access these APIs. It would be unnecessary and overkill to use oAuth type authentication for internal apps.

Is my front end team right? What is the advantage of securing REST APIs with oAuth for internal apps? We don't plan to use SSL initially, as this is a consumer, SaaS application

Are you talking about the authentication between users and the front-end app? or the front-end app itself and the backend?

I guess as with almost anything security related, it depends. You'd need to consider the value of the data available through this app, and compare it with the exposure it might have to compromise (external but also internal). It might or might not be sufficient using source-IP filtering, or even OAUTH, depending on this risk profile.

As for the analogy with the keys to the rooms in the house. True, you don't normally need keys to every room in the house, but when you go to the toilet, you might want to lock the door, just in case someone walks in on you. Or if you want to store the precious necklace your grand-grandmother used to wear, you might want to consider putting it in a safe. Or when you have lots of guests at a party, you might put all the expensive china in a storage room and lock it away and only leave paper cups... hope you see where this is going (and don't forget to invite us to the party!)


Network Concerns Over a MITM Attack If my website is hosted on a network of hundreds, possibly thousands, of computers wouldn't an attacker have to gain control of just one of them in order to conduct a MITM attack on my website considering that I do not use any form of SSL encryption?

If you are somehow conducting administrative tasks via unencrypted methods everything is in plain text. I hope you could not or would not do that over the internet. (chances are you ssh into that server for these tasks) However hypothetically speaking if this was the case and someone somehow sniffed your traffic or somehow got between you and your web-server (via MITM), then yes its totally possible. All your commands, passwords and html are right there in plain text ascii.


Static vs Dynamic Linking I came across DJB's Curve25519 implementation site (https://cr.yp.to/ecdh.html) and noticed he states in reference to using it:

  You can and should include it in your own programs, rather than going to the effort of linking to a shared library; the compiled code is around 16 kilobytes, depending on the CPU

I assume by this he means to static link the lib in your program which seems odd to me from a security perspective. Would it not be safer for your crypto code library to be a shared lib so if there is ever an implementation vulnerability it would be much simpler to patch it instead of recompiling all the dependent programs?

Using a shared library is a good idea for getting security fixes without having to recompile all the applications that use the library -- but this holds only if there is indeed a shared library that several applications use, and that is actively maintained by somebody else.

In an ideal world, you would not even download the source code for the Curve25519 implementation. You would use the OS-provided package that contains the shared library. If a bug were to be found, it would be corrected upstream and the packager would publish a new, fixed version, that your application (and others using the library) would automatically benefit from the fix. It would have similar benefits for performance (e.g. if a new, faster implementation more optimized for your current hardware is produced).

However, such a package does not exist for the moment. DJB does not appear to be willing to maintain such a package, for any version of any OS (in fact he has been quite vehemently opposed to how most if not all package managers work; he also expressed misgivings about shared libraries). If you use the code, then you are importing it in your application, and the maintenance effort, i.e. keeping track of changes and propagating fixed versions, will fall squarely on your shoulders. Even if you make it a shared library, it will still be your shared library, not shared with any other application. You might as well link the code in; it won't change things for security, and it will be simpler.


Best practices for firewall exceptions My company has a firewall set up which, among other things, scans incoming files for malware. The scanner alerted about a malicious file that was downloaded to one of our machines. After some investigating, I learned that this is a program that is necessary to one of the core functions of our company and needs to be downloaded periodically. Rather than adding the remote IP address as an exception in our firewall's malicious file scanner, I wanted to see if there are general best practices for handling firewall exceptions. It seems like any exception you add is exposing your network to any vulnerability on the remote network.
Is there a widely accepted best practice for deciding whether to add an exception to the firewall versus instead fixing the file or program? If you do end up adding an exception, what are some ways to minimize the possibility that that exception can be exploited?
I'd love any insight on the issue itself, or how the question could be improved. While I'm interested in security, I have very little practical experience with it.

There is no best practice, it's entirely based on a risk assessment. Risk is typically a relationship between Impact and Likelihood, lessened by Mitigations. Mitigations lower the Impact and/or the Likelihood. Each scenario and context for risk is different, which is why there is no one way, or best practice, to look at the problem.
Then you start brainstorming the effects of mitigations:

What could happen if you did not do mitigation X?
How much does X cost (in money, effort, etc.)?
What other risks get introduced by doing X?
What can be done to minimize those risks?
... repeat ...

But as a part of all that, you need to look at the operational impact of doing X at all.
You have an anti-virus on the firewall that is impacting critical business function every once in a while. You are worried that an infected file might slip through.

How often? Can you mitigate by manually extracting the file and distribute it yourself to those who need it?
Can you whitelist the file and confirm that the file is the approved file from the source? (checksums, signatures, etc.)
Can you add a temporary exception or do exceptions need to be permanent?
Can you scan the exempted file using a local anti-virus?

These are all questions with different impacts on your business function, and the likelihood and impact of the exemption causing a problem.


If hackers know my android app license key , can they redirect the in app purchases of my app to their account? I have published an android app with in app purchase. I failed to encrypt XOR my licence key. If hackers have my license key can they redirect my payments to their account or just they can by pass in app purchase ?

Knowing your app key doesn't give any control over your developer account or payments, it is supposed to identify the app, AFAICT.

Also, XOR encryption in app code is merely obfuscation, a poor form of DRM.

If they can extract the key, they might also be able to locally manipulate the app to bypass restrictions on paid features.


Silent (no user interaction) utility to clear cached credentials on Windows Is there any way to clear cached credentials on Windows, that doesn't require:

user interaction (e.g. a confirmation window);
administrator access; or
making a persistent change to the configuration, such as tampering with the registry?

A function implemented in a DLL is fine, I can write a small utility around it.

Who wins there — accountability or privacy?

The short answer is "no".

Cached credentials are maintained in special Registry keys.  These keys are only accessible by the SYSTEM account.  In order to impersonate the SYSTEM account, you must have Administrator access to the system.

You might be able to write a script or something that can bypass #1.  However, in the absence of any flaw in the OS (which cannot be reliably presumed, since it would likely be patched at some point), you cannot likely avoid #2.  And, since the cached credentials are stored in the Registry, #3 is non-optional no matter how you want to do it.

I believe you can get away without using the SYSTEM account, by modifying the configuration options that define how the system handles cached credentials instead of messing with the cache itself.  However, this will still violate your #2 & #3 requirements because the options are stored in the Registry and do require Administrator permissions to modify.  Additionally, it may require one or two re-logins or reboots to be effective.

Sidenote:  This question, as currently written, is perhaps more appropriate for Server Fault or Stack Overflow.  Nevertheless, the answer remains the same.

EDIT:  For more information about where the cached credentials are stored and how to modify settings which affect them, you may want to check out my related question on ServerFault.


How Secure are Virtual Networks When using a Virtual Network, is it possible to infect the underlying Network infrastructure with malware from the Virtual Network.  How safe is the use of Virtual Networks?

Because virtualization software is not perfect, it is in some cases possible to escape out of the virtual environment and do bad things on the host.  It is important to keep your virtualization (and other software) up to date, because security patches to prevent this attack are sometimes released.  I believe that malware could indeed then be put onto the host network if other vulnerabilities were exploited.  So, yes, I believe it would be possible... however, it would be very difficult.  This would be a significant hurdle that should keep most attackers out of the host network.  I believe virtual networks are a great safety measure to take, as long as the security implications are considered.

Another attack to consider (not quite malware on the host network) is a Denial of Service (DoS), or Distributed Denial of Service (DDoS) attack in which network traffic is flooded.  If the virtual host shares the same network resources with the host network, then if the virtual network is flooded with traffic, it would also flood the host network, bringing both to a crawl / halt.


Which ciphers produce random cipher text? I already know AES produces a "random" output.
5e4e6440826d6afc4535fbf078455f791159701a9df624ddd4e4dda84523b6a7
Its cipher-text doesn't follow a pattern and is indistinguishable from noise.

Is this common in most cipher-texts?
What are some other (specifically fast) examples of ciphers?

All modern ciphers aim to produce what looks like random data - it's one of the core principles of information theory.

Ciphers that don't produce apparently random looking data tend to have fairly serious flaws, since this provides an avenue for attack - going back to pre-computer ciphers, enigma had this issue, and fell, in part, due to pattern recognition (specifically, someone spotted that A could never map to A, reducing the search space significantly, among other issues).

Any reasonable modern block cipher should be both fast and generate apparently random data, if used properly.


Claim Based Authorization vs Attribute Based Access Control Is there a difference between Attribute Based Access Control which is usually associated with XACML and Claim Based Authorization which seems to be a term coined by Microsoft?

Is the latter simply Microsoft's name/implementation for ABAC? Or are the two completely different concepts?

I came across both terms during my research and they seem like similar if not identical things to me, but maybe I am missing something? Are claims and attributes just different names for the same idea?

Attributes:

  Attribute-based access control defines a new access control paradigm whereby access rights are granted to users through the use of policies which combine attributes together. (Wikipedia)

Claims:

  Claims-based authorization is an approach where the authorization decision to grant or deny access is based on arbitrary logic that uses data available in claims to make the decision. (MSDN)

ABAC and CBAC are practically the same thing. Microsoft doesn't call things attributes, but refers to them as claims because attributes tend to be associated with SAML whereas claims are mostly protocol agnostic.

XACML is a model/implementation that exposes ABAC, whereas there isn't any concrete CBAC model or implementation -- not from Microsoft anyway. This is mostly because generic authorization models are a pain in the butt and overly complicated, and the gist of the guidance was that each application is different permissions-wise so you should figure it out on your own.


Can one use IP-spoofing to anonymize DDOS attacks? Since it is possible to fake the source IP of a packet, is it also possible to anonymize DDOS attacks?

The other answers seemed wrong to me, so here is my attempt.

Yes.

This is very common, and has recently seem attacks in the rage of hundreds of gigabits per second. The idea is not to spoof your IP to the target machine, but to spoof your IP to an intermediary that returns data back to your spoofed IP (target).

It is generally not very easy to spoof source IP addresses, so having a direct distributed DOS against a target (i.e: SYN Flood) using all fake addresses would be very difficult. If you are able to spoof a few addresses, you would have the best luck abusing a service that would result in an amplification (DNS, NTP). So the purpose of spoofing the address here is not to hide your IP, but to make the intermediate think you are the victim, flooding them with unsolicited responses.

The attack would go something like this:

The attacker spoofs the victims IP address, and sends a 60 Byte DNS request to an open resolver.
The resolver responds to the victim's IP, a 4000 byte TXT record

Here is some more info on recent attacks:

https://www.watchguard.com/infocenter/editorial/41649.asp

http://blog.cloudflare.com/deep-inside-a-dns-amplification-ddos-attack


Why can't just any program use his own file-system-access-system? This may sound stupid for everyone who knows more than me about the UNIX-System and security in software:

Imagine you have a program trying to cause harm by deleting files. You just do something like "rm -rf /home/" and get an error message, because rm checks whether you are allowed to delete this directory or not and stops if you are not allowed to.

So far, so good.

Now, what exactly is stopping the virus-programmer to use his own "delete"-method? Why must he rely on system calls and cannot simply use his own methods to achieve his goals?
He could write a delete-method that just doesn't check for rights and deletes anyway, couldn't he?

Another example would be file-editing. Why can't an attacker just write his own read-write-mechanisms that do not check for rights and use them to edit files?

So: What exactly is it that forces the evil-program to stay in the sandbox the OS is providing?

During system boot, the OS takes exclusive control of a lot of privileged operations and becomes the gatekeeper.  The CPU and other hardware itself will only listen to the trusted process (the kernel) that has been given the keys to the kingdom.  This means that in order to do things like get access to most system resources, the application has to actually request this access through the OS.  The OS actually does the requested behavior, not the application.  The application could try to make direct requests to hardware (which would have to be hardware specific), but since it isn't the kernel, the requests would be ignored if they are trying to access anything that is privileged to the kernel.


Are there security design weaknesses in the EFF Sovereign Keys proposal? In response to SOPA and a number of high profile security breaches at certficate authourities in 2011, the EFF has released a soverign keys proposal:

https://www.eff.org/deeplinks/2011/11/sovereign-keys-proposal-make-https-and-email-more-secure

As a security community can we see any design flaws and proposed changes in this proposal that we could feedback?

this piece bugs me...

  In practice, we expect many domains to use a third-party service
  provider for Sovereign Key management,3 but the domain holders can
  choose exactly which if any such parties they wish to trust.

So there will be a handful of Sovereign Key Management (SKM) companies similar to the handful of Certificate root companies now. They will charge an exorbidant fee to store your Key for you, and half the websites won't do it. THEN the browsers will (instead of blocking the invalid key) have to default to a "The Sovereign Key for the website you are attempting to access is invalid. Would you like to continue to the website anyway?"

How is this different from what we have now?


Anti-sniffer for USB I'm looking for a Windows utility that can list all drivers, driver-filters, services, sniffers and other information for a selected USB port.

I want to check if my "USB connection" is confidential.

You can look for strange USB device IDs with USBDview or USBView.

  USBDeview is a small utility that lists all USB devices that currently
  connected to your computer, as well as all USB devices that you
  previously used.  For each USB device, extended information is
  displayed: Device name/description, device type, serial number (for
  mass storage devices), the date/time that device was added, VendorID,
  ProductID, and more...  USBDeview also allows you to uninstall USB
  devices that you previously used, disconnect USB devices that are
  currently connected to your computer, as well as to disable and enable
  USB devices.

USB View is similar.

Other methods to defeat hardware key-loggers:

while typing sensitive information like passwords, after a few keys
of the password, use your mouse and point to a different location the
type some keys and then go back to the password field. This ways the
key logger doesn't know which keys are useful and which are not
use a password manager like LastPAss that fills in passwords
use a virtual on screen keyboard
use one time passwords or security tokens to make your passwords unique

usean on screen keyboard for sensitive data


Has it been mathematically proven that antivirus can't detect all viruses? What analysis was Bruce Schneier referencing when he wrote:

  Viruses have no “cure.” It’s been mathematically proven that it is always possible to write a virus that any existing antivirus program can’t stop.

From the book Secrets & Lies by Bruce Schneier, page 154.

Under one possible interpretation of that, it's a result of Rice's theorem. A program is malicious if it performs some malicious action, which makes it a semantic property. Some programs are malicious and some aren't, which makes it a non-trivial property. Thus, by Rice's theorem, it's undecidable in the general case whether a program is malicious.


Secure SSH host keys I am trying to fix my SSH setup on Fedora and RedHat with ssh-audit.

I managed to fix the ciphers and algorithms by setting

KexAlgorithms diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,curve25519-sha256@libssh.org
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com

in /etc/ssh/sshd_config

The audit tool is still complaining about the host keys that should be re-generated:

# host-key algorithms
[...]
(key) ecdsa-sha2-nistp256            -- [fail] using weak elliptic curves
                                     `- [warn] using weak random number generator could reveal the key
                                     `- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62
[...]
# algorithm recommendations (for OpenSSH 7.9)
(rec) -ecdsa-sha2-nistp256           -- key algorithm to remove

I then recreated the Diffie-Hellman moduli and generated new keys

rm -fv /etc/ssh/ssh_host_*
ssh-keygen -G moduli-2048.candidates -b 2048
ssh-keygen -T moduli-2048 -f moduli-2048.candidates
cp moduli-2048 /etc/ssh/moduli
ssh-keygen -A

The audit tool is still complaining. How could I use a better random number generator? I can I exclude ecdsa-sha2-nistp256 by the key generation?

All of the curves used by ECDSA keys are considered weak. Just delete the ssh_host_ecdsa_key and ssh_host_ecdsa_key.pub files without replacing them, and/or comment out the entries for them in sshd_config. The only kinds of keys worth having are RSA and Ed25519, and you should already have them.


Enabling SSLCompression in apache I am trying to enable SSLCompression in apache (localhost) for testing purpose.

My apache version is 2.4.18 and I have added the SSLCompression on line in both apache2.conf file and my .htaccess file. But still I cannot enable it.

I have downloaded the following version of openssl
https://www.openssl.org/source/old/1.1.0/openssl-1.1.0-pre6.tar.gz

I am using openssl to generate the certificates and test it. When I run the command

apps/openssl s_client -connect localhost:443

I get the following response

SSL handshake has read 2625 bytes and written 310 bytes
Verification error: self signed certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:

where it says I do not have the compression enabled. Can anyone tell me where I am doing wrong?

FYI I have enabled mod_rewrite and mod_deflate modules in apache2.

According to OpenSSL 1.1.0 release notes:

  CRIME protection: disable compression by default, even if OpenSSL is
       compiled with zlib enabled. Applications can still enable compression
       by calling SSL_CTX_clear_options(ctx, SSL_OP_NO_COMPRESSION), or by
       using the SSL_CONF library to configure compression.

As a consequence, OpenSSL must be compiled with the good option and Apache needs to enable compression the right way...

I suggest you to use an older branch previously compiled with zlib option. For instance using Ubuntu 16.04:

cd /tmp
sudo apt-get build-dep openssl
sudo apt install zlib1g-dev zlibc
apt-get source openssl
cd openssl-1.0.2g/
sed -i -e "s/no-zlib/zlib/g" debian/rules
dpkg-buildpackage -rfakeroot -uc -b
cd ..
sudo dpkg -i libssl1.0.0_1.0.2g-1ubuntu4.2_amd64.deb libssl-dev_1.0.2g-1ubuntu4.2_amd64.deb openssl_1.0.2g-1ubuntu4.2_amd64.deb

This, keeping SSLCompression on in Apache, should do the trick I think.

EDIT: After testing, it appears to be working:

root@test# echo "" | openssl s_client -connect 127.0.0.1:443 | grep zlib
...
Compression: zlib compression
Expansion: zlib compression
    Compression: 1 (zlib compression)
DONE


Host Testing Automation in Kali using Python I posted the following question link on stack overflow and it was pointed out that I should possibly forward it to security exchange. For convenience the question is re-iterated below:

I started creating a script to automate host setup testing in Kali using python. I would like to know if there are any other "scans" that I am missing or that could be done in order to retrieve more information about a specific host?

I would also like to know if any of the current scans can be improved?

The code thus far is shown below:

   #Automate test startup using IP Addresses
import os

def runTerminal(command,name):
    os.system("gnome-terminal --tab -e 'bash -c \"" + command+" > "+name+"\"'")

testName = raw_input("Enter the name of the current test: ")

URL = raw_input("Enter the URL: ")
print "Current test: " + testName + " using host: "+ URL

initialURL = URL.split("://",1)[1]
if ':' in initialURL:
    port = initialURL.split(":",1)[1]
else:
    port = 0

shortURL=initialURL.split(":",1)[0]

print "URL : " + str(shortURL) + " Port: " + str(port)

#Scan web server for known vulnerabilities
print "Running Nikto..."
niktoCommand = "nikto -h "+ str(shortURL)
runTerminal(niktoCommand,testName+"Nikto.txt")

#transfer a URL or get basic headers
print "Running cURL..."
cURLCommand = "curl -kv "+ str(initialURL)
runTerminal(cURLCommand,testName+"Curl.txt")

#Network exploration tool and security / port scanner
print "Running Nmap..."
if port == 0:
    NmapCommand = "nmap -sV -A "+str(shortURL)
else:
    NmapCommand = "nmap -sV -A "+str(shortURL)+ " -p "+ port
runTerminal(NmapCommand,testName+"Nmap.txt")

#Web Content Scanner
print "Running Dirb..."
dirbCommand = " dirb "+str(URL)
runTerminal(dirbCommand,testName+"Dirb.txt")

#Fast SSL/TLS scanner
if port == 443:
    print "Running SSLScan..."
    sslCommand = " sslscan "+str(initialURL)
    runTerminal(sslCommand,testName+"SSLScan.txt")

#Web Application Firewall Detection Tool
print "Running wafw00f..."
wafCommand = " wafw00f -av " +str(URL)
runTerminal(wafCommand,testName+"WafScan.txt")

#Scanner similar to dirb mixed with curl
print "Running UniScan..."
uniCommand = " uniscan -u " +str(URL)+" -qweds"
runTerminal(uniCommand,testName+"UniScan.txt")

So far the code takes in a project name in order to save a file, it also takes in a URL which then gets split as required by specific scans. From there it sends the scan specific commands to a function which runs the scan in a new terminal window.

I would add to this script:

Nmap NSE scripts (like "--script=http*" and other relevant scripts)
UDP Scanning (you can use "nmap -sU" or any other UDP scanner)

Also, make sure you have good wordlists for your Dirbuster/Nikto scan, usually the easiest attack vectors are on the "hidden" URLs.


In ARP spoofing is it two MAC mapping to one IP address OR two IP mapping to one MAC address? In ARP spoofing, is it two MACs mapping to one IP address OR two IPs mapping to one MAC address?

As far as I understand, it should be two MACs mapping to one IP. But I came across this question which has tick mark (accepted as best answer) on it and mentions the opposite:

  ARP spoofing tries to do something different: two IP addresses (or two links) which map to one MAC address.

And moreover when I use Wireshark I do get the error "duplicate IP address detected". Both the machines are sending "I have IP address X"  (and mention their own MAC along with) so why is it not two MAC mapping to one IP? What am I missing here?

The answer is correct. When ARP poisoning happens, the attacker machine is saying "Hi, I am 10.20.30.40, my MAC is AABBCCDDEEFF". And the victim machine is saying "Hi, I am 10.20.30.40, my MAC is 112233445566".

Two machines with the same MAC. Why? It's because on the Ethernet layer, IP does not mean anything. The MAC is the address used to route the packet. And when someone needs to send a packet to 10.20.30.40, it's the MAC address that defines who will receive the packet, not the IP. if the MAC is already cached, the packet is sent right away.

Otherwise, the sender will issue an ARP Request: who is 10.20.30.40? Tell 10.20.30.200, the owner of the IP will reply, and 10.20.30.200 will put the entry on its cache table.

You are seeing those "duplicate IP address detected" because 2 (or more) MAC addresses are replying to the same IP. When a message ARP Request: who is 10.20.30.40? Tell 10.20.30.200 is sent, both the attacker and the victim are telling they own that IP, and giving their own MAC addresses.


Can work IT see the contents of my personal Google Drive? I was logged into my personal Gmail account on a work computer, and I forgot to actually log off. A couple days later, another person brought up Google drive on the work computer, and Google already had me logged on. Needless to say, I had some NSFW images and private financial documents on my drive that the individual saw, and reported me for looking at explicit images while at work (which I never did. I would never open my drive myself at work). I do not know how much clicking around my drive they did, but I doubt anything was downloaded. Now, IT is investigating, and I have been suspended. I remotely logged out of all of my Google accounts when I found someone had opened my drive, and deleted any unsafe for work images and private files. However, will IT be able to see what was on my Google drive at the time it was pulled up on the work computer?

There are a lot of things wrong here from an InfoSec standpoint.

Why are different employees sharing the same workstation login and consequently browser cookies etc?
Why were you using such an insecure computer to log on to your Google account?
Why did your coworker not notice they were in somebody else's private files and log out immediately?
Why is your coworker assuming you were looking at NSFW images and reporting you for it?
Unless the content was beyond work-inappropriate and legally questionable, or such usage is clearly against the acceptable use policy (AUP), I don't believe it is ethical for your employer to comment on your personal files.. that said, different jurisdictions have different opinions on this.

As for "can they see what's in my drive?"  There may be hints in the browser history, cached thumbnails, images or content.  Metadata would contain the most recent date and time of the access.

If they were skilled, they might see that Google drive was not used when you were on the machine, but it was used when your coworker and IT was using the machine.

Various enterprise security products can look deeper, but given you're sharing a login, I would be highly surprised if they had anything which could look deeper or record the content of what was seen in your drive.  (e.g., Interception proxy or Network recorder)

Despite the lack of these enterprise tools, there's no guarantees of what has been read or changed: an insecure computer with multiple users had authenticated and unsupervised access to your Google account.  What was downloaded, copied or looked at is anyone's guess.  An enterprise account might have an audit log, but I don't believe any such thing exists for personal accounts.


Is SESSION is safe for transferring encrypted email and password in PHP I am working on a project where I am using PHP_SESSION, Somewhere I heard that PHP_SESSION are quite unsafe for passing valuable data so I have to know what are the security flaws, how it can be hacked and how to protect yourself from them, Every Simple, Brief and Usable answer should be appreciated.

The $_SESSION variable in PHP is a temporary block of memory assigned to each specific user separately. Its purpose is not to be secure, it is meant to store session information.

If you are thinking of using it to store long lasting data, or data that needs to comply with the CIA triad I suggest you look into something else. There are variables in PHP's config related to garbage collection that may affect the life cycle of your session data, but most importantly, all session data is stored in the /tmp folder (unless configured otherwise), so if an attacker gains access to the file system they will be able to fetch all content from the $_SESSION variable of every user.

You may consider instead, storing an encrypted version of everything sensitive, as explained here

Another thing to consider is to override the default way of handling $_SESSION, in PHP you can define your own session handling functions. With this you may store your sessions in a remote database for example, adding an extra layer of security. Of course if your file system is compromised the log in credentials to that database most likely will be compromised as well, but at least its an extra layer of security.


Does (online) poker require cryptographically secure randomness? Here’s a quote from a reddit discussion:

… for poker [a cryptographically secure RNG] is completely unnecessary.
If you have an appropriate unpredictable seed, and you are throwing away a lot of the randomness, MT is perfectly safe.

I’d normally write this off as ignorance, but this goes on:

I've actually implemented a real-money poker backend, and the company even had it certified

And since nobody lies on the internet, this makes me wonder. Said person expands on this in another part of the discussion:

[To prevent predictability] you would not use 624 consecutive values produced from [the MT generator]. If you want a real-money app. certified, one of the criteria is to throw away a large and unpredictable amount of the output of the PRNG.
You also don't know the specifics of how the PRNG was used to produce a shuffle. So, you have no way to map the cards you see on the table to a sequence from the PRNG.
You also don't know when the PRNG is reseeded.
One last thing. You need to store (219937 − 1) * 4 bytes of data for lookup, in order to find the pattern you need to predict.

Except for the last paragraph, these arguments sounds suspiciously like security by obscurity. The last paragraph sounds less so, but somebody else in the discussion has claimed that the statement is untrue, and you don’t need such a big lookup table.
Just to clarify, I’m aware that MT19937 isn’t cryptographically secure (and so is the person I’m quoting). However, my assumption so far was that gambling (and poker) would require a cryptographically secure random source – and not just a secure seed – (a) to be tamper proof, and (b) for certification. Is this wrong?

Here is the cryptographer's point of view. The person you quote says: "you don't need a cryptographically secure PRNG", but what he actually claims is "when I use MT 19937 and do some mumbo-jumbo such as throwing away a large part of the output, it somehow becomes a cryptographically secure PRNG".

His comment about storing "(219337-1)*4 bytes for lookup" is enough to demonstrate that he is not very clear in his head about what security, cryptography, randomness and unpredictability actually are. This figure is the "period"; the period was used in (very) older times as a measure of security, because known PRNG from that time had very small periods, to the point that repetition did occur in practice. This engendered a whole family of non-crypto PRNG where designers where trying to overawe their competitors by flourishing the longest possible period. This makes no real sense from a cryptographic point of view. Security of a PRNG is about unpredictability, and a very short period is an issue only because it allows future output to be predictable. AES used in CTR mode is a PRNG with a period of 2135 (bits), a figure much lower than 219337-1, and yet not a problem at all.

The "throwing away of large and unpredictable amount of output" also illustrates the confusion. Removing bits from the output may hide some state leakage from a weak PRNG; this can even turn a weak PRNG into a strong one, as studied with the shrinking generator. However, it does nothing about seed predictability; indeed, if some of the output is "thrown away", then there is a mechanism which decides what to keep and what to throw away, and that mechanism is also part of the PRNG. If all of this is seed with the current time, then exhaustive search on the possible "current time" values will be efficient (current time is not a secret) and will unravel the whole thing.

However we may argue that though MT is not cryptographically secure, this does not mean that making an effective attack is easy. There are three types of PRNG:

The awfully weak algorithms, either through very poor processing (leaking the internal state), or predictable seed, or both. These are broken in practice.
The "cryptographically strong" PRNG, which resist attacks even in the ludicrous conditions that academics assume (an academic will consider an algorithm as "broken" if it claims 128-bit security but offers only 2123.4 resistance).
The grey zone in between: broken as per academics, but a practical attack is not immediate.

With his Mersenne Twister, he is in the grey zone, and he believes that his voodoo manipulations will keep it that way. It is entirely plausible that he could also convince an auditor that voodoo works. This in no way implies that the algorithm is secure; only that an auditor was ready to sign a paper claiming that the algorithm fulfils some legal requirements. At that point, it is a good thing to remember that some other auditors found it fit to sign papers claiming that Enron was a financially sound and clean venture: this helps to put things into the right perspective.

From what he describes, chances are that the initial seed is time-based, and the actual security relies entirely on the non-publication of the algorithm details. That's security through obscurity at its best (or worst, depending from the point of view).


If password is changed on Active Directory, can I ensure that PC must be restarted before logon with new password Basically, if I have a Windows computer connected to a domain, how can I ensure that if the password is changed on Active Directory that the computer must be restarted before the new password takes effect? Is this possible?

I ask because I have a computer that is on 24/7 and that runs important services. It spends most of it's time locked (Windows key + L locked). Theoretically, if for example somebody broke into the office and got access to the domain controller, they could reset the password and log in. But if they had to restart before logging in, then additional security measures could be put in place to prevent the OS from booting unless you know what to do.

Thanks

I'm not sure your security expectations here are realistic.

If someone gets access to your DC in such a way that allows them to change arbitrary account passwords, then you've got plenty of bigger problems to worry about.

If they could re-boot the system in order to force their password change to take effect (after which point, your hypothetical additional security measures take effect), then they either have:

1.) Remote login access to the system, which means that they don't need to reboot the system for this purpose because they're already on it.

or

2.) Physical access to the system, which pretty much bypasses any additional logical security you have in place, short of hard drive encryption.

Let's say, for the sake of argument, that they are able to re-boot the system but are still unable to log into it.  At this point, they've effectively DoSed whatever services the system provides which requires you to keep the system logged in at all times.  Perhaps this is not as significant of a breach as if they actually got logical access to the system.  But, depending on how critical those services are, it could have a significant impact on your organization.

The lesson here is to make sure your servers which require a high level of CIA (Confidentiality, Integrity, or Availability), such as systems running critical services and the domain controllers they answer to, are well secured physically, and separated from your other less-secured systems as far as possible both physically and logically.

I believe the saying goes something like:  "If you allow someone (either intentionally, or through lack of adequate security) physical access to your system, then the system is no longer yours."  The same goes especially for domain controllers.  If you allow someone to run arbitrary commands on your domain controller, then the domain is no longer yours.


Principle of asymmetric algorithm in plain english I was giving a presentation to my colleagues about cryptography basics in which I explained about asymmetric algorithm and its use. One of the common question from the audience about asymmetric algorithm encryption/decryption is, why can't we decrypt the cipher data using the same key(e.g. public key) that we've used to encrypt(like symmetric algorithm). I know it is the mathematical property that prevents this but I really don't know how to explain in plain english. The question is more like if we do "10 + 2"(assume 10 as plaintext and 2 is key) then why can't we do "12 - 2"(12 is ciphertext and 2 is encryption key) to get the original data.

Can anyone help me to explain the principle of asymmetric algorithm in plain english?

It's like one of these:

Say you want to secure something in a box. Anyone can close the lock (public key). This means anyone will be able to put something into the box and lock the box (they won't be able to open the lock once it's locked (you just pinch these closed)). The key to open the lock is something only you have (private key). You are the only one that will be able to open the lock and see what's inside the box.

I suggest you buy on of these to demonstrate how they work.


Why can I read the response to this CSRF attack? I have a website www.foo.com:8002 that I have resolve to 127.0.0.1:8002 in my hosts file. I have another (the main site) running at localhost:80

In www.foo.com:8002 the page looks like

<form name="myform" action="http://localhost/bar" method="post">
  <input type="hidden" name="some" value="value" />
</form>
<script> document.myform.submit() </script>

I expected for the request to go through and the browser (Chrome) to not read the response since it violates the same origin policy. However, it turns out that the browser receives the response and displays the contents perfectly fine. How is this possible?

Ahh!  I think I can explain.

foo.com can navigate the browser to any page or domain.  Thus, foo.com can submit a form that posts to localhost, even though that's a different domain.  No problem.

After navigating to a new page, the browser will happily display the contents of the new page to the user.  For instance, after submitting the form to localhost, the browser will happily display the response from localhost to the user.
This is not a same-origin policy violation, because the response is shown to the user, not to foo.com.  The user is trusted and is not restricted by the same-origin policy.  The same-origin policy only restricts websites, not the user.

At no point does foo.com get to read the response from localhost.  The browser will show the response from localhost on the screen, but foo.com can't read it.  That is what the same-origin policy forbids.

So, in summary: the same-origin policy doesn't prevent one site from navigating the browser to another site.  It doesn't prevent one site from triggering a request to another site.  However, it does prevent the first site from reading the response to that request to the second site.


Should I return an HSTS header for 404 error pages? I setup our .NET web application so that it has HSTS enabled.  I verfied this by going to https://gf.dev/hsts-test and put in our URL and it shows that HSTS protection is there.

The result shows:

  Strict-Transport-Security  max-age=31536000; includeSubDomains

However, our client comes back saying it is still not the case.  They told us while our main URL is HSTS enabled, the test vector URL is not.

For example:

Go to https://gf.dev/hsts-test
Put in https://nvisium.com and click Test Header
Result shows it is HSTS enabled.
Do the test again but put in https://nvisium.com/test.xml  (test.xml does not exist)
Result shows it is not HSTS enabled.

If I put the URL to an existed resource that it passes the HSTS test.

My question is do they have a point? or is this a false positive test in one of the Penetration test software they use?

Playing devil's advocate, I can only argue that if you request a non-existence resource, the web site still sends a response back and that it does not force the client to use hsts.

Suppose attacker tricks victim to click on link to your site, browser uses http, attacker in strong network position intercepts and sends malicious content and makes victim believe content came from your site.

How would HSTS help? If the victim visited your site before, their browser has an HSTS "flag" for the domain, and clicking the link would make the browser use https instead, foiling the attack. But only if the victim has visited the site before!

What about victims who did not visit the site before, or visited the site too long ago? This is what HSTS Preload is for. I recommend adding your site to HSTS Preload list. This would foil the attack regardless of presence of HSTS header on 404 error page.

Note, HSTS on 404 error page doesn't affect the attack as described. Whether the link provided by attacker leads to 404 or not doesn't matter - the attacker can intercept and replace the response either way. What matters is whether this browser has visited your site before (within the time limit) or not, and whether you have HSTS Preload (and updated browser) or not.

With nginx webserver, there is a way to add HSTS response header to error pages too, the optional "always" argument to "add_header". I don't know how to do that with IIS or whether it's even possible with IIS, but maybe it is. In your place, I would fix this, but I don't see how it's a security problem.


Can I safely use an encrypted URL parameter for the session id? I'm planning to send a user's session ID  as a URL parameter which will be AES encrypted. I don't think my app has any link sharing problems. Is this idea feasible? Is it safe?

If your session ID is truly random, there is no additional security in AES-encrypting it. If, however, it is not random, I would strongly recommend against doing so, for reasons similar to why no-one sane uses predictable session ID tokens.

Also, if you're not using SSL, your traffic can be sniffed. This means that, no matter how much you encrypt the token... it is still plainly visible. (Well, your traffic can be sniffed with SSL on, but it's a bit more complicated)


What is Cloud KMS? What's it's purpose/benefit of KMS? How does it work? How do I use it? (AWS KMS, GCP KMS, Azure Key Vault) What is Cloud KMS? What's it's purpose/benefit of KMS? Is there a concrete example of a problem I solve using it? How does it work? How do I use it?  (AWS KMS, GCP KMS, Azure Key Vault)
Whenever I've tried to read the official docs
 https://aws.amazon.com/kms/
https://cloud.google.com/kms/
https://docs.microsoft.com/en-us/azure/key-vault/key-vault-whatis

I'd never get any useful information out of the official docs, I'd get:

Generic Explanations:
 KMS: Key Management System, we help you centrally manage your encryption keys.  (I got that from the name... but what does that actually mean? I'm not even sure if I have any keys I need to manage. I can't think of a scenario where I'd be using so many encryption keys that I'd need help managing them. Is this some product that's only meant for huge organizations?)
Generic Benefits:
(buzz words you can say about any product aka meaningless for an
explanation.)
"fully managed", "central management", "low cost", "auditable", "encryption", "secure", "helps meet compliance regulations", "scalable", "automated", "integrated", "REST API", "highly available", "HSM backed", "protect secrets")
(Ok this might be cool, but wdf does it actually do? How does KMS help me meet compliance regulations, give a concrete example? You help protect secrets? How? I'm already keeping my secrets secret, the name told me to do that... So what are you actually offering? This sounds like it'll add  complexity without adding any benefits)
No concrete explanation or concrete examples of KMS benefits/problems that can be solved using KMS:
 Whenever I've tried to look deeper I'd either find nothing, or explanations that would go over my head. I need to know a concrete, relatable problem, that KMS helps me solve.

KMS allows you to encrypt/decrypt data without ever seeing your master keys. It makes managing encryption keys simpler because there's nothing you can do that can allow you to leak the master key.

They can also manage the choices of encryption algorithm, and the mechanism for upgrading algorithm choice. So these decisions are made for you so you can't accidentally configure weak encryption parameters.

Also note though, that the cynical part of you should also notice that the pronunciation of "Cloud KMS" is very similar to "vendor lock in". It makes it really hard to switch cloud provider as you can't easily move your data without also decrypting everything first. Some KMS solutions allow you to import your own key, which can reduce your surface, but brings you back into having to protect your master key and since most Cloud HSM don't specify the encryption parameters and algorithms in a vendor neutral term, you still can't easily decrypt your data even if you have a copy of your imported master key.

Probably the biggest advantage of a Cloud KMS though is logging and auditing. Building your own logging and audit infrastructure for key usage is normally non trivial, but it comes out of the box with most Cloud KMS.


Windows 7 password recovery A few weeks ago I've changed the password on my old laptop, I forgot the password as I wasn't using it often. Now I need to recover the password because I used it to encrypt some important documents. I've extracted the hashes of the laptop using Ubuntu, I wanted to crack them with hashcat but I'm not sure what type of hashes they are, there are two hashes for each user. I've read that windows 7 uses NTLM v2 but there's 2 hashes, so I got confused.

  Administrator:500:aad3b435b51404eeaad3b435b51404ee:c68bbf270f17d29960c0681c8202c07c:::

So could anybody tell me what type of hashes they are and how to crack them ?
the laptop runs windows 7 professional.

Thanks.

You could try John the Ripper. Alternatively if you are willing to pay cash money there is a service which will do this for you for a fee:

http://www.rixler.com/windows_service.htm

Only do this if it is your password or at the request of the owner. Remember that logging on to a computer without proper authority is a crime in most jurisdictions.


PBKDF2 used to generate an encryption key: long shared secret (password) vs iterations count I want to use pbkdf2 to generate a key for a symetric encryption (DES, 3DES, may be AES) algorith, that will be used to secure private data between an AS/400 and another computer (probably running Windows).

I've been "porting" the pbkdf2 c source code from a FreeBSD repository to an AS/400 (AKA as iSeries or Power system), which is BTW not a big deal.

I have also compiled the same code on a Windows system (with Visual Studio 2012)
(For those who may be interested, an API which implements PBKDF2 exists in Windows 7 and Win2008R2: BCryptDeriveKeyPBKDF2())

The performance seems good enough on Windows (I admit that the Windows machine is not a "slow machine" at time of writing: Asus R751L, Intel Core i7-4500U, 16GB ram):
With password = "abcd", salt = "some salt" (I will use a 64bit or more if required random value in the real application),
here are some times for several iterations count (c):

c = 1000 => 31ms (not optimized), 15ms (optimized for speed)
c = 10000 => 320ms (not optimized), 94ms (optimized for speed)
c = 100000 => 3280ms (not optimized), 880ms (optimized for speed)

(FYI, the BCryptDeriveKeyPBKDF2() API gives slightly better results than the version I have compiled, but this is not my issue)

Now the problem is the execution speed I get with the AS/400 system:

c = 1000 => 12590ms (not optimized), 2946ms (optimized)
c = 10000 => 125889ms (not optimized), 29452ms (optimized)
c = 100000 => (have not tried...)

My AS/400 is not a very powerful system, but even the optimized version is really slow...

Up to now, I have read that the "c" (iterations count) parameter should be as high as possible, 1000 being the recommended minimum value for "c" in the 2000's..., and that one needs to find a trade-off between acceptable performance and security, according to the involved systems; in my case, c = 1000 takes already too much time to be computed in my opinion, for several reasons:

Application Reponsiveness,
possible DOS attacks,
...

Now I am wondering: can a long and/or complicated shared secret be a solution to keep "c" as small as possible without "losing" too much "security"?
(1000 for "c" is already far too slow, so I would like to use c = 100 may be...)

Is there some kind of rule, like "adding n characters to the password is somewhat equivalent increasing the number of iterations (c) of x?

Does increasing the size of the salt (e.g., 128 bits or more instead of 64 bits) increase the difficulty get back to the original data for a cracker?

The AS/400 line of machine has a long history. They normally use CPU from the PowerPC / POWER family, but the first models began with CPU clocked at 55 MHz, which you cannot expect to be fast... This might explain the abysmal performance that you get. Or perhaps there was some subtle issue in your porting process. For instance, aggressive loop unrolling may make a function code exceed L1 cache, which can kill performance big time (I already witnessed a 50x slowdown for such cases).

Anyway, the iterations in PBKDF2 are meant to compensate for the relatively low entropy of the input password (because the password is a password, fitting in a human brain). If you can arrange for the password to have high entropy, then you will get security with a low iteration count.

(Mind that entropy is not length. Entropy is randomness.)


Connections through Firewalls explained I'm looking for a good explanation of how connections work through firewalls.
I've got the idea of packaging(encapsulating) some protocol inside another one as its payload when tunneling.
But what I can't get is actually why the firewall passes msgs from remote server to the client behind firewall.
My understanding is as such: let's assume we are using http as a transport

client --> sends msg to remote server --> firewall accepts it and passes --> server gets the message

server answers to client --> firewall remembers that this message is response to msg from client and passes it backwards --> client gets message

now, the server wants to pass another msg --> sends it client --> firewall blocks it, as it is not a response to any of the clients requests

I'm probably missing something. Or should we use another approach for such purpose? When, let's say a server doesn't actually close connection to client's request and keeps connection, and inside this connection we have a transparent interaction between server and client?

any good resource would be much appreciated

thanks

Firewalls are generally classified into three main categories these are

Stateless/StateFul Packet Filters
Application/Proxy Firewall
Web Application Firewall/Reverse Proxy Firewall

Each type of Firewall operates at different layers in a TCP/IP stack and has its own pros and cons. You are actually using an Application/Proxy Firewall which imposes significant overhead if connections are not managed. It will be create a bottleneck if we keeps connection opened as firewall is maintaining state for each connection. For more detailed answers review this figure and have a read on Application Proxy Firewall.


Tools for phreaking? Does Kali Linux offers tools and programs for testing security of telephones? If not, where can I get tools for this? Literally a pentest suite but focused on telephone networks, SIM cards, mobile phones etc?

Since phreaking is broad, i will try to cover the important points.
General knowledge
Before trying to phreak out some of your devices i strongly recommend to study those fields:

Some examples of typical ISP (internet service provider) network Architecture

Some examples of typical MNO (Mobile network operator) network Architecture

Analog(copper) lines and recent telco technologies

Lot of service provider companies are maintaining both MNO and ISP network infrastructure. Learning how those two distinct networks communicate to each other will help you much more than stating some Phreaker softs. for instance start by reading those two pages:
IMS
UMTS

"Why are you talking about MNO or ISP infrastructure?"
you might say.

Well, regarding phreaking, knowing how those infra works should answer half your question. Telling you indirectly what you can do with a computer and what you cannot.
Answer
You can play with some metasploit SIP modules, create AP or setup PPP dialup. It can be instructive and teach you some basics, like the Modulation and Demodulation (Yes, this is how the Modem word was born.) Or the difference between copper and radio networks, and intrinsically learn about the interoperability between them. Of course the OSI model should have no secret for you.
If you truly want assess phone security in depth, you need more than a linux distro. You need hardware.

3 Android phones with 3 sims would be good. (caller, callee(victim), attacker)
adding a Copper network phone or two to your lab would be better.
Build/buy some phreaking box would be the best. (be very careful on this point! owning a box, whatever the color, can be illegal in your country jurisdiction, you might need some special authorization to have one, please inquire, don't take it lightly.)

Last important point: dont try to spoof or create a MNO's LTE/3G/4G antenna.
Have fun.


How to enable ONLY TLS 1.2 in Java, blocking SSL TLS1.0 and TLS 1.1 I'm creating my SSL context like this:

SSLContext ret = SSLContext.getInstance("TLSv1.2");

When I went in firefox and forced it to disable TLS1.2, I noticed the page still loaded using TLS1.1

I would like to make sure the server ONLY allows TLS1.2 -- does anyone know of a way to do this?

Check out SSLSocket.setEnabledProtocols(). Here are the valid names for protocols.


Equipment required for sniffing data / address buses via EM emission What kind of equipment would be required to sniff data from the electromagnetic emissions of data / address buses on an average motherboard?

I'd imagine a sensitive hall probe, a faraday cage and some expensive analysis equipment (e.g. spectrum analyser) would be necessary, racking up a pretty significant cost, but I don't really have any sources to suggest that this is correct or incorrect.

Anyone had any experience in this field? Are there homebrew methods, or is this the kind of attack that requires significant resources to pull off?

I recall a video I saw from one of the big conventions, in which a researcher was able to decode emissions from a PS/2 keyboard using nothing but a slow oscilloscope - he simply observed the ground pin of the target machine and he could pick bits straight off. I had previously assumed that such attacks required spectrum analysers and a degree in RF black magic - but apparently not!

The video is by 'Andrea Barisana and Daniele Bianco' and is from a BlackHat 2009 talk - talk slides are at https://www.blackhat.com/presentations/bh-usa-09/BARISANI/BHUSA09-Barisani-Keystrokes-SLIDES.pdf.

I should point out that I haven't tried to replicate their research myself.


PCI Compliance Problem My company is trying to become fully PCI Compliant and we are switching our outdated systems to use Authorize.net CIM among other things.  But, currently we're all over the place and until our new database management system gets updated, I don't have a place that I can temporarily store credit cards for payments to a bill.

Currently, when a customer calls up and wants to pay their bill, they fill out a payment form online (which among other things includes their credit card number) that gets securely emailed (lol oxymoron) to us for a temporary period of time (before it is submitted into our database system and then sent to authorize.net to be charged).  Or even worse, sometimes it's actually written down on a piece of paper!  Not cool...  It's just the number though, no CVV2 or anything.

Is there ANY method that allows us to store just a credit card number and an identifier for it (locally or remotely) that is PCI compliant?  I can't use CIM for this as these are just loose numbers with no accounts at the time of entry, way way too complicated and our new system will be using it.  I need a quicker solution for now.  Basically I'd like to be able to say "Store Credit card xxxxxxxxxxxx1234 HERE with ID 5" and then later come back and say "Get me the credit card with ID 5".  Just so it's stored encrypted somewhere in a PCI compliant manner.

I was trying to think of the easiest possible solution for you. What I came up with is just simply writing down all the info you need in a txt doc using Notepad++, then just encrypt the entire contents of the file. When you need to get a number out or add a number just get off your network completely so you are not connected at all, then decrypt the file using whatever password you came up with.

There is a built in plugin module to do this in notepad++. You can find the details here: http://howto.cnet.com/8301-11310_39-57449365-285/how-to-encrypt-selected-text-and-entire-text-files-with-notepad/

Of course this is in NO WAY any kind of long term or perfectly secure solution. But for a quick and dirty way to just store some encrypted data this should do the trick. I am not sure about this meeting PCI though, a QSA might have a hay-day with this one lol


Is this jQuery ajax call vulnerable to XSS? If somebody can edit $("#field").val(), can they change the url property here to point to another location?

$.ajax({
  url: "http://mywebsite/script?param=" + $("#field").val(),
  dataType: "jsonp",
  success: function(response) {
      document.write(/*fields from response object*/);
  },
 });

If they can then my page is XSS vulnerable since the malicious location could return script tags in the response object. I want to know if any value of field could be used to change the AJAX url.

Update

My apologies, I have updated the question. The value is actually contained in a javascript variable and is not directly written by php (otherwise there is obviously XSS issues). Sorry.

Yes it is vulnerable, but not it the way you suspect. The attacker would not try modify the loaded URL, but to execute the code directly. For example:

$_GET['fname'] = '"+(function(){/*any_code_i_like*/})()+"';

will become:

$.ajax({
   url: "http://mywebsite/script?param="+(function(){/*any_code_i_like*/})()+""

and the code will execute even before requesting the URL with ajax. It's just an example, there are other vectors that would work here too. The simplest way to escape the parameter to prevent XSS in this context would be using urlencode() in PHP like this:

$.ajax({
  url: "http://mywebsite/script?param=<?php echo urlencode($_GET["fname"]); ?>"
  dataType: "jsonp",
  success: function(response) {
      document.write(/*fields from response object*/);
  },
 });

Also, take a look at OWASP XSS Prevention Cheat Sheet.

Update: After you updated the question - there is no XSS vulnerability here (you can't e.g. point the request to another domain), but the example is vulnerable to a different beast - HTTP parameter polution. It might not matter in this exact case, but imagine that the given parameter is:

a_valid_value&param=another_param_injected

The attacker is able to inject additional HTTP GET parameters which might be important for your application and might change the execution flow (e.g. parameter admin=1). You should get into habit of escaping/encoding everything coming from user input. In this modified case you should use Javascript encodeURIComponent function which prevents attacker from injecting '&','=' and '?':

"http://mywebsite/script?param=" + encodeURIComponent($("#field").val()),


Benefits of Content Security Policy I would like to know how really good is the content security policy header for preventing XSS considering the following :

Many sites have inline JS / CSS.
The request/ response headers can be modified in Transit.

You have to get rid of the inline JS in order to be able to set a useful policy. (You can include unsafe-inline in the policy, but at that point you're disabling the main point of using it.) Deploying CSP in any useful way means you're probably going to have to update your app to remove any inline script and style, but this is a 'best practices' measure with other advantages than just CSP.
Yes, if you have a man-in-the-middle attack then you've lost worse already. If that's on your threat model you should be addressing it with SSL.

CSP should not be used as a primary defence against XSS - you still need to be doing HTML-escaping and all the other measures to make your app secure and correct. But it's a good defence-in-depth measure to make exploitation of an accidental lapse in that less likely.


Are there limits (or, what are the limits) to our understanding of AES's resistance to known plaintext attacks? Let's assume the same message is encrypted many times, each time with a different IV but the same key.  Do we reach a point where just knowing what that message is gives us a plausible attack by which we can discover the key?

The closest thing I see to this is a side channel attack mentioned on the Wikipedia page requiring over 200 million chosen plaintexts, and presumably side-channels can be closed as they are discovered, negating this particular weakness.

Aside from that, it seems that it might be unwise to re-encode the same message many times, if a weakness were to be found then such a scenario might be the first to be exploited, but I was just wondering if there was anything we were currently aware of along those lines.

A perfect block cipher is modeled as a pseudorandom permutation. For blocks of n bits, there are 2n! possible permutations; a perfect block cipher is as if the key was a random uniform selection of one permutation among all these. For a PRP, knowing many plaintext/ciphertext pairs (m, E(m)) gives you exactly zero information on the encryption of blocks m' which are not part of the known pairs.

Right now, the best attack we know which may distinguish AES from a PRP is the so-called biclique attack, which has a cost only very slightly lower than basic brute force on the key (cost is theoretically about 2126.1, compared to 2127 for brute force -- needless to say, the attack cannot be actually tried with existing technology, so we are not absolutely sure that it works as advertised, though that is plausible).

Assuming that AES is indeed as good a PRP as we can get, usual encryption modes can be shown to be "secure" as long as you haven't processed more than 264 blocks with the same key. That's the point where, statistically, the PRP begins to be differentiated from a PRF. It translates to about 300 millions of terabytes, which is kind of large. AES has been defined to use 128-bit blocks, and not 64-bit blocks like 3DES, precisely so that we do not run into that kind of problem.

To sum up: in practice, you don't have to fear reusing the same key again and again, as long as you do it correctly (e.g. CBC mode requires random uniform unpredictable IV).


Is it possible for Firefox to detect MITM attacks by the enterprise? I'm far from a security expert, so the premise of my question might be wrong.  If so please let me know.

In an enterprise setting, browser users are vulnerable to, and often subjected to, MITM attacks by the enterprise.  The enterprise has complete control over how the browser is configured, so it simply pre-installs its own CA root certificate and configures the browser to trust it.  The enterprise can then issue certificates for any website on the internet, and read or modify HTTPS traffic to them.  For example, if a user accesses their online bank, they have no way of knowing if a rogue employee in the IT dept is intercepting their online banking password.  Worse, they will be incorrectly reassured by all the expected security indicators (green padlock, correct name on the certificate, etc).

Revoking trust in the enterprise's root certificate would solve this, but the enterprise can prevent such configuration changes, and doing so would prevent the browser accessing intranet sites anyway, so it's not a solution.

Finally, since the enterprise (attacker) has complete control over the machine, it could just change the browser binary to display false security indicators (or install keyloggers, screen grabbers, etc).  So let's assume that the enterprise's motivation only extends as far as configuring the browser and monitoring the network, and that the browser binary is unmodified.  Let's also assume the browser is Firefox, since that's what I use.

Is it possible for a NOVICE user, under these conditions, to reliably detect MITM attacks by the enterprise?
If not, could changes made outside the control of the enterprise -- to Firefox itself, or to web security infrastructure -- block the enterprise from making a MITM attack without the user knowing?

As long as the browser itself is unmodified, you can detect MITM by checking the certificate chain by clicking on the padlock icon next to the URL bar. When the connection isn't being MITMed, the root of the certificate chain should be a public CA. All public CA publishes their public key hash or you can cross check the root's hash against the root store you download directly from Mozilla. If you are really paranoid, you want to download the root store from a connection that you know for sure is secure. You can also audit the browser's root store (using the built in certificate manager) against the securely downloaded root store, to check that the browser's root store doesn't contain any additional roots that shouldn't have been there.

In practice, most Enterprise interception policy aren't meant to be hidden from their users/employees, so the CN field of the root certificate usually would clearly indicates that the root certificate belongs to the enterprise rather than one of the Public CA. Therefore, a much simpler way to detect MITM in this case is to simply check the name in the "Verified by:" field in the padlock icon popup. This is slightly less robust though, because it depends on the enterprise not deliberately going out of their way to try to hide that they're intercepting.

If the browser is modified, then all bets are off as the browser can lie to you. Note that installing a classic (non-Webextension) add-on counts as modifying the browser.


How can i protect myself from tor vulnerability on windows Recently I came across an article regarding Tor. According to article

  there is speculation that the uncovered malware was used by a law
  enforcement agency to harvest the IP addresses of users of several
  hidden services hosted by Freedom Hosting.

I use Tor regularly in my windows machine. How can I protect myself from this kind of vulnerability?

The vulnerability was in the bundled Firefox browser. It has since been patched, so updating it would fix the problem.

In general, there are several ways to protect yourself:

Update Tor Bundle to the latest version, which isn't vulnerable to this specific attack.
Enable NoScript globally, and only whitelist sites when you've FULLY checked that they're not serving dodgy JS. Remember that FH got popped, so all FH sites were infected.
Always keep your OS, AV, firewall, apps, etc. up to date.
Install EMET and configure it to provide additional protection against exploits.
Do your browsing in an isolated session, e.g. in a VM or via Sandboxie, in order to minimise the risk of future exploits. This won't stop you from being identified via out-of-Tor comms, but it helps prevent your box from being popped.


nmap traceroute shows only one hop regardless of target I'm using Zenmap to map out the network topology of the company I'm working in. When I ran the following command to trace route how my system connects to the internet but Zenmap only shows me a single hop.

    nmap -sn --traceroute google.com

    Starting Nmap 7.70 ( https://nmap.org )

    Nmap scan report for google.com (216.58.204.110)

    Host is up (0.00025s latency).

    rDNS record for 216.58.204.110: par10s28-in-f110.1e100.net

    TRACEROUTE (using port 80/tcp)

    HOP RTT     ADDRESS

    1   0.00 ms par10s28-in-f110.1e100.net (216.58.204.110)

    Nmap done: 1 IP address (1 host up) scanned in 3.19 seconds

This happens regardless of what target I provide (bing, facebook or even a server I know is on a different continent). I tried running the same command directly in the cmd but that also shows the same result. Tracert command on cmd shows the correct result (ie all the hops).

I know nmap runs traceroute in a different way but I'd like to know why this happens. Also is there anyway to fix this and make it actually show the entire route and all the hops? I searched on the internet but I couldn't find a solution. This is important for building the topology diagram in zenmap.

Thanks.

EDIT: As per comments, I tried traceroute to IP addreess.

 nmap -sn --traceroute 216.58.204.110

Still shows the same result.

 Starting Nmap 7.70 ( https://nmap.org ) at 2018-05-24 18:13

Nmap scan report for par10s28-in-f14.1e100.net (216.58.204.110)

Host is up (0.00025s latency).

TRACEROUTE (using port 80/tcp)

HOP RTT     ADDRESS

1   0.00 ms par10s28-in-f14.1e100.net (216.58.204.110)

Nmap done: 1 IP address (1 host up) scanned in 3.18 seconds

traceroute works by sending packets with a specific TTL (time to live, i.e. maximum number of hops to travel). It expects that these packets get discarded by a system on the path to the target if the TTL is reached and that this system sends an ICMP time exceeded message back.

Since your output of nmap only shows the unlikely result of you being only a single hop away from the target and a very low time to the target it is likely that some middlebox (firewall or similar) at the edge of your local network is messing with the traffic, i.e. it transparently intercepts the connection and answers it directly instead of forwarding it.

  Tracert command on cmd shows the correct result (ie all the hops).

Tracert uses ICMP. According to your output your nmap is using TCP on port 80 instead:

  TRACEROUTE (using port 80/tcp)

Thus the middlebox let ICMP probably pass while it handles port 80 by itself. This is a common behavior with transparent proxies on firewalls.


Grabbing a hash from a suspected sqllite3 database file I have a .db file that is encrypted when opened with DB Browser for SQLite as it asks for a password which is not known. I am trying to obtain the hash and hash type for this file as I know it has been made using SQLCipher.

Research of how SQLCipher works show's that an AES 256 bit encryption has been applied to the file. I would like to run this file through the password cracking software "hashcat" but without knowing the hash type, I cannot perform this action.

Is there anyway to retrieve the hash type from the given file so I can perform a dictionary attack using hashcat?

AES 256 is a form of encryption, two way. Hashes are one way.

It sounds to me like the database is encrypted with AES 256 and when decrypted (using a password/passphrase) it will allow you to browse it. SQLCipher is a full database encryption technique. When browsing it you might come across hash values, most likely in a password column.

Hashcat is for hashes, it takes the hash (which is one way) and tries to find a collission (or uses other smart tricks) to determine what password would lead to that hash.

1: Decrypt the database
2: Find the hashes
3: Let loose the hashcat! (and try to determine the hash type)


Should I store my intellectual property / code online? As a hosting company we have gathered a busload of information over the years that are pretty much confidential. This information includes code, graphics, ERD diagrams, SEO strategies and so much more. As our company expanded, we have now reached a point where we need to store this information for the entire company to access. However, the employees of the company (less than 10) are all in different countries (with 2 at most in the same cities).

We need to store this information online so everyone can access it. A wiki came to mind as the best solution, but to be honest, as secure as our servers are, I'd rather host it completely seperate from our hosting servers and getting a dedicated server account just for these purposes seem a bit extreme.

So my question is: how do others store intellectual property online and should things like code be stored online, or rather archived on a laptop? My particular concern is, if we put all the passwords to all our servers online, and someone gets in, not only do they have access to everything from bank accounts, to servers, but they know exactly how we do business and could sell this information to our competition, or just copy us or intercept our plans.

Any ideas or am I being paranoid?

You're not being paranoid at all. First and foremost you must consider requiring a VPN (and maybe 2 factor authentication) to access your company data/intranet. Passwords should be stored in absolutely nothing less than an application like KeePass or LastPass.

I am a huge fan of a Wiki. But you need to draw a line between what is "the internet" and what is "our private network" - Anything you put on "the internet" should not be intellectual property. The internet is a public place no matter how you look at it.

Secure your network and your websites and data behind it will be secured also.

VPN + Wiki on Apache/IIS with proper IP restrictions + KeePass and you're good to go


With a known secret key, can I determine the response for an authentication challenge? I am trying to find a response for a 64-bit authentication challenge message (e.g. c055258b829d89bc).  Each challenge message is unique.

If I know the 512-bit secret key that was used to create the 64-bit challenge message, is it possible to find the response?  If so, how would one go about doing so?

I have no idea which authentication scheme you refer too. But usually a challenge-response authentication scheme is used to prove that the client knows a specific secret. So the information about the secret are not contained in the challenge (which is often random) but instead in the response. But the exact details depend on the authentication scheme so you need to provide more details if you want to have a better answer.


With HTTPS, can I reliable know client domain for authenticating them against my API I am having a hard time coming up with the best title for this question, but let me explain my situation:

I have a chat-room-as-a-service app similar to Intercom. Anyone can load the chat in an iframe and display it in their site. I want to make it so that site creators can request a 'namespace' i.e. acme inc and then pass that as a parameter in the iframe src URL.

The problem is that anyone could join the company's chat by simply typing the name as a param into their own iframe URL. I need a way to verify that  when a host connects to my app with a "name" param, that it is the correct host and not a spoofer.

This is all in JavaScript, by the way, but since this is security and not Stack Overflow, I don't expect someone to give me correct code, just important concepts. Thanks.

Have you seen Macaroon Tokens? I've always wanted to use them for authorization processes but haven't had the chance, however they seem like a potential match for your use case.

Here's the research paper and here's a very simple demo tool.

You could for example add several caveats such as client's IP or other similar fingerprint so that a stolen macaroon can't be used elsewhere. Or maybe you can restrict the expiry time to 1 minute or even require a macaroon per request (i.e. chat message or something perhaps?).

Unfortunately for some reason there doesn't seem to be wide adoption of this very cool concept, so a lot of the stuff is old and not sure how maintained the different libraries are, so the usefulness might be limited for you, depending on your case.

However the most common technique I've seen is basically just using cookies (with short expiration times, depending on your use case) to keep server-side session identifiers, which you can use to control access. Just make sure you use HTTPS to send them.

Edit to address the comment:

Here's a javascript library for Macaroons.

What I meant by fingerprinting was getting some kind of info from the user (when they login) and adding them as a Macaroon caveat. e.g.

Add a valid email for that "namespace" such that user X in namespace N can't just jump in to namespace M.
Build a whitelist with the known range of IPs for each client that have authorization to access their chat. You can try to determine the IP via WebRTC leak but that requires a browser that supports WebRTC, and the leak might be fixed later on, depending on the browser.

The answer to determining the client's IP will depend on your particular use case. There's lots of different solutions there that have a variable amount of cost/benefit ratio that only you can evaluate.

For example, you could use a Node server, but if you don't have one already, this might be costly in terms of new infrastructure, code, etc. Maybe you have a Tomcat server that you can already use to find the IP and can plug into that, etc. But they all have different security implications and associated costs, so this would be a broad question.

Edit:

I've also read some comments regarding how insecure JWT's are if you are using them for client-side sessions. So I might add this just in case someone recommends it.

This article: JSON Web Tokens should be avoided spurred some discussion by people that work in the field, for example this comment by Thomas Ptacek.

Small extract:

  The issue with JWT in particular is that it doesn't bring anything to
  the table, but comes with a whole lot of terrifying complexity. Worse,
  you as a developer won't see that complexity: JWT looks like a simple
  token with a magic cryptographically-protected bag-of-attributes
  interface. The problems are all behind the scenes.


Are my session settings secure enough? I'm developing a file hosting and sharing web application.

Are the following PHP session settings secure enough?

ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_lifetime', 0);
ini_set('session.entropy_file', '/dev/urandom');
ini_set('session.hash_function', 'whirlpool'); //is whirlpool that necessary?
ini_set('session.use_only_cookies', 1);
ini_set('session.hash_bits_per_character', 5);
ini_set('session.cookie_secure', 1);

session_name('sid');

session_start();

if (!isset($_COOKIE['sid'])) {
    $_SESSION['token'] = CryptoCharGen::alnum(); //20 chars
}

To add on to the security:

Tying a cryptographically strong CSRF token  to the user
session for form validation.
Regenerating a new session ID upon logging in and out and destroying the old session.
Regenerating a new CSRF token upon successful submission of any form.

I've read to rename the default PHP session name, so I named it sid instead. Is that good enough?

Should I generate the session id with my own generator? (CryptoCharGen)

Should I be concerned about how I name my session variables?

You can also add session.entropy_length = 512 and session.use_trans_sid = 0.

Also do not forget to:

use https
regenerate session id if you change users permissions.
do sessions time out. Time depends on your app.

It has nothing to do with security, but why not to change session.hash_bits_per_character to 6. The bigger the number, the shorter the string sent from and to the server.


Is there a way to get information out of the router Is there any way (directly from a computer or device) to see the packets that pass the router from the different devices.
Thanks.

Look at wireshark with an card on the network listening in promiscuous mode.  Additionally, some routers will have a feature to log/see traffic going through directly; most home routers will not.


How can I demonstrate the reflected XSS via post methods I was trying to make a PoC of XSS:

Attack sample:

I have injected script into the value:

<html>

  <body>
    <form action="https://test.com/api/users.prefs.set?t=1447648400" method="POST">
      <input type="hidden" name="name" value="emoji&#95;use" />
      <input type="hidden" name="value" value="<script>alert('xss')</script>" />
      <input type="hidden" name="token" value="xoxs&#45;14407185377&#45;14407185393&#45;14621684436&#45;9d317bf841" />
      <input type="hidden" name="&#95;attempts" value="1" />
      <input type="submit" value="Submit request" />
    </form>
  </body>
</html>

And I was able to get successful response from browser with <script>alert('xss')</script>. Now the script got injected and reflected at response I pointed out it as reflected XSS. The problem is that the alert doesn't get popped up, so it's just coming it as browser response.

Now my developer argues that the since the script doesn't get executed at the browser, so it's not vulnerable. How can I make proof of concept for this?

Possible exploitation which I can think of is to send a crafted link to the developer with beef and controlling the machine to prove the vulnerablity.

Any other way to prove the reflected XSS or any possible explanation which convinces my developer? I'm seeking suggestions from community, any other ideas to prove it?

The fact that the alert doesn't show, doesn't mean it's not there and in return it means input validation is not performed. That alone should be sufficient.

My next thought is (if the content type is set to html and not to json) to change the payload. What happens if you do:

<script>document.location.href="http://www.google.com";</script>

Assuming that a web application is used in front of the API, perhaps you can demonstrate a cookie stealer scenario.

In addition, you could demonstrate the alert box when using a proxy such as Fiddler and Burp Suite: Select the response, then click "generate HTML".


Sending Client Certificate to Server I have a simple question.

Is a web browser sends client certificate to the web server on demand(means web server is configured for client authentication and demand the client certificate) or just send all of the certificates that web browser has. If a web server send client certificate on server demand then how a web browser know which client certificate has to sent to particular web server.

During the SSL handshake,

If the server requires a digital certificate for client authentication,
the server sends a "client certificate request" that includes a list of
the types of certificates supported and the Distinguished Names of
acceptable Certification Authorities (CAs).

(quote is from a reasonably lucid explanation of the SSL handshake by IBM.)

The client then compares the certificates in its store against that list to see if it has any signed by the CAs that the server listed.  If it finds one, it will send it, usually after prompting the user whether they want to send it.  Presumably if there were multiple matches it would ask the user which to send (if any).

(Updating to answer comment below with regarding GAE):

This page appears to be a Google employee saying that App Engine doesn't support Client Certificate authentication.  Now, that's dated 2010, so I wouldn't take it as the final word, but it is a flat-sounding "no".

This question is looking for the same thing, and that person got redirected to look into OAuth2 via Google Cloud Endpoints.  Perhaps that would serve your needs well enough?


Checking the validity of an e-mail? I was in Court and my ex-wife produced an e-mail that she claims to have sent. Given the nature of this e-mail and following texts, it made no sense but was purely made to prove something she had said to be true when it would have proved the type of character she was. I believe this e-mail wasn’t sent but merely mocked up with some copy and paste skills.

I wasn’t forwarded the e-mail (sent from a gmail account), but a paper copy of it was produced in Court. Would it be possible to check with gmail as to whether the actual e-mail was sent? Obviously things can disappear between sender and recipient but by its contents I don’t believe it was sent.

Any help much appreciated.

Google might have it in their logs, but I doubt they'd let you know.

IANAL, but there is one way that could establish that the letter was sent - if your ex-wife logged in on her Gmail account, showed that it really was her Gmail account at the court, and showed the mail in the "Sent Items" box. Then the court could also establish to whom it was sent and CC'd - or rather, to which e-mail adresses it was sent and CC'd.

It's not possible to prove that the mail was not sent. If the mail is not present in the "Sent Items", she could simply claim that she'd already deleted it from there.