OpenSource API Security Testing Automation? I had been tasked with automating application api security testing for proof of concept project which requires me to propose a tool. Now this tool has to provide data results as json/xml or otherwise in order for Jenkins to consume & graffna to combine all the data for an integrated dashboard which includes performance validation, functional validation & as well as security validation.

So far, I was able to figure out few api security tools which could support with validation tasks however these weren't a bridge to jenkins for the devops team to utilize. These tools were Astra, Vooki, syntribos & Susanoo

I would like to receive support on this if few of you folks might be open to share feedbacks on the situation & the tooling to be proposed.

Try OWASP ZAP API Scan. There's a lot of information about this tool and it's integration with CI/CD pipelines. You can provide OpenAPI definitions to scanner, solve authentication issues using tokens and collect results in json format.

This is the url of the official project: https://github.com/zaproxy/zaproxy/wiki/ZAP-API-Scan


Websites visited on a VPN network My residence provides wifi and I'm using my personal computer to connect to it. I use a login and password to have access to the internet. Some websites are blocked by it.

Sometimes I log into VPN (using ANyConnect) to access data on my university's server. When I'm on the VPN, the websites usually blocked aren't.

My question is, can web pages I visit to be tracked when I'm on the VPN or directly connected to the WiFi? How does it work? Do they keep a record of the websites I visit?

The VPN operator can track and record what websites you visit while you're using the VPN if they want to, and you'd have to check their policies to see what they actually do. If everything is set up properly, your wifi provider can only see that you're sending encrypted data to and from the VPN, but can't see what pages you're visiting. If you're connected to the wifi and not using the VPN, the wifi provider can then see what pages you're visiting, and for pages not served using https they can even see the full content of all of your communication with those pages.


How to create a DROWN attack I need to create a test lab to demonstrate how a DROWN (
Decrypting RSA with Obsolete and Weakened eNcryption) attack can be preformed, does anyone know of a guide or steps in how to create this attack?

I need to demonstrate this for my honors but I can not find anything on this. I know how to test if a server is vulnerable, how to resolve the issue but I can not find anything on how to actually preform the attack.

Can anyone please help me?

Like the first comment said, i find it very doubtful you can't find anything.

A complete description of the implementation can be found here:
https://drownattack.com/drown-attack-original-report.pdf

I think what you mean is; "Can you point me to a public PoC i can copy."

No.

This attack is highly dangerous. And while it is an awesome school project, it can be used to defraud banks and steal highly sensitive information so it makes sense to restrict the tools to do that.

If you want to construct the attack yourself, look into the Bleichenbacher padding oracle side-channel attack.

Here you can find an implementation of this.

Furthermore the whitepaper mentions this to increase the likelyhood of finding a valid padding:

  Efficient padding oracle attacks on cryptographic hardware. In
  Advances in Cryptology–CRYPTO
  2012. Springer, 2012, pp. 608–625.

Then, to use an SSLv2 server as an oracle to show the validity of the padding:

  This allows an attacker to deduce the validity of RSA
  ciphertexts in the following manner:
  1.
  The   attacker   sends   a
  ClientMasterKey
  mes-
  sage,  which  contains  an  RSA  ciphertext
  c
  0
  and
  any  sequence  of  11  bytes  as  the  clear  portion
  of   the
  master_key
  ,
  mk
  clear
  .
  The   server   re-
  sponds  with  a
  ServerVerify
  message,   which
  contains   the
  challenge
  encrypted   using   the
  server_write_key
  .
  2.
  The  attacker  performs  an
  exhaustive  search
  over
  the   possible   values   of   the   5   bytes   of   the
  master_key
  mk
  secret
  .
  He  then  computes  the
  corresponding
  server_write_key
  and   checks
  whether the
  ServerVerify
  message decrypts to the
  challenge
  .  One value should pass this check; let
  this value be termed
  mk
  0
  .  Recall that if the RSA
  plaintext was valid,
  mk
  0
  is the unpadded data in the
  RSA plaintext. Otherwise,
  mk
  0
  is a randomly gener-
  ated sequence of 5 bytes.
  3.
  The  attacker  re-connects  to  the  server  with  the
  same  RSA  ciphertext
  c
  0
  .
  The  server  responds
  with another
  ServerVerify
  message that contains
  the current
  challenge
  encrypted using the current
  server_write_key
  . If the decrypted RSA cipher-
  text was valid, the attacker can directly decrypt a
  correct
  challenge
  value from the
  ServerVerify
  message by using the
  master_key
  mk
  0
  . Otherwise,
  if the
  ServerVerify
  message does not correctly
  decrypt to the
  challenge
  , the RSA ciphertext was
  invalid, and the attacker knows the
  mk
  0
  value was
  generated at random.


are there any services to test nmap While playing with nmap, I have started to wonder: are there any ip addresses which were specifically made to learn how to use nmap.

(As far as I understood I can not just scan any ip address, because this is illegal)

On SE I have seen posts with the examples of sites for sql-injections, so I hope that there is something out there to learn how to use nmap. Currently I am scanning my own machine 127.0.0.1 and my own web server, which is not so much fun.

As Terry said in the comments, you can test out nmap on scanme.nmap.org, which is designed for exactly this.

You could also set up a machine in a VM, or on Amazon EC2 for testing, with various services and firewall configurations, in order to see how nmap's results change depending on your OS and configuration.


DNS leak test shows that my ISP swaps google DNS for its own I've tested DNS for a leak at dnsleaktest.com and I'm getting these results:

When I'm not specifying DNS on my PC, it's using default ISP's DNS.
When I change it to google's DNS:

DNS leak test shows a different but nonetheless ISP's DNS instead of the Google's one. (I suppose the ISP is hijacking DNS in this case, right?).
Terminal command shows Google's DNS:

When I use VPN, only then I see google's 8.8.8.8 DNS in the DNS leak test in case when I'm using a browser VPN extension or 10.9.0.1 in case a system-wide VPN like "PrivateTunnel".

Are there any methods I can use to prevent that DNS hijacking or do I have to stick with VPNs?

ISP can change the responses you getting from any common DNS server in the internet, unless your DNS resolver and DNS server supports DNSSEC and also the domain in question is secured via DNSSEC.

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

If you want to have all DNS requests secured, you must use either VPN or you can use DNS resolver capable of DNS encryption in conjunciont with DNS server that offers DNS encryption.

You can use something like this: https://www.opendns.com/about/innovations/dnscrypt/


Protecting data within the intranet from internet i want to build an internet facing website that interact with internal resource such as referential data.

We have a DMZ zone and intranet zone. When users logs in to the website, the http web server in dmz makes a connection with the intranet zone via a messaging service , the business logic application server in the intranet zone responds to the request.

However we have an internal team raising concern that the connection between DMZ and intranet is risky, instead they suggested that we do it this way. Place an request service in DMZ, when user logs in,  the service puts a request row in this service store, in the intranet zone, create a poling service that monitor any request being placed in the DmZ, if found, pushes only information related to the login user to the Dmz via a file rsync from intranet. In this way , no direct connection is allowed to initiated directly from external, and safer. However, as file copy is slow, this will hit performance on the webpage, imaging client logs in and wait for file to be generated , encrypted and copied, then decrypted, read and presented !  That addes so much complexity to front end server to read files instead of JMS service call.

What do you think of the proposed solution?  and is there alternative than file copy but not compromising the security?

Your question is not well explained. I think you want to replace a messaging service (is this a message queue, and http connection, or something else?) with a database table in the DMZ that's polled by the server in the private subnet, to service a real time web request. When there's a reply it's rsync'd back to the web server.

That will likely result in a large increase time required to service a request. Even polling the database every second will result in latency, and rsync and polling a file system is going to introduce more latency and complexity. This is not practical, it's complex, and it's unnecessary.

A message queue might be more practical, but again they're not really meant for real time communications. You'll have to have your web server sit polling a queue to wait for a reply, taking resources.

A better model is likely to be ensure you have:

A properly configured firewall at the entry point to the DMZ and the private subnet/intranet
A layer that checks requests on the way in, such as a WAF. This can be a piece of hardware or a service. CDN vendors offer a WAF service (AWS WAF, CloudFlare, and Incapsula are some I know of). You can also use mod_security with the OWASP rule set, but it's tricky to tune.
IDS/IPS systems in place
Monitoring so you know what "normal" is for your network
Ensure your internal application has been properly code reviewed and security checked, for example to combat common attacks like SQL Injection. Coverage of the OWASP top ten is a minimum.


Windows 7 ROP Functions mapped to 0x00######## I am currently working on learning Windows Exploitation and am working in a Windows 7 VM. I was going through some tutorials and while they worked fine on Vista and below, they won't on Windows 7 due to a new restriction.

The restriction is that addresses that I could use for ROP are now mapped to 0x00 and which contains a NULL byte. This is also the same with potential gadgets like "call esp, jmp esp, etc"

!mona rop

# rop chain generated with mona.py - www.corelan.be
 rop_gadgets = [
   0x0045021d,  # POP EAX # RETN [Eureka Email.exe]
   0x004570a8,  # ptr to &VirtualAlloc() [IAT Eureka Email.exe]
   0x004124d4,  # MOV EAX,DWORD PTR DS:[EAX] # RETN [Eureka Email.exe]
   0x004412d7,  # PUSH EAX # PUSHAD # XOR EAX,EAX # POP ESI # RETN [Eureka Email.exe]
   0x00446d9f,  # POP EBP # RETN [Eureka Email.exe]
   0x00415e82,  # & push esp # ret  [Eureka Email.exe]

How do I bypass this new restriction in Windows 7? In Linux I know this is "ASCII Guard" but I am not familiar with it in Windows nor did I know it was a thing.

Sometimes you just can't ROP if your vulnerable function breaks on null terminated strings.

However, you still have some other options:

Try to find a memory leak condition. You get at least one return address before the last null byte breaks your payload, and build a 2nd stage exploit
You could write a ROP chain including ASLR and re-based modules (if using mona, tell it to include modules regardless of their security: !mona -cm aslr=true,rebase=true and no nulls !mona -cp nonull) and shift relative base address offsets on the gadgets on the fly in some brute-force tries. You might get lucky and land just fine as 32 bits address space entropy is very reduced.


Safest way to keep an offline bitcoin wallet Keeping a large amount of bitcoins in an online computer is dangerous. The bitcoin wallet is merely a file, and once the file has been copied the bitcoins can be transferred to another account. Password protected files can be hacked using keylogging and other types of spyware.

Therefore, the general advice is keeping a small amount of bitcoins in a computer, while keeping the rest in an offline account. There are two major types of offline accounts:

Brain Wallets: These wallets are created offline from a passphrase. The wallet can be constructed from the the same passphrase whenever the owner wants to make a transaction. Whoever guesses - or bruteforce attacks - the passphrase, has the wallet.
Paper Wallets: These wallets are generated using a random seed. They should be printed on an archive-quality paper and kept in a safe.

What are the pros and cons of each method? Which is more secure for storing bitcoins offline for a long period of time?

A way to secure online storage

One thing that could very much help with securing any data file of interest from access is to make use of Mandatory Access Control (SELinux in this example) and an second machine, possibly airgapped. You'll need a small program running on the wallet machine (I'll call it banker for this post) whose job it is to generate challenges and release coins only to properly authenticated requests.

We rely on SELinux to do the following: prevent read, write, and permission changing access to the bitcoin and authentication seed files to every application except for banker and whatever it spawns. We also rely on SELinux to prevent itself from being taken out of enforcing mode without a system reboot.

The banker authenticates any withdrawal by printing a random seed value and the corresponding HMAC output generated by combining the seed value with your authentication seed. This authentication seed is kept somewhere else, perhaps on your phone. You can use any method you'd like for exchanging the signed request such as email, scp, web interface, or taking a picture of a QR code and running it through your own app on the phone, then taking a picture of that code with your computer's camera. Go wild! You could also make use of an incrementing counter that never lets an equal or lower-numbered request succeed in order to make one-way authentications, or if you're feeling very fancy, you can use GnuPG and an OpenPGP smartcard to authenticate with a pinpad.

Expire any requests after a certain period of time: five minutes to an hour depending on how speedy you feel. Expire any requests that work immediately so they can't be replayed. Not that I recommend it (defense-in-depth is always wise), but in theory this should permit you to allow somebody to login to your machine as root and still be unable to steal your coins.

The security of your offline storage

I realized I didn't actually answer your initial question, so here's the followup: you're trying to defend against losing your money in one of two ways:

Somebody steals your wallet
You lose your wallet

In both cases of offline storage, you're protected if you weren't compromised before the data was printed out and erased from the computer's memory. That second part is a big caveat: if you're printing files they may be left as temporary files somewhere on the disk.

Both systems are roughly equal for risk of loss. Your password should be very long and complex. If you forget or lose the paper where your password is written, your wallet becomes lost, in essence to a fire. If you lose the paper your printed individual values on, the same happens.


What can be done with the last 4 digits of one's SSN If a hacker were to get the last 4 digits of your SSN (and maybe some other info like name, etc), what could they do?

To avoid the possibility that they could guess the other digits from date/location of birth and only focus on what they could do with the last 4, assume the person was not born in the US.

Far too many places use the last 4 of a SSN for customer support representative (CSR) validation. It's supposedly one of those "pieces of information" only you would know, but, sadly, is more often better known that we'd like to think. It can then be used as part of a social engineering attack to gain access to, or control of, an account. Here's an account of how something similar was used to gain control of a reporter's Apple account and wipe all his devices.

As Honan explained, Amazon allowed users to add a credit card number to an account simply by calling Amazon and providing a name, e-mail address, and billing address. After hackers used this method of adding a credit card number to Honan's account, they hung up—and then called Amazon back to claim they'd lost access to the account. At this point, they provided the fake credit card number, convincing Amazon to let them add a new e-mail address to the account. The next step was going to the Amazon website and requesting that a password reset e-mail be sent to that e-mail address. From there, the hackers could view the last four digits of Honan's credit cards on Amazon's website.
With those four digits (and Honan's username and billing address), hackers convinced Apple to send a temporary password that let them take over his iCloud account and wreak all sorts of havoc. "The very four digits that Amazon considers unimportant enough to display in the clear on the Web are precisely the same ones that Apple considers secure enough to perform identity verification," Honan wrote.

I can't tell you how often I've had a CSR just take the last 4 of my social as proof that it's me.


What evidence does a compiled file leave behind? I was wondering when people compile malware and use the compiled files for engagements or nefarious purposes, what evidence do they leave behind in the compiled Windows executables? I have heard that the OS usernames of the compilers can be disclosed upon analysis of the executable. Is it true? Is the evidence left behind the same both for .NET and native applications?

Yes it is true.
Both .Net and native applications (atleast those compiled by Visual Studio) contain an absolute path to a .pdb (Program Database) file when compiled in debug mode (which is usually the default). Since paths in Windows are usually of the form C:\Users\UserName\..., the path also reveals the malware author's OS username along with some information about the directory structure on their computer. It could also be possible to use it to deduce something about your nationality and/or locality. For example, if the path contains Chinese characters, it would be safe to say that the  author is Chinese (and  might live in China).
Portable executable headers also contain a TimeDateStamp which indicates the time at which the file was created/compiled. This could be used to roughly infer the possible time zone(s) in which the malware author resides (atleast for professional malware developers who can be expected to work during normal working hours. Amateur developers probably work at unpredictable hours).


Automated tools vs. Manual reviews What are the advantages of using automated tools, as opposed to manual review? What are the disadvantages?
This applies both to external blackbox vulnerability scanning, and to static code analysis.

From the original Area51 proposal

Some good answers here, but I think some points were missing:

Automatic tools finish a lot faster than manual testing, by orders of magnitude.
Automatic tools cover the breadth, but you need manual testing for depth. (Breadth both in range of attacks/tests, and in probing all interfaces / lines of code).
Autotools are great for the common low hanging fruit, but if you need to step up the level of security you'll need to go deeper manually.
Manual testing cannot possibly cover every bit of the system (whether it's lines of code, decompiled assembly, web pages and parameters, web services, etc), whereas autotools are great for that.
As @Andreas said, sometimes there is a complex vector, that autotools cannot possibly imagine, but will be obvious to an expert.
Autotools cannot test for business logic flaws, they hunt the technical flaws only - and the more common ones, at that.
Manual testing is not consistent.
Manual testing depends on the skill of the individual tester (oh, the horror!!), but you really need to know what you're looking for.
Likewise, with manual testing you cannot get regression testing.
Autotools are automatically updated with the newest exploits, but a human usually won't remember all the vectors he read about two years ago...
On the other hand, autotools will only get updated once every while, but a human can learn about a spanking new technique and implement it the very next day.
Autotools usually include a very high percentage of false positives (from 30% to over 90%, depending on the methodology and choice of product).
Autotools usually come with a decent reporting suite.

Bottom line? They both have a place, and should both be used in the correct context. For low-quality apps, first start by fixing everything the autotool can find, and don't bother with investing in a proper manual review just yet. When you raise the security level, and gotten rid of the low hanging fruit, go the distance and perform an in-depth manual review. And, when you're doing manual testing - first step, is running the autotool, filter the results, THEN begin the real testing.


Is XSS possible when using htmlspecialchars and https prefix check in href? There is a standard XSS exploitation technique where one can use javascript keyword in  to execute javascript code. Example:

please clickme

Let's us consider PHP code which uses htmlspecialchars with combination of a prefix check, where the URL must always start with https://. Is there any way to exploit it in modern browsers like firefox, chrome?

<?php
// PHP 7
$url = htmlspecialchars($_GET["url"] ?? "", ENT_QUOTES);
$text = htmlspecialchars($_GET["text"] ?? "", ENT_QUOTES);
if ((substr($url, 0, 8) !== "https://")) {
    $url = "https://" . $url;
}
?>
<a href="<?= $url; >"><?= $text; >

I know that there is a open redirect vulnerability. I tried things like https://@javascript://://alert();  but it seems that google chrome blocks it (medium.com 2017: Say goodbye to URLs with embedded credentials). [This question is not about securing that code - this question is solely about exploiting.]

Here are more examples from the past:

youtube, liveoverflow: "HOW FRCKN' HARD IS IT TO UNDERSTAND A URL?! - uXSS CVE-2018-6128"
youtube, liveoverflow: "Identifying Good Research to actually Learn Something - Cross-site Scripting"

When using htmlspecialchars, all HTML tags will be escaped.
So let's say you type in hello.
In source:

Without htmlspecialchars: hello
With htmlspecialchars ENT_QUOTES: &lt;a href=&quot;https://hello&quot;&gt;&lt;/a&gt;.

In browser:

Without htmlspecialchars: hello
With htmlspecialchars: hello


Why are WPA2 passwords longer than 16 bytes more secure than 16 byte passwords? In this good Information Security StackExchange question, the answers reveal that a long WPA2-PSK password does not degrade performance of the network.  The reasoning is that the password itself is never transmitted, and the generated CMAC that is transmitted is always 128 bits (16 bytes).

Why then, are WPA2 passwords longer than 16 bytes more secure than WPA2 passwords of 16 bytes?

You state your CMAC is 128 bits, so in general you don't need a passphrase with more than 128-bits of entropy.  However, if you choose a 16 character password (without picking the bytes completely randomly), the entropy isn't 128-bits, it's typically much less.  E.g., if you chose randomly from 95 printable ASCII characters, you'd have about 105 bits of entropy (log2(95^16) ~ 105) which is about 8 million times weaker than a 128-bit entropy passphrase.  If you didn't choose randomly, but say concatenated English words, the entropy would be much smaller; e.g., meaningful English has an entropy of about 2.6 bits per character (16*2.6 ~ 42 bits), which would be quite feasible to be broken in offline attacks.

If you want to remember a meaningful English phrase as your passphrase, it should probably be about 50 characters long (128 bits/2.6(bit/char) ~ 49.2).  Or if you chose a diceware passphrase randomly from a dictionary with 6^5 = 7776 words in it (12.9 bits/word), then you need about 10 words to get to 128 bits.

So, to summarize there is an upper limit to security when using a passphrase.  E.g., there's no use having a 20 word diceware passphrase with a 128-bit CMAC (the entropy of the MAC maxes out at 128 bits); the 20-word passphrase won't be more secure than a 10-word one, but a 10 word diceware passphrase will be significantly more secure than a 3 word one (that say has 16 characters in it) with an entropy of about 39 bits.

EDIT: The primary key used in WPA2-PSK is the PMK (pairwise-master-key).  This is derived from the pre-shared password and the name of the access point.  The PMK is 256-bit (32 byte) and calculated via PMK = PBKDF2(HMAC-SHA1, preshared_password, salt=access_point_name, rounds=4096) (where PBKDF2 is password based key-derivation function 2, which in this case involves 4096 rounds of HMAC-SHA1).

If you somehow found a different password that generates the same PMK for an access point, you can connect to the access point, eavesdrop, and tamper with messages.

That said in WPA2 you also derive a transient key (PTK) from the PMK and random nonces sent over during the four-way handshake.  The PTK is 512-bits, parts of which are used for different purposes, but your traffic within a session is encrypted with a 128-bit transient key.  (If you find a encryption key part of the transient key you could decrypt traffic within one session, but that's it -- you wouldn't be able to sign traffic to tamper with it or create new sessions).


Do I need to hash or encrypt API keys before storing them in a database? I'm securing API calls to a REST service I'm building using API Keys. The plan is to:

When we get a new client, generate an API Key (a UUID).
Email the API key to them.
They send the API key on every call to our service (over HTTPS). We will lookup the API Key in our database (either encrypting or hashing it first) and figure out the account the API key is for.

Eventually, we'll add user accounts and a portal for all this so clients can generate and deactivate API keys without us needing to be involved.

My question is on the last part. Should I hash or encrypt (or leave unecrypted?) the API keys before storing them in the database? I'm trying to understand the implications. I know that if I hash them, then I'm protecting against someone knowing all API keys if they get DB access. But what are the other things I should be thinking about? For example, are there performance reasons to do one over the other?

Yes, you should absolutely hash your API keys. In effect, they are your passwords and should be treated as such. And note that's hashed - not encrypted. You never need to decrypt the API keys, hence you should not be able to.

As saghaulor says, you need to make sure you use a version 4 UUID (a random one, that is) and that you use a cryptographically secure source of randomness when generating them. Since a correctly generated UUID contains 122 bits of entropy you need not worrie about salting or using a slow hash function like bcrypt. A single round of SHA-256 would be enough.

A problematic part of your design is that you are giving users "passwords" that are delivered by mail and that they can not change. That may not be good enough for security concious users. Perhaps the portal you mention will solve this problem.


Will the same JavaScript fetched by HTTP and HTTPS be cached separately by the browser? Say that a web server supports both HTTP and HTTPS. If a browser fetches the same JavaScript with a HTTP GET and a HTTPS GET, and the JavaScript is cache-able, will the browser cache two copies of the same JavaScript?

The reason I'm asking is that if only one copy is cached, would it be possible for an attacker to first trick the victim into downloading JavaScript via HTTP and compromise it along the way, which will result in a cache poisoning attack?

Resources are cached by their URL, and the protocol (http:// or https://) is part of the URL. Since the protocol differs, the URL must also differ, and you have two separate cache entries.


Is there a PCI Requirement for shuffling digits while accepting PIN? The following image shows a PIN entry device which shuffles the digits.

. via twitter

I've seen this question, but it doesn't cover why companies are still doing this.

I looked at the POS PIN Entry Device and the Software-based PIN Entry on COTSSecurityRequirements requirements and neither of them seems to have anything about shuffling the digits.

Is there a requirement or specification that I'm missing?

There is no fixed requirement to do this, in any standards I am aware of.

I understand the thinking behind it - you'd think it could make it harder to shoulder surf, however in my experience it makes it easier to shoulder surf, as the person keying in the code will now need to check visually for each digit, rather than being able to type them in from memory.


Code Vulnerability in Shell script I was given an assignment for my Computer Security class. We we were given a piece of code to analyze and determine the vulnerabilities that it might have.

#!/bin/sh
# shell script to create a copy of the shadow file to the /tmp directory

echo > /tmp/shadowcopy

# allow only root access
chmod 600 /tmp/shadowcopy

# append the original file to the copy
cat /etc/shadow >> /tmp/shadowcopy

# Hint: the access permissions of a file in linux are verified when the file is opened.
# the process will keep the original permissions as long as it keeps the file open, even
# if permissions change.

Some classmates and I determined that this script might suffer from race condition vulnerability if two separate process try to open the /tmp/shadowcopy.

We also think that command injection vulnerability could be possible if the /tmp/shadowcopy is changed before the append begins.

Are our assumptions about this shell script correct? or are we missing an important vulnerability that might be exploited if the script is used?

The cat binary doesn't implant flock() calls using the LOCK_EX for exclusive write access so your assumption is correct.

You can verify that by following the system calls issues by that or any binary by running strace cat file.

A way to prevent the problem would be as follows:

#!/bin/bash

set -e

(
  flock -n 200

  echo > /tmp/shadowcopy

  chmod 600 /tmp/shadowcopy

  cat /etc/shadow >> /tmp/shadowcopy
) 200>/var/lock/.mylock

The permissions also can pose a race condition as someone can issue a tail -f /tmp/shadowcopy prior to your chmod command to gain access.

For further reading on best security practices regarding race conditions you should take a look at fnctl(), flock() & stat().

Or if someone else was on the device watching the buffer they could access the hashes as well, see https://gist.github.com/jas-/9534117.

It is proof of concept for scraping memory from a running process.


AIA/CRL locations for Offline Root I've read the answer to the following "Checklist on building an Offline Root & Intermediate Certificate Authority (CA)" and I have one questions based on the system I am trying building
It's an Windows 2008 system with 3 domains/forest (That is one domain per forest)
I wish to use certificates within this and belive I should be able to do so with a single self signed offline room.

ROOT - is the CA = Self Signed Offline Root
DOM1IntRoot is the CA for the Active directory domain DOM1.A.COM
DOM2IntRoot is the CA for the Active directory domain DOM2.A.COM
DOM23IntRoot is the CA for the Active directory domain DOM3.DOM2.A.COM

There are no trusts, no subdomains So what I'd like to do is sign DOM1IntRoot, DOM2IntRoot and DOM3IntRoot with ROOT so that I only need one offline root
So that means I need to install the ROOT CA certificate into each domain - which I think from the Microsoft "Example Scenario for Contoso"  means I need to set the LDAP AIA location to a configuration partition which exists in all domains (in this case DC=a,DC=com ) and the HTTP location to some single server .  However, it also says that they can have seperated CRL/AIA locations which seems contradictory

So then I read the answer referenced above and says leave the AIA/CRL blank.  Which seems to imply that the DOM1IntRoot, DOM2IntRoot , DOM3IntRoot will be publishing the CRL/AIA for the ROOT

So I have two possible answers either the ROOTCA has CRL/AIA or it doesnt.
If the ROOTCA has AIA/CRL then what exactly should I specify for the LDAP/HTTP and  FILE URLS for AIA and the CRL locations
eg is this correct?

ldap:///CN=ROOTCA<CRLNameSuffix>,CN=ROOTCA,CN=CDP,CN=Public Key Services,CN=Services,DC=A,DC=COM
http://<SOMESERVER>/CertEnroll/ROOTCA<CRLNameSuffix><DeltaCRLAllowed>.crl
file://\\<SOMESERVER>\CertEnroll\ROOTCA<CRLNameSuffix><DeltaCRLAllowed>.crl

Where <SOMESERVER> is a server with IIS which will make the Certificates abvailable

Note that I am NOT using the offline roots servers name as its never seen- is that correct?

If the ROOTCA does not have AIA/CRL then how do I publish a revocation of (say) DOM1IntRoot?

I'm a little confused so this question may be starting from completely the wrong assumptions

I'll add a little information on the domain structure to try and head off some questions
 - DOM1.A.COM is where the clients set
 - DOM2.A.COM is a DMZ type network protecting DOM3
 - DOM3.DOM2.A.COM is only accessed but users from DOM1 remotely logging into DOM2 and then another remote session in DOM3
 - We wish to use certificates for the seesions between DOM1 and DOM2 and DOM2 and DOM3
 - We also will be using certificates from DOM2 to the network devices (It probably should be DOM3 but thats still being discussed)
 - DOM2 and DOM3 are isloated from the internet. DOM3 is isloated from everything except DOM2

If the root CA is offline then the root CA is offline: it has no network. This implies that whenever a CRL is published, a manual intervention is needed to put it on a connected host. At that point, you can put it manually in three places if need be.

The "Authority Information Access" (AIA) and "CRL Distribution Points" (CRLDP) extensions are information which is written in the certificates issued by the CA. In that case, these extensions are in the CA certificates issued to the subordinate CA (the three subdomain CA). There is no requirement that each sub-CA receives the exact same AIA and CRLDP from the root; you could perfectly arrange for the root to issue the certificate for CA1 with an AIA and CRLDP pointing to locations (ldap:// URL) in the forest for DOM1.A.COM, where you will manually push a copy of the root CA certificate and the CRL produced by the root CA. Ditto for CA2, but this time with locations in DOM2.A.COM, and so on.

However, it is probably simpler to use HTTP. Put a Web server somewhere accessible from all the domains, and have the root CA write in the certificates it issue some AIA and CRLDP with http:// URL. Plain HTTP is fine for certificates and CRL, which are signed object, and thus can be distributed with no regard for any kind of security (no need of HTTPS or whatsnot for certificate and CRL publication).

Also, the AIA is not very useful for a root CA because it is a root: validation will work only if whoever validates trusts the root a priori, so it must already know it. AIA is for locating certificates which you do not know a priori, and, therefore, certificates which you do not trust a priori: very useful for intermediate CA, quite useless for root CA. In an Active Directory context, you can push the root CA as "trusted" through, for instance, some GPO.

To automate CRL publication, you could use a mostly offline root CA. That's a root CA which is offline except that it has an inherently one-way channel to output regularly produced CRL. I have done it once over an audio cable (CRL encoded as sound, decoded on the other side): the advantage is that the "out" jack from the audio interface of a server is physically distinct from the "in" jack (the "out" is green, the "in" is pink), so it can be visually ascertained that the root is still offline. Other people have used RJ45 cables with only one pair of wires connected, which has better bandwidth but is less easily visually inspected.

Anyway, it does not change the root of the thing, which is that HTTP will make your life simpler.


Can I set up a 3g/4g Connection Proxy for Table/Phone App Pen Testing? I would like to set up a testing environment for smartphone and tablet apps that can intercept 3g/4g communications and provide a traffic dump. I'd like to see all the 3g/4g traffic coming from, or going to, the device.

Wireless connections are straight forward because I can set up a proxy somewhere in the comms chain but I'm not sure whether this is possible for mobile connections over 3g/4g.

It's important that the smartphone doesn't realise that it is being proxied as this may affect the behaviour of any application I am testing so I need some way of intercepting (proxying?) the cellular traffic without using any on-board proxy settings.

Is this possible?

Most devices could can have a proxy set on them which would be invisible to the application. Personally I use proxydroid (or similar) on android and IPtables on iPhone. Your devices may need to be rooted (and any apps patched to avoid root detection). You will also come up against certificate pinning like you would over a WiFi connection and will have to patch the application to bypass this. (unless you have the private key for the target's SSL cert - which is unlikely unless you are the sysadmin for the target server)

Over a 3G / 4G connection, you would need to run your proxy server on a machine with a public facing IP address - VPS servers are useful for this.

Alternatively you may be able to get the phone to VPN into a network that you control and pass it fake DNS information using DNSMasquerade or similar - you can set up a server with your proxy operating on ports 80 and 443 and give the IP to that server as the response to any DNS request made by the phone. (some more complicated layer 3 routing may need to be done if the App uses IP addresses directly)

You can't transmit / receive data on the radio bands allocated to 3G / 4G under most jurisdictions due to wireless telegraphy laws. If you want to spoof a 3g / 4g network without violating any laws, you could set up a faraday cage (use a certified commercial solution), set up your own base station using an SDR and openBTS or similar and sniff / proxy the traffic from the role of the mobile network operator (any GSM / UTMS / 4G encryption on the channel will be done using your parameters but you will still have to MitM any higher layer (HTTPS etc.) traffic. This works in most cases, though check with local laws / an experienced lawyer in your jurisdiction first. The hardware to do this can be expensive.

Using a hacked commercially available femtocell may be a simpler way to do this though this probably still violates many laws and most likely your user agreement with the network operator. Proceed with caution. MNOs actively monitor attempts to circumvent protections on their devices and employ third party consultants to try and break their security. Some may use VPN connections back to the MNO, though I have not examined enough to fully confirm or deny this. An past example of this approach is here, though note that you will still need to break the HTTPS encryption / tell your device to send the traffic to a proxy. Hosting your proxy server on a public IP address or using your own VPN is probably a much simpler (and legally safer) approach. https://www.nccgroup.trust/globalassets/newsroom/us/blog/documents/2013/femtocell.pdf


Cafe's wifi disconnects me whenever I connect my VPN. How? I'm at a cafe where all but a couple of websites like Youtube are blocked. I'm typing this from my hotspot.

Whenever I connect my VPN (PIA), it automatically disconnects me from the wifi. After I disconnect the VPN, my wifi connection is established again.

How does this work and how do I bypass it? I've never seen this happen before.

How does this work

Your VPN uses a server in Private Internet Access public network to be able to work. The fact that those addresses are used by PIA is well known (it's probably registered in the public WHOIS database too). It is probably known to whoever designed that WiFi security.

As soon as whatever routes packets in that café sees a packet directed to any of a largish number of uncool address pools, the originating device is disconnected for security reasons.

One way to do it is with a Linux router box with iptables, fail2ban, and a custom script to send the disconnect command to a compatible router (I think I know how to do that with a D-Link access point, as it has a Web interface that could be scripted via curl; but most APs are probably scriptable that way). Set a limit of, say, 20 packet attempts in a minute to trigger disconnect, and Bob's your uncle.

  and how do I bypass it?

You need to find a service that offers VPN or proxy services, and yet is not blacklisted. Whether one exists, is more than I could say.

If the network uses a whitelist for allowed sites, and a blacklist for sites that trigger disconnection, you might find such a service and yet it will not work - you'll remain connected to the WiFi (not being blacklisted) but unable to navigate (not being whitelisted).

Frankly, moving your custom elsewhere or procuring a cellphone data plan with WiFi tethering both look more promising than trying to bruteforce access.


Prevent Cross Site Scripting but still support HTML file upload I have a web application where user can upload and view files. The user has a link next to the file (s)he has uploaded. Clicking on the link will open the file in the browser (if possible) or show the download dialog (of the browser). Meaning that, if the user upload an html/pdf/txt file it will be rendered in the browser but if it is a word document, it will be downloaded. The file url is like https://mydoma.in/ran-dom-guid.
It is identified that rendering the HTML file in the browser could be a vulnerability - Cross Site Scripting. That is, since the file is executed under my domain, it is possible to attack if it contains a malicious script.
What is the right solution to this problem? The two options I am currently looking at are:

to put Content-Disposition header in the response to make HTML files downloaded instead viewed in the browser.
to find some html scrubbing/sanitizing library to remove any javascript from the file before I serve it.

Looking at the gmail, they do the second approach (of scrubbing) with having a separate domain for the file download - may be to minimize/distract the attack surface. However in this approach the receiver gets a different file than what was sent. Which is not 'right' in my opinion; may be I am biased. In my case, the first one is easy to fix. But I wonder if that is enough, or is there any thing that I overlook!
What are your thoughts on these approaches? Or do you have any other suggestions?

Security-wise, the first solution is better. Forcing a download via content-disposition is simple and clean.
HTML parsing and sanitizing on the other hand is a complex task with lots of room for error, possibly allowing an attacker to still perform XSS attacks. Additionally, you'd also need to worry about other attacks related to the SOP (eg CSRF if your CSRF defense is a referer check, Clickjacking, etc).
Usability-wise, it seems that you would prefer the second approach though (the user can view the file directly instead of having to download it). Going with a well-established library is a good idea in that case.
Alternative approaches might be isolated subdomains (probably one per user) serving the files, or sandboxed iframes displaying the content (configured as restricted as possible for your use-case, and taking other SOP issues under consideration).


Does the browser get the access_token in OAuth2? I've spent more than 10 days trying to understand the Authorization Code Flow for a web application where I'm supposed to implement OpenID Connect for a single sign on. It feels that there is a lot of conflicting information out there and I still haven't gotten a clear picture of everything.

In many places people mention that the access_token ends up to the browser.
In a book I'm reading it mentions that the access_token should never be delivered to the end user. It specifically mentions that it should always go from server-to-server (with client_id and client_secret).

This makes me think that the flow should be something like this

Browser                       Resource Server                  Auth Server
   | --------- GET /authorize ------------------------------------> |
   | <-------- 302 myapp/callback?code=100 ------------------------ |
   | -- GET myapp/callback?code=100 -> |
   |                                   | --- GET /access_token --> |
   |                                   | <-- token --------------- |
   | <- 200 OK ----------------------- |

So in this case the token ends up at the Resource Server which is also the confidential client. But then what is the point of a token anyway if the server itself is holding it to access itself?

It would make more sense if the token was at the browser so that the user can fire requests to the server directly. I feel even more puzzled now since it seems that the server would need to do some cross reference between session cookies and access_tokens, so that it knows that John is now asking for resource x.

Is my thinking correct?

The browser gets the authorization code, but not the access token.

For the OAuth2.0 Authorization Code Grant, suppose you're logged in to an app that will manage files you have stored on Google Drive.

The files are the resource
You're the end-user/resource owner
The app is hosted on the client server
Google is the authorization server

On the app you click 'Add files from Google Drive'. You get redirected to Google with the following information:

response_type ('code')
client_id
redirect_uri (hosted by client)
scope (in this case 'https://www.googleapis.com/auth/drive'; this is not a url, it just uniquely identifies the resource)
state (a random string to prevent CSRF)

You're now on the Google login page, where it will show the message 'App would like to access your files on Google Drive'. Upon successfully authenticating, you'll be redirected to the client at 'redirect_uri', with the following information:

code
state (from the previous step)

Now the client makes a request to Google. Note that the user agent for this request is the client's server, not the end-user's web browser. The client sends the following information:

grant_type ('authorization_code')
code (from the previous step)
redirect_uri (must be identical to the previous one)
client_id
credentials (the authorization server MAY accept any form of client authentication meeting its security requirements [1])

The authorization server returns:

access_token
refresh_token (optional)

Now you're back on the page you were originally on. On the backend, the client server can access all your files on Google Drive using the access_token it just received plus it's own id and credentials.  This access token never reaches your browser.

The OpenID Connect Auhtorization Code Flow uses a similar method, but instead of granting access to a resource, it allows the client to authenticate the end-user (think 'Sign in with Google').

Reference:

[1] https://tools.ietf.org/html/rfc6749#section-4.1


HIPAA non-business associate for contract work I have been asked by the sole owner/employee of a blood testing business to make her a web site.  This web site would simply be used to schedule appointments for her patients.  For this reason information such as

Name
Phone number
Address
Email Address

and some other fields will be needed.  I am told this all needs to be covered under HIPAA.

I've been doing reading on this for weeks now and I know how to properly encrypt the data in a database which should give her proper HIPAA compliance. In additional I will be building a server for her to store that information on in her office (which I believe also gives her compliance as it's physically separated from everything else and stored in a locked room).

I will never have access to the data and basically once the web site is done I will not have anything to do with it again (barring she wants new features - always the case on these things I suppose).

I read this page here which basically makes it sound like I'm a non-business associate. Am I?  Do I need her to sign a form saying that I am?  Basically I AM NOT a HIPAA expert, I'm just in this for the money to make a web site which I know how to easily do and don't want to get in some legal trouble later on because of it.

Yes, that is correct.

Based on your agreement, if you are building anything that touches (stores,transmits, or manipulates) PHI (Protected Health Information), you must meet HIPAA security rules (164.312 Technical safeguards) by the book.

It covers only covered entities and BA-s but as a non BA vendor you are responsible to meet or exceed the standards and to show due diligence, being a non BA vendor liability is not shifted, you can and should have and EO or other professional insurance to mitigate risk.


PCI DSS Scope outside CDE Our organization is in process of determining if our PCI DSS scope is correct. We have done lots of research and read the Open PCI DSS Scoping Toolkit document. However, we still struggle to fully understand it.

We have the CDE servers segregated on its own VLAN behind the internal firewalls. Only the CDE environment is behind these firewalls. We understand that all 12 requirements apply to this segment (1a devices).

Q1. We have devices outside our PCI segment that provide services to PCI segment. This includes Active Directory, SIEM, and Anti-Virus.  To us it seems these devices belong to “2a” category and are in scope.  The toolkit states that all applicable PCI controls are required for Category 1 and 2a systems. Does that mean that we have to move all these devices behind the firewall into the CDE environment? Or can we leave it as is, and protect these servers with all applicable PCI controls (also introduce the hardening standards) and then document all required ports that are required to be opened on the firewall in order for these servers to provide required services to our CDE environment?

Q2. One of our larger departments functions in a call center fashion. They take card data via phone and then enter it to software that is installed on their PC. This software connects to the server in CDE environment. Nothing is stored locally on the PC. Everything is submitted and stored on this one server in CDE environment. The connection between the PC and the server is encrypted. Additionally, after the data has been entered, if the center representative went back in to check the card number, they would be able to see only the last 4 digits for verification purposes. Our question is about these PCs (we understand they are in scope), but do we need to move them inside the CDE environment where the server is located or leave them where they are at, and apply all applicable PCI controls and host based hardening controls (FIM, SIEM, anti-virus, patching, access controls, monitoring, etc). There is only 1 port required for the PC (software on the PC) to communicate with the server within the CDE segment. That is the only port we allow through the firewall and we have it documented.

Thank you so for your help.

Response to Q1

The network segments containing systems which handle cardholder data should be in their own VLANs - it appears you've done this. The systems which are connected to and security impacting are also in scope but don't need to be within the CDE as they don't handle cardholder data. Those systems can be individually in scope without bringing the population of that network segment into scope. It would be useful to have local firewalls enabled as an additional security measure.

Response to Q2

The call centre should be in its own VLAN so it's logically segmented from environments which don't handle cardholder data. The call centre is part of your CDE.

Considering the above you may have the following VLANs:

CDE DMZ
CDE internal
CDE call centre
Other stuff - may contain in-scope systems i.e. connected to, security
impacting
Other


Applications of ODEs to Cybersecurity My university's cybersecurity program allows one to take a course in ordinary differential equations as an elective. The course would be interesting to take, although I don't know how I'd apply it to anything. Are there any examples of cybersecurity problems that are solved with ODEs?

I don't want to say definitively no, but trigonometry, calculus (including ODEs) doesn't come up much in cryptography or cyber-security.  That said its still part of a basic STEM background mathematical literacy, so I'd personally recommend taking the course just as part of a standard breadth of general education.

There are two examples I can come up with.  First, is some CS topics that could be of relevance to a cyber-security expert, will at times involve differential equations in the theory behind it -- specifically with Machine Learning and Artificial Intelligence.   Granted, its not going to be solve y'' + 3y' + 1 = exp(2 x) type things you'll learn to solve in a typical ODE class.  It's more just being comfortable with the basic concept of differential equations.  For example, browse the lecture nodes to the Stanford version of Andrew Ng's ML class).

The other example is if for your cyber-security needs require you knowing some physics, which frequently will involve differential equations.  E.g., if you need to understand the physics of wireless transmission.

That said, its more relevant learning basic number theory and linear algebra.  Somewhat relevant: is this question "What is the lowest level of math needed in order to understand encryption".


Does nmap trace back to you? I just got certified in CEH and learned A LOT about nmap and how it really manipulates the three-way-handshake to get some cool information.

I have a question about possible detection problems.

When you are sending a SYN packet, even as part of a -sS scan, does that packet carry your source IP? If so, couldn't your target record that connection attempt in the firewall log and trace the connection back to you? Or is it just an unspoken 'no duh' that you should also be spoofing your IP if you want to remind undetected? Or does namp do this automatically? Or does nothing get logged if the connection was unsuccessful and the three-way handshake not completed?

It does get traced back to your IP. However, this isn't really practically avoidable.

What you can technically do is a "idle scan" with nmap. I won't go into the technical stuff too much, but it's based off the side channel of IP ID being incremented. However, I've never heard of hackers actually using this method.
https://nmap.org/book/idlescan.html

However, the internet is getting scanned so much, that there is no way for the admin to investigate every port scan.

On a local network, you'd want to slow it down a lot so it doesn't get detected as a port scan. That's what phineas phisher did when he hacked the hackteam. Even on the local network, there are many false positives when it comes to detecting port scans.

It's also possible to use IP spoofing or proxies to mask your IP address by hiding it among many other IP addresses. Furthermore, a proxy or VPN may be used for port scanning. This will completely hide your IP address from the target. You can also combine the two methods.


What is the best practice for encrypting and storing temp data on client? I have a client-server system, where the client is an Android app. The client and the server communicate over HTTP.

If the server/network is not available, then the client has to store the data locally in an encrypted file and needs to retry to initiate the communication later, once the server/network has recovered.

There is a business requirement that these local files have to be encrypted somehow on the client, and if the client becomes damaged, the administrator needs to be able to recover the data from the local encrypted files.
The data does not need to be encrypted while sending over the network.

I would like to know is what is the best way to encrypt the data?
I have a potential solution in my mind, but not sure, whether it is correct/efficient or not:

I would encrypt the files with a symmetric key and share it with the server, so it can decrypt it. In order to keep the symmetric key in secret while sending it over the network, my plan is to encrypt the symmetric key with the server's public key, so only the server will be able to recover the symmetric key.

I do not want to re-invent the wheel, so I anyone knows any better, or simpler way to store and to encrypt temp data on the client, then please, share it with me. I am also looking for the name of the design-pattern that solves such a problem if there is any.

Threat modeling.

Who are you attempting to hide the data from? The user of the mobile device? If the admin needs to recover the data, why not just keep it on the server?

If you don't care about encrypting over the network, you don't care about the privacy of the data, so we need to understand what business purpose is served by encrypting on the device, if we are to provide a useful answer.

When you talk about a symmetric key protected by a public key, you are basically re-inventing https (TLS), in which case, just use that instead of http, and rolling your own.

If the client picks the symmetric key, it could decrypt the files locally, so you gain no protection there, and since the files aren't encrypted when originally sent over the network, I don't understand the business value/requirement to store them encrypted on the end device. A hostile end user could just capture the unencrypted files as they were sent.

If OP can flesh out the question with the reason for the requirement, we might be able to give better advice.

In the most abstract, what you describe would "work" but wouldn't really be protecting anything in any meaningful way.


How to use sslstrip with Internet Connection Sharing? I'm trying to make sslstrip work with Internet Connection Sharing.ve shared internet connection to router and another pc connected to that router, all are Linux, so

Internet <-> pc1 <-> broadband router <-> pc2

How can I use pc1 to decrypt all ssl packet coming from pc2 with ssl strip

Fundamentally, sslstrip acts as a transparent proxy for web traffic that changes https:// to http://.  The transparent proxy functionality is implemented using ARP spoofing, which means the network switch needs to be susceptible to ARP spoofing attempts.

So you'd install sslstrip on pc1, make sure pc1 is able to forward packets, start arpspoof (separate package than sslstrip - i think arpspoof is on SF), and run sslstrip.  You can see if arpspoof is running by running tcpdump on pc1 or checking the mac address table on the broadband router - the internet router should list the MAC address of pc1 and tcpdump should show all packets routing from pc2.

Aside from that, moxie's defcon prezo is published here.  There's also videos that show you how to make this work link


Can I file download server specify what logo the file will have on the user's computer? Is it possible for a download to specify it's own icon (as a file in the GUI)?
So for example, if I download a file called foo.dmg can I make it show up (in the download bar or in the explorer) as a video.
I'm asking for Mac but Windows would be a bonus.

Reason this is security related: I (and I'm sure others) rely on the logo to trust that the right app will be used to open the file as a proxy to checking the extension.

A icon / logo is not a security control and applications can specify any icon they wish attached to an exe and ini files on a desktop for windows.


Securely installing software in a hostile environment Consider the case where a user with a freshly installed Linux box is operating in a hostile environment controlled by an attacker with access to the internet gateway.
How can such a user update the system and install software securely using the available package manager, e.g., apt, npm, pacman, etc, when they are targeted by an attacker who can use mitm, dns spoofing, arp cache poisoning?
Is trusting the package manager's signature enough?

Is trusting the package manager's signature enough?

No. There have been numerous vulnerabilities for those in the past. Of course it also depends on the adversary. But when you assume that he can do mitm then he probably is well equipped and can do some other attacks too.
Just because it has been signed somehow it does not automatically make it bullet prove. In the end it is software checking other software. (Most) Software has bugs ... Maybe someone got the signing key and can now sign anything they want ...
iirc there have been bugs in the update mechanism for the BIOS in case of big companies with big budgets too (Intel)
Originally apt did not use https and there even was a website explaining specifically why. After a new attack was published which would have been prevented by https the owner of the website changed its content. Sadly the original site does not exist anymore.
https://www.reddit.com/r/linux/comments/aidxwa/why_does_apt_not_use_https/
When you google for packet manager security + linux you should find some more or less recent publications and potential attacks.
Using apt with https makes it certainly harder. The question is if it is hard enough. Against a nation state which could fake certs, redirect traffic or has access to the server itself it wont help.
You could take a look at the certs send by the server or watch the system behavior. Ideally, you would still have another secure(TM) system where you could cross check the results.


Hacking someone's encrypted data? Recently one of my friend said that he can hack anyone's Facebook or email account. I don't believe such talks because as a computer science student I know how hard it is to break encrypted data that sends and receive from a client in a network. But I was so curious to find out if there is any way of accessing encrypted data and what I was found was a web page which describes how does an unprotected WiFi network can use to capture your data. And it said

  This app can be used to gain access to private accounts on popular Web services, such as Gmail, LinkedIn, Yahoo, and Facebook.

But how? As an example, when I access to google sign in page, it establishes a encrypted line between client and server. So even after I sign in it uses https protocol. So how can that app can access such sensitive information? whether that network is unprotected or protected, data are still encrypted according to my knowledge. So please explain me how is that possible.

Here is the link to that page: http://www.pcworld.com/article/2043095/heres-what-an-eavesdropper-sees-when-you-use-an-unsecured-wi-fi-hotspot.html

Your question is a bit vague, but I'll give it a shot. Public WiFi networks are known to be dangerous spots from which to access any private account on any web service. There are a few common attacks, like man-in-the-middle attacks in which an attacker intercepts unencrypted (http) connects and can take data, or dns redirects, in which an attacker either hacks the router and changes the dns to redirect to his malicious page, or spoofs the router and makes you connect directly to him. There are also extensions for browsers like firesheep for firefox which works by intercepting unencrypted cookies for popular websites and thus faking credentials to hijack a user's session.

Still, if you're accessing webpages via https and they have valid security certificates, you can mitigate some if not most of these threats. And in 2016, https is pretty widespread.

As far as using them to steal login info, there are more effective ways to get login passwords, especially if you have physical access to a victim's computer. As far as Google or Facebook, you can pretty much assume that their encryption algorithms are up to snuff (aside from NSA backdoors). The issue almost always lies with the end user or the way with which the user communicates with otherwise secure services.

And as far as physical access goes, there's always Lan Turtles https://lanturtle.com/ and Wif Pineapples https://www.wifipineapple.com/
Point is, you can't trust the infrastructure you use to access the internet, so every bit of info you send is encrypted between you and the sites you want to access, or at least that's the idea. You never know when you have government agencies like the NSA wiretapping the entire backbone of the internet for unencrypted data.

To my knowledge, it is not possible/practical for an attacker that intercepts encrypted data to decrypt it. However, this alone does not make your computer or online activity safe over public wifi. An outdated/unpatched operating system or browser security hole could let an attacker into your system, where they could do all sorts of nefarious things like install keyloggers, getting your information in other ways.


Would a VPN prevent hackers from gaining access to my network if already breached? Hypothetically, if someone had illegal access to your network, wireless, or the like, and if you set up a VPN, would that stop the hacker from being able to see everything that you do or would him having prior access to the network trump the VPN setup?

Also, if I do setup a VPN, what protections does it give me as far as keeping people from accessing my email, what I do online, being able to convos through our phones, etc?

As an added security, is the general consensus to use something like a Tor browser or setup (not sure what the technical terms are) along with using a VPN?

Basically, I just want to take steps to the point of overkill to protect my network and any device that is using it as well.

EDIT

Thank you to whomever provided that information about the duplicate question, I looked at it and it was pretty much what I needed, but I think I needed a simpler answer to my question, as I don't know a lot of technical jargon. I did also want to know how Tor and VPN works in as close to layman's terms as possible and the commenters did a great job of helping explain that.

Think of a VPN like a tunnel. You tunnel underground, out of your house, past a dangerous area and then out into a more trusted area. (A gross over-simplification)

Would digging this tunnel do anything to eject a squatter in your property? No. The squatter gained access and has their own methods in an out. To deal with the squatter, you need to identify it and how they got in and close the route into your home.

Tor helps to protect your anonymity when you browse. It does not protect your phone.

You appear to be looking for a single protection measure to deal with what you think is a widespread weakness across your computers, your network, your landline and your car (from your previous question). Complex problems do not have simplistic solutions. You need to get to the root of the problem, not throw technology at it.


Old operating system (offline computer) need to come online for a few minutes OSX El Capitan
I have an offline computer running an old OSX operating system.
I would like to connect that computer to the web for a brief few minutes in order to install HomeBrew and install a newer version of rsync.  I will use the command line.
What can I do to reduce security risks while connecting?
Maybe block some traffic through my router?  There wont be other computers/ devices on my network needing to connect at the same time.
I can probably connect through a mobile phone (Android 9.0 or iOS 14) if that helps at all.

If you are connecting through a router and not browsing the Internet, your risks are minimal. The risks would be if the computer was directly exposed to the Internet or you started browsing, opening emails, etc.
Your Mac will probably send a lot of traffic out to get updates, etc. But that's not a risk.
If you have other programs running that might "phone home", like browsers, apps, etc. I'd make sure those weren't running, just in case you end up getting a malicious update (usually through apps made through small or independent developers).


License key / Serial number generator and checker I need a serial number generator and accompanying checker. I would like to be able to set a salt (and maybe a length). The generator should only produce serial numbers that pass the test of the checker. Those numbers should only account for a small fraction of all the possible numbers of the given length.

The algorithm needn't be cryptographically secure. Rather, it should be very easy to implement (in javascript) and it should be very fast.

To clarify: If you buy commercial software, it is sometimes protected with a serial number/a key. If you type it in, the software verifies it algorithmically (by checking whether it fulfills certain properties), rather than looking up a huge database. I'm also pretty sure that the keys were all generated algorithmically rather than by hand. And only a small fraction of all the possible keys of a given length are actually valid so it's hard to guess keys.

Salt: I don't know whether salt is the right word, but the algorithm should have at least one parameter, whose choice alters the generated keys (so that multiple people can use the same algorithm and needn't fear collisions).

If there is no real need for security, then here is a very fast serial number generator, with a checker:

User a counter. Initialize it at 0. When you want a new serial number, increment your counter by 1000; the new counter value is the serial number. The checker works like this: a serial number is valid if it ends with three zeros. Only one of every 1000 numbers will be accepted by the checker.

If this solution does not please you, then you do have a need for security, and this calls for cryptography.

The cryptographically secure solution is to have signed serial numbers: the serial number is the encoding of some payload (e.g. a counter of all serial numbers that you have generated) and a signature over the payload. The generator has a private key, which it uses to compute the signatures; the checker only knows the corresponding public key. The trouble with this setup is not really about verification time, even in Javascript; rather, it is the size of the signature which is a problem. I assume that the serial number will be, at some point, typed by a user. The minimal theoretical size for a cryptographically secure signature is about 80 bits (since signatures can be verified with only the public key, an attacker could try all possible bit sequences, and we usually require a security level of at least 280). However, the smallest signatures among the "assumed to be secure schemes" are closer to 160 bits (with BLS, which uses a pairing, which is kind of complex to implement) or 320 bits (with DSA or ECDSA). There is some work on signature systems with shorter signatures (Quartz, or McEliece-Niederreiter) but there is quite some controversy on their security.

Even with both uppercase letters and digits (36 possible characters, and there you have both 'I' and '1', and also 'O' and '0'), a 160-bit signature will use 31 characters. Along with the payload, you will end up with serial numbers of length 35 or so, which is probably too much for an average user to type in (but not by a large margin; an 80-bit signature would fit nicely).

If you do not use a signature scheme, then you must be aware that a reasonably determined attacker will be able, through some disassembly, to circumvent the checker, or even to learn enough to be able to produce his own serial numbers (which the checker will happily accept). At that point, you will not get quantified security: you will not be able to say: "my scheme is secure up to a budget of 3.8 billion dollars". Rather, it will go as: "my scheme is secure until a sufficiently witty and bored student comes along, reverse-engineers the checker code, and publishes the result on Facebook".

The classical not-really-secure scheme would look like this:

Use the counter from the previous scheme (the one with ends with three zeros). Encode it as a 64-bit block. Encrypt that block with some hardcoded symmetric key, using a block cipher. The checker knows the key, and verifies the serial number by decrypting it (with the same hardcoded symmetric key) and looking at the final zeros.

This is not really more secure than the plain counter, but at least the serial numbers will be random-looking. With an alphabet of 34 characters (digits and uppercase letters except 'O' and 'I'), a 64-bit block requires 13 letters, which is probably acceptable (a typical Microsoft serial number has 25 letters). For the 64-bit block cipher, I recommend XTEA, which should be fast and simple enough to implement.


Are there any FIPS140-2 requirements that apply when boot code is updated in the field? FIPS140-2 standard specifies the following conditional test to be performed by the cryptographic module if software or firmware components can be externally loaded into a cryptographic module:

An Approved authentication technique (e.g., an Approved message authentication code, digital signature algorithm, or HMAC) shall be applied to all validated software and firmware components when the components are externally loaded into a cryptographic module.  The software/firmware load test is not required for any software and firmware components excluded from the security requirements of this standard (refer to Section 4.1).
The calculated result shall be compared with a previously generated result.  If the calculated result does not equal the previously generated result, the software/firmware load test shall fail.

Section 4.1: Hardware, software, and firmware components of a cryptographic module can be excluded from the requirements of this standard if shown that these components do not affect the security of the module.

Should I argue that the boot code can be excluded according to Section 4.1, thus boot code does not affect the security of the module, since there are attacks that involve the boot code like "Evil Maid"?
Note: this cryptographic module is defined as a hardware cryptographic module. The cryptographic officer can upgrade the boot code that bootstraps the firmware implementing the cryptographic functionality.
Do I have to add a digital signature or HMAC for the new boot code when upgrading is desired OR should I argue to exclude it?

I assume the question is about security level 1? There are various FIPS 140-2 level 1 compliant software modules on the market and they don't require the boot code to be authenticated. I believe security level 3 would require a full integrity check of the software including the boot code.

For a better understanding of what is required for FIPS 140-2 certification I would suggest taking a look at some of the security policies linked to on this page on the NIST site. If you find a product on that page which is similar to your own you can use their security policy document as a basis for your security policy.


Tracing MAC addresses found in router logs How can I trace the following MAC addresses and find out who they are or belong to:
68:B9:D3:73:00:2F
98:E2:34:05:BD:8E

When checking my router, these MAC addresses were in the drop-down menu.

MAC addresses are only locally unique and it could be a spoofed address (if it an attack) as well. Therefore if you are referring to an attack, the best thing is to look at MAC addresses later.
If you have a chance to analyze ARP packets from your router you will be able to find the related IP addresses.
Or
If you suspect an inside attacker, you can check your ARP/RARPtable.
Or block these MAC addresses using MAC filtering. Users will complain when they are not able to use the internet. Before that, make sure all critical users are not using these MAC addresses.
In addition to that, try to identify the product vendor using a MAC lookup tool to look for the devices.
But It is really hard to find your network devices if they are connecting through multiple ways.


How can I reprogram a usb as a keyboard One of my recent posts has lead me to find that you can reprogram a usb drive to appear as a keyboard to a computer. I would like to know how to do this I am currently on a power google trying to find the answer I need (I know you can buy usb drives out there already but I want to make one!)

If i find any solutions I will answer this my self but maybe someone here can hasten the speed?

so to reiterate: How do I reprogram a USB drive to appear as a keyboard?

original question that this is based off:

How can USB sticks be dangerous?

Although that is possible, it's kinda hard to do that by yourself and it's for more advanced users. It requires lots of knowledge on low level programming and hardware.

It seems that what you want to accomplish here is the reprogramming of a USB flash drive's firmware to act as an HID (Human Interface Device). This is called a bad USB.

I found a tutorial called
How to Make Your Own Bad USB. The tutorial introduces you in more detail to what it is a bad USB and explains how to create one in Windows.
But the exploit described in this tutorial doesn't work on all USB flash drives. It has some specific requirements.

From the tutorial intro:

  Most common USB flash drives are exploitable due to the "Bad USB
  vulnerability". This allows us hackers to reprogram the
  microcontroller of them to act as a “Human Interface Device” (HID) /
  keyboard and perform custom keystrokes on our target machine. This
  scenario is often called “HID Payload Attack”, since you have to hand
  over your script to the Bad USB for the execution ( more on that later
  ). Even though almost every USB flash drive is exploitable, only a way
  to reprogram “Phison” microcontrollers has been released yet.

I haven't tried the tutorial, so I can't tell you if it will work, but nothing as trying it by yourself :)


Which methods should I connect a VPN, via that-vpn-app or through an VPN configuration on network manager linux? I saw there are 2 available methods (that I know of and currently focusing on) to connect to a vpn. The first one is through their application based of that vpn provider. The others is by configuring VPN Connections > OpenVpn.

I have searched on internet and found link1 and link2. Of course, method from link2 is easier and less complex than the method in link1, but this is not my main focus here. I can't find anywhere explain pros and cons of these 2 methods or any page explain why should a user pick one method over the others.

To be more specific in comparison, I have narrowed some areas to focus on below. Feel free to add more if there are something I should know, but missed.

Speed / overall performance of the connection
Security --> The permission that the VPN has accessed to on user's devices. I'm not sure if there is any major important thing to consider if compare between OSes. Feel free to add in the answer if you would like, but I current am focusing on linux.
Others. Please explain.

By the way, I used the link of the same VPN provider to show that there are actually more than 1 method to connect to the same VPN provider and not just something that varies between each VPN provider.

Unless a proprietary/custom VPN protocol is used, a VPN client application will typically be a wrapper around the same existing programs and protocols. If you were to study the application, you would very likely see that an OpenVPN binary and OpenVPN configs are used.

The application's main advantage is most often the user experience. Instead of manually downloading config files or finding what IP address you need to connect to when you want to switch location, the program can display high-level choices (e.g. VPN server location) through a fancy UI.

Another feature of these programs is that they sometimes can manipulate your firewall rules to ensure there are no leaks. Of course, you could set this up yourself if you wanted.

Otherwise, the performance and behavior of the VPN should be identical to that of OpenVPN alone.

However, any additional application you run on your system can increase your attack surface, creating opportunities for privilege escalation; e.g. the client application may run under your user, but may also require a root level daemon to manipulate your network configuration. Additionally, like with any application you install, you must trust it to not be malicious, although this is usually not a concern from well-known companies.


My system is being attacked or it is attacking My system is running on Windows 10. I am using Avast Free Antivirus. Today i got an update from Windows update. After installing that update Avast started raising notification saying

  We've safely aborted connection on because it was infected with smb:cve-2017-0144[Expl].

The detailed notification is shown in the in the image.

The IP 192.168.114.50 belongs to my LAN. The IP of my system is 192.168.114.72. I want to know if my system is attacking 192.168.114.50 or it is being attacked by 192.168.114.50.

I am confused because of url. I searched Avast Forums but could not get an explanation but a suggestion to block port 445. It confused me more by suspecting my system.

Reading the alert you have windows file sharing turned on(CIFS) and another machine 114.50 tried to connect and use an exploit related to CVE-2017-0144 . It would appear from the alert 114.50 is infected, run your AV/cleaner on that.


Does it weaken the encryption of SSH to use compression? When using compression on openssh (a la ssh -C ...), does this reduce entropy and make the tunnel traffic more vulnerable to cryptanalysis? Is compression an option I should disable server-side for this or any other reason?

I have a vague recollection of disabling compression being recommended for security reasons, but the rationale (if any) eludes me and my feeble Google queries.

Compression before encryption is a problem if the attacker can control parts of the transferred data and then use the detectable compression ratio (i.e. amount of transferred data vs. original data) to make conclusions about some of the traffic. This was in TLS used within BREACH and CRIME attacks to infer cookies and CSRF tokens. Making such attacks work requires the attacker to trigger repeated transmission of mostly the same data where the only difference is the attacker controlled part. This is feasible in several use cases of HTTPS.

While one might in theory use SSH in a similar scenario the common use case of SSH is not like this, i.e. the attacker has no control over parts of the input and can also not trigger sending nearly the same data again and again. In the common use cases of SSH compression before encryption is thus not a problem.


Course of actions after finding security flaw I've found what I believe is a significant security flaw on quite a big platform. It can be exploited to obtain on the orders of millions of email addresses with some additional data. They're big enough in that they have set up a customer support system, which is causing me great problems in getting in touch with the right person.

Is there a good course of action I can take in such circumstances?

Check whois - there may be usable contact information there.

you could try emailing postmaster@theirdomain - that's supposed to connect to a human admin of some type.

contact the cyber emergency response team. aka CERT, they may have a better means of contact. EG: www.us-cert.gov


PGP Key Signing Robot DKIM Verified Emails It occurred to me that DKIM verified emails, from major players (e.g., GMail), could open the door to more modern OpenPGP robot key signing authorities.

The idea would be to ask people to send a key singing request to a known address (e.g., robot@somedomain.com), and to sign their request with their OpenPGP key. The DKIM signature of that email would then be checked so as to verify that the requester has control over the claimed account (i.e., that GMail, for example, asserts that the email was sent by a valid / authenticated user). If everything checks out, the bot would sign the corresponding identity in the sender's public key, and send it back.

My understanding is that DKIM makes it much more difficult to spoof an email address when the "From: " header is included in the DKIM signature.

So, I ask the community here, what are some weaknesses or limitations of this approach? Here are some of the issues that I've considered:

In the past, DKIM keys were much too short (< 1024 bit RSA). This has been resolved.
DKIM public keys are hosted as DNS records, and plain-old DNS can be spoofed (perhaps pinning can be used for major players)
DKIM keys are perhaps less protected than other security credentials, as their primary purpose is to combat spam and phising (no solution?).

Are there other dangers I'm overlooking?

NOTE: For what it's worth, it would appear that keybase.io is toying with this idea (https://github.com/keybase/keybase-issues/issues/373)

DKIM only makes the promise that a specific mail server processed the mail. Only  DMARC creates is an association between the From header in the mail and the DKIM signature. But this association is restricted only to the domain part of the address, or even only the organizational domain depending on the restrictions in the DMARC record.

There is no proof that the mail address set in From-header of the mail is actually used in the MAIL FROM part of the SMTP dialog. I.e. it might be that the first is trusted@example.com while the second is attacker@example.com. Because the domain part of the From address still fits the DKIM signature everything looks fine.

It might be that the mail server will make sure that the sender given in the SMTP dialog and the From header will be the same. But I can find nothing about this in DKIM or DMARC specification. And while gmail and yahoo seem to rewrite From if it does not match the SMTP envelope there is no guarantee that others will do it too. This means, that you cannot use a DKIM signature to validate an E-mail address as long as you don't know how this case is handled by a specific mail provider now and also in the future.


How secure is a static site hosted on Amazon S3? I'm thinking about separating the static content from the dynamic content, and put the main www domain with the static content on Amazon S3. The main reason I want to do this is security. This site has a potential to be a target for hackers to break into. I don't have much knowledge in security, and I probably can't handle protecting it do a decent degree.

So is putting the main domain on Amazon S3 really solved all of my security concerns? Are static sites/files hosted on S3 known to be an easy or hard target for hackers? Are there any precautions I need to do by myself? (I already decided to have a separate account for s3 than my ec2 instances, to minimize the risk of hackers getting my security credentials. does that make sense?)

There is no way for us to determine whether this would be secure.   Security is a massively deep topic that requires extensive analysis and an ability to think like an attacker.  The best way to get this knowledge is the Web Application Hacker's Handbook.  It is an interesting and fun read, but more importantly you'll be full of security knowledge when you're done.

Statistically, chances are very good that a static HTML page on Amazon S3 is secure.  The reason is that the majority of vulnerabilities arise from improper handling of user input.  This shouldn't be an issue for you.

To improve your security, look through the source of your page for any leaked information.  Make sure you're not giving away sensitive information in comments.  I've seen this one before:

<!-- Use the DB administrator password for testing:  f@keP@a$$w0rD -->

Also don't think that giving your content a static but unlinked URL is providing security.  Security through obscurity is not really security.


Hashes, FTK vs Quickhash I was given a E01 image, along with a FTK generated checksum (MD5 & SHA1) to make sure nothing has been tampered with.

I installed filehash, and quickhash which gives me a hash that does not match the FTK-generated hash.

Why is that? It is a bit to bit copy of a memory card
If I add the E01 file to Autopsy the hash matches!
Why?

Edited:
In the E01.txt file there are FTK computed hashes
Adding the E01 file to Autopsy -> Match between E01 validator and FTK computed hash

Quickhash does not match with the computed hash. Why is this?

Because QuickHash hashes "the file", whereas FTK Imager hashes the internal content of an E01 set.

e.g. if you have 10 image segments (E01 - E010), each segment is a file on disk. It contains the acquired data from the original disk and various values pertinent to the E01 image like CRC checks and metadata. When Quickhash is passed one image segment, it reads the file and tells you the hash of it. When you open an E01 image in FTKi however, FTKi reads all 10 image segments together, ignores the metadata and CRC stuff and hashes the cummlative acquired data. That resulting hash value will match the original hash of the disk.

The QuickHash user manual also explains this.


User account password encryption by web based emails service providers? Do web based email providers like Gmail, hotmail encrypt user account passwords when saving them to their database? If they do, why does account information get leaked after a hack?

They are not encrypted, they are actually hashed: they are both cryptographic operation with the difference that hashes are irreversible.

One cannot simply "decrypt" a password hash. However, given a password, one can generate a hash for it.

If an attacker has obtained by some mean the content of the password hashes database, he can then think of a random password, compute its hash, compare this computed hash to check if it matches one the hashes stored in the database. If it does, then it means that the attacker has just guessed the right password for the corresponding user!

To make the process quicker, the attacker would use two main means:

Instead of thinking of a random password, he will use a very large list of the most frequently used passwords and dictionary words, which will usually already provide him a lot of accounts, but furthermore he will then automatically apply to these potential passwords a set of frequent transformations wrongly perceived as secure by a lot of users.
Some password cracking software allow to accelerate the hashing process by using the GPU (the graphic card processor) which happens to be quicker than the CPU for the cryptographic operations required to compute some hash (the effectiveness heavily depends on the exact hash algorithm used, modern recommended hash algorithm are specially thought to fight against this).

Such process will usually not allow to get all passwords from the leaked databases, but it will still allow to get a lot of them: all the weaker ones. So, if you use a strong password, and the website used a proper password hash method, then even in case of a database breach your password may still be safe


Further exploit self XSS I´m pentesting a clients website and found a self XSS Vulnerability in the Login Page: in case of a login error the Error Page shows the Username, so if you input <script>alert("XSS")</script> as User, it shows the alert box.
However, it´s probably not that likely, that users do that by themselves. So I´m looking for a way to further exploit this.
My first idea was to generate a link with the parameters of the POST Request in the URL so I would get a reflected XSS if somebody clicked it. But the username and password parameters are sent in the request body and not I the URL. And according to this answer: How to exploit XSS in POST request when parameter is going in body? it is not possible to craft a link with the body Parameters in the URL.
I´m guessing the application could have more problems with Input Validation but since this is a blackbox test I have no credentials and can only work with the Login Page. So does anyone have any ideas/could point me in the right direction how I could "upgrade" the self XSS to a more severe Vulnerability?
EDIT: Thanks for the Help, I managed to get a CSRF. In Case someone is reading this in the future: Burp Suite has a cool feature for this: right click on the Request, select Engagement Tools and then CSRF PoC. It will then create a basic HTML Page that submits the specified request if someone clicks the Button

Use the method described in the linked answer. The attacker creates a webpage with a form that automatically submits using JavaScript. Then the attacker submits the URL to the attacker's page to the victim.
If there is XSS in the username field, it is very likely that the application is vulnerable for XSS in many other places. So you may want to continue searching for a place that is easier to exploit.


Is there any way to restrict multiple access to my server at the same time using one client certificate? My Server is Windows 2008.

Mr. X is accessing my web server using Mr. X's certificate. In that time, an outsider is also trying to access my server using Mr. X's certificate (somehow he got it). Is it possible to disable multiple access using one certificate?

N.B: I mapped 900 certificates to my SSL-enabled server which was one-to-one mapping. No one else will be allowed to access my server. I used one user account to map all 900 certificates. But while testing I found that I can access my server from two different PCs using one client certificate at the same time. How can I resolve it? It would great if anyone can help me regarding this.

I'm not 100% if this can be done from the webserver layer, but your application itself can verify who is logged in.

Using PHP, this can be done using the following $_SERVER vars.  For example - in PHP-; using $_SERVER["SSL_CLIENT_S_DN_Email"], your application can determine if a particular user's email address (or SSL_CLIENT_M_SERIAL for the cert's serial number) is logged in already and take action (deny access, raise warning, ...) if a new "session" is initiated.  You'd need to keep track whether a user is "still logged in" though, usually through a timeout on last HTTP request.

Hope this helps,


Is it possible to clone my contactless debit card while it's in my pocket? I have a bank account that I never use, someone cloned my debit card and used it to buy something  in Brazil in order to make sure the cloning was successful then they started making transactions of £10 till they sucked everything in the account.
The account had a little bit over £50, the bank refunded the money straight away as I dont even use the card.

The question is how did they manage to clone my card if I dont use it? Yes it's in my pocket all the time but I never use it to make payment nor I check my balance at the ATM.

The only thing I can think of is that I recently spend a lot of time in the mosque where someone could sit next to me and like in movies use a device to clone my card, is such technology available?

If your debit card has an NFC chip on it (the "tap to pay"), it's possible.  This presentation discusses two methods.  One is skimming an NFC card and using the recovered data for making Card Not Present transactions online.  The other is called a "pre-play" attack, where "future transactions" are skimmed from the card in your pocket, and used to make purchases before you use the card again.  Ironically, you might have stopped some of these if you had used your card before the attacker had the chance to commit fraud.

Because it's possible, does that mean it's likely?  Hard to say.  But if it was in fact a case of NFC skimming, then you live, work, and pray very near someone who might target you again.  Consider keeping your NFC cards in an RF-blocking wallet, or leaving them at home.  Since it sounds like you rarely use them, this shouldn't alter the convenience factor much.

The good news is that your bank protected you from losses related to the theft, and that you don't have to worry too much about it.


How can I be sure that I'm downloading over SSL? Maybe I'm asking absolutely dumb question, but I couldn't find the answer yet. I know when I'm sending or getting a data in a browser over https, both server and client (browser) checks each other certificates. If everything is ok the data transfer starts.

Now I wonder how to handle all this stuff in my code? I'm using some framework which allows me to download data. When I'm specifying an address as https://... I downloading stuff. But I didn't specify any certificates (I don't have any!). So how does it works in my case? Is it really https?

Here's an example that confused me: I have some file in dropbox. I can download it with my code if I specify https address. But also I can download the same file if I specify just http!

If you are trying to write code for downloading data over TLS(SSL) you should consider if you know which hosts you are downloading from and use a technique caled certificate pinning.

Cert. pinning is hard-coding the certificate of the server you are connecting to in your code and only accepting the connection if it is made over TLS using the expected certificate. OWASP explains the concept here: https://www.owasp.org/index.php/Certificate_and_Public_Key_Pinning

But basically it comes down to you explicitly verifying the different details of the connection you are setting up. More information about the framework and scenario would help.