How to get MAC addresses of devices which are not in the network Can I get MAC addresses of devices (mobile phones) which are near to my network but not connected to it? (Linux)

I have been trying to get the MAC addresses of devices connected to my network through nmap command... but how can I get devices which are not connected to my network?

If it's not in the same network, you most likely won't be able to.

MAC addresses are hardware addresses and are usually hidden behind a router unless you are on the same network or have direct access to the device. In other words, once you leave the network, unless the device(s) in question is/are directly connected to a router you will get the MAC address of the switch rather than the individual devices when querying that network.

Depending on the security of your network, you may not even be able to get the MAC addresses of devices on the same switch since they may be on different VLANs.

With that said, in your comment you asked if you could get any other information on the device(s). Without access to the network that the device is on it's pretty difficult to get any information on anything other than that of the router. Without getting too technical, unless the device has its own static IP address that you know, which is unlikely for a mobile device, if you query the network from the outside you'll get the public IP of the router, not the devices. Specifically for mobile phones, you can probably get information via Bluetooth if it's enabled on the device, but you have to be in close proximity. According to one commenter it may also be possible to sniff the device's traffic given close enough proximity. There are probably ways to gather more info, but it's probably more trouble than it's worth.

The easiest way to get information on a device on a different network is to simply join that network.

Edit: As you say in another comment, you have a WiFi adapter that someone can connect to. If the device doesn't connect to that adapter, then you can't gather any information about the device. But if the device does connect to your WiFi adapter, if it's assigning IP addresses, you will be able to see both the MAC address and the IP address you assigned, and with the MAC address you can infer roughly what kind of device it is based off the manufacturer's portion of the MAC address. If you're letting the device access the Internet, you will also be able to see all of the packets it sends through your adapter. You may be able to get some additional information specifically about the device, but it depends on the device, your WiFi adapter, the software you're using... and so on, which means there are many variables.


How do I migrate users with shared email addresses to an email-based forgotten password process? I'm migrating users from custom application-level authentication security (built into the app, using username as the unique identifier) to security as a service (using ThinkTecture's Identity Server and MembershipReboot).

A substantial number of existing users have non-unique or null email addresses. These will all be seeded from the existing app to MembershipReboot's database.

The forgotten password process (using a username field to generate and send an OTP via SMS) is being replaced with MembershipReboot's forgotten credential process using email addresses to generate a URL for users to reset their password.

For those users with a shared email address should I include a separate step to capture the username after capturing the users email address to generate a URL for the correct user? Or is there a reasonable alternative that doesn't require any proactive user change?

For shared email addresses, I would generate a reset link only after the user has entered a valid username and email. The reset procedure would also require a new, unique email address that must be separately verified.

Presumably the users that share an email address already have some level of trust between them. If not then you would need to find an alternate piece of information that identifies each user.


Windows Defender Network Protection component really aggressive, what to do? Has anyone noticed that the Windows Defender Network Protection component (part of Exploit Guard) can be REALLY aggressive? Sometimes, in order to use a program, app or else, I need to set it to "Disabled" (even if it's only in "Audit" mode, it can slow down the connection by A LOT, if it doesn't timeout before).

Is there any way to add exceptions to that component? Like, do not filter websites if they are part of the Intranet, or add custom URLs, IPs, domains, etc. to ignore? I researched it for a bit, and it looks like you have 2 options: Block or Disable (because putting it in "Audit" mode has the same effect as "Block" since the connections will still go through it, it's just that they won't be explicitely blocked if they are malicious).

Thank you.

Forgot about this question.

For anyone reading it, apparently, the whitelist/blacklist functionnality is only available in MDATP (Microsoft Defender Advanced Threat Protection), which requires a Windows 10 E5 licence (at least) to access. This comes from a Microsoft Support Engineer I worked with and to who I asked about this.

So as of today, the only options for Network Protection is Windows Defender via SCCM, PowerShell, GPO and Intune is: Block (Enabled), Audit (Enabled) and Disable (Disabled).


Can software projects which accept government funding be trusted? You may know or probably are using TOR client which provides anonymity to the users but how can one be sure they are secure when browsing using this client and its network since its funded by feds?

I have read this article by the Washington Post about TOR and it mentions that the Tor Executive Director Andrew Lewman's Email to Tor Users about the collaboration between both FBI and Tor Project. but how would one trust such a statement ?

" Just because the project accepts federal funding does not mean it collaborated with the NSA to unmask people's online identities".

What has even shocked me more is that FBI has helped the local police in Turkey to find the identity of a man that's pedophile and that helped detaining him which is good! but FBI funding Tor's project and In the mean time spying on peoples activity online?

what do you think?

http://www.hurriyetdailynews.com/expat-teacher-detained-in-istanbul-on-child-porn-accusations.aspx?pageID=517&nID=55251&NewsCatID=341

http://www.washingtonpost.com/blogs/the-switch/wp/2013/09/06/the-feds-pays-for-60-percent-of-tors-development-can-users-trust-it/

There are several points to consider:

There is no indication that the guy in Turkey was using TOR or even how the FBI contributed.  So, this news story is not related to your question.
US government IS actively putting backdoors in all kinds of things: For example, recent revelations that RSA accepted money from the federal government to use a weak default encryption algorithm should make us suspect everything is compromised and not just projects that are federally funded.
You said "FBI is funding TOR".  FBI does not fund TOR.  I think you are using "FBI" as a catch-all for federal government and maybe you don't care about the distinction.  80% of TOR funding is from US government, mostly Department of Defense.   It is in the model of a research grant and was originally funded by DARPA and the Naval Research Laboratory.
TOR is open source and so it can be verified whether it was deliberately or otherwise made insecure.
The speculation is that instead of compromising the program itself, the government has simply created enough TOR exit nodes to be able to correlate TOR traffic with the users they are interested in.  If you use TOR and expect it to protect you, understand the limitations just like any other tool.
Edward Snowden trusted it enough to use it to communicate with Glenn Greenwald.
See two big stories about people getting busted even though they used TOR.  In one, Eric Eoin Marques was arrested for child porn due to an insecurity in Firefox and not TOR itself.  In the other, Silk Road, Ross William Ulbricht was protecting himself with TOR, but I understand it was a non-anonymized forum posting about how to use TOR that led the FBI to him.


Is SSH secure against MiTM if server fingerprint is not checked, public key authentication is used and confidentiality is not needed for that service? When connecting to a server for the first time, ssh usually requires users to check server's fingerprint and then caches the info. This is needed in order to prevent MiTM.

Is it a design flaw in SSH that a user is required to check fingerprint manually? I mean the following use-case.

There is a server. There is a client. The server provide some personalized services to authenticated users. So it is the server's responsibility to check user's credentials properly.

Server knows its fingerprint. Let's assume that the client (not ssh one, but an app built upon ssh, like a GUI client for git) is unwiling to check the fingerprint because in order to do it it should get the true fingerprint somehow, which means GUI for that has to be implemented.

The authentication protocol is that the client signs the challenge provided by the server, the server verifies it and then allows access. It feels like a design flaw: a malicious server can impersonate a user to a legitimate server by doing MiTM and proxying user's responses to the original server.

The way to fix that would be to sign not only challenge, but also server's fingerprint. (See the accepted answer for the right picture) Then the server can detect MiTM server-side. Though it doesn't protect from a malicious server being impersonated to a user.

In short:  it is not a design flaw. You've just had a misunderstanding of the design.

  The authentication protocol is that the client signs the challenge provided by the server, the server verifies it and then allows access.

The client does not sign a challenge provided by the server. Instead the client signs a structure defined in RFC 4252 section 7 which includes as a major component the session identifier.  This session identifier itself is a result of the key exchange as described in RFC 4253 section 7.2.

  ... a malicious server can impersonate a user to a legitimate server by doing MiTM and proxying user's responses to the original server.

Since the MITM does not have access to the clients private key it cannot create a new signature with this key. Thus it needs to find a way to make the server accept the original signature by the client. And since the signature depends on the session identifier the MITM would need to establish a SSH connection between client and MITM and another  between MITM and server which both have the same session identifier.

But in the Diffie Hellman key exchange the result of the key exchange depends both on client data unknown to the server and server data unknown to the client.  Since the MITM has only control over one side of each connection it cannot control the result of the key exchange and thus cannot control the session identifier.

Therefore the attack you describe will not work. The MITM cannot simply impersonate the client as long as the server properly authenticates the client. Either the authentication will fail because the signature is broken (does not match the session identifier) or it will fail because the public key is not the one expected by the server (in case MITM made up its own client key).


How do I prevent traffic on my site from a source other than Cloudflare? I use Google Cloud Platform to serve the site I manage.

I have one load balancer there, which controls the movement to several virtual machines.

When I came across the problem of DDOS attacks on this site, I started using Google Armor to block the intruders' IP addresses, but over time, when the problem escalated, my team decided to use the Cloudflare service and now all domain traffic from the Internet to service is lead by Cloudflare as a middleman.

However, further DDOS incidents show that the attack is carried out in two ways: using the domain (or domain IP referring to Cloudflare), but also directly on the load balancer's IP from Google Claud.

The attackers could have known this load balancer's IP, before joining Cloudflare, because that IP has not changed.

I would like all traffic to be directed by Cloudflare and, if possible, that nobody from the outside knows the load balancer's  IP or virtual servers located in the Google Cloud.

I have two questions:

If I change the load balancer's IP address now, can someone from the outside (attacker) get to this IP in some way?
I could use Google Armor (or another firewall) to allow Google Claud to accept traffic only from Cloudflare, but is there such a permanent (immutable) list of IP addresses that are only used by Cloudflare to communicate with my site (or all sites) to which I could restrict traffic?

Maybe someone else has some other ideas as to the situation and he would like to share them. I am happy to hear them.

Once you change the public IP address of your site, configure the DNS to point to Cloudflare and forward your request from there, the attacker will always go through the Cloudflare and won't hit your server directly.

Cloudflare publishes its public IP list that you can restrict on your perimeter. The list is available at https://www.cloudflare.com/ips/


Encrypt a textfile with gnupg on the console It is easy to decrypt an encrypted textfile with:

 gpg --decrypt /tmp/message

But how can I encrypt my own textfile?

Encrypting is as easy as decrypting:

gpg --encrypt /tmp/message

GnuPG will now ask you for the key(s) to encrypt to. The encrypted message will be stored to the same path with .gpg extension. The output file can be set using --output /path/to/encrypted/file.

You can also include the recipient as parameter, useful for scripting gpg, add --recipient foo@example.org.

For more options, read man gpg and the GnuPG manual.


Facebook changed the default email address for every contact.  How do I mitigate the impact and risk? Facebook created a problem for regulated industries and Registered Investment Advisers (RIAs) by changing the default outgoing SMTP address for every contact to a @Facebook.com address.

This is an issue because RIAs are subject to external compliance auditing, usually though a 3rd party journaling target such as SMARSH or Proofpoint Archive.

For example, suppose an email addresses changes to @facebook.com, then that means all email protections that were in place by the company (such as encryption, AV, etc.) also bypasses the required any other journaling infrastructure that is required by law.

Questions

What are the exact circumstances that cause the default email address to change?
If the email address has changed, how does that affect liability?
If the email address changed on the mobile device, does it also change Outlook's default address (Exchange Server/OWA presumably as well)?
Does the scope of the SEC search or legal search now expand to a Facebook address as a result?  (affecting privacy)
How does one mitigate the risk, and/or undo the changes?

What are the exact circumstances that cause the default email address to change?

Facebook wants control.

If the email address has changed, how does that affect liability?

Just change it back?

How does one mitigate the risk, and/or undo the changes?

You change it, like you have always been able to do, Facebook even has a support article on the subject.


Why does localbattle.net point to localhost? I found a random link on a forum linking to localbattle.net, at the same time I was running a local server on localhost. When I went to localbattle.net, my local server page appeared! The certificate was invalid, and the "Your connection is not private" warning screen appeared. Can that site see the content of my local server (page)? And is it a my client's issue, their server's issue, or my local server's issue?

This domain is used by Blizzard (battle.net) for some communication between their web pages and a server running in localhost.

Thus, when the web page wanted to communicate with the local install, it would direct a request to https://localbattle.net:22886/ were the game would be running a webserver. As they owned the domain, they would have issued a publicly valid certificate for that domain, which could then be embedded in the game, while they couldn't have obtained a certificate for 127.0.0.1 or localhost.

Do note however that this was still the wrong thing to do. Since the private key needed to be shared within the game, the private key isn't really private, and such certificate MUST be revoked by the CA within 24 hours of knowing about it (section 4.9.1.1 of the Baseline Requirements).

The public certificate running locally was originally reported by Tavis Ormandy and -after Hanno Böck reported it to mozilla and the CA- the certificate got revoked, after which Blizzard issued an update that installed a local (non-CA) certificate into the root trust store. Then they briefly used a new certificate, issued by digicert which also got revoked, and added to the OneCRL.

The whole story is explained quite well on this mozilla.dev.security.policy thread. If you want to dig up more, you can also read this Reddit thread, and the Blizzard post explaining their change to use a self-signed certificate.


Sending Secret data over HTTPs from embedded system Giving the following scenario:

A is an Embedded System with an encrypted firmware (No one can read its code or even the bin file in any way).

B is an RESTFUL server (AWS cloud based)

A sends an HTTPs request to B which includes a header as follow:

GET https://endpoint/file,  Headers{"SecretKey":"123456"}

B will reply with a file.

Assumptions:

The embedded system A is 100% secured and no one can see its code or its bin file.
The server and the back-end code are 100% secured and non hackable.

P.S. Nothing is 100% secure. However, I put those assumptions so you do not have to worry about them. I need to know the possibilities other than hacking the embedded system or the server which I already know about them.

Questions:

Is it possible to any one who has full access to the client's network (e.g. Owner) to get the raw (unencrypted) SecretKey header sent by A?
Is it possible to any one who has full access to the client's network (e.g. Owner) to get the raw (unencrypted) file returned from B?
If the answer to the previous questions is yes, what is the chance? What can I do to prevent this as much as possible?

The traffic between A and B is transmitted over HTTPS and is thus encrypted and authenticated. If properly implemented, it is not possible for an attacker to see this traffic, even with access to the network.

For this to be secure the client device has to do proper verification of the server certificate. Is the certificate properly signed and does it belong to the correct domain?

A typical way to intercept HTTPS traffic is to configure another root certificate to be trusted on the device. You should not allow the user to configure the device this way.


How do I know if root account has been compromised? My server was hacked with some files being overwritten to generate spam links on the index page. All my previous backups contain the same modified files, making the nuking from orbit option a puke. If the server root has not been compromised, I intend to just clear the infection and monitor further. What are the signs to look out for to determine if my root has been compromised?

Your computer has been rooted if an unauthorized user (how defined? becomes difficult on systems with many accounts) has gained access to it. If JoeUser is an account with little access to anything of importance (how defined? by whom? how is importance level tracked?) nothing much might be lost, but any unauthorized (ie, hostile) access has the potential for further breaches, given the way ordinary humans behave -- see the movie War Games for an entertaining and not too fantastic account with drama, or the Cuckoo's Egg by Cliff Stoll for a much more realistic, though still dramatic account from reality. Things have not improved much since Stoll's little adventure (and the browser / web / server / live database Internet has made things vastly more dangerous), and official (govt., corp., org., ...) resources are still pretty clueless.

On the other hand, if JoeUser is the local superuser account, any breach is more or less disastrous, as everything on the machine(s) is in principle completely lost. All data, all configuration information, and probably all connectivity information (topology, all passwords (if users have been foolish), ...). An attacker will likely want to continue to have access to the machine(s) and so will try to so configure the system as to perform normally, save that when the attacker wants access for further depredations, it is still available to him.

The techniques used for such things are as varied as people's imagination and low cunning.  They are usually called rootkits. Since very few people are really good at this sort of thing, and since many attackers are scriptkiddie level folks, techniques are often reused. There are several rootkit scan programs (some good, some not so good, ...) which can find the traces left by some (perhaps many) of these schemes. But if the rootkit scanner you choose is not aware of whichever rootkitting technique was used on your machine, you won't hear about it. Or, even worse, what about the situation in which the rootkitting attack on your machine isn't traceable by a looking for traces on your disk or machine memory, or is really new and none of the rootkit scanning programs have any provision for finding evidence of it?

In actual reality, you won't generally have the time, nor sufficient expertise on your particular machine (OS), to find rootkit traces that no scanner can find. Thus as a practical matter, the reformat / reinstall from trusted media / reconfigure / acceptance test / pray option is likely the only one with any real credibility.

In your case, you may not have been rootkitted. Depending on the configuration of your server software, root access may not have been required to do the spam distribution you report. IF that is so, you may be able to merely reformat the server's partition (if hat's how you had it setup) / reinstall / .... Inappropriate configuration of the server and its resources (files, access to executables, and other accounts' files (eg, read only for SSL operations, special configuration files, exec PATH setup in the environment, ...) may have been the entry point.

Make sure your server is correctly locked down to prevent such access, not an easy task. Requires considerable time and expertise in following the boards, books, conferences, ... to be sure you're up with the current best practice -- which, of course, may have hidden vulnerabilities no one currently is aware of.

There are no easy answers.  is not available and will not be until Internet standards are rather less porous than they are currently.


Is this reflected or DOM-based XSS? Scenario:

Server-side script takes URL parameter parameter1 and writes it without encoding into cookie cookie1. Then regular HTML page containing client-side script is returned.

Client-side script, when user triggers an action, takes a value stored in cookie cookie1 and inserts it without any processing as HTML content of a paragraph.

How to classify this XSS? On one hand, payload reaches the server and server-side code can encode user supplied data before putting it into a cookie. On the other hand, insecure DOM manipulation is another reason of XSS occuring. Could you please clarify the distinction between reflected and DOM-based XSS on this particular example?

DOM based if you're basing it on the stored/reflected/DOM classification system.

From OWASP Types of Cross-Site Scripting:

  DOM Based XSS is a form of XSS where the entire tainted data flow from
  source to sink takes place in the browser, i.e., the source of the
  data is in the DOM, the sink is also in the DOM, and the data flow
  never leaves the browser.

Here the source of the data is document.cookie and the sink is also in the DOM (HTML content of a paragraph).

However, classifying XSS in such a way really only boils down to semantics, as the article notes:

  For years, most people thought of these (Stored, Reflected, DOM) as
  three different types of XSS, but in reality, they overlap. You can
  have both Stored and Reflected DOM Based XSS.

Using the above I guess you could classify it as "Reflected DOM Based".

OWASP have attempted to try and get people to reclassify XSS as either server based or client based, where DOM XSS is a subset of Client XSS. Using this system it would be a "Reflected Client XSS" vulnerability.

Regardless of actual classification, the vulnerability here is in the DOM rather than the cookie storage as there is no need to HTML encode for storage into a cookie. Encoding should be done as late as possible when the usage context is known otherwise this cookie could have been poisoned.

e.g.

Website is on example.com and it normally only listens on HTTPS.
Attacker Man-In-The-Middles an HTTP connection from their victim and sends them to example.com over plain HTTP. The HTTP server in this case is the attacker's.
Attacker sets the cookie containing some script code.
The victim later visits the real example.com over HTTPS and the XSS is triggered.

As the code that adds the text to the DOM is not correctly HTML encoding, this is a DOM based XSS attack. As you can see from the above example, not HTML encoding on storage into the cookie doesn't stop the above attack scenario.


Alternative to charging 2 small amounts for credit cards authentication? Currently the client I'm working for charge 2 small amounts on adding credit card to authenticate credit card. After that they ask end-users to check the exact amounts on their monthly statements and enter the amounts back. This way they confirm that end-users have really access to the account and the card is not stolen.

As this is complicated way and end-users don't want it, is there any user-friendlier way to protect users and the company from stolen credit cards being used to make purchases from the company?

If the card has been stolen, it should have been cancelled. Alternatively, it should be on a blacklist and flagged as such if your client is doing any fraud analysis.

The current process for authenticating a user does sounds rather laborious for clients. It should be possible to perform a null value pre-authorisation of the card. This means that for the initial authorisation, the PSP/acquirer will require the PAN, expiry date and CVV2 of the card. After the card has been authorised, future transactions can be performed against this card using the PAN and expiry date only.

The methods for the above to work are dependent on your acquirer or Payment Service Provider. It's worth discussing possibilities with them or reading their API documentation. To reduce fraud rates, you could also [where possible] push users to use Verified By Visa/MasterCard during the authorisation process.


It's secure to store private keys in AWS Secret Manager? I'm implementing a service that makes signs and sends transactions at the end of the day, this acts as a crypto exchange. The service creates for every new user a key pair (Private key with its public key). The user can deposit his funds to his respective public key (this is a hot wallet and he has no access to the private key of it) and the service must send these funds to a cold wallet at the end of the day. I'm looking for a solution to store these private keys safely using AWS infrastructure.
Reading the description of AWS Secret Manager, it says that it can store API keys, DB Credentials, or tokens OAuth, but it doesn't mention crypto private keys.
I found other solutions using Hashicorp, but I prefer a solution using any AWS solutions.
So, the questions are:

It's safe to store Private keys in AWS KMS or Secret Manager?
If not, is there a solution using AWS?

The whole point of AWS Secret Manager and KMS is to store secrets and keys, so I don't see why this would not be safe. However, the actual security of your implementation is likely to be dependent on how you use those services, and whether or not your code integrates those services safely.
Since your platform handles financial transactions, and I presume that your cryptocurrency wallet is not insured, your financial safety is determined solely by the security of your implementation. I would strongly recommend paying a security professional - preferably one experienced with these AWS services - to review your design and implementation. Recent history is littered with examples of exchanges being compromised and funds being stolen, due to security deficiencies in the exchange. The investment is almost certainly worth it.


OpenPGP encrypting backup files and sending them to Usenet servers My Internet service provider includes Usenet servers with about about 45 days of retention. I'm planning to backup my most important files on there.

I have a 50Mb/s symmetrical fiber connection to the internet, however all the Internet service provider's own services have a different limit of 500Mb/s symmetrical. This includes the Usenet servers (upload test showed an average speed of 39MB/s, limited by hard drive speed).

I want to backup my pictures and some important documents, however simply uploading them there would make them available for the world to see. So first I tar them.

tar -cf $_file -P /user/pictures /user/importantFiles /user/log/

Then I generated a 4096 bit RSA keypair. I imported the public key into GnuPG on my file server.

Now I'm planning on encrypting it with GnuPG and AES 256 bit.

gpg --output $_file.enc --symmetric --cipher-algo AES256 test.out -r [8NumberIDHere]

then I delete the original file.

rm -f $_file

After which I start the upload to my Internet service provider's Usenet server.

I'm planning on doing this once a week while keep I keep using the same public key. The total file size we're talking about after taring is about 15GB.

Yes, I asked my Internet service provider, and they told me they have no problem with me using it as a ~45 days backup location.

Am I doing everything correctly? How secure will the uploaded files be? Am I overlooking something?

In principle, encrypting with AES 256 bit should be fine, as long as you don't mess up (and upload unencrypted information by accident), the math stays secure (new findings could harm the used algorithm's security in future) and finally the data really does not deleted exactly at the time you require to restore from your backup.

Using --symmetric encryption will disable public/private key cryptography, as already indicated in GnuPG's warning message:

$ gpg --recipient a4ff2279 --symmetric
gpg: WARNING: recipients (-r) given without using public key encryption

If you want to do public/private key cryptography, do not use the --symmetric option, otherwise don't use the -r/--recipient flag to denote a public key to encrypt for. OpenPGP is a hybrid cryptography protocol, and will use symmetric encryption anyway -- but will use a random session key encrypted using your public key instead of a (weaker) passphrase.

Anyway: although your provider accepted you (mis)using their servers for this purpose, I'd not go for that route:

You distribute the data publicly to everybody. If your private key is weak, lost or gets public for any other reason, "the whole world" might be able to read your backup. The same applies if you upload unencrypted information by accident!
You are allowed to (mis)use the servers, but have no guarantees they don't change their mind and delete the files at any time.

15GB of data are not a lot. There are lots of services providing you with a personal cloud storage in that size, even for free. Not only are you using the storage in the way it is purposed to be used, but also there is some additional safety net in case something goes wrong, and not everybody can read your data (although you also should remember: "there is no cloud, just other people's computers" and you still have to put some trust in them (so encryption on your client computer/file server is a very good thing go do).


Can a machine running a packet sniffer see what nginx is forwarding on localhost to a Flask app? I want to serve a Flask application from my pc. Other machines in my network only should be able to consume the API. However, I wish to have the communication between the other machines and the API secured using https with a self-signed certificate. For this reason (because serving Flask with waitress does not support https on its own), I am using nginx on the same machine as a proxy so that it can handle https.
My question is:
If someone connects to my network, let's say via wifi, and runs a packet sniffer like Wireshark, will they be able to see what is being transferred between the legitimate clients of the app and the app?
When running Wireshark on the same machine as the application, I see the request and all of its contents. I believe this is because it is sniffing on localhost and sees the forwarded http request (from nginx to the app). When running Wireshark on my laptop, I don't see the http request. Can someone confirm this is safe for my purposes?
Also: Can someone confirm that if nginx were to run on a separate local machine, then the http request would be exposed again?
EDIT: Here is the nginx configuration I have
server {
    listen 443 ssl;

    ssl_certificate /etc/nginx/sites-available/nginx-selfsigned.crt;
    ssl_certificate_key /etc/nginx/sites-available/nginx-selfsigned.key;

    server_name example.com;

    location / {

        proxy_pass http://127.0.0.1:5000;
        proxy_set_header X-Real-IP $remote_addr;

    }
}

server {
  listen 80;

  server_name 192.168.1.5;

  return 301 https://$server_name$request_uri;
}

If installed on localhost with sufficient permissions, Wireshark can see all your localhost traffic (with some caveats).
That said, a 'packet sniffer' in my understanding refers to something running on a different machine which sniffs packets off the actual network. It's my (perhaps not entirely correct) understanding that packets to/from localhost from/to localhost or to/from 127.0.0.1 from/to 127.0.0.1 do not end up on the network. You may want to read a bit about the loopback interface.


Is eavesdropping possible over smpp? I don't know much about the SMPP protocol, but I often hear that it is not a secure protocol.

If Alice sends a SMS to Bob, can Eve view what Alice sent to him? If yes, can you give an example on how Eve can accomplish that?

SMPP is an application layer protocol and is not intended to offer transport functionality. It is therefore assumed that the underlying network connection will provide reliable data transfer from point to point including packet encryption.

Vulnerabilities that are found in SMPP protocol:

Zero Confidentiality: As there is no encryption standard specified in
SMPP, messages sent from A to B travel in plain text.
Man-in-the-middle Attack: The attacker can make independent connections with the victims and relay messages between them, making them believe that they are talking directly to each other when in fact the entire conversation is controlled by the attacker.
Message Tampering: There can be the deliberate altering or adulteration
of protocol information. This may lead to text messages being tampered
with before they get to the recipients.
No Endpoint Authentication: As there is no confidentiality, attackers can
easily compromise the login details of the SMSC. Attacker can
authenticate himself as an authenticate user and can misuse the
messaging services.

Therefore, if you want to secure SMPP communications you must do so using TLS and both your clients and servers must support it. By introducing
Transport Layer Security, Secure SMPP is capable of satisfying security
parameters of confidentiality, integrity and authentication.

As a one-sentence answer to your questions: if it uses TLS the SMPP communication secure, if there is no TLS, it is not and anyone with network access may intercept and read it.


IKE Phase 1 /w PSK resource? I can't seem to find a sufficiently detailed resource that describes the IKE phase 1 PSK identity authentication process.  They seem to focus on differences between aggressive and main mode while oversimplifying them.

I'm trying to understand the identity vetting of IKE phase 1 using a pre-shared key.

I read one source describing that the pre-shared key is hashed and those hashes are shared to prove that each party knows the hash (and therefore vet the identity of each party), however wouldn't capturing of those hashes present an opportunity for a replay attack?  Or for example couldn't one side wait for the hash and send it back to "prove" it knows the PSK?  Which leads to my next question, apparently main-mode encrypts the hash, so what is used to encrypt that hash, the same PSK?

I would love to read up on this more in order to attempt to answer my own questions, but again I can't seem to find anything thorough.

Thanks in advance.

All this is basically answered in RFC 2409, section 5, which describes how SKEYID and HASH_I/R are calculated plus how the different keys are derived.

  however wouldn't capturing of those hashes present an opportunity for a replay attack?

No, random nonces that are exchanged between the peers are used as input when calculating SKEYID (besides the PSK).

  Or for example couldn't one side wait for the hash and send it back to "prove" it knows the PSK?

No, HASH_I (sent by the initiator) and HASH_R (sent by the responder) are calculated differently.

  Which leads to my next question, apparently main-mode encrypts the hash, so what is used to encrypt that hash, the same PSK?

SKEYID_e is largely based on the shared secret from an ephemeral Diffie-Hellman exchange. But SKEYID is also incorporated and, as mentioned above, that is based on the PSK. So yes, without the PSK the message containing the HASH_I payload can't be decrypted. But depending on the strength of the PSK that might not help much (see my answer here).


What is attribute-based authentication? I found the following definition here :

  From a privacy perspective a better solution would be the use of
  attribute-based authentication (Goyal et al. 2006) which allows access
  of online services based on the attributes of users, for example their
  friends, nationality, age etc

But it's not very clear to me, so:

What is attribute-based authentication?
What are its advantages?
How can it enhance privacy protection while online?

What is attribute-based authentication?

Attribute based authentication is a way of "minimal disclosure" authentication in that (at least in theory) it's only checked whether you have some attribute, rather than "who you are". This means that if a website requires you to have a certain age authentication will only leak your age, but not your identity.

This goes further in advanced systems which allow for predicates to be tested (i.e. 'age > 18') which means that even less information is leaked because now the website knows you're older than 18 but it's not leaked how old exactly.

In trivial systems you could just have somebody sign your attributes and then the website verifies the signature of your attributes. However, the problem with that is that if you try to authenticate twice you can be fingerprinted because if you just send your age signed then if you do it again you'll send the exact same content (signature is still the same) so the website knows it's the same person. Advanced systems don't do that as they create a new temporary pseudonym for each authentication which makes it impossible to fingerprint the person who tries to authenticate.

If you want to find out more you should read about 'privacy-preserving attribute-based credentials' and look into cryptoengines like UProve (Microsoft) and Idemix (IBM).

What are its advantages?

Ideally:

Minimum disclosure
Not linkable (you can authenticate twice without anybody knowing it's you again)
Decentralized (you're in possession of your attributes)

However, not all attribute-based authentication schemes necessarily fulfill this. You could for example have an authentication provider and the website you try to authenticate to contacts that provider and asks whether you are older than 18. This however leaks information to the authentication provider about what websites you visit so in practice a scheme that is not decentralized isn't exactly good for your privacy.

How can it enhance privacy protection while online?

Same deal. In privacy-preserving attribute based credentials/authentication you are 100% anonymous (excluding of course that you leak your IP and things like that) and not linkable and only leak the minimum amount of information required and it can be done offline.

The funny thing is that once they started developing this they faced the problem that users are now 100% anonymous and in some contexts you're required to be able to tell the government who used your service so effort had to be spent to develop backdoors that leak information about you.

There are also issues with revocation. Some systems thus require also proof that your credentials have not be revoked yet. But anyway... in THEORY privacy-preserving attribute based credentials/authentication are really good for privacy but they have drawbacks (revocation / DE-anonymization for legal purposes) and more user interaction. A website for example might just ask for "everything" and if the user doesn't intervene they will leak everything so software has to display to the user what is being leaked and the user has to confirm it which means these systems require much more from the user which is a huge problem for your average user.

Also... you need additional architecture... such as an issuer a revocation authority an inspection authority you need a crypto engine you need storage for the credentials which are all things that don't really make it practical for web-based authentication YET unless you're willing to install a browser plugin... you need to synchronize your credentials somehow (for example to be able to login in from your tablet, phone and PC) which means you also need software to synchronized your credentials etc... In theory the technology is great... in practice it's just not there YET and maybe it will have the same fate as PGP: it'll be considered to cumbersome/difficult for your average user to manage. A centralized system will surely be accepted but you lose out on privacy.


Real value of MAC models in Linux I have read about MAC vs. DAC in the Internet, but I still fail to understand, what kind of attack it is impossible to protect against if one only uses DAC+capabilities in comparison to MAC+DAC+capabilities. If a process does not run as root and lacks CAP_DAC_OVERRIDE, CAP_FOWNER and other dangerous capabilities, it cannot overcome the already assigned ownership and ACL's of the resources it uses. On the other hand, if a process runs as root and has CAP_MAC_ADMIN, it can overwrite the security context enforced by MAC.
So is MAC "just additional layer of protection" without any real advantage on modern Linux system?
Update1
I will add here my "answers" to particular arguments here.
I assume none of the processes run as root and have unnecessary capabilities (except for the system startup processes/scripts).
An argument: you can protect a web-server from running arbitrary shell-commands.
Answer: (Putting containerized web-apps aside,) one could add an allowing ACL for all commands the server UID/GID can access, and a forbidding ACL to the rest of the commands on the host.
An argument: a user can have a file with permissions 0777 [and essentially leak it to everyone in the system].
Answer: The system startup script can set default ACL to the directory where this file is created, so that whatever the user process creates in that directory will always get those ACL's inherited.
In general having 7 in "others" seems like a bad idea and if the file gets such permissions, the discretionary policy could be enforced here at system rollout (distribution installation), or even at startup every time the system boots.

The distinction is in who decides the permissions on files. A DAC gives the owner of the file the full control of the file permissions. MAC uses labels to enforce a centralized control, which means there is an additional layer of security that is not up to owner of the file to decide.
As an example, a user might have a file with rwxrwxrwx (777) permissions, but MAC enforces its rwx only to a specific set of security labels, effectively overriding DAC.


Could a password hash that's prone to more collisions provide better overall security? Website security breaches seem to be a common occurrence, giving the attacker password hashes that he can conduct a brute force attack against, often given him a list of passwords that will work on other sites since users commonly reuse passwords.

Would it improve overall security by making the hashing algorithm slightly weaker and more prone to collisions, so even if the attacker does brute force a password that works on the hacked site, it's not likely to work at any other site?

So if, for example,  some hash algorithm were 1000 times more likely to have a collision than some other hash algorithm, it makes the attacker's work 1000 times easier on that site, but any password he brute forces has only a 1 in 1000 chance of working on another site. He could continue to brute force and come up with all 1000 passwords that collide with the hash, but if he tried to cycle through all 1000 passwords on other sites, hopefully that site would shut him down before he got through all passwords.

Would this lead to better overall security by reducing the ability of a hacker to exploit passwords shared with other sites, or would it just weaken security by deliberately making it much easier to brute force a single site's password?

The "1000" factors cancel out. By making collisions much probable so that each password has on average 999 brother passwords which equally grant access to site A, you make entering site A 1000 times easier. Due to the vast choice of possible passwords, that "easy-site-A" password has only 1/1000 probability of being good for site B (where the user reused his password), but that extra 1000 difficulty factor is over the difficulty of entering site A -- which has just been made 1000 times easier. So entry in site B has not been made harder.

One other way to see it is to imagine the attacker trying to attack site B. He then creates site A himself -- with an extremely collision-happy hash function so that every possible password grants access to A: it suffices to have a hash function which always return the same value. The attacker can certainly implement a site with no access restriction, i.e. that kind of "site A". Does it change anything to the difficulty of entering site B ? Since it is something that the attacker can build from scratch independently of site B and its users, it cannot.

In the situation you envision, you can imagine site A as a filter for site B. Sure, site A won't tell you which password is the right one for site B; but it will reduce the list of candidates to 1000 (out of a few billions). This can only help attacking site B, and will certainly not protect site B.


What's the secure way to change UNIX permissions on a harcoded file often? I'm writing a daemon that monitors something in the OS and flips execution permissions on a file in /run/ back and forth. The file has static contents and the file name is hardcoded in the daemon. I made the daemon run as root to make it able to write to /run/.

The daemon is supposed to be used on a large number of desktop Linux machines, so I want to make sure it's not exploitable. I'm not particularly concerned by DDoS attacks though because the daemon is not mission-critical. However, all the ways to make a file executable or not executable seem to have a security flaw.

Way #1: chmod() back and forth

Create the file and chmod() it back and forth. I'm not fond with the idea because if an attacker manages to replace the file with a symlink to something else, an arbitrary file or folder will be chmod'ed into readability and possibly executability. The attacker would need root permissions for that, though.

Way #2: remove the file and atomically recreate it with open()

Delete the the file first and then atomically create a new one with the correct permissions using open(path, O_CREAT|O_WRONLY|O_TRUNC|O_EXCL, permissions), then write contents to the stream and close it. I like this one more because the only thing that can be exploited is removing a file with a hardcoded name by substituting the target directory with a symlink to some other directory, and if you can overwrite root dirs you should not need tricking daemons into removing a file with a hardcoded filename anyway.
What happens if the file gets deleted while the daemon is writing to stream in this case?
Is using g_remove() okay or shall I use unlink() only and abort if it fails?

Am I missing something or I'm just being paranoid and way #2 is secure enough?

Your method #1 can be adapted to protect against symlink attacks:

lstat() the file path you want to chmod.  Save the values of st_dev and st_ino in the struct stat that is returned.  These two numbers uniquely identify the file on your system.
open() the file with O_RDONLY.
fstat() the open file descriptor.  Check to make sure that st_dev and st_ino are the same as the ones you saved earlier.  If they're different, you've just followed a symlink and should bail out.
fchmod() the file descriptor to set the execute bit.  fchmod() is like chmod() except it operates on an open file descriptor.

If the attacker can't modify any ancestor directories of the directory containing this file, this is all you need to do.  If the attacker can modify ancestor directories, then it's possible you followed a symlink on an earlier component of the path when you called lstat.  Thus it gets a bit more complicated:

lstat() the first component of the path which might be a symlink.  Save st_dev and st_ino.
chdir() into the next component of the path using a relative path.
stat() the current directory (.) and make sure the st_dev and st_ino are the same.
Repeat until you reach the directory containing the file.

When you've finally reached the directory containing the file, perform the original steps above, but make sure you call lstat() and open() on a relative path.


Exploit include_once in PHP Code For a project we were asked to find and exploit the "Remote Code Injection" vulnerability of a web application. After hours of search (we have the source code of the web application as it is running on localhost), we came to the conclusion that the only possible place to inject anything is following code snippet:

if (!file_exists($filepath . $file . '.php')) {
         redirect_main_page();
}
include_once($filepath . $file . '.php');

However, we have further constraints ini_set("include_path", ".:../etc/:../files/");

So is there any way to exploit the include? The ultimate goal is to display the /var/www/html/project/etc/config.php on the website.

What we have tried so far:

http://127.0.0.1/project/files/index.php?page=../etc/config.php%00

->Fatal Error: include_once(): Failed opening '/var/www/html/project/files/../etc/config.php' for inclusion (include_path='.:../etc/:../pages/') (2).

Why are you using %00 at the end of your input? You're getting it "free" :) from the code itself in the . ".php" part

I'm guessing that the challenge is not in PHP7, since you can't terminate strings like that any more.

Anyway, using the payload ../etc/config (without null - %00) works for me:

However, maybe my setup is wrong:

  /opt/lampp/htdocs/project/files/test.php:

<?php
ini_set("include_path", ".:../etc/:../files/");

$filepath = "/opt/lampp/htdocs/project/files/";
$file = $_GET['page'];

echo("
 final path - ".$filepath . $file . '.php' . "
");
if (!file_exists($filepath . $file . '.php')) {
         echo "FAIL";
         exit();
}

include_once($filepath . $file . '.php');

  /opt/lampp/htdocs/project/etc/config.php:

<?php
echo "
WIN
";


Is "Why Should You Avoid AES In MySQL?" true? From a 2012 Smashing Magazine article quite a bold statement is made to avoid AES in MySQL itself. Or as they put it "Why Should You Avoid AES In MySQL?". However, if you search for SQL encryption, you often find the AES_ENCRYPT from (My)SQL mentioned. I am not saying that many search results mean the statement is untrue, but it just got me thinking: are the three quoted reasons below actually true?

What do the security experts here think about the reasons "why PHP’s Mcrypt is superior to MySQL’s AES functions":

  MySQL needs a database link between the application and database in order for encryption and decryption to occur. This could lead to unnecessary scalability issues and fatal errors if the database has internal failures, thus rendering your application unusable.

I cannot understand this issue; if you encrypt/decrypt in php, you also need to store the values in the database with a database link? If the decryption fails on php's side, this also leads to application failures? What is the point made here?

  PHP can do the same MySQL decryption and encryption with some effort but without a database connection, which improves the application’s speed and efficiency.

Php can do it "with some effort" and that improves the application's speed? Because you're encrypting before it's sent over the wire, the application (which will handles the encryption) gains increased speed and efficiency? How could that be true? In my opinion, it's about the "best tool for the job", so the argument that "php is capable too" does not mean per se it's the best tool as well. It's just a tool, without the argument why it's the best tool.

  MySQL often logs transactions, so if the database’s server has been compromised, then the log file would produce both the encryption key and the original value.

This is a valid point if you encrypt values in the database and have logging turned on. At least you should turn off the general query log as the binary log does only log transactions but no select statements. If you don't need logging at all, you could just make the statement "if you use AES in MySQL, turn off all loggin". That sounds more valid to me than "if you want to use AES in MySQL, do it in php".

Can anyone explain to me why above points might be valid and why -in general- it is better to encrypt your data in your (php) application rather than in (My)SQL.

The primary reason not to use AES_* functions in MySQL is because they are using ECB block mode of operation, which is insecure.

Read more at:

https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation

Edit:
Since MySQL 5.6.17 things have changed and MySQL supports CBC block mode, but it has to be enabled manually. Read http://mysqlserverteam.com/understand-and-satisfy-your-aes-encryption-needs-with-5-6-17/


Is a DoS attack possible on a single home connection when the ISP uses NAT? Today almost all ISPs use a NAT system to assign more people the same IP (at least where I am), probably because the IPv4 addresses are ending and they want to save money. Is it possible to make a DoS / DDoS attack on such a connection? Knowing the public IP address, I think theoretically it is possible to saturate the ISP circuit that uses NAT, but practically it is possible to attack only the single target? Also because I believe it is impossible for anyone with such a power to saturate the entire ISP.

Saturating bandwidth capacity of an entire ISP is very well possible and unfortunately happens on a daily basis. You’re right that with techniques like carrier grade NAT and end user may not have a dedicated IPv4 address, but that can still result in an outage when attacked. And of course, if the ISP deployed IPv6, it can be possible to uniquely target the end user that way.


How to prove someone sent an email to you? There are similar question about how to prove YOU sent an email, but I want to know if it is possible to prove a 3rd party sent an email to me.

An individual sent some very threatening emails to my company, enough to warrant providing the email copies to authorities. Now, this individual is claiming he did not send the emails and they are fake. He even says in his final email that he will get away with it because emails are so easy to fake and so no one will believe he sent them.

I have the emails, the headers, etc but I do not know what I can provide that will show a specific mail server sent the emails or IP address or anything.

What steps do I need to take in order to prove this individual did send these emails?

It sounds like your message is signed using DKIM which is good, because this provides cryptographic proof that the sending mail server sent the message and verifies the integrity of several key fields such as the to and from addresses. Assuming that the sending mail server can be trusted to properly authenticate the sending user (eg. via their login) then this essentially proves that the user in question sent it.

I'd provide the whole header to authorities, but the section which looks like this will be most important:

X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=mime-version:message-id:date:subject:from:to:cc:content-type;
bh=62R0FTDx1ty9lsn/QNK3rrnxESP0zwJj1ca95CbZzxQ=;
b=JAd1gFDtEKmA+KtSYuALKekaVb150ZFfqxluvTb6nc3pi5n2l8EE8BjZFTlyuif+h9
aGk6MyYrsBLFYjAQtweTcBlChVvBTw01mhJKGrKEVAKrnmHNknN9ivoV90/7024UEjGJ
w5VOtjmTC0lBCYIrnuqK13yDbjx2Ra4SzJ62RaUpoM4eECsJbBLK9BK0TULg92ozfwf9
UHF4ozrXIyTgeG87ifDtuz5ddrwFvP47mgoqP7ENaXsxhGFZqHOFJly7jrvNbWEWEfRX
ygY2Miuu/DnB1g1C/ahGq8VtQvb0XmVEK4XESJPBgP3F0wfpT4MrGbJbYiW3Z9SIiA1F
jhXw==

Your mail server might automatically validate the DKIM signature and include the validation result in a header such as "dkim=pass", but you don't have to trust this and you could verify the signature yourself if they questioned it.


Security Assessment vs. Risk Analysis What the real difference between IT Security Assessment based on ISO 27001 (or in general other international standard) and qualitative risk analysis?

In some way the approach is much similar - environment, question towards process owner, gap analysis and final result (where you are and where you should be)

An IT security assessment is a type of risk assessment. Here's the usual process:

Identify the scope of the assessment, and the information assets that are important to the target.
Perform an analysis of the technical security of the target, e.g. via network attacks, physical penetration, etc.
If in scope, perform an analysis of the security policies that the target currently has.
If in scope, perform an analysis of the human security of the target, e.g. via social engineering.
Compile the results of these analyses into a report, using an appropriate risk categorisation framework.

This is by no means exhaustive, and the order of the inner three tasks is arbitrary.

The difference between a generic risk assessment and an IT risk assessment is that the latter isn't something that can really be qualified - it's like asking about the difference between fruit and an apple.

If you're looking at ISO27000 standards specifically, these are just a way to enforce and standardise a particular code of practice and set of analysis tasks, in order to prove that an organisation has performed a security risk assessment to a particular level. They don't change the basic framework of a risk assessment, they just give you a set of minimums that you must perform.


What does it mean that Hmac is secure? I'm not taking about general collision attack on weak hash function such as MD5 or SHA-1. I'm wondering security of HMAC which is based on weak hash function

If there are key k, message m

Hmac(k,m) = hash(k`xor opad) || hash( (k` xor ipad) || m ) )

First Question, What does it mean that Hmac is secure?

Attacker cannot generates valid Hmac of given message m without knowing key
Attacker cannot finds collision that satisfy Hmac(k',m') = Hmac(k,m) such k',m'
Attacker can recover key k
others

And Second Question.

I'm reading about paper Transcript Collision

Transcript Collision Attacks: Breaking Authentication in TLS,IKE, and SSH

In this paper, They introduce Transcript collision
Attacker know m1 and m2. And can find collision that satisfy
hash(m1 || m2' ) == hash(m1' || m2 ) such m1' and m2'

If adversary uses this Transcript Collision Attacks in weak hash function,
Can he also finds collision that satisfy Hmac(k',m') = Hmac(k,m) such k',m'??

Cryptographers have a generally accepted definition of MAC security: resistance to existential forgery under adaptive chosen-message attack.  Most cryptography textbooks cover this definition—for example, the Handbook of Applied Cryptography is a good source for this.  The HAC is available online, so you might want to browse Chapter 9.  It's a bit dated on the algorithms side, but the definitions are generally still applicable.

But to just coarsely expand this, the security goal for MACs is this.  Assume that:

The attacker doesn't know the defender's secret key;
The attacker can cause the defender to compute tags for messages of their choice;
The attacker can use the results of earlier queries to refine later ones.

Then a MAC is broken if an efficient attacker is able to forge any valid (message, tag) pair for a message they didn't query as part of #2.  (Note that proper formulations of this definition have some math attached to them quantifying the effort that the attacker puts into the attack and what probability of success is unacceptable.)

If the key is secret this definition implies the security goals that you list (see the HAC for more detail):

  Attacker cannot generate valid Hmac of given message m without knowing key
  Attacker cannot finds collision that satisfy Hmac(k',m') = Hmac(k,m) such k',m'
  Attacker cannot recover key k

HMAC is designed to meet at least MAC security, but there are also proofs that HMAC supports another, stronger goal, called PRF security ("PRF" = pseudorandom function), which says that an efficient attacker can't tell the function apart from a randomly selected function of the same domain and range.


Why are Protection Rings called rings? Protection rings are different privilege levels granted to software, with the kernel being the most privileged, applications the least privileged, and drivers somewhere in between.

My question is why are they called rings? (as opposed to privilege levels) Is this justified historically or through the analogy making it easier to understand?

Warning: This answer contains educated speculation.

"Rings" clearly expresses the "nested set" aspect of protection rings, which were described as "concentric" in early papers describing them.

The earliest citation for rings which I can find is the 1967 paper "Protection in an Information Processing Utility" by Robert M. Graham.  It states,

  We define rings to be ordered, disjoint sets of segments, numbered
  from 0 to some maximum.

The 1972 paper "A Hardware Architecture for Implementing Protection Rings" by Michael D. Schroeder and Jerome H. Saltzer provides more language that reinforces this image (emphasis mine):

  In a system which uses segmentation as a memory addressing scheme,
  protection can be achieved in part by associating concentric rings of
  decreasing access privilege with a computation.

and

  Put another way, the sets of access capabilities represented by the
  various rings of a process form a collection of nested subsets, with
  ring 0 the largest set and ring r - 1 the smallest set in the
  collection.

The concentric circle metaphor clearly correlates to this notion of "nested subsets", in a way that other metaphors - like the OSI 7-layer "stack" model - do not.

The other language that works better with concentric circles is "gates."  Again to quote Schroeder and Saltzer,

  Restricting the start of execution in a particular domain to certain
  program locations, called gates, provides [protection]...

With a ring structure, a gate between two layers is the only clear connectivity point - whereas with a stack, a gate may exist on the line between the shared connection line, but other methods of access may be perceived by traversing the whitespace along the sides.  Again, the OSI model more closely matches that, where layers may be 'leaped' and ignored.  With a concentric ring structure, it becomes clear that every layer of access is cumulative (in one direction, in the case of protection rings.)

While gates do also lend themselves to the medieval castle design of concentric walls with gates between them, I cannot find any historic references equating Multics rings with castles; only modern references drawing the analogy in order to illustrate the concept.


Is there a Plug and Play demonstration kit for various types of attacks? I'm going to lecture a group of students about Information Security. I'm going to explain the theoretical sides of SQLi, Buffer Overflow and XSS.

I wanted to give them a live demonstration without breaking the law. Do you happen to know of any framework (maybe even Metasploit is capable of this) that has various of vulnerable services and programs which I can demonstrate the attacks on?

There are deliberately vulnerable web applications available from several sources, these can be downloaded and run locally and have been created for the type of activity you describe.

The OWASP WebGoat Project is one such example, which has been around a while and can be effectively used on a single machine to demo the principles of web app vulnerabilities.

As a side note, Metasploit is a different beast and is good for demo'ing things like exploiting remote privilege escalation vulnerabilities, and while it can be used on a single machine (with multiple VMs) I find it is more effective with at least two separate machines (one of which will have to have vulnerable software running on it).


IPtables - Accept Arbitrary Packets I've achieved a lot on blocking attacks on GameServers but I'm stuck on something. I've blocked major requests of game-server which it aceepts in the form "\xff\xff\xff\xff" which can be followed by the actual queries like get status or get info to make something like "\xff\xff\xff\xff getstatus " but I see other queries if sent to the game-server will cause it to reply with a "disconnect" packet with the same rate as input so if the input rate is high then the high output of "disconnect" might give lag to the server. Hence I want to block all queries except the ones actual clients use which I suppose are in the form "\xff\xff\xff\xff" or .... so,

I tried using this rule :

    -A INPUT -p udp -m udp -m u32 ! --u32 0x1c=0xffffffff -j ACCEPT

    -A INPUT -p udp -m udp -m recent --set --name Total --rsource
    -A INPUT -p udp -m udp -m recent --update --seconds 1 --hitcount 20 --name Total --rsource -j DROP

Now where the rule does accept the clients but it only blocks requests in the form "\xff\xff\xff\xff getstatus " ( by which GameServer replies with status ) and not just "getstatus " ( by which GameServer replies with disconnect packet ). So I suppose the accept rule is accepting the simple "string" as well. I actually want it to also block the non-(\xff) queries. So how do I modify the rule?

You might want to develop a UDP proxy. UDP is very easy to be proxied, each packet is a complete data structure, so it's easy to filter it.
UDP proxy would be an Linux C application which is receiving packets on port X and resending it to port Y. This could be simple as single loop. In this loop, you can run any kind of check and drop packets by simply not forwarding them.
It's that easy because it seems it's not encrypted traffic.


What is the term for requiring a user to go through an additional activation/verification process on new devices only? When I log onto my bank's website on a new device (be it a new phone or a web browser I haven't used before) it prompts me to send an activation code to my phone or email. I have to enter in this one-time code before it will let me log in.

The next time I log in I don't have to do this, unless something happened like I cleared out all my cookies or something. I may even have multi-factor authentication turned on to where I need to do something else like enter in another phrase or a code from a dongle or something but I don't have to do the verification code through a text message or other means unless something changes to my browser/device situation.

What is the term for this? Most of the ____factor Authentication terms are referring to needing to do something every time, I'm just wondering if there's a term for when you only need to do it on new devices.

This falls under the area of Adaptive Authentication, although that term covers the whole package - deciding who you are based on multiple factors, and getting more reassurance using multiple resources, including pushing out cookies to act as a factor in future authentications.

A couple of well known examples are:

RSA Adaptive Authentication
OpenAM / ForgeRock

Determining if you're coming from a device that the server knows about is a "device cookie" in ForgeRock or "device identification" in RSA.  But, really, they have multiple factors that they assign weights to when deciding to trust you:

Have there been failed authentications for this account?
Is the client IP address on a whitelist?
Is the client IP address in a good geolocation?
Has the account logged in from this IP previously?
Is the device recognized from past logins (e.g., device cookie?)
How long has it been since this account last logged in?

Coming from a recognized device is weighted heavily, so if that device cookie is missing you often have to do the work to get it.  But it's quite possible to write a policy where that isn't the case, given the variety of checks you can use in determining trust.


Windows SQL Server Intrusion Detection I'm looking into Snort to carry our basic intrusion detection, but finding it hard going.  What other Intrusion Detection software is there that is good to use for SQL Server?

You should look not into IDS technologies but Database Activity Monitoring (& Prevention).  DAM(P) software shims itself in to watch all SQL queries and results and uses a combination of generic rules and guided knowledge to detect and in some cases prevent inappropriate use.

An IDS will catch SQL injection, which is more specifically aimed at web applications (and impacts databases as an end-state).  It generally won't have any rules specific to normal database operations.


SSH Keybased authentication using Nitrokey So I'm fairly new to more secure forms of key management, I've been used to storing my keys inside key files on my computer.
Recently I wanted to try and see if I could setup SSH authentication to my webserver using a key stored on my Nitrokey Pro making my keychain more portable and secure in the process.

I followed this guide pretty much step by step but noticed that in the end, I did not need my Nitrokey Pro to be inserted into my computer at all for the authentication to succeed.

I have a feeling that upon exporting my key it somehow got added to my local key storage making the Nitrokey redundant but I am not knowledgable enough about the exact workings to be sure.

Would anyone be able to help me ensure that I can only SSH into my web server while my Nitrokey is inserted into my computer?

Notes:

OS: OSX El Capitan 10.11.4
Nitrokey Pro
Even while the Nitrokey is inserted into my computer it does NOT ask me to enter a pin when I attempt to SSH.
OpenSC 0.15.0
gpg 2.0.28

I tried removing from  ~/.ssh the following:

id.rsa
private_key.pem

after attempting to SSH to my web server again I get:

  Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

I assume this indicates that the SSH session cannot find my key to authenticate with,
I checked if my computer was detecting the Nitrokey by running:

  gpg --card-status

and received card information like I would expect.

I have a feeling that upon exporting my key it somehow got added to my local key storage making the NitroKey redundant but I am not knowledgable enough about the exact workings to be sure.

If that was done properly, it should not be possible. If the private key is stored in the "smartcard", it should not be exportable and for every private key operation, you need that card.

I don't have NitroKey and I am not knowledgeable about the nitrokey applications internals so few commands that should bring some more light:

Post devbug log of your connection using the key stored on the cards: ssh -vvv server
How does the ssh-add -L look like?
Can you see the keys in the "smartcard" when running pkcs11-tool --login -O --module /path/to/usr/lib64/pkcs11/opensc-pkcs11.so


If a website allows another person to get a list of the site's users passwords, how likely is it that the passwords are stored in cleartext? We had an incident where some of our managers were given passwords for the people they supervise using a particular company website. Ostensibly it was done so the managers could check in on the users and see that they're doing what they've been directed to do with this third party website.

When I found out that a list of the passwords were printed out and given to the managers, I immediately thought that the passwords on the commercial website weren't being stored in a secure fashion and warned users that they should immediately change any passwords that nearly matched their "throwaway" accounts; I'm also afraid that, being typical humans, there are a number of people that used the same password on that site that they use with our internal password system so they didn't need to remember more than one password. I was also shocked that the users weren't warned that their passwords would be distributed to other people/supervisors.

I went to the website in question and clicked on their privacy policy link; it returned a 404 error.

Was I being paranoid?
What are the chances that the commercial website is storing their
passwords in the clear if a manager is able to retrieve a
plaintext list of passwords?

No, you're not paranoid. The chances are pretty high that passwords are stored as plaintext in the database (it's the most obvious explanation). Some estimations say that 30% of websites store (or have stored) their users' passwords in plaintext. Examples include Reddit.com or RockYou.com. It's typically only after a serious breach occurs that the password storage procedures are put to the test.

Often sites that store passwords in plaintext will offer you a possibility to resend you the old password once you forgot it. That pretty much proves this insecure practice.

There is a possibility that the passwords are stored encrypted and were decrypted for the report, but it's a rare practice. Even if the passwords are encrypted there will always be a problem of key storage as the application most likely would need access to the decryption key for authenticating its users.

Of course the proper thing to do for the application is to salt and hash the passwords.


I need explanation on how serious these vulnerabilities are? I have found two vulnerabilities on my college site and I want to report them but don't know if these are "really" vulnerabilities :

RFI inside SWF file.

Example: https://www.site.com/opis.swf?sTitle=Vulnerable&sDesc=Again vulnerable&sPrice=Vulnerable&sCoverFront=http://www.neurosciencemarketing.com/blog/wp-content/photos/smiley1.jpg&sCoverBack=http://www.neurosciencemarketing.com/blog/wp-content/photos/smiley1.jpg&sBuyLink=http://www.google.com&sPath=http://www.neurosciencemarketing.com/blog/wp-content/photos/smiley1.jpg

As you can see sTitle and sDesc are text values , sCoverFront and sCoverBack are .jpg, sBuyLink is redirection url (my ideas is XSS vector: data:text/html,alert(document.cookie)) and sPath seems to be url for m4u video.
Pick of swf applet:

RFI for image source link.

Example: http://site.com/static/Covers.htm?b=http://www.stringfunction.com/img/url-encode-url-decode.jpg&f=http://www.stringfunction.com/img/url-encode-url-decode.jpg

And here is code for src settings:

And for Querystring:

/* Client-side access to querystring name=value pairs
    Version 1.2.3
    22 Jun 2005
    Adam Vandenberg
*/
function Querystring(qs) { // optionally pass a querystring to parse
    this.params = new Object()
    this.get=Querystring_get

    if (qs == null)
        qs=location.search.substring(1,location.search.length)

    if (qs.length == 0) return;

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
    qs = qs.replace(/\+/g, ' ')
    var args = qs.split('&') // parse out name/value pairs separated via &

// split out each name=value pair
    for (var i=0;i<args.length;i++) {
        var value;
        var pair = args[i].split('=')
        var name = unescape(pair[0])

        if (pair.length == 2)
            value = unescape(pair[1])
        else
            value = name

        this.params[name] = value
    }
}

function Querystring_get(key, default_) {
    // This silly looking line changes UNDEFINED to NULL
    if (default_ == null) default_ = null;

    var value=this.params[key]
    if (value==null) value=default_;

    return value;
}

Is there any vuln in these, are they worth of reporting.
Thank you.

If I were creating this, I would avoid any type of RFI (whether it can be practically exploited or not doesn't matter). If a hole exists but there seems to be no risk, it's just asking for trouble. I would let the webmaster or whoever you think you should contact know what you found. Linking to some vulnerabilities regarding remote file inclusion will help bring your point across. This is a good resource


Securing a Node.js REST API for React.js webapp as well as a standalone API I'm trying to create a secure method of authentication for my Node.js REST API that will work both for direct API requests as well as from my React.js web application. I've done some reading on how to properly store authentication tokens to protect against XSS and CSRF, so I'd like to present what I've come up with to see if there are any holes in it, or if it will work at all.

This method will use a combination of JWT, localstorage (React app), and cookies (Node API).

The API has an endpoint /authentication. When called, it will generate a CSRF token and include it in the payload of the JWT. It will then set a cookie (HttpOnly, secure) with the JWT, and return said JWT.

When /authentication is called from my React.js web app, it will receive the JWT, and store just the CSRF token in localstorage.

Then, whenever the app needs to fetch a resource from the API, it will send the CSRF token in the header of each request.

The Node.js app will have a middleware that checks a few things:

If the entire JWT is present, it will authenticate. This is the case where users are interacting with the API directly.
If it's just the CSRF token, we will first verify the signature of the JWT in the cookie, and then compare the received CSRF with the one in the cookie. If they match, then it will authenticate.

My thinking is that this way, the JWT is never exposed on the web app for any attacks to occur.

Does this model seem secure enough?

Welcome to the site, Vipulp!

I am not certain if your requirements allow it (apologies if not), but I would recommend using an existing node.js library to do the heavy lifting for you. Something like passport http://www.passportjs.org/docs/ or the like.

This way you don't need to reinvent the wheel, and are less at risk of missing an edge case or including a bug.


Why do we need security measure likes control flow integrity and buffer overflow guard if we have good access control protocol in place? Reading into information security, I noticed two branches. Access control when communication with external device by using some type of cryptographic authentication and encryption mechanism and things like control flow integrity. My question is why do we need the latter if former is good enough.
Are there example of control flow exploits on access control protocol implementation themselves? My focus is mainly on embedded devices.

Control flow integrity and buffer over flow protection are measures against exploiting coding bugs in a program. Access control is about controlling who can access some device or application etc.

By assuming that access control would be sufficient you assume that a) access control itself is perfect and never has any bugs and b) access control makes sure that only innocent users will be able to access the remote device/application. You therefore conclude that the remote device/application can have lots of bugs since no hacker will even be able to reach the buggy code in order to exploit it.

Both assumptions are wrong: a) access control can have bugs like other software and b) some hacker might hack into the trusted client and is therefore treated as authorized to access the remote device/application. And the hacker will not be friendly to a buggy application.


How does LastPass decrypt passwords? I am a web developer, not a security expert, but I know a little bit about security because I need it as a web developer.

According to LastPass,

  LastPass encrypts your Vault before it goes to the server using
  256-bit AES encryption. Since the Vault is already encrypted before it
  leaves your computer and reaches the LastPass server, not even
  LastPass employees can see your sensitive data!

As I understand it simply means that LastPass employees cannot see password by using any method. So how we can find our passwords which are saved on their servers (encrypted password)?  I mean if their program can show passwords for us, why employees can't use the same method to decrypt our passwords which are stored in their servers?

Or do I misunderstand some point?

The decryption happens on your device, using the password you enter when starting the program, or a stored version of this, if you've selected "remember me" or are using biometric authentication. The password isn't sent to their servers, so the employees don't have access to it.

In more detail: the master password is used to generate an encryption key, which is then used on the client device to encrypt passwords. When you log into a new device, the password you've entered is used to generate the same encryption key, which, since symmetric encryption is used, also allows for decryption. This effectively means that the master password is the key for all the other data stored.

If you change your master password, the client side code re-encrypts all your passwords with the new key generated from this. This can take a while if you have a lot of passwords stored.


Inconsistency Among MD5, SHA1, and SHA256 Hashing Protocols There appears to be an inconsistency (or unpublished protocol) in many online hash generators when formulating a hash from an uploaded text file, versus strictly hashing the contents of a file. This issue appears to be unrelated to the name of the file, yet can be consistently replicated.

For example, hashing the following (by copy-and-paste at http://onlinemd5.com/)...

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.

... produces an MD5 hash of: A5E90C16BEB53BB93468496EAF2E0AC4.

Yet if one copies the above into a text file, then uploads the file, the MD5 hash produced is: 8F18B10192372D8523558CF65DB2B1B2, regardless of the name of the file.

In addition to the above site, this can reproduced at "passwordsgenerator.net/md5-hash-generator/" (copy-paste) and "md5file.com/calculator" (file upload), and is consistent among MD5, SHA-1, and SHA-256.

This implies that there are either unseen characters that are consistently being hashed within the file upload (independent of the filename) that are messing with the hash, or the algorithms are adding/subtracting characters upon file import (unlikely).

Why are these hashes coming out different?

I'm on a Windows machine, using basic notepad for file creation. Please excuse the "quote" links above; I do not maintain an appropriate reputation for multiple links in a post.

A5E90C16BEB53BB93468496EAF2E0AC4 is the MD5 hash of that text with Unix-style line endings (LF).

8F18B10192372D8523558CF65DB2B1B2 is the MD5 hash of that text with Windows-style line endings (CRLF).

Since you're using Notepad on Windows, I'm guessing the first site is converting the line endings to Unix-style before hashing the text.


How is it possible that this spam mail came from Google Forms without revealing their sender address? I got just this typical spam email, but this one seemed odd. It came from Google Forms, which apparently can send emails too, however you have to sign in to Google Forms to use it, and it uses the email you signed in with.
How did this spammer manage to appear to send from the Forms email? This seems like it can be easily used to phish unsuspecting people who trust a Google address. What is especially strange is that this mail came from the google.com domain, which is not something that public users can create mails on, and it is signed by google.com, so as far as i understand it cant be spoofed - so how is this possible?

The spammer in question is abusing a Google Forms feature called Response Receipts. If you create a Google form and turn on response receipts, then whenever anybody fills in and submits the form, a copy of the filled form is sent to the email address they provide in the form. This response receipt is sent from the Google service account forms-receipts-noreply@google.com and since it is sent by Google itself, it is also signed by google.com.
So all the spammer has to do is create a Google form with the body of the form containing the content of their spam email. Then they simply submit the form with the victims' email addresses and sit back as Google delivers their spam for them. Note, however, that when I tried replicating this, the response receipt email landed in my spam folder, which means Google does attempt to detect such spam emails. The spammers must have figured out a way to bypass gmail's spam filters for the email to land in your main inbox.


Can I store a pair of keys on iOS secure element? I would like to know if I can use the iPhone's secure element to store a pair of keys. I need to store them in the safest emplacement, and I can't think of a better one than the secure element.

You can do this by setting kSecAttrTokenID to kSecAttrTokenIDSecureEnclave when generating the key. According to the documentation (which consists of some comments in SecItem.h), the only kinds of keys the secure enclave can store are elliptic curve secp256r1 keys. You can't put RSA keys there, for example.


Is it possible to bypass this Xss Filter? I was creating an XSS filter for my node plugin. Is there any way to bypass it? If yes How can i prevent it?

function xSSFilter(str) {
        return str
            .replace(/&/g, '&amp;')
            .replace(/"/g, '&quot;')
            .replace(/'/g, '&#39;')
            .replace(/</g, '&lt;')
            .replace(/>/g, '&gt;');
    }

Output encoding is context-specific. If you're only putting the output of this function into HTML text elements - not into attributes, not into strings (or anywhere else) in a script, not into CSS, etc. - you might be OK. For now. If you're aiming for any other context, you're definitely not OK. Here are just a few (this isn't a comprehensive list, don't try to make a comprehensive list, you'll most likely fail and even if you don't the next ECMAScript or HTML update will break your magical unicorn of a viable blacklist for you).

You're not filtering \, which can be used to escape the legitimate string-ending ' or ". If the attacker controls another string on the same line, that string will be interpreted as code.
You're not filtering `, which is used to delimit template strings in JS; an attacker would be able to break out of one of those trivially.
You're not filtering ${ or }, which are used to create expressions for expansion within a template string; the text between them is treated as code.

Just use output encoding of everything non-alphanumeric if you want to be really safe, or at least use a whitelist of non-alphanumeric characters to not encode (and be conservative with it). If you're using the filter only for a specific context or two (say, HTML text and non-event HTML attributes), you can maybe get by with a specific "blacklist" of characters to filter, but it's riskier than going the other way.


Is Strict-Transport-Security header necessary when HTTPS is set up? My website data is transferred via HTTPS. As far as I understand this, there is a certificate that is issued by CA which is provided by server for each client, client and server decide how to  encrypt and  decrypt the info being exchanged and from this point and on communicate only this way. This is basic HTTPS.

Now I do not understand where the Strict-Transport-Security header fits here. When the server sends it in response, the browser will conduct communication only via HTTPS. And in case some URLs are still HTTP it will automatically transform them to HTTPS.

Here is  the question: if we've set up HTTPS like I've described in the first paragraph is it still necessary to send Strict-Transport-Security header with server response? If so, what purpose will it serve?

I'll refer you to this: https://security.stackexchange.com/a/17272/125176

Basically, HSTS tells the browser never to communicate with the server without HTTPS. In this way, you're covering both communication lines.

Excerpt:

  HSTS tells the browser: never use HTTP with this site. Only access it
  via HTTPS. So, to enable HSTS, you must make sure that your site works
  with HTTPS, and only HTTPS. This includes everything: HTML, CSS,
  Javascript, everything. Make sure all of the CSS and Javascript on
  your site is available over HTTPS. Also, I suggest that you convert
  your pages to reference everything over HTTPS (I recommend your pages
  avoid loading any other Javascript or CSS resource over HTTP, as that
  may cause warnings or security problems for some browsers).

Is it necessary? That's up to you to decide. Is it recommended? Yes.


AppSec Developer Certifications I've noticed that certifications seem to be a big part of the IT Security Professional (non-development), but have not seen the same attention being given/required of the software development engineer that focuses on application security or building security software.

Am I wrong, and just not seeing it? Or is it true that security certifications aren't as much needed for devs vs general it professional (network engineers, admins, etc)?

I guess ultimately my question is, will certifications be required for a software development engineer that specializes in software security, SDLC, mostly application security (with some/little hints of network security)?

There are not many security certifications for developers. The simple reason is that there would have to be certs for every language and trend. And considering that trends swing wildly from year to year, there is not enough time to develop a robust security certification that will not be laughed at while the trend is still relevant.

Dev communities opt for calling secure libraries, on-the-job training around secure coding, and testing.

There are general secure coding certs, but they are so general that few people take them seriously.

This is a situation that is not going to change while the innovation cycle in software development is so tight.

IT/Networking pros have a much more stable environment to work in, so the certifications have a chance to grow and mature. Firewalls are firewalls, the only change from situation to situation is the syntax. Phishing is phishing and the hallmarks, how to identify, how to block, and how to educate users has not changed in years.

Could the IT end of things have a much tighter innovation cycle? Yes. But we have been working for so many years to get the basics right, that there is little need for attackers or defenders to innovate. So, the common body of knowledge remains stable, making it possible to certify against that common body of knowledge.


Risks associated with HTTP content injection? I'm curious about the risks associated with HTTP content injection, where an ISP injects content to pages accessed over non HTTPS connections.

Some examples:

http://arstechnica.com/tech-policy/2014/09/why-comcasts-javascript-ad-injections-threaten-security-net-neutrality/
http://m.theregister.co.uk/2015/01/06/gogo_ssl/2

I'm specifically asking about situations where:

The injection is only carried out against HTTP connections. The ISP is not spoofing SSL certificates.
The injected content is non malicious. For example, a banner listing your remaining free minutes on a hotel WiFi connection.

Does the act of introducing this content introduce any additional attack vectors other than those normally associated with using HTTP?

Considering that the code they inject can be anything, one would have to assume that there are risks. Perhaps their code has a vulnerability in it that allows injection. Perhaps it obscures important items on the page. Perhaps it references an external resource (eg: JavaScript) of less security. Who knows? It certainly seems a risk to me.

There are other risks that you are exposed to independent of the injection. For example, they are probably providing a custom DNS of unknown behavior. So you're at their risk for DNS security.

In fact, how do you actually know you're using the hotel's WiFi router? In general you can't.

It is considered bad to use open WiFi routers.

Using a VPN (I use PIA) is generally considered a secure strategy.