Securely transferring data from service provider to client Suppose a client C wants to transfer form a service provider P, who collected data on behave of C using a web-application. Additionally, suppose the amount of data is larger than 100 MByte and contains privacy related information. Thus, the data needs to be protected against third party access.

C and P operate within their own local network, both have access to the internet. The workstations and servers in C's and P's local network are assumed to be secure.

I'd like to know, which of these transfer methods is preferable and why:

Option A: Use SFTP to transfer files.

Option B: Use a simple web-application to download data directly from the web-server. Use HTTPS to protect the transport layer and a userID with a long/random password to gain privileged access. In this case, web-app would be able to dynamically export data and advertise it as a file to the browser.

Option C: Partition data into sufficiently small packets, encrypt each part with GnuPG and forward it using e-mail.

From a security point of view, are all options probably equivalent?

Or is the fact, that Option A and Option C require the creation of temporary files, less secure than just in time generation of the export file using Option B?

From a security point of view, your options are NOT equivalent. Whether this is important or not depends on the context.

The first two methods are, roughly, equivalent in security: in both case you're using encryption of data in transit and rely on the complexity of you access password to protect the data. The security challenge you're going to get here are pretty much in the line of: protecting against MitM attacks and password cracking. In both case, you'll have to setup this carefully and properly to prevent MitM and in both case you'll require a separate secure channel for exchanging keys (in your case, the password).

You could make it stronger by using public/private key pairs for authentication though. Another issue is that, since the data is not encrypted on the server (at rest), any flaw in the server software or setup might grant access to your data to an attacker.

The third method is different. Although you will still require a separate secure channel to exchange passwords, you are not relying on encryption connection for confidentiality. This means that the whole setup is more resilient since breaking one layer of protection (say, your mail server) will not grant an attacker access to the data.

That being said, you could improve on that design a lot. For instance, using a SFTP server to host an encrypted PGP file will make everything both more secure and more practical. If you're willing to trust your keys to some machine in your internal network, the whole thing can be automated.

As for temporary files, only if they really mater in your use case, then your requirement is strict enough that you should NOT try to implement that yourself but hire a professional. In general, temp files are as secure as the other files on your machine: if your machine is secure enough, so are your files. And if you have a temporary, non-encrypted files uploaded to a server somewhere, that file will be as safe as the "real" copy that you intend to leave there (i.e. not very much).


Using android auto in a rental car I've started using rental cars frequently for work and android auto has apparently become common enough that many of the cars I rent have it built in.  It could be helpful to me even over the short time period of a car rental but I'm hesitant.  Having never used it before I'm not familiar with the ecosystem or potential information security risks that might be associated with its usage on someone else's car.  That's pretty much the extent of my question(s):

What, if anything, are the potential risks of using android auto on a rental car/shared vehicle?  Are there any steps that can be taken to minimize any potential risks, in particular the risk of any information from my phone (including identifying information about my phone) being left behind for someone else to find?

I have been an avid user of Android Auto for a while now. I have explored all the ins and outs of this software and have done some security research of my own earlier on. Hopefully sharing my findings will help put your mind at ease and allow you to enjoy your rental and Android Auto. =)

What, if anything, are the potential risks of using android auto on a rental car/shared vehicle? Are there any steps that can be taken to minimize any potential risks, in particular the risk of any information from my phone (including identifying information about my phone) being left behind for someone else to find?

According to this website, the sources of which are credible and verifiable, the only thing the software saves from your phone is an ID that is provided through USB. This allows the software to better serve you by knowing exactly which system it needs to start for your particular device. For example; an iPhone will provide an ID and the software will associate that ID with Apple CarPlay, if you're using an Android phone the software will associate your phone's ID with Android Auto.

Also, the website points out that device IDs can be deleted through "a factory reset of the multimedia system". This might be a good way for your to mitigate the risk of losing your phone ID to a bad guy. (if you consider that a risk at all)

One thing though, Is that if you connect to Android Auto, it may ask you if you'd like to pair your phone through Bluetooth. This, unlike the Android Auto software, can pose different security threats. Often times, Bluetooth enabled media devices built into your vehicle will request to download certain information from your phone that you may not feel comfortable sharing with just anyone who rents the car after you. According to the website: "the amount of information your car's Bluetooth system collects varies by Bluetooth module but typically there is storage for hundreds if not thousands of phone numbers." So, in conclusion, your Bluetooth-enabled risk factor depends on the module installed, but as long as you don't allow a Bluetooth connection with your car you should be A-Okay!

Steps that can be taken to minimize potential risks (i.e., phone book and phone identity leakage)

You would be able to erase your phone's identity from the car's software by "a factory reset of the multimedia system". The method by which you do this will depend on the manufacturer, so your best bet will be to do some searching online for how to do that with your particular system.
Make sure to deny any requests that are made to connect via Bluetooth.

And that should be it! I hope this helps.


Secure keyboard entry with JavaScript or Flash? Is it possible to perform secure keyboard entry (similar to what is offered in the OS X Terminal app) using only web technologies and/or Flash?

If not, is there any way to more broadly guarantee exclusive/isolated access to input devices, or to check whether or not a device has been read or manipulated by external processes since start of observation?

I assume this is impossible with JavaScript alone, however I am not familiar with Flash and have heard of more extensive capabilities being offered (usually hear about them being abused) than JS would permit.

No, since that would imply that Flash or JavaScript does have access to raw hardware, outside of its sandbox.

Think opposite, that if a flash applet or JavaScript applet would have this access, it would be possible to build a keylogging website that remained Active across tabs.

If you need to protect against keyloggers, I would suggest some sort of 2FA. Then it wont matter if the password does fall in the wrong hands, as long as the token does not fall in the wrong hands.


Digital Forensic test image? Does anyone know where I can get a free forensic test image for FTK? I need it to be below 5000 files for the demo. I found one but it is larger than 5k and it spits errors back at me.

Maybe look for floppy disk images. Such as this one: http://project.honeynet.org/scans/scan24/


Why does arp spoofing work? I'm learning about arp spoofing and I'm a bit confused as to how it works.

From what I gather you are on a LAN network with a victim and connected to a router. You then tell the router that you are the victim, and the victim that you are the router. The victim and the router both store this bad information in their arp cache and will send information to you, which you relay to the other side while being able to read/edit it.

What I don't understand is why the MAC address stays in the arp table. If you are telling the victim that you are the router and the real router is telling the victim that they are the router wouldn't the victim's computer automatically use whichever router it was using before?

Similarly, if the real victim and you are both telling the router that you are the victim, wouldn't the router just detect what you're trying to do and remove you from the network?

I'm sorry if this is a stupid question but LAN hacking in general is relatively new to me.

The real router doesn't "tell the victim that they are the router" (by sending an ARP reply), unless it gets an ARP request from the victim (asking "who is the router?").

The victim won't send an ARP request unless the fake entry times out of its ARP cache (so that it "forgets that the attacker is the router").


TCP/IP and firewall bypass security risks I'm reading Architecture of Open Source Applications. From chapter about Audacity:

  However, we do not want Audacity to provide a route to bypass a
  firewall, so we have a rule not to have TCP/IP connections to or from
  Audacity at all. Avoiding TCP/IP cuts out many security concerns.

Could you pls explain me (as to security newcomer with details) the next things:

What does they mean by the last sentence? Do "security conterns" with TCP/IP related ONLY to firewall bypass route?
How firewalls work with IP/TCP and why you do need bypass route only for TCP/IP?

Right before the statement you quoted, the author writes:

  Architecture is also shaped by considerations of how best to use our scarce developer time. With a small team of developers, we do not have the resources to do, for example, the in-depth analysis of security loopholes that teams working on Firefox and Thunderbird do.

This is key to understanding what they mean here. Audacity doesn't provide a "route to bypass a firewall", but as a small team they understand that they do not have the man-power or resources to find all the issues in their software that might lead to an exploit that allows people to bypass firewalls.

So rather than putting their resources to work finding holes and bugs in their own software, they avoided the TCP/IP stack altogether, and because of that, avoided a whole slew of security issues that could stem from including TCP/IP.

As far as your second question is concerned, as @schroeder mentioned, that is more of a basic networking question that is not within the scope of this site.


Is it safe and secured to use Mono-Project for Ubuntu to run a ASP.NET with a MySQL database? I am looking to rent a VPS server to host a game server, MySQL database and an ASP.NET site on it. A Windows server is too expensive for me but Mono-Project for Ubuntu does everything that I need it to do. Question is - is it as secured as running the ASP.NET site on Windows? Are there any security issues? I need to secure my site really well because it is going to have a database with sensitive user info, including passwords. I will also be using libraries with my ASP.NET site if it matters (such as MySQL connector for dot net and BCrypt.Net)

One rule specialy true in software development is the simpler the better. Each time you add a complex system (OS, library, framework), you must wonder about its security level with 2 different points of view:

does the design present security problems? (typically how is the data hosted and accessed, how is authentication and authorization processed, what is the complexity of the configuration)
what is the risk that the system contains implementation flaws?

That second question is often hard to answer and is often not much than a bet but is important. As far as I am concerned I try to know what the reputation is, and look at the bug list for open source systems. Its size, the kind of bugs and time of resolution scheds some light on the risk of security flaws. The following is no more than my opinion:

Ubuntu is a serious OS, based on Debian Linux and has a pretty good reputation. Its configuration to obtain a standard server security level requires some work (it is by default a workstation system) but it is not much harder than Windows
Mono is a framework that port the NET API to the non Microsoft world. I am not an expert on it but I would be afraid that its developpers cared more for functionalities than security. You should examine the current bug list to make your own opinion. IMHO this is the key point for your question.

But using a correct underlying platform is far from being enough to build a secure web application. Many problems can come (and often do) from the way the application itself is designed and implemented. And anyway, I must secure it really shows that you are concerned with security which is a good start point, but best practices recommend to do a true security analysis:

what are the threats
what are the current weaknesses
what are the security requirements

Only the anwsers to those question will allow you to secure the application according to its requirement.


On gpg2's symmetric decryption According to an answer and comments in a earlier question of mine, when one uses gpg2 to symmetrically encrypt a message, gpg2 randomly generates a one-time encryption key for that message, as well as some random salt, and uses this key and salt to encrypt the message.  Furthermore, the passpharse and the resulting encrypted message comprise all the information that gpg2 needs in order to decode the message.

I am still unclear on some of this.

First, could someone walk me through how gpg2 uses the passphrase to decrypt a message symmetrically encrypted under that passphrase?

I imagine that the passphrase is used to decrypt the one-time randomly-generated encryption key K that was used to encrypt the main message, and then this K is used to decrypt the rest of the encrypted content to produce the original message.

If this is true, it means that, however strong the one-time encryption key may be, this strength is irrelevant; the only cryptographic strength that matters here is the strength of the passphrase.  Is this correct?

Second, what is the point of using a salt here, if the symmetric encryption key is a one-time randomly generated one, used to encrypt only one message?  In other words, what kind of attack could be mounted against a one-time random encryption key that a salt would thwart?

TL;DR Skip to the last paragraph

Not quite. To encrypt the file, the passphrase and the one-time random salt are combined to encrypt the one-time random key. The salt must then be stored unencrypted along with the encrypted file data. Then, to decrypt the file, the passphrase and the salt (obtained from the encrypted file) are combined again to decrypt the one-time random key which is then used to decrypt the file.

According to an answer to your previous question, the purpose of the salt is to fix the problem that most passphrases will be rubbish (low entropy) and adding salt will help to improve them. This might sound unlikely to really work since the salt is available to an adversary but presumably it must increase the computational task of decrypting the one-time random key (i.e. similar to the situation with password hashing where salt means that there's no possibility of using rainbow tables to speed things up).

An answer to your previous question claimed that adding salt does help and there was a link to more information on the use of salt in cryptography: https://en.wikipedia.org/wiki/Salt_(cryptography) but that page only refers to the use of salt in password hashing, not key encryption. It doesn't sound convincing based on that statement alone. I'm sure that the authors of gpg must have good reasons for adding salt but I don't know what those reasons are (IANAC = I am not a cryptograper). This isn't the same situation as password hashing where the hash is stored and might become available to an adversary.

Having said that, strong passphrases definitely are essential. They are usually the weakest part of cryptography. Even with salted password hashing, a bad, short, well-known password will still be cracked quickly even without rainbow tables (unless bcrypt/scrypt/argon2 is used).

If you don't trust this salt technique (and I'm not suggesting that you should or shouldn't), use a great passphrase. A six-word Diceware passphrase should take the NSA 3,500 years to crack (even if they know it's a Diceware passphrase). Although it's only 77 bits of entropy. To get 128 bits of entropy, you need a ten-word Diceware password. A good place to get Diceware passwords is https://www.rempe.us/diceware/#eff but there are others.

Actually, forget the above. I think whoever told you that symmetric encryption involves a one-time random key was wrong. Having read the links thoughtfully provided by RubberStamp, it seems that the passphrase and the salt are the inputs to the s2k (string2key) key derivation function to create the symmetric key that is then used to encrypt the data. So there is no random key for symmetric encryption. I think whoever said that there was was confusing gpg's asymmetric encryption with its symmetric encryption. With asymmetric encryption, there's a random symmetric key which is encrypted using the public key and decrypted using the private key. With symmetric encryption, there is only the passphrase and the salt. So, yes, the strength is entirely dependant on the strength of the passphrase (see above). The purpose of the salt is not to strengthen the passphrase. It's to ensure that the actual key used to encrypt a file is unique to that file so that, even if you use the same passphrase to encrypt every file, and you are compelled by the authorities (or other threat actors) to hand over the key to an encrypted file, instead of giving them the passphrase which could decrypt all of your files, you can just give them the session key obtained with the --show-session-key option, and then they can use the --override-session-key option to decrypt the one file that they are interested in without automatically having access to all of your other files that may have been encrypted using the same passphrase. This makes much more sense. Actually, it was RubberStamp who said that symmetric encryption uses a random key but I didn't get that impression from reading the section of the RFC that was linked to. And if there was a random key, there would be no compelling need (that I can see) for a salt. The per-file uniqueness of the symmetric encryption key can be achieved either by a random key or by salt. It wouldn't require both.


NTKRNLPA.EXE connected to strange IP Some assistance/advice needed to research this.

First: I am not sure if this is the right place to ask this. If it isn't please note and I'll close.

Over the weekend my email accounts (yahoo & corporate) were locked because of invalid password.

Looking at one of my laptops (Windows XPSP3), using ProcessHacker.exe I see the process "ntkrnlpa.exe" connected to IP 205.202.182.4. Further looking up that IP points me to:

  uk    uk  lnd london  51.514999   -0.083000   dinsa ministry of defence

What other tool would someone use to inspect this?

Edit: I added some screen shots.

You should first investigate the IP and block further. If you do a reverse lookup, just typing nslookup 205.202.182.4 into a command line, you'll see:

Name:    mil_shs_4.mil.esu3.k12.ne.us
Address:  205.202.182.4

Looking the subnet up in ARIN it's owned by the university of Nebraska, but the address looks like it belongs to an elementary school. So, nothing to do with the UK MoD.

So does this help you? Maybe, if you have nothing to do with a school at Murdock, Nebraska then one of their servers may be owned, and is being used as a C&C server for malware on your computer. If your system is connecting to this often then it's quite possible you've been hacked. Whether that is why your email accounts were locked is a different story, but it's reasonably likely.


Is it bad to use the same sequence of characters in each password? A friend of mine purposed a method of making passwords where each has the same base and added to it is something indirectly related to the site or product being signed into. For example all passwords would start with "AXxY2" and then the one for hotmail.com adds on "any letters?" so the entire password to login to hotmail.com would be "AXxY2any letters?". Is this a good system?

I personally never find reminders or hints useful with passwords so would it be better to use an unrelated unique part for each site? For example instead of having "any letters?" it would be something like "run skip bike climb".

It all depends on how much security you need.  The most secure case is to use very long, completely random passwords for every user, but practically speaking, that is also the least usable unless you use a password manager.  If you want to maintain the strongest possible security then that is what you should do, but for many people, that level of security simply isn't necessary.

On the far opposite side from that, there is using the same, short, easy to remember password everywhere.  This is super easy to use, but it isn't very secure because it can a) be guessed, b) if a user account is compromised in one place, even with the password properly protected, it will be fairly easy for the attacker to figure out what the password is and c) if it is used multiple places, there is a good chance that the attacker will then be able to access other accounts you have as well.

There are any number of hybrid ways you can work between these two extremes.  You can have multiple passwords for different security levels (separating basic forum users and news sites from personal data sites from banking and financial sites).  There can also be a system of making derived passwords that you can easily remember on some system, but hopefully the system isn't known by an attacker that might find one or two of your passwords, and thus a single compromise wouldn't impact your other accounts.

If there is a chance you may specifically be targeted, then this probably isn't a good idea since most systems you could come up with won't hold up very well against a determined and experienced attacker, but if you are just up against people trying to find accounts from a giant list, chances are pretty good even a simple system of differentiation of passwords will probably be sufficient to protect you.

Ultimately, it is up to you to decide what level of security you need and how much effort you are willing to go through to achieve that level of security.


Is using the md5 hashing algorithm as method for authorization in an HTTP POST request unsafe? I am creating a page on a website that will show a user some authorized information from another website, and that website uses a combination of the user's user-number and a secret passphrase hashed using md5 and sent over an [edit] HTTPS POST request. Is this unsafe?

Note: I am not involved in the decision making for what security procedures to implement. I am simply connecting to a 3rd party site that uses this system and I wanted an assessment of their security.

This idea raises red flags in my head for a few reasons:

MD5 is broken in a way that makes it possible for an attacker to compute a colliding hash, such that md5(a + b) == md5(a + c) without having to know b. In this case, a is your user ID, and b is your secret. As such, MD5 is is a bad choice here. SHA family hashes are also a bad choice, because they rely on the same construction and suffer the same issue. Update: No, I got this wrong. MD5 isn't quite as broken as I thought. Regardless, the following points hold true...
If you're relying on MD5 for brute-force resistance, you're going to have problems. MD5 runs way too fast for that kind of thing. You need to use a slow KDF such as PBKDF2 or bcrypt. Even so, this seems like an odd use for a hash or KDF.
The salt seems to serve no purpose here. Salts are used to prevent precomputation attacks such as rainbow tables and hash databases. If the goal is to prevent replay attacks, the salt will not help you here. An attacker will be able to replay your authentication messages.
An attacker can modify the request in-transit, by performing a man-in-the-middle attack. In doing so he is free to arbitrarily alter these messages.

The only way to properly do this is to use HTTPS (i.e. TLS) for the connection. This provides authenticity and confidentiality, and prevents replay attacks.


Sqlmap tested parameters might not be injectable When I try to inject something, after testing all parameters with --level=3 --risk=3, this shows up. Please tell me what to do, and where I'm wrong.

This is the full command:

sqlmap -u "www.mysite.com/index.php?id=1*" --level=3 --risk=3 --random-agent --string --regexp

  [CRITICAL] all tested parameters appear to be not injectable. Try to increase '--level'/'--risk' values to perform more tests. Also, you can try to rerun by providing either a valid value for option '--string' (or '--regexp'). If you suspect that there is some kind of protection mechanism involved (e.g. WAF) maybe you could retry with an option '--tamper' (e.g. '--tamper=space2comment')

It means that sqlmap has not found any sql injection on parameters you tested.
From my experience there is a chance there might be sql injection but you will have to test it manually as not tool is as good as humans brain. Or if you want to continue with tools try sqlninja or havij or any other automated sql injection exploitation tool.

Good luck.


Go through proxy server to Find an original IP Address I work for a small company who has troubles with third parties selling our products on Amazon. Sometimes those third parties have websites and when I use an IP address finder online it gives me coordinates to what I think is a proxy server because there has been a few times where I enter different IP addresses but I get the same coordinates. Is there a way that I can go through the proxy server and find the original location for that website. I am a huge novice when it comes to this so I do not even know if this is possible but I would love any help that I can get. Thank you

Use traceroute:

traceroute <ipaddress>

on linux.

ex:

john@john-ubuntu:~$ traceroute google.com
traceroute to google.com (173.194.46.101), 30 hops max, 60 byte packets
 1  ...
 2  ...
 3  ...
 4  ...
 5  ...
 6  ...
 7  ...
 8  74.125.49.37 (74.125.49.37)  18.659 ms 205.213.119.62 (205.213.119.62)  18.648 ms  18.605 ms
 9  209.85.254.128 (209.85.254.128)  18.595 ms 209.85.254.130 (209.85.254.130)  18.516 ms  21.724 ms
10  209.85.245.225 (209.85.245.225)  18.836 ms  18.630 ms  18.617 ms
11  ord08s13-in-f5.1e100.net (173.194.46.101)  18.246 ms  18.305 ms  18.220 ms
john@john-ubuntu:~$

install on Ubuntu:

sudo apt-get install traceroute

Fedora:

sudo yum install traceroute

Edit:

You could also just do a whois, which might be easier:

john@john-ubuntu:~$ whois google.com

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

...

Registry Registrant ID:
Registrant Name: Dns Admin
Registrant Organization: Google Inc.
Registrant Street: Please contact contact-admin@google.com, 1600 Amphitheatre Parkway
Registrant City: Mountain View
Registrant State/Province: CA
Registrant Postal Code: 94043
Registrant Country: US
Registrant Phone: +1.6502530000
Registrant Phone Ext:
Registrant Fax: +1.6506188571
Registrant Fax Ext:
Registrant Email: dns-admin@google.com
Registry Admin ID:
Admin Name: DNS Admin
Admin Organization: Google Inc.

  Admin Street: 1600 Amphitheatre Parkway
      Admin City: Mountain View
      Admin State/Province: CA
      Admin Postal Code: 94043
      Admin Country: US
      Admin Phone: +1.6506234000
      Admin Phone Ext:
      Admin Fax: +1.6506188571
      Admin Fax Ext:
      Admin Email: dns-admin@google.com
      ...

This should give you all the info you need!


Does a completely random string produce a completely random hash As the title states, say you create a hypothetical completely random  string like one used for a OTP. Would hashing the string (provided it is the same length and possible characters as the hash output) and using the hash make the OTP any less cryptographically secure then just using the string as a key?

Hashing never outputs random string.

A hash algorithm is an algorithm which manipulates the input data in very strictly defined steps and outputs the result.

You can't know how the output will looks like before calculating the hash, so according to your question: if you input a random data, the output will look like random (but only to you, and not to the original data).

As much the length of input matches length of hash output, both methods are safe enough.


RSA: Is it safe to go without padding if the message length == key length? I've been reading about the algorithm, and I've seen that a number of attacks against textbook RSA are based on encrypting shorter messages and checking the result. If padding does what I think it does (expand out the message to be the same length as the key), is it safe to forego padding if the message is guaranteed to be length of the key already?

As far as I know some padding schemes introduce random characters, so my gut tells me that it is required anyway to prevent against plaintext attacks.

Should I go for a smaller message size and add padding? Or is it safe to use m==n and no padding.

When you encrypt a message using RSA, padding is needed to ensure several properties:

Encrypting the same message twice must result in different outputs, to prevent a chosen plaintext attack. This is the reason why paddings are randomized.
RSA preserves some structure, padding should eliminate that structure.
When an attacker manipulates the ciphertext, you want to reject that forgery in a way that prevents the attacker from learning anything.

Many older paddings, such as PKCS#1v1.5 fail to ensure this, and thus are broken for many applications. You should use OAEP padding.

Alternatively you can just encrypt a random number of the same size as the modulus with RSA and use its hash as key for symmetric encryption (e.g. AES-GCM). This is known as RSA-KEM and doesn't need any padding. It produces larger ciphertexts but is easier to implement.


How to protect unauthorized logins in case DB server gets compromised? Generally what happens when an user registers to a web app is that their passwords get hashed well, so even if a DB leak happens, getting the original password is not feasible.

But what happens if an attacker (or a malicious sysadmin) gets access to the DB and APP server and instead of dumping the data, he/she seeks out the code doing the hashing/salting, with that knowledge forges a new hash, and simply drops it inside the appropriate field in the DB?

I know this is a very unlikely scenario, but is there an industry standard way to protect the user accounts against this?

Clarification: The attacker would only have read-only access to the APP server, and read-write permissions to the DB.

Effectively, all the attacker is doing is changing users' passwords. This would enable the attacker to login to those users' accounts. As for how you protect against this, I'm not sure you should bother. If someone has read/write access to your DB you're pretty much sunk. You need to protect from someone obtaining read/write access to the DB in the first place, not try to prevent someone who has write access from just changing someone's password.

This is sort of like wondering, if someone breaks into your home, how could you stop them from opening the fridge and stealing your beer?


Security in large-scale SOAs Let's assume a service-oriented architecture (SOA) with hundreds of services. The services are completely isolated – what is behind their APIs is an implementation detail.

Different services can have different security policies – i.e. who can access the service. For example, a service can be fully public, accessible to a subset of employees, accessible to a subset of other services, etc. Some services may even have that specified on the API level, for example a public service with some internal API calls (is that a bad idea?).

How should the infrastructure interconnecting the services reflect the security policies? Are there any standard approaches to this? Is it known how Amazon does it - they surely must have an automated solution?

I googled a bit but didn't find any good resources on this. Links are absolutely ok as answers to this question :)

Well.. that's quite a broad question, but, let me see what I can uncover for you. Let's start with your questions:

Some services may even have that specified on the API level, for example a public service with some internal API calls (is that a bad idea?).

I'm not sure I understand what is being asked here. When you say "internal API call", I am assuming that you are referring to a private service that the public API is accessing. This is indeed "ok", assuming that the internal service is behind a strict firewall.

How should the infrastructure interconnecting the services reflect the security policies? Are there any standard approaches to this?

Let's start with the creation of a new service. I highly recommend viewing this book, especially for access controls. Essentially, a newly created service or subject should assume the following:

A secure default policy should be applied to any newly created subject
The attributes of the system should not be expressed in terms that can easily be forged such as an IP address.
A user ID or service ID should remain permanently assigned to a service/subject

Once created, the service will then need to communicate with your internal services. In terms of security and policy, this is rather difficult to answer since it depends on what you choose for transfer protocols / messaging / etc...  For example, using an internal architecture such as ESB. Here are a few articles to outline utilizing ESB:

Intel's, "SOA? ESB? What is all this?"
Mulesoft's ESB
JBoss ESB

and a few security focused articles outlining SOA ESB:

this article.
NetworkWorld's Article

However, I do know that amazon does not use ESB via this article, though I did find a few articles that may help as well:

Amazon's "database" solutions
General SOA Security

Again, the security policies will reflect what the transfer protocol / messaging protocol, etc for service to service. For example, services communicating via proprietary ports (all behind a firewall).

Hope something in there can help!


Is there any way for a client to view headers set by an NGINX reverse proxy? I am setting up an NGINX reverse proxy, which sits in front of an API. I would like to use:
proxy_set_header X-Secret-Key ${SECRET_VALUE};
to add a token to the request, which is then read by the API. ${SECRET_VALUE} is pulled from a secrets vault and injected into the conf file at runtime. For the purposes of this question, we can assume the secrets vault is secure. We can also assume that the API does not do anything silly, like add X-Secret-Key to the response headers, and that the connection between the reverse proxy and the API is secure.
My question: is there any way that an attacker can view request headers added by the proxy in this way? Or are they only visible to the proxy itself and the API?
Many thanks.

... an attacker ...

There is no generic attacker and there is no generic attack target. If you mean an attacker in front of the proxy then they will not be able to access the API key provided " that the API does not do anything silly".
If the attacker can compromise the proxy though or can use an information leak in the proxy with access to the key then the attacker can get access to the key. If it is possible to compromise the proxy or if there is a key-leaking information leak is unknown just based on your description.
Also, if the attacker is between proxy and API they might be able to get access to the API key too, depending on how well the connection between proxy and API is protected against MITM attacks.


Is it possible to disable all PHP functions not used in my application? I want to secure my PHP installation. I can disable some functions, like system(), exec() etc using disable_functions in php.ini. But I can forget to disable some dangerous functions. Is it possible to disable all functions, excluding the ones already used in my application?

To hook into @UTF-8's comment, using PHP_Parser, you can fairly easily generate a list of default PHP functions not actually used by your application which you can then store in the disabled_functions configuration option:

<?php

require 'vendor/autoload.php';

use PhpParser\Node;
use PhpParser\NodeTraverser;
use PhpParser\ParserFactory;
use PhpParser\NodeVisitorAbstract;
use PhpParser\PrettyPrinter\Standard;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Function_;

class Collector extends NodeVisitorAbstract
{
    public $functions = [];
    public function leaveNode(Node $node)
    {
        if ($node instanceof PhpParser\Node\Expr\FuncCall)
            $this->functions[] = (string) $node->name;
    }
}

$sourcePath = __DIR__ . '/test/';

$files = new \CallbackFilterIterator(
    new \RecursiveIteratorIterator(
        new \RecursiveDirectoryIterator($sourcePath),
            \RecursiveIteratorIterator::SELF_FIRST
    ),
    function($current, $key, $iterator) { return preg_match('~.php$~i', (string) $current) > 0; }
);

$nodeTraverser = new NodeTraverser();
$nodeTraverser->addVisitor($visitor = new Collector());
$parserFactory = new ParserFactory();
$parser        = $parserFactory->create(ParserFactory::PREFER_PHP7);

foreach ($files as $file)
{

    $stmts  = $parser->parse(file_get_contents((string) $file));
    $nodeTraverser->traverse($stmts);
}

$defined_functions = get_defined_functions();

$blocked_functions = array_diff($defined_functions['internal'], $visitor->functions);

echo 'disabled_functions = "', join(',', $blocked_functions), '"', PHP_EOL;

Something similar can be created for disable_classes, just look for PhpParser\Node\Expr\New_ instead.

Some things to consider:

Your first step should be to reduce the amount of modules your instance of PHP is loading.
It's going to be annoying to manage this.
You're going to have a bad time if you use anything dynamically.
Having a large disable_functions setting may have a performance impact. You may want to consider using Suhosin's whitelist functionality as suggested by https://security.stackexchange.com/a/122471/242.


HTTPS web service switched to HTTP. What can go wrong? I recently visited a website which used to have an HTTPS connection. Now it has just a plain HTTP connection, and the authentication method has changed from user+password to "authenticate with Google account".

I contacted them and asked them why they dropped the HTTPS, and they told me "because now the authentication is secure with Google, so it is not necessary anymore".

Well, I am not an expert in security, but before replying to them, I would like to know: what could go wrong?

So, with my little knowledge, I would say (correct me if I am wrong):

Privacy loss in the communications between client and server (the attacker can read any information exchanged, and that includes personal information that the client may be posting to the server).
An attacker could modify the client's requests, maybe with malicious intentions.
An attacker could read the cookie and use it to get access to the service as if they were the client that originally authenticated using Google's services.

Am I right? What else could go wrong?

You are right, the regression to HTTP is pointless.

Note that all your points apply to one particular kind of attack, where the adversary is able to access the data transport between client and server. That could be the owner of a WiFi hotspot or your ISP acting as a man-in-the-middle, who sits in between you and the server. This can be hard to accomplish for a remote attacker, but is particularly easy on a public WiFi.

What HTTPS adds to HTTP is secure data transport. The web application itself can be completely fine - if you are communicating over an unencrypted channel, the attacker will be able to read, modify and inject arbitrary data into your requests and the server responses. With a captured session cookie, it will also be possible to impersonate you for as long as the cookie is valid.

What the attacker cannot do is take over your Google account or reauthenticate with Google at a later point. This is because the authentication with Google always happens over SSL and the granted token expires after a given time.

So the situation is somewhat better than capturing your credentials straight away. However, as you said, an attacker would still be able to take over the session and perform any action on your behalf.


vulnerable webapp pentest challenge So I have this challenge in pentesting to get a shell on a vulnerable webapp. I am an authenticated user and I know that the vulnerable app is kcfinder-2.51 which is a plugin for ckeditor_3.6.4.

I am trying to upload weevely shell, but the problem is that the server is configured to redirect everything to 404-page if it's a directory or if it's a wrong file.

Another problem is that the upload directory is unique to every user even a non-authenticated user has a different upload directory.

How do I know which upload directory the shell is uploaded on?
And if I upload a .htaccess file in that directory can I enable directory listing or change the config?

You can do much more than enabling directory indexes with a .htaccess file. Take a look at my htshells project: https://github.com/wireghoul/htshells/


What are rainbow tables and how are they used? Where can I find one? Is there a pot of gold at the end?
How do I protect against them?

From the Area51 proposal

  This question was IT Security Question of the Week.
  Read the Sep 09, 2011 blog entry for more details or submit your own Question of the Week.

Rainbow Tables are commonly confused with another, simpler technique that leverages a compute time-storage tradeoff in password recover: hash tables.

Hash tables are constructed by hashing each word in a password dictionary. The password-hash pairs are stored in a table, sorted by hash value. To use a hash table, simple take the hash and perform a binary search in the table to find the original password, if it's present.

Rainbow Tables are more complex. Constructing a rainbow table requires two things: a hashing function and a reduction function. The hashing function for a given set of Rainbow Tables must match the hashed password you want to recover. The reduction function must transform a hash into something usable as a password. A simple reduction function is to Base64 encode the hash, then truncate it to a certain number of characters.

Rainbow tables are constructed of "chains" of a certain length: 100,000 for example. To construct the chain, pick a random seed value. Then apply the hashing and reduction functions to this seed, and its output, and continue iterating 100,000 times. Only the seed and final value are stored. Repeat this process to create as many chains as desired.

To recover a password using Rainbow Tables, the password hash undergoes the above process for the same length: in this case 100,000 but each link in the chain is retained. Each link in the chain is compared with the final value of each chain. If there is a match, the chain can be reconstructed, keeping both the output of each hashing function and the output of each reduction function. That reconstructed chain will contain the hash of the password in question as well as the password that produced it.

The strengths of a hash table are that recovering a password is lightning fast (binary search) and the person building the hash table can choose what goes into it, such as the top 10,000 passwords. The weakness compared to Rainbow Tables is that hash tables must store every single hash-password pair.

Rainbow Tables have the benefit the person constructing those tables can choose how much storage is required by selecting the number of links in each chain. The more links between the seed and the final value, the more passwords are captured. One weakness is that the person building the chains doesn't choose the passwords they capture so Rainbow Tables can't be optimized for common passwords. Also, password recovery involves computing long chains of hashes, making recovery an expensive operation. The longer the chains, the more passwords are captured in them, but more time is required to find a password inside.

Hash tables are good for common passwords, Rainbow Tables are good for tough passwords. The best approach would be to recover as many passwords as possible using hash tables and/or conventional cracking with a dictionary of the top N passwords. For those that remain, use Rainbow Tables.


Security implications for two applications communicating with TCP/IP on localhost Considering this for the local loopback connection: -

  It is implemented entirely within the operating system's networking software and passes no packets to any network interface controller.

If two applications on the same machine communicate with TCP/IP using the loop back address 127.0.0.1, will other applications on that machine, such as Wireshark, be able to intercept the packets and view the data being sent between the applications?

As you say, when the communication happens on localhost, no packet whatsoever goes to the external network, so if capture happens, then it must happen on the machine itself.

There are two noteworthy points in that respect:

Capturing on localhost does not work on all OS. Notably, it does not work well on Windows (there are partial solutions), while it works on Linux.
Capturing requires some extensive access rights. People who can capture localhost traffic already have root or Administrator access on the machine, so they can also directly inspect the RAM of the involved process, and generally do what they want with the machine.

Thus security issues related to a localhost connection do not come from traffic capture. More usually, problems come from unprivileged applications on the same machine (running as another local user) which connect to the server. A security-aware local server will usually use getpeereid() (on Unix-like systems) to know who is connecting to it.


How does a website know the DNS server a client uses? There are websites which claim to do "DNS leak tests". I don't care so much about DNS leaks but am curious, how does the website know which DNS server I am using? I guessed it would be a header sent in the HTTP request but wasn't able to find it.

Example website: https://www.dnsleaktest.com/

EDIT: there are plenty of other examples found through a google search.

This is a DNS resolution trick that could also be performed using non-http protocols but in this case is performed by using random hostnames and zero-pixel images via http.

Look at the source code on the page and you will see a series of random 10-character subdomains requested for several URL's. These are very unique hostnames which neither your computer or your ISP, or more importantly your DNS provider, will have cached in local DNS.

When these unique URL's hostnames hit your DNS provider they then have to request them from the testing companies website who then correlates the owners IP address doing the unique DNS request and then notifies you of the company name that made the request via a quick lookup

List of randomized host names all for the same domain

ixc9a5snm4.dnsleaktest.com
rhl50vm36o.dnsleaktest.com
4xov3y3uvc.dnsleaktest.com
2n5t99gbzp.dnsleaktest.com
6mzklkved4.dnsleaktest.com
d6z20e9c2x.dnsleaktest.com

can be found in the following html (your hostnames will be different)

.
.
.
.
.
.


What risks does WPA carry? A family member of mine would like to be able to play old PSP games online. Unfortunately the device does not support WPA2, and my network is strictly WPA2 AES secured. What are the risks involved in operating a mixed WPA/WPA2 infrastructure, assuming that AES is forced rather than TKIP?

WPA isn't that secure, but then again WPA2 is no great shakes either. The main risk is that WPA's encryption is easier to break, and implementing WPA versus WPA2 would make it easier for an attacker to discover your key, which is the same for all devices presuming you are running personal mode, even if you can run mixed WPA/WPA2. WPA and WPA2 share some of the same structural vulnerabilities, so WPA2 isn't so much better that running WPA/WPA2 mode is an enormous step down in security.

Really though, part of your risk assessment should include likelihood, and what the potential impact could be. This sounds like a home setup, what is the likelihood that someone is going to pick your home's WiFi to crack, especially considering that there's probably some open or WEP-enabled networks that are easier pickings. And what is the damage potential if someone was successful? Is there anything in your home that someone would want to specifically target?

Most likely the actual risk is pretty minimal, but if you're worried you could enable MAC address filtering (although a skilled attacker isn't going to be slowed down much by that), or you could buy a second WiFi access-point (dirt cheap these days) and put it onto a DMZ network with no access to your main network.


Detecting old file extension name of corrupted file For example, someone corrupted the file before deleting it.

I opened a Word file via vim, or leafpad and deleted information & then changed the file extension to mp4. And then deleted it.

How can I know that this mp4 file was a .doc some times ago, after recovering this file via recuva? Is it possible?

The file extension does not determine what format a file is in; they exist so that applications can identify and open their respective known filetypes, and secondly so users can see what type of file it is (although some file explorers, notably Windows Explorer in Windows 7 and later by default, will hide the file extension if the extension is known).

Most file types contain a file header or "magic number" in the first few bytes of the file that are unique to the particular file type. Tools such as the UNIX file utility exist to read and identify files based on their magic number. Changing or removing the file extension does not affect the contents of the file and thus does not diminish the ability to recover the file type with this method.


Good Default TCP Connection Timeout Time I am trying to configure the firewall at our company and I was wondering what a good default TCP connection timeout would be. We currently have it set for 10 minutes but I feel like this is too long but at the same time I am not really sure.

If anybody has any advice or knowledge on the subject it would be greatly appreciated.

This fully depends on the kind of applications you are running. If this is only simple web traffic then a timeout of a minute should already be sufficient. But, if you have long living TCP connections which can be idle for a long time and where the peers don't use TCP keep alive or similar to keep the connection open then even 10 minutes will be to short. Typical applications like this might be telnet or SSH sessions but also IMAP connections which expect the server to notify the client if new mails arrive can be idle for a long time.

Thus, know your network, know what kind of applications are in use and how they behave in the network and only then you can decide what an appropriate timeout will be. And unless your firewall exposes only basic functionality you could also have different timeouts based on the target port of the TCP connection and maybe dynamic adjustments of timeouts based on the number of currently tracked states, i.e. shorter timeouts when more states are open to keep the memory usage down.


How does duqu implement its dll files in PNF file format? As you know files with PNF extension are associated with bitmap file type, from  technically point of view how did authors of duqu implement this? as I concluded it is possible to make dlls in any file format, am I right?

As SteveS said in the comments, Windows doesn't care what file name you use - it's just a label. The "file extension" is only used as an indicator for how a user can interact with the file. Many applications also use it as a way to indicate that the file is of a particular type, but ultimately it's nothing more than a naming convention and shouldn't be relied on.

As long as the file is a PE format module, it can be loaded into a process as a module, e.g. via kernel32.dll!LoadLibrary. In fact, Windows relies on this behaviour in many cases, since .exe, .dll, .cpl, .ocx, .sys, .scr and .drv files are all PE files.


Are there XSS vulnerabilities while image preview before uploading it? I wrote a JQuery tool to preview images before uploads.

User A clicks the explore button to select an image
selects it
a change-event displays the image

If user A selects a prepared SVG image as "greetings_ILL_xss_your_site.svg" or "greetings_ILL_xss_your_site.gif" my JQuery will get the image from tmp dir, resize and display it.

As svg are small programs, and gif can contain scripts:

Could it run code that uses XSS scripts?
Is the previewed image authenticated to run script requests?

No, there's not. If someone wants to attack one's own machine with JS, devtool's console tab is much easier than crafting a bad svg. XSS is only a problem when malicious code is shared with other users. If the user was unaware the file was malicious, it could present a problem, but it's not yours to deal with.

Furthermore, the origin/protocol context in which a preview image would be displayed (data: or blob:) should protect your site from being reached by a bad image's code anyway (though some zero-days or whatever could be possible).


"It is safe if only Port 443/HTTPS is accessible from Internet!" Is it? I was in discussion with a vendor to implement a backup solution and as flexible as most cloud applications nowadays, it needs to be access from anywhere on Internet without VPN or any special tunneling.

From high level perceptive, the solution has a web-ish application that client talks to and it needs to talk to a MS sql for some database/datastore operation. I am a little concerned to expose the application to Internet even just port 443/HTTPS as assured by the vendor rep. As traditional design, I could put the application into DMZ and leave SQL inside. I am still not 100% comfortable but I do not have a scenario in my mind to prove my concern.

I need your help convince me that it is not safe to expose web application to Internet even just port 443.

Port 443 is the default port for HTTPS communication using SSL/TLS. As such, if you can reject and/or redirect traffic on port 80 (the default unsecured HTTP port) and reject all other ports, and if you can trust your web server OS's TCP/IP and TLS implementations, this scheme is as safe as any publicly-accessible computer communications endpoint can be made, from a hardware/firmware perspective.

However, this only proves that the means of communication is secure, and that this comm channel is the only way to get in. That can still mean the application communicating over this channel has vulnerabilities. Someone could hijack the remote system and use the secure channel to request information the person normally wouldn't be able to get. The remote system itself could store information it retrieves from you in an insecure manner. The component of this solution residing on your webservice could be vulnerable to any number of attack vectors that don't require breaking TLS itself; a third party could, for instance, perform a replay attack to corrupt data by making your server do things twice. Or, they could properly negotiate a TLS connection with your server and then pound on the relatively weak authentication system provided by the application.

In short, just because you can expose only port 443 to the world and accept only properly-negotiated TLS connections through it does not necessarily mean your system is secure. You must also trust that the application using the TLS channel is properly implemented to prevent various attacks carried out by systems using the channel. If you cannot trust this application, you should not use it.


Authenticated encryption (Symmetric encryption) for .NET applications Is there an implementation of Authenticated encryption for .NET applications?

The AES API from .NET does not include mode such as GCM. In the documentation, I can only see insecure modes (ECB, CBC, OFB, ...) that can not be use alone.

Very important : I am looking for a mature implementation not a GitHub project used by 1 person or an old/dead project.


Is a host OS more vulnerable to a hypervisor escape if the guest OS knows the root password to the host? This is assuming that escaping the hypervisor is the only way the guest OS could compromise the host-- e.g. it's not networked, isn't sharing folders or the clipboard, etc. Does knowledge about the host's root password matter in the context of maintaining isolation through a (type one or two) hypervisor?

In order to use the root password, the hypervisor must first be escaped.

The root password is only used by userspace applications to request greater permissions. The way a root password works is simple. When an application wants to switch to a more privileged user, a trusted and privileged program reads the password, hashes it, and compares the hash against the stored password hash in /etc/shadow. If the password matches, this trusted program executes the application as root. This is why the root password is considered sensitive.

In order to (ab)use the root password, a malicious application needs to be able to perform syscalls, the primary API between userspace and the kernel. To use the su program to elevate privileges for example, the execve() and read() syscalls are needed to run the program and pass the root password to it, respectively. A guest operating system running in a hypervisor does not have access to syscalls on the host, only to the hypervisor itself (using so-called hypercalls), and to the kernel which is running virtualized. In order to escape from the hypervisor, a bug in its programming must be exploited. Knowledge of the host's root password thus does not help escape a hypervisor because it can only be used to elevate privileges after the hypervisor has already been broken!

While knowledge of the root password does not make a hypervisor escape easier, it is still not necessarily a good idea to give it to the guest. If the hypervisor is running unprivileged but is not sandboxed (e.g. QEMU with sandboxing disabled), a hypervisor escape may allow the attacker to run with the privileges of the hypervisor software. If they know the root password, they may use it to elevate privileges after they have broken out of the hypervisor.


What prevents me from launching an SYN-ACK flood using HTTP servers? I've been studying networks lately and this issue came across my mind.

What prevents me from sending a lot of SYN requests with source address of my (attack's) target and flooding the target's internet line with SYN-ACK packets?

This gives me advantage over simple SYN flood (or UDP flood) against my attack target -- anonymity, I can hide my real IP this way and make my attack pretty hard to mitigate by blackholing, because I can force any HTTP server on the internet to send the traffic.

Another advantage is that I can send the SYNs to the HTTP servers from almost any computer in a botnet - including those behind a firewall.

My question is: Why can't I do this? Why hasn't this been exploited in the wild?

This is a long known-about attack called a "reflected DoS". The reason it mostly doesn't cause much of a problem for defenders is that receiving an unexpected SYN+ACK doesn't take up any state on the target server; at most it may send back a packet to say "uh, sorry, wasn't expecting that" which may cause some saturation of their network connection in a scenario where the attacker has a lot of bandwidth at their disposal, but mostly this isn't very useful to attackers. Most of the time, the firewall in front of the service will see that there's no open connection and just drop the packet silently. In general, SYN and SYN+ACK packets are very small, so you need a huge number of them to cause any problems for a defender in terms of flooding.

By contrast, the reason SYN flooding is sometimes effective is not that the network link becomes saturated, but that the server's TCP stack is expecting the new clients to send an ACK and must maintain state until that wait period times out, causing the half-open connection limit to be reached and new connections from legitimate users to be denied. This is, however, mostly mitigated in most sensible scenarios by use of modern TCP/IP stack implementations and defensive measures such as TCP cookies and firewall / IPS rules.

The type of flooding reflection attacks more commonly seen are those which amplify the attack in the process, whereby small packets sent by an attacker generate large response packets from the server, allowing the attacker to amplify the volume of traffic significantly. This was mostly initially exploited against DNS servers, but more recently attackers have identified many other services which produce even greater amplification coefficients, particularly NTP.


Dedicated application server security I'd like to expose a machine running Windows Server 2012 to the internet. I plan to run a single application that uses a specific port (say 12345) and then use RDP through 3389 to logon and manage it. I would use the firewall to block access to all but these two ports.

Assuming the single application itself is secure, I'd like to know whether there are aspects of security I need to consider, and if so, what they are.

Update 9/26/16
Sorry I didn't respond sooner; one of my email filters marked your reply as read. Thanks for replying.

I plan to rent a server, or virtual server, from someone like 1&1. Based on your response I guess I'd rent two and use one as a router. Maybe all of their servers sit behind a router - I'll have to ask.

I've noted your bulleted suggestions and they all make sense. I'll look into smart CDN services.

I think I understand the matter of dealing with DDOS attacks on the open ports but I'm not quite clear about how the machine is vulnerable if I've blocked all ports except for the application and RDP. Could you expand on this a little?

I wouldn't recommend connecting any machine direct to the Internet if you can help it. There are too many attack vectors that you are exposing yourself to, many of which will be unknown.

In any case, doing so would be very unusual indeed. In almost every case, you would connect the server via a router that would have at least some basic protections built in. Things such as invalid packets and basic Denial of Service attack protection are common. You would also use that to limit the incoming open ports and forward incoming traffic to the correct internal IP address (NAT).

In addition, you need to make sure that:

The server & its software is constantly patched. Ideally, patches should be pushed from a trusted server deeper inside a protected internal network.
You are running anti-malware protection. At least Windows Defender.
You should turn off every process that isn't needed and uninstall all unnecessary software and services
You should move the RDP connection onto a non-standard port. You can do this at the router/firewall using port forwarding or on the server itself.
You can also configure the RDP server to use TLS which will provide additional protection over the standard RDP traffic.
You must make sure there are no default user names on the server and that any user ID's have very strong passcodes, especially admin users.
You should use another machine - preferably further inside a protected network - to grab logs from the server and those logs should be monitored for unusual activity. This should be done automatically using a monitoring system.

You might also want to think about denial of service attacks. If the application that is being served is a web service, you might consider using a smart CDN service such as Cloudflare to provide smart caching and DDOS protection. In that case, you can restrict incoming connections to the app port to only be from the CDN.

Of course, how much effort you put into this depends partly on the value of the information the server is handling. But you also have some responsibility to the rest of the Internet to ensure your server doesn't end up as part of a botnet.


Encrypt web.config file using Data Protection API I have encrypted part of my web.config file using the Data Protection API.

Now, my question is, what does a hacker need in order to decrypt the web.config file?

Does he require physical access to the machine in order to decrypt it?  Or can he decrypt it from a remote location?

It depends.

If the attacker gains access to your web.config alone, then he's not able to decrypt it without the key, which we're assuming he doesn't possess.
If you've set useMachineProtection to true in your DpapiProtectedConfigurationProvider configurations, and the attacker gains access to your machine (remote or not) with any account, then any process running on the machine could decrypt the web.config file, including anything the attacker could run.
If you've set useMachineProtection to false in your DpapiProtectedConfigurationProvider configurations,  then the attacker needs access to the user account used for the process (remote or not).

You need to know that DPAPI provides password-based protection. So, assuming you're using option #3, then even if the attacker gains physical access to the machine, they still need the account's password to decrypt encryption keys which will decrypt the data. Of course, the attacker can easily reset the password, but that would render the encrypted keys useless and leaves your data inaccessible.

Note that until .Net 3.5 SP1, useMachineProtection is set to true (bad) by default. I have no information on later versions.

Update: .Net 4.0 uses the default value true for useMachineProtection as well.


How do I release a self made program without it being tracked back to me? For clarification, I am looking for the best way to release this program anonymously, not how to remain anonymous and such in general life (that is a different -already answered- question).

I've created a program myself not pirated/cracked and would like to release it to the world but do not want anyone to know I created it...

What is the best way to realistically assume that the author will not be determined?

Do I simply walk around the tube station and drop a usb with it and hope someone picks it up and uploads it to a torrent site (a big stretch). I would also like to limit all potential exposure -physical and digital.

My program is not malware and is something people would use but like I said, I do not want to be tracked at all.

Additional Details From Comments (I delete my comments so there is not so much clutter)

This is a standard compiled program with source code files as well. I've created binaries for linux and compiled a .dmg for mac as well as an .msi for windows (for the non-technical users). I actually do not have an IOS app (or any mobile app).
We can assume that it is ok to know the creator posthumously, thus in ~100 years.
I anticipate this program to become widespread. As such many people will want to determine the origins. I cannot give details about the program or it's functionality.
I am looking for a form of realistic statistical security (seen in cryptology theory; IE mathematically guessing RSA will take X amount of cpu hours). I would think that there are ways to be statistically anonymous (IE having more possibilities of where/who a person is than possible cpu hours)
Assume an adversary with considerable resources. I cannot give details on the anticipated adversary.
The level of protection is simply avoiding 'substantial' evidence. I do not care so much if the identity is suspected (even heavily) based on supposition, but I am look for a way to avoid the vast amounts of hard evidence left behind that could be tied to the author.
I have taken some precautions and I hope to be as ambiguous as possible (without having this question closed). Also, the whole branch of this question is completely isolated in every meaningful way from the program and its author. Likewise, the distro of the program will be isolated from me etc... My goal with this post is to garner feedback and peer review some ideas of my own...
I do not care if someone(s) else take credit for my app, in fact that may be better for its survival (and mine;)
This program does not need to be hosted by myself nor do any of its components. For release, I am looking for a solution like a bit-torrent where it is decentralised.
The initial release will be fire-and-forget. I have made every effort to make my code available and understandable in hopes that many other developers will be able to tweak it should future changes be needed. I have taken so many steps to make this software future compatible but only time will tell. To that note, I may release additional 'patches' but that depends on many factors...

This is an interesting question because it is almost entirely nontechnical. One presumes from your question that you are releasing something that would offend more than one national government.

Digital Opsec

Compartmentation: Only work on it using resources that are not associated to you. One cross-contamination will burn you (that is how DPR was sent up -- he once used his Silk Road laptop from home and once posted with a reference only DPR would know about Silk Road under his own name). This means a laptop only for this program that has the battery removed when you are within 200 meters of your home
When you compile it, run the compiled binary through "strings". If you see anything that is a word you use, determine if it can be removed
Use variable names, subroutine names, object class names that are consistent with another lexicon. Careto was attributed to the Spanish because the analyzed binary had names in Spanish, one of which was the word careto, meaning an ugly mask
Strip the executable and any libraries before packaging it

Offline Opsec

Compartmentation: As The Offspring said, http://youtu.be/G2gTFBhQ7Ko. That means EVERYTHING: cell phones, cell phone service (personal is Sprint, program is Ma Bell), laptops, usernames, passwords, email addresses, email hosting providers (personal is gmail, then program is hotmail), EVERYTHING

If it is used for the program, it is never used for your purposes
If it is used for your purposes, it is never used for the program
If you check your Facebook once from your laptop for the program, you have been made

BTW, members of APT1 used a hijacked machine to Twitter, to get around the Great Firewall of China, and that is how they were made
cf DPR above

Resources used for the development and maintenance of the program, the support of the program and the communication about the program should be owned by the non-natural person (see below) and should never be used for anything else (see compartmentation, above)
Plausible deniability: when something is going on with your program, be doing something else, have an alibi every time
Be blase and naive about the existence and function of your program. "Oh, did someone make that? Not sure why they would. It sounds interesting. Tell me about".
Create a legal fiction (read "corporation") to own your program, and do not have any ties to it. Some jurisdictions are friendlier to anonymous non-natural persons (a legal term for a corporation or trust). http://www.npr.org/blogs/money/2012/07/27/157421340/how-to-set-up-an-offshore-company.
Understand the difference between anonymity and pseudonymity
Keep the development of the program, the person who owns the intellectual property of the program, the assets of that entity (bank account, tax-filings, patents), and the servers that are used to sell / distribute it in different jurisdictions. This would mean that to discover the full extent of the involvement, your adversary would have to get cooperation and collaboration with authorities in more countries

Corporation in Belize, taxes filed as a Belizian corporation operating internationally
Software development in Canada
Bank account in Dominican Republic
Assignment of intellectual property to an Irish subsidiary of the corporation
Web servers in multiple countries

Have a plan in-place for when you are made. There is no such thing as a fool-proof plan


publication of GDPR implementation I'm aware of this post that GDPR apparently does not enforce a specific standard to secure sensible data.  Based on this post e.g., there is no requirement to encrypt or hash login data in a local database, either.
GDPR however provides the user of a service the right to know what data are stored in the service's data base, and their purpose in this database.  Based on these two, I would like to know: Does an individual user has the right to know how the login user name is stored in the service' database?  With services like https://haveibeenpwned.com/ displaying possible breaches as known to them as one indicator, does it depend on courtesy if, e.g. my phone provider to disclose «we secure your login credentials hashed, with sha512sum / blake2».  Or, are there companies in Europe which disclose this part of their applied cryptography voluntarily in their contract / on their website?
I'm willing to move this question to law.stackexchange if this question is not suitable for the current forum.

This is probably a question that should be in Law.SE, but I'll try to write a quick answer anyway.
As far as I know, the users have no right to know any technical details or know how security controls are implemented. However, I believe that data controllers and data processors have the right to request specific technical details from other data processors they are relying on. In other words, you, as a user, have no right to ask StackExchange how they hash the passwords. However, StackExchange might have the right to ask their hosting provider if and how they encrypt their HDD, for example.
My opinion is based on the fact that I don't think I have ever seen such rights mentioned in the sections dedicated to the data subjects (the users), but I have seen something relevant in the sections dedicated to the data processors.
Here's an excerpt from article 28 (Processor), emphasis mine:

3. Processing by a processor shall be governed by a contract or other legal act under Union or Member State law, that is binding on the processor with regard to the controller and that sets out the subject-matter and duration of the processing, the nature and purpose of the processing, the type of personal data and categories of data subjects and the obligations and rights of the controller. That contract or other legal act shall stipulate, in particular, that the processor:
[...]
(c) takes all measures required pursuant to Article 32 (note: Article 32 is "Security of processing");
[...]
(f) assists the controller in ensuring compliance with the obligations pursuant to Articles 32 to 36 taking into account the nature of processing and the information available to the processor;
[...]
(h) makes available to the controller all information necessary to demonstrate compliance with the obligations laid down in this Article and allow for and contribute to audits, including inspections, conducted by the controller or another auditor mandated by the controller.


Is HTTPS over UDP secure? Recently, I notice that while using Google search, I am connecting to Google's server using UDP instead of TCP on both port 80 and port 443. It seems that Google is experimenting with some new technology related to SPDY QUIC or HTTP/2.0.

Since UDP is a connectionless protocol, it can be spoofed easily. Does this not make HTTPS over UDP insecure?

HTTPS over UDP is secure. This is because the security of HTTPS doesn't use any of the properties of TCP except that it is a transport layer. Just like UDP, TCP is easy to spoof and manipulate. TCP is only to make things more reliable, not more secure. With UDP, packets can be doubled, missed or sent in the wrong order. TLS is a means to fix these issues. TLS works on UDP instead of TCP. But then those issues would make the encryption more likely to break on one side, and the connection would fail.
If you start to add error correction and other features to higher protocols like TLS, you basically re-build TCP, which is bad as then you have to maintain (and build) your own TCP stack with all the problems this introduces.
The UDP connections you are observing are most likely not SPDY, as SPDY uses TCP for transport.


Skype security concerns on an enterprise network I am trying to write a security opinion that may influence policy in the future in the Enterprise-grade network which I work to protect regarding the use of Skype on the networks, and security risks thereof.  I have been trying to find recent analyses of Skype from a security standpoint, but I am unable to find more recent analyses (older than 2011 is what I have been finding).

Is anyone able to link me to a more recent analysis of Skype security, or help outline the security risks of Skype such that the security opinion is more complete?

(Security research briefs, whitepapers, etc. are generally what I'm looking for)

I believe the reports before 2011 are valid. The architecture of Skype hasn't changed since before then afaik. This type of report has been done before by many folk that I've known or worked with as well as myself. I can't give you the finished working papers obviously as it's essentially PII but here's some papers that research was based upon (apologies if you already have them) -

SANS-1
SANS-2
Bluecoat-1
Bluecoat-2

You'll also find that the vendors will regularly publish KBs in relation to Skype and how their new filter/feature extends Skype detection/analysis so it'd be a good bet searching through the Web Proxy vendor (Intel/McAfee, Cisco Ironport, Websense, Bluecoat, Trend, Symantec - trying not to show any bias - etc) Knowledge Bases.


How to log all resources my site needs from other sites? is there any simple way to log/list all resources my website (wordpress & theme) needs from the outside?
Like jquery, fonts and all this stuff. I want to host it on my own server. (doesn't matter if it's a good idea or not)

If you use Firefox, you can install Firebug, go to the Network tab, and load your site. All the requests will be shown there, so you can host them on your server and change the code for your website.


How does an iPhone app detect a proxy? I was interested to lookup the traffic of an app and I installed MITM-proxy on my Mac and set up the connection to it on my iPhone.

Actually everything worked like it should, except that the main functions are kind of "blocked" when I try to use them in the app. But when I leave the proxy e.g. turn off my wifi, the app works like it should.

At work we are using a proxy too, but the app works there without problems.
How can the app detect the MITM-proxy and is there a way to get around it?

This is likely due to the fact that the certificates used by the apps are pinned. This way breaking the TLS connection with a proxy fails.

It works in your company because the traffic is proxied, but not decrypted/reencrypted - the app does a direct CONNECT call to its server.


What is the difference between http and https with a self-signed SSL certificate? A colleague of mine has told me he doesn't see why there is a warning when visiting a HTTPS website with a self-signed certificate saying that the security may be compromised, but there is no warning when visiting a "regular" HTTP website, although the security could also be compromised.

I have failed to think of an argument against that (I understand the difference between self-signed certificates and CA-issued).

So, what is the security risk that one has when visiting a HTTPS website with a self-signed or expired certificate, that you don't have when visiting a HTTP website ?

I would like to add what is the reasoning behind the browser warning message for self-signed certificates but there is none for HTTP, but I can think of several already, "not bothering the users of 90% of the web" being one.

Note

I am aware of a very similar question, but it doesn't answer my particular question.

Update

Google realized this paradox, and they will soon mark all HTTP-not-S connections as non-secure : https://security.googleblog.com/2016/09/moving-towards-more-secure-web.html

The purpose of the warning is that by using HTTPS, there is an expectation of proper security, but a self-signed or expired certificate has vulnerabilities that the user needs to be aware of.

The "risk" is that one thinks they are properly secured, but they are not fully secured, as opposed to HTTP, where one knows there is no encryption at all.

There would not be a warning for HTTP, because there is no security (i.e. encryption) to compromise.


DDoS: A protocol where the victim says "Don't send me traffic for N ms"? When a server senses (whether or not true) it is under DDoS attack, how about a protocol where it sends a non-spoofable message upstream to routers saying "Don't send traffic to my IP address for N ms" to cut down net clogging (the server can't handle the requests anyway). Each router passes the message upstream until time expires. The process repeats as long as the "attack" continues, N optimally adjusted each time, until the attack subsides (it always does, for some reason).

This would not save the target, since it would be deliberately taken offline. But perhaps it could be used to protect other machines on the same network from being affected by the attack.

Ok, this is an obvious idea; is it used, or why doesn't it work?  Don't ask me questions; I won't know the answer.

Although this sounds like a nice idea in theory, I think there are a few reasons why this hasn't been implemented yet and won't be implemented. They mostly have to do with complexity and scalability:

If every router on the internet needs to keep track of requests from every host to throttle traffic, this would result into a very large database every router needs to update and check for every packet being routed. This has a huge impact on the router's performance.

A second thing to consider is that things like this only work if it's widely supported. Solutions like you proposed are complex, and before consensus can be found in the IETF to define standards on how to implement this (if it is found at all) a lot of time will have passed. After that, even more time passes before a large amount of routers on the internet have upgraded to software which has implemented such a feature. All in all, it can easily take a number of years before such an idea is converted into an implemented standard.

Another problem is trust. You'll need to provide some mechanism to make sure that the host or router claiming to request throttling is actually responsible for hosting that IP. Without this, the mechanism could actually be used as a tool for doing a DDoS attack, by spoofing requests for throttling for the target, thus stopping all traffic towards the host. Routing and trust is still a very complex combination. BGP, the dynamic routing protocol on which the internet is built, is still mostly based on trust, and more and more it's clear that there are a lot of people operating networks on the internet you simply cannot trust. Solutions like RPKI and BGPsec are still not widely deployed. Adding yet trust based another mechanism will make things only more complicated.

And last but not least: not everyone benefits from not sending packets. If packets are queued, this may be a burden on networks along the path. But even if that's not the case: many networks make money by transporting packets, and transporting less packets means earning less money. If a network has a direct relationship with the network under attack the may consider it a (possibly paid) service, if not, they might be reducing their income by throttling. Of course, plenty of networks also focus the good of the internet, but may won't, and that would mean that the idea won't work that well.


Is it possible for an 802.1x network (PEAP/MSCHAPv2) to have no certificate? Is it possible for an 802.1x network (PEAP/MSCHAPv2) to have no certificate (CA, user, or otherwise)?

If so, what are the security implications?

The reason I ask is: I'm regularly connecting to a particular organization's WLAN and I'm under the impression that there is no certificate in use. I don't recall accepting one, and the client configuration looks like this:

Is it possible for an 802.1x network (PEAP/MSCHAPv2) to have no certificate (CA, user, or otherwise)?

PEAP/MSCHAPv2 doesn't typically use client certificates, nor does it directly use any CA certificates in establishing a TLS connection (*see below). However it certainly requires the use of a server certificate (PEAP is a TLS tunneled EAP protocol).

  If so, what are the security implications?

The image you provided indicates you are likely using some form of *nix which is giving you two certificate options.

Addressing the second option (client certificate) first, the vast majority of users connecting to wireless with a network using PEAP/MSCHAPv2 will never need this field (I have configured/deployed thousands of APs in numerous environments and have never seen this used personally).

The important option is the first one, the CA certificate field. Why? Because this helps to significantly reduce the possibility of connecting to a fake or rogue wireless network trying to impersonate the one to which you intend to connect.

This begs the question of how the CA certificate helps. Keep in mind that before successful authentication to the network, your client has no access to the network or the resources on it. The AP or wireless controller acting as the NAS (network access server) is proxying the connection from your client devices EAP supplicant to the RADIUS authentication server. The CA certificate is being used to help validate the identity of the RADIUS authentication server to which your EAP supplicant is authenticating.

Generally speaking, the EAP supplicant must make a decision on whether it will send your username/password to the authentication server without being connected to the network. This means it is only able to work with information it has and information it is given by the authentication server, it can't go out on the Internet to check another source until after it has authenticated and it is too late to withhold your username/password.

The EAP supplicant does this primarily by checking two things (with a couple options present in many EAP supplicants like Windows and OSX, but often not on mobile devices like tablets and phones):

Is the certificate provided by the authentication server a valid certificate issued from a CA trusted by the client device?
(Optional) Is the certificate issued from the designated CA(s) in the EAP supplicant?
Does the hostname listed on the certificate match the hostname given by the authentication server?
(Optional) Is the hostname given by the authentication server one of the hostnames allowed in the configuration of the EAP supplicant?

The other options for the EAP supplicant are to either have the OS prompt the user to "check and approve" the certificate (bad idea) or to not validate the certificate at all (worse idea) before sending your username/password.

So providing the CA certificate in your EAP supplicant configuration will help by allowing it to use #2 above to validate the identity of the RADIUS server in addition to #1 and #3. You should be able to get the correct CA information and/or certificate from your IT department.

Note: portions of this answer were copied from another of my answers.


Why is the Java download only offered via HTTP, not HTTPS? I am looking to get the newest Java package on http://www.oracle.com/technetwork/java/javase/downloads/index.html

However, I can not open that page using https, which seems to leave open a great opportunity for "drive-by downloads" for MITM's by injecting malicuious content into the download stream, for example. Let alone DNS poisoning.

Even if I could find some MD5 hashes on that site, they could be manipulated.

Why does Oracle not protect the download of their assets? Or am I misunderstanding something about secure downloads entirely?

This is no excuse for Oracle not serving it's downloads over https, but there are SHA 256 and MD5 (yuck) hashes on the download page. The link is https.

This does rely on the user downloading the image to check the sha256, which unfortunately few people do.

When clicking on the 'checksum' link below you will hit a link like this:

https://oracle.com/webfolder/s/digest/8u131checksum.html


How to start with an Information Security Program? I am a software tester, InfoSec is mostly tangential to my job, and people only ask me questions about InfoSec because I am not afraid to use Google or Stack Exchange when I don't know something. (which is most of the time)

Our US operations manager wants to have a conversation with me to learn more about Information Security. He got an email from a prospect in the financial sector that includes this section:

  (a)   ACME will ensure its information security program (“Info Security
  Program”) is designed and implemented, and during the term of this
  Agreement will continue to be designed and implemented, to: (1)
  reasonably and adequately mitigate any risks identified by either of
  the parties related to the Software and Services, and the protection
  of Customer Confidential Information disclosed to ACME or ACME
  Personnel, and (2) describe and report on its own risk assessments,
  risk management, control, and training of ACME Personnel in compliance
  with the Info Security Program, security oversight regarding ACME
  Personnel, and the process for the annual certification of the Info
  Security Program. ACME will safeguard against the destruction, loss,
  alteration, or unauthorized disclosure of or access to Customer
  Confidential Information in the possession of ACME Personnel,
  including through the use of encryption while transmitted or in
  transport, or while being stored, processed or managed on ACME
  equipment when such encryption required by Law, is advised by industry
  standards for similar products or services, or is required in an
  Transaction Document (collectively, the “Data Safeguards”). ACME will
  ensure that the Info Security Program is materially equivalent to
  Customer’s own information security standards in place from time to
  time applicable to the risks presented by the Products or Services
  (collectively the “IS Standards”). The parties may redefine the term
  “IS Standards” to mean any industry-recognized standard or testing
  protocol (e.g., NIST, ISO 27001/27002 or SSAE, AT101), if expressly
  set forth in an SOW.

This language is so scary that I first pooped in my pants, and then created a security.stackexchange.com account to ask for advice because I don't even know where to start. We are a small software company (less than 40 people) that is fortunate enough to have some commercial success, and we're not careless about security, but we don't have any formal Information Security Program (yet).

Some questions:

Can someone please translate the above quote into common English?
I read something about annual certification, would it be ok to say that our company should make use of a third party security auditor and let them tell us what we should do?
Who within our organisation would typically be responsible for implementing an Information Security Program?
I am thinking about recommending to buy ISO27001 (I mean the actual PDF file that contains the text of that standard, which can be purchased for 166 Swiss Franks from the iso.org store), but who should read it? (related to the previous question)

Background information:

We collect typical CRM information to be able to send invoices.
We do not collect sensitive information, like data about the users/customers of our customers.
Our support team may ask sample data for troubleshooting purposes, and will always ask for "dummy" or sanitized data that reproduces the issue at hand.

This question is not a duplicate of How to communicate how secure your system is to your employer's clients. That posts is about how to communicate to customers - we already know that because the customer already told us which kind of communication they want - they mentioned a SOC Type 1 Report. It is also not a duplicate of How to get top management support for security projects? because management support is easy in our case: get security certified or miss out on big contracts.

I'll give it a shot.

In a nutshell, the language is CYA in case you get breached or hacked and have access to their data, they can tell their customers "Acme said they had a security program and was protected so this is their fault".

In that case if you end up being the cause of them losing data, they can blame you.

That being said, its pretty standard contract language when companies are partnering or sharing data.  Mostly its a "Due Diligence" type artifact.

Regarding your questions:

  Can someone please translate the above quote into common English?

Basically you need to have documented security policies/procedures.  Within those documents you should state what you do to maintain systems and ensure that adequate security is provided.  You should also try and address actual procedures that touch on security related subjects (access control, auditing, monitoring, incident response, etc.).  You may already cover some of this in your normal Standard Operating Procedures (SOP) and you can reference those documents.   When you create a new user or change groups/roles, are there written procedures for how to to it?  Is there someone who approves that change?  Those are the kinds of things that should be addressed.  When they aren't written down, people don't have references for how to do them and they take liberties which may introduce security vulnerabilities.

  I read something about annual certification, would it be ok to say that our company should make use of a third party security auditor and let them tell us what we should do?

This is the route a lot of organizations take, but security is definitely not something that should be reviewed "annually". It is an ongoing, forever process that should be integrated into your daily operations. That being said, a third party group can perform an "audit" that serves as your annual certification.  The result of that will be a report that you can used to fix deficiencies and enhance your security posture.  Highly recommend this, no matter how mature your security program is.  The first few times you go through it, use different vendors so that you can compare the results.  The quality of these types of assessments varies GREATLY.

  Who within our organisation would typically be responsible for implementing an Information Security Program?

They go by many names, but the ultimate responsibility of security will lie with the system owner.  That could be your CEO, the program manager, or in larger organizations an ISSO or Information System Security Officer.  In smaller organizations, it usually falls to a Product or IT Manager.  Hiring a consultant to help start this process may be a good idea at this stage.  You're only going to see these requirements more often as you start working/partnering with large enterprises.

  I am thinking about recommending to buy ISO27001, but who should read it? (related to the previous question)

What exactly are you considering buying?  ISO27001 is a security compliance framework that provides a direction for securing your assets/enterprise and as far as I know you shouldn't have to pay for anything upfront unless its a service or product.  Choosing a compliance framework to base your program off of is a great first step in establishing a security program.  I would personally recommend ISO or NIST as they are large international/national standards and have a lot of overlap with other compliance frameworks (PCI, HIPAA, etc.).  That being said, I have no idea what your goals are so you'll have to do some research and choose what's best for your organization.

I've written a lot of documentation and done a lot of security control testing so I may be opinionated at this point, but if you have additional questions, feel free to PM me.  Good luck!


Sharing an expired certificate? Today one of our certificates expired and I needed to order a new one. When collecting all the data needed to create a new one, I got the idea that all needed information is already contained in the expired existing certificate.

Are there any security threats when sending a expired certificate (x.509, private key) to someone else so they can extract all the information they need from this expired certificate for any reason?

Does it make any difference if they create a new certificate(We need a certificate for user ABC just like this expired one from user XYZ) or if they renew the old one in this context?

It's fine to reuse the data from the old certificate, but do NOT send anyone your new private key. The convention is to send a certificate authority a CSR (certificate signing request), which will contain the client's public key, start date, end date and distinguished name (country, common name, organization name, etc.). The only thing missing is the certificate authority's signature, which they will append to your CSR, thereby making it an actual certificate.