Reverse proxy or Public load balancer? What would be the difference between putting in a load balancer or reverse proxy on the perimeter to send requests back to a system in our LAN? We don't want to have people NAT directly into the LAN, which is why we're considering putting this extra step in between.

To make things clear the requests are coming from a cloud provider and currently configured to terminate the connection within the LAN. I don't see what a load balancer would give us from a security perspective, but I'm not sure how much more security would be placed with a reverse proxy either. Either way, I'd prefer these connections to be as secure as possible. I'm limiting what the source addresses from the cloud provider can hit, but there might be a need for remote clients to attach as well, which would make things less secure.

Any suggestions?

A reverse proxy (and by extension most load balancer which are essentially a specialised reverse proxy) would generally reconstruct the packet/request (depending on what layer it functions at) rather than just modifying the packet and forwarding it on.

That process can provide some protection against malformed or forged packets/requests. Typically this is described as "breaking the circuit" because packets are never directly passed between the networks.


Advertisement on Skype tried to download a file to my computer using Javascript I usually have Skype running in the background. If you have ever used Skype before, you probably know it has advertisements. One of these advertisements made two windows pop up on my screen, asking to download a file. Windows caught it though (for once...). This made me wonder, how could an ad on Skype make windows pop up?

Notice in the first picture, it's a .js file. Does Skype allow Javascript to be run on my computer through ads? If so, what can be done? Can an attacker access my files, or track my keystrokes? Is there an exploit in Skype that hasn't been patched yet?

It seems to me that Skype is using the areyouahuman.com ad tech to only deliver their ads to "humans".

Why it wants to download the file? If you see at "Type" it says: Undecided. Which could be a bug in the areyouahuman server which failed to set the content-type header. In the case of browsers, they normally display the "download file" pop-up when the type is not recognized (similar to what happened to you).

It can be that Skype is using an embedded browser instance to execute the banners. I don't know it that is true, but that seems to be the case.

Does it pose a security risk? I'm sure it is. If Skype is rolling their ads allowing Javascript, someone could potentially inject malicious code into them.

How bad can it get if that happens? If what I stated before is true, my guess is that it can get as worst as any browser vulnerability.

Better to contact Microsoft and report that bug.


Is it safe to tell your users what kind of hashing algorithm you use? For example, on the user registration page, is it safe to tell people "Your password will be stored as a one-way hash using the (whatever) algorithm."

If it is not safe, then your hash function is pure junk, and you should not use it.

In any decent security analysis, it is assumed that the attacker already knows all the software that you are using, because:

There are not so many possibilities.
A lot can be guessed based on application behaviour and output.
An attacker who could get a glimpse at your database might also have a copy of your PHP scripts, and thus knows.
Even in cases where the attacker does not know your hash function, it is very difficult to quantify such lack of knowledge: to what extent does the attacker not know ?
In particular, the attacker may also register as a user, with a password he chooses, and then observe the resulting hash, allowing him to quickly test any potential hash function.

On the other hand, making the used hash function explicit may give you a reputation of "competent site owner" which would bring confidence to technically-inclined customers.


What is a good practical (and sane) way to manage all your passwords for online sites? I am just a mere mortal that wants to have a somewhat secure way of managing all my passwords.
This is something that I have been putting off, but since LinkedIn decided to give away one of my passwords away, I figured it was about time I addressed this issue.
I say somewhat secure, because - clearly - the most secure way would be for me to remember every single unique 200 character password I created for every site.
I know there are various sites that allow you to create hashes per url that you mix with a particular word you select, so I think that is what I am leaning towards.
I could also write it down, but then if I don't carry my passwords with me I am in big trouble and I am clumsy like that.
What is a good practical way to manage passwords for different sites (short of writing them down)? Any Chrome plugin hash generator I should be looking into? Online service?

What I do is the following:

I write the passwords down.

Many people will cringe and scream and curse me and say that this is wrong and should never be done, but this is too simplistic an assertion. Details matter. Here are the details:

I keep the passwords in a text file.
When I get out of my home and must access my passwords, I bring with me a netbook. That computer has a few specific characteristics:

It runs Ubuntu (a Linux distribution).
No swap space is configured. What is "in RAM" is really "in physical RAM" and never makes it to permanent storage.
The /tmp directory is a tmpfs, i.e. the files in that directory are only in RAM (and that's physical RAM, see above).
I always shut the machine down; I never put it in "sleep mode".

Under these conditions, I have a reasonable guarantee that if I write a file in /tmp, read it, then shut down the computer, then the file contents will not be accessible to any evildoer who would steal the machine.
My file full of passwords is symmetrically encrypted with GnuPG, with a big, fat, strong passphrase (that passphrase, I keep in my brain).
When I must use a password, I decrypt the file in the /tmp directory and I erase it immediately after; and when I no longer need to use the computer, I shut it down, as is my custom.

Under these conditions, my passwords are reasonably safe. This is not perfect: if my computer is hacked in silently and the attacker can observe everything I do for a long time, he will get my passwords -- but he would get them anyway under these conditions, if only by plugging some evil code in the Web browser itself (regardless of how you manage your passwords, the Web browser code gets them at some point, since it must send them to the servers who ask for them). I claim that my method is much safer than the common alternative, which is reusing passwords on several sites. Do not reuse passwords !

(In practice, I very rarely have to access my file of passwords, because I remember the passwords I often type -- and those I do not often type, well, I type them rarely, by definition.)


Is there a place where we can see which Microsoft's KB replaces which Microsoft's KB? Do you If there is a simple listing of which KB replaces which KB in Microsoft development because every report from Microsoft explain one by one which KB replaces which KB, but I can't find a place where this will be all gathered.

Microsoft Report Example here

There used to be a file you could download, mssecure.xml which contained all this info. It was used by Microsoft Baseline Security Analyser 1, which is now long retired. Unfortunately, there is no replacement from Microsoft (info).

The information you need is contained in the Nessus plugins and you could probably write a script to parse them and summarise the info. Although doing that may be a violation of the Nessus license.


Where should we maintain external (subcontractors) usernames and passwords? We have three environments:

Testing and development
Preproduction
Production

In our company all technical people, including sysadmins and network administrators, are subcontractors so a lot of them (but not all) need access to almost everything.

Where should we maintain external (subcontractors) credentials?

Today we have a different domains for them, one different domain por each environment: "EXTERNALSTEST", "EXTERNALSPRE" and "EXTERNALSPRO" (we also have domains for our own employees ("COMPANYTEST", "COMPANYPRE" and "COMPANYPRO").

We also give different usernames to externals depending on the environment:
test_username for "Testing and Development environment" and "Preproduction" environments and username for "Production" environment.

We are looking for doing this easier but secure.

Can we have a unique username and a unique domain "EXTERNALS" stored in "Production" for all external employees?

The risk I see here is that if we have the EXTERNAL domain just in Production we will have to open the communication from the other environments to Production and today we have a good segregation of this environments with firewalls rules.

Is this the better organization of external users? Is this secure?

I am not a network architect, but a red teamer. The networks that have been the hardest from a password management and segregation perspective have been that of administrators needing a user account and an administrator account. So if they are external, they would use their user account with two factor authentication to access the vpn for the environment they need. After accessing the VPN via two factor auth, they would need to access the password vault to "check out" their administrative credentials. Lieberman seems to be a decent option. I would also require two factor authentication to the password vault with a different soft/hard token. After the admins check out their password and then are done with them, have the passwords change, I know Lieberman does this errrr lol. This will HELP mitigate the possibility of the credentials being obtained from memory, cache, secrets, etc.

I think the segregation of domains is good, make sure to check the trust relationship between them. The different domains should not have any established trusts (regardless of what anyone says), otherwise what is the point of a different domain? Here is a link to the Lieberman website that give an in-depth description on how they try and mitigate attack on credentials: https://liebsoft.com/products/enterprise_random_password_manager/

As to the option of using LDAP and Kerberos on the internet...please...do not do that... I don't have enough points to respond to the comment directly. I read through the documentation that was provided: first of all it does not seem to offer the ability to use 2 factor authentication, which is horrible in itself but even more so when you are asking for a solution used primarily by administrators. Also, I just looked and it offers the administrative console for user and authentication management on the internet, with a simple admin username and password. This would leave it susceptible to brute force all day...keys to the kingdom. Some may say you don't have to put them on the internet, however it looks like most "MarkLogic" servers are from a simple shodan search. It looks sketchy at best.

I can say from experience that 2 factor authentication creates a huge headache and disturbance for hackers during their operations. Especially when its coupled with good password management of administrative credentials, i.e. the creds change frequently, are different from the user credentials, and another barrier of 2 factor auth is required to even access them.

ALSO!!!!! Do not let the soft token be requested and automatically approved by the user that is requesting them, AKA a self service portal for soft tokens. That needs to be a manual validation process. I do not believe this is a complete solution, however a good start. Hope this perspective helps at any rate.


Can a meltdown attack also violate data integrity of other processes or is it just violating data secrecy? Can a meltdown attack also violate data integrity of other processes by obtaining different passwords or is it just violating data secrecy by reading data it is unauthorized to do?

Meltdown is an attack that allows overcoming memory isolation completely by providing a simple way for any user process to read the entire kernel memory of the machine. Attacker can get password, private keys and valuable information. You can access the research paper here.


Why can't I upload a new ECC key to key servers, which is supported by GnuPG 2.1? My OpenPGP key is soon to expire so I wanted to create a new one.
GPG 2.1 came out a month ago including ECC support and I wanted to try the new key types.

So I have generated a brand new ed25519 key. Today I tried to upload it using gpg2 --send-key but then I couldn't find it.
I also uploaded it manually on pgp.mit.edu and I got:

Key block added to key server database. New public keys added:
1 key(s) added successfully.

but still couldn't find it with a search.

Why? Is it unsupported?

pgp.mit.edu and most other key servers are currently running the SKS key server software, which is (as of November 30th, 2014) not yet ready for the new ECC keys. There is some code, though; but it is not ready for production yet.

Be aware that even if most keyservers will support it (probably rather soon), broad support for ECC keys with other OpenPGP users will take quite some time, don't expect a majority of GnuPG users to have GnuPG available for their distribution within the next months or even 2-3 years, and people using older implementations will not be able to use ECC keys!


Why not use username as a password salt? The point of salting your password hashes is to prevent the attacker from using an off-the-shelf rainbow table. The salt needs to be unique per user, but doesn't need to be secret.

Why not use the username / user ID as a salt rather than staring a separate value in the DB. Is there some reason you'd need to change a user's salt in the future?

[I would have expected to find a question like this already, but I didn't. I also didn't look very hard]

The fact that the salt is a deterministic function of the username makes it likely that users who use the same username and password on two different sites might end up with the same password hash on both.  Attackers who observe this coincidence might then focus their efforts on cracking those password entries, so you might be exposing your users to more risk.  (This could in principle be mitigated by incorporating some site-specific data to the salt.)
When the user changes their password, it would be salted identically to the previous one.  Crackers can then attack those two password entries with the same effort as just one.
It just doesn't really gain you anything compared to the simple expedient of selecting a random salt each time you store a new password.  This is simple and optimal, because random salts are not just highly likely to be unique within your database, but also across all password databases ever kept.  Why deviate from a strategy that's both simple and optimal?


Does an email header/source contain sensitive information? I think I received a phishing mail and I want to forward the email header/source to the company mentioned in the mail.

Is there any sensitive information in the header or source, besides the email text and addresses? For example, I saw that the antivirus (and version) used to check mail was mentioned.

It depends on what you classify as sensitive. The following is a (not comprehensive) list of things that could be contained in an email header that an attacker could make use of.

If you consider any of the following sensitive the answer is yes.

Sender and recipient email addresses
Server names, which could reveal FQDN of your internal domain
Your organisations public IP address
Information on servers that have handled the email
TLS/SSL info & what ciphers you use (or don’t use)
Banner information
Email gateway details
What Anti-Virus you use to scan email


Securing fingerprint templates stored on web authentication server I have a multi-factor web authentication server, that in addition to regular passwords  uses fingerprints for user authentication.

Can anyone think of a security flaw in the following scenario:

I have Resource Server that hosts valuable resources, the resource owner must provide his fingerprint to an authentication server to grant access to his/her resources.

Securing the fingerprint data is critical. Before the user can use the system. He must install a web browser plugin. During the plugin installation the plugin connects to the authentication server and obtains a digital certificate from the server (a server public key).

Now when the user goes to the resource server webpage he types his username/password and the web page asks him to scan his fingerprint. Then, the  web browser plugin connects to the fingerprint scanner and triggers the scanner to scan the user's fingerprint.

The plugin gets the fingerprint from the scanner and encrypts it using a randomly generated 256 AES key and then encrypts this AES using the authentication server public key.

Then the plugin returns a JSON object containing the encrypted fingerprint and the encrypted AES key. Next a Java script from the resource server login page using AJAX send the JSON object to the resource server. The resource server forwards the JSON object to the Authentication server.

The authentication server decrypts the AES key using its private key and then uses the recovered AES to decrypt the fingerprint data. Finally, it compares the received fingerprint data with the stored fingerprint template and returns the result to the resource server. Based on the result the resource server denies or grants access to the user.

The fingerprint templates on the authentication server are stored in an encrypted database using a 256 AES Key.

The plugin gets the fingerprint from the scanner and encrypts it using a randomly generated 256 AES key and then encrypts this AES using the authentication server public key.

Yeah... the big question is....

Where are you storing the server private key ?

If its on a HSM then great.  If not, then there's a nice weak link....


Setting up ASP.NET web application on internet for first time; Are these security measures enough? I have a web application running on IIS 7 in offices on LAN and I wish to upload it to hosting space on (Godaddy) because I like it to be used in my other offices (other cities).

This application uses asp.net membership provider for user authentication and the data is gets validated from front and back end before submitting input and encrypted query string is used. I am plane to use Ultimate hosting plan for Godaddy which comes with Malware Scanner and SSL Certificate.

Are these security measures enough? As there is staff personal information in the database.

If not what other measures I can set.

If that's the only thing you've thought about, then likely the answer is "no, that's not enough".  I'm assuming that's not really all you have thought about, but just in case...

"Enough" is something that is determined after a detailed threat analysis by someone (or a team of someones) that knows what they are doing. Web applications are wonderful attack surfaces, and while Microsoft made it relatively easy to properly build a reasonably secure website using ASP.NET, it's still very easy to not build a secure website.

Simply putting something together and putting out there isn't enough, even for a website that contains no sensitive data.

There are many threats to worry about:

SQL Injection attacks

Can be used to steal sensitive information from your databases, insert malicious code to be output to browsers (see the next vulnerability) and in the absolutely worst-case scenario, SQL injection can be used to give an attacker complete control over your server.

Cross-Site Scripting (XSS)

Someone figures out a way to get your website to serve up malicious JavaScript.  Usually this is done by injecting the script into a database and then counting on the developer to not know enough to escape the database output.  It can also be done if the attacker has access to your file system, but putting the payload in the database is much more common.

Cross-Site Request Forgery (XSRF)

This is when someone uses XSS to put a malicious JavaScript on YOUR website that then goes and performs unauthorized transactions (often without your user's knowledge) on another website.  (This is why it doesn't matter if your site has sensitive information or not.  If you aren't coding to prevent XSS, your website can be used to attack websites that do have sensitive data.

Those are only the first thing to pop into my head.  There are a ton of other issues to be concerned with.  But this forum isn't meant for that type of in-depth answer.

I suggest starting here: http://msdn.microsoft.com/en-us/library/ff649100.aspx Once you've digested that, I'd strongly recommend becoming familiar with the OWASP Top 10. http://www.owasp.org/index.php/Top_10_2010-Main You're asking about a small sliver of the things you need to be concerned about.


Encrypt content such that it can decrypted only by a specific application Is there a key management approach for the following scenario:

Customer Alice uses an application S1 to generate a file. The contents are expected to be encrypted such that it can only be decrypted by someone who owns another application S2.
Alice distributes the file publicly.
Customer Bob owns application S2 and is able to decrypt the file.

In this case, Alice does not know Bob, and is not exchanging any keys with him directly. The key exchange is offline and between the applications S1 and S2!

How will application S2 store its decryption key? Obfuscating it in the binary is a bad idea. Let's say that using a key server is a non-starter in my scenario. Are there any other solutions?

Does any well-known product run into this scenario? How did they solve it?

True encryption means that a secret will be required to get original data back. Common secrets storage are:

the recipient's brain (something you know)
a smartcard of other HSM (something you have)

As soon as you go away from this secure encryption use case, you fall into obfuscation with 2 common ways:

a custom algorythm - hard to securely setup and test, and hard to protect against reverse engeneering, please keep away from that
a key hidden inside an application executable - hard to change if it were compromised, and hard to protect against reverse engeneering, not really better

If all you need is that Alice and Bob are not required to exchange any keys, you could use a central hub:

application S2 is distributed in such a way that every customers receives a personnal asymetric pair of keys and the central app only stores the public part, ideally the pair should be generated client side, for example during an app initialization
when Alice sends a message through S1, the message in encrypted with a random symetric key, and that key is securely transmitted to the central hub. A UUID of the message is transmitted to the recipient and to the central hub
when Bob receives the message and the UUID, S2 application opens a secure channel (TLS) to the central Hub. Bob is authenticated with his private key as a legitimate S2 owner, so the hub accepts the request for the symetric key for the message identified by its UUID
S2 can decrypt the message and Bob can read it

Limits:

what is controlled is only the ownership of a valid key, if Bob turns evil and decides to sell copies of his keys, you cannot prevent it. Same if he does not turn evil but gets hacked
if Bob finds that you S2 app is not what he wants and uses a third party app that mimics the interface you have no technical way to prevent it - but legal ways may exist...
even if the central hub does not receive the messages, you have full control over S1 and S2, so you could easily get all exchanged messages - you must know it when you present your solution to customers


Where are located the DPAPI BLOBS and is there any tool to decypher them? I'm doing some testing with DPAPI for a project where I'm involved. I would like to know where the users Masterkey are located and if there is any free utility to find and decipher them.

I'm pretty sure that they are located in "%APPDATA%\Microsoft\Protect\" subfolders, but as far as free utilities goes, the only one I've found is DPAPIck, but is outdated and it doesn't seem to work properly in my system (Windows 2008 Server R2, I'm using the 0.1 version because I don't have any python interpreter installed).

The key blobs are stored in the following path:

%APPDATA%\Microsoft\Protect\{SID}

Where {SID} is the security identifier for the user.

There's a paid tool by PassWare that claims to support Win2K8, but it looks like DPAPick is the only freeware tool. Since it's a community project, you could always drop them a bug report. You also mentioned that you aren't running the latest version due to not having python... just go grab python then!


XSS triggered but chrome didn't show popup. What exactly was going on? Related to my previous question on XSS in canonical link.

At the beginning I turned off Chrome's XSS auditor and tried executing XSS with just onload event using following payload which did not trigger.

  " onload="alert(1)

But when I turned ON XSS auditor Chrome gave a warning as follows:

My question is why XSS was not triggered when XSS auditor was OFF ?

The XSS auditor can be triggered even if your payload isn't working, and sometimes even if there's no XSS vulnerability at all!

The XSS auditor just looks at the request parameters to check if there's a match with a part of the response.

To understand why your payload isn't working, disable the XSS auditor and look at the HTML source / developer console.


Fine grained authorization with OAuth2 In my understanding of OAuth2 the scope may be used to specify access to what is asked and granted by code owner.

In most cases I encounters the scope list is closed and specify "kinds" of thing that can be accessed, for example profile, email, openid from Google Sign-in.

Does it make sense to encode access to specific resources in scope?
Like account:{account number}:rw

This is for the case where user have multiple distinct resources managed by resource server and would like to authorize third party access to specific resources but instead of "kind" of resource.
For example the hypothetical application would manage data folders and user U would grant read access to his folder "/A" but not any other folder to application B

I understand that in such case both Authorization and Resource server would have to parse and specifically handle such open ended scopes.

Are there other issues with that approach?

Is OAuth2 even right technology for such case? If not what to use instead?

I think the intent of OAuth scopes was to provide a framework for delegated consent, which is a form of discretionary authorization, but different from policy-driven authorization, which is what it sounds like you are trying to accomplish. The resource server has the responsibility to enforce both the delegation and the policy-driven approach.  Scopes wind up being a like a claim, if you try to model policy-driven authorization and similar to role-based access control, will grow exponentially with the permission (action-resource) matrix (read-account, write-account, etc.)  Your resource server developers have to know what each scope means to enforce:
@PreAuthorize("#oauth2.hasScope(‘read-account’)") so you can see the complex if-then-else logic that can result.
Consider externalizing your policy decision from your Resource Server by having it use all of the context it has (id_token attributes, resource metadata, client footprint, scopes) to make a request of a policy decision service with "can [subject] do [action] on [resource] in this [context/env]?"   The policy decision service is an domain that contains your risk, context and policy-driven rules like "External clients can read account details when the resource owner has a relationship with the account owner when 2-factor authentication is utilized."  Look for services that support standards like JSON profile for XACML. This will keep you from running into scope explosion and help achieve more cohesive policies.


Recently had a virus, can I use backed up files on clean system? I had to reinstall my OS (windows) recently due to a virus. I backed up my source files onto a flash drive. How can I get to those files without problems? I know flash drives can have nasty things in the autorun, but let's say I put the drive on a linux machine and try to read the files off of it, would that be ok? What could actually be embedded within the files themselves that could hurt my new, clean install?

There is an abundance of ways untrusted files could cause harm to your system.

One popular way to verify if any single file is malicious is to use Virus Total:
http://www.virustotal.com/

  Virustotal is a service that analyzes suspicious files and URLs and facilitates the quick detection of viruses, worms, trojans, and all kinds of malware detected by antivirus engines.

Short of re-installing everything from trusted sources you cannot get 100% assurance everything is clean.


Client reconnects during deauthentication attack During my first deauthentication attack the client I targeted was disconnected from the wireless network, however I was able to reconnect the client to the network even though aireplay-ng was still sending deauthentication packets. The device was an iPhone XR.

I found that some routers have deauth mitigation built in (by ignoring repeated deauth probes) but I was able to deauth multiple other devices from the same network successfully including different iPhone models so I don't think this is the case.

Is it likely the device (iPhone XR, or indeed all newer iPhone models) has deauth mitigation built in, or do you think the settings on the device have been tweaked manually to prevent deauth attacks?

I'm simply trying to understand why the client was able to reconnect.

It's hard to say exactly what you're seeing, but this is a possible scenario:

Client De-auths
Client sees extra network traffic and changes mode n -> g, or g-> b, etc.
De-auth packets are ignored by client as the client is now in a different mode.

See the end of the doc here: https://www.aircrack-ng.org/doku.php?id=deauthentication

It mentions the problems with deauth packets to devices in different modes. If you can check the logs on your AP, you could validate this was the case.


Web browser account security Please note that I've looked what similar questions have been addressed, but all I found was partial discussions.

My concerns is about web browser, password managers, cookies and sessions.

My goal is to make for someone impossible to log any of my websites while keeping things easy.

Password Manager
The first thing to start is a password manager in order to have secure passwords and a master password to rule them all. It's a good thing. But not enough. The thing is, cookies are stored to keep users sign in.
Session/Cookies manager
What I would like now is to be able to "log in" my browser as I would do in an OS. If someone access my browser he can use it, but not my account. If I enter a master password I'm suddenly connected to everything. This include password manager and not sharing cookies/not staying connected unless you proved your identity.

What I tried:
I tried LastPass 4.0 which looks cool. I made it logout when the browser I closed so that one could not log anywhere using my browser without the master key.

As I said the problem comes with cookies. Accounts like Google just keeps logging automatically, so it somehow bypass the password manager.

The perfect thing would be a LastPass that encrypts (or store elswhere) its cookies.

Anyone knows what could do it? Can't find extensions fitting my needs.

Thanks :)

The easy way to handle your problem is to allow cookies only to stay during a session. Whenever you tear down your browser session, all cookies get purged.

Firefox at least has this feature built in, so you don't actually need any extension to do that for you. (Settings -> Privacy -> History -> drop down "with user specific settings" -> "accept cookies until" -> drop down "firefox is closed")

Given, this does not allow your cookies to be "unlocked" like passwords, but it removed the problem of being logged on.

Yet, such a plugin would be pretty neat. I can't believe there is none. If that is true: Go for it and make one - or a change request.


Will disabling "symlink" in PHP.ini prevent attackers from attacking other websites? I have a small shared server where couple of websites are hosted, so I'm not sure if this kind of protection will be enough to prevent attackers from executing symlink attack.

I've added symlink to disabled PHP functions and of course others like exec to prevent from executing ln command.

Also apparmor is there in order to prevent some kind of damage.

Even if I allow all PHP functions and those dangerous, apparmor will block ln command:

apparmor="DENIED" operation="exec" profile="/usr/sbin/apache2" name="/bin/ln"

Is this sufficient protection against symlink attack?

Symbolic links is used for creating shortcuts in Linux.
If an attacker gains access to any single site on your server, he can easily
create a symbolic link to / directory & then putting the document root
afterwards it. Now the attacker can easily read your sensitive files.

You can protect it by:

Change the permission of /bin/ln to 400.

Locate php.ini by command- “locate php.ini” (without quotes). Edit the main
php.ini & disable symlink & proc_open.

If you have a shared host, & it is vulnerable to symlink, then change the
permission of your configuration files to 400.

Turn PHP safe_mode ON


Who/what maintains the CRL for a web server's client certs? In the instance of a web server that requires client certificates to log in, what exactly is creating and updating the CRL? From all of the examples I see, it is a manual process.

Is it really a person manually adding a certificate to the CRL when you no longer want that person to have access to the website?

In this context, a client certificate is really no different from any other certificate; the CA that issue the certificate is responsible for maintaining revocation information for it. Managing revocation information of certificates they issue is a core function of a certificate authority. When you pay for a certificate, this is one of the services you are paying for.

To be specific, every certificate will have either a CRL Distribution Point (for CRLs) and Authority Info Access (for OCSP) X.509 extension that point to the URL where revocation information for that certificate can be found. It is the CA's responsibility to maintain revocation information at those URLs.

Updating and publishing CRLs is mostly automated, but there may be a human in the loop to actually mark your certificate as revoked, or not. depending on how the cert is revoked. For example, if you call an API to request your own cert be revoked, then almost certainly no humans are involved. If there's an ars technica news story about you horribly mis-managing your certificate's private key, then almost certainly some human at the CA will decide to revoke your cert for you ;)

Pulling this in from comments, even though it's a little outside the scope of the original question:

Alternatively, I've seen setups where someone's access to the site is taken away, but their certificate does not need to be revoked (for example, someone changes departments and still needs their client certs for other websites). That would be managed through whatever Roles / Permissions system is built into the website, and doesn't really have anything to do with certificates themselves or CRLs because the cert is still valid as far as the CA is concerned.


Is there an anti virus that protects processes from being injected code to? As title says, is there an av that does that?

And if not, is there any other program that protects processes like lsass in windows, apart from protected process utility in win8.1?

Most antivirus will try to protect processes from code injection. However, this is ultimately heuristic: the only clear distinction between malicious code injection, and normal process behaviour, is at the human level: did the human user actually wanted that to happen, or not. Software in general, AV in particular, cannot fathom the intricate psychological processes in the soul of the human user.

So AV software commonly relies on recognizing known "hostile payload" and tries to catch variants thereof. It is a delicate compromise between security and functionality: the AV should let the normal data flow, but still reliably locate and destroy maliciously crafted data. So AV vendors must tap-dance between false positives (blocking normal data, thus breaking functionality) and false negatives (failing to block malicious data). Furthermore, AV ought to be efficient: they cannot afford to use all the CPU resources of the machine in order to come to a block/pass decision.

Common AV surveys all network communications to apply their automatic filters on all data flows. Some also try to be especially careful and strict for data which flows to specific, "sensitive" process like, indeed, lsass.exe.

Summary: yeah, AV do that. But don't expect miracles.


Where can I find information on existing viruses? As part of my research, I have created a small malware corpus which I'm conducting my tests against. I would like to categorize them based on Metamorphic / Polymorphic / etc.

I am not sure if this is the right place for this question. If not, I would appreciate suggestions for a more suitable one.

VX heaven (which is now unfortunately down) used to be a great source for research materials.  You can probably still find some places where they have some of the documentation and malware examples they provided (Google is you friend here).

Malware Sample Sources for Researchers has some malware's sources which can be studied to understand how they infect computers and spread.

The information you will find should be only used for educational purposes though.


What to do if my MAC has been spoofed? My MAC address has been spoofed by a neighbor to access my WiFi, positively. I know it's futile changing the WPA key or not broadcasting the SSID.

What are my options at this point ?

If your neighbor is using your WiFi, the fundamental problem is that they have your password.

Change your router password to a strong password and make sure you use WPA2 authentication. Make sure you perform the router change from a wired connection and disable WAN side administrative access.

Spoofing your MAC address would be a poor choice for them because it would result in collision problems with your MAC, which would not work well for either of you.

MAC spoofing would only come into play if you have applied MAC access controls to your router, which is not a default setup.

Last but not least, duplicate MAC addresses can be difficult to detect, so I would suspect spoofing your MAC is unlikely. Again, it’s probably just your password.


How did the brute-forcers get my IP address so quickly? This is probably a massive noob question, but Google results aren’t being helpful and I couldn’t find something specific here.

I made this server that just hosts IRC, HTTP and SSH for some friends. I have done this sort of thing before, and to my knowledge everything was fine. But today, minutes after I turn boot up the server properly for the first time, and pretty much for the whole day until I noticed it tonight, I was getting brute-forced via SSH. They were checking from a whole bunch of different IP addresses, from businesses in places like China and Vietnam, to DigitalOcean’s address.

I had not shared the direct IP address with anyone, and the DNS had only been set up for a day or two. There is no way anybody outside of my friend circle (people I trust) would have known that the server existed, and nobody would have any reason to hack me.

So my question is, assuming it wasn’t leaked, how did these people get my IP address so quickly, and what would they seek to gain my taking control of my machine?

The IPv4 address range isn't that big.

A class A network (/8) has about 16 million hosts, and in theory there is 256 of them. As a result, the internet has about 4,294,966,784 hosts. Of course, this is an approximation.

Many address ranges are actually reserved (e.g. 127.0.0.0/8, 10.0.0.0/8), and others are actually one address that represent a NAT-ed internal network. But just judging from a naive back-of-the-envelope calculation, we can say it's somewhere in that ballpark.

What an attacker can do now is mass-scan one subnet for a particular service, such as SSH. Simply get a number of hosts (e.g. 32 hosts) and divide the target subnet evenly. Scan only for SSH hosts on port 22, and check which hosts reply.

An attacker can then either try to launch a brute force attack themselves, or they can sell that list of active hosts to someone else, who then attempts to attack you.

How long would it take to make such a list? Assuming that the attacker wants to scan a whole class A network (16 million hosts), with 32 hosts to scan, at roughly 100 hosts per second, we get a rough estimate of 90 minutes. Of course, time will vary, depending on the speed or the number of hosts, but it should be in that ballpark.


Automated URL Discovering I built a simple server containing static files at /files/ and I'm attempting to discover them using automated tools.

I'm using wfuzz to brute force on the URL but is that the only way? Is there any other method for URL discovery, probably more effective that could compromise the privacy of my server?

What other techniques do hackers use on the wild?

Discovery of URLs in the wild tends to be done in one of three ways

Search Engine Based.  If your content gets indexed by a search engine, it's discoverable.  this doesn't just include them hitting your site directly, if other sites link to the content it may be findable that way.
"known URLS".  There's a lot of URLs that are known to be things like administrative interfaces or CGIs with known issues.  Tools like nikto maintain a database of them and can be used by attackers to discover systems which have that software installed.
Brute-force.  Tools like OWASP DirBuster combined with lists of common directory/file names can be used to discover content.

In terms of an untargeted attack unless you have a common vulnerable piece of software (e.g. phpmyadmin) hosted on a default URL, it's unlikely you'll have a problem as the sheer number of sites on the Internet make it unlikely that you'll face a human attacker focused on finding content on your site.

With a targeted attacker tools like nikto and dirbuster would be usuable to try and find content on your site.

If you have information that you don't want to be found I would recommend adding authentication and SSL to it to prevent unauthorised access to it.


How is a Watering Hole Attack performed I learned a little about Watering Hole Attacks, and I want to know how this attack is executed, what are methods used to achieve the goal of attacking the target, who is targeted by this attack?

Thank you.

Simple idea: If I can't make you go to a dangerous place, I check the "safe" places you go to and make one of them dangerous.

Attackers often spread malware by compromising websites and uploading malicious scripts to infect visitors (e.g. injecting a Flash exploit on a famous news site) - this is rarely a targeted attack. But in a watering hole attack, the adversary carefully chooses a specific website that they know their victim or group of victims visit frequently. So even if they are trained to not click on any untrusted links or to open unknown email attachments they will still eventually visit the website and get infected anyways. This way the attacker doesn't need to have the usual interaction with the victim, like sending out emails with dangerous links.

Real-life example from 2015:

  A Chinese attack group infected Forbes.com back in November in a watering hole attack targeting visitors working in the financial services and defense industries, according to two security companies.

(Source)

The term derives from the idea that instead of hunting their prey, predators often wait at watering holes because they know that other animals will eventually need to go there to drink.


nmap not showing closed ports When I running the command

nmap -p 443 -iL ip.txt

It only shows IP addresses with open ports in the output, but does not show IP addresses with closed ports. How can I see the closed ports/IPs.

There is typically a line that shows something like "Not shown: 1494 closed ports, 496 filtered ports", so in this case it would be "Not shown, 1 closed port"... but you're only searching for one port which gives me the filtered or closed result by that port, so can't say what you're seeing. I tried it with debug on and it gives results like what you're looking for. Try:

nmap -d -d -p 443 -iL ip.txt


How do you bruteforce decrypt data if you don't know what you are looking for? If I wanted to brute-force decrypt data, I would try decrypting it with a key and see if the decryption returned nonsense. If the decryption returned meaningful data (ex. something that a natural language processor deemed English, if I was trying to decrypt an English language email), I would assume I had the key. If it did not return meaningful data, I would try again with the next possible key until I had tried all possible keys. But this method would not work if I did not know if I was trying to decrypt a picture, text in Spanish, text in Chinese, an audio file etc.

How do you brute force decrypt if you don't know what you are trying to find?

It is an extremely rare situation for a brute-force attacker to work on data where they have no idea at all what is encrypted. When brute-forcing encrypted files in an unencrypted folder labeled "financial documentation", it's a fairly safe guess that if you get valid document, spreadsheet, or PDF files, you've decrypted something.

Even without information leakage from a badly-managed file system, most common file types contain a great deal of standard metadata. PDF files, .doc files, .JPG files, and others contain fairly standard headers. Text files contain information about their encoding. A brute-force adversary would spend time looking for this metadata. (This is, in fact, a form of Known Plaintext attack.) It doesn't matter whether that Word document is in English, Chinese, Swahili, or Esperanto. It's still a Word document, with all the metadata associated with it.

Though it's not precisely what you're asking about, cryptananalysis of the Enigma during World War II involved a similar form of this attack.


Is there any point of arp spoofing on a wifi network? I know that arp spoofing is required on a LAN network due to the fact that data is sent directly to a destination, but what about for a WLAN network? All packets can be seen if you are in promiscuous mode, so is there any point of arp spoofing?

It's true that you can examine data that way, but arp spoofing is used for many other attacks too, as you can do a lot when being the receiver of the data. You could then decide if you would like to send the packets somewhere else, to answer back with fake info (for example, a phishing site), and many others.


Can a WannaCry infection via zero day vector be blocked by an antivirus? We know that an AV would be able to stop a WannaCry executable that can be found in an attack email/file just before double-clicking.

However would an anti-virus be able to block against a WannaCry infection coming through the smbv1 zero day vulnerability ?

Since the code is loaded to memory directly in the vulnerability payload without the medium of a double-clicked file, this question comes to mind.

Maybe. It should.

It all depends on the AV, its inner workings, etc. In addition to how the actual virus works (in this case WannaCry).

For instance, WannaCry has several files, which are unpacked then run. If your AV also detects those in addition to the container, it would be reasonable that it stopped the infection, too.

Additionally, if the machine is directly connected to the internet, it would probably connect to the public sinkhole, thus not doing the real infection.

By the way, just as you should be using an up to date antivirus, you should be up to date with Microsoft patches, which means the machine wouldn't be vulnerable to the smb vulnerability used by ETERNALBLUE.


Making an API repository private vs public So I am currently working on the API of an application that will be serving many users. Currently the only "sensitive" information being stored using the API is user emails and names. The application allows users to form teams (which can be private). The API serves requests coming from Slack and also from a client website. Metadata about user communications on slack is also collected by the API.

Assuming no secrets are exposed in the codebase, would it be ok to keep the repo public?

The main arguments for making it public are:

Keep the project open source.
It can be a useful GraphQL learning resource.
Access to workflow tools that are only free for open source projects.
Get community help on finding and patching exploits.

The main arguments against making it public are:

If there is something we missed or forgot to secure it could be exploited.
People would figure out how it works internally and maybe try to mess with things that arent thoroughly validated yet.
If we are ever careless and accidentally commit something sub-par that could create problems too.

What's the best approach here?
Thanks for any help.

I think you are okay making this a public repo as long as the following conditions are met:

No application secrets such as keys or certificates are maintained in the repo.
No sensitive or personal identifying information, such as user names, email addresses, passwords, etc. are maintained in the repo.
No algorithms that if reverse engineered could lead to the exposure or exfiltration of any of the above in the runtime system. For example, reverse engineering an encryption routine or a protocol that could expose a user name and password.

Assuming these are met one important factor that shouldn't be overlooked is ensuring that your app is architected to protect itself from intrusion. This would include user authentication, ensuring that the front-end only communicates to the backend through the API (i.e. no direct use of backend services like making a db call from the frontend), using secure protocols (like HTTPS) to protect the communications channel, and ensuring that the OS and any other services you are using are regularly up-to-date on security patches.


Best practice to discover network hosts? I'm creating a python networking program and need to discover all the usable hosts on the network such as phones and desktops on Linux.
What works better, NMAP, Arp-Scan, arp, or something else?

I've tried this to discover hosts with NMAP:

nmap -n -sn 192.168.1.0/24 | awk '/is up/ {print up}; {gsub (/\(|\)/,""); up = $NF}'

This for Arp-Scan:

sudo arp-scan -I wlp1s0 -l

And this for ARP:

arp -a

Running each of these commands, one after another, I get these results:

seth@pixel:~$ sudo arp-scan -I wlp1s0 -l
Interface: wlp1s0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.9 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.1.1 20:e5:2a:04:85:d2   NETGEAR INC.,
192.168.1.3 bc:c8:10:28:6e:38   Cisco SPVTG
192.168.1.4 e4:e0:a6:3f:45:88   (Unknown)
192.168.1.9 d4:f4:6f:25:0f:c3   (Unknown)
192.168.1.16    c0:ee:fb:ef:a0:90   (Unknown)

5 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9: 256 hosts scanned in 2.271 seconds (112.73 hosts/sec). 5 responded
seth@pixel:~$ nmap -n -sn 192.168.1.0/24 | awk '/is up/ {print up}; {gsub (/\(|\)/,""); up = $NF}'
192.168.1.1
192.168.1.3
192.168.1.13
192.168.1.16
seth@pixel:~$ arp -a
? (192.168.1.73) at <incomplete> on wlp1s0
? (192.168.1.14) at <incomplete> on wlp1s0
? (192.168.1.207) at <incomplete> on wlp1s0
? (192.168.1.140) at <incomplete> on wlp1s0
? (192.168.1.77) at <incomplete> on wlp1s0
? (192.168.1.18) at <incomplete> on wlp1s0
? (192.168.1.211) at <incomplete> on wlp1s0
? (192.168.1.144) at <incomplete> on wlp1s0
? (192.168.1.81) at <incomplete> on wlp1s0
? (192.168.1.22) at <incomplete> on wlp1s0
? (192.168.1.215) at <incomplete> on wlp1s0
? (192.168.1.148) at <incomplete> on wlp1s0
? (192.168.1.5) at e4:e0:a6:3e:af:ad [ether] on wlp1s0
? (192.168.1.9) at d4:f4:6f:25:0f:c3 [ether] on wlp1s0
? (192.168.1.4) at e4:e0:a6:3f:45:88 [ether] on wlp1s0
? (192.168.1.16) at c0:ee:fb:ef:a0:90 [ether] on wlp1s0
? (192.168.1.3) at bc:c8:10:28:6e:38 [ether] on wlp1s0
? (192.168.1.3) at bc:c8:10:28:6e:38 [ether] on wlp1s0

As you can see, arp -a returns the most hosts in the quickest time possible, but is it accurate and reliable?
What should I use?
Should I just write a simple script that pings all hosts in a given subnet?

For unprivileged Unix shell users, the default probes are a SYN packet to ports 80 and 443 using the connect system call. This host discovery is often sufficient when scanning local networks, but a more comprehensive set of discovery probes is recommended for security auditing.

Nmap host discovery

Therefore, running nmap -sn as an unprivileged user may not return accurate results if hosts do not reply to these probes (e.g. strict firewalls and/or no ICMP response). Running the same scan as root will use ARP instead, producing a similar if not identical result to the arp-scan tool.

Note that arp -a does not scan or even necessarily display all of the hosts on the network. This command simply dumps your ARP table, which contains entries from hosts you've sent ARP requests for, or received gratituitous ARPs from.

Additionally, your idea to ping all hosts may not work if these hosts do not reply  due to firewalls (firewalls are commonly set up to block ICMP, regardless of the merit in this practice).

That said, an ARP scan (with nmap, arp-scan, or your own script) is likely the most reliable way to determine the hosts on your local network, since this will not be blocked except in extreme cases.


When form submission fails, password field gets blanked, why is that the case? I've recently asked a question about blanking the password fields in UX for usability purposes, but It seems all the sites use this approach for security reasons. Why is it insecure to post back the same pass that user has entered?

Good question. Having the benefit of looking at some of the answers, and pondering over this myself, I actually don't see any major security benefits from clearing the password from the partial form returned to the user, but there definitely are some risks worth considering.

From a security architecture point of view (as @Roryalsop already touched on), you usually want passwords flowing only in one direction. From the user to the application, never back. This applies on all layers, and this one-way-system gives benefits from a security point of view. Having an exception to this rule might or might not be a good idea. But that's why your question is interesting. Does this scenario deserve an exception?

Lets look at some attack vectors and see if nulling the password protects against any of those:

sniffing the traffic - if an attacker is able to intercept communication between the user and server, it can sniff the password sent in the first place by the user. I see no benefit in emptying it on the response
malware on the server or client side - the same. It can intercept the initial password.
cached data - this was already mentioned briefly by @SachinKumar but is worth expanding. There's an increased chance that if the server returns the password with the response, it might end up cached somewhere (the server memcached, a proxy server along the path, the client's browser history etc). Client requests are never cached. Server responses are! This is probably the biggest risk I see. Proxies can be probably be eliminated from the equation by using SSL, and if the server uses correct cache-headers and sets the input field correctly, this can also mitigate browser-caching. That said, it's still possible that the value gets cached somewhere, even accidentally and that's probably not desirable.

But then, nulling the password is easy enough, shouldn't damage user-experience too much and keep things cleaner from a security standpoint. I would still suggest you keep doing so.

If you're worried about user-experience, try to follow the advice you were already given on UX - perform extra validation on the client side, just so the user gets early feedback. Don't replace the validation on the server. This is the most important validation ultimately. But for user-feedback, client-side validation can work wonders to improve user experience and you don't have to take even a slight risk of the password being cached (or change your security architecture by making an exception).


What options are available for implementing DLP? What options are available for implementing DLP within an organisation and what are the pros and cons of each?

One approach is to lock down endpoints to block the egress points, which includes:

Disabling local media: USB, SD cards, CD writers, firewire, etc. Many enterprises attempt this - disabling USB is considered a standard baseline - but rarely are all these blocked. Thin clients can do this more robustly than a normal computer.
Blocking network egress: this is harder; some enterprises use a content filtering proxy to block file sharing sites and webmail, but they never block them all, and in particular corporate email needs to be allowed.
You need to prevent unauthorised devices connecting to the network, as these will not have local media disabled, so can be used to egress. Some enterprises attempt this with network access control (NAC).

I see this done in many environments, but never comprehensively. But even if this could be implemented perfectly, there is a major problem: it's too restrictive. We disabled USB because we want to stop Joe copying the top secret database onto a USB stick. Now, Joe may want to - quite legitimately - put some non-confidential marketing material on a USB stick to use at a conference. The lockdown prevents this - it doesn't have any concept of classification, so it can't distinguish between a public presentation and a top secret memo. Most enterprises have a process to request USB be re-enabled, with a business justification, but at that point Joe can steal the top secret database.

To improve on this, various vendors have created Data Loss Prevention (DLP) tools. Some of them are called Data Loss Mitigation (DLM); it's the same technology. These work in various ways, but most have an agent on the endpoint, and a central management system. When the system is installed, various key documents will be marked as confidential, and some patterns may be used (a popular one is 16 digits, indicating a credit card number). Now, when Joe tries to write a file to his USB stick, the agent checks whether the file is confidential, and then allows (or doesn't allow) the file to be written.

Commercial DLP systems are now pretty mature and try to address all the local media and network egress points. It's important to realise that they are only intended to stop your internal staff. They will not generally stop hackers (despite the claims some vendors make). Still, they are a good technology to have, and although they are not that widely used, I think most security conscious organisations should have it. I think the cost/benefit ratio is better than you get from IDS.

As people have mentioned, one egress point that nothing can protect is people. You can stop someone copying a 10gb database to a USB drive. But if the top secret data is one sentence ("it was xxxx who shot JFK") then someone can of course read that, remember it, then leak it outside your organisation. And to stop someone photographing their screen you would need physical security controls, like confiscating personal electronic devices.


Publishing proxy server IP address on github Is it safe to store proxy IP address and port in a shell config file on github? I see some people doing that and don't worry about it.

It's probably not something devastating, but it's certainly unwise. Ignoring an attacker using it for discovery (and someone will someday), the bigger issue is storing configuration files in your SCM poses a future threat.

Whatever infrastructure you have will grow and evolve. Someday someone will put something sensitive (passwords, username, keys) into those configuration files without thinking twice. As soon as they run 'git push', the horse has left the barn.


Hiding my activity from mobile service provider Ok there is mobile service provider which also happens to be providing mobile internet.

Now, I am interested to hide my activity from that provider. e.g. it can't see my browsing habbit. Basically this provider know both owner of particular phone number. and also provides internet.

my question is:

is using just proxy protection for this?
Is using this tool: https://guardianproject.info/apps/orbot/, protection for this?
or this: https://play.google.com/store/apps/details?id=info.guardianproject.orfox ?

To answer this question directly:

  is using just proxy protection for this?

Possibly, but a proxy would have to be specially configured to manipulate the traffic it receives. Even then it is still might go over the ISP "wire" where they inspect the traffic and forward it along. Keep in mind a proxy is just something between your end point and the intended endpoint. So unless the proxy just sends the traffic over another wire entirely (like what a web proxy does), your ISP will still get it. To what level an ISP can inspect that traffic is outside of the scope of this answer.

  Is using this tool: https://guardianproject.info/apps/orbot/, protection for this?

"Protection" is subjective. Some believe that the entire Tor network has been compromised, while others believe it to be a true anonmyzer. It really depends on what you think offers the greatest level of protection for you. Everyone in the InfoSec field will confirm you do security in layers. But I digress - Orbot:

  uses Tor to encrypt your Internet traffic and then hides it by bouncing through a series of computers around the world.

So more or less it sends your app data connections over the Tor network. Some app servers might be okay with that but some others might not.

  or this: https://play.google.com/store/apps/details?id=info.guardianproject.orfox ?

Again, it all depends on your comfort level of protection. In the application description it says:

  THIS IS A BETA RELEASE MEANT FOR PUBLIC TESTING ONLY. PLEASE DO NOT RELY ON THIS FOR STRONG ANONYMITY UNTIL ALL TESTING IS COMPLETE.

If you are really serious and want to hide your traffic, you would use a VPN with an anonymizer. But that is another discussion entirely.


Lightweight Live Pen-test OS Does anyone know of any lightweight OSs that are great for Pen-testing?  I would love to have a very lightweight live OS that I can boot off a USB and try some pen-testing against some of my Windows/Linux boxes.  It would be nice if this OS had a toolset of different common attacks.  I am sure this will be some Linux build but I am not sure whats popular out there for this.

Thanks

BackTrack USB Live is probably your best bet.

BackTrack includes many well known security tools including:

Update Kali linux has replaced backtrack now.  It's from the same people so the tools described should still be there.

Metasploit integration
RFMON Injection capable wireless drivers
Kismet
Nmap
Ophcrack
Ettercap
Wireshark (formerly known as Ethereal)
BeEF (Browser Exploitation Framework)
Hydra
Cisco OCS Mass Scanner A very reliable and fast scanner for Cisco routers with telnet/enable default password.
Quypt (Terminal Emulator) (which is private software by Crimson Hacking group, which has leaked to the Mainstream) Blackhat
A large collection of exploits as well as more commonplace software such as browsers.


Is it possible to run Responder and/or Layer 2 ARP Poisoning over OpenVPN or an OpenVPN Ethernet Bridge? Situation: We usually perform penetration tests from Linux machines connected to the clients local network. However for this test the client wants the start point to be a windows machine and has thus provided us with remote access to one of their windows workstations(To simulate phishing).

I know there are windows alternative options, but what i'm wanting to do is find the best way to "fully" join my linux machine in our office to the network that the windows machine is on.

My current thinking is a OpenVPN connection via a reverse SSH tunnel. Will this be enough to run tools such as Responder and Layer 2 MITM attacks? I'm open to any alternative methods of joining the linux machine to the remote network.

No, it's not possible to run responder through a VPN. You must compromise a system on the network then run responder via that system. After compromising a system and gaining higher privileged access, crackmapexec would be a better option than responder.


Web Site and ISP based Malware (adware) Computers on our network have this weird issue that some web pages (mostly Turkish news sites, but not all) show a specific type of ad that looks like adware/malware. When I click to close them, they open a new web page, which some of them are legit (e.g. youtube) and some of them are not.

Background:

appear on almost all web browsers (Edge, Chrome, Firefox)
appear on freshly installed computers from known good sources
appear on computers in one office location but not another (other office is on a separate ISP and computers have installs from the same install sources)
virus scans come up clean
some employees report the same ads on their iphone for the same web pages (does not show on Android phones)
Changing DNS settings to safe Google DNS IP numbers 8.8.8.8 for IPv4 and 2001:4860:4860::8888 for IPv6 has no effect

I am guessing that this has something to do with the web pages themselves and the ISP our company uses. Normally, these web pages have normal ads that appear on the first page. Probably, because of some security issues of the ISP, the news site ad engine, directs to unwanted ads.

What is this situation called so I can do more research?
How to get rid of these ads?

What you are describing does appear to be a problem outside your immediate network: at the router (assuming all traffic from this office goes through one router) or the ISP. If the ISP uses an ad network and that network has malicious ads, this problem can occur.


How to protect files from someone who has access to the computer that contains those files? Basically, I have a Raspberry Pi that is installed in a car. If the car gets stolen, how can I make sure that the files can't be decrypted?

The Raspberry Pi contains a Python script that records movements in the car. When a sequence is finished, it is then encrypted, so the script has to have access to the encryption key.

The Python script also needs to decrypt the file, because it has to be able to send the sequence to a client via a network in HTTPS. It has to have access to the decryption key.

If the key(s) are hard coded in the script, it will be easy for the stealer to decrypt the files.

Could I use a user password generated key (I have seen some people talking about PBKDF2)? If so, how would it work if the client sends that password via HTTPS to the server (the server being the Raspberry Pi)? The generated key would still need to be stored somewhere, so I don't see how it could help.

If your Raspberry Pi doesn't need to decrypt the data use asymmetric encryption (public/private key) instead. Then the public (encrypting) key can be used on the Raspberry Pi and only when it arrives at your client (via HTTPS) can it be decrypted with the private key.

I haven't used Python in this manner but the following URL seems like a good start:

Laurent Luce's Blog - Python and cryptography with pycrypto

EDIT: Since your Raspberry Pi needs both encrypt and decrypt capabilities, the most secure method is to still incorporate asymmetric encryption. Just like your current method of using symmetric encryption (shared key), one has to be careful with where to store the keys. By incorporating smart cards, the private (decrypting) key would be stored on the card itself. Just like having a key to start your car, a smart card could be required to use your Raspberry Pi. While this would increase your costs (purchase of smart card, card reader, etc), it is the most secure option.

If this solution is not viable, then full disk encryption is your best bet as mentioned by pjc50.


Can I trust Google Scripts on sites like Labnol? For example, consider this script.
It requires me to grant permission to my Gmail account, but I'm confused why this is necessary -- is it not myself who is running the script? Or is my data going through someone else's servers than Google?
Can I trust the scripts I find on sites like that?

Edit: I only mean "trust" from a privacy perspective, not an integrity perspective. In other words, I'm not worried about a malicious script deleting my data, but I am worried about it sending my data to someone else's servers.

I am the author of Gmail script that you referenced in the question. The script is now available as a Google-approved add-on on the Chrome Store.

It requires access to the entire Gmail because, unfortunately, that's how permissions works inside Google Scripts. You either have full access or no access.

In the Gmail Scheduler script, it needs permissions to read your Gmail drafts for scheduling as well for sending email through your Gmail account. When a script sends email from your account, a copy of the email is always stored in the Gmail Sent items so it is a good place to check if the script is sending emails to any other address.


Are official browser add-ons really safe? Almost any browser addon/extension that I install on my Chrome or Firefox (be it Firebug, RESTClient, ...) warns me, saying:

  It [the add-on] can:

  Access your data on all website
  Access your tabs and browsing activity

Now, practically speaking, I have no time (or the skill) to read through their source-code and verify absence of malware (such as one placed in by its original author).

Given this, can I safely assume these add-ons won't violate my privacy because they are coming from standard/well-known and thus implicitly trusted places, such as the Chrome Web Store, the Firefox add-on site, Opera's add-on site, Safari's extension gallery, or the EFF site.

Even an add-on like HTTPS Everywhere, which you install to maintain privacy and prevent MiTM attacks, warns similarly.

Is there any way to quickly tell what add-on to install and what not to, without having to read their source code?

You cannot assume that an add-on is safe "because it's hosted in one of the official extension galleries".
In this answer, I start with the explanation of how extensions end up in the extension galleries for the popular browsers. At the end, I dedicate an extra section to Chrome.
How does an item get listed in the official stores?

Anyone with Google Wallet can pay 5$ to upload up to 20 extensions/apps to the Chrome Web Store. Extensions with binary components (NPAPI) are always reviewed manually. Other extensions are only checked by Google's secret scanner, which may put an extension on hold ("Pending review") if needed. This scanner is not perfect: Two months ago, I found many malicious extensions that violate the Developer Program policies. (I've filed some Report abuse forms; some apps were taken down, others weren't even though they contained the same kind of adware).
All Firefox add-ons on AMO are put in a review queue upon submission. All editors who review add-ons have to follow the guidelines as stated in Performing a review. Extension developers are supposed to follow these instructions.
Safari extensions can be submitted to the Apple Extension gallery. Developers have to adhere to the requirements of this document pdf. After passing the review, the extension will be listed in the gallery. Apple does not host the extension files themselves. After passing review, the extension will receive a prominent location in the relatively quiet extension gallery. Upon click, the extension from an external location is immediately installed without confirmation. As of Safari 9, extensions can choose to host the extension data in the extension gallery if they wish.
All extensions in Opera's extension gallery are manually reviewed. Extensions will only be listed if they pass review (acceptance criteria).
Extensions and add-ons on IEGallery.com are manually reviewed. The review criteria are very vague though. Further, IE extensions are compiled code, so the reviewers can't even know for sure that the add-on is safe.

Auto-updating
All of these four galleries support automatic updates of extensions. Unless stated otherwise, the updates will automatically be installed (unless turned off by the user).

Updates to Chrome extensions are automatically checked, sometimes followed by a manual review. When an extension requests more permissions, they're automatically disabled until a user confirms the new requirements. The developer documentation provides list of permission warnings and their meanings. Google has also created a page (with fewer details) to explain the warnings to users - see Permissions requested by apps and extensions.

Updates to Firefox add-ons are manually reviewed.

Updates to Opera extensions are manually reviewed. Opera abandoned their old extension ecosystem and switched to a Chromium-like extension API in Opera 15. Before Opera 15 (Opera 12.xx and earlier), updates were automatically installed. Starting from Opera 15, extensions are disabled when a new permission is added, just like Chromium (see this comment on Github).

Safari extensions hosted in the extension gallery itself are probably  checked by Apple1, (updates to) Safari extensions hosted elsewhere are not. As of Safari 9, extensions can only be auto-updated if they are hosted in Apple's extension gallery.

Internet Explorer extensions are not automatically updated, unless the developer has built this feature.

External code
Reviews are useless if vendors allow the use of external JavaScript code. So, which galleries allows the use of external code?

Chrome extensions may contain external code.
Firefox and Opera forbids the use of external JavaScript code in add-ons.
Safari extensions are hosted on servers not controlled by Apple, so the developer is free to include whatever they want.
Internet Explorer extensions are generally closed-source compiled binaries, so developers can run whatever code they want.

Privacy
Many extensions collect usage statistics without the user's consent. Chrome even offers a tutorial on setting up tracking in extensions...
Chrome
Firefox and Opera are doing quite well with the security of their extension platform. I don't put as much trust in the Chrome web store, because it does not manually review all extensions.
The only way to be sure that an extension is safe is to review it yourself.
For this purpose, I've created the "Chrome extension source viewer" Chrome extension. This extension allows one to view the source code of an extension in the Chrome Web Store. It ships with a code beautifier to make it more readable.
The first place to look at it a file called manifest.json, because it defines the capabilities of an extension. Do you see anything suspicious? For instance, does an extension which promises to add smileys to Facebook define a content script for *://*/* (=match pattern for every page)? Don't install the extension.
Look at the list of files. Do you see a file called analytics.js? Know that you're going be tracked. This is not necessarily wrong, but it's good to know. Look in the files for _gaq.push, which is the standard way to use Google Analytics.
Final note: Do not blindly trust an extension because it has a high number of users. Look through recent reviews and look for any red flags. Ignore the usual trolling comments and "1 star - does not work!" (unless there are heaps of them), and focus on comments that raise concerns about privacy or security.

1.  Apple likely performs these checks, but it is unconfirmed.


Properly implemented strong crypto systems I have read this article about the revelation that in 2010 major encryption mechanisms including big four (hotmail, facebook, google, yahoo) and other encryption mechanisms were broken by NSA and GCHQ.

  The agencies have not yet cracked all encryption technologies,
  however, the documents suggest. Snowden appeared to confirm this
  during a live Q&A with Guardian readers in June. "Encryption works.
  Properly implemented strong crypto systems are one of the few things
  that you can rely on," he said before warning that NSA can frequently
  find ways around it as a result of weak security on the computers at
  either end of the communication.

and

  For at least three years, one document says, GCHQ, almost certainly in
  close collaboration with the N.S.A., has been looking for ways into
  protected traffic of the most popular Internet companies: Google,
  Yahoo, Facebook and Microsoft’s Hotmail. By 2012, GCHQ had developed
  “new access opportunities” into Google’s systems, according to the
  document.

source:

http://www.nytimes.com/2013/09/06/us/nsa-foils-much-internet-encryption.html?hp&_r=0

http://www.theguardian.com/world/2013/sep/05/nsa-gchq-encryption-codes-security

My question is, what does Edward Snowden mean by Properly implemented strong crypto systems.

Could some IT security professional explain that to me a little more? What crypto systems does he think about?

By "properly implemented strong crypto systems" he means "cryptographic systems in which the design or the implementation was neither unwillingly weakened through designer/implementer incompetence, nor willingly weakened through deliberate alterations".

NSA/GCHQ did not break encryption mechanisms; they bribed (or otherwise forced) the designers, implementers and providers of some cryptographic systems into adding backdoors for them to use. Backdoors can be deliberately weak design elements, data leakage... my favourite is poor PRNG, because such alterations can be disguised as incompetence (e.g. the rumours on OpenBSD a few years ago).

A properly implemented strong crypto system is a system:

which is strong, i.e. whose design has been done according to the state-of-the-art and can be argued to "look solid" (subject to the usual caveat that "you cannot test for security");
whose implementation was not botched in some way.

For the first point, this mostly means: complies with standards which have been published for quite some years, and for which cryptographers have not found anything bad to say (or anything that could not be fixed), but still got interested in it. E.g. SSL/TLS or OpenPGP. For the second point, this mostly means open-source, with reasons to believe that "many eyes" have gone through the code; e.g. OpenSSL or GnuPG.


What conditions would make you feel comfortable inputting your SSN? I am doing some analogous research on data collection and was curious if a company followed up with you asking for your SSN what would be the safest / most convenient way to send it to them.

Some thoughts I had were

Email with secure link to a form on the company's webpage
Direct number for someone who will pick up immediately, no automated system or waiting
A form to select the best time to call you back
Somewhere on the companies phone app

For the sake of argument lets just say it is required by the government to submit it.

A previously established trusted channel

In order for a channel to be considered safe, the priority is the user's feeling of trust, it's not sufficient for it to simply be safe. It also needs to be convenient, unless the user is absolutely desperate and locked in.

This pretty much means that you need to reuse a channel that the user already knows and trusts without creating or explaining something new.

The following avenues come to mind:

If all the users have existing accounts in your web system, then submitting SSN in it is just as OK as any other way - they need to trust you anyways, but a proper https website will feel adequate. It may be a bonus if the submitted SSN is not visibly stored, if their user profile only shows a checkbox "Yes, you've submitted your SSN, we've stowed it away someplace secure".
If the users have your mobile application, then they will probably feel secure inputting the data there, since there are no reasonable indicators for them to feel that your approach is less secure than e.g. their email on that device. It's your job to ensure that the submission actually is secure, but it doesn't influence the user impressions directly.

The suggested ways to submit over the phone seem less appropriate to me. Telling your data to an operator (likely minimum wage, possibly offshore) over the phone by itself feels a security risk; it could be argued that however your SSN gets there, those employees shouldn't have access to see it. However, there will be a segment of users, e.g. elderly people, who will prefer this channel anyway to anything digital.

Email with a secure link seems to be the worst option. While your email with that link may be secure, there is no easy way to distinguish that from a phishing operation, so such emails will be (and should be!) mistrusted by definition. The proper way would be an email that informs them to log in to your site in the usual way, and have a personal notification on your site take them to appropriate form when/if they log in.


Is it safe to remove these groups from the Local Security Policy area? I'm trying to edit a particular section inside the Local Security Policy snap in and I'm wondering if I really need to give all of these groups (I think they're groups) permissions.  Based on this information I may remove the same groups from other parts of the snap in but these look strange particularly the number ones and possibly Classic .NET AppPool.  I do development in Visual Studios but I don't do development in ASP.NET or at least haven't in a number of years.  I'm wondering if it's safe to remove them without causing future headaches.  It may be that the only way to know for sure is to remove them and then do things that I normally do to see if they work properly but maybe someone else has already been through this experience.  Here's a screenshot of the particular section I'm looking at but the same user groups will be in other places to remove.

What you are looking at is called an SID (Security Identifier). It is a unique and immutable value used to identify a security principal (includes machines, domain computer accounts, users) and security group in Windows OSs.

Below is the structure of an SID:

Common SID’s

MS Developer Page lists these SIDs as non unique.
From your example, it looks like it's listed under the NT autority, 21 signifies that the remaining subauthorities identify a domain and the RID signifies that it was not created by default (has an RID > 1000)(@ Iszi) & src)

Use the powershell function to match the number to the {name} of the domain member:

  get-sid “{name}$"
  (src)

To aid you in your search you could use you could also use the PsGetSid tool from the Windows SysInternals Suite.

Classic .NET AppPool is a synthesized account related to a mode of the Internet Information Server(IIS) 7.0 system. When an application pool is in Classic mode, IIS 7 and above handles requests in the same way as in IIS 6.0 worker process isolation mode. ASP.NET requests first go through native processing steps in IIS and are then routed to Aspnet_isapi.dll for processing of managed code in the managed runtime. Finally, the request is routed back through IIS to send the response.(z) If you delete this it will be gone. I would suggest running TaskManager to see if any application are running under this pool before doing that. Also, ensure that you are not using an older web application built on IIS 6.x and older.


How can I audit which type of Block Mode encryption is being used when no source code is available? Given that there are clear advantages to using some block modes of encryption over another, and I would like to ensure that all software used in the enterprise uses a certain "level" of security I'd like to issue a statement of assurance to my stakeholders that the most appropriate technology is being used.  e.g.

Ban the following modes

ECB, CBC, OFB

In favor of the following modes:

CTR, EAX, GCM

The only way I know of auditing this type of policy (outside of the FIPS mode in GPO) is to observe and test the output of these ciphers is as intended.

Question

What approaches could be taken to audit the ciphers being used when the sourcecode is unavailable?
What prerequisites needed for each approach?  (e.g. CPA ability, Private Key, IV, key length, block length,  etc)

Although I'd like to keep this as simple as possible for auditing purposes, I'm also curious about the permutations of what information is needed (private key, IV, etc) so I can understand how easily an attacker can identify "weak" implementations that exist without that private information.

(note: I am willing to write the necessary statistical or encryption/decryption routines)

Testing for ECB / CBC / OFB / CTR mode is fairly straightforward.  It's also straightforward to see if the mode has authenticated encryption like EAX / GCM (though it isn't straightforward to see which mode of AE).

ECB: have a file with many similar blocks in the plaintext.  Do you see identical blocks in the ciphertext?  (Yes this is similar to Dan's answer, last part of Adnan's answer, but included for completeness).
CBC: Encrypt a file, and then flip a bit in the IV (typically in the first block of the ciphertext); say you flipped the fifth bit of the first block.  Do you see an identical flipped bit in the first block of the plaintext after decrypting?  Similarly, flip a random bit later in the file say the 8th bit in the 10th block of the ciphertext.  When you decrypt do you see the 10th block as gibberish, and then the 8th bit of the 11th block flipped?  Again, consult the modes of operation diagram for CBC decryption and the reason should be clear.
OFB/CTR: Test if you have a stream cipher.  Without touching the IV / Random Nonce (typically the first block), if you alter a bit later in the ciphertext, do you see same bit flipped in the decrypted plaintext?  If so you have a stream cipher; an important difference from CBC is in this case there's no gibberish block.  I agree with CodesInChaos's comment that there's little security difference between OFB/CTR.  If you have the encryption key1 call it K, you could differentiate between OFB / CTR.  E.g., let c[1], c[2] be the first and second block of ciphertext and p[1], p[2] be the first block of plaintext.  Calculate D(K, c[1] XOR p[1]) and D(K, c[2] XOR p[2]), where D(K, c) is the decryption of block c with key K.  If they are consecutive numbers, you have CTR mode.  If D(K, c[2] XOR p[2]) = c[1] XOR p[1] then you have OFB mode.
EAX/GCM - Both are authenticated encryption -- they contain a message authentication code (MAC) and the file will not decrypt (even to gibberish) if the file is altered as the MAC will not be valid with overwhelming probability.

Granted, a lot of this assumes things like you know the block size, but that should be easy to figure out.  E.g., encrypt a very small (1 byte) message.  Then assuming there's no MAC involved, you'll likely create a two block message (IV + one-block of padded ciphertext -- though CTR/OFB may not pad); then encrypt a longer message.  From trial and error, you should be able to find out the block size and IV size.

EDIT: I definitely agree with the excellent point Thomas Pornin brought up.  This sort of reverse engineering could help uncover the block cipher, but doesn't really test security.  There are many backdoors that could have been covertly put in that you can't detect without painfully reverse engineering, by stepping through the assembly.  For example, you could believe you have an Authenticated Encryption block cipher that can only be decrypted with your secret key constructed off your passphrase.  But really the file is encrypted with a random key, that is itself encrypted at the beginning of the file using both your passphrase, and then once with their backdoor key.  Thus, they would be able to decrypt any file you use.  Or maybe the scheme does this same scheme, e.g., at the beginning of the file store the per-file-key to be decrypted using your secret key, but there's only about a billion or so keys (that they know all of them).  Or maybe its encrypted with only your key, but the key derivation function only uses the first ~30 bits of the hash of your passphrase as your key.  Hence, it could be very quickly brute forced with a billion attempts.  Similarly, it doesn't have to be a deliberate backdoor; it could just be improper subtle implementation flaw allowing for side-channel ataacks.

1 This was not assumed for other parts -- there are a lot of ways you could know to enter a passphrase to the decryption system, but not know the key derivation function (or encryption function) used internally to generated the key.


How could online encryption ever work? I have recently read about the german enigma machine in WW2, It worked in a way that every day the machine configuration was sent per mail to the different operators.
(I couldn't find official sources on this, please do suggest an edit if i said something wrong)

Obviously these ciphers could be confiscated by the allies, but that apparently wasnt very effective compared to brute forcing it. (Turing)

Now about online encryption like https, how is it possible to encrypt anythingonline, if the decryption key would also need to be transferred somehow.

It just never made sense to me, even if there is a public+private key scenario. If someone can tap into the connection, he can see both being sent right?

I would love to get enlightened on this, this is where my amateur theories on cryptography break down.. Thanks!

Take a look at this explanation of the Diffie Helmann key exchange. The central point is that due to some clever mathematics, both parties are able to compute the secret key, while being certain that no one else could have done the same.

If you spend a couple of minutes looking into the mathematics, it should become clearer why this is possible.


How to prevent VPS owner from accessing my API key I want to run a program on a vps, which uses my api key for doing financial transactions. I don't want there to be any chance the host owning the vps or any other hacker to ever be able to see my api key. Is there a way to make this impossible.

You cannot. If you don't own the computer, you don't own the computer.

You will have to calculate the risk. Is more financially rewarding for the VPS owner to provide you with the services, or to steal your keys and your money? Is the reputation damage worth it?

Usually, the VPS owner aren't interested on your data, so if you use a reputable provider, with years of service and lots of users, you will be safe. But a no-name provider using rented servers, dead cheap price, and lack of support may not be a good place to be.


Best practice pattern for service worker background-sync with CSRF protection I have a request that uses a one time token embedded in the page to ensure CSRF protection - an attacker might be able to fool my users into making a illicit request, but they can't get the token, and even if they can it is changed with each request and can expire.

So far, so secure.

I want to implement background-sync with a service worker, so a user can post data offline, and then send that data later when they get a connection.

However, that means that the page isn't available to get the CSRF token, and any token linked with the request when the user builds it may be invalid by the time the data is actually sent.

This would seem to be a general issue with any progressive web site, what is the best practice to handle it?

I think that the background-sync could request a new token, apply it to the data to send and then send it, and that still be a loop that a CSRF attacker couldn't take advantage of, but I'm not certain of that. Can anyone confirm this either way?

At the moment the CRSF tokens ensure that the request has come from a specific page - that's going to have to change for any background process to work. Instead there will have to be some kind of CSRF token service, so we'll only be able to ensure that the user has previously and recently been able to make a request from that service. Is that still adequate protection against CSRF?

I think that the background-sync could request a new token, apply it
  to the data to send and then send it, and that still be a loop that a
  CSRF attacker couldn't take advantage of, but I'm not certain of that.
  Can anyone confirm this either way?

I'd take this approach. The Same Origin Policy will still ensure that any attacker cannot grab the CSRF token.

  At the moment the CRSF tokens ensure that the request has come from a
  specific page - that's going to have to change for any background
  process to work. Instead there will have to be some kind of CSRF token
  service, so we'll only be able to ensure that the user has previously
  and recently been able to make a request from that service. Is that
  still adequate protection against CSRF?

It is good enough to have one CSRF token per user session. There is little need to go more granular than this and to do it per page. As long as the token is associated with the session and cannot be used for other sessions, then this would mitigate CSRF.

A CSRF token service is a good idea.


Debugging SUID for privilege escalation When doing privilege escalation, assuming an application with the SUID set and a debugger, what stops us from starting a shell from within the debugger? I mean just write the shell code in an environment variable or somewhere in memory and just call the pointer from within the debugger. Or in any case, if that would not work we could just manually change a return address on the stack and possibly even detach afterwards.

I think I am missing something but I can't quite see what it is. My best guess would be that when a debugger is attached the SUID bit is cleared otherwise this is a very generic way of escalating privileges.

what stops us from starting a shell from within the debugger?

If you run a setuid program under debugger, and you're not root, it will run as if was not setuid. Meaning it will execute under your id, not root. So while you can spawn a shell, it will use your credentials.

You can easily test it yourself by launching su under gdb and verify in another console that it is executed under your user account.

And if you launch the setuid program and then try to gdb attach to it, this will return 'permission denied' error.