Can a DDoS attack yield any information? Can a DDoS attack reveal any information or be used to mount a hack? My understanding is that the whole point of DDoS or DoS is to consume all of the resources/overload the server causing it to crash. And that being the only reason to do a DDoS.

I have heard that DDoS is used to get information. Is that true or totally false?

A DDoS will certainly give an attacker information about response times, load capability and routing.

It may also give information about how incidents are handled internally and externally, as well as how they are reported to the public.

But this is not what the main uses are.

Generally the two key reasons for DDoS are to:

take a service or website offline
distract from a wider attack, exploit or intrusion

The first is well known, very popular, and is relatively straightforward to carry out, with the only defence against a large attack being a high volume DDoS mitigation service.

The second is more rarely used, but is being seen as a part of an attacker's toolset. Loading the incident response team can make it harder for them to detect an intrusion, can hide the real reason for the attack, and can hide evidence of an intrusion in amongst large numbers of log entries from the DDoS.


Stop software updates after the system is "stable"? Yesterday morning I had an OS class and we just started the part about OS security.

When the professor was explaining what is a patch manager, he told us that a computer company he knows which deals in securing servers, after the certification (I don't really know how you certify security when you deal with computers), stops the patch manager because they say

  we reached a stable situation so
  updating the software will solve known
  bugs but could also end up in introducing new security
  issues so we don't do that

Now, I do not disagree with the logic of it because it's actually true that you can introduce new bugs, but what about solving the existing ones? And what does mean stable when the word is used in this context?

In theory, what your professor is proposing sounds reasonable.  But there's a problem in practice.  You never get to a stable configuration.  Ever.

There is no non-trivial software out there that doesn't have unknown bugs.  None.  And some percentage of those bugs are security vulnerabilities.

What does the professor propose to do if someone finds a remote code execution vulnerability in the system after certification is complete?

Does he really believe it's safer to keep a system deployed with a known remote code execution vulnerability than to take the risk of a patch?

The answer (surprisingly) might be "yes".  And that goes to the heart of real-world security.  Security is really about risk management.  Every deployed piece of software has a certain amount of risk associated with that software.  The newly deployed software might break an existing line-of-business application.  It might introduce new vulnerabilities.

There's basically no way of knowing what might happen.  So you need to decide what your tolerance for risk is.

For some systems (often systems where someone's life depends on the system), it's actually better to keep the system unchanged (even if there are known vulnerabilities) and mitigate the vulnerabilities outside the system (with a firewall maybe).  For other systems, all you need to do is ensure that your line-of-business applications continue to work.

There is no one-size-fits-all solution here.  Every enterprise needs to make their own decision about the risk/reward trade-offs associated with a security patch.  Some will accept the risk, others won't.


Token Auth best practices: how to prevent copying tokens out of the browser? I am getting familiar with authentication (using passportjs) and using things like sessions, jet, etc.
My question is what is the best way to prevent someone from going on a computer and copying a sessionid/token/jwt/etc. and entering it into the website on their browser and getting unobstructed access into the user's profile.
Is there a technique that makes this not possible? I've looked into browser fingerprinting and not sure if that's a good idea since browsers often change navigator attributes.
Also, I code with JS so preferably that language.

I think this is really out of scope of your application code. If a malicious user is able to steal session information by having physical or other access to the victim's computer, all assumptions about security are off. Even if you were to prevent stolen session information from being used, what's to stop the attacker from stealing credentials instead? Or simply just using the already logged-in session on the victim's computer? Maybe the victim's browser could be remotely hijacked to communicate with your service on the attacker's behalf.
That said, there are sometimes mechanisms used that will flag when the session's IP address changes, or there is a log on from a new location. However, these things also come with a negative user experience, so it is up to you to balance that if you choose to implement any of them. This would need to be server-side logic in any case.


Difference between authentication, integrity and data origin authentication I first thought all these terms were synonyms, but I sometimes see those terms used in the same document. For instance, on MSDN:

  data origin authentication, which enables the recipient to verify that
  messages have not been tampered with in transit (data integrity) and
  that they originate from the expected sender (authenticity).

I don't completely understand how is integrity different from authenticity.

How could it be possible to ensure only authenticity of the sender without data integrity? If an attacker is able to modify the content, how can we trust the sender field to be correct?

Similarly, what does it mean to know that some data has integrity, but not knowing the sender?

To me, it's just a matter of including or not the "Sender" field of the header in the part of the message that's checked for integrity (or authenticity, I'm confused now)

As far as I know, digital signatures solve both integrity an authenticity, maybe that's why I can't see the difference between the two.

Integrity is about making sure that some piece of data has not been altered from some "reference version". Authenticity is a special case of integrity, where the "reference version" is defined as "whatever it was when it was under control of a specific entity". Authentication is about making sure that a given entity (with whom you are interacting) is who you believe it to be.

In that sense, you get authenticity when integrity and authentication are joined together. If you prefer, authenticity is authentication applied to a piece of data through integrity.

For instance, consider that you use your browser to connect to some https:// Web site. This means SSL. There is authentication during the initial handshake: the server sends its certificate and uses its private key, and the server's certificate contains the server's name; your browser checks that the server's name matches what was expected (the server name part in the URL). Then all the exchanged data is sent as "records" which are encrypted and protected against alteration: this is integrity. Since your browser receives data that is guaranteed unmodified from what it was when it was sent by a duly authenticated server, the data can be said to be "authentic".

Don't overthink things. The terminology is at least half traditional, meaning that it is not necessarily practical. We like to talk about the triad "Confidentiality -  Integrity - Authenticity" mostly because it makes the acronym "CIA", which looks cool.


How do Lync and SSL inspection play together? Whitelisting all Lync hostnames is cumbersome. Globally deactivating SSL inspection is undesirable.
At a place I work for, they have SSL-inspection enabled on their proxy. All traffic to the Internet has to go via this proxy server.
Most of the time, it is not a problem, except when it comes to Lync. This company has chosen to be federated with everyone.
Now, when we try to establish conferences, whiteboard, desktop sharing with external companies, it usually fails.
When we trace the traffic, we have been able to pinpoint the hostnames used for Lync traffic, and exempted them from SSL inspection.
Now, the problem is that this was just for one company. And we probably need to do this again for another. And another, and another... As each different company has their own Lync infrastructure and hostnames for Lync services.
This gives me the impression that Lync is forcing some companies to turn off SSL inspection globally, as the user requires Lync, and the manual labor required to exempt sites from inspection is too big.
Surely there's a better way?
While this is an open question on how you handle this situation, some solutions are better than others. Official KBs from Lync and proxy vendors say the same: you have to whitelist the Lync hosts. But they ignore that there are pretty many of them out there.
So please, if you have a better solution, post it as an answer below.
Background
And I would like to add the reasons SSL inspection does not work:

Lync does not speak standard SSL
Lync only allow certificates origined from the Lync servers. (Certificate/Public key pinning.) It disregards the trusted CAs installed on the client computers - so the proxy-issued certificate is invalid for Lync.

If the facts you mention in the Background section are true - there is no other way of making it work. If a client application looks for specific signature you can't use your proxy.

I think the best way you can handle it is to write a script that identify Lync servers, and add it to the exempt list.


Are RSA Key Pairs unique? I generate RSA key pairs mostly using the following command:

ssh-keygen -t rsa -b 4096 -C "someemail@hostname.com"

which produces a public-private RSA key pair. If I run this command again and again I get different key pairs.

Will all the key pairs that ssh-keygen generates be unique (not taking collision into account at this point)?
If yes, how does ssh-keygen assure that all key pairs that different people generate at different times are unique and do not end up being the same?
If no, on what factors does the uniqueness of a key pair depend? Other than key length space, and PRNG.

Will all the key pairs that ssh-keygengenerates be unique (not taking collision into account at this point)?

Yes, every key pair will be unique, with well above 99.99999% probability. This is largely due to the size of the key space and the quality of the CSPRNG that is used (see below).

  If yes, how does ssh-keygen assure that all key pairs that different people generate at different times are unique and do not end up being the same?

It makes no such assurances, but it is effectively guaranteed to be unique anyways. This is because the OS uses a high quality CSPRNG (Cryptographically Secure Pseudo-Random Number Generator) algorithm that is much more reliable (meaning, more unpredictable) than the out-of-the-box PRNG you get with most languages.

  If no, on what factors does the uniqueness of a key pair depend? Other than key length space, and PRNG.

The uniqueness comes from the CSPRNG, not a "regular" PRNG. The difference is the choice of entropy.

A PRNG simply takes some seed (usually either "0" if a programmer is lazy, or some arbitrary measure, such as from time()), shuffles the bits around every time something asks for bits, then does more shuffling. It only "appears" to be random until you observe the output for some period of time, at which point you can determine (a) which seed was used, and (b) the next infinite number of outputs that will be observed from that particular PRNG.

A CSPRNG, by contrast, builds entropy the longer it runs. It does this by taking periodic readings from multiple devices and applying some pretty complicated abstractions to the incoming data to generate a pool of "random" bits. This means that if you're running a flavor of Linux when you loaded this answer, odds are some bits of this answer are now floating in your entropy pool (until they are used, at any rate).

Logically, of course, these bits are random in the sense that computers do not actually have the capability to do "random" things (they always precisely follow the instructions given to them), but they are nevertheless random in the sense that no generic algorithm devised by either man or machine can possibly hope to determine the original entropy numbers, which is being constantly replenished as random numbers are generated.

Since computers often receive different types of input from the network, disks, and so on in fairly unpredictable order (because of latency, retries, other physical characteristics of hardware), it would be impossible for two systems to be perfectly synchronized to the point where the CSPRNG would also be in sync. Similarly, it'd be impossible to predict the output of a CSPRNG unless you were literally debugging the kernel, and the very act of doing so, or trying to report the current state, would alter the state of the CSPRNG.

Of course, the official documentation is quite clear on this: it's all theoretical, as we have no way of proving that no key will ever be generated twice. However, the odds are so incredibly stacked against ever finding a random key that was a duplicate that one may as well say it is indeed impossible.


1and1 Dedicated Server got compromised (Windows Server 2003) We had couple of dedicated servers rented on 1and1 hosting. In past we had situation where our server has got compromised and intruders were able to hack into the Windows 2003 standard edition and been able to manipulate the server for malicious purposes.

Once it was compromised for sending out mass spam emails. (this has happened multiple times and after that we changed RDP port to other than default we did not have any other port than smtp, 80 and 443 + rdp, but even after change of our RDP port we have got hacked once)

Another Windows 2003 Ent edition was hacked which was hosted in our unmanaged co-location and was hacked by some Palestine hacker group just to show that server had been compromised and replace website/portal with their logo.

Now in both cases we have noticed that hackers were able to create windows user on the server and their login events were recorded in the security even log.

Now we have limited users and removed all old or unused users from the server but can anyone tell me that how can we stop and make Windows Server OS secure enough that some hacker could not remotely create new user and gain access to Windows system.

I would recommend taking a look at the detailed guide created by the NSA

http://www.nsa.gov/ia/mitigation_guidance/security_configuration_guides/operating_systems.shtml#microsoft

They compile best practices and were written with the help of Microsoft.


How does Cipher Block Chaining relate to AES? I was reading FIPS197 for a class (found here: http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf ) trying to find some sort of specific relation between CBC and AES. I guess my problem is that I don't really know what to look for. I take it that CBC is a component of AES?

CBC is just one of the modes of operation that can be applied to a general block cipher, i.e. it is not tied specifically to AES. For die diverse modes of operation for block encryption see: http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation


How to create an anti-flood mechanism without leaving VPN's out? I'm trying to protect my applications from some bots that are either malfunctioning or trying to take my sites down (lots of requests from the same IPs in the logs).

Every time someone requests an expensive or security-related action, I save the name of that action, the IP, and the date. Then I check for some limits, eg: the action login.fail has a limit of 10 attempts every 10 minutes, and 20 per hour. If the limit is exceeded, I save the ban and allow no more actions from that IP (I simplified the description a bit).

This works well, but this could leave legitimate users out. For example, if lots of users are coming from the same VPN and share the same IP (even if the bots are not coming from that IP). And I don't want to create sites that hinder privacy (by banning VPNs) just to be safe from bots.

I can't check for headers like the User-Agent because those can be faked.

So what can I do? Is there a way around this? Anything else I can check other than the IP?

Have you ever considered protecting your site behind a service like CloudFlare? They act as a reverse proxy for your site and will scrub bad traffic at their edge nodes based on some very advanced heuristics. Even their free accounts offer a great level of protection because it's in their interest to drop malicious traffic so it doesn't pass through their network. Not only that but they have many advanced features like auto-minification of HTML/JS/CSS, CDN, analytics and more. I wrote a quick blog covering them after I started using them here.


What is Megan-35 encryption? There are a lot of websites offering online Megan-35 encryption/decryption. Surprisingly, I haven't been able to spot out any resources detailing the underlying algorithm. Can anyone provide any link to the Megan-35 algorithm itself?

The Megan-35 is an encoding and not and encryption.
It is a variant of the famous Base64.

The first step to encode to Megan-35 is to encode in base64. Then for each letter in base64 you will translate this letter to another letter.

You can find a python code on a gist.


Is it safe to use my personal password as my password in work related accounts? For example I have this complex personal password cary1bondoc21cary2bondoc as my password and because I am forgetful I also want to used that in work related accounts like company email, etc. Is there a chance that my company can record the strokes that I've made while I am in their offices, which will eventually to them knowing my personal passwords?

I think this question can begin to be answered by this graphic, which shows what security people think versus average people about best practices for information security.

Note that the average person thinks using a strong password (meaning a complex, difficult-to-guess gibberishy password) is a priority, while security professionals view a unique password (meaning one that you only use for that particular purpose) as a priority.

In corporate environments, sometimes IT staff have a legitimate need to request your password (although it's not a good practice, they still do it..).  Also you cannot be sure of the security of the database holding your password, or if monitoring software is installed that would give IT staff access to that password.  So, having a unique password for your corporate environment is certainly a better practice for your own safety.

In general, it is a poor practice to reuse any password on different sites.  I prioritize using unique passwords, as you never know if the site you have logged into will be hacked.  If you use the same password on a site that is compromised, attackers may try to use that password against other known sites like PayPal, facebook etc.

This is where security professionals' 5th preference comes in: use a password manager.  If you use a password manager like KeePass or LastPass, you can more easily utilize unique and strong passwords.  Then, you can use your complex password as your "master password," and for no other reason as you do not want this password to ever become known.  You can also enable two factor authentication (security professionals' #3 preference!) to better secure that master database.  This is a better practice in the real-world than re-using passwords, or using formulaic passwords (e.g. that include the name of the site at the end of the password).


Threat Modelling Examples (Distributed Systems) I have threat modelled applications in the past, but I'd like to threat model a distributed system. However for other people I'm with, who have never done it at all, I'd like to check out some examples somewhere but I can't find any online.

Does anyone know of something like a resource where examples of modelled systems and the threats found might exist?

I would highly recommend Microsofts approach with the Threat Modeling Tool (https://www.microsoft.com/en-us/download/details.aspx?id=49168) it comes with some instructions and guidelines. Also consider playing some elevation of privilege (https://www.microsoft.com/en-us/SDL/adopt/eop.aspx) that gives some good insights into threat modeling.

To get/make an example, look through: http://holisticinfosec.blogspot.dk/2014/05/toolsmith-microsoft-threat-modeling.html it goes through some of the points in the 2014 version.


Why can't you use the same password for every site, if they are hashed on the site? I've often heard people talking about not using the same password on every website. What's the deal if servers store passwords in a SHA hash instead of plain text? The most they can do is spam you with junk mail, right?

Passwords may be stored as a hash in the database, but there are so many ways that this simple process can go wrong. And once one of your passwords is known, then all the rest of your accounts are at risk.
Consider the very simple case where you enter the password into the username field. Now your password is exposed in clear text in every server log for that site. And you can't go back.
Consider also a website that made a small change to their login process, but there was an error in their code, and all passwords entered were also in a plaintext file that the developers forgot to disable (this actually happened to a major site).
Once one password that you've used gets exposed, for whatever reason, then you have to go to all your accounts that used that password and update the password on them all, else you risk that account.
Instead of re-using passwords, use a password manager that can take all the guess-work and memorization out of the equation.


how to test for csrf if the web application is not using tokens and there are no users defined for that application? I am testing an application that doesn't use anti-csrf tokens for its requests. There are no users defined for this application as well. Well, in that case, how to carry out testing for csrf in this particular application?

Related: CSRF protection for unauthenticated requests, actions, searches or comments?.

This question is not a duplicate as you are asking how to test for it.

In just the same way you would test for normal CSRF. Instigate a request to the server that would simulate the request arriving cross-domain. That is:

Origin and referer headers appropriately set.
No headers present that cannot be set cross-domain (e.g. X-Requested-With).
No tokens present that an attacker cannot determine without crossing origins in the browser session.

Of course you can always test for it by actually hosting your own page to make a cross-domain request to the site you are testing (being careful to strip any additional tokens that wouldn't be known of course).


Can sharing docker info compromise security? Running docker info gives a result such as this:

$ docker info
Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 2
Server Version: 18.06.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: alphanumeric number (expected: alphanumeric no.)
runc version: N/A (expected: alphanumeric no. )
init version: v0.18.0 (expected: alphanumeric number)
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.18.0-1-amd64
Operating System: Debian GNU/Linux buster/sid
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.659GiB
Name: debian
ID: 4name:4name:4name:4name:4name:4name:4name:4name:4name:4name:4name:4name
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

The unique ID's perhaps are containerid version, runc version and ID version. If somebody comes to know of these details, could there be problems?

Generally you wouldn't want to share any piece of enumeration info to anyone..
However if you need to share this with a vendor, I don't see a problem sharing this specific log file.


How do I determine whether a person use a (public) WiFi access point using WiFi sniffing? I would like to distinguish the behavior of users to use a (public) Wi-Fi access point. It would be possible to access the log files of the access point, but I don't have the authority to.
Alternatively, I set this experiment for sniffing (sensing) the Wi-Fi packets:
There is an access point; there are many users, too
I set Wi-Fi sensors built on Raspberry Pi to collect the Wi-Fi packets from the users and AP.
Simply, As the MAC address of destination and origin were the device and the AP, the device was thought to be using the AP when it was sent and received by the data frame (not the management frame).
However, there are four sub-types in the data frame. Although not sure, QoS NULL and QoS data do not appear to be using data.
In this situation, do you have any ideas to detect the usage of WiFi AP by sniffing the packet? All of data frame can be considered to determine the usage of Wi-Fi AP?

Some tools can already do this, notably airodump-ng, which will show a list of clients and the network they are currently associated with. The tool can filter by open networks.
QoS data is typically used for the data, but will usually be unintelligible due to encryption, and would need to be processed by another dissector in order to see the payload anyway.


Is this symetric or asymetric encryption? I’m at the beginning of my journey into the world of security. I am reading about the most fundamentals topics and I have encountered something unusual that has thrown me.

The Conundrum:

I have come across an encryption process on an appliance that can be configured with a plain text key. When you view the configuration of the appliance it shows the key as a cipher text (imagine perhaps the idea is stop people shoulder surfing the key of the appliance). So the plain text key I entered in the appliance configuration has been encrypted somehow.

An appliance will use my configured key with MD5 to hash messages between its self and another appliance. What confuses me is that when I configure a second appliance to talk to the first one I can either configure the same plain text key or I can copy the cipher text from the first appliance shown when viewing the appliance configuration and input that cipher text into the second appliance (specifying as I enter it that I am entering the cipher text version of the key not a plain text version of the key).1

The two appliances talk happily, hashing their inter-appliance message with MD5. At this point I thought the cipher method used to store my key must be symmetrical. The 2nd appliance runs a decryption function that is the reverse of the encryption function and voila, it gets the plain text key so it can be used for the inter- appliance MD5 hashing.
After a little digging on the Internet I have found that the cipher method is using a salt2. To the best of my beginner knowledge salts are used for asymmetric ciphers but these appliances exhibit the behaviour of a symmetrical cipher function because they can both encode/decode the same plain text to cipher text (or vice versa) independently of each other. A bit more digging has revealed the salt value is hard coded into the appliance OS and so it’s the same on every one of these appliances.

The question: (Skip to here for short version)

So is this an asymmetric encryption cipher being used that is being “forced” to act symmetrically by given all appliances the same hard coded salt value, or can symmetric ciphers use a salt?

1 If I had three appliances meshed in a traingle all talking to each other, I can configured them with any combination of putting the plain text key into all appliances, configuring one with the plain text key then copying the cipher text version of that key to the other two, or configuring two appliances with the plain text key and copying the cipher text key from one of the appliances to the third appliance. They will still all talk happily so they must all be doing the exact same encryption/decryption process?

2 This encryption/decryption process has been broken wide open and has become public knowledge.

I think you're confused because of a misunderstanding between encrypting and hashing.  I'll try to clarify by quoting your original post.

"When you view the configuration of the appliance it shows the key as a cipher text (imagine perhaps the idea is stop people shoulder surfing the key of the appliance). So the plain text key I entered in the appliance configuration has been encrypted somehow."

The key is hashed, not encrypted. It is good practice to not store keys in plaintext because an intruder able to compromise the appliance would get access to all account passwords.

"An appliance will use my configured key with MD5 to hash messages between its self and another appliance. What confuses me is that when I configure a second appliance to talk to the first one I can either configure the same plain text key or I can copy the cipher text from the first appliance shown when viewing the appliance configuration and input that cipher text into the second appliance (specifying as I enter it that I am entering the cipher text version of the key not a plain text version of the key)."

Replace cipher text with hashed key here. Apart from that, everything is normal, the appliance allows you to enter the key either in plaintext or in its hashed form; that's a common feature.

"At this point I thought the cipher method used to store my key must be symmetrical. The 2nd appliance runs a decryption function that is the reverse of the encryption function and voila, it gets the plain text key so it can be used for the inter- appliance MD5 hashing."

There is no cipher method or decryption here, your key is stored hashed in the appliances. Appliance 2 is able to talk with appliance 1 because you entered the key in both devices. They can then use this key to communicate securely by encrypting the exchanged message with any symmetric cipher.

"After a little digging on the Internet I have found that the cipher method is using a salt. To the best of my beginner knowledge salts are used for asymmetric ciphers but these appliances exhibit the behaviour of a symmetrical cipher function because they can both encode/decode the same plain text to cipher text (or vice versa) independently of each other."

No, salt is used to secure the hash function used to store safely the key in the appliance. Salt has nothing to do with symmetric or asymmetric ciphers.

"So is this an asymmetric encryption cipher being used that is being “forced” to act symmetrically by given all appliances the same hard coded salt value, or can symmetric ciphers use a salt?"

None of the above, see previous answer.


Finance with the multitude of "Secure Browsers" [Thanks for the great answers! But it was put on hold so I've edited my question to be a lot less opinion-based. Based on the answers already given, though, I am getting the sense that booting off a LiveCD with an updated installation of Chrome is probably the best option. :P]

For the following:

Kaspersky Safe Money
Avast SafeZone
BitDefender SafePay
etc.

I don't know where I can look up the software specs: Which of these use a fresh VM every startup? Which are capable of preventing keylogging? How well do each of these track the main Chromium (or Firefox or whatever) branch? What other good security features do these have?

The challenge with any non-mainstream browser is that writing a browser engine from scratch is a complex and expensive process, and maintaining a fork of a browser and tracking upstream is also a complex process, especially once the fork starts to deviate significantly from the base project.

If you look at the problems that WhiteHat aviator encountered earlier this year and the fact that it's no longer maintained by WhiteHat, you can see an example of the possible issues.

Not to say that I think it's impossible for someone to do a good job of creating a browser more focused on security, but that it may be hard for the company doing it to dedicate more resource to security than the mainstream browser developers already do (from that google plus post, the chrome team have 30 full-time security people).

Personally I'd recommend using an up to date platform with decent security tools and, if you're specifically concerned, consider having a device or VM dedicated to financial transactions, to separate it out from other browsing.


Is CORS helping in anyway against Cross-Site Forgery? I've been reading in the last couple of days about CORS and in a lot of places it's mentioned as it is a "Security" feature to help the world from cross domain forgery.

I still don't see the benefit and the reasoning for CORS. Ok, browsers will do a preflight request / server will validate the origin. But an attacker can easily create an HttpRequest top-bottom with whatever Headers(Origin) he wants and he will get access to the resource.

How is CORS helping and what's the benefit of it?

I'll start my answer by saying that many people misunderstand the Same Origin Policy and what CORS brings to the table.
Some of the up-voted answers already here are stating that the Same Origin Policy prevents cross-site requests, and therefore prevents CSRF. This is not the case. All the SOP does is prevent the response from being read by another domain (aka origin). This is irrelevant to whether a "classic" CSRF attack is successful or not.
By "classic" I'm referring to the types of request that were possible before CORS came about. That is, the types of request that can be sent via HTML forms as well as XHR (e.g. GET or POST without custom headers).
The only time the SOP comes into play with "classic" CSRF is to prevent any token from being read by a different domain.
Of course, now we have CORS and all sorts of cross-domain requests are possible such as PUT and DELETE, CORS does in fact protect against these by requiring a pre-flight. However, generally speaking CORS is not providing greater net benefit because the reason this functionality is available in the first place is due to CORS.
All CORS does is relax the SOP when it is active. It does not increase security (except perhaps allowing cross-domain resource sharing to be standardised and prevent developers from introducing flaws with something like JSONP), it simply allows some exceptions to take place. Some browsers with partial CORS support allow cross site XHR requests (e.g. IE 10 and earlier), however they do not allow custom headers to be appended. In CORS supported browsers the Origin header cannot be set, preventing an attacker from spoofing this.
I mentioned domains were different origins. Origins can also differ by port and protocol when talking about AJAX requests (not so much with cookies).
Finally, all of the above has nothing to do with forged requests coming directly from an attacker, for example with curl. Remember, the attacker needs to use the victim's browser for their attack. They need the browser to automatically send its cookies. This cannot be achieved by a direct curl request as this would only be authenticating the attacker in this type of attack scenario (the category known as "client-side attacks").
The benefit of CORS is that it allows your domain to allow reads from another trusted domain. So if you have http://data.example.org you can set response headers to allow http://site.example.com to make AJAX requests and retrieve data from your API.


Sent images on company WiFi network by accident I know this was stupid, so I don't need to be told that...here goes:
I was at work and thought I was on 4G network on my Android phone but after sending a number of nude pics via a social media app and Gmail on my BYOD smartphone I realized I was logged in to the corporate WiFi network.  Of course with my unique user name/password.
I freaked out, logged right off and factory reset my phone. I'm obviously very worried. I was an idiot and will NEVER do this again. What is the chance that they would pick up on the fact that this type of image was being transmitted over their network--of course they have the ability to figure this out, but is it likely? I wasn't on a porn site, so hopefully no IP address to tip them off to look into my usage any deeper. I work for a large company.

The prior question that others have referenced did not deal with sending photos or ilicit material, only with streaming Netflix

When connecting to a corporate network, wired or wireless, it's possible for their IT department to intercept your traffic and/or get details of what you're doing on the web -- but in BYOD environments, this possibility can vary greatly.  Security varies widely, but there's intrusion detection systems, SSL interception (although this only works from corporate-managed devices), DNS and traffic logs that might reveal what users have been doing on the internet.

Each individual app that you install will have different security standards, depending upon the app vendor's practices.  In this case, you identified Grindr in the comments as the app.

A quick web search reveals an evaluation of Grindr security: https://www.os3.nl/_media/reports/grindr.pdf  in which you'll find that Grindr does in fact use SSL/TLS for its connection to the Grindr server, where all data is sent/received from (including pictures).  Since your smartphone is BYOD, it likely doesn't have corporate master SSL certificates installed.  In this case, your employer cannot intercept the SSL traffic.  However, if your employer has installed an app to manage your phone or otherwise enforce BYOD policy, this might not be the case. Thus, based on the information you provided, it seems that your connection to Grindr and the data you sent/received is likely secure.

However, your DNS queries and the IPs of the Grindr webservers may be flagged, or website information derived from the SSL certificate exchange before communications are encrypted, so it's possible the employer may (through use of IDS or other sophisticated security apparatuses) know you had been using Grindr, but not what you had sent/received, or what your login information is etc.

So, it may be possible that the corporate network knows you're using Grindr, but likely not your naughty pictures or any other information.


Is It Possible to Implement Rule-Based Access Control on Amazon Web Services? I've gone through a few security tutorials on AWS and noted that each tutorial focused on role-based access control only.  Has anyone used rule-based access control on AWS?  If so, could you point me to links or documentation?

You mean attribute-based? Yes it is possible. AWS has several ways to do that e.g. AWS IAM which can be used across AWS services. In some cases you can also use resource-based policies (AWS API gateway). Lastly, there are companies e.g. Axiomatics and Savyint who also address this need.


What's the motivation for excluing /usr/local/bin from root's PATH? I just discovered that root's PATH on CentOS does not include /usr/local/bin.

What's the rationale for this? I'm tempted to add it to the PATH but I don't know what vulnerabilities that might introduce.

There is a discussion here https://bugs.centos.org/view.php?id=5707 indicating inconsistent behavior. It's there via sudo but not there with a direct root login. That's according to the bug report, which is specific to centOS 6.

More to the point, you're vulnerable if there is danger of bad stuff being installed at /usr/local/bin. By forcing yourself to use the full path ( /usr/local/bin/whatever ) you don't have any risk of accidentally invoking bad stuff via $PATH.

Of course that's true for anything performed with elevated privilege. Keep your path variable limited and you reduce your risk of tripping over an intruder's trap.


Encryption that service provider themselves cannot decrypt? I recently saw the following message verbatim on an online application I use.  The login is simply a login/password combination.  There is no oauth, no two factor authentication, etc...

This sounds like bullshit to me, but I'm no security expert which is why I'm posting it here.  Is this possibly true?  If so, how would one go about securing their site this way?

  To access our secure area, you must enter your Logon ID and Security Code. As a security precaution, we store your Security Code in our database in an encrypted format that even we cannot decode.

There are several possible ways for this to work, but the primary thing this relies on is them storing your password as a one-way hash. This prevents even them from reversing the hash to get your password, and your password is the key to the decryption.

During login, the password you enter is hashed using the same algorithm and compared to the stored hash, if they match then you must have entered the correct password. Thus, the server can authenticate you without ever needing to know your actual password.

Of course the practical success of this depends on the hashing algorithm used, and the length/complexity of your password.

Assuming you have a good password, and they have used a strong hashing algorithm, preferably using multiple iterations and salt (a random piece of data added to the password prior to hashing to ensure no two people using the same password will have the same hash) then nobody would be able to crack your password, and thence decrypt your data.


Account Security Cardholder data Ok, so we do not store any cardholder data so I get confused by these questions.

"Is all access to any database containing cardholder data (including access by applications, administrators, and all other users) restricted as follows:"

8.7(a) Is all user access to, user queries of, and user actions on (for example, move, copy, delete), the database through programmatic methods only (for example, through stored procedures)?

Isn't this N/A for me?

Isn't this N/A for me?

Yes.  You'll want to review the section titled "Guidance for Non-Applicability of Certain, Specific Requirements" on page vi of SAQ D 3.2.1.  To quote (emphasis mine):

  While many organizations completing SAQ D will need to validate
  compliance with every PCI DSS requirement, some organizations with
  very specific business models may find that some requirements do not
  apply. For example, a company that does not use wireless technology in
  any capacity would not be expected to validate compliance with the
  sections of the PCI DSS that are specific to managing wireless
  technology.

Since you aren't storing card data in a database, the database questions would all be N/A.  In addition to marking them N/A, you need to provide an explanation:

  If any requirements are deemed not applicable to your environment,
  select the “N/A” option for that specific requirement, and complete
  the “Explanation of Non-Applicability” worksheet in Appendix C for
  each “N/A” entry.


Free second-level domain SSL certificate With CAcert.org losing trust in browsers and OSs and StartSSL providing only top-level domain certificates, are there any free SSL certificates providers for second-level domains?

StartSSL does in fact offer free SSL certs for subdomains, though they are Class 1 certificates. You just have to go through a normal domain validation on the actual subdomain. Wildcard certificates (e.g. *.example.com) are not available for free, and are only available when you purchase a Class 2 or 3 cert. I have used these free subdomain certificates on my various personal projects, and they validate in Safari, Chrome, Firefox, and IE just fine. You don't get the green status bar, but you wouldn't anyway without paying for extended validation.


Security concerns issuing wildcard certificates to individual employees We recently setup a two tier internal certificate authority. We also disseminate Root CAs via Active Directory so certificates from our internal CA are automatically trusted by every (Windows) system in our network.

Our devs need SSL certificates for their local workstations. One option would be to generate a wildcard certificate to them like *.foo.bar.com.

The benefits are ease of implementation and future proof-ness (if we create new subdomains in the future, it covers them automatically).

However, the flip side is if we were to issue a wildcard certificate, how can you be certain that a malicious employee won't abuse it?

Imagine a situation where a malicious dev sets up a website on their local workstation (mail.foo.bar.com) and can somehow either also poison DNS or modify a user's local host file. That wildcard certificate lends credibility to their malicious website, making it look more authentic.

Am I being overly paranoid? Should we issue wildcards and make certificate maintenance easier or should we generate unique certificates for every DNS name to limit the scope of use?

Anybody have any thoughts? Experiences?

EDIT

To me it seems there are two very good solutions posted here:

Separate dev/test and production into independent CAs as recommended by @Kotzu. For us personally I can't justify setting up a second CA just for that purpose. It's too much effort for the number of certificates we have (40 total of which 10-20 are dev). That said, I totally think its the best answer.
Modify the DNS naming structure as recommended by @immbis so that the "dev" portion of the name is the subdomain not the sub-subdomain. Thus making the wildcard more obviously a dev domain. This would alleviate my concerns about issuing wildcard certificates to a great extent. Then impersonation can only occur for *.dev.ourdomain.com - which I'm ok with. That said, we just have it hard coded too many places to make this practical.

I think what we'll end up doing is continue to issue fully qualified SSL certificates to each dev. That feels safer as it leaves a lot less wiggle room for a malicious person to abuse/impersonate a legitimate resource. This entire situation is a bit of a tails case anyway. I hope our devs generally aren't acting maliciously and trying to set up bogus sites. I just don't want to be handing out trusted wildcard certs like free candy only to later have them be ab/used some unexpected way.

If we need more and more certificates and issuing individual certificates becomes unmanageable then we'll consider setting up a second CA that's only trusted by the dev workstations (not the whole company) and issuing new wildcard certs.

I think you should segregate your environment. Only production certificates should be trusted on all your network. Dev and testing certificates should only be trusted on the computers where developers work.
In a more secure environment you would not even use the same root CA for production and development environments.


Can't successfully do an idle scan I have Kali Linux installed in VirtualBox and would like to do an idle scan. For this I need to find a suitable zombie PC. I'm using the ipidseq script to find one. The script finds some IP addresses along with open ports.  Unfortunately I executed the idle scan many many times with Zenmap( nmap -sl zombieip -p -pN targetip ) and always get the same response from Zenmap, that the port on the zombie IP cannot be used, "perhaps it's down or firewalled".

My question is: should I continue trying, but with a script to automate the process, or could I be doing something wrong?

For an idle (zombie) scan to work you don't actually care about the ports being opened or closed in your zombie machine that you want to relay on for your scan.
You care about the IP sequence number: if it is incremental your zombie target is a good candidate for your scan.
IP seq number is usually random, but some printers don't randomize it enough in their printing protocol's pings each few seconds, so you can exploit this to use it for your scan.

This is what happens when a zombie machine is not randomizing its TCP/IP seq number and the port is open in your targeted machine, the one to be scanned:

Note that if there is a stateful firewall between you and your zombie machine it will block any SYN/ACK packets without previous initialized connection so you should seek another zombie where firewall is not blocking your forged SYN/ACK packets.

Another option is to send a SYN instead of a SYN/ACK, but I am not sure if this is possible in nmap. You may want to build your own scanner with hping3


Upgrade my Dell Inspiron laptop for PenTesting I have a Dell Inspiron N5110 & wanna upgrade it to start practising pentesing with virtual machines. What do u suggest from specs below to upgrade (I have Kali Linux, Tails OS, XP, Metasploitable etc)...

When I use virtualbox with Kali (attacker) & win xp (victim) the laptop becomes terribly slow.

Operating System

Windows 8.1 Enterprise 64-bit

CPU

Intel Core i5 2450M @ 2.50GHz   60 °C
Sandy Bridge 32nm Technology

RAM

4.00GB Single-Channel DDR3 @ 665MHz (9-9-9-24)

Motherboard

Dell Inc. 0FXK2Y (CPU 1)    61 °C

Graphics

Generic PnP Monitor (1366x768@60Hz)
Intel HD Graphics 3000 (Dell)
1023MB NVIDIA GeForce GT 525M (Dell)    55 °C

Storage

465GB Hitachi HTS547550A9E384 ATA Device (SATA) 42 °C

Optical Drives

DTSOFT Virtual CdRom Device
MATSHITA DVD+-RW UJ8C1 ATA Device

Audio

IDT High Definition Audio CODEC

There are several things you could do and what I am able to make of your question is that you want to be able to run virtual machines in your native OS (Windows 8) with some speed. I'm sure you've figured out by now that running Kali in a VM can use a lot of your host systems resources which you can control by adjusting the RAM allocation the VM has in Virtualbox's settings as well as how many core its allotted to use and several other small setting adjustments you can make. Try out different configurations and see what is the best fit for you. Now if you're really dedicated to learning penetration testing and if your willing to make major system changes then you could install Kali as your native OS and either Dual boot Windows 8 with Kali or remove Windows all together. By doing this you are isolating your Operating Systems without dedicating your session in one to supplement the other.


Converting keys between openssl and openssh If I use the following

openssl req -x509  -days 365 -newkey rsa:2048 -keyout private.pem -out public.pem -nodes

I get private.pem and public.pem

If I use

ssh-keygen -t rsa -f rsa

I get rsa and rsa.pub

Is it possible to convert from the format of rsa to private.pem and vice-a-versa?

Edit:  To be more specific,

a) If I have the private.pem and public.pem generated by the above command, how do I get the equivalent rsa private key and public key?

b)  Given the rsa and rsa.pub, how do I get the x509 keys if I do know the additional metadata that the above openssl command takes in?

If I go from the openssh format to x509 and back, I should ideally get the same key file back.

You are missing a bit here.

ssh-keygen can be used to convert public keys from SSH formats in to PEM formats suitable for OpenSSL. Private keys are normally already stored in a PEM format suitable for both.

However, the OpenSSL command you show generates a self-signed certificate. This certificate is not something OpenSSH traditionally uses for anything - and it definitely is not the same thing as a public key only.

OpenSSH does have support for certificates as well, but it is likely that you are not using this support. Also, these certificates are not X.509, so they are incompatible with OpenSSL.

The certificate contains information that is not present anywhere else and each certificate is unique and can not be recreated at will. This means that you need to store the X.509 certificate, in addition to the private key, if you wish use the same key for both OpenSSL and OpenSSH.

If you just want to share the private key, the OpenSSL key generated by your example command is stored in private.pem, and it should already be in PEM format compatible with (recent) OpenSSH. To extract an OpenSSH compatible public key from it, you can just run:

ssh-keygen -f private.pem -y > private.pub

If you want to start from OpenSSH and work your way over to the OpenSSL side, with a self-signed certificate (for whatever reason), here's how:

$ ssh-keygen -f test-user
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in test-user.
Your public key has been saved in test-user.pub.
The key fingerprint is:
ff:36:f1:74:c7:0d:4e:da:79:5c:96:27:2c:2c:4e:b6 naked@tink
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|           . .  .|
|          + o =.+|
|        S+ o * B+|
|         .E o = B|
|          .  + o.|
|           .o .  |
|           ...   |
+-----------------+
$ openssl req -x509 -days 365 -new -key test-user -out test-user-cert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:
$ ls -l test-user*
-rw------- 1 naked naked 1675 Mar 18 21:52 test-user
-rw-r--r-- 1 naked naked 1229 Mar 18 21:53 test-user-cert.pem
-rw-r--r-- 1 naked naked  392 Mar 18 21:52 test-user.pub

From these, both test-user and test-user-cert.pem files are critical to preserve, where as test-user.pub can always be recreated from test-user as needed.


PHP sprintf vulnerability? On some sites such as WriteCodeOnline, sprintf, vsprintf and other related formatted string functions are disabled for security reasons:

  Warning: vsprintf() has been disabled for security reasons on line 1

I'm wondering what these security reasons are. I've already read the Wikipedia article on Uncontrolled format string but it only addresses the aspects of using printf in C.

What are the security issues of executing *printf on PHP? Obviously the function isn't meant for preventing SQL injections, but that's a matter of using the correct tool for the job.

Yes, it's not C/C++ language; however, perl, PHP, ruby and java are descendents that carry on various C language conventions. By not having %n, php gets rid of part of the problem, but it still has %x which can be exploitable under certain circumstances.

Basically, printf() and its variants can allow control of the format string if you don't specify it.

Unvalidated user input can supply the format string of their choosing that will lead to a buffer overflow like condition (not a true buffer overflow).

Modern perl and PHP will throw warnings during the development phase so you don't create code missing the format string, if you choose to ignore them, you can have an issue.

Since the site you're referencing allows you to put in any old darn thing to test code, they are preventing creative format strings being entered into printf() that can eat memory, create a denial of service attack, cause premature program termination or crash the PHP interpreter on that website.

Format String Vulnerability in C


Ethical Hacking: Cracking my personal wireless network I am teaching myself ethical hacking.

Now, I am attempting to crack the password of my Verizon FIOS Router at home. Using Kali Linux 2 based on this website.

Steps So Far

On Kali Linux typed airmon-ng and it listed my wireless adapter
Typed airmon-ng start wlan0
Typed airodump-ng wlan0 and it listed my router's SSID twice with different BSSID.
Copied a BSSID and executed the command airodump-ng c 6 --bssid [BSSID] -w /root/Desktop wlan0

So far, I get this. I tried disconnecting and reconnecting to the network (both my smartphone and laptop), but it does not show client connecting. Let alone any 4-way handshake.

How to speed up the process so it shows client connecting? Thank you.

I believe the question has been already answered here, but I'll post mine as well.

From experience, it might be the following:

You're not close enough to the router, there is a chance that you'll not capture the handshake if the client is too close to the AP and the monitor mode device is relatively far.
A hardware issue, your network device is old and not compatible, so it can't capture packets from another protocols. For example if your device running 802.11g and the network is 802.11n

Solution: First, try to capture the handshake from different physical positions, if it doesn't work, try another WiFi device.


Facebook login security I have a client/server application, I want to log in with Facebook to my app. I can get an access token using Facebook login from the client, then send that to server to authenticate the user. My question is, how do I know that it was my app the one who logged in to Facebook? What if another app that the user logged in to with Facebook did that request?

Facebook connect is pretty much oauth openid connect with a few changes. So in order to understand the security model, it can behelpful to understand how oauth works. There are a lot of resources on that available on the net.

Your question isn't quite specific enough to give you a specific answer. I'll assume you're designing a server application designed to be used in browsers (user agents) and that you don't actually worry about which application did the original login request to authenticate the user,  but rather that you want to avoid a scenario where a user which isn't authorized to use your server application can use it because he successfully authenticated himself to facebook earlier on, either directly on fb or using another app that uses facebook connect.

The comments to your original question already provide answers to this question:

When you get an access token from fb connect, you must verify it. There's an endpoint facebook provides in order to do that, so your server application must send a verification request to that endpoint. If you don't verify it, just as you fear, you could end up with an access token that wasn't meant for your app, or for another user, or had expired. If you do verify it, you will get back a json reply from the verification endpoint that contains a user id and an app id. You can compare the app id with your own app id to see if the token is meant for your application. An attacker shouldn't be able to produce a token with your app id (partly because your app id shouldn't be known to anyone but FB and you). But I the main reason why nobody can act as if they were your app is because you must provide the app secret as part of the verification process. Only you and FB know that secret. So FB can fail the verification if app secret and the app id in the token don't belong to the same app (there's actually another step involved before verification - you must first get an app access token, in order to use it with the verification endpoint, and in order to get the app token, you must provide your app id and secret).

From the verification response, you can also see whether the user id is what you expect it to be. One you've verified the token, it's authenticated and you can trust what it says about who and which app the token is for. Until you do verify tokens, they're just claims that anyone could make.


Do password derived encryption keys need to be salted? If I have a database where I store users' sensitive information, and encrypt that information, do I need to do something like PBKDF2(password,salt,10^5) for the encryption key as well as the hash?

Whenever you have a human password and want to process it into some format that "leaves traces", then you need to do it with a function that is resilient to brute force (e.g. PBKDF2). You thus need to do that when you hash the password to obtain a password verification token that you store; you also need to do that when you are turning the password into a key for symmetric encryption.

To make things clearer: if you turn password P into key K and then use K to encrypt some data D and store the encrypted result E, then an attacker, observing E, could "try passwords" by turning a potential password P' into key K' and then trying to decrypt E with K' and see if it yields some sensible data D. This is the offline dictionary attack situation, very similar to basic password hashing.

Strictly speaking, turning some data into a key is called Key Derivation, and "PBKDF" really means "Password-Based Key Derivation Function".


Email header IP address Do the IP addresses in an email header include information from the device from which the mail is being sent, or from the mail server?

Usually, each machine on which the mail transits:

adds a Received: header stating from where the email seems to come;
announces its name (which could be an IP address) to the next machine, which may or may not include that information in its own Received: header.

Here is an example in one of the 100+ spams that I daily receive:

X-Original-To: pornin@bolet.org
Delivered-To: pornin@bolet.org
Received: from davisandsons.net (213-238-65-230.adsl.inetia.pl [213.238.65.230])
        by arges.bolet.org (Postfix) with ESMTP id 7951068C0D4
        for <pornin@bolet.org>; Fri,  7 Oct 2011 21:49:22 +0200 (CEST)
Received: from apache by davisandsons.net with local (Exim 4.67)
        (envelope-from <minusculesxdl3@kurdogluholding.com.tr>)
        id XD1AV6-73T5L6-H9
        for <pornin@bolet.org>; Fri, 7 Oct 2011 20:46:35 +0100
To: <pornin@bolet.org>;
Subject: Re:web site
(...)

Header lines are added in "reverse order": each mail server adds its line at the beginning of the header. So here my mail server (arges.bolet.org) received a connection for a mail which, at the SMTP level, was destined to me (over the connection, the other machine sent: RCPT TO: pornin@bolet.org). As part of the SMTP protocol, that machine first sent an HELO command in which it claimed to be "davisandsons.net"; my mail server looked at the source IP address (213.238.65.230) and did a reverse DNS resolution on it, yielding "213-238-65-230.adsl.inetia.pl" (from an ISP in Poland). It turns out that "davisandsons.net" can be resolved to a quite different IP address, nominally from England.

This first Received: header was added by my mail server, so it is trustworthy. The next line, and all subsequent lines, however, were sent as is by that Polish machine which began the conversation by claiming it was in England, a blatant lie, thus not the greatest way to build mutual trust. That header could be completely phony. Assuming it is not bogus, it would indicate that the mail originated from the local machine, by a user called "apache". The probable scenario is then: the home PC of some poor guy in Poland is an infected zombie, which relays spam. The infection might have began through a poorly configured Apache Web server on that machine.

(Spamassassin rated that specific spam with a whooping 20.5 score, and I automatically zap incoming emails with a score of 5.0 or more.)


Strange 'agetty' process running on my VPS. Recently, I had to reinstall one of my VPS servers (again), due to malware. I took what I considered to be pretty good security precautions. I also locked the root account and am using sudo as well. But one day later, I logged in and noticed the program 'agetty' was running on several TTY's :

root       382  0.0  0.0  12600   292 tty3     Ss+  Jun21   0:00 /sbin/agetty --noclear tty3 linux
root       383  0.0  0.0  12600   292 tty2     Ss+  Jun21   0:00 /sbin/agetty --noclear tty2 linux
root       384  0.0  0.0  12600   292 tty5     Ss+  Jun21   0:00 /sbin/agetty --noclear tty5 linux
root       385  0.0  0.0  12600   292 tty6     Ss+  Jun21   0:00 /sbin/agetty --noclear tty6 linux
root       386  0.0  0.0  12600   292 tty4     Ss+  Jun21   0:00 /sbin/agetty --noclear tty4 linux
root       387  0.0  0.0  12600   296 tty1     Ss+  Jun21   0:00 /sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt102

Apparently agetty is an 'alternate getty' that is used for accessing a system via a serial console, or at least that's my understanding. So it seems that there is no legitmate reason for these processes to be running on my server. I emailed my provider about it, and they said that unless I configured this, it should not be running, and that it has nothing to do with their systems. That leads me to think that someone is trying to hack my server (again).

I have a few questions. First, is there any legit reason why I'm seeing these processes? Second, what do these options mean: --keep-baud console 115200 38400 9600 vt102 ? I was not able to fully understand what's going on from reading the man pages or from anything I've found online. Is it possible that somebody has managed to get a login console to my server and is trying to bruteforce their way in to get a shell? I checked the auth.log and syslog and did not find anything that indicated such activity.

I suppose I am just trying to figure out what this process is, and if it is malicious, how can I kill it? Rebooting the machine did not work... Any tips would be appreciated.

Those are default Linux "consoles" or virtual terminals (VTs), Alt+F1-F6. I don't remember seeing a system that didn't have them installed by default.

You'd disable them by removing them from your init/systemd/upstart/whatever scripts. Documentation for your Linux distribution probably mentions that.


How to test security of an encryption algorithm? What are the standards methods to test the quality of an encryption algorithms. Secondly if i am trying to implement an encryption algorithm then what practices should i adopt?

Yes, it is called writing research papers and getting them peer reviewed.

There is no reason you should ever write your own encryption algorithm unless you are in the field of academic research, and then you will still not "use" your algorithm for at least 4 years (that's how long it took to choose SHA-3 between the time when the algorithm was submitted to when it it was selected as the official standard) while other people look at it.

You will make mistakes that you will not even know are mistakes (do you know what a timing attack is? does your algorithm protect against it?). If someone with resources ever wanted to attack your algorithm do you think something you came up with could stand up to a team of PhD Crypto Analysts looking at it with a fine tooth comb for a week, a month, a year?

Use a existing library, please don't make your own.


Digital Signature Software What is the digital signature software? What it takes to digitally sign software?

I'm using the Kaspersky antivírus and the software I wrote, in Delphi, is flagged by the antivirus software due to lack of digital signature, as an untrusted software.

To use my software I need to go to the Kaspersky and set it as a trusted application.

Observing this article I see that the use of certificates is required:

  Before you can get started, you'll need a code-signing certificate and associated private key.

Then immediately says I can generate a key in my infrastructure:

  You can generate your proper code-signing certificate using your
  internal Windows public key infrastructure (PKI) or you can buy one
  from a commercial Certification Authority (CA) such as Verisign.

So, I ask:

How can I generate a certificate on my own infrastructure?
What are the advantages and disadvantages of obtaining a digital certificate?
What are the advantages and disadvantages to digitally sign software?
What is the difference between a certificate generated in my own infrastructure against a certificate obtained by a certifying institution?

Check this other question so you can understand more about certificates:

How do the processes for digital certificates, signatures and ssl work?

Basically signing a software guarantees that you are the author of the software and it has not been modified in any way by another party. For example if you check your PCs drivers, you will see they have a signature (i.e Microsoft Windows). this means we can be sure Microsoft made that driver. However there is nothing stopping me from creating a fake signature that has "Microsoft Windows" as name. This is what Certificate Authrotities are for, you could say they are trusted entities that contain records of each person/company and its true Public Key. That way even if I create a fake signature that has Microsoft as a name, a client will notice that the public key im giving it and the public key on record from the CA don´t match and thus I am an impostor.


What does Chrome use as the key for decrypting my saved passwords? When using Chrome, Chrome offers to remember my password on non-Google sites.

If my Google password is the key used to decrypt the other passwords that Chrome stores for me, wouldn't Chrome have to ask for my Google password every time it wants to auto fill one of my other passwords? Since it does not do this, it makes me think that my Google password is not the key, since Chrome supposedly does not store my actual Google password anywhere. So what is the key?

Or is my Google password stored somewhere 'securely' on my local device, and I just have to trust that Chrome only uses it when decrypting my passwords?

Note: this question assumes the OS is ChromeOS

According to this article it's your OS password instead of your Google pass.


Is it safe to send SSL certificates via email? I just ordered a cheap Comodo PositiveSSL Certificate via a UK reseller, and I was rather surprised to find that the following files were emailed to me automatically, in a zip file:

Root CA Certificate - AddTrustExternalCARoot.crt
Intermediate CA Certificate - COMODORSAAddTrustCA.crt
Intermediate CA Certificate - COMODORSADomainValidationSecureServerCA.crt
Your PositiveSSL Certificate - domain_name.crt

Additionally the cert itself (the last file) is added in text form at the end of the email.

It's for a site that does not need a lot of security - it does not handle credit cards or other highly confidential information. I set up a strong passphrase on the associated private key.

Am I right in assuming this cert is useless without the private key and passphrase? Or, given that email can be considered compromised, would an attacker wishing to decrypt my site traffic be at an advantage if they have these files?

I am minded to re-generate the certificate immediately, but I worry that Comodo will just "helpfully" send me a new zip file. I would much rather download all these files from the reseller's SSL website.

You are right assuming the certificate is useless without the private key, so sending it in the mail is no big security risk and is common practice actually. The certificate is supposed to be public, connecting to your website would also provide me with your certificate, so no need to hack your email there.

edit

When starting the connection the server sends the certificate which incorporates the public key. The client will generate a (symmetric) session key used for encrypting the rest of the communication and encrypt this with the public key. Now only the server with the corresponding private key can decrypt this session key and use it to decrypt and encrypt the following data.

This way it doesn't matter if someone else has your certificate, as long as they don't have the private key belonging to it, they won't be able to decrypt the session key and won't be able to impersonate your server.


website hacked by someone proxying over a tor router I'm curious to get an opinion on following: If someone decides to exploit some sort of vulnerability in a web application of mine or performs something of malicious intent, would this individual be able to stay anonymous by adapting following procedure?

attacker finds a crowded public space with Wi-Fi
attacker brought a Tor Raspberry Pi which he connects to the public Wi-Fi
attacker connects attacking device and proxy through the Tor Raspberry Pi
attacker steals information and trashes the Tor Raspberry Pi

Would it be possible to identify the attacker in any way post exploitation?

Any of these tactics alone would probably be enough, unless the target is high profile enough to lead to a serious investigation by the authorities. If your blog or low-profile, low impact, application is pwned by an anonymous person (e.g. not immediately evident who it is), no investigation will probably happen in most jurisdictions.

A private person probably has slim to no chance of tracking down a user of e.g. a Burger King wifi on a given time, or to reveal a tor users identity. Remember that NSA is spending money targeting tor users to reveal their identities.


Things to do to ensure that data is secured on my virtual server I'm not much of a server administrator but I'm maintaining a virtual server with Ubuntu OS where my website is hosted. I often use ssh, ftp and MySQL. As my website gets popular, I want to make sure the data and source code are secure. What are the things I should do?

For example, recently I decided to switch to login using SSH keys only for every user except for the root account. Probably, I should also do something similar for my database. I'm looking for good, easy things to implement.

You could start by reading about some (Ubuntu specific) best practices. Like:

Closing unnecessary ports.
Removing unnecessary packages.
Setting up some basic iptables rules.
Setting up a Web Application Firewall like mod_security.
Look into DNS solutions like CloudFlare to prevent heavy load on your VPS processes in case of DDoS-attacks.
Working with SSH keys and/or setting up a two factor authentication method like Authy-SSH.
Setting up downtime-monitoring like Pingdom or UptimeRobot.
Do some software specific security hardening for example for Apache, PHP and MySQL.
Get regularly tested by the use of Vulnerability scanners and/or penetration testers.

It's important to regularly update all software packages and the Ubuntu kernel and you can take a look into full disk encryption with LVM/LUKS.

Also I recommend to take a look at http://hardenubuntu.com/ like user PolymathMonkey suggested.


Is privacy compromised when sharing SHA-1 hashed URLs? I'm working on a small side project which involves a browser add-on and a backend service. The service is pretty simple. Give it a URL and it will check if the URL exists in a database. If the URL is found some additional information is also returned.

The browser add-on forwards any URLs that the user opens to the service and checks the response. Now, sharing every URL you're browsing is of course a big no-no. So instead, I was thinking about using SHA1 (or similar hashing function) to create a hash of the URL, and only send that to the backend service to check for membership in the DB.

My question is whether this scheme is better for the users privacy. My thinking is that now I'm not sharing any URLs, and the only way I know the user has opened a given URL is if it's already present in the database.

It's better but not perfect.

While it is (currently) impossible to get the URL for a given hash, of course every URL has the same hash.

So it is not possible to see all the URLs a user browses, but it is quite likely to get most of them.

While it isn’t possible to see user A visits HASH1 and conclude that HASH1 means fancyDomainBelongingToUserA-NoOneElseVisits.com, it is for example possible to just calculate the hash for CheatOnMyWife.fancytld and then see which users visit that site.

I wouldn’t consider that to be protecting the users privacy.

Also just matching users who visit a lot of similar domains can be pretty revealing.


Is there any alternative beside sending One-Time-Password via SMS? I'm working on one smaller system where it will be required to enter One-Time-Password (OTP, not to be confused with a One-Time-Pad) to download sensitive files which will be delivered to the user.

The primary idea was, to send an OTP via SMS within a pre-set time limit.

But since the SMS in not enough secure, I started to think about any other alternative for delivering an OTP to my users.

I can suggest to my users to use Signal and then deliver them information, but in that case I'm afraid that it will be too complicated for them.

Any idea or should I follow my primary idea?

Why can't you use TOTP or HOTP which is standard and supported by most authenticator apps?

When people register for your service they need to enroll their authenticator app by scanning a QR code which contains the secret seed used to generate codes.

On subsequent visits the site prompts them to enter codes generated by the app, without any network access since codes are generated locally on the device.

As a bonus, since you're using standard protocols your users may already have a compatible authenticator app installed, and if not, could nudge them into using the app for more services (their Google account, etc). In the end, users are more secure and everyone wins.


Windows / Running Installers When you install a program in Windows, I've always noticed you must allow it Admin (UAC elevation).  However, now it can effectively do anything it wants!  Unpack a service, deploy it as LOCAL SYSTEM, write in a rootkit even!  All because I simply wanted to install a basic program I found on the web.

Is there a better way to handle installers out there?  Where it has limited rights?

It basically boils down to trust. Most software packages are digitally signed. If they are signed by a trusted certificate you can be more sure of their identity. It's however not fool proof.

There is no real other way of knowing, if you want to be sure you will need to review every single bit of code which is not possible with Windows as it is a closed source operating system.


Banking: Ubuntu virtual machine and virtual keyboard, or full Ubuntu install on USB drive? I am mildly paranoid about protecting the security of my financial accounts. I often use Tails on a live USB for its light weight and amnesia. However, I also require the use of Chrome to visit some sites that I trust. Tails is unable to accomodate Chrome at this time. I would use Ubuntu on a live USB, but I find it very tedious and slow to install Chrome for every boot.

Would it be more secure to use a Ubuntu virtual machine and virtual keyboard, or do a full install of Ubuntu on a USB 3.0 drive? The former option would be more practical, is it safe enough?

I am green, other suggestions welcome, of course.

The problem, as stated, seems to boil down to the simple question: do you trust your host OS to be malware-free? If yes, then just use that for your banking. If not, then running a VM inside an infested host will not give you the level of tin-foil-hattery that you're looking for.


Can you prove that the OS loaded by your BIOS is really your OS? Assume you are a paranoic that have a 100% open source OS with drivers etc, but you don't have an alternative to your closed source BIOS.
How can you sure the BIOS didn't insert malicious code in e.g some programs ? You can't trust a program that computes the hash of the memory, since it may have been tampered with also.

I have highlighted the key part of your question:

  Assume you are a paranoic that have a 100% open source OS with drivers
  etc, but you don't have an alternative to your closed source BIOS. How
  can you sure the BIOS didn't insert malicious code in e.g some
  programs ? You can't trust a program that computes the hash of the
  memory, since it may have been tampered with also.

If you were able to reverse-engineer your BIOS and prove its capabilities, then you should be able to tell whether it could inject malicious code, etc. This would require a great deal of time and skill, but it might be possible, eventually.

In the meantime, the answer is no: you cannot prove that the OS loaded by your BIOS is the OS you intended.

For related work, see:

Matthew Garrett's tpmtotp
Trammell Hudson's additions to tpmtotp, especially Heads.
Joanna Rutkowska's Blue Pill
Joanna Rutkowska's Evil Maid


Is a PDF creating service vulnerable for injection of malicious code We have a report in our web application that being shown in tabular format in HTML. This report has the provision to be downloaded as PDF by clicking the download as PDF button. The question is about the way this PDF download provision being implemented. I'm told to write a back-end service that would convert raw HTML string in to downloadable PDF. To convert the HTML into PDF we are using The Flying Saucer library for Java. Now the way this is suppose to work is that I will get raw HTML content as string such as:

            Column 1
            Column 2
            Column-3
            Column-4
            Column-5

            H2285
            F125
            16

            ... and so on

From the front end in the request parameters and I have to convert this HTML string using the flying saucer and return a PDF file. My question is that Is there a way that an attacker can inject malicious code inside this HTML content and send it to the back-end service? Which might be harmful to any one who opens the PDF file?

I have googled for any security issues in the flying saucer library but could'nt find anything. But I did find this question from this site itself on How to inject malicious code in pdf or jpeg and there's another one Detecting malicious javascript in PDF

I have worked with many PDF libraries (not this one exactly though) mainly in .NET and if done correctly are fine. If you are worried about having the client side HTML sent back to the server and it has been manipulated, then a possible suggestion is that you render a seperate HTML version in your backend specifically for the PDF library to use. This is therefore not rendered to the client and is not subjected to client manipulation.


How important is NAT as a security layer? I've signed on to help a department move buildings and upgrade their dated infrastructure. This department has about 40 employees, 25 desktops, an old Novell server, and a handful of laboratory processing machines with attached systems. At the old location, this department had two networks - a LAN with no outside access whatsoever on an entirely separate switch, and a few machines with outside access.

We are trying to modernize this setup a bit as pretty much every user needs to access email and the time tracking system.

The parent organization (~10k employees) has a large IT department that is in charge of the connection and phone system at the new offsite location. The IT dept. had uverse dropped in and setup a VPN to their central network. Each desktop needs to be registered in the IT dept's system/website to get a (static) IP Address. Each IP Address given is outside accessible on any port that has a service listening on the client machine.

The server has confidential (HIPPA) data on it, the desktops have mapped network drives to access (some) of this data. There is also a client/server LIS in place.

My question is this: Is it worth making a stink that all of these machines are outside accessible?

Should we:

Request NAT to abstract the outside from the inside, as well as a firewall that blocks all traffic not explicitly defined as allowed? If so, what argument's can I make for NAT/firewall that outweigh the benefits of them having each machine registered in their system? I would be relaying all IT related requests from the end users to the IT department in either case - so it doesn't seem very necessary to have them tied down to specific addresses in their system. Most importantly, it sounds like a nightmare to manage separate firewalls on every desktop (varying platforms/generations) and on the server.
Request the IT dept. block all incoming traffic to each wan accessible IP on whatever existing firewalls they have in place
Keep the departments LAN completely isolated from the internet. Users must share dedicated machines for accessing email, internet, and time tracking system.

Thanks in advance for any comments or advice on this.

NAT and firewalling are completely orthogonal concepts that have nothing to do with each other. Because some NAT implementations accidentally provide some firewalling, there is a persistent myth that NAT provides security. It provides no security whatsoever. None. Zero.

For example, a perfectly reasonable NAT implementation might, if it only had one client, forward all inbound TCP and UDP packets to that one client. The net effect would be precisely the same as if the client had the outside address of the NAT device.

Don't think that because most NAT devices have some firewalling built in by design or do some by accident that this means NAT itself provides any security. It is the firewalling that provides the security, not the NAT. The purpose of NAT is to make things work.

You must not assume a machine is not outside accessible just because it's behind a NAT device. It's not outside accessible if some device is specifically configured not to permit it to be accessed from the outside, whether that device does NAT or not.

Every machine having an outside address but with a stateful firewall that's properly configured, managed, and monitored is vastly superior to a cheap SoHo NAT box.

Many actual SoHo NAT boxes forward traffic to inside hosts despite no inside host having ever sent traffic to the source of the forwarded traffic. Permissive NAT does really exist.


How to implement ECDHE-RSA-AES256-GCM-SHA-2 communication in OpenSSL? Full question

How do you implement client and server based solution-pair to secure network communication for simple C++-based desktop (non-browser) programs utilising the ECDHE-RSA-AES256-GCM-SHA-2 cipher-suite using OpenSSL?

Pre-text

I am a novice into using any cryptography other than pushing things into hashes and bcrypt. I need to secure flowing network data from clients to a server so a general purpose client-server solution is required. The mentioned cipher suite seems to be the big fat thing currently, providing many mitigations and benefits.

Resources

https://www.feistyduck.com/library/openssl-cookbook/
https://wiki.openssl.org/index.php/Main_Page

Problem

I appreciate the work done by the OpenSSL devs to maintain documentation. But I can't find anything that does not require you to be a security professional to implement the said cipher suite in a client-server architecture. There seems to be no examples on the internet or the mentioned resources.

Do I really need to spend months or years to figure all this stuff out?

So far I'm guessing I need to figure out AES in GCM mode separately then ECDHE key generation then RSA key generation and then somehow stitch it all together myself?

Do you want to link libssl from openssl into your server and your client executables to have a TLS server and TLS client with hardcoded TLS version (1.2) and hardcoded cipher suite (TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) and I guess a hardcoded pinned certificate?

I suggest you use something like libcurl in your client, which is higher level than libssl. It uses libssl but does most of the work for you.

I suggest you look at the code of nginx to see how to do a TLS server using openssl. It has some code you don't need because it handles more features than you need, but it's a start. Also you should decide to only use openssl 1.0.2, which removes a bunch of code to support older versions.

If you produce libssl and libcrypto object code to link into your executables, you can and should avoid bundling a lot of the code that is compiled by default but not used by your application. So don't compile md5 and sha1 (you'll only use sha256 certificates). Don't compile any ciphers other than AES. Don't compile any elliptic curves other than P-256 (or 25519).

Alternatively, you can bundle shared libraries produced with default compilation flags, but that means a lot more code that might run.


iPhone 5S security: Given someone's fingerprint can I use a 3D printer to create a fake finger with a real fingerprint on it? With such a big deal being made about the iPhone 5S's fingerprint reader (and formerly the Thinkpads' fingerprint readers) I really wonder how secure it is to use fingerprints in lieu of passwords.

If you can dust and photograph a roommate's or coworker's fingerprint off a coffee cup or desk surface or keyboard and then apply that to the surface of a 3D finger shape, assuming it is from the correct finger, it should be easy to use a 3D printer create a fake finger with a good print on it to use in unlocking an iPhone, a Thinkpad, or even getting into a gym (my local gym has a fingerprint scanner).

Vendors of fingerprint scanners usually prefer security-through-obscurity, so open specifications of the hardware module ("TouchID" in this case) are unlikely available. Apple's firmware secrecy doesn't help.

But we can speculate on common features of (good) fingerprint scanners:

Capacitive touch where a human finger's natural electric conductivity is measured.
Infrared heat as a human finger is both warm blooded and will dissipate heat in a fairly predictable pattern upon a colder surface.
A pressure gradient on initial touch as human finger-pads are soft and compressive rather than hard and unyielding
Spectrophotometry (a form of remote sensing) as a human finger will have different spectral properties from latex, foam or PVC. This can include both the visible colour of a finger (as recorded for that human owner) and other electromagnetic waves within the sensor's bandwidth
Heartbeat sensing to detect a live finger

No current generation of 3D printers could handle this.

A future organic printer could grow and customise a human finger on the back of suitable warm-blooded synthetic organism (or perhaps just a mouse). But by the time this technology was mature, spot-contact DNA sensors will probably be mainstream. Eventually the three common factors of authentication (knowledge, possession and physical being) will start to merge together; at least logistically.


Is it possible to block psexec without blocking regular SMB access? I don't have much experience in protecting windows machines, so sorry if I'm missing something obvious; how would one protect from psexec without disabling SMB? One could disable the admin$ share, but I've read here and there that it can cause some applications to misfunction. Is it something that can be handled by a local anti-virus? Sorry for the vagueness of my question, I have looked around but I wasn't able to find much. Thanks for any answer.

Edit for clarification: in short, I'd like to know whether it's possible to share data via SMB without allowing people to execute commands on my machine via psexec.

For psexec to work, you must already have local admin credentials for the target. If you don't want people using psexec to a given computer, the proper solution is to not give them admin rights there. Otherwise, they could just undo whatever you do anyway.


VeraCode static code scan reports "Improper Neutralization of CRLF Sequences in HTTP Headers" for frontend code I have the following code in my frontend javascript which basically reads the csrf cookie value and sets that in the ajax calls done via jquery.

    var csrftoken = self.getCookie('csrftoken');
    xhr.setRequestHeader("X-CSRFToken", csrftoken);

This seems to be a very standard technique and yet Veracode reports it as a vulnerability.

Looking at the details of this kind of vulnerability, at https://cwe.mitre.org/data/definitions/113.html, I don't see how could it be an issue given the http header is being set from client end and not server end. If the csrf token value is injected wrongly, the request would not suceed due to csrf mismatch anyways.

Why does Veracode consider this to be a vulnerability at all or is it a vulnerability that I am unable to understand?

HTTP response headers are delimited by one line break, and two line breaks start the actual response body. If an attacker can inject a line break into the header they can inject a new header after the line break, and if they inject two they can also inject content into the response body, such as new HTML (XSS). This is might happen because of Improper Neutralization of CRLF Sequences in HTTP Headers (AKA "HTTP Response Splitting").

These days, this issue is very unlikely – practically nobody uses a single addHeader() sink to add multiple headers or addCookie() to add multiple cookies - you just invoke it multiple times if the need arises. All modern frameworks handle that and make sure that the splitting, caused by injection, is mitigated.

If somebody still insists implementing an HTTP writer over TCP – they could always introduce header-splitting as they write the raw packet, but that is an unlikely scenario, and it will not be caught by Static Analysis Tools like Veracode, because they would never be able to get the context of the packet.

The bottom line is that this Veracode result seems like a False Positive.


ssh session hijacking I've created a simple scenario with ssh session hijacking. There is single session open from host A to host B and I can create another connection inside of established connection.
I'm wondering how to detect in a SIEM such an activity?I can't use ports because there is only one normal ssh connection.

Any ideas?

As you point out, if you want to detect when a new multiplexed session is opened over an existing SSH connection you will not be able to detect it at the network level, as the multiple sessions are multiplexed over a single TCP connection.

To be able to record the additional sessions you need to increase the SSH server log level, changing LogLevel in /etc/ssh/sshd_config from the default INFO to VERBOSE will record the following entries when a new session is established over an existing connection:

Running a command

Oct 13 19:02:32 server sshd[18850]: Starting session: command for myuser from 192.168.0.1 port 48196 id 1
Oct 13 19:02:32 server sshd[18850]: Close session: user myuser from 192.168.0.1 port 48196 id 1

Opening an interactive shell

Oct 13 19:11:10 server sshd[19379]: Starting session: shell on pts/5 for myuser from 192.168.0.1 port 48196 id 1

Note how the port does not change for the various sessions, while the id number identifies each separate session.

In summary: Increase the log level for sshd, then feed the ssh server logs to your SIEM and look for the appropriate log entries.


Would it be good secure programming practice to overwrite a "sensitive" variable before deleting it? Is it good secure programming practice to overwrite sensitive data stored in a variable before it is deleted (or goes out of scope)?  My thought is that it would prevent a hacker from being able to read any latent data in RAM due to data-remanence.  Would there be any added security in overwriting it several times?  Here is a small example of what I am talking about, in C++ (with comments included).

void doSecret()
{
  // The secret you want to protect (probably best not to have it hardcoded like this)
  int mySecret = 12345;

  // Do whatever you do with the number
  ...

  // **Clear out the memory of mySecret by writing over it**
  mySecret = 111111;
  mySecret = 0;
  // Maybe repeat a few times in a loop
}

One thought is, if this does actually add security, it would be nice if the compiler automatically added the instructions to do this (perhaps by default, or perhaps by telling the compiler to do it when deleting variables).

  This question was featured as an Information Security Question of the Week.
  Read the Dec 12 2014 blog entry for more details or submit your own Question of the Week.

Yes that is a good idea to overwrite then delete/release the value. Do not assume that all you have to do is "overwrite the data" or let it fall out of scope for the GC to handle, because each language interacts with the hardware differently.
When securing a variable you might need to think about:

encryption (in case of memory dumps or page caching)
pinning in memory
ability to mark as read-only (to prevent any further modifications)
safe construction by NOT allowing a constant string to be passed in
optimizing compilers (see note in linked article re: ZeroMemory macro)

The actual implementation of "erasing" depends on the language and platform. Research the language you're using and see if it's possible to code securely.
Why is this a good idea? Crashdumps, and anything that contains the heap could contain your sensitive data.  Consider using the following when securing your in-memory data

SecureZeroMemory
.NET SecureString
C++ Template

Please refer to StackOverflow for per-language implementation guides.
You should be aware that even when using vendor guidance (MSFT in this case) it is still possible to dump the contents of SecureString, and may have specific usage guidelines for high security scenarios.


What's the security issue with base64 encoding/decoding? http://phptester.net/ yields the warning

  WARNING base64_decode() has been disabled for security reasons

Why?

Besides the obvious vulnerabilities that have nothing to do with base64_decode (treating it as encryption, as a hash, evaluating base64_decoded data, etc) why would simply executing it be a security vulnerability?

why would simply executing it be a security vulnerability?

It's not.

base64_decode does exactly what you would expect: It decodes a string.

There are also no know vulnerabilities in it, nor have there been in the past (there was an integer overflow issue in base64_encode -  CVE-2003-0861 - but PHP does not consider it a security issue).

I would assume that http://phptester.net/ bans it because it can be used to obfuscate data. They may have some filters in place to prevent execution of dangerous code and may worry that base64_decode could be used to bypassed these filters. I don't think that this is necessary or useful, but that might be their train of thought.