"Virus Found" Web Browser Pop-up I use a website that typically creates a new tab with an ad on the first click. Usually, I can close the tab without even looking at it, but recently a more aggressive strain brings up a pop-up (for both Safari and Chrome on OS X) saying "Virus Found"... which I took a screenshot of:

The first few times this happened, I was using Safari, panicked, and just quit out of Safari, which worked fine. For some reason, Safari would typically not re-encounter this pop-up (or any new tab ads from the site) until I closed all the way out of Safari again.

I recently used Chrome, which got locked by the same pop-up but would not quit (that is, right-clicking the chrome icon in the dock and clicking "Quit" was non-responsive). So, I clicked the "OK" on the pop-up which brought me to an obviously scammy site wanting me to click a button to scan my computer for viruses. I did not click that button; rather, I immediately closed out of that tab. I've noticed that Chrome does not re-display that ad unless I delete its browser cache/history.

My first question is: could any harm have been done by clicking the Safari/Chrome pop-up "OK" button which redirected me to a scam site (note that I immediately closed out of the scam site)?

A related question that I am simply curious if anyone knows the answer to is why Chrome has a much harder time with this than Safari?

Some additional information: I installed AdwareMedic and scanned for Adware but it found nothing; after that, I followed instructions to look at Safari's extensions (but there are none) and to change the homepage to google (with https) which I did and the pop-up has not returned on Safari since then. I followed similar instructions to "Reset Settings" for Chrome which only brought the pop-up back (it disappears after clicking the "OK" until I remove that event's history/cache I think).

EDIT
I think @aviv adequately answered my question, but in case this may sate curiosity or help future users, I'll post here the scam url (which I do not recommend visiting)

http://app.macoscleaner.com/secure/en8/index.html?voluumdata=vid..00000003-a935-4042-8000-000000000000__vpid..4f731800-0f3e-11e5-8777-238ebdf4bb87__caid..48dced12-25c7-4982-b011-527d198fa9ea__rt..D__lid..b1d13635-3362-4e00-b49f-3daef77eb6d5__oid1..07bb6eaa-c983-4d90-b4ad-3670b87ec557__var1..20026__rd..onclickads%5C.%5Cnet&zoneid=20026&visitor_id=66476472834

Additionally, the website that sparked this question has a url of www dot animefreak dot tv (I don't have enough reputation to post another url).

To try to get the pop-up to appear (there are other new tab "on-click" ads that appear that don't cause a dialog box to appear and go to more mundane sites), I recommend using Chrome's Incognito mode, since the site seems to have a timer or something on normal use (that is, a pop-up occurs when I click one of the hyperlinks on the site only after a while; after I close it on Safari/Chrome for my normal preferences, it does not show up again for a while but it does every time for Incognito Chrome).

If people think this update/edit would better serve the community as a new question (about how a site can open a new tab even though my preferences say not to allow such, or something along those lines), leave a comment and I will do so.

Also note that I'll may be out of contact for up to a week at a time but I will be active when able to do so.

This message is just utilizing the alert function from javascript which is used to display a message to the user. One thing you need to understand is that once this tab has been opened you have already browsed to the "scam" site, the message is shown by the scam site.
No harm can be done from the message itself and not from clicking OK. It doesn't matter whether you close that tab before or after clicking OK since once you browsed to that page it controls the order of things done and if it had any malicious intent it would have executed it before showing you this message... So it doesn't really matter if you use Safari or Chrome. It is strange though that your browser allows the site you are visiting to open a new tab, this behavior is usually disabled by default and instead you get a notification that this site wants to open a pop up. Maybe you allowed it sometime and thats why you get this annoying new tab opened. To disable it follow the instructions from Google

It is true that Chrome does not allow any action if a dialog window is open, but its not that it is having a harder time or that this is putting you in danger.

Regarding your question about the possible harm done: probably if you didnt interact with the scam site, no harm is done, perhaps beyond that site making some money from you visiting this site and maybe that site tracking your visit there by some analytics engine such as google analytics. As long as you have not granted it any special permission like using your camera, or did not enter any password into it it can not do much. Usually these sites will try to trick you into entering credentials for some of your accounts, or downloading some malware in disguise of some useful application.


Are Wi-Fi scanning programs reliable? Recently, I scanned some Wi-Fi networks with wifite tool in Kali. This tool said that one of the available Wi-Fi networks is secured with WPA2. Ten minutes later, I scanned these Wi-Fi networks again. In this scan, wifite said the same network is secured with WEP. I scanned these networks again using Fern Wi-Fi cracker. In this state I saw that the network is secured by WPA. I'm confused with these observation. Now my question is:

Do security methods change over the time or are these programs are unreliable?

That is very weird. The tools shouldn't lie. The networks are not changing its configuration by theirselves. Maybe the same network changed its config (done manually by network's owner). Anyway, If you want to compare results you can check with different tools. I can recommend to you some of them (scanner tools) for Linux and Windows:

airodump-ng <- is in aircrack suite
kismet
inssider <- is not free
netstumbler <- pretty old
acrylic <- free version is only scanner

Of course there are a lot of tools to audit wireless networks, not only for scanning. You can check some of my favourites:

airgeddon <- wpa/wpa2, wps, DoS, handshake capture, Evil Twin, etc...
linset <- Evil Twin
wifihacker <- wep, wpa/wpa2, wps


Use header instead of cookie for CSRF double submit cookies? Double submit cookies are vulnerable to cookie injection from the same domain. What if I use a custom header instead of a cookie?

Example HTTP request:

header X-CSRF-PROTECTION = 5a445s66gg54s45a54
POST   X-CSRF-PROTECTION = 5a445s66gg54s45a54, param1=aaa....

Isn't that safer?

Edit:
ok, I was confused, thanks to Anders now I have a more clear idea.

I'd like to avoid to put an hidden form fields, but I want provide a decent protection.

I always use json ajax based interaction
I always check that content-type is 'application/json"

So, what I proposed before doesn't add security.

I could:

store at login time a random token in SESSION and as COOKIE
every ajax request, should read the cookie and set it as request header
the server can compare the header with session value

What do you think about?

The reason to use double submit (instead of a synchronizer token) is that you do not want to have to do a lookup on the server for every request. So as long as the value of the cookie matches that of the request parameter the request will be passed through.

That works because evil.com can neither read cookies from example.com (and thereby send a matching request parameter), nor set them (and thereby set both to some arbitrary constant).

You are correct to point out that this fails for subdomains. It is possible for evil.example.com to set a coockie that will be used for example.com, and thereby bypassing the test. So if you do not trust your subdomains, do not use this solution for CSRF protrection!

Now, does your proposal solve the problem? No. It actually makes it worse. Since you do not need to read or modify any cookie value anymore, it comes down to being able to modify request headers. So this is the same as just relying on a single header with a constant value, e.g. the commonly used:

X-Requested-With: XMLHttpRequest

You have two problems here:

You are still vulnerable to an attack from evil.example.com since a subdomain can modify request parameters to its parents by using document.domain.
You might also be vulnerable to attacks from evil.com since there have been multiple Flash exploits allowing you to set headers for cross domain requests.


Does a SOC 2 SSAE report not come with a "seal of approval" from a certified auditor? I'm studying for the CCSP exam and I'm confused with a test prep question in my study materials.

The question reads:

  "Which kind of SSAE report comes with a seal of approval from a
  certified auditor?"

  A. SOC 1
  B. SOC 2
  C. SOC 3
  D. SOC 4

I chose B. SOC 2 because I figured that as one of the most detailed reports on controls at a service organization, it would certainly need to have some record ("seal") of a reputable auditor performing the study.

The test prep material says I'm wrong though:

  C. SOC 2 deals with the CIA tria.  SOC 1 is for financial reporting.
  SOC 3 is only an attestation by the auditor.  There is no SOC 4

OK, fair enough.  I can understand how SOC 3 would be an appropriate answer but why not SOC 2 as well?  Is there no attestation on a SOC 2 report by the auditor?

SOC 2 report includes a description of the tests performed by the auditor and
the results of those tests and the auditor’s opinion of the effectiveness of the individual
controls and systems. SOC 3 does not contain test information and details on the controls in place, but just reports whether the systems meet the requirements of the criteria for the specific trust service.

SOC 3 is commonly used as a “seal of approval” and placed on service providers’ websites and marketing collateral.

The link below will give more detailed comparison between SOC 1 , SOC 2 and SOC 3 reports.

https://www.aicpa.org/INTERESTAREAS/FRC/ASSURANCEADVISORYSERVICES/DownloadableDocuments/Comparision-SOC-1-3.pdf


Is running an OpenBSD in QEMU on an OpenBSD machine safe? Is running an OpenBSD** using QEMU on an OpenBSD safer then running just natively an OpenBSD?

** = only used for apache + scp + ssh

I'm thinking about running the OS/webserver in QEMU because then I could be "more flexible" to use the securelevel configured to 2:

http://www.openbsd.org/cgi-bin/man.cgi?query=securelevel

Are there any other solutions ["jail/chroot" the full OS?]? The bad thing that QEMU is from ports, so it's "less secure"? Performance doesn't matters, only security from OS/webserver side.

My understanding of the question is that you want to run a webserver and an ssh server only.

First, I'm not sure why you wouldn't be able to able to do this with securelevel set to 2.

Second, if you run qemu as a package/port and you use the kernel module you are adding a device, giving some superuser permissions and generally increasing the attack surface.  The time setting this up would be better spent on securing your webserver, perhaps in a chroot (not with the entire OS!).

The idea behind's OpenBSD's security is that you don't have to fuss with it very much and you can spend your time securing applications that run on top with it.  Almost always simplicity is the friend of security.  Unless you fall into some clearly defined need like tdammers suggested, it's best to hew as closely as possible to the default install with any needed configuration.


Recourse if debit card was used on a suspicious website My husband got a pop-up ad on his phone for a fashion website and purchased two pairs of sunglasses using our debit card.  The confirmation was emailed to me (marked as spam by gmail), and the site seemed very suspicious to me:  the URL is nonsense, the confirmation message had a number of basic grammatical errors, and the deal seems too good to be true.  It could potentially be completely legitimate, but I'm suspicious.

What, if anything, should I do at this point to mitigate the fact that my husband just gave out our billing information to a potentially fraudulent website?  We are in the USA.

Billing confirmation message:

no-reply@tobeno1shop.com
Jul 30 (2 days ago)

 to me
Dear {{ myemailaddress@gmail.com }},
Attention：This is a confirmation for your order detail. It means you have paid for the order successfully.
Order details:
Merchant Order No. :  628
Order No.          :  {{ order number }}
Payment Date&Time  :  Mon Jul 31 03:01:01 CST 2017
Amount             :  54.98 USD
**Please do not reply to this email. Emails sent to this address will not be answered.
**Due to floating exchange rate, tiny disparity of order value may exist.
**Please note that your bank may apply a small charge for handling this transaction.
Contact details:
Email: service@tobeno1shop.com
☆ We an independent third party payment provider and as such protecting all cardholders is our primary concern.
☆If you have any problems about this transaction, please don’t hesitate to contact us. We’ll try our best to help you until you are satisfied with it.
☆Please ensure our email add added to your allowed list to ensure that we can help you properly.

Don't report this as fraud; that will kick off an investigation that will ultimately conclude you did authorize the transaction. Waste of time all around.

Call the card company, tell them you made a purchase on a site that is not at all PCI-compliant, is "likely fraudulent" and your card information is now assumed compromised.
Go through the hoops to get a new card issued with new numbers.
Wait 30-45 days to see if the glasses show up. Be pleasantly surprised if they do. If they don't, dispute the charge before the end of the dispute period (gen. 60 days).
Educate your husband to never buy anything marketed through ads. Even when the goods are delivered, they're seldom as good a deal as you think.

As for identity fraud, I'm not seeing birthdays or socials in the form, so it's unlikely they could actually do anything with it. They ask for enough information to authorize a transaction so I'd expect fraudulent charges on the card at worst if you don't shut it down immediately.


What is the most secure way of transferring a secret between 2 processes running on the same system? As a part of my system, I have many processes, each of them created through a script. One of the processes can be considered as a "Master Process" in the sense that this process communicates with the Server and gets all configuration and key related information.

Now, I have a requirement to the pass the configuration and key information from the "Master Process" to other processes. Currently, I am trying to write the configuration information to a file (one file for each of the other process) and the other processes read from that file designated for itself.

The problem now arises as I also have a key and I don't want that to be written to the file.

What is the most secure way to pass the key from the "Master Process" to other processes?

I have thought of the below so far:

Have a SSL/TLS protected socket communication (TCP) between other
processes and master process. The problem with this approach is that,
SSL/TLS is heavy and I cannot open a listening socket on the Master
Process.
Use Pipes. But, I am not clear how I can secure pipes and    also
ensure that processes which are not intended to connect to    Master
Process and get the key, don't get it.
Shared-Memory - Same    problem as above.

Please note that, these processes don't share a Parent-Child Process relationship.

Any pointers will be of great help!

If your threat model includes "malicious processes running as the same user as the legitimate process that needs the key", you need to go back to the drawing board and redesign. It is not possible to protect against that. Processes within a single user session are not, and should not be expected to be, secure from one another.

The concern you express about pipes, for example, extends to any other kind of IPC mechanism. TLS sockets with mutual auth? Any process that can connect to the socket can also be impersonated by another process in the same user context, reading the same key data, and spoofing the legit process. Even if you could securely establish the IPC, that's no guarantee that the data would be secure. For example, some operating systems (Windows notably, but I think also some Unix-likes) allow any process running under a given use to debug any other process under the same user, so the malicious process could just read the secret right out of the legit process' address space.

OK, let's talk about scenarios where you don't assume that another process in the same user context as you is malicious. Maybe that's because you (re)designed the whole thing so that it runs under a special user context used only for the specific purpose of your software. Maybe that's because you're working on an embedded device where you control all the code that runs. Maybe it's just because you accepted that trying to defend against malicious code with the same privileges as you is hopeless and pointless (if the bad guys are executing code in your user context, it's already game over, man).

You didn't specify the OS that your software needs to run on. However, in general, there are a few decent choices here for secret that you don't ever want to commit to persistent storage.

On Unix-like systems:

Unix domain (local) sockets. Fast and fairly straightforward. Support bidirectional communication, if that matters. To be secure, you just have to create them in a location that is neither readable nor writable by any other user (something under the user profile is a popular choice). On the other hand, you said you can't host a listening socket on the Master (why not?) so this may not work.
A named pipe, also called a FIFO. Fast and straightforward, but unidirectional only (if you want bidirectional, you need to create a pair of pipes). As with the local socket, make sure the FIFO is created where no other user can access.

On Windows:

A named pipe. Unlike Unix named pipes, Windows pipes don't go in the standard file system; there's a special "named pipe file system" for them. This means you need to ensure you create the pipe with the right access control list (ACL). Once created, though, using the pipe is fast and simple.
A named memory mapping. The CreateFileMapping API can be used to create a memory mapping that is not backed by any normal file, but instead by the system paging file. While the pagefile is backed by persistent data and therefore could lead to the secret being stored on disk, that is a risk with any process; you can't guarantee that the secret won't ever be paged out of working memory unless your platform offers (and you use) some kind of kernel-secured buffer. Meanwhile, an attacker wouldn't know where to look for the secret in the pagefile, so you're probably safe. Named memory mappings, like named pipes, must be secure using an ACL that prevents processes running under other users from opening the mapping. Once both parties have opened the mapping, though, it's very fast.
Direct memory access (read, most likely) between processes. The client process simply reads the secret out of the parent's virtual address space. This requires a way to pass the relevant address to the other process, but it's OK if that address is exposed; other users can't access the process' memory even if they know where to look, because processes always have an ACL that prevents other users from reading their memory.


Manually monitoring your PC for Java (Oracle) exploits? Sandboxing and AV's aside, if I wanted to manually look at/monitor my system for where they usually enter it, where could I look for possible malicious Java viruses/activity, e.g., would they first show in Task Manager or temp files?

Are there any tools for this?

Manually monitoring for any kind of Malware is not exactly practical (even on a single computer, let alone in any kind enterprise setting).  Also, the answer to that question will depend on what OS you are referring to.

I'm just going to assume you're using a windows OS.  If you're really determined to conduct some kind of manual search, sort by date modified and look in directories that are common across all systems (system files, current user, program files, etc.).

As far as java vulnerabilities, just keep up to date on exploit notifications and keep your JVM updated.


Is checking against password lists a good way to enforce a secure password policy and possibly detect dictionary attacks on a web-based app? I have written a script to check a given password against a ~65 million long list of passwords collated from various lists released after hacking attempts.

I am thinking about incorporating it into the password checking process when a user chooses a password - notifying them that a password  is on a list used by hackers.

Plus I wondered if it could be used to detect a dictionary/ brute force attack when passwords in the list are ysed in failed login attempts.

Any thoughts on the usefulness/ effectiveness of this approach appreciated.

If you are concerned about them using weak passwords, I would just focus on the complexity requirements. Force them to use a 12+ character password with special characters. A list of 65 million sounds to be relatively small, are these mostly less than 8 characters?

In consideration of a brute force attack, it doesn't matter if there is great entropy or distribution among the characterset if the length is low (8 or less characters).

You get the same bang for you buck if you just enforce client side length and complexity or "password strength checker". Probably better to put your effort into securing the storage of the password on the backend (salt, pepper, hsm, etc.) so it can't be compromised.

From the brute force perspective. If the attacker steals your DB and does an offline attack, clearly your check if not going to be of any consquence. If they are trying to do an online brute force, you can just lock the IP out after X number of failed attempts or to lock out the account if its being targeted with multiple attempts in a distributed matter and let the user reset when they want to legitimately get on. It sounds like it would be much more complex and require more resources to check against the list on each attempt to logon - possibly could lead to a denial of service on a modest web server by over taxing the system.

While it can have some value, I am not sure if users would get it. While its nice to want to try to protect them, if they want to use short passwords and you let them, they will - maybe they take their five character password and add a number - if this isn't on your list, its done nothing to help them since it's a still only six characters. So your list will detect some common passwords, but it doesn't address the core issue which is length and complexity. Trying 65 million passwords in an offline attack is no effort for an attacker with a GPU cracking rig.


What security controls should be in the API Gateway and what in the webservices? Nowadays webservices are used a lot and a "new" kind of product is in the streets: the API Gateway. This solucion is published to Internet, receives the requests for webservices from external parties and mobile apps, do some security (authentication, authorization, some products do validation of inputs, XML and JSON security, etc.) and then the request is passed to the internal webservice.

What security controls should be done in the API Gateway and what security controls should be done in the web service?

For example,

Where should be done validation of inputs?
Authentication?
Authorization? Business logic security?

Moreover, one person today asked me if we should put the API Gateway between a web application in our DMZ and our internal bus...I replied that in this scenario all the security needed should be performed by the web application so the API GW is not needed...Am I right?

An API Gateway is responsible for managing the public interface presented to external customers. It should handle low level issues like:

protocol compliance
blacklisting
rate limiting
quotas
versioning
request normalization

It can interface with:

a discovery system to know which internal web services should handle what public endpoints
a routing system to know how to translate public routes to internal routes
an authorization system to know how to translate external API tokens to internal authorization credentials, so that individual web services don't have to repeatedly ask for those themselves.

In short it should handle common issues across the public surface area of API. It should not have any knowledge of the specific business logic details of a particular web service or a particular route.

Individual web services need to validate their own inputs. Only individual services know what parameters are valid and what types those parameters can assume. However, if the web services use JSON payloads, the API Gateway can do basic JSON validation and perhaps even check payloads against JSON Schemas for them on a per-URL basis.

An API Gateway can handle authentication, as it usually can be connected to an Identity Provider, has knowledge of various authentication protocols, and can be configured to provision authorization tokens. Though often folks have their own authentication schemes and workflows that go beyond what an API Gateway provides out of the box.

An API Gateway should certainly validate authorization tokens provided by external callers, and should help simplify some aspects of access control that individual web services face by enhancing payloads with roles or rights the authorization token is entitled to. But individual services are still responsible for granular checks of those roles, and business logic security.

An API Gateway is often configured at the edge or in a DMZ, as it faces untrusted traffic and has a responsibility to transform it into a more syntactically normalized form. Web services are still responsible for semantics.

If an HTML-generating web application consumes APIs, there is a policy decision about whether that application consumes only public-facing APIs, or also can consume internal APIs directly from internal web services. There are pros and cons to both sides. The architecture emerges from that decision.


Point-to-point Microwave Security I have found online multiple references to sniffing attacks on point-to-point microwave links, either by sitting in the side lobes or on a rooftop within the line-of-sight path. However, my search on man-in-the-middle attacks on these networks has returned nothing other than occasional mentions on product pages.

Does anyone know of an injection attack on a point-to-point microwave link?

The closest I have found is a company's white paper extoling their product's encryption with a cartoon drawing of a man-in-the-middle attack (Fig.1).

Microwave is not secure physically, but then again no Layer 1 network is secure (modulo physical security like burying, hardened cables, thick walls, and armed guards).  Wireless, particularly through public airspace makes physical security a non-starter, so we have to move up the stack instead.

You enable security on top by using IPSec for Layer 3 (Network), TLS with AEAD for Layer 4 (Transport).  Other options are possible.

I would treat the microwave network like the Internet in that is untrusted and anything you put on it is assumed to be readable as sent.  This is pretty much what the white paper is advising as well.

For example you can achieve message integrity and confidentiality on an untrusted physical network by using TLS with AEAD cipher suites like TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (or many others).


"Rebuild" firmware on router Is it possible to rebuild/make firmware for a router with a backdoor for attackers? I mean If attackers get access to a home router and they're make a new firmware with backdoor in case If I will change admin panel password?

Once a machine is compromised you can't even trust its "firmware update" feature anymore as you can't be sure it really does overwrite the current, malicious firmware. The only way to be sure would be to desolder the memory chips and rewrite them from a trusted computer or flash it via JTAG.

On the other hand, those firmware-reflashing attacks aren't common unless it's a targeted attack, so I would say you have nothing to worry about unless you have actual proof that your router was compromised.


OAuth2 - Is it safe to return the access-token to the user? I'm new to OAuth (1 & 2), and I'm developing the server side of a mobile app that has a form with a "Fill Details from Google account" button. I don't need any long-range authentication\authorization.

From here (Listing 2) I understand that the server should have a controller that:

When called without a code in the query it will refer the user to get one (in an AuthorizationEndpoint such as: https://accounts.google.com/o/oauth2/auth).
When called with a code in the query, the server will send an HTTP request to the TokenEndpoint (https://accounts.google.com/o/oauth2/token) to convert the code to an access-token (using a secret-key that is passed in the request).

At this stage, my server is suppose to be able to use the access-token to fetch the user's details from https://www.googleapis.com/plus/v1/people/me - and then return the details to the user's app, to fill in its form.

Am I (the server developer) allowed to be lazy and return the access-token to the user, instead of its details? i.e., let the user app make the request to https://www.googleapis.com/plus/v1/people/me.

This will allow, in the future, to give more power to the client app without changing the code on my server.

Thanks

I think you are speaking of the implicit grant which return directly an access token to the client. You have better time to directly look at the RFC.

My thought is it is safe if you use https. If you use JWT (json web token), the access_token can be signed (JSON Web Signature (JWS)) and encrypted (JSON Web Encryption (JWE)) in the payload.


sqlmap login post problem I have an asp login form (username & password) that is SQL-injectable when the username is found in the database

For example, if I inserted

-username : foo   (foo founded in database)

-password : '.;/;

Then the result is:

  Incorrect syntax near ';'. Unclosed quotation mark after the character string ' order by dat desc '.`

Question:  In sqlmap I wrote

sqlmap --url="foo.com/login.aspx" --data="username=foo&password=.';.;."
--level=5

But the sqlmap result is: all tested parameters appear to be not injectable.

What is the wrong with my sqlmap statement?

That you can generate an error doesn't necessarily mean you can exploit it. Did you try something like

bad' or '1' = '1

Can you bypass the login?


Managing a large amount of MBSA Results? I am responsible for scanning and fixing issues on ~50 servers with Microsoft Baseline Security Analyzer (MBSA) version 2.2. Unfortunately, there is no out of the box way to manage multiple MBSA results. The only semi-official way to do this has been through the scripting examples page, and even this is not very great. It only sort of tallies the results up without giving details.

The best way I have come up with so far is changing the file extension of the MBSA results to XML and importing them into an excel spreadsheet but it is very tedious as it includes every detail, even if there is no issue, additionally this is suspicious to auditors who want "tamper free" results.

Is there a better method / procedure / program / trick to managing these results?

There is the MBSA Management Pack from MS. It provides reports and performs some of the basic tasks an MBSA admin might need to do.


Shall I enable 'send all traffic over VPN' on my Mac? I want my Mac to be as secure as possible, but I don't know if the send all traffic over VPN option is safe or not. Please can someone explain if it is more secure to enable it or not.

This depends upon what threats you are trying to mitigate against.  By using a VPN you are essentially changing then end point of you traffic, or where it connects to the Internet.  If you are using an insecure WiFi connection this will encrypt and thus protect all of your traffic that traverses the wireless network.  This is significantly more secure then passing all of your Internet traffic over and open/insecure network.  However you are only moving the "on ramp" that you are using to connect to the Internet.  If you are concerned with your Internet Service Provider monitoring your connections to particular networks this is also a good technique to use.  Using a VPN will not however give you and end to end secure connection, so if you are using insecure protocols such as HTTP or email in plain text then you are just as insecure once that traffic reaches the public Internet.  Using a layered approach including multiple layers of encryption both at the protocol level and at the network level (VPN) afford you the most security.


If an RSS feed handles quotes and HTML tags incorrectly, can it be considered a security risk? I'm trying to encourage an organization to fix their RSS feed, which has numerous problems with the way quotes and tags in the source text are displayed in feed readers. I'd like to be able to tell them that their feed constitutes a security risk for readers, because I think that might get their attention.

Here are a few of the issues I've documented:

spurious extended characters
pieces of random HTML markup
missing characters, including entire paragraphs at times
quote characters almost never appear (especially apostrophes)
missing spaces between words

Sometimes a post will be so messed up that I get page after page of garbage.

I've tested several feed readers, on Windows and Mac systems, and the problems appeared in all tests. The same material looks fine when viewed on the source page.

Assuming the answer is yes, how might the risk affect users?

By itself, malformed HTML is probably not placing their users at risk of anything other than developing an aversion to an amateurish, ugly feed. It's probably caused by an automated Word-to-HTML or PDF-to-HTML converter, but by themselves those won't create risk for their readers.

Do they include user-submitted data in their feed? If so, they could subject their users to a CSRF or XSS attack.  Or they might be susceptible to script injection.  But if so, those could be vulnerabilities regardless of whether or not the rest of their HTML is well formed.  The fact that they don't test their feeds or care about their image may give their clients the impression they don't care about other issues such as security or data safety; but it's not proof of negligence.

Don't use 'security' as a stick unless you have more concrete evidence of a vulnerability. Instead, let them know their company image is coming across poorly. When you raise the stakes, you could say "if you don't care about this, why should I believe that you care about other things, like the safety of my data?" If they still do nothing, I suggest you look elsewhere for your source of topical news. There are millions of other web sites, some of which might serve you better.


Is Blowfish validated against any standards? OWASP ASVS 3.0 V7.7 states the following:

  Verify that cryptographic algorithms used by the application have been validated against FIPS 140-2 or an equivalent standard.

Blowfish is not included in NISTs database of FIPS 140 validated modules. Has it been validated against another standard?

Blowfish is an algorithm. An algorithm isn't validated against anything. What is validated is an implementation of an algorithm.

Blowfish isn't defined by any text that calls itself a standard, as far as I know. The original paper is the closest thing to an official specification. The author has also published test vectors.

You should not use Blowfish because it is weak for some applications. Better alternatives exist: AES, CAMELLIA, ChaCha... Blowfish's main flaw is that it has a 64-bit block size, which allows some attacks with a cost of only about 4 billion calculations, like Sweet32 for DES.

You should take this particular piece of advice with a grain of salt. Having an implementation that comes with an official FIPS 140 compliance stamp is actually a bad thing! The reason is that getting the official stamp is slow and expensive, and any bug fix requires going through this process again. So having an official FIPS 140 compliance stamp practically guarantees that your code has known bugs.

Additionally, FIPS 140 comes in several levels, and level 1 only states that the implementation performs its calculations correctly when given good input. That's all. Only levels 2 and above include some security requirements. Note that the “2” in FIPS 140-2 is the version of the specification, not the level.

What is important is:

Choose an algorithm that is well-known, and that is codified by some standard. This can be a government standard such as NIST publications, or an IEEE standard, or an IETF RFC, etc. Never use an in-house or recently-published algorithm. Always give the cryptographic research community a few years to try to break an algorithm before you start using it.
Pay attention to the security parameters and security properties (key size, block size, resistance against common attack techniques, …). Some standards permit obsolete or deprecated choices for backward compatibility.
Choose an implementation that has been, at a minimum, functionally validated against official test vectors. Preferably the implementation should come with interoperability tests that run against a well-known implementation such as the one by the author of the algorithm.
Choose an implementation that has undergone a security review.
Make sure that you have a process for keeping all copies of the software updated with the latest bug fixes.


Are EMV terminals required to support offline PIN as well as online PIN in US market? It is my understanding that in the US 100% of EMV transactions (contact and contactless) are expected to be performed online.  If so, why would a payment gateway be requiring a US terminal to support offline PIN (if online is offered) for CVM?

The short answer is international interoperability.

Not all countries joined the EMV band-wagon at the same time, and hence different countries support different types CVMs. Many markets still only support Offline PIN, or even Signature.

Hence, both cards and terminals support multiple CVMs, but do so in a prioritized order. The idea is that the card and terminal negotiate the highest common CVM that both support, in order to carry out a transaction.

If the American terminals only supported Online PIN, then travellers might fail to transact there, since they their cards might not support Online PIN. This could be a valid decision, but in some areas (like retail at airports) this is unacceptable.

Similarly if Americans went to overseas to countries where Online PIN is not supported, they'd expect their cards to support either Offline PIN or signature in order to facilitate payments there.

This gives most customers the best chance of at least transacting -- albeit with a 'lower' CVM.


I installed a windows app that stores cookies in a plain text un-encrypted database. Is this a problem? I have recently installed an application that was developed with Electron that requires I authorize via Google to use the application.

I did this at the same time as monitoring the application with procmon and seeing what the application does. It appears to write to a SQLite3 database stored in AppData/Roaming on Windows.

The database is not encrypted or password protected but contains sensitive cookies such as .google.com NID xxxxxxx and HSID and LSID values.

This concerns me because I can use these values to make requests to Google which could be used to mimic my identity.

Edit

I took the values and I replicated a Google request by replaced the values in the database and I could successfully make a request to a Google service. In my example I used returned my recent Google activity in JSON form. After more testing I was also able to view my contacts and perform other actions.

I am not a Windows user or Windows developer but this strikes me as strange as this database is readable which means a rouge application/user could read this and the fact I can replicate requests worries me. Surely apps are supposed to use API's for this and not storing users cookies? Basically this app undermines the security of my Google service.

I know Chrome stores it's cookies in a SQLite database but there is at least some level encryption there because cookies are encryption. But, they're not for this applications database. My Brave browser's database for example is protected by SQLCipher.

Is this a security concern and if so what category does it fall under?

EDIT: Based on your comment, it sounds like your concern might be less "why are these secrets not encrypted?" and more "why is this app storing full Google session tokens instead of using OAuth to get restricted-access tokens?" That is a perfectly valid criticism of the software; it is highly unlikely that it needs more access than it could get through OAuth, and using OAuth is more secure because in the event that the token (or the app itself) gets compromised, it can do less harm to your account and it is easier to tell what happened and close off access.

Just don't expect the access token or refresh token to be stored encrypted, unless the app asks you for a password every time you launch it (and even then, it's possible for a malicious program to steal the tokens anyhow). There are some apps for which the extra security gained from demanding a password on every launch is worth the hassle (password manager apps/extensions like LastPass or encryption tools like gpg often do this, for example). Unless that's happening, anything else that is done to the secrets is basically obfuscation, not security.

The standard security model for Windows (and other modern general-purpose operating systems) assumes that any code you run is trusted to have whatever privileges you run it with. In other words, if you don't trust a program with access to your saved cookies (and all major browsers store cookies either in plain text or easily decryptable by a running program), then either run it in a sandbox that has limited access to the file system (such as a Windows Store app on Win8+, or the highly-restrictive sandbox Chrome uses for its renderer processes), run it under a different user (standard users cannot read the contents of another user's profile directory, including the AppData directory), or don't run it at all. "Full-trust" (non-sandboxed) apps running under the same user account do not, and cannot, keep secrets from one another; the burden is on the user to not run such full-trust software unless you do, in fact, trust it.

While it might give you some peace of mind if the cookies were encrypted, what encryption key would you use, and where would it be stored? You'd either need to enter a password to generate a key every time you launch the app, or the key would need to be stored in such a way that any other programs running under your account could also access the key and then access the files (there is no such thing as data that only one program could ever read). For that matter, if you run a malicious program under your account, it could simply attach to the Electron app as a debugger and read its secrets straight out of memory.

If you're concerned that somebody running software outside of your account - for example, a privileged process that can read into other users' home directories, or another operating system entirely (such as a thief might use to bypass Windows' protections and try to steal data from your hard disk), you could use encryption to defeat that. Windows offers three main ways to do this: DPAPI (Data Protection API), EFS (Encrypting File System) and BitLocker Full Volume Encryption. DPAPI encrypts or decrypts arbitrary blobs of data with a key that is protected by the user's password; a program must specifically request the data be encrypted or decrypted but doesn't have to supply a key because if the program is running under a logged-in Windows session, the user's key is used (if the program is not running under the user that encrypted the data, this won't work). EFS encrypts specific files (setting it for a directory encrypts all the files within that directory) also using a key protected by your Windows password, but transparently decrypts the data on read (and re-encrypts on write) for processes running under your account. So long as an attacker cannot guess / brute-force your password the data is safe, but malicious software that you run (or that an attacker runs after compromising a program you ran) can still read the data. BitLocker encrypts the entire hard disk (aside from a small bit containing some boot code to enable decrypting the rest) and can be set up to require a password when the computer boots to Windows, but once Windows is running, any software (not just software under your account) will be able to access the disk; BitLocker only protects against offline attacks.

EDIT 2: You mentioned Chrome's encryption of cookies. Chrome uses DPAPI (on Windows), which uses your password as a key protector much like EFS does. On OSX, it uses a password-derived key and stores the password in the Keychain, which I believe is also protected by the user's password (though I may be wrong). On Linux, Chrome apparently uses the static, hardcoded password "peanuts" to derive the encryption key. Security-wise, that last approach is worth exactly "peanuts", so at least the "password" is appropriate. Also added DPAPI to the main response.


Never believed BadBios...but do now...is there help? After lengthy efforts to remove multiple malware issues off of 6 laptops, the strange behaviour is an accurate depiction of "badBios", something I never believed true. My current experiences have changed this view.

Can you please help with directions to information so that I can develop an appropriate strategy. Economics prevent scrapping the infected machines.

If the device is truly infected at BIOS level or below then I would be hesitant to say you could ever trust the device again. The normal methods for replacing the firmware involve interaction with said firmware. I.e. how do you know it actually does it? Or that it doesn't patch the infection back in? Meanwhile most traditional malware writers are not going to bother infecting firmware - the economics of the effort required vs payoff aren't worth it. So you have to assume an extremely skilled and motivated party is behind it.

Unless you knew where the machine was infected you would have to re-flash every piece of storage on the device using a method which does not involve the existing firmware. For some parts there will be hardware pins which can be used to write directly to storage. For others you might have to desolder the flash, write it then re-solder it back. Unless you already had the equipment required for this I expect you'd find your economics would take you back to replacing the hardware.

However I find it extremely unlikely these machines are infected at this level. Economics mean malware this sophisticated doesn't make sense for targeting mass infection. And were you the type of party that is likely to be targeted (state actor, large corporate etc.) you would not have questioned the economics of replacing the machines.

I would suggest obtaining known to be clean OS installation media, formatting the entire disk(/s) and reinstalling the OS, fully updating it and installing an appropriate anti-virus product. I would then fully review other software you are considering installing before doing so and not inserting any media which has touched the machines while infected. If files need to be backed up and recovered start recovery to a single machine. Once that is confirmed not to have been infected you can recover to the others. As an added precaution you could use a live-USB with a different operating system to copy the files to the clean machine. You could also run a full virus/malware scan on the backup from that other OS before recovery.


How can I found a source of HTTP request in Wireshark? There are weird requests to/from the AWS:

and another one to/from 177.143.198.104.bc.googleusercontent.com:

( http://whois.domaintools.com/177.143.198.104 )

I use Ubuntu 18.04 Desktop, web browsers are turned off. How can I found a source? I mean, what program/script does it run.

In Linux the command

netstat -anp

Will list all network connections and will include the ip, port , and program name

So in wireshark you can find the ip and port for the web request

Then run netstat and search for that ip and port to find the program using it


Importance of a short expire time on JWTs We are currently using JSON web tokens for authentication for our website's API. We use 1 hour short-lived access tokens that get refreshed using a permanent revocable refresh token.
Now we want to add an account + login system to the website and tie it to the API usage. However, we are currently debating on the security of this.

The naive implementation would be just a 3 hour access token for a session and something like 2 weeks expire time if the user chooses the "stay logged in" option. However, this would kinda make the short expire time useless. In case the tokens get leaked you have an attack window of two entire weeks.
The alternative we thought of would be some kind of "proxy" that checks if the token is expired and refreshes automatically with the refresh token in localstorage or as a cookie.

Would the naive version be an acceptable implementation or are the security risks too high?

It depends on the requirements of the host and network that you're in .

As with any password an JWT/cookie or whatever it may be, the longer the item is available without change the more time a hacker has for it to be broken.

I personally have my JWTs secret generated with a random key upon the web application starting.

I set a life span on JWTs to be no longer than 5 hours. You can also look for other items in the cookie like OS, browser , IP address ect. It depends on how you want to handle it.

You can have all JWTs killed at the end of office hours too.

  3 hour access token for a session and something like 2 weeks expire time if the user chooses the "stay logged in" option.However, this would kinda make the short expire time useless.

I agree. Encourage users to utilize lastpass or keypass might be an option. I personally thinking that logging in once every 5 hrs is not an inconvenience and is a cheap cost for doing business.

Let me know if this answers your question or helps.


Risk in not expiring an "unsubscribe" link Are there any risks with an "unsubscribe" link in e-mails that never expires?

The e-mails are sent to customers.  The token used to unsubscribe the customer will include a customer ID encoded using JSON Web Tokens (JWT) tokens.

Thanks

I can not see any real disadvantage for your users.  The worst that could happen to them would be to have to resubscribe.

Note that with the current efforts put in anti-SPAM regulations and controls, every one with a mailing list should be extremely careful to properly maintain it.  You certainly much prefer to have someone opt-out than having them report your message as SPAM.


When, during authentication, should I ask for an OTP token? I was working on implementing an OTP strategy in our login process of a web application when I was asking myself: Should I ask for the OTP token before or after asking for the username/password?

What I generally see with services I use is, I have to provide the OTP token after they've verified my username/password.

I was wondering if this was just due to user experience decisions or if there was a security aspect to it.

From a security perspective, it makes sense to ask at the same time -- that way, an attacker doesn't know what they got wrong. With some services (e.g. Google), the OTP has another option to send a text message, so from a UX perspective, putting it after the password cuts back on spurious texts.


Is there a way to overwrite a file being used by a service without service management permissions? I am trying to demo an exploit and here is the scenario:

A service is running with SYSTEM privileges where the executable it is running (binpath) can be modified by any user. The exploit consists of replacing the target binary with a malicious one so that on startup of the machine the malicious executable is launched with SYSTEM privileges instead of the original one. The problem here however, is that the service binary can't be replaced as it is being used by the service in question while the computer is running. Typically only admins can stop services so stopping the service before switching the binaries would make the demo kind of moot.

My question is:

Is there a way to replace the binary (which I have full permissions to) without permissions to stop the service?

Generally, binaries can be renamed while they are executing, unless the process (or some other process) explicitly prevents this. Simply rename the binary and then drop a malicious one in with the old name. When the computer reboots (or the service restarts), it'll run your version.

Another approach is DLL planting. Find a DLL that the app uses (ideally not a system DLL, and definitely not one that is loaded only as a resource file) that is not being loaded by explicit path, and replace it with a malicious version. You can either use the renaming trick mentioned above, or simply take a DLL that is normally loaded from another location (such as System32) and put your malicious copy in the service's install directory (or working directory, if different that's writable).

Actually weaponizing this is left as an exercise to the reader, of course, but I think it's important to post this answer because a lot of people don't realize that executing a Windows binary does NOT inherently prevent the binary from being renamed.


Trusted Timestamping Scope and Real-World Uses What security assurances does Trusted Timestamping based on Cryotography provide?

What are the real-world uses of Trusted Timestamping?

Time stamping is meant to provide a verifiable proof that a given piece of data "existed" at some past date. One widespread time stamping protocol is described in RFC 3161: technically, the TSA (Time Stamping Authority) computes a digital signature on a structure which includes the current date (at the time of signature, as known by the TSA) and a hash value computed over the data which is to be time-stamped. The time stamp is a "proof" in a legal sense as long as there are mechanisms with appropriate legal value that guarantee that the TSA has a correct source for the current date and time, that its private key is properly protected and never used to sign fake time stamp structured, and that the purported TSA public key (used to verify the time stamp) is really the genuine key owned by the TSA. PKI may be involved.

A simple use of time stamping is to establish a proof of anteriority: the digital equivalent of a Soleau envelope. Time stamping is also a critical component of long-term archival of digitally signed data: digital signatures tend to "expire" (because, generically, the validity of a digital signature, as a kind of proof, depends on the continuous exclusive control of the private key by the signer, which is hard to maintain for extended period of times -- thus, certificates have an "end of validity" date). See ERS and CAdES for examples of how time stamping is used in such a context.

Legal frameworks on time stamping vary, depending on the country. In France, there is a state-managed registry for time stamping authorities and systems which can be viewed as a kind of diploma for TSA who "do it right" (in a very French, state-centralized way).

Authenticode can embed time stamps. PDF files can also be time stamped in a way which is already supported by Acrobat Reader, along the PAdES format (a PDF equivalent of CAdES).


how to secure open securedoc.html? I got call from revenue and asked them confirmation that's it's call actually from them.

They sent me email (I check Gmail original and it's actually from revenu) with securedoc.html

I need to open this attachment to read secure message.

But I'm not sure if it's secure to open html from your local drive. I read the the following discussion:

  The browser has a security sandbox. When you visit a site, that
  sandbox only permits code on that site to access content on the same
  domain. If you run html from your machine, then the sandbox now
  includes your filesystem - and thus can be used to access anything the
  user can.

Can I open html secure? Maybe in incognito mode?

I saw similar question, but it's about email from unfamiliar sources, in my case I know source.

Secure messaging of this nature is indeed a real thing used legitimately. However, criminals know this and may well try to imitate a real secure message to lure their target(s) into opening unsafe attachments.

If you have verified the sender's address, then you are probably safe. But if you would prefer to take a cautious approach you could open the HTML file in a text editor such as Notepad. You can then read the HTML source code and view any scripts/links embedded within it without actually executing anything.

With regard to browser sandboxing, that point is accurate as far as I know. Regardless, there are ways a capable attacker can escape a browser sandbox (although publicly disclosed methods are quickly patched to prevent exploitation).


RAM memory data remanence and double boot, risky? I wonder if my setup can be risky. To give a good starting point for answers I would briefly sketch the situation

setup:

double boot system GNU/Linux and Microsoft Windows
GNU/Linux is on 2 partitions which are both LUKS encrypted using AES cipher with a considered "safe" block-chaining mode and keylength
Windows is not encrypted and distrusted anyway (I use it to run skype)
Latop computer (Lenovo Thinkpad) with a battery (if that matters to RAM or not)
The boot partition with GRUP and KERNEL is on a SD-Card not plugged while Windows runs. (Clearly it needs to be plaintext)

situation:

Generally work's done in Linux ( which can work with the encrypted partitions because I supply the key during the boot; no swap partition; yet an tmpfs for /tmp)
When I want to Skype I reboot the computer (having ejected the SD with the bootloader and kernel) and start Windows

I assume that in such a case the RAM is still absolutely readable and hence the key for decrypting and accessing the encrypted linux is still somewhere in the RAM? Additionally all the data of /tmp/ is initially still there?

An answer would confirm if this is reasonable to assume!
An even better answer would include (assuming the risk exists) ideas how to remedy this (at present I shutdown and take out the battery for 2-20 secs).

Maybe there is no risk, because Linux does overwrite the RAM at shutdown to avoid
a "cold boot attack" (as suggested in [this question][1])?

Also I thought I have additional risk as distrusted Mircosoft Software can help attackers to access my hardware and hence even without accessing directly my linux partition (by retrieval of the cipher-key via "cold boot attack") firmware can be changed to attack my system.
I am not paranoid about that (though it might seem) and aware that firmware has always been a "risky business" I just think that having the double boot I invite a constant update of this risk, while GNU/Linux in theory would make an update of potential firmware spy mechanisms much harder.

There is a Linux version of Skype however, I wouldn't recommend running it on bare metal. Have you considered running a virtual machine on your main Linux system (either Windows or Linux) and running Skype inside that? This way the software inside the virtual machine cannot access the ram of the host.

  I assume that in such a case the RAM is still absolutely readable and hence the key for decrypting and accessing the encrypted linux is still somewhere in the RAM?

This is a possibility. You may be interested in tresor which stores the encryption key inside a CPU register instead of in RAM.
http://linuxaria.com/howto/protect-linux-from-cold-boot-attacks-with-tresor?lang=en


Unable to completely enforce password policy PCI DSS has a few requirements regarding the password policy (like remember last four passwords, change password every 90 days, use at least seven  numeric and
alphabetic characters and more).

These requirements are easily enforced as soon as the systems are connected to a centralized user management system (like Active Directory) or the vendor provides the ability to enforce it locally.

In case i have a system that i can't locally enforce the password policy or can't connect to AD, i will need to fill a compensating control worksheet.

My question is, can you advice controls that will effectively provide answer to the gap created by the lack of ability to enforce password history and maximum age ?

There is one compensating control you can implement:
Don't allow the users to select password, instead, change the password to a random one each time the user selects to change password. Of course, only the user should know the random password, thus this password will not count as a "initial password" that needs to be immediately changed.

Second thing you can do, to solve this problem for systems that does not support password policies, are the following:

You can fulfill the policy by requiring password changes to go through a administrator or IT Desk, that will ensure the password meets the policy.

This can be implemented by splitting the password in 2.
The first half of password, you must submit to the administrator or IT Desk. The first half must meet the requirements, which the administrator or IT Desk verify.
Of course, the administrator or IT Desk should have a procedure to destroy any passwords after the change, using for example a shredder.

The second half is freeform and must, say, contain at least 8 charachters. This is not revealed to administrator or IT Desk. This part of password does not need to meet any policy.

The password change for users are then organized, that the user come to the administrator or IT Desk, and ask for have their password to X system changed.
They have to tell or write down the first part of password, and show to the desk. Then the IT Desk or administrator will ensure the shown part of password is fullfilling the policy. The IT Desk or administrator will then type in the first part of password in the change password dialog.

Then the user has to type the second part, without the IT Desk or administrator looking. The user should of course not be able to erase or change any part of the password typed by the IT Desk, nor be able to move on without their permission.
(This can be accomplished by disabling all function keys, eg backspace, tab, insert, delete, enter, alt, ctrl, and such on the keyboard, requiring a mouse to disable the lock, and the mouse is unplugged and taken away when its time for the user to enter his part)

After the user has typed the second part, the IT Desk or administrators, which cannot see the complete password because it show up as "***************", will then type the first part again, but in the "Verify password dialog".
The process repeats again with the user typing the second part again.

Then the IT administrator or IT desk press "Submit" and password is changed.

This fullfils all the requirements by the PCI DSS, but also ensures the IT Desk or administrator cannot know indivual user passwords, and also allows the IT Desk or administrator to verify that the first part of password fullfills PCI DSS rules, and also ensure it does not matches the 4 last passwords. The 4 last passwords can be stored as hashes, and the IT Desk or administrator will first hash the first part and check it don't match the 4 last hashes.

Using this scheme, you don't need to file any compensating control.

Third thing you can do, is to implement a single-sign on solution, where users are using their regular windows passwords, to sign on to services not supporting password policies. This is normally then accomplished by having the single-sign on solution set a very long, and very secure, random password, and then this password is used between the single-sign on software and the service not supporting password policies. This password can be regarded as a "key", which in PCI DSS have longer change durations (1 year is for key rotation in PCI DSS) and this "key" is used between the single-sign on solution and the service in question.


Is VPN needed when using https? Some YouTube videos have sponsors who claim "your banking can be stolen if you connect to unsafe networks like airports and hotels"

If using https, and hsts, and verifying the certificate is valid, are my connection safe, if not using vpn?

If using https, and hsts, and verifying the certificate is valid, are my connection safe, if not using vpn?

If you are using HTTPS with a valid certificate, then Transport Layer Security (TLS, née SSL) is likely adequately protecting your communication with the server that sent the certificate.

An attacker on the network may still be able to see things like the IP address of the server you are communicating with (or other header data below the application layer). But the application layer data (in this case the HTTP data and headers) will be encrypted with TLS (the S in HTTPS) and thus the network attacker will not be able to see that data.

In other words, for the most part, yes it is safe without VPN.

The above statement is subject to the usual caveat that threat models will vary. E.g., if an attacker has access to your computer and can run, say, super user processes on your local machine, then they can likely steal your data prior to TLS encryption. Additionally, if you are not positive that the certificate is valid, then the above mentioned safety would not apply. Etc.


Web authentication - password vs key file There is a corporate web mail site (PHP + MySQL) for limited numbers of users who are employees of a company working remotely with the corporate web portal. Each user has a login and password.

I'm thinking about replacing usual text passwords with a key file, i.e. user choose any file to be the key at his first logon, it can be a text file or even a picture, the checksum of that file gets stored in the database and at next time such a user needs to loging he uploads his key file instead of typing a password. Would such authentication be more secure than a password typing? I guess it is much harder to figure out a key file than a password.

The main problem with a key file is that it is a file. As such, it is stored somewhere, on some physical medium. It will be copied with backups. The file will still be there on discard hard disks. Users will copy their files to several devices in order to be able to log from all these devices. To sum up, files leak.

Conversely, a password fits in a brain and needs not be written anywhere; the user naturally moves it around with him; passwords don't leak to backup tapes and old disks. Last but not least, password entry works well on mobile phones, whereas file upload can be more technologically challenging.

So while a secret file can contain a lot more secrecy than a mind-powered password, it also tends to be a lot less "secret" and to imply usability issues. Overall, the "secret file" method does not seem to be more secure, in a generic way, than passwords.

Another way to see it: a "secret file" is equivalent, from a security point of view, to a text file that contains a big fat and random password, that the user reads when he wants to log in (and possibly "types" the password with a copy&paste). Every argument against writing down a password in a text file equally applies to your "secret file" idea.


What problem would there be with an open private key for developers to use? I always find it a pain to create a new key for development and I was thinking of doing something like this both for myself and to help other developers out:

Register a domain like fakesite.com
Get a wildcard ssl certificate
Make both the certificate and private key files available to the public
Test my sites locally by adding entries to my host files for whatever I want to test (i.e. api.fakesite.com, www.fakesite.com, etc.) either pointing to 127.0.0.1 or to my ip on my local network and using the publicly available certificate and private key.

fakesite.com would send all subdomains to one page on the main website which would explain what it was for.  The actual certificate and private key would be made available elsewhere such as in a github repository.

The only problems I could think of would be

1) Attacker can perform a MITM attack rerouting your DNS to their website, which they can make look secure by using the publicly available 'private key', and trick you into browsing to a web page like 'citibank.fakesite.com' and entering your information.

2) As a developer I mistype a url and sent traffic to apu.fakesite.com, which is being used like above so they can capture the traffic I was meaning to send to my local computer

It actually seems more secure for me as a developer than creating a self-signed certificate using publicly available tools and having the key sitting around on my hard drive for my tools to use.  If anyone got that, they could spoof any website for me because I have to trust it, right?

By using someplace like letsencrypt for the authority, they can say my certificate/key is only valid for that one domain, which should only be used for local testing and development.

Are there issues I'm not thinking about, or is #1 likely enough that this would be a bad idea?

I have the feeling that you are trying to tackle the problem you have from the wrong end:

  I always find it a pain to create a new key for development ...

I'm not sure what you are doing which causes so much pain, but if you are doing the same steps again and again it might be actually useful to find a way to automate these steps for yourself.

  It actually seems more secure for me as a developer than creating a self-signed certificate using publicly available tools and having the key sitting around on my hard drive for my tools to use. If anyone got that, they could spoof any website for me because I have to trust it, right?

If I interpret this correctly you are creating a self-signed server certificate with basic constraints CA true (i.e. this certificate can be used to issue certificates). It is correct that this can be used to create more certificate and thus access to the certificate and its key can be used to man-in-the-middle all sites - provided that you've imported this certificate as trusted CA (certificate authority) instead of a trusted server certificate. Note that just adding an exception once the browser complains will not add this certificate as certificate authority.

It also would mean that the attacker needs to have access to your system in the first place - in which case it might do even more harm. Nevertheless, this particular problem can be easily mitigated:

Most (all?) browsers actually can import a self-signed server certificate which has basic constraints CA false. There are though tools which cannot deal with this and expect CA true on a self-signed certificate.
One could create a CA with its own private key, let it issue some leaf certificates (basic constraints CA false) with another private key and then throw the private key of the CA away. The CA can still be imported as trusted into the browser so that all certificates issued by this CA will be trusted too. Since the private key of the CA is deleted one cannot create more certificates though.

  fakesite.com would send all subdomains to one page on the main website which would explain what it was for. The actual certificate and private key would be made available elsewhere such as in a github repository.

It is not a good idea to use a publicly available domain for this. The problem is that it is insecure by default, i.e. the browser will resolve the domain and try to connect to it and man in the middle attacks to the domain will not be detected since everybody knows the private key to mount invisible attacks. And then the attacker could do the attacks you've already described and maybe more.

Fortunately the public CA which has issued the certificate would revoke the certificate anyway if the private key gets known publicly and thus this idea would not work (provided that the browsers check for revocation - which many don't or don't do properly).

But the general idea could be modified to be safer. If one simply uses a domain which will never exist publicly, a browser can only connect to the domain if the system is specifically setup for this. RFC 2606 defines some top level domains which might be used for this, i.e. .example, .test, .invalid and .localhost. When using any of these top level domains an attacker could only harm developer systems which are specifically setup to resolve such domains and which have explicitly imported this certificate as a trusted server certificate, instead of being able to harm arbitrary systems.


Tracking script creates vulnerability I am using a third party service that provided a tracking script which when embedded in the page seems to create some kind of vulnerability as occasionally people are redirected to a phising link instead. Big flashy text pretend microsoft login that kind of thing.

This is the script:

<script type="text/javascript">
piAId = '<redacted>';
piCId = '<redacted>';
piHostname = 'pi.pardot.com';

(function() {
            function async_load(){
                            var s = document.createElement('script'); s.type = 'text/javascript';
                            s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + 'pardot.com/pd.js';
                            var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c);
            }
            if(window.attachEvent) { window.attachEvent('onload', async_load); }
            else { window.addEventListener('load', async_load, false); }
})();
</script>

Is the issue with the script itself or the hosting configuration allowing this to be manipulated?

There is something funky about this script.

('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + 'pardot.com/pd.js'

This expression produces the urls pipardot.com and cdnpardot.com which appear to be registered to not pardot.com. The script is bad, and wherever you got the script from is also bad.

It may also have been good from the original source, but edited by another exploit on your web server.


Can malware affect storage devices lower than mbr I found the worm rammit on one of my windows computers so I'm a bit paranoid now about all my dated usb, hdds, etc.  Does malware commonly affect devices lower than the mbr. For instance is

shred /dev/sda
fdisk -u /dev/sda
mkfs /dev/sda1

going to take care of all common malware?

Can malware affect storage devices lower than MBR

Yes, it can.  Infection of firmware has been part of several APT (nation-state level) hacks, such as Stuxnet and Equation Group tools.

  Does malware commonly affect devices lower than the MBR

Commonly?  No, not yet, probably because targeting specific hardware is not as generic as targeting higher-level operating systems, and "common" malware wants to run widely.  You probably do not have to worry about it.


Are there DNS analysis tools that could detect bad DNS results? Are there any tools (or at least methods that would work, if no free tools currently exist) which one could use to detect false DNS results?

It would be very simply to detect an attack along the lines of DNSChanger (just alert the user if the DNS server ip has been changed) but suppose a system like DNSChanger had worked by proxying your DNS queries and editing them on the fly.. how could you detect this?

I'm not aware of any tools, and I'm not sure how effective they would be. If you got enough privileges to change the DNS servers of a system, you can probably also disable any anti-malware programs.

If you still want to, you could easily write a script that does the following:

Query for the domain you want to be sure is correct, using the system's DNS servers
Query a trusted DNS server for the same domain
Query a second trusted DNS server for the same domain

From which you can conclude:

If they all give the same IP, it's probably legit.
If the trusted DNS servers give the same IP but yours doesn't, something is wrong
If they all give different IPs, the nameserver of the target domain uses round-robin or split horizon

This is, like with almost everything, not entirely safe. Like I said, malware needs a lot of privileges to do this, it's not unthinkable that it spoofs the IP for trusted servers like OpenDNS or Google's public DNS, making them appear to return the same answer as the malware server.

Probably the only way to ensure you are talking to trusted DNS servers, is by using DNSSEC.


Stack address is shown less than heap address in C program I am learning binary exploitation from "Hacking: The Art of Exploitation". In theory the address of an element of stack should be higher than the address of an element on heap. But in this program I am getting the address of stack_var is lower than that of heap_var. I am using Ubuntu 18.04.2 LTS with AMD Ryzen 5 2500u processor.

#include <stdio.h>

int global_var;
int global_initialized_var = 5;

void function(){
    int stack_var;

    printf("the function's stack_var is at address 0x%08x\n", &stack_var);
}

int main(){
    int stack_var;
    static int static_initialized_var = 5;
    static int static_var;
    int *heap_var_ptr;

    heap_var_ptr = (int *) malloc(4);

    //These variables are in data segment
    printf("global_initialized_var is at address 0x%08x\n", &global_initialized_var);
    printf("static_initialized_var is at address 0x%08x\n", &static_initialized_var);

    //These variables are in bss segment
    printf("static_var is at address 0x%08x\n", &static_var);
    printf("global_var is at address 0x%08x\n", &global_var);

    //This variable is in heap segment
    printf("heap_var is at address 0x%08x\n", heap_var_ptr);

    //These variables are in stack segment
    printf("stack_var is at address 0x%08x\n", &stack_var);
    function();
}

Output:

global_initialized_var is at address 0x91d2f010
static_initialized_var is at address 0x91d2f014
static_var is at address 0x91d2f01c
global_var is at address 0x91d2f020
heap_var is at address 0x9292b260
stack_var is at address 0x242e2bec
the function's stack_var is at address 0x242e2bc4

As you have spotted, with %p it works as expected.

The explanation at the source of your situation is that %x reads integers (whose size is 4 bytes) out from pointers (whose size is 8 bytes on your architecture).
So, you are simply asking printf to read the first 4 bytes of the pointer, neglecting the rest 4. You may change your format to "0x%016lx" to format pointers with leading zeros.

In those cases where the pointer is small enough to fit in 4 bytes, you see them (haphazardly) correctly because the least significant bytes are stored as first due to the fact that your architecture is little-endian.


SQL injection -- why isn't escape quotes safe anymore? Raw SQL

When you're writing SQL -- for anything that takes human input really, a lot of things have been done to avoid the injection.

Everyone that's heard of SQL injection knows that (I'm going to use PHP as a sample) doing something like this isn't safe:

$sql = "SELECT * FROM `users`
.  WHERE `userName` = "{$_POST["username"]}"
.  AND `pass` = "{$_POST["pass"]}";";

Magic

Then of course, someone came out with the idea of using "magic escape quotes" to deal with program input that wasn't sanitized correctly and directly put into sql as a result of bad practices. This didn't really solve the issue with SQL injection, but it did mean all user input got mangled up.

Adding slashes

So, some people turned off magic quotes. Then, they parsed user input before the point of SQL through addslashes() which in theory escapes all the quotes and your hacker can't do ' OR 1=1, but even the documentation for addslashes it's self say that you shouldn't use addslashes, it says use the database-specific function such as mysql_real_escape_string(), but this is still said to not be enough by some.

Adding slashes specific to Database

So, we can't use DBMS specific *_real_escape_string, we can't use add slashes, the "magic quotes" thing caused lots of issues, and the web is full of short worded quotes such as:

  "A dedicated hacker will find a way to
  jump through your quote-escaping loops,
  just use the DBAL prepared statements" - John Q any programmer

Okay, so that scared me enough to use prepare statements and a DBAL. It didn't really explain anything, but it sounds good because I've heard it a lot.

Prepared statements

So now we're using PDO, or a DBAL from a framework, or something else that wraps all our sql and makes sure someone can't run an sql injection.

My question is basically a "why not?", not a "what should I use?". The web's full of people telling you to use this or use that or whatever, but no explanations of why these things had to happen.

Direct questions

Pointed questions (reminder, I'm asking about SQL, PHP was an example language because of it's bad rep around SQL, concepts are universal):

Why can't we escape all user input using "magic" ?
Why wasn't addslashes "good enough"?
Whats wrong with using DB-specific escape functions, and why was it better than addslashes?
Why are prepared statements with frameworks and PDO being hailed as the gold standard of SQL? Why are they better? Why can't I do an SQL injection with these, where as I COULD have with the previously mentioned means? Can a programmer not somehow manage to still screw this up? What should they look out for?
Any other concerns I haven't brought up?

Why can't we escape all user input using "magic"?

At the time the magic is applied, it is unknown where the data will end up. So magic quotes are destroying data that, unless it is written unescaped to a database.

It may just be used in the HTML response sent back to the client. Think of a form that has not beem filled in completely and is therefore shown again to the user. With magic quotes, the data entered on the first attempt will now be SQL escaped, which is meaningless on an HTML page. Even worse: on the second submission the data is SQL escaped again.

  Why wasn't addslashes "good enough"?

It has issues with multibyte characters:

' 27
\ 5c
뼧 bf 5c

Those are two bytes, but only one Unicode character.

Since addslashes does not know anything about Unicode, it converts the input bf 27 to bf 5c 27. If this is read by a Unicode-aware program, it is seen as 뼧'. Boom.

There is a good explanation of this issue at http://shiflett.org/blog/2006/jan/addslashes-versus-mysql-real-escape-string

  Whats wrong with using DB-specific escape functions, and why was it better than addslashes?

They are better because they ensure that the escaping interprets the data in the same way the database does (see the last question).

From a security point of view, they are okay if you use them for every single database input. But they have the risk that you may forget either of them somewhere.

Edit: As getahobby added: Or that you use xxx_escape_strings for numbers without adding quotation marks around them in the SQL statement and without ensuring that they are actual numbers by casting or converting the input to the appropriate data type /Edit

From a software development perspective they are bad because they make it a lot harder to add support for other SQL database server software.

  Why are prepared statements with frameworks and PDO being hailed as the gold standard of SQL? Why are they better?

PDO is mostly a good thing for software design reasons. It makes it a lot easier to support other database server software. It has an object orientated interface which abstracts many of the little database specific incompatibilities.

  Why can't I do an SQL injection with these [prepared statements], where as I COULD have with the previously mentioned means?

The "constant query with variable parameters" part of prepared statements is what is important here. The database driver will escape all the parameters automatically without the developer having to think about it.

Parametrized queries are often easier to read that normal queries with escaped parameters for syntactic reasons. Depending on the environment, they may be a little faster.

Always using prepared statements with parameters is something that can be validated by static code analysis tools. A missing call to xxx_escape_string is not spotted that easily and reliably.

  Can a programmer not somehow manage to still screw this up? What should they look out for?

"Prepared statements" imply that the are constant. Dynamically generating prepared statements - especially with user input - still have all the injection issues.


IPsec down with unusual SNMP traffic Time to time IPSec tunnel status become down, with unusual SNMP Traffic. when I disable and enable port manually, it become normal.

I am using 200E fortigate firewall.

Have you any idea or previous experience with this issue?

Unfamiliar with that particular unit, but throwing an SNMP trap on an interface up/down is not abnormal if the firewall itself is monitored with SNMP. It could also be LAN side hosts throwing the SNMP as a notification of timeout because of the tunnel outage.

Best bet is to get a sample and take a look. If it is a complex network, it probably isn't malicious. The other thing might be to run a ping monitor of your choice of the remote public interface, just to verify that the tunnel up/down is happening because of a layer 3 problem. Which it probably is, and examining the logs of the firewall will likely confirm that.

Just a few thoughts.


Security problem with confirmation email I have an app, and when they first login, I send a classic confirmation email. When users need to reinstall the app, sometimes users send messages to our support saying: "I don't remember the email used to register my account, how can I have the verification code?"

This is pretty annoying, so I thought about sending to users a message like 'we sent a verification code to a***@gmail.com' but I'm getting worried about security issues and data protection policies. What do you think? Could this be a security problem? Do you know a better way?

Reinstalling shouldn't need a verification code, if they have their name and password to login. Reinstall on fresh device, log in, there is your account.

Password reset, on the other hand, implies they have lost/forgotten password, but still know their username. If their username was their email, then they know which email they've signed up with.

So I have to assume they gave you an email address when they signed up, but don't use that to login, they use some sort of other username.

If they don't know the email address, and they don't know the password, they need to provide some form of proof of ownership/control over the account.

Not knowing what your app specifically does, I can't suggest anything, other than, would support have access to anything only the account owner would know (e.g. value of last bank balance)?

Yes, that's what the email address was supposed to have been, but perhaps you could use something else for verification?


How to prevent the device from connecting to the original AP? I'm running an Evil Twin attack with airgeddon. Point is that after deauth the account is going, automatically, to get reconnected to the orginal AP and not the fake one.
The aireplay is likes so:
aireplay-ng -0 0 -a [BSSID] wlan0 -c [TARGET MAC]

DoS is tricky. To answer you, more data is needed... your chipset, that is very important.
I'll quote the well explained text from airgeddon's wiki. It will throw some light to you:

Not all attacks work against every APs and its clients. Sometimes, clients are taken down only partially, while others remain unaffected even on the same AP. It depends of many factors and variables: Chipset used to perform the attack, type of client (Android, computer, Apple device, etc), Access Point, distance and signal to the target, etc. The signal is of greater significance, which must be powerful enough. If you think it is not working, you should try a different mode of attack: mdk4, aireplay or even mdk3 modifying the configuration options ".airgeddonrc" file. More info about the available options on this link

The entire link is here:
https://github.com/v1s1t0r1sh3r3/airgeddon/wiki/FAQ%20&%20Troubleshooting#dos-deauth-is-not-working-what-can-i-do


Why install a certificate in the Trusted Root CA of the server? As part of configuration tasks I am doing at work I am having to learn more about how https works and how to set things up. One bit that I am not sure about is the need to install a certificate in the Trusted Root CA of the server.
I understand when a client makes a request to an HTTP server, the HTTP server responds with a certificate. The browser comes pre-installed with Root CA which it can use to validate the presented certificate from the server. All these makes sense.
What I cannot imagine is the use case where a server needs to add a certificate into trusted root store. The only use case I can think of is when the server also wants to require the client to authenticate itself. Is this the only use case why a server running http service is required to have root CA installed? Or are there more scenarios?

You are correct, the Root CA is required when clients connect to the service with client authentication certificates.
Your server may be a client of another service.  In that case, it also needs the Root CA in its own trust-anchor store (Trusted Root CA as you called it).  Without this, the server couldn't authenticate the signatures on any certificates presented to it when it connects via TLS to the other service.


Is VPN a likely access point through which to deploy a ransomware payload? We run a small office network with Windows SBS 2011 and  Draytek Vigor 3300 router.  We recently had a ransomware attack in which it currently appears the payload was run on the SBS server itself.

Since no users log in to the machine, and it doesn't run email client or a web browser, the most likely loophole would appear to be some remote desktop session or other access through the VPN ports.

We had these open, NAT redirected to the server:

UDP

1723
500
4500
2883

TCP

1723
50
3389
22

Is this a reasonable attack point, or should I be looking elsewhere?  As additional evidence, the attack appeared to take place out of office hours with all client pc's turned off.  The only other components would be the router, switches, printers etc.  With hindsight, the router and administrator passwords might have been susceptible to brute force attack - although the server was set to 30s before permitting a failed password retry, making that seem very unlikely.

You're over thinking how the server got infected. Instead of jumping to remote desktops or VPNs, look at what currently is open on it.

By your own admission, it has open ports and is NAT'd to the outside world, are you sure that it is patched and updated? If it doesn't run mail, why is port 50 open on it? That is a remote mail checking port. Why is SSH open on the server as well?


Is an anonymous FTP user always a risk (even if this user doesn't have access to anything)? I found some FTP servers in a network that seem to allow login with an anonymous FTP user. I confirmed this with the ftp-anon NSE script in Nmap.

PORT     STATE SERVICE
21/tcp   open  ftp
|_ftp-anon: Anonymous FTP login allowed (FTP code 230)

But when I try to connect with an anonymous user using an FTP client like FileZilla, it seems that this FTP user does not have any rights.

Status: Connecting to X.X.X.X:21...
Status: Connection established, waiting for welcome message...
Status: Insecure server, it does not support FTP over TLS.
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/" is current directory
Command:    TYPE I
Response:   200 Command successful
Command:    PASV
Response:   227 Entering Passive Mode(X,X,X,X,004,001)
Command:    LIST
Error:  The data connection could not be established: EAI_NONAME - Neither nodename nor servname provided, or not known
Error:  Connection timed out after 20 seconds of inactivity
Error:  Failed to retrieve directory listing
Status: Disconnected from server

So am I right to assume that this FTP server does allow a connection with an anonymous user but that anonymous user doesn't have any rights? If so, would the right recommendation still be to disallow anonymous FTP users or won't that make any difference? Also, what are the risks of above scenario?

That connection does not mean you have no rights, it means there was a network problem setting up the FTP data connection. Here's a thread on FileZilla's forum about similar errors. Causes range from unresolvable hostnames to misbehaving proxies. But I strongly doubt that the reason for this error is anonymous user restrictions; that would be indicated by some sort of 4XX or 5XX error from the server telling you you don't have the rights to do something.


Advantages of encrypting IV in AES GCM I've got a friend who stores some important data locally in a database. Before storing, he however first encrypts it with AES GCM with a certain key. He then encrypts the IV with another key, and then appends it to the encrypted data.

Looking at this, I started wondering, is there an advantage to this? Also, is there a better way to implement security especially when you use 2 passwords anyway?

P.S. My friend is paranoid.

NIST recommends using a random IV for AES-GCM. As GCM is a variant of CTR mode, you should never reuse the same IV with the same key, or an attacker can recreate parts of the plaintext if he knows something about its structure.

Encrypting the IV does not add much, as any security protocol must keep data secret when only the key is secret. If disclosing anything but the key compromises the security, then the process is not secure. AES-GCM is proven to be secure, so encrypting the IV is redundant.


How to react on a message about a pending account ban on Facebook? Are you getting this message on chat?

LAST WARNING : Your account is reported to have violated the policies that are considered annoying or insulting Facebook users. Until we system will disable your account within 24 hours if you do not do the reconfirmation.
If you still want to use Facebook, Please confirm your account below:
[redacted]-confirm-security-user.de.lv/
Thanks.
The Facebook Team

In general, you should contact the Facebook support or abuse team about messages like this. If the warning is real, they will be happy to confirm it. If it is not real, it is itself an abusive action and Facebook will be happy to learn about it.

In your case, the mentioned URL does not point to facebook.com but a domain that is not owned by Facebook. Therefore this message is a fake and you should not open the address. (Please see What malicious things can happen when clicking on links in email?).

The easiest thing is to just ignore it. If you have some time, you can report it to Facebook as a phishing attempt.

In case you already went to that page and entered your password there, make sure to change on all sites, where you used it.


Educational Security Vulnerability I'm doing a presentation in college. Topic is browser security. I was looking for a browser exploit. I would like to use such thing as a showcase. Do you have any ideas which vulnerability I could present? Of course it could be an exploit which was fixed versions ago. It could for any major browser like Firefox, Chrome, IE ...

Choosing a vulnerability to present will be dependent on what you want to be able to show as proof of the exploit. Do you want to pop a shell? Do you want to escape the sandbox? Run arbitrary code? What browser? What security do you want to test? It will also depend on your skill level and resources. So, it will be difficult for someone else to recommend any particular exploit.

You can look through the exploit-db.com to find PoCs of exploits that match your needs, or you can use the security presenter's best friend: Metasploit.

Use their online search tool: https://www.rapid7.com/db/search?utf8=%E2%9C%93&q=browser&t=m

Metasploit shows you their pre-made exploits, and you can have a number of pre-made effects (shell, run code, etc.). Not every possible exploit has a nice, presentable effect, but you have the ability to narrow your search nicely.