If password is super long, your wpa / wpa2-psk is safe?

If a password is strong, then it is strong. WPA2 uses PBKDF2 with 4096 iterations and the network SSID as salt to turn the password into the shared secret. This is not bad. This means that a "strong" password will be, in this case, a password with 68 bits of entropy or more: the 4096 iterations add 12 bits to the brute force effort, and I use the traditional "80 bits" as the threshold of attacker's power. Note that 280 is a lot, and an attacker who is interested in obtaining a free Internet access through your WiFi is unlikely to devote that much computing power to the effort. A weaker password in the 40-bit entropy range will already be strong enough to deter attackers.

This famous question discusses password generation and entropy. A password with 40 bits of entropy can still be compatible with a human brain.

Password derivation aside, there is no known weakness in WPA2, so you can say that with a strong password, WPA2/PSK is safe... within its functionality. Remember the following points:

WPA2 is about keeping outsiders outside. It prevents external attackers from joining the network, i.e. looking at existing traffic and inserting his own. However, WPA2 does not protect connected clients from each other.
Even without piercing the crypto layer, attackers will still be able to do some traffic analysis: they can track the client machines (their MAC addresses are visible) and get some idea of what they say based on the timing and size of each frame.
Attackers who just want to achieve wanton disruption can jam the traffic by simply emitting stronger radio waves at the same frequency; and they can do that remotely. To do the same with a wired network requires physical access to the wires. For instance, your neighbour can jam your WiFi without leaving his house, while breaking your wire network would require entering your home.


Using PGP to answer account security questions with PKI

The format of a PGP signature is a base-64 encoded message containing a number of fields, many of which are fixed or predictable.  (e.g., key identifiers, algorithms in use, length fields, etc.)  Additionally, the signatures contain timestamps, so if you regenerate a signature, you are not guaranteed to get the same values.  PGP signatures are not deterministic, so are not a good fit for your use case.

If you want to do something like this, I would use an HMAC with a single secret to generate the answer.  However, if you do just that, then two sites with the same security question get the same answer.  (No worse than your original proposal, nor the traditional security question implementation, just a note.)

You can do something like the following in python:

import hmac
print hmac.HMAC('secretkey', 'What is the air speed velocity of an unladen swallow?').hexdigest()

Which gives 0e348e81ee5460ef138f7ec3ac9431de as the result.  Without secretkey, an attacker could not reproduce this.  Obviously you could wrap this in a small script to make it easier to use.

OTOH, the common solution to this problem is to store the answers in an a password manager.  I used to use rather profane answers (more or less unrelated to the question) for security questions -- I stopped after the first time I called a bank and they wanted the answer I setup online told to them over the phone.


Workarounds for sites that are broken without cookies?

If you're concerned about trackers, you're probably looking for First Party Isolation.
First Party Isolation is a feature that Firefox adopted from the Tor browser's Cross-Origin Identifier Unlinkability concept. FPI works by linking all cookies to the first-party domain (the one in the URL bar), making third-party cookies distinct between different domains. That is, if you're visiting a.com and a tracker sets a cookie, and later visit b.com which uses the same tracker, it won't be able to see the cookies it has placed earlier, when the first-party domain was different (a.com). Another explanation:

What is First-Party Isolation
FPI works by separating cookies on a per-domain basis. This is important because most online advertisers drop a cookie on the user's computer for each site the user visits and the advertisers loads an ad.
With FPI enabled, the ad tracker won't be able to see all the cookies it dropped on that user's PC, but only the cookie created for the domain the user is currently viewing.
This will force the ad tracker to create a new user profile for each site the user visits and the advertiser won't be able to aggregate these cookies and the user's browsing history into one big fat profile.

(Source)
To enable FPI, you can either go to about:config and set privacy.firstparty.isolate to true, or install the official First Party Isolation add-on. But before you activate it, be aware that some web apps rely on third-party cookies for actual functionality and may become unusable afterwards (e.g. you might be unable to log in). If you experience such problems, try also setting privacy.firstparty.isolate.restrict_opener_access to false which will relax the isolation rules and you're less likely to experience problems during, say, a cross-domain login flow that redirects you between different domains.

Another approach in Firefox are containers.
With containers you're essentially isolating different sessions from each other without having to use multiple browser profiles. E.g., you could read WaPo in a distinct container, and any cookies set by trackers in that container wouldn't be visible in the other ones. Containers are available in Firefox Nightly and as an add-on.
(Chrome doesn't have this exact feature, but you can use multiple profiles to get the same effect.)

I thought about writing a script that would run every 10 seconds on my machine and delete all cookies except those from whitelisted domains.

The problem I see with this is that some sites re-create cookies immediately after you delete them (as long as you still have their scripts loaded). And if your timing is bad, you might eventually run into the same problems you had with disabled cookies.
Finally, there are also reputable addons such as Ghostery that detect and block known trackers. So, you have plenty of options to maintain your privacy without disabling cookies entirely -- which unfortunately doesn't get you very far in the modern web.


Email received regarding Security flaw in website

TL;DR: It's probably well-intentioned and not a scam, but just poorly written.

I don't know of any kind of scam that would be based on this.  Certainly there have been attempts to extort website owners for money based on knowledge of website vulnerabilities (and the implicit threat to exploit them), but that doesn't look like the case here.

It's not a very well-written disclosure email.  I've certainly stumbled across vulnerabilities before (obviously, attempting to exploit them on a site that hasn't given permission would be illegal, but there are some that can be obvious without attempting exploitation), and sent emails with the same intent as the author above, but I try to provide all the detail in the first email.  I want to help.  I don't want to bounce back and forth in email land.

If it were me, I would ask them for details: what page (or pages) contain the vulnerabilities, which parameters are injectable, and whether they could share a proof of concept.  If you're not familiar with XSS, I recommend reading the OWASP page on the vulnerability.  It's both very common and can be critical, depending on the context.  A typical proof of concept (PoC) for XSS won't be dangerous to you or your site, but will do something like pop up a javascript alert box containing the hostname of the site, your session cookes, or even just the number 1.  Any of those show that a malicious attacker could be running Javascript on your site, which would have significant implications for your site security.

As some have pointed out, it's also possible the lack of information is them playing it "cagey" will looking for a reward/payment.  Obviously, if your site does not have a published bug bounty, you're under no obligation to do so.


Listening to phone calls as user profiling for marketing

Data dealers often buy data from multiple sources and aggregate it to generate an all-compassing user-profile from it. For example:

xyz company sold your telephone number and what the conversation was about.
social network which asks for your phone number for password recovery sold your telephone number and your ip address at some point in time.
advertisement network sold the tracking cookie ID for that IP address at that point in time.

Now the data dealer has linked your call with xyz to your identity on the advertisement network and can pay the advertisement network to show you xyz-related advertisement.

To avoid this from happening in the future:

Look at the privacy policy of any companies and websites you interact with and refuse to do business with them when the policy allows them to resell your data.
Do not reveal more personal information to internet services than strictly necessary.
Use a browser plugin like Ghostery or Privacy Badger to block web trackers (keep in mind that an advertisement filters like AdBlock only blocks visible advertisement and are not designed to prevent invisible trackers from tracking you).
Inform yourself about what rights to privacy you have according to your local laws and make use of them (for example, in many EU countries you have the right to order companies to tell you what private information they have about you and can order them to delete it).


How to identify coded content in a phishing page

Just a few small things, haven't figured out the thing entirely. Feel free to expand and comment on this.

After we beautify the code, we get: http://pastebin.com/CdZ5BTfj

We see:

var C4 = new Array(0x3c, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74...

And then a function

function DC() {
    var Wb = C4.length,
        _yu = new Array(Wb),
        i;
    for (i = 0; i < Wb; i++) _yu[i] = String.fromCharCode(C4[i]);
    document.open();
    document.clear();
    document.write(_yu.join(""));
    document.close();
};

So, this just performs HEX --> ASCII conversion and writes the decoded string into the document. This in turn evaluates to

<script>
    function _ii(Cc) {
        var Dc, yx, _099, _ln, o, _x02, _jh;
        Dc = new Array(4);
        _jh = XF();
        _ln = _jh.length;
        yx = _r0(Cc, _s88n(_jh[_ln - (0x4c ^ 0x4e)]), 0x03e8);
        _099 = ZZ(_xsii(_jh[_ln - (0x2b ^ 0x2f)]), yx);
        _x02 = ZZ(_xsii(_jh[_ln - (0x98 ^ 0x9B)]), yx);
        o = JJ(_jh, _099, _x02, Dc);
        if ((Dc.join("")) == _jh[_ln - 1]) {
            document.write(o.join(""));
            document.close();
        } else {
            msg.innerHTML = "&nbsp;";
            alert('Senha inválida!');
        };
        _ip = false;
    };
</script>

This is where it gets interesting, because other obfuscated functions are called. This is where the magical array returned by "XF()" is being used:

function XF() {
    return new Array('0cd0a85cd816....6ec24dde78ca48', 'd6860accfa237d675ba73acc5e486168', 'f81845c6e66b62e5fc758da50dc73d68', 'a96751384baa020ef306acaed4e7851683989674', 'eb3494af236b53ec970b830e308ff41d');
};

Since we just need to grab the decrypted string that is again written in the document, we can easily modify the code to output the string instead.

But, for that we need the "cc" Object that is used within _ii(). We see that there is a function calling _ii():

function A0(Cc) {
    if (!_ip) {
        msg.innerHTML = ms2;
        window.setTimeout(function() {
            _ii(Cc);
        }, 0);
        _ip = true;
    };
};

But then, who calls A0 instead and with what argument? We look at the HTML and see

<form name="F1" onsubmit="A0(document.F1.P1.value)" action="javascript:A0(document.F1.P1.value)">

And also

<a href="javascript: A0(document.F1.P1.value);">

So, we need the value of the form F1 and the subobject P1 for that

However, I haven't figured out the right argument for that right now. Maybe a hardcoded value somwhere inside. When I execute the modified version of the function with argument "abc" sothat it ouputs string that is written to the document, I only get garbage right now

If we figure out the right argument, this will probably decrypt correctly to a new piece of malware. The code I've seen until now is just Hashing (MD5 or SHA1) and encryption stuff. The real malware must be inside the array at the XF() function.

(Modified function: )

function _ii(Cc) {
    console.log("inside");
    var Dc, yx, _099, _ln, o, _x02, _jh;
    Dc = new Array(4);
    console.log("good");
    _jh = XF();
    console.log("outside");

    _ln = _jh.length;
    console.log("good");
    yx = _r0(Cc, _s88n(_jh[_ln - (0x4c ^ 0x4e)]), 0x03e8);
    _099 = ZZ(_xsii(_jh[_ln - (0x2b ^ 0x2f)]), yx);
    _x02 = ZZ(_xsii(_jh[_ln - (0x98 ^ 0x9B)]), yx);
    o = JJ(_jh, _099, _x02, Dc);
    console.log(o.join(""));
    /*if ((Dc.join("")) == _jh[_ln - 1]) {
        document.write(o.join(""));
        document.close();
    } else {
        msg.innerHTML = "&nbsp;";
        alert('Senha inválida!');
    };*/
    _ip = false;
};

The form is safe to open, none of the linked pictures exist anymore. We have the following page:

The text left to the textbox seems to say "Please enter your password". So, this seems like we really have to know the password to decrypt the text. But what is the password? I thought this was a scam? Until know, the password doesn't seem to get sent to some 3rd-party server. Only the right password decrypts something else (or I'm failing to decrypt the code and it does something else)


analyzing hacked website log : is there any link between ./etc and ./tmp when uploading files?

(Deleted my answer on SO since that will likely be closed)

etc is a suggestive directory to attack because it should be owned by root and unwritable to anybody else.

$ ls -alZ / | grep tmp
drwxr-xr-x. root root system_u:object_r:etc_t:s0       etc

You know that, but I'm just saying that it is suggestive because I don't see any reason why it should be writable. It's probably that the script is just thrashing and trying to write everywhere on the filesystem, maybe the compromised program just happens to have write permissions at /etc/, probably so it can alter its own config file...or misconfiguration on /etc/.

My little script here is clumsy and only creates the directory but shows what I mean about thrashing:

find / -maxdepth 2 -type d -exec mkdir -p '{}'\/assets\/images \;

tmp is a good initial target for malware because everyone has write permission there and those files can be executed, albeit with limited permissions.

$ ls -alZ / | grep tmp
drwxrwxrwt. root root system_u:object_r:tmp_t:s0       tmp

The breach looks like an attempt at escalation because if there was root access there would be no reason to write to tmp, or thrash, and the logs could be cleaned up. A good start is to enable selinux so that files that are not in specific locations for executables cannot be executed. Selinux would have prevented a lot of the thrashing too.

I don't know about efr, irso, nc12 but write permissions to ssl is definitely bad and do to misconfiguration. I'm guessing the entry happened through a clumsy php script based on the extra changes to public_html (index.php), that's just a guess.


Now, I believe I could have issues with the internal state space of the PRNG. If it has to few, it will "wrap around" and produce a bias for certain numbers. If it has too many, it might apply modulo to scale down, thus also producing a bias for numbers in the lower range.

No, the state space of a good PRNG will not make it appear biased in the ways that you fear here.  A good, non-crypto RNG will produce output that appears unbiased and independent to some set of statistical tests.  A cryptographically secure one, in addition, will produce output that appears unbiased and independent to any efficient observer; i.e., you can't write an efficient program to tell its output apart from a truly random sequence.

  How long a seed would I need to initialize a PRNG used for KFY-Shuffle a string of 4000 characters? Am I overthinking this, is there something I did not think of?

The number of distinct permutations of a 4,000 element sequence is 4,000! (factorial), which is something like 2^43000, so technically you need a 43,000 bit string (5,263 bytes) to be able to uniquely address any one such permutation.

Practical answer: just use a crypto RNG.  While it's unlikely at best that it would be able to output all possible permutations even when fed external entropy, the thing that matters is that no real-life attacker will be able to tell the difference.


3rd Party Vulnerabilities Fix (Access to source code vs no access to source code)

In that scenario, I would reach out to the vendor. If you are one of their customers you should have a support model for ongoing issues. If it was developed or purchased with no ongoing support you might have to pay for a update. You should come up with a options paper for management eg:

Do nothing and the risks associated
Have company abc develop and publish a update
Purchase a up to date competing application with ongoing support
Mitigate the vulnerability some how (Cant expand as haven't got the details)


Can employers log internet traffic of employees personal computers?

The question of whether what they're doing is legal will very much depend on the country you are in as laws vary from place to place.

As a general piece of advice, you might want to review your terms of employment and any company policies to do with monitoring.  It's possible that they'll lay out what steps they can/will take there.

If you don't trust them then it's probably best not to run their software on your machine. If you have to work from home you could request they provide you with a corporate laptop to do the work on, to avoid having to install their software on your machine.


For this kind of attack you could use for example Responder.py
Please, bare in mind that in order to make it work over the internet it would be necessary to:

Enable outbound SMB connections on the server that you plan to attack.
NAT the port 445 on the attacker computer and ensure that no firewall is blocking it.

Once those two conditions are true you can now configure  Responder.py to enable a SMB server and after that start Responder.py.
Now you just need to test it accessing it.
Please, do not forget to close everything back once you have finished playing!


Yes, this can happen. This attack is typically targeted at MS Windows users.

The counter measure is, as usual, to have all your components up to date.

Note that the light of your webcam will be on, which is an indication of the attack (it is not possible to disable this functionality it may be possible to disable the light on older machines or specific configurations - thanks @silverpenguin for the comment).


Does OpenID Connect provide CSRF and XSS protection?

Binding a JWT token to a session does not protect from CSRF and XSS attacks. The OpenID Connect specification does not include CSRF and XSS specifications, and it conceptually just cannot include it.
CSRF
An attacker tricks a user to click on a button, image or link, that triggers some malicious action like transfer $1000 to some account., where as user is not aware of this action. From the server point of view the request will be absolutely correct. In particular, the session ID from httpOnly cookie will be present and valid, also the JWT token will be present, valid and will refer the valid session ID. Thus the server will execute the request.
To protect from CSRF a request should contain something that only server knows, what attacker doesn't know. There are different techniques (synchronizer token, cookie-to-header token, etc.) In all cases this part of the content is provided by the server itself, not by the 3rd party service that issued JWT token.
XSS
XSS leads to generation of DOM and/or Script that causes undesired behaviour. Again, from the server point of view any such request will contain valid session ID and valid JWT token.
The protection from XSS includes filtering of input and, on client side, escaping of response elements that are not expected to be DOM elements. JWT does not help to protect from XSS.


Is my ssh server safe because I use DenyHosts and don't allow root access?

Security is a relative concept. I cannot say if a certain configuration is safe because there is always a safer practice. As you have mentioned, using a public/private key pair is more secure but you are unwilling to sacrifice convenience for the added security. Ultimately, you need to find a balance between convenience and security that you are comfortable with.

You might want to look into GeoIP filters to limit your SSH logins from a certain country only. This will prevent brute force attempts from other countries.

More information on GeoIP filters here: http://www.axllent.org/docs/view/ssh-geoip/

Another possible measure is to have SSH listen on a non-default port. Most automated scanners will only scan port 22 and thus will not pick up your server if it is running on other ports. However, there are drawbacks to that as well. E.g. certain locations, internet cafes may block these non-default ports.

More information on non default port here: http://major.io/2013/05/14/changing-your-ssh-servers-port-from-the-default-is-it-worth-it/


How to get a green certificate bar if I'm not a company?

Refer to the guidelines set up by the CA/Browser forum for extended validation.

  8.5.1 General

  The CA MAY only issue EV Certificates to Applicants that meet the
  Private Organization, Government Entity,Business Entity and
  Non-Commercial Entity requirements specified below.

  8.5.2 Private Organization Subjects An Applicant qualifies as a Private Organization if:

  (1) The entity’s legal existence is created or recognized by a by a
  filing with (or an act of) the Incorporating  or Registration Agency
  in its Jurisdiction of Incorporation or Registration (e.g., by
  issuance of a certificate of incorporation, registration number, etc.)
  or created or recognized by a Government  Agency (e.g. under a
  charter, treaty, convention, or equivalent recognition instrument);

  (2) The entity designated with the Incorporating or Registration
  Agency a Registered Agent, a Registered Office (as required under the
  laws of the Jurisdiction ofIncorporation or Registration), or an
  equivalent facility;

  (3) The entity is not designated on the records of the Incorporating
  or Registration Agency by labels such as “inactive,” “invalid,” “not
  current,” or the equivalent;

  (4) The entity has a verifiable physical existence and business
  presence;

  (5) The entity’s Jurisdiction of Incorporation, Registration, Charter,
  or License, and/or its Place of Business is not in any country where
  the CA is prohibited from doing business or issuing a certificate by
  the laws of the CA’s jurisdiction; and

  (6) The entity is not listed on any government denial list or
  prohibited list (e.g., trade embargo) under the laws of the CA’s
  jurisdiction.


Fake secured WiFi network to harvest password

If you come at this from a different angle then yes.

Effectively what you are asking is "can I fool the user into typing there real Wifi AP password into a prompt that you control."

Yes this is possible in various ways. In previous pen and social engineering tests I have got the victim onto a website I control then conditionally display various prompts that look and act exactly like system prompts.

Some users fall for it others don't.

To harvest Wifi creds you can display a wifi re-prompt for the password, many will just input there PW without thinking. The more convincing the prompt the higher the success. A targeted attack will first have the SSID to correctly set the one displayed in the prompt. This can be combined with a persistent de-auth beacon to add a convincer that there wifi has dropped out.

Time all of the above right, with the correct info on the target and this attack vector is very successful.


How to keep an eye on upgrades, patches and security issues for used open-source libraries?

The Open Source Vulnerability Database (http://osvdb.org/) is useful.
See also the answers to this question

If the libraries are among the tens of thousands of Ubuntu packages, the Ubuntu CVE tracker provides good information:

http://people.canonical.com/~ubuntu-security/cve/

The code to parse the Mitre CVE database and the NVD (National Vulnerability Database) for new vulnerabilities and track security issues is at https://launchpad.net/ubuntu-cve-tracker

You can see the README and browse the code and parsed CVEs at

http://bazaar.launchpad.net/~ubuntu-security/ubuntu-cve-tracker/master/files

and you can easily follow it with the open-source "bzr" distributed source control system.

Security and packaging problems are unusually complicated for Java as discussed at http://fnords.wordpress.com/2010/09/24/the-real-problem-with-java-in-linux-distros/


Is a vpn connection through a proxy more secure?

Proxy vs. VPN

  If you would make a VPN connection through an proxy server would be the ultimate option.

Not necessarily.

  The VPN endpoint is seeing the data, BUT it can only see where it comes from, the proxy server. The proxy server on the other hand can see the real ip address, but can't see the actual data.

Did you know that VPN servers are essentially proxy servers, but with encryption? :-) Proxy servers in general don't encrypt their traffic to/fro, so this is not a good idea at all. It shows you connecting to the proxy, the data you're sending to the proxy in real time, the data that's being sent to the VPN. That means you're completely unsecured.

Tracking you is still possible either way

And even if your proxy encrypted the information to/fro, there are a lot of ways to track you, even if you're hidden behind a dozen VPNs and proxies! :-o

There's too much information leakage on the main operating system, and this goes for Windows, Linux, etc. You really need to do something such as:

VPN such as Private Internet Access which is set to kill your main  connection on failed connection.
Virtual Machine which has it's own VPN/proxy, and which isn't Windows.
Completely change your browsing habits.

And you have to be really careful. It simply isn't worth the effort unless you're a criminal scum, or a paranoid schizophrenic who thinks they are onto you for some unknown reason that makes zero sense. And even then, you can't really 100% hide anyway.


Which is the best way to secure login password and safeguard user data? (even DBAs couldn't connect data to users)

If you want to store data in a way that the person holding the data cannot read it, then

You need to encrypt the data client-side.  Encrypting server-side opens the possibility that someone (say, the operator of the service) can record the data while it's in transit.
The encryption needs to be done using client-selected keys.  If anyone else provides the keys, they can record them.
The client needs to be storable offline (so the service operator can't tamper with it after the fact) and should have source code available (so the user can audit it to ensure it does what it's supposed to).

To prevent the service operator from associating data with an account, the "store" operation is not "associate a new record with this account", but "store a record tagged with this hash", where the hash in question is provided by the client (say, a salted hash of their password, where the salt is the index number of the desired record).  Conversely, the retrieval operation is not "select records associated with this account", but "select records tagged with this hash".  Further, the "store" and "retrieve" operations cannot require the user to be logged in.  There's probably a way for a user to prove they have an account without revealing which account it is, but I don't know how to do it.

Theoretically, any user can request any other user's records, though with a 256-bit hash, the odds of any random request returning a value are vanishingly rare (1 in 10^68, if you've got a billion records stored).  Since an attacker doesn't have the decryption password, being able to retrieve someone else's record is of little value.


What are the best practices for (token based) security in a webapp?

To some extent it may depend on the design of your web app and the level of security
your app requires (based on a risk assessment). In short, there is no one answer
suitable for all situations. The key to a good user experience is ensuring your
security level is in-line with the actual requirements. Too stringent security
requirements with too short a timeout will lead to frustration for the user and too
little will expose them to excessive risk.

Understanding how your app is used is very important. Nothing frustrates a user
more than being forced to re-authenticate multiple times in what they consider a
single session. For example, I have some apps which I keep open for a long time, but
I might only actively use the app a few times a day. I don't want to re-authenticate
after every 30 minutes of idle time, but I'm happy to re-authenticate once a
day. Other apps, such as my banking app, I want to ask me for re-authentication if
the session has been idle for just a short period.

I think the most important objective is to make the re-authentication process as
painless as possible. Forcing someone to re-enter their credentials and then sending
them back to the home page is rarely a good solution. What you want is a process
which briefly interrupts the users workflow, but once re-authenticated, puts them
back into their workflow at the point where it was interrupted by the authentication
process.

This can be a little tricky with traditional based applications where much of the
workflow state is maintained on the server - especially if you use session
timeouts. However, it sounds like your application is using a lot of javascript and
so I suspect you maintain local state.

One solution is to have your rest API verify your token/session and if a decision is
made that you need to re-authenticate, pass back json data which essentially tells
your app to re-authenticate than then re-submit the request. Javascript on your
client can then use this information to pop up a modal window to collect
authentication data, submit it to your authentication service to get a new token and
then re-submit the original request with the new token.

for a more traditional application, the general solution is to use server
redirects. When you try to access a REST API and your token has expired, redirect the
browser to the login page, but have the login page also accept a 'next' url. Once the
user is authenticated, the login service will use the next parameter to redirect the
browser back tot he original REST API call. The challenge with this can be ensuring
you maintain all necessary state information.

Another addition which is sometimes acceptable is to have your authentication service
configured so that if it gets an authentication request which includes a token which
is still valid, it does not require the user to re-authenticate. Instead, it just
issues a new token. This will allow your application to renew the token without user
interaction in the background. Your REST API's can be configured to redirect to the
authentication service if the token is going to expire within the next X
seconds/minutes. The advantage of doing this is that if someone has a very long
session, they are not forced to re-enter their credentials simply because the value
you set for token expiration has expired.

Most of the time, the applications I work on do not have high security
requirements. For these applications, I tend to use a long expiration value for the
tokens and a reasonable session expiration timeout based on idle time. This way, the
user is not forced to re-authenticate simply because of an arbitrary expiration time
for the authentication token, but they are required to re-authenticate if the session
has been idle for a specified amount of time.


How can I tell if Windows is running SMB?

Answer to this question:

(1) There is no service that runs the SMB server. It is a native system process that runs in the NT kernel.

(2) If the kernel is running SMB, it can be detected by giving the command netstat -an to display all network listeners. If port 445 is listening, then it means the SMB server is running.


DDoS might be very unlikely to happen to my website but in any case a CDN that should protect from it slows my website

I'm a little unclear about your last paragraph so I'll answer a bit broadly.  If you're enabling DDoS protection on a shared hosting system, doing so will protect your site and potentially the other hosted sites from DDoS.  If the other sites are not DDoS protected, an attack directed at them could potentially take your site down, even if your own site is DDoS protected.


Encryption key split into parts and stored in different places

That depends a lot on your ceremonies. It sounds like your encrypted data is on a computer connected to the internet, isolating the computer would be a better way to increase security. If you are decrypting the data often it is also not that helpful, an adversary could watch you put together the split key and then use this assembled key later.

Secret sharing does cover some of this theory and might show where this idea is used, also shows that instead of just concatenating the spit keys together you should do something a little bit more complicated.


Differential cryptanalysis is a kind of attack which exploits some fine details in the structure of the attacked cipher; you look at pairs of plaintexts, encrypted with the same key, and the corresponding ciphertexts. The pairs must be carefully chosen so that the difference between the two plaintexts (usually, bitwise difference, i.e. a XOR) exercises with "high" probability the exact algorithm weakness that is targeted. There is no "generic" differential cryptanalysis in which you would just throw random plaintexts at the cipher, and hope that they will somehow combine into a Megazord-like attack.

In plain words, to do differential cryptanalysis, you have to understand what you are doing, down to the hairy mathematical details. And when you reach that point, you see that the base bits for differential cryptanalysis are not very important (what matters is the difference between the two plaintexts). Therefore, in the context of a lab experiment, most random generators will do -- but you will probably have to generate a lot of pairs of plaintexts, so you might encounter some bottleneck if the PRNG is too slow (but don't believe it yet; measure it).

If you want to get the gist of differential cryptanalysis, go read this book and try to implement it on a reduced version of DES (down to, say, 8 rounds instead of the standard 16).


Are there any ways to defraud a fundraising site?

No, a one-way "exchange" like fundraising cannot be defrauded in the common way that online shops have to deal with. When there is nothing to gain, fraud is impossible as per the definition.

That said - how about chargeback charges? Does the charity have to pay for every chargeback? If so, it could be possible for me to harm your charity - if I don't agree with their cause - by a DoS-style attack (hundreds of donations, with hundreds of chargebacks).

I'd guess that I wouldn't try that - it could very well be that the banks would see the malicious attempt and refuse to fulfil the chargeback requests. In that case, I'd have funded a charity that I disagree with. Nevertheless, you should clarify this with your bank.


Brute force algorithm to break symmetric key. How to find the program when current key is the correct one?

Ideally you need to have some idea of what you are looking for, but in most situations your plaintext should be relatively easy to distinguish. You might be able to identify it because it contains English-language words/grammar, or fits a known file format, for example.
Unicity Distance
If the ciphertext is short enough, the problem might be that there is more than one valid plaintext for a single ciphertext, although only one of these is the intended message. The additional valid keys are spurious. This is the concept of 'unicity distance': the length of a ciphertext needed such that there are no spurious keys.

Consider an attack on the ciphertext string "WNAIW" encrypted using a Vigenère cipher with a five letter key. Conceivably, this string could be deciphered into any other string — RIVER and WATER are both possibilities for certain keys. This is a general rule of cryptanalysis: with no additional information it is impossible to decode this message.

https://en.wikipedia.org/wiki/Unicity_distance
In the event that there are spurious keys, you need an even more specific idea of what you are looking for (e.g. keywords like you suggested).
Otherwise, as an attacker, you need enough ciphertext to meet the unicity distance in order to be sure.

For DES, the unicity distance is 8.2 bytes. For 128-bit ciphers, it is about 19 bytes.
This means that if you are trying to brute-force DES you need two ciphertext blocks. (DES's block length is 8 bytes.) Decrypt the first ciphertext block with one key after another. If the resulting plaintext looks like English, then decrypt the second block with the same key. If the second plaintext block also looks like English, you've found the correct key.

https://www.schneier.com/crypto-gram/archives/1998/1215.html#plaintext
Obscuring The Plaintext
Further obfuscating the plaintext, like you suggested, could therefore be effective in theory as long as the attacker did not have the requisite insider knowledge, and they were not checking for the obfuscation. This has to be carefully considered, because the attacker may have successfully found the correct key, and it's just a question of identifying that they have done so.
Also, we need to consider that certain (or many) methods of obscurity could be identifiable. Something trivial like Base64 encoding would be trivial to identify, and easily programmable as a check. Even if the plaintext was actually another ciphertext, there are potentially techniques for identifying these too (although they are not trivial) (e.g. http://practicalcryptography.com/cryptanalysis/text-characterisation/identifying-unknown-ciphers/).
As a result, although this has the potential to make an attacker's life more difficult, it is obscurity rather than security, and I would still ensure the level of encryption was suitable for purpose even if the plaintext was not obscured - i.e. I don't think it should be relied upon as part of the security mechanism.


How we can prevent innocent looking USBNinja (USBHarpoon) attacks?

USBNinja exploits design-level weaknesses of the USB specification. As such there is no simple technical solution and it is unlikely that one will emerge.

You can attempt to close down your USB using device control solutions, but a) you need a very homogeneous IT environment to be able to do that effectively (i.e. blocking devices based on vendor and product ID) and b) a targeted attack can easily work around these.

You also cause yourself headaches with device control that should not be underestimated. We've just been through this process for a customer, and it took days to find a tight policy that doesn't lock down the entire system (due to the way Windows loads its device drivers, if you block an essential device, your system is toast).

An awareness approach is most likely the one with the highest contribution to resistance, but it will also have holes (guests and visitors, contractors, etc.)

For your most valuable devices, I would seriously consider glueing known-good devices to the system at least so much that any tampering will be visible. Also lock unused USB ports (there are USB locks).

Consider USB locks also for notebooks of critical personel.


Not sure how helpful this is but have you tried

<?php

as your content rather. [Untested]
I've only personally setup TCP DDoS blocks using snort+snortsam for uni project.

Also check you have defined correct NIC in conf file.

Hope someone can give you a more direct answer.


You are correct, it is an attempt to fool the spam filter by throwing off the statistical analysis of the text.  Without all this nonsense text, the filter would rate it, say "90% likely to be spam" because of "Click Here" and other text.  Now, with all this business speak in the hidden text, the filter can't be so sure and might rate it "50% likely" and with a better rating might squeak under the block.  Also, the nonsense text would allow way more randomization so that it wouldn't match at all an otherwise identical email that has been flagged by a human as junk.

You said "Surely the other attributes will block..."  It really depends on how the filter is configured.  This wasn't a sophisticated attempt but administrators are always tweaking the configuration so that they don't lose important emails.  So, it is never a yes or no answer to "Is this Spam" but a likelyhood so that an admin can say, "We want to block what our filter says is 75% or more likely to be spam but allow everything else"  Then, it becomes an arms race of fooling the spam filter.


Is checking zip content on another PC enough to prevent data leak?

Is checking archive content (by previewing or extracting it) on another PC enough to prevent possible leaks?

Is it enough to be 100% sure - No, since the software used to extract might have bugs too. Or the original software might have added the data accidentally at some place in the ZIP file where they don't get extracted but are still visible when looking at the file through other means.
Does it reduce the risk - Yes.
Does it reduce the risk enough - Depends on what you consider enough.


Is there a security device to register unauthorised physical access?

It sounds like you want a tamper-evident security seal.  There are many commercial offerings.  You can look at tamper-evident tape, cable seals, padlock seals, and many other options.  I recommend that you read background information from Argonne National Laboratory, which has done some of the best research on the security of these seals.

Let me warn you of some caveats.  First, the effectiveness of the seal is highly dependent upon the procedure used for inspecting the seal.  Second, most seals can be defeated without too much sophistication, so they provide only a low level of security.  You are not going to find something that "proves in court" that the item was not opened.

I also recommend you read Security Seals On Voting Machines: A Case Study, by Andrew Appel.  It is a case study that looks at how these seals have been used to protect voting machines.  It has many great pictures of examples of seals that have been used in that industry, to give you a feeling for the range of options.  It also gives some hard-earned lessons: for instance, it explains why seals have been ineffective at protecting voting systems, and (as a cautionary note) it talks about how easy it was for someone with no prior knowledge of the topic to work out on his own how to defeat the seals.

With all that, tamper-evident security seals might still meet your needs.  But you need to understand that they are not magic, they are not a silver bullet, and they do have some limitations.


They are trying to do Bayesian poisoning.

By sending lots of correct words and a few words which are used in spam, like viagra, those words get a lower spam notification (over time).

This means that after a while they can get real spam with links through to the filter.


Does GnuPG use symmetric + public key encryption for large files?

OpenPGP always applies hybrid encryption (no matter how small the file/message is), thus encrypts the message using symmetric encryption and a session key, which again is encrypted using one or more public keys and asymmetric cryptography (once for each recipient). In fact, also symmetric encryption might be used again for the session key, if you also add a passphrase (you can encrypt combining a passphrase and public keys at the same time, such that either a passphrase or the matching private key can decrypt the message).

The (very simplified) structure of an OpenPGP message is more or less

one or more Public-Key Encrypted Session Key Packets (Tag 1) and Symmetric-Key Encrypted Session Key Packets (Tag 3),
followed by a Symmetrically Encrypted Data Packet (Tag 9),
which then contains a Literal Data Packet (Tag 11), often wrapped in a Compressed Data Packet (Tag 8).

There is no difference between encrypting files and messages in OpenPGP, maybe apart from messages not having a filename attached. The packages and algorithms used are the exactly same ones.

Discussing algorithms used is a little bit more complicated and depends on the version of GnuPG, preferences set on the computer encrypting and preferences set by the recipient's key owner. The easy way to determine what's used is to run gpg --list-packets, which provides the full packet structure (reading RFC 4880 helps at understanding the output, and you will learn a lot about how OpenPGP works behind the scenes), often adding one or two -v options is sufficient and provides an easier to read and understand, textual output.


How to log packets which are allowed by SNORT?

You are approaching this the wrong way.  A far better approach is to use a capture engine like Daemonlogger and then post-process the data in near real time.

The reason is that, as wonderful as Snort is, the more you add the the ruleset, the slower it will operate.  Don't get me wrong, it's very good, but this is not an ideal way to configure it.  If you are dealing with high speed well utilized links, Snort may begin to drop packets.

Marty Roesch, created of Snort, wrote Daemonlogger to address exactly this issue.  Daemonlogger is used for fast full packet capture, which is then analyzed by one or more Snort instances (or other tools like SANCP, Silk, etc.)

Rather than starting from scratch I'd suggest that you look into SecurityOnion, which has all of this stuff already installed and ready to use, or look at NSMWiki.org, which has great general information and lots of specific information on Sguil, which is an excellent NSM architecture and interface.


Assuming my password is strong enough, how else can I protect my account?

Threats:

Keylogger (as @MikeScott mentioned) on your PC or mobile device, or that of any other PC or mobile device that you use to access this account
Malicious browser extension
Malicious mobile app (if you sign into the account through a third-party app, or if your phone is rooted or compromised by a malicious app)
Phishing attack (you enter the credentials on what you think is Google's login page, but it isn't)
Reusing the password on a malicious site
Reusing the password on a site that gets compromised
Google gets compromised
Malicious app that you approve to have access to your Google account
App with access to your Google account gets compromised the attacker uses it to access its users' Google accounts
Password stored or transmitted insecurely (written down, sent over an insecure communication channel, etc.)
Attacker gains access to accounts needed to recover a "forgotten" password (for example, this might be your phone number, which can be hijacked)
Attacker impersonates you (pretending to have forgotten the password) and successfully tricks Google support
Password guessed by somebody who figures out how you generated it (unless you actually used a secure random number generator, this is more likely than you might think; humans are terrible at making random phrases or numbers)

Mitigations:

MULTI-FACTOR AUTHENTICATION (as @MikeScott mentioned), ideally using a really secure method such as a Yubikey in U2F mode (other methods are still vulnerable to phishing attacks), and ideally not just using SMS (too easy to hijack)
Keep your machines (PCs and mobile devices) up to date, both the OS and the apps
Don't sign into your account on other peoples' computers or devices
Don't ever re-use the password on another site
Don't store the password in plain text anywhere (a high-quality password safe app, such as LastPass or 1Password, is fine as long as you have a very good password, and ideally MFA, on the password safe)
Before you enter your password anywhere, make sure you expect to need to enter your password there (for example, if you should still be signed in but are being asked for your password, that's a sign you may be seeing a phishing page instead!)
Before giving access to any third-party apps (even ones that say they're from Google; sometimes people use sneaky ways to make it look like Google wrote the app when actually they didn't), make sure that the app is from a trusted source and actually needs to access your Google account for some reason (simply verifying your identity / email address is usually safe, actually accessing your email is a danger sign)
Don't use any insecure accounts as password recovery methods for your Google account
Run a reputable anti-virus (do not ever rely on AV software - they can be bypassed by knowledgeable attackers - but better to have it than not)
Be very cautious what browser extensions you use, especially ones that have permission to access "all web sites" (or Google sites in particular, of course)
Never share your password with anybody (even if you trust them personally, their computer might be less secure than yours)
Practice safe Internet usage in general (don't open unexpected attachments, don't run scripts or programs from shady or pirate sites, don't enable Flash or Java in the browser, etc.)


Android tamper resistance: BuildConfig.DEBUG spoofing?

As your sample code shows if the attacker uses a debug version he can easily bypass the security checks. Actually you need compiler directives to do that.

Using compiler directives the portion of codes marked as DEBUG never compile to final application and because of that you are safe using that method.


Log all API calls during the execution of an Android app

You can see Binder methods and other strace functionality with -- http://newandroidbook.com/tools/jtrace.html

However, I think you are looking to intercept API calls with the -- https://github.com/AndroidHooker/hooker -- techniques. There are other hooking techniques such as with IntroSpy -- https://www.sensepost.com/blog/2016/android-hooking-with-introspy --  but they don't look as applicable to your situation.

You could run into situations where anti-hooking techniques are present -- http://d3adend.org/blog/?p=589, so I suggest having a way to replace that code and repackage the APK -- https://github.com/oguzhantopgul/AppManipulator

The book, Hacking Android, covers using both IntroSpy and the XposedFramework for hooking. I think you'll like the output log from the XposedBridgeAPI -- http://blog.attify.com/2015/01/04/xposed-framework-android-hooking/ -- and you can find its development documentation here -- https://github.com/rovo89/XposedBridge/wiki/Development-tutorial

Moreover, the book covers what is more-common practice for Android app reversers and penetration testers, which is use of the Frida tools. In particular, I think the appmon -- http://dpnishant.github.io/appmon/ -- extension is the most-relevant (supporting both root and non-root privileged access), but you also might take a look at the extended version of cycript from NowSecure -- https://www.nowsecure.com/blog/2016/09/02/cycript-on-steroids-pumping-up-portability-and-performance-with-frida/


Depends on what you're trying to do and what kind of TCP connection you're using.

To keep it short, I'll give you some things to consider:

TCP is just another transfer protocol like HTTP. If it's unencrypted, stuff like eavesdropping and worse might happen. But since you're not launching the next version of WikiLeaks, you might just be safe when you transfer that access token unencrypted. Yet, I'm not saying I recommend it!
The Facebook access token itself is pretty safe to transfer if there's no connection to other data. Meaning: no one would know what a random string of characters would be for if you don't transfer data that shows more information next to the access token itself.
The access token is only part of a whole. Just having it won't kill anyone's Facebook account.

As said: TCP is just like FTP, HTTP and all the other protocols. If it's not encrypted, people can fetch and put to use intercepted info more quickly. As a quick answer to your generalized question, this should satisfy.

If you expect an in-deep risk analysis, we (the people trying to help by answering) would need to know a bit more about the "Why TCP and what for". But in the end, you'll end up with an encrypted connection (TCP or other) if you want to be 100% sure that you're SAFELY transmitting Facebook access tokens somewhere else but Facebook. Think of it like your MySQL database... you're not storing passwords unencrypted either, or are you? Same goes for transmitting sensitive data: keep it safe and encrypt what you can because you never know where the next script-kid might be lurking to ruin your day.

Hmmm...

Why do I get the feeling the shortest answer would have been a simple, two-letter "no"?

-

UPDATE

As some comments show that there is a big lack in understanding data security, I'll add a few lines.

Some argued HTTPS does in-stream encryption. It doesn't. HTTPS combines Hypertext Transfer Protocol (HTTP) with SSL/TLS protocol.

HTTPS transmissions might be encrypted, but from a SECURITY point of view, everything can be intercepted - encrypted or not.

Next, some seem to mix up HTTPS with the less used S-HTTP (Secure HTTP). There is a big difference!

look at the question

The question was:

  "Is it safe to transfer Facebook access token via TCP? What is the worst that can happen if someone gets the token?"

The answer is NO, you need to use secure protocols to avoid eavesdropping/man-in-the-middle attacks.

But let's assume the OP is smart and uses HTTPS as an crypto wrapper. With HTTPS you might avoid eavesdropping/man-in-the-middle attachs, but you can't ignore that a Chosen-ciphertext attack will still be successful! For a first read about this, check "LIMITATIONS of HTTPS" at http://en.wikipedia.org/wiki/HTTP_Secure and "CSS" attacks at http://en.wikipedia.org/wiki/Chosen-ciphertext_attack.

As the OP asked about "worst case", the answer is: "interception of the key, optional decryption of the intercepted data when a security layer like HTTPS is used and in the end it might lead to the abuse of the token".

Now, if the question would have been "how likely is it that this will happen", I would have answered: "pretty much unlikely, but that doesn't mean it can't happen".

But if you check the question again, you'll discover that that was not part of the question. So I won't go into statistics and probability calculations here. Besides, we're missing major parts of the "how and why" of the transmission, so no one can honestly give a definitive answer regarding the probability. That would be unprofessional, to say the least.

other forms of attacks

No matter how you do it - in the end, everything is unsecure and unbreakable crypto has yet to be invented.

Depending on the country, there can and will be a whole range of additional security problems involved... and I'm not talking about China! See how Tunesia kicked FaceBook security with something that's so simple, it should run shivers down your spine: http://www.cpj.org/internet/2011/01/tunisia-invades-censors-facebook-other-accounts.php

look at the question AGAIN

Don't take security questions lightly. You might comment against my answer and vote it down, but that won't make transmitting a Facebook token via TCP any safer!

Especially, as the OP does not indicate he is using any kind of security layer, we have to interpret it as if the FaceBook token is transmitted from IP "a" to IP "b" in an unsecure way!

A regular transmission of data using TCP is unsecure by definition for several reasons, of which I have merely scratched the surface of some.

I can only repeat: don't take security questions lightly.


Is 100% anonymity possible with Tor under certain circumstances?

ToR and associated products (e.g. Tails) provide a technological capability which will, if used consistently, allow certain actions to be taken online without any easy way to track them back to the person executing them.

So it's likely that the weak point in an anonymous browsing setup will be the person operating it.  Good Operational Security (OpSec) practice is difficult to achieve for most people, and there are a wide number of actions which could reveal information about the user behind the system.

Good OpSec requires a lot of discipline (e.g. never logging in without using ToR no matter how urgent it is, never mentioning any aspects of your real life whilst trying to be anonymous online and lots more)

So the most likely way that a troll or abuser would be unmasked would be that they slip up whilst trying to be anonymous, although there they'd only get caught if someone is watching for it and also if they haven't done anything illegal their OpSec slip-up may have limited consequences.

One option that some sites take to address this kind of problem is just block known ToR exit nodes and other well known anonymous proxies from connecting to their systems.  Depending on the user-base this may or may not be acceptable.  Obviously people have good reasons to want to be anonymous online (sometimes to avoid abusive people) so blocking ToR isn't appropriate for a lot of sites.


Correct settings to generate private intermediate CA

The only difference between a root and intermediate CA is that the root is by definition self signed.

And the difference between a root or intermediate CA and an end (user) certificate is that first two contain a x509 Certificate sign extension while last one do not.

So that is only a question of self-signed or not and presence of a Certificate sign extension.


Encrypt folder on Linux that can only be decrypted on that specific OS and device

No matter what you do, you will need to store an encryption key somewhere, which will then be recoverable. If you require a license server, this could be worked around by hooking or patching the application. You can do things like this to slow down an adversary, but it won't be complete protection. If you really don't want to give out your software, use a client-server architecture with the bulk of the logic on the server side and require authentication from a paid/authorized user (although then you can't prevent the client software from being copied or modified either, but that's usually an accepted risk).


Do corporate systems need to be updated immediately after updates are available?

There are two type of cases:

1. Vendor Released an Update
A bug/vulnerability may be discovered or vendor has just added new features and released a new update, at this point I exactly recommend you to update your services automatically.
Generally it doesn't cause any serious problem. Also, you can undo updates in popular softwares or services.

2. Vendor Hasn't Released an Update
A bug/vulnerability may be disclosed or you may want to add new patches, but there is no official update. So, you have to intervene and make everything yourself. Sometimes you have to do it, because some vendors may not release an update for critical vulnerabilities, for days, like Microsoft! I recommend you https://vullnerability.com website to track vulnerabilities real-time. So, you will be alerted when a vulnerability discovered and take an action as soon as possible before vendor. Its generally more dangerous and not recommended.

For both situations:
You should create backup for possible problems. I prefer to host my services in two different servers, the first server is real and the second one is backup, if I have a problem in first server, I immediately redirect my services to second server to don't lose data and customer.


Are there any Windows permissions management applications?

What you are looking for is Windows Powershell. It is the windows equivalent to the unix terminal. Using the command line for administrative task is so much more efficient compared to using GUIs once you get past the learning curve.

In Powershell, the dir or ls command allows you to list files and directories together with the permissions. I am not that familiar with the PowerShell commands, but this post from Microsoft is a good starting point.

You can easily write scripts to automate larger task as well, just as one can do on Linux/Unix systems.


OpenSSL check if a SSL certificate is SHA-1 or SHA256 signed

Here's the command for Linux and Windows.
And don't be alarmed about the doubled output line (Signature Algorithm: ...). That is expected (and mandatory).
Linux: SHA1 demo site
$ echo '' | openssl s_client -connect sha1.badssl.com:443 -servername sha1.badssl.com 2>/dev/null | openssl x509 -noout -text | grep 'Signature Algorithm'
    Signature Algorithm: sha1WithRSAEncryption
    Signature Algorithm: sha1WithRSAEncryption

Linux: SHA256 demo site
$ echo '' | openssl s_client -connect sha256.badssl.com:443 -servername sha256.badssl.com 2>/dev/null | openssl x509 -noout -text | grep 'Signature Algorithm'
    Signature Algorithm: sha256WithRSAEncryption
    Signature Algorithm: sha256WithRSAEncryption

Windows cmd.exe: SHA1 demo site
c:\>echo " " | openssl.exe s_client -connect sha1.badssl.com:443 -servername sha1.badssl.com 2>nul | openssl.exe x509 -noout -text | findstr /C:"Signature Algorithm"
    Signature Algorithm: sha1WithRSAEncryption
    Signature Algorithm: sha1WithRSAEncryption

Windows cmd.exe: SHA256 demo site
c:\>echo " " | openssl.exe s_client -connect sha256.badssl.com:443 -servername sha256.badssl.com 2>nul | openssl.exe x509 -noout -text | findstr /C:"Signature Algorithm"
    Signature Algorithm: sha256WithRSAEncryption
    Signature Algorithm: sha256WithRSAEncryption

Fingerprint is not inside certificate
It's a computed value.


As stated in the nessus documentation. members of the "Denial of Service" family are direct checks that in some cases attempt to exploit the DoS vulnerability they are testing for.

The Denial of Service family contains some plugins that could cause outages on a network if the Safe Checks option is not enabled, in addition to some useful checks that will not cause any harm. The Denial of Service family can be used in conjunction with Safe Checks to ensure that any potentially dangerous plugins are not run. However, it is recommended that the Denial of Service family not be used on a production network unless scheduled during a maintenance window and with staff ready to respond to any issues.

https://docs.tenable.com/nessus/Content/Plugins.htm

Nessus plugins with DoS in the name and not in the 'Denial of Service' plugin family are often simple checks that verify if the target is vulnerable to X DoS vulnerability based on the reported version.


What is the difference between an anti-virus and an IPS?

A good simplistic way to think of this is that an IPS generally is associated with a firewall, whereas AV is associated with software.

In the McAfee environment I administer, I use IPS to block/allow firewall traffic.  So I take what is known and expected, and then block the rest.  IPS also looks at what applications are communicating over which ports and to where.

Antivirus, on the other hand, looks at software that wants to run on your device and compares that against a list of known bad executables and, along with heuristics, against a list of known bad behaviors.  So AV would stop CryptoLocker by blocking the encryption behavior, and IPS would (theoretically) block it by blocking traffic to its C&C server.

I'm not familiar with Checkpoint so I'm going to defer answers to that question to other folks here.


How can MS Access work with an encrypted field in a Linked SQL Server table?

You idiot!  You're using Access!  Stop that!

However, if you absolutely have to, a quick Google search shows VBA can call the Windows API, so, per this link, here's some starting sample code (unverified):

'Paste this code in a Class Module, named clsCryptoFilterBox

Option Explicit

Private Declare Function CryptAcquireContext Lib "advapi32.dll" Alias "CryptAcquireContextA" (phProv As Long, pszContainer As String, pszProvider As String, ByVal dwProvType As Long, ByVal dwFlags As Long) As Long

Private Declare Function CryptCreateHash Lib "advapi32.dll" (ByVal hProv As Long, ByVal Algid As Long, ByVal hKey As Long, ByVal dwFlags As Long, phHash As Long) As Long

Private Declare Function CryptDeriveKey Lib "advapi32.dll" (ByVal hProv As Long, ByVal Algid As Long, ByVal hBaseData As Long, ByVal dwFlags As Long, phKey As Long) As Long

Private Declare Function CryptDestroyHash Lib "advapi32.dll" (ByVal hHash As Long) As Long

Private Declare Function CryptDestroyKey Lib "advapi32.dll" (ByVal hKey As Long) As Long

Private Declare Function CryptEncrypt Lib "advapi32.dll" (ByVal hKey As Long, ByVal hHash As Long, ByVal Final As Long, ByVal dwFlags As Long, ByVal pbData As String, pdwDataLen As Long, ByVal dwBufLen As Long) As Long

Private Declare Function CryptDecrypt Lib "advapi32.dll" (ByVal hKey As Long, ByVal hHash As Long, ByVal Final As Long, ByVal dwFlags As Long, ByVal pbData As String, pdwDataLen As Long) As Long

Private Declare Function CryptExportKey Lib "advapi32.dll" (ByVal hKey As Long, ByVal hExpKey As Long, ByVal dwBlobType As Long, ByVal dwFlags As Long, ByVal pbData As String, pdwDataLen As Long) As Long

Private Declare Function CryptGenKey Lib "advapi32.dll" (ByVal hProv As Long, ByVal Algid As Long, ByVal dwFlags As Long, phKey As Long) As Long

Private Declare Function CryptGetProvParam Lib "advapi32.dll" (ByVal hProv As Long, ByVal dwParam As Long, pbData As Any, pdwDataLen As Long, ByVal dwFlags As Long) As Long

Private Declare Function CryptGetUserKey Lib "advapi32.dll" (ByVal hProv As Long, ByVal dwKeySpec As Long, phUserKey As Long) As Long

Private Declare Function CryptHashData Lib "advapi32.dll" (ByVal hHash As Long, ByVal pbData As String, ByVal dwDataLen As Long, ByVal dwFlags As Long) As Long

Private Declare Function CryptReleaseContext Lib "advapi32.dll" (ByVal hProv As Long, ByVal dwFlags As Long) As Long

Private Declare Function CryptSignHash Lib "advapi32.dll" Alias "CryptSignHashA" (ByVal hHash As Long, ByVal dwKeySpec As Long, ByVal sDescription As String, ByVal dwFlags As Long, ByVal pbSignature As String, pdwSigLen As Long) As Long

Private Declare Function CryptVerifySignature Lib "advapi32.dll" Alias "CryptVerifySignatureA" (ByVal hHash As Long, ByVal pbSignature As String, ByVal dwSigLen As Long, ByVal hPubKey As Long, ByVal sDescription As String, ByVal dwFlags As Long) As Long

'API error function

Private Declare Function GetLastError Lib "kernel32" () As Long

'API memory functions

Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long

Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long

Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long

Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long

Private Declare Sub CpyMemValAdrFromRefAdr Lib "kernel32" Alias "RtlMoveMemory" (ByVal hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)

Private Declare Sub CpyMemRefAdrFromValAdr Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, ByVal hpvSource As Any, ByVal cbCopy As Long)

'constants for API memory functions

Private Const GMEM_MOVEABLE = &H2

Private Const GMEM_ZEROINIT = &H40

Private Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT)

'constants for Cryptography API functions

Private Const MS_DEF_PROV = "Microsoft Base Cryptographic Provider v1.0"

Private Const PROV_RSA_FULL = 1

Private Const CRYPT_NEWKEYSET = &H8

Private Const PP_CONTAINER = 6

Private Const AT_KEYEXCHANGE = 1

Private Const AT_SIGNATURE = 2

Private Const SIMPLEBLOB = 1

Private Const ALG_CLASS_DATA_ENCRYPT = 24576

Private Const ALG_CLASS_HASH = 32768

Private Const ALG_TYPE_ANY = 0

Private Const ALG_TYPE_BLOCK = 1536

Private Const ALG_TYPE_STREAM = 2048

Private Const ALG_SID_RC2 = 2

Private Const ALG_SID_RC4 = 1

Private Const ALG_SID_MD5 = 3

Private Const CALG_MD5 = ((ALG_CLASS_HASH Or ALG_TYPE_ANY) Or ALG_SID_MD5)

Private Const CALG_RC2 = ((ALG_CLASS_DATA_ENCRYPT Or ALG_TYPE_BLOCK) Or ALG_SID_RC2)

Private Const CALG_RC4 = ((ALG_CLASS_DATA_ENCRYPT Or ALG_TYPE_STREAM) Or ALG_SID_RC4)

'constants from WinErr.h

Private Const NTE_NO_KEY As Long = -2146893811 '0x8009000DL

Private Const NTE_BAD_SIGNATURE As Long = -2146893818

'clsCryptoFilterBox constants

Private Const CFB_BUSY = 0

Private Const CFB_READY = 1

Private Const CFB_VALID = 2

Private Const ENCRYPT_ALGORITHM = CALG_RC4

Private Const ENCRYPT_BLOCK_SIZE = 1

Private Const CRYPT_EXPORTABLE = 1

'private property buffers

Private sInBuffer As String

Private sOutBuffer As String

Private sPassword As String

Private sSignature As String

Private lStatus As Long

Public Property Get InBuffer() As String

InBuffer = sInBuffer

End Property

Public Property Let InBuffer(vNewValue As String)

sInBuffer = vNewValue

End Property

Public Property Get OutBuffer() As String

OutBuffer = sOutBuffer

End Property

Public Property Get Signature() As String

Signature = sSignature

End Property

Public Property Let Signature(vNewValue As String)

sSignature = vNewValue

End Property

Public Sub Sign()

'Create a signature for Inbuffer and place in Signature

Dim sContainer As String, sDescription As String, sProvider As String, lHCryptprov As Long

Dim lHHash As Long, lResult As Long, lSignatureLen As Long

On Error GoTo ErrSign

'switch Status property

lStatus = CFB_BUSY

'init Signature property

sSignature = ""

'Get handle to the default provider.

sContainer = vbNullChar

sProvider = MS_DEF_PROV & vbNullChar

If Not CBool(CryptAcquireContext(lHCryptprov, ByVal sContainer, ByVal sProvider, PROV_RSA_FULL, 0)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptAcquireContext!")

GoTo ReleaseHandles:

End If

'Create a hash object.

If Not CBool(CryptCreateHash(lHCryptprov, CALG_MD5, 0, 0, lHHash)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptCreateHash!")

GoTo ReleaseHandles:

End If

If Not CBool(CryptHashData(lHHash, sInBuffer, Len(sInBuffer), 0)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptHashData!")

GoTo ReleaseHandles:

End If

'Sign hash object.

'Determine size of signature.

sDescription = vbNullChar

lResult = CryptSignHash(lHHash, AT_SIGNATURE, sDescription, 0, sSignature, lSignatureLen)

sSignature = String(lSignatureLen, vbNullChar)

'Sign hash object (with signature key).

If Not CBool(CryptSignHash(lHHash, AT_SIGNATURE, sDescription, 0, sSignature, lSignatureLen)) Then

MsgBox ("Error " & CStr(GetLastError()) & " during CryptSignHash")

GoTo ReleaseHandles:

End If

ReleaseHandles:

'Destroy hash object.

If lHHash Then lResult = CryptDestroyHash(lHHash)

'Release provider handle.

If lHCryptprov Then lResult = CryptReleaseContext(lHCryptprov, 0)

'switch Status property

lStatus = CFB_READY

Exit Sub

ErrSign:

MsgBox ("ErrSign " & Error$)

GoTo ReleaseHandles

End Sub

Public Sub Validate()

'Validate InBuffer with Signature and assign Status with result

Dim bValid As Boolean, sContainer As String, sDescription As String, sProvider As String

Dim lDataLen As Long, lDataPoint As Long, lHCryptprov As Long, lHHash As Long

Dim lResult As Long, lSignatureLen As Long, lHCryptKey As Long

ReDim aByteData(0) As Byte

On Error GoTo ErrValidate

'switch Status property

lStatus = CFB_BUSY

'init internal valid flag

bValid = True

'Get handle to the default provider.

sContainer = vbNullChar

sProvider = MS_DEF_PROV & vbNullChar

If Not CBool(CryptAcquireContext(lHCryptprov, ByVal sContainer, ByVal sProvider, PROV_RSA_FULL, 0)) Then

bValid = False

MsgBox ("Error " & CStr(GetLastError) & " during CryptAcquireContext!")

GoTo ReleaseHandles:

End If

'Create a hash object.

If Not CBool(CryptCreateHash(lHCryptprov, CALG_MD5, 0, 0, lHHash)) Then

bValid = False

MsgBox ("Error " & CStr(GetLastError) & " during CryptCreateHash!")

GoTo ReleaseHandles:

End If

'Add data to hash object.

If Not CBool(CryptHashData(lHHash, sInBuffer, Len(sInBuffer), 0)) Then

bValid = False

MsgBox ("Error " & CStr(GetLastError) & " during CryptHashData!")

GoTo ReleaseHandles:

End If

'Determine size of signature.

'sDescription = vbNullChar

'lResult = CryptSignHash(lHHash, AT_SIGNATURE, sDescription, 0, 0, lSignatureLen)

'Get handle to signature key.

If Not CBool(CryptGetUserKey(lHCryptprov, AT_SIGNATURE, lHCryptKey)) Then

bValid = False

MsgBox ("Error " & CStr(GetLastError) & " during CryptGetUserKey!")

GoTo ReleaseHandles:

End If

lSignatureLen = Len(sSignature)

'Verify signature.

If Not CBool(CryptVerifySignature(lHHash, sSignature, lSignatureLen, lHCryptKey, sDescription, 0)) Then

If GetLastError = NTE_BAD_SIGNATURE Then

bValid = False

GoTo ReleaseHandles:

Else

bValid = False

MsgBox ("Error " & CStr(GetLastError) & " during CryptVerifySignature!")

GoTo ReleaseHandles:

End If

End If

ReleaseHandles:

'Release signature key.

If lHCryptKey Then lResult = CryptDestroyKey(lHCryptKey)

'Destroy hash object.

If lHHash Then lResult = CryptDestroyHash(lHHash)

'Release provider handle.

If lHCryptprov Then lResult = CryptReleaseContext(lHCryptprov, 0)

Select Case bValid

Case True

lStatus = CFB_VALID

Case Else

lStatus = CFB_READY

End Select

Exit Sub

ErrValidate:

MsgBox ("ErrValidate " & Error$)

Resume

End Sub

Public Sub Encrypt()

'Encrypt InBuffer into OutBuffer

Dim lHExchgKey As Long, lHCryptprov As Long, lHHash As Long, lHkey As Long

Dim lResult As Long, sContainer As String, sProvider As String, sCryptBuffer As String

Dim lCryptLength As Long, lCryptBufLen As Long

On Error GoTo ErrEncrypt

'switch Status property

lStatus = CFB_BUSY

'Get handle to the default provider

sContainer = vbNullChar

sProvider = vbNullChar

sProvider = MS_DEF_PROV & vbNullChar

If Not CBool(CryptAcquireContext(lHCryptprov, ByVal sContainer, ByVal sProvider, PROV_RSA_FULL, 0)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptAcquireContext!")

GoTo Done

End If

'Create a hash object.

If Not CBool(CryptCreateHash(lHCryptprov, CALG_MD5, 0, 0, lHHash)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptCreateHash!")

GoTo Done

End If

'Hash in the password data.

If Not CBool(CryptHashData(lHHash, sPassword, Len(sPassword), 0)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptHashData!")

GoTo Done

End If

'Derive a session key from the hash object.

If Not CBool(CryptDeriveKey(lHCryptprov, ENCRYPT_ALGORITHM, lHHash, 0, lHkey)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptDeriveKey!")

GoTo Done

End If

'Destroy the hash object.

CryptDestroyHash (lHHash)

lHHash = 0

'Prepare a string buffer for the CryptEncrypt function

lCryptLength = Len(sInBuffer)

lCryptBufLen = lCryptLength * 2

sCryptBuffer = String(lCryptBufLen, vbNullChar)

LSet sCryptBuffer = sInBuffer

'Encrypt data

If Not CBool(CryptEncrypt(lHkey, 0, 1, 0, sCryptBuffer, lCryptLength, lCryptBufLen)) Then

MsgBox ("bytes required:" & CStr(lCryptLength))

MsgBox ("Error " & CStr(GetLastError) & " during CryptEncrypt!")

'GoTo Done

End If

sOutBuffer = Mid$(sCryptBuffer, 1, lCryptLength)

Done:

'Destroy session key.

If (lHkey) Then lResult = CryptDestroyKey(lHkey)

'Release key exchange key handle.

If lHExchgKey Then CryptDestroyKey (lHExchgKey)

'Destroy hash object.

If lHHash Then CryptDestroyHash (lHHash)

'Release provider handle.

If lHCryptprov Then lResult = CryptReleaseContext(lHCryptprov, 0)

'switch Status property

lStatus = CFB_READY

Exit Sub

ErrEncrypt:

MsgBox ("ErrEncrypt " & Error$)

Resume

End Sub

Public Sub Decrypt()

'Decrypt InBuffer into OutBuffer

Dim lHExchgKey As Long, lHCryptprov As Long, lHHash As Long, lHkey As Long

Dim lResult As Long, sContainer As String, sProvider As String

Dim sCryptBuffer As String, lCryptBufLen As Long, lCryptPoint As Long

Dim lPasswordPoint As Long, lPasswordCount As Long

On Error GoTo ErrDecrypt

'switch Status property

lStatus = CFB_BUSY

'Init sOutBuffer

sOutBuffer = ""

'Get handle to the default provider.

sContainer = vbNullChar

sProvider = vbNullChar

sProvider = MS_DEF_PROV & vbNullChar

If Not CBool(CryptAcquireContext(lHCryptprov, ByVal sContainer, ByVal sProvider, PROV_RSA_FULL, 0)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptAcquireContext!")

GoTo Done

End If

'Create a hash object.

If Not CBool(CryptCreateHash(lHCryptprov, CALG_MD5, 0, 0, lHHash)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptCreateHash!")

GoTo Done

End If

'Hash in the password data.

If Not CBool(CryptHashData(lHHash, sPassword, Len(sPassword), 0)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptHashData!")

GoTo Done

End If

'Derive a session key from the hash object.

If Not CBool(CryptDeriveKey(lHCryptprov, ENCRYPT_ALGORITHM, lHHash, 0, lHkey)) Then

MsgBox ("Error " & CStr(GetLastError) & " during CryptDeriveKey!")

GoTo Done

End If

'Destroy the hash object.

CryptDestroyHash (lHHash)

lHHash = 0

'Prepare sCryptBuffer for CryptDecrypt

lCryptBufLen = Len(sInBuffer) * 2

sCryptBuffer = String(lCryptBufLen, vbNullChar)

LSet sCryptBuffer = sInBuffer

'Decrypt data

If Not CBool(CryptDecrypt(lHkey, 0, 1, 0, sCryptBuffer, lCryptBufLen)) Then

MsgBox ("bytes required:" & CStr(lCryptBufLen))

MsgBox ("Error " & CStr(GetLastError) & " during CryptDecrypt!")

GoTo Done

End If

'Apply decrypted string from sCryptBuffer to private buffer for OutBuffer property

sOutBuffer = Mid$(sCryptBuffer, 1, Len(sInBuffer))

Done:

'Destroy session key.

If (lHkey) Then lResult = CryptDestroyKey(lHkey)

'Release key exchange key handle.

If lHExchgKey Then CryptDestroyKey (lHExchgKey)

'Destroy hash object.

If lHHash Then CryptDestroyHash (lHHash)

'Release provider handle.

If lHCryptprov Then lResult = CryptReleaseContext(lHCryptprov, 0)

'switch Status property

lStatus = CFB_READY

Exit Sub

ErrDecrypt:

MsgBox ("ErrDecrypt " & Error$)

GoTo Done

End Sub

Public Property Get Status() As Long

Status = lStatus

End Property

Private Function InitUser() As Long

Dim lHCryptprov As Long, lHCryptKey As Long, avProviderData(1000) As Byte

Dim lProviderDataAddress As Long, lProviderDataLen As Long, lDataSize As Long

Dim lResult As Long, sContainer As String, sProvider As String

Dim sUserName As String, lPoint As Long, lMemHandle As Long

Dim lReturn As Long, sBuffer As String

On Error GoTo ErrInitUser

'prepare string buffers

sContainer = vbNullChar

sProvider = MS_DEF_PROV & vbNullChar

'Attempt to acquire a handle to the default key container.

If Not CBool(CryptAcquireContext(lHCryptprov, ByVal sContainer, ByVal sProvider, PROV_RSA_FULL, 0)) Then

'Create default key container.

If Not CBool(CryptAcquireContext(lHCryptprov, ByVal sContainer, ByVal sProvider, PROV_RSA_FULL, CRYPT_NEWKEYSET)) Then

MsgBox ("Error creating key container! " & CStr(GetLastError))

Exit Function

End If

'Get name of default key container.

lProviderDataLen = Len(avProviderData(0)) * (UBound(avProviderData) + 1)

If Not CBool(CryptGetProvParam(lHCryptprov, PP_CONTAINER, avProviderData(0), lProviderDataLen, 0)) Then

MsgBox ("Error getting user name! " & CStr(GetLastError))

avProviderData(0) = 0

End If

'Get sUserName from avProviderData()

lPoint = LBound(avProviderData)

While lPoint <= UBound(avProviderData)

If avProviderData(lPoint) <> 0 Then

sUserName = sUserName & Chr$(avProviderData(lPoint))

Else

lPoint = UBound(avProviderData)

End If

lPoint = lPoint + 1

Wend

MsgBox ("Create key container " & sUserName)

End If

'Attempt to get handle to signature key

If Not CBool(CryptGetUserKey(lHCryptprov, AT_SIGNATURE, lHCryptKey)) Then

If GetLastError = NTE_NO_KEY Then

MsgBox ("Create key exchange key pair")

If Not CBool(CryptGenKey(lHCryptprov, AT_SIGNATURE, 0, lHCryptKey)) Then

MsgBox ("Error during CryptGenKey! " & CStr(GetLastError))

Exit Function

Else

lResult = CryptDestroyKey(lHCryptprov)

End If

Else

MsgBox ("Error during CryptGetUserKey! " & CStr(GetLastError))

Exit Function

End If

End If

'Attempt to get handle to exchange key

If Not CBool(CryptGetUserKey(lHCryptprov, AT_KEYEXCHANGE, lHCryptKey)) Then

If GetLastError = NTE_NO_KEY Then

MsgBox ("Create key exchange key pair")

If Not CBool(CryptGenKey(lHCryptprov, AT_KEYEXCHANGE, 0, lHCryptKey)) Then

MsgBox ("Error during CryptGenKey! " & CStr(GetLastError))

Exit Function

Else

lResult = CryptDestroyKey(lHCryptprov)

End If

Else

MsgBox ("Error during CryptGetUserKey! " & CStr(GetLastError))

Exit Function

End If

End If

'release handle to provider

lResult = CryptReleaseContext(lHCryptprov, 0)

InitUser = True

Exit Function

ErrInitUser:

MsgBox ("ErrInitUser " & Error$)

Resume

End Function

Private Sub Class_Initialize()

If InitUser = True Then

MsgBox ("InitUser OK")

Else

MsgBox ("InitUser failed")

End If

End Sub

Public Property Get Password() As String

Password = sPassword

End Property

Public Property Let Password(vNewValue As String)

sPassword = vNewValue

End Property


Any not totally insecure browser vulnerable to BEAST?

It should be noted that BEAST requires some hostile code which runs on the victim's browser, code which is able to send arbitrary requests to the target Web site, with enough "control" on the sent bytes to pull off the CBC-related calculations. In particular, this cannot be "just text". The BEAST authors had to find some sort of channel which would evade the Same-Origin Policy. They found two:

one in Java, which has been fixed soon afterwards (and unfixed Java plugins have other, bigger holes);
one in a draft version of WebSocket, which was never widespread (being draft) and has been fixed; actually, it was already fixed when the attack was published, although the fix was serendipitous (it was a change which was meant for protecting against something else).

Arguably, BEAST cannot be exploited nowadays unless another SOP hole is found. Moreover, even if such a SOP hole is found, current browsers to the 1/n-1 split which also prevents BEAST from being applicable. This method has been applied in major Web browsers more than one year ago (see this) and I don't believe that there was no remote-execution bug found in these browsers in the last year. This would mean that, indeed, there is no reason to worry about BEAST anymore. Switching to TLS 1.2 would still be good nonetheless.

The Lucky Thirteen attack is, arguably, not an attack on the browser but on the server. It requires the browser to engage in a lot of requests to the server (in a BEAST-similar setup), but the leak comes from the server: the server processes an incoming record, and the MAC verification will fail, but some subtle timing measure may reveal whether the PKCS#5-like padding was correct or not. It is claimed that almost all vendors (at least the open-source ones) fixed their code to avoid the leak that Lucky Thirteen relies on.

Web browser brand and version has little relevance to the Lucky Thirteen. Theoretically, one could reverse the setup and attack the processing of records sent by the server to the client, but it would require that the attacker has sufficient control over the server's responses to make the attack work, and that seems quite hard.


What are the security implications of storing multiple hashes for similar passwords?

If there is any impact on technical aspects of security, whether positive or negative, it appears to be very marginal. I qualify "technical" because human/psychological elements often play a significant role.

The real impact is only the real user - whose life is made marginally difficult and perhaps on the plus side, more security aware.

From the server side, I see this as extra work (both during development and operations) that doesn't quite give enough benefit to justify it. To defend against any moderately talented attacker's dictionary attack, the number of hashes that need to be stored this way is too large to make sense at scale.

Why? The attacker's work factor hasn't changed much, despite you having eliminated "some" of the combinations.

OTOH, user awareness can be better handled on the client side by rating the password strength while the user types it in. This can include both entropy tests (length, variety, etc) as well as uniqueness tests (variation of previous password). No need to store it on the server side, IMHO.


Is there any quick or automated to way to check the version of PHP running on a remote server?

Unless the version information is presented to you, e.g. in headers, a call to phpinfo() in the code etc., there is likely no way to determine the version.

The only other way I can think of would be to try and exploit known vulnerabilities in PHP itself, and deduce the version based on success. However, this may or may not be appropriate for your assessment.


How to copy files without copying Alternate Data Streams

Copy it to any non-NTFS filesystem.
Alternate Data Streams (ADS) are a feature unique to NTFS. They are similar to, but distinct from, extended attributes (xattrs) on many Linux filesystems like ext4. The primary difference is that ADS streams may be hidden, requiring knowledge of the ADS handle to access it (at least without specialized tools), whereas xattrs can be easily enumerated.
Because only NTFS supports ADS, copying it to a filesystem like ext4 effectively cleans it out. It is for the same reason that xattrs are not preserved when a file is copied from ext4 to NTFS.
On a side-note, while malicious code could theoretically hide in a file's ADS, it would not be active there. Malware stored in an ADS would be completely neutralized until something else intentionally activated it. It is no more a source of infections than other places data can be hidden.


The risk of RSA encryption. Would individually encrypted characters be risky?

I'm assuming you mean that each character is individually encrypted, and you get the ciphertexts and public key(s) used to encrypt the characters.
The main consideration would be whether the encryptions were performed with padding, such as OAEP. The importance of padding is well established for most cases. In particular, for this scenario, the critical weakness is the determinism of the output - unpadded RSA produces a deterministic output for a given input and key - which can be used to trivially brute-force small messages. The algorithm is simple:

Attacker takes the supplied public key and uses it to encrypt every possible (or even just every likely) character, individually.
Attacker compares each resulting ciphertext with the supplied ciphertext. If they match, the attacker knows what character produced that ciphertext and thus has "decrypted" the message.
Repeat for each (ciphertext, public key) pair that you have until you've "decrypted" everything.

If the messages are padded correctly, this attack is not possible. In that case, there is not (AFAIK) any reason this scheme wouldn't work.
Of course, RSA with secure key sizes is painfully slow, and using it for a large number of tiny messages is absurdly wasteful. In any realistic scenario, you would either encrypt the full message with the key (if it's short enough to do so in one "block"), or use a hybrid cryptosystem where the message is encrypted using a symmetric cipher, and the symmetric cipher's key is encrypted using an asymmetric cipher such as RSA.


Remote OS Command Injection - scanned by ZAP

In my case every time I see this vulnerability it is false positive, this command is "sleep", so if the response long, and takes approximately 15 seconds, which can happen for various reasons (network problems, VPN problems) OWASP ZAP return this as vulnerability.
You should run this request several times and see if every response takes approximately 15 seconds, if not, I would classify this as false positive.


Does steganography ensure confidentiality?

Steganography solves a different problem.  Steganography attempts to hide the existence of the data at all, not necessarily protect the confidentiality of the data once it's discovered.

Regarding Kerckhoff's principle, yes, steganography does violate Kerckhoff's principle.  Specifically, point 2:

  It should not require secrecy, and it should not be a problem if it falls into enemy hands;

Steganography does not use a key, and as such requires that the method of encoding data remain secret.


How do I know if a website encrypts passwords apart from SSL?

No, you can't be sure that a site has correctly hashed your password.

However, there can be some signs that they did not, particularly if they e-mail your existing password as part of the "forgot password" functionality.


Can websites tell whether that I am visiting them using the same device?

By using incognito mode and using a VPN you are masking two of your fingerprints:

Cookies
IP Address

These are the most common techniques used by websites to identify users today.

There is much more information websites can get from your browser to use to identify you.
Such as:

User Agent
HTTP_ACCEPT Headers
Browser Plugins
Time Zone
Screen Size and Color Depth
System Fonts
Supercookies
HTML5 Canvas Fingerprinting

These pieces of information alone do not have much meaning in relation to identifying a device.
But when put all together, they make up a pretty unique profile.

To view some of the information a website can obtain from you browser in order to fingerprint you, visit:
https://panopticlick.eff.org/ or http://ip-check.info/

For more information about the information your browser leaks, visit:
https://www.browserleaks.com/


How to migrate users? (Changing the login system)

What you could do is hash the old passwords and make the users choose a new one when they login. You really need to force them to use new passwords though since if there's not a 100% chance that the old database was leaked their financial info could be exposed. If you think that the old system was compromised you'd be better off sending out emails, or requiring verification when they login.


The "rememberable" Devise strategy is used to re-authenticate a user from the value stored in a persistent cookie (the remember_user_token that you decoded) with the following format:

[[<user_id>], "<user_salt>", "<cookie_generated_at_UTC_time>"]]

The cookie is signed to prevent tampering of the cookie values (the signature is the blob you can find after the "--" in the cookie).

The application you are testing uses the default implementation of "rememberable", which does away with the need of having a database column to store the per-user "remember tokens"; instead it uses the user id + password salt as the key to uniquely identify the user. When the application receives back the signed id+salt cookie, it looks up a user with the matching id and if the salt matches that of the cookie, it successfully authenticates the user and continues the processing.

The use of the salt as unique identifier avoids having to store "remember tokens" on the server side; as a trade-off it reveals the salt. Giving an attacker access to the bcrypt salt without the actual hashed password is useless (the salt is only used to avoid pre-computed hash attacks, forcing an attacker to bruteforce each hashed secret separately). If an attacker gains access to the user password they will also get access to the salt, so the security of the "rememberable" strategy is not compromised by the sharing the salt.

I would personally be more concerned by the sharing of the user ID (the first field in the cookie), e.g. it may be later re-used in direct object reference attacks.

If you are not comfortable exposing the user password salt you can implement your own remember_token method in your Devise user class, see the rememberable model, e.g. for instance creating random tokens and storing them on the user database table.


How to find out that a NIC is in promiscuous mode on a LAN?

DNS test - many packet sniffing tools perform IP address to name lookups to provide DNS names in place of IP addresses. To test this, you must place your network card into promiscuous mode and sends packets out onto the network aimed to bogus hosts. If any name lookups from the bogus hosts are seen, a sniffer might be in action on the host performing the lookups.

ARP Test - When in promiscuous mode the driver for the network card checks for the MAC address being that of the network card for unicast packets, but only checks the first octet of the MAC address against the value 0xff to determine if the packet is broadcast or not. Note that the address for a broadcast packet is ff:ff:ff:ff:ff:ff. To test for this flaw, if you send a packet with a MAC address of ff:00:00:00:00:00 and the correct destination IP address of the host. After receiving a packet, the Microsoft OS using the flawed driver will respond while in promiscuous mode. Probably it happens just with the default MS driver.

Ether Ping test - In older Linux kernels when a network card is placed in promiscuous mode every packet is passed on to the OS. Some Linux kernels looked only at the IP address in the packets to determine whether they should be processed or not. To test for this flaw, you have to send a packet with a bogus MAC address and a valid IP address. Vulnerable Linux kernels with their network cards in promiscuous mode only look at the valid IP address. To get a response, an ICMP echo request message is sent within the bogus packet leading to vulnerable hosts in promiscuous mode to respond.

Maybe there are more, the DNS test for me is the most reliable


Is it possible to digitally sign an email twice?

It depends on the order of operations. If A signed the email and then encrypted it with B's public key, then when B decrypts the email, the signature is still valid, and thus B can sign the email signed by A and encrypt it with C's public key. When C receives the email, they can decrypt the email and check both signatures and all is well.

If however A encrypted the email before signing, there would be no valid signature left after B decrypts the email. And so there would be no way to have C verify A's signature.

As cremefraiche points out clearsigning the message before encrypting will allow both signatures to be verified.


If I know a currently working exploit to spoof SMS on a major carrier, what should I do?

Make a demonstration video.

I have found that demonstration videos are an incredibly powerful way to communicate security issues, capturing the attention of managers who would otherwise dismiss this as "geeks talking geek".

Try to make the video as real life as possible. Include an example that is not just "oh look, this shouldn't happen" but actually gives a plausible real world scenario where this would be a serious issue.

Do not include technical detail in the video. If there's a technical step, just show someone running some commands on a computer - maybe even blur the screen to hide the commands. The video is to show WHAT can happen, not HOW it happens. This also means the video is less sensitive, as it doesn't contain technical details of the vulnerability.

If it is only some carriers that are vulnerable, include an example of attempting the same attack on a non-vulnerable carrier - to show that it doesn't succeed.

Share the video with the carrier privately at first, and tell them that if you don't get an adequate and timely response you will share the video more widely.

Here is an example of myself and a colleague in a demonstration video.


As with many things, ensuring you detect a successful exploit requires defense in depth, and a little preparation.

We'll start with the assumption that an attacker will somehow break the "target software" and either have it or the account it runs under execute arbitrary code supplied by the attacker. Our goal is to be able to detect that this has occurred.

First, on the prevention side, you'll want to ensure that whatever target software runs under a separate account with least privileges. This implies that even a successful attack will not have access to the rest of the system. You'll also want to make sure the system gets regular security updates, etc. This mitigates the risk that the attacker will be able to elevate privileges from the account he popped to root or something else interesting. Finally, have only the minimal software needed, ideally only for a single purpose. (Don't comingle web/app/database on the same box.)

Now once you have those done, you can start looking detecting the exploit. For that, you should start with OS event logging. Did any unusual processes start or stop. Presumably, there'll be a pattern of "normal" usage, and if the attacker runs their own code, it might be in a separate process. An IPS/IDS should provide lots of insight into this -- much better to find a good one and configure it than to try to roll it yourself. Any IPS/IDS worth its salt should be sending event data out to a separate host (as @user400344 suggests).

On the OS firewall side, most server software doesn't initiate TCP connections to random endpoints, so you may want to configure the firewall to only allow traffic outbound to known destinations. This would also make it a little harder for an attacker to exfiltrate data. Upstream from the server, you could monitor TCP traffic to ensure it matches what you expect.

Keep a log of all processes started. There are various programs that can help you do this. (Also pipe that off the host.)

Next, at the application layer, you'll want to write to syslog or another service that runs separate from the target software. During the exploit, the attacker would be able to write to syslog, but not modify it.

If the target software schedules jobs, accepts commands, etc., then check to ensure those aren't modified except through an expected workflow.

You could run an IPS/IDS at the application layer too (web app firewall, if the target software is a web server), in which case that should provide additional defense.